From 445c90ff9ae57fdd089e7472d51442414d0dbf8f Mon Sep 17 00:00:00 2001 From: Grahame Grieve Date: Sun, 24 Feb 2019 21:31:47 +1100 Subject: [PATCH] test --- org.hl7.fhir.convertors/.classpath | 1 + .../convertors/IGR2ConvertorAdvisor5.java | 67 + .../fhir/convertors/R2016MayToR5Loader.java | 156 + .../org/hl7/fhir/convertors/R2ToR5Loader.java | 153 + .../org/hl7/fhir/convertors/R3ToR5Loader.java | 171 + .../org/hl7/fhir/convertors/R4ToR5Loader.java | 171 + .../convertors/SpecDifferenceEvaluator.java | 93 +- .../convertors/TerminologyClientFactory.java | 13 +- .../fhir/convertors/TerminologyClientR2.java | 16 +- .../fhir/convertors/TerminologyClientR3.java | 32 +- .../fhir/convertors/TerminologyClientR4.java | 96 + .../convertors/VersionConvertorAdvisor50.java | 39 + .../convertors/VersionConvertor_10_50.java | 12260 +++++++++ .../convertors/VersionConvertor_14_50.java | 6933 +++++ .../convertors/VersionConvertor_30_50.java | 21553 ++++++++++++++++ .../convertors/VersionConvertor_40_50.java | 3837 +++ .../fhir/convertors/conv40_50/Account.java | 181 + .../conv40_50/ActivityDefinition.java | 419 + .../convertors/conv40_50/AdverseEvent.java | 215 + .../conv40_50/AllergyIntolerance.java | 255 + .../convertors/conv40_50/Appointment.java | 265 + .../conv40_50/AppointmentResponse.java | 115 + .../fhir/convertors/conv40_50/AuditEvent.java | 367 + .../hl7/fhir/convertors/conv40_50/Basic.java | 79 + .../hl7/fhir/convertors/conv40_50/Binary.java | 71 + .../conv40_50/BiologicallyDerivedProduct.java | 287 + .../convertors/conv40_50/BodyStructure.java | 91 + .../hl7/fhir/convertors/conv40_50/Bundle.java | 335 + .../conv40_50/CapabilityStatement.java | 829 + .../fhir/convertors/conv40_50/CarePlan.java | 391 + .../fhir/convertors/conv40_50/CareTeam.java | 169 + .../convertors/conv40_50/CatalogEntry.java | 155 + .../fhir/convertors/conv40_50/ChargeItem.java | 217 + .../conv40_50/ChargeItemDefinition.java | 263 + .../hl7/fhir/convertors/conv40_50/Claim.java | 709 + .../convertors/conv40_50/ClaimResponse.java | 713 + .../conv40_50/ClinicalImpression.java | 213 + .../fhir/convertors/conv40_50/CodeSystem.java | 433 + .../convertors/conv40_50/Communication.java | 227 + .../conv40_50/CommunicationRequest.java | 221 + .../conv40_50/CompartmentDefinition.java | 169 + .../convertors/conv40_50/Composition.java | 377 + .../fhir/convertors/conv40_50/ConceptMap.java | 325 + .../fhir/convertors/conv40_50/Condition.java | 179 + .../fhir/convertors/conv40_50/Consent.java | 343 + .../fhir/convertors/conv40_50/Contract.java | 907 + .../fhir/convertors/conv40_50/Coverage.java | 231 + .../conv40_50/CoverageEligibilityRequest.java | 295 + .../CoverageEligibilityResponse.java | 343 + .../convertors/conv40_50/DetectedIssue.java | 213 + .../hl7/fhir/convertors/conv40_50/Device.java | 387 + .../conv40_50/DeviceDefinition.java | 331 + .../convertors/conv40_50/DeviceMetric.java | 255 + .../convertors/conv40_50/DeviceRequest.java | 267 + .../conv40_50/DeviceUseStatement.java | 139 + .../conv40_50/DiagnosticReport.java | 191 + .../conv40_50/DocumentManifest.java | 131 + .../conv40_50/DocumentReference.java | 263 + .../conv40_50/EffectEvidenceSynthesis.java | 399 + .../fhir/convertors/conv40_50/Encounter.java | 397 + .../fhir/convertors/conv40_50/Endpoint.java | 131 + .../conv40_50/EnrollmentRequest.java | 111 + .../conv40_50/EnrollmentResponse.java | 139 + .../convertors/conv40_50/Enumerations.java | 287 + .../convertors/conv40_50/EpisodeOfCare.java | 189 + .../convertors/conv40_50/EventDefinition.java | 171 + .../fhir/convertors/conv40_50/Evidence.java | 171 + .../conv40_50/EvidenceVariable.java | 261 + .../convertors/conv40_50/ExampleScenario.java | 731 + .../conv40_50/ExplanationOfBenefit.java | 1197 + .../conv40_50/FamilyMemberHistory.java | 191 + .../hl7/fhir/convertors/conv40_50/Flag.java | 113 + .../hl7/fhir/convertors/conv40_50/Goal.java | 185 + .../convertors/conv40_50/GraphDefinition.java | 301 + .../hl7/fhir/convertors/conv40_50/Group.java | 187 + .../conv40_50/GuidanceResponse.java | 147 + .../conv40_50/HealthcareService.java | 265 + .../convertors/conv40_50/ImagingStudy.java | 285 + .../convertors/conv40_50/Immunization.java | 313 + .../conv40_50/ImmunizationEvaluation.java | 131 + .../conv40_50/ImmunizationRecommendation.java | 167 + .../conv40_50/ImplementationGuide.java | 1235 + .../convertors/conv40_50/InsurancePlan.java | 379 + .../fhir/convertors/conv40_50/Invoice.java | 261 + .../fhir/convertors/conv40_50/Library.java | 183 + .../fhir/convertors/conv40_50/Linkage.java | 117 + .../convertors/conv40_50/ListResource.java | 187 + .../fhir/convertors/conv40_50/Location.java | 259 + .../fhir/convertors/conv40_50/Measure.java | 375 + .../convertors/conv40_50/MeasureReport.java | 317 + .../hl7/fhir/convertors/conv40_50/Media.java | 179 + .../fhir/convertors/conv40_50/Medication.java | 165 + .../conv40_50/MedicationAdministration.java | 199 + .../conv40_50/MedicationDispense.java | 211 + .../conv40_50/MedicationKnowledge.java | 551 + .../conv40_50/MedicationRequest.java | 367 + .../conv40_50/MedicationStatement.java | 159 + .../conv40_50/MedicinalProduct.java | 303 + .../MedicinalProductAuthorization.java | 191 + .../MedicinalProductContraindication.java | 111 + .../conv40_50/MedicinalProductIndication.java | 119 + .../conv40_50/MedicinalProductIngredient.java | 219 + .../MedicinalProductInteraction.java | 107 + .../MedicinalProductManufactured.java | 87 + .../conv40_50/MedicinalProductPackaged.java | 183 + .../MedicinalProductPharmaceutical.java | 207 + .../MedicinalProductUndesirableEffect.java | 79 + .../conv40_50/MessageDefinition.java | 257 + .../convertors/conv40_50/MessageHeader.java | 221 + .../conv40_50/MolecularSequence.java | 569 + .../convertors/conv40_50/NamingSystem.java | 193 + .../convertors/conv40_50/NutritionOrder.java | 395 + .../convertors/conv40_50/Observation.java | 263 + .../conv40_50/ObservationDefinition.java | 251 + .../conv40_50/OperationDefinition.java | 335 + .../conv40_50/OperationOutcome.java | 205 + .../convertors/conv40_50/Organization.java | 131 + .../conv40_50/OrganizationAffiliation.java | 107 + .../fhir/convertors/conv40_50/Parameters.java | 94 + .../fhir/convertors/conv40_50/Patient.java | 239 + .../convertors/conv40_50/PaymentNotice.java | 131 + .../conv40_50/PaymentReconciliation.java | 247 + .../hl7/fhir/convertors/conv40_50/Person.java | 147 + .../convertors/conv40_50/PlanDefinition.java | 695 + .../convertors/conv40_50/Practitioner.java | 131 + .../conv40_50/PractitionerRole.java | 201 + .../fhir/convertors/conv40_50/Procedure.java | 255 + .../fhir/convertors/conv40_50/Provenance.java | 185 + .../convertors/conv40_50/Questionnaire.java | 399 + .../conv40_50/QuestionnaireResponse.java | 189 + .../convertors/conv40_50/RelatedPerson.java | 131 + .../convertors/conv40_50/RequestGroup.java | 531 + .../conv40_50/ResearchDefinition.java | 195 + .../conv40_50/ResearchElementDefinition.java | 327 + .../convertors/conv40_50/ResearchStudy.java | 245 + .../convertors/conv40_50/ResearchSubject.java | 133 + .../convertors/conv40_50/RiskAssessment.java | 199 + .../conv40_50/RiskEvidenceSynthesis.java | 343 + .../fhir/convertors/conv40_50/Schedule.java | 91 + .../convertors/conv40_50/SearchParameter.java | 287 + .../convertors/conv40_50/ServiceRequest.java | 279 + .../hl7/fhir/convertors/conv40_50/Slot.java | 129 + .../fhir/convertors/conv40_50/Specimen.java | 251 + .../conv40_50/SpecimenDefinition.java | 251 + .../conv40_50/StructureDefinition.java | 329 + .../convertors/conv40_50/StructureMap.java | 613 + .../convertors/conv40_50/Subscription.java | 169 + .../fhir/convertors/conv40_50/Substance.java | 161 + .../conv40_50/SubstanceNucleicAcid.java | 187 + .../conv40_50/SubstancePolymer.java | 259 + .../conv40_50/SubstanceProtein.java | 123 + .../SubstanceReferenceInformation.java | 215 + .../conv40_50/SubstanceSourceMaterial.java | 299 + .../conv40_50/SubstanceSpecification.java | 523 + .../convertors/conv40_50/SupplyDelivery.java | 151 + .../convertors/conv40_50/SupplyRequest.java | 197 + .../hl7/fhir/convertors/conv40_50/Task.java | 357 + .../conv40_50/TerminologyCapabilities.java | 457 + .../fhir/convertors/conv40_50/TestReport.java | 423 + .../fhir/convertors/conv40_50/TestScript.java | 847 + .../fhir/convertors/conv40_50/ValueSet.java | 429 + .../conv40_50/VerificationResult.java | 263 + .../conv40_50/VisionPrescription.java | 255 + .../org/hl7/fhir/r4/model/Enumerations.java | 5 + .../java/org/hl7/fhir/r5/model/Constants.java | 2 +- .../org/hl7/fhir/r5/model/Enumerations.java | 13 + ...ClientR4.java => TerminologyClientR5.java} | 4 +- .../hl7/fhir/utilities/cache/NpmPackage.java | 11 + org.hl7.fhir.validation/.classpath | 1 + .../fhir/r4/validation/InstanceValidator.java | 11 +- .../r4/validation/NativeHostServices.java | 4 +- .../fhir/r4/validation/ValidationEngine.java | 12 +- .../hl7/fhir/r5/validation/BaseValidator.java | 517 + .../r5/validation/CodeSystemValidator.java | 59 + .../DefaultEnableWhenEvaluator.java | 216 + .../fhir/r5/validation/EnableWhenResult.java | 48 + .../r5/validation/IEnableWhenEvaluator.java | 10 + .../fhir/r5/validation/InstanceValidator.java | 4404 ++++ .../validation/InstanceValidatorFactory.java | 37 + .../r5/validation/NativeHostServices.java | 425 + .../fhir/r5/validation/ProfileValidator.java | 131 + .../fhir/r5/validation/ValidationEngine.java | 1052 + .../org/hl7/fhir/r5/validation/Validator.java | 534 + .../hl7/fhir/r5/validation/XmlValidator.java | 234 + .../conversion/tests/R3R4ConversionTests.java | 4 +- .../tests/CDAValidationTestCase.java | 2 +- .../tests/InstanceValidatorR4Test.java | 50 +- .../tests/NativeHostServiceTester.java | 2 +- .../validation/tests/TransformationTests.java | 2 +- .../tests/ValidationEngineTests.java | 10 +- .../validation/tests/ValidationTestSuite.java | 50 +- 191 files changed, 94576 insertions(+), 139 deletions(-) create mode 100644 org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/IGR2ConvertorAdvisor5.java create mode 100644 org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/R2016MayToR5Loader.java create mode 100644 org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/R2ToR5Loader.java create mode 100644 org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/R3ToR5Loader.java create mode 100644 org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/R4ToR5Loader.java create mode 100644 org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/TerminologyClientR4.java create mode 100644 org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/VersionConvertorAdvisor50.java create mode 100644 org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/VersionConvertor_10_50.java create mode 100644 org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/VersionConvertor_14_50.java create mode 100644 org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/VersionConvertor_30_50.java create mode 100644 org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/VersionConvertor_40_50.java create mode 100644 org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Account.java create mode 100644 org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/ActivityDefinition.java create mode 100644 org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/AdverseEvent.java create mode 100644 org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/AllergyIntolerance.java create mode 100644 org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Appointment.java create mode 100644 org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/AppointmentResponse.java create mode 100644 org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/AuditEvent.java create mode 100644 org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Basic.java create mode 100644 org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Binary.java create mode 100644 org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/BiologicallyDerivedProduct.java create mode 100644 org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/BodyStructure.java create mode 100644 org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Bundle.java create mode 100644 org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/CapabilityStatement.java create mode 100644 org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/CarePlan.java create mode 100644 org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/CareTeam.java create mode 100644 org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/CatalogEntry.java create mode 100644 org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/ChargeItem.java create mode 100644 org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/ChargeItemDefinition.java create mode 100644 org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Claim.java create mode 100644 org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/ClaimResponse.java create mode 100644 org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/ClinicalImpression.java create mode 100644 org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/CodeSystem.java create mode 100644 org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Communication.java create mode 100644 org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/CommunicationRequest.java create mode 100644 org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/CompartmentDefinition.java create mode 100644 org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Composition.java create mode 100644 org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/ConceptMap.java create mode 100644 org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Condition.java create mode 100644 org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Consent.java create mode 100644 org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Contract.java create mode 100644 org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Coverage.java create mode 100644 org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/CoverageEligibilityRequest.java create mode 100644 org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/CoverageEligibilityResponse.java create mode 100644 org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/DetectedIssue.java create mode 100644 org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Device.java create mode 100644 org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/DeviceDefinition.java create mode 100644 org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/DeviceMetric.java create mode 100644 org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/DeviceRequest.java create mode 100644 org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/DeviceUseStatement.java create mode 100644 org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/DiagnosticReport.java create mode 100644 org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/DocumentManifest.java create mode 100644 org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/DocumentReference.java create mode 100644 org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/EffectEvidenceSynthesis.java create mode 100644 org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Encounter.java create mode 100644 org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Endpoint.java create mode 100644 org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/EnrollmentRequest.java create mode 100644 org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/EnrollmentResponse.java create mode 100644 org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Enumerations.java create mode 100644 org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/EpisodeOfCare.java create mode 100644 org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/EventDefinition.java create mode 100644 org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Evidence.java create mode 100644 org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/EvidenceVariable.java create mode 100644 org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/ExampleScenario.java create mode 100644 org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/ExplanationOfBenefit.java create mode 100644 org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/FamilyMemberHistory.java create mode 100644 org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Flag.java create mode 100644 org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Goal.java create mode 100644 org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/GraphDefinition.java create mode 100644 org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Group.java create mode 100644 org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/GuidanceResponse.java create mode 100644 org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/HealthcareService.java create mode 100644 org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/ImagingStudy.java create mode 100644 org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Immunization.java create mode 100644 org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/ImmunizationEvaluation.java create mode 100644 org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/ImmunizationRecommendation.java create mode 100644 org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/ImplementationGuide.java create mode 100644 org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/InsurancePlan.java create mode 100644 org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Invoice.java create mode 100644 org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Library.java create mode 100644 org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Linkage.java create mode 100644 org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/ListResource.java create mode 100644 org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Location.java create mode 100644 org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Measure.java create mode 100644 org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/MeasureReport.java create mode 100644 org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Media.java create mode 100644 org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Medication.java create mode 100644 org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/MedicationAdministration.java create mode 100644 org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/MedicationDispense.java create mode 100644 org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/MedicationKnowledge.java create mode 100644 org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/MedicationRequest.java create mode 100644 org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/MedicationStatement.java create mode 100644 org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/MedicinalProduct.java create mode 100644 org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/MedicinalProductAuthorization.java create mode 100644 org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/MedicinalProductContraindication.java create mode 100644 org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/MedicinalProductIndication.java create mode 100644 org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/MedicinalProductIngredient.java create mode 100644 org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/MedicinalProductInteraction.java create mode 100644 org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/MedicinalProductManufactured.java create mode 100644 org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/MedicinalProductPackaged.java create mode 100644 org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/MedicinalProductPharmaceutical.java create mode 100644 org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/MedicinalProductUndesirableEffect.java create mode 100644 org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/MessageDefinition.java create mode 100644 org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/MessageHeader.java create mode 100644 org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/MolecularSequence.java create mode 100644 org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/NamingSystem.java create mode 100644 org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/NutritionOrder.java create mode 100644 org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Observation.java create mode 100644 org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/ObservationDefinition.java create mode 100644 org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/OperationDefinition.java create mode 100644 org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/OperationOutcome.java create mode 100644 org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Organization.java create mode 100644 org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/OrganizationAffiliation.java create mode 100644 org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Parameters.java create mode 100644 org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Patient.java create mode 100644 org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/PaymentNotice.java create mode 100644 org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/PaymentReconciliation.java create mode 100644 org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Person.java create mode 100644 org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/PlanDefinition.java create mode 100644 org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Practitioner.java create mode 100644 org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/PractitionerRole.java create mode 100644 org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Procedure.java create mode 100644 org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Provenance.java create mode 100644 org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Questionnaire.java create mode 100644 org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/QuestionnaireResponse.java create mode 100644 org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/RelatedPerson.java create mode 100644 org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/RequestGroup.java create mode 100644 org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/ResearchDefinition.java create mode 100644 org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/ResearchElementDefinition.java create mode 100644 org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/ResearchStudy.java create mode 100644 org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/ResearchSubject.java create mode 100644 org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/RiskAssessment.java create mode 100644 org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/RiskEvidenceSynthesis.java create mode 100644 org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Schedule.java create mode 100644 org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/SearchParameter.java create mode 100644 org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/ServiceRequest.java create mode 100644 org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Slot.java create mode 100644 org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Specimen.java create mode 100644 org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/SpecimenDefinition.java create mode 100644 org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/StructureDefinition.java create mode 100644 org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/StructureMap.java create mode 100644 org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Subscription.java create mode 100644 org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Substance.java create mode 100644 org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/SubstanceNucleicAcid.java create mode 100644 org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/SubstancePolymer.java create mode 100644 org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/SubstanceProtein.java create mode 100644 org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/SubstanceReferenceInformation.java create mode 100644 org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/SubstanceSourceMaterial.java create mode 100644 org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/SubstanceSpecification.java create mode 100644 org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/SupplyDelivery.java create mode 100644 org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/SupplyRequest.java create mode 100644 org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Task.java create mode 100644 org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/TerminologyCapabilities.java create mode 100644 org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/TestReport.java create mode 100644 org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/TestScript.java create mode 100644 org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/ValueSet.java create mode 100644 org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/VerificationResult.java create mode 100644 org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/VisionPrescription.java rename org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/terminologies/{TerminologyClientR4.java => TerminologyClientR5.java} (94%) create mode 100644 org.hl7.fhir.validation/src/main/java/org/hl7/fhir/r5/validation/BaseValidator.java create mode 100644 org.hl7.fhir.validation/src/main/java/org/hl7/fhir/r5/validation/CodeSystemValidator.java create mode 100644 org.hl7.fhir.validation/src/main/java/org/hl7/fhir/r5/validation/DefaultEnableWhenEvaluator.java create mode 100644 org.hl7.fhir.validation/src/main/java/org/hl7/fhir/r5/validation/EnableWhenResult.java create mode 100644 org.hl7.fhir.validation/src/main/java/org/hl7/fhir/r5/validation/IEnableWhenEvaluator.java create mode 100644 org.hl7.fhir.validation/src/main/java/org/hl7/fhir/r5/validation/InstanceValidator.java create mode 100644 org.hl7.fhir.validation/src/main/java/org/hl7/fhir/r5/validation/InstanceValidatorFactory.java create mode 100644 org.hl7.fhir.validation/src/main/java/org/hl7/fhir/r5/validation/NativeHostServices.java create mode 100644 org.hl7.fhir.validation/src/main/java/org/hl7/fhir/r5/validation/ProfileValidator.java create mode 100644 org.hl7.fhir.validation/src/main/java/org/hl7/fhir/r5/validation/ValidationEngine.java create mode 100644 org.hl7.fhir.validation/src/main/java/org/hl7/fhir/r5/validation/Validator.java create mode 100644 org.hl7.fhir.validation/src/main/java/org/hl7/fhir/r5/validation/XmlValidator.java diff --git a/org.hl7.fhir.convertors/.classpath b/org.hl7.fhir.convertors/.classpath index 1ddf83a39..4004b7589 100644 --- a/org.hl7.fhir.convertors/.classpath +++ b/org.hl7.fhir.convertors/.classpath @@ -35,5 +35,6 @@ + diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/IGR2ConvertorAdvisor5.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/IGR2ConvertorAdvisor5.java new file mode 100644 index 000000000..3d1dec2c3 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/IGR2ConvertorAdvisor5.java @@ -0,0 +1,67 @@ +package org.hl7.fhir.convertors; + +/*- + * #%L + * org.hl7.fhir.convertors + * %% + * Copyright (C) 2015 - 2019 Health Level 7 + * %% + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * #L% + */ + + +import org.hl7.fhir.dstu2.model.Resource; +import org.hl7.fhir.exceptions.FHIRException; +import org.hl7.fhir.r5.model.Bundle.BundleEntryComponent; +import org.hl7.fhir.r5.model.CodeSystem; +import org.hl7.fhir.r5.model.ValueSet; + +public class IGR2ConvertorAdvisor5 implements VersionConvertorAdvisor50 { + + @Override + public boolean ignoreEntry(BundleEntryComponent src) { + return false; + } + + @Override + public Resource convertR2(org.hl7.fhir.r5.model.Resource resource) throws FHIRException { + return null; + } + + @Override + public org.hl7.fhir.dstu2016may.model.Resource convertR2016May(org.hl7.fhir.r5.model.Resource resource) throws FHIRException { + return null; + } + + @Override + public org.hl7.fhir.dstu3.model.Resource convertR3(org.hl7.fhir.r5.model.Resource resource) throws FHIRException { + return null; + } + + @Override + public void handleCodeSystem(CodeSystem cs, ValueSet vs) { + cs.setId(vs.getId()); + } + + @Override + public CodeSystem getCodeSystem(ValueSet src) { + return null; + } + + @Override + public org.hl7.fhir.r4.model.Resource convertR4(org.hl7.fhir.r5.model.Resource resource) throws FHIRException { + return null; + } + +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/R2016MayToR5Loader.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/R2016MayToR5Loader.java new file mode 100644 index 000000000..38c6af7f9 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/R2016MayToR5Loader.java @@ -0,0 +1,156 @@ +package org.hl7.fhir.convertors; + +/*- + * #%L + * org.hl7.fhir.convertors + * %% + * Copyright (C) 2014 - 2019 Health Level 7 + * %% + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * #L% + */ + + +import java.io.IOException; +import java.io.InputStream; +import java.util.ArrayList; +import java.util.List; +import java.util.UUID; + +import org.hl7.fhir.dstu2016may.formats.JsonParser; +import org.hl7.fhir.dstu2016may.formats.XmlParser; +import org.hl7.fhir.dstu2016may.model.Resource; +import org.hl7.fhir.exceptions.FHIRException; +import org.hl7.fhir.r5.conformance.ProfileUtilities; +import org.hl7.fhir.r5.context.SimpleWorkerContext.IContextResourceLoader; +import org.hl7.fhir.r5.model.Bundle; +import org.hl7.fhir.r5.model.Bundle.BundleEntryComponent; +import org.hl7.fhir.r5.model.Bundle.BundleType; +import org.hl7.fhir.r5.model.CodeSystem; +import org.hl7.fhir.r5.model.MetadataResource; +import org.hl7.fhir.r5.model.StructureDefinition; +import org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionKind; +import org.hl7.fhir.r5.model.UriType; +import org.hl7.fhir.r5.model.ValueSet; + +public class R2016MayToR5Loader implements IContextResourceLoader, VersionConvertorAdvisor50 { + + private List cslist = new ArrayList<>(); + private boolean patchUrls; + private boolean killPrimitives;; + + @Override + public Bundle loadBundle(InputStream stream, boolean isJson) throws FHIRException, IOException { + Resource r2016may = null; + if (isJson) + r2016may = new JsonParser().parse(stream); + else + r2016may = new XmlParser().parse(stream); + org.hl7.fhir.r5.model.Resource r5 = VersionConvertor_14_50.convertResource(r2016may); + + Bundle b; + if (r5 instanceof Bundle) + b = (Bundle) r5; + else { + b = new Bundle(); + b.setId(UUID.randomUUID().toString().toLowerCase()); + b.setType(BundleType.COLLECTION); + b.addEntry().setResource(r5).setFullUrl(r5 instanceof MetadataResource ? ((MetadataResource) r5).getUrl() : null); + } + + for (CodeSystem cs : cslist) { + BundleEntryComponent be = b.addEntry(); + be.setFullUrl(cs.getUrl()); + be.setResource(cs); + } + if (killPrimitives) { + List remove = new ArrayList(); + for (BundleEntryComponent be : b.getEntry()) { + if (be.hasResource() && be.getResource() instanceof StructureDefinition) { + StructureDefinition sd = (StructureDefinition) be.getResource(); + if (sd.getKind() == StructureDefinitionKind.PRIMITIVETYPE) + remove.add(be); + } + } + b.getEntry().removeAll(remove); + } + for (BundleEntryComponent be : b.getEntry()) { + if (be.hasResource() && be.getResource() instanceof StructureDefinition) { + StructureDefinition sd = (StructureDefinition) be.getResource(); + new ProfileUtilities(null, null, null).setIds(sd, false); + if (patchUrls) { + sd.setUrl(sd.getUrl().replace("http://hl7.org/fhir/", "http://hl7.org/fhir/2016May/")); + sd.addExtension().setUrl("http://hl7.org/fhir/StructureDefinition/elementdefinition-namespace").setValue(new UriType("http://hl7.org/fhir")); + } + } + } + return b; + } + + @Override + public boolean ignoreEntry(BundleEntryComponent src) { + return false; + } + + @Override + public org.hl7.fhir.dstu2.model.Resource convertR2(org.hl7.fhir.r5.model.Resource resource) throws FHIRException { + return null; + } + + @Override + public Resource convertR2016May(org.hl7.fhir.r5.model.Resource resource) throws FHIRException { + return null; + } + + @Override + public org.hl7.fhir.dstu3.model.Resource convertR3(org.hl7.fhir.r5.model.Resource resource) throws FHIRException { + return null; + } + + @Override + public void handleCodeSystem(CodeSystem cs, ValueSet vs) { + cs.setId(vs.getId()); + cs.setValueSet(vs.getUrl()); + cslist.add(cs); + + } + + @Override + public CodeSystem getCodeSystem(ValueSet src) { + return null; + } + + public boolean isPatchUrls() { + return patchUrls; + } + + public R2016MayToR5Loader setPatchUrls(boolean patchUrls) { + this.patchUrls = patchUrls; + return this; + } + + public boolean isKillPrimitives() { + return killPrimitives; + } + + public R2016MayToR5Loader setKillPrimitives(boolean killPrimitives) { + this.killPrimitives = killPrimitives; + return this; + } + + @Override + public org.hl7.fhir.r4.model.Resource convertR4(org.hl7.fhir.r5.model.Resource resource) throws FHIRException { + return null; + } + +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/R2ToR5Loader.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/R2ToR5Loader.java new file mode 100644 index 000000000..474295654 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/R2ToR5Loader.java @@ -0,0 +1,153 @@ +package org.hl7.fhir.convertors; + +/*- + * #%L + * org.hl7.fhir.convertors + * %% + * Copyright (C) 2015 - 2019 Health Level 7 + * %% + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * #L% + */ + + +import java.io.IOException; +import java.io.InputStream; +import java.util.ArrayList; +import java.util.List; +import java.util.UUID; + +import org.hl7.fhir.dstu2.formats.JsonParser; +import org.hl7.fhir.dstu2.formats.XmlParser; +import org.hl7.fhir.dstu2.model.Resource; +import org.hl7.fhir.exceptions.FHIRException; +import org.hl7.fhir.r5.context.SimpleWorkerContext.IContextResourceLoader; +import org.hl7.fhir.r5.model.Bundle; +import org.hl7.fhir.r5.model.Bundle.BundleEntryComponent; +import org.hl7.fhir.r5.model.Bundle.BundleType; +import org.hl7.fhir.r5.model.CodeSystem; +import org.hl7.fhir.r5.model.MetadataResource; +import org.hl7.fhir.r5.model.StructureDefinition; +import org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionKind; +import org.hl7.fhir.r5.model.UriType; +import org.hl7.fhir.r5.model.ValueSet; + +public class R2ToR5Loader implements IContextResourceLoader, VersionConvertorAdvisor50 { + + private List cslist = new ArrayList<>(); + private boolean patchUrls; + private boolean killPrimitives;; + + @Override + public Bundle loadBundle(InputStream stream, boolean isJson) throws FHIRException, IOException { + Resource r2 = null; + if (isJson) + r2 = new JsonParser().parse(stream); + else + r2 = new XmlParser().parse(stream); + org.hl7.fhir.r5.model.Resource r5 = new VersionConvertor_10_50(this).convertResource(r2); + Bundle b; + if (r5 instanceof Bundle) + b = (Bundle) r5; + else { + b = new Bundle(); + b.setId(UUID.randomUUID().toString().toLowerCase()); + b.setType(BundleType.COLLECTION); + b.addEntry().setResource(r5).setFullUrl(r5 instanceof MetadataResource ? ((MetadataResource) r5).getUrl() : null); + } + // Add any code systems defined as part of processing value sets to the end of the converted Bundle + for (CodeSystem cs : cslist) { + BundleEntryComponent be = b.addEntry(); + be.setFullUrl(cs.getUrl()); + be.setResource(cs); + } + cslist.clear(); + if (killPrimitives) { + List remove = new ArrayList(); + for (BundleEntryComponent be : b.getEntry()) { + if (be.hasResource() && be.getResource() instanceof StructureDefinition) { + StructureDefinition sd = (StructureDefinition) be.getResource(); + if (sd.getKind() == StructureDefinitionKind.PRIMITIVETYPE) + remove.add(be); + } + } + b.getEntry().removeAll(remove); + } + if (patchUrls) { + for (BundleEntryComponent be : b.getEntry()) { + if (be.hasResource() && be.getResource() instanceof StructureDefinition) { + StructureDefinition sd = (StructureDefinition) be.getResource(); + sd.setUrl(sd.getUrl().replace("http://hl7.org/fhir/", "http://hl7.org/fhir/DSTU2/")); + sd.addExtension().setUrl("http://hl7.org/fhir/StructureDefinition/elementdefinition-namespace").setValue(new UriType("http://hl7.org/fhir")); + } + } + } + return b; + } + + @Override + public boolean ignoreEntry(BundleEntryComponent src) { + return false; + } + + @Override + public Resource convertR2(org.hl7.fhir.r5.model.Resource resource) throws FHIRException { + return null; + } + + @Override + public org.hl7.fhir.dstu2016may.model.Resource convertR2016May(org.hl7.fhir.r5.model.Resource resource) throws FHIRException { + return null; + } + + public org.hl7.fhir.dstu3.model.Resource convertR3(org.hl7.fhir.r5.model.Resource resource) throws FHIRException { + return null; + } + + @Override + public void handleCodeSystem(CodeSystem cs, ValueSet vs) { + cs.setId(vs.getId()); + cs.setValueSet(vs.getUrl()); + cslist.add(cs); + + } + + @Override + public CodeSystem getCodeSystem(ValueSet src) { + return null; + } + + public boolean isPatchUrls() { + return patchUrls; + } + + public R2ToR5Loader setPatchUrls(boolean patchUrls) { + this.patchUrls = patchUrls; + return this; + } + + public boolean isKillPrimitives() { + return killPrimitives; + } + + public R2ToR5Loader setKillPrimitives(boolean killPrimitives) { + this.killPrimitives = killPrimitives; + return this; + } + + @Override + public org.hl7.fhir.r4.model.Resource convertR4(org.hl7.fhir.r5.model.Resource resource) throws FHIRException { + return null; + } + +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/R3ToR5Loader.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/R3ToR5Loader.java new file mode 100644 index 000000000..dc1e0dbee --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/R3ToR5Loader.java @@ -0,0 +1,171 @@ +package org.hl7.fhir.convertors; + +/*- + * #%L + * org.hl7.fhir.convertors + * %% + * Copyright (C) 2015 - 2019 Health Level 7 + * %% + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * #L% + */ + + +import java.io.IOException; +import java.io.InputStream; +import java.util.ArrayList; +import java.util.List; +import java.util.UUID; + +import org.hl7.fhir.dstu3.formats.JsonParser; +import org.hl7.fhir.dstu3.formats.XmlParser; +import org.hl7.fhir.dstu3.model.Resource; +import org.hl7.fhir.exceptions.FHIRException; +import org.hl7.fhir.r5.context.SimpleWorkerContext.IContextResourceLoader; +import org.hl7.fhir.r5.model.Bundle; +import org.hl7.fhir.r5.model.Bundle.BundleEntryComponent; +import org.hl7.fhir.r5.model.Bundle.BundleType; +import org.hl7.fhir.r5.model.CanonicalType; +import org.hl7.fhir.r5.model.CodeSystem; +import org.hl7.fhir.r5.model.ElementDefinition; +import org.hl7.fhir.r5.model.ElementDefinition.TypeRefComponent; +import org.hl7.fhir.r5.model.MetadataResource; +import org.hl7.fhir.r5.model.StructureDefinition; +import org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionKind; +import org.hl7.fhir.r5.model.UriType; +import org.hl7.fhir.r5.model.ValueSet; + +public class R3ToR5Loader implements IContextResourceLoader, VersionConvertorAdvisor50 { + + private List cslist = new ArrayList<>(); + private boolean patchUrls; + private boolean killPrimitives;; + + @Override + public Bundle loadBundle(InputStream stream, boolean isJson) throws FHIRException, IOException { + Resource r3 = null; + if (isJson) + r3 = new JsonParser().parse(stream); + else + r3 = new XmlParser().parse(stream); + org.hl7.fhir.r5.model.Resource r5 = VersionConvertor_30_50.convertResource(r3, false); + + Bundle b; + if (r5 instanceof Bundle) + b = (Bundle) r5; + else { + b = new Bundle(); + b.setId(UUID.randomUUID().toString().toLowerCase()); + b.setType(BundleType.COLLECTION); + b.addEntry().setResource(r5).setFullUrl(r5 instanceof MetadataResource ? ((MetadataResource) r5).getUrl() : null); + } + for (CodeSystem cs : cslist) { + BundleEntryComponent be = b.addEntry(); + be.setFullUrl(cs.getUrl()); + be.setResource(cs); + } + if (killPrimitives) { + List remove = new ArrayList(); + for (BundleEntryComponent be : b.getEntry()) { + if (be.hasResource() && be.getResource() instanceof StructureDefinition) { + StructureDefinition sd = (StructureDefinition) be.getResource(); + if (sd.getKind() == StructureDefinitionKind.PRIMITIVETYPE) + remove.add(be); + } + } + b.getEntry().removeAll(remove); + } + if (patchUrls) { + for (BundleEntryComponent be : b.getEntry()) { + if (be.hasResource() && be.getResource() instanceof StructureDefinition) { + StructureDefinition sd = (StructureDefinition) be.getResource(); + sd.setUrl(sd.getUrl().replace("http://hl7.org/fhir/", "http://hl7.org/fhir/3.0/")); + sd.addExtension().setUrl("http://hl7.org/fhir/StructureDefinition/elementdefinition-namespace").setValue(new UriType("http://hl7.org/fhir")); + for (ElementDefinition ed : sd.getSnapshot().getElement()) + patchUrl(ed); + for (ElementDefinition ed : sd.getDifferential().getElement()) + patchUrl(ed); + } + } + } + return b; + } + + private void patchUrl(ElementDefinition ed) { + for (TypeRefComponent tr : ed.getType()) { + for (CanonicalType s : tr.getTargetProfile()) { + s.setValue(s.getValue().replace("http://hl7.org/fhir/", "http://hl7.org/fhir/3.0/")); + } + for (CanonicalType s : tr.getProfile()) { + s.setValue(s.getValue().replace("http://hl7.org/fhir/", "http://hl7.org/fhir/3.0/")); + } + } + } + + @Override + public boolean ignoreEntry(BundleEntryComponent src) { + return false; + } + + @Override + public org.hl7.fhir.dstu2.model.Resource convertR2(org.hl7.fhir.r5.model.Resource resource) throws FHIRException { + return null; + } + + @Override + public org.hl7.fhir.dstu2016may.model.Resource convertR2016May(org.hl7.fhir.r5.model.Resource resource) throws FHIRException { + return null; + } + + @Override + public Resource convertR3(org.hl7.fhir.r5.model.Resource resource) throws FHIRException { + return null; + } + + @Override + public void handleCodeSystem(CodeSystem cs, ValueSet vs) { + cs.setId(vs.getId()); + cs.setValueSet(vs.getUrl()); + cslist.add(cs); + + } + + @Override + public CodeSystem getCodeSystem(ValueSet src) { + return null; + } + + public boolean isPatchUrls() { + return patchUrls; + } + + public R3ToR5Loader setPatchUrls(boolean patchUrls) { + this.patchUrls = patchUrls; + return this; + } + + public boolean isKillPrimitives() { + return killPrimitives; + } + + public R3ToR5Loader setKillPrimitives(boolean killPrimitives) { + this.killPrimitives = killPrimitives; + return this; + } + + @Override + public org.hl7.fhir.r4.model.Resource convertR4(org.hl7.fhir.r5.model.Resource resource) throws FHIRException { + return null; + } + +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/R4ToR5Loader.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/R4ToR5Loader.java new file mode 100644 index 000000000..f1bb1f469 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/R4ToR5Loader.java @@ -0,0 +1,171 @@ +package org.hl7.fhir.convertors; + +/*- + * #%L + * org.hl7.fhir.convertors + * %% + * Copyright (C) 2015 - 2019 Health Level 7 + * %% + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * #L% + */ + + +import java.io.IOException; +import java.io.InputStream; +import java.util.ArrayList; +import java.util.List; +import java.util.UUID; + +import org.hl7.fhir.r4.formats.JsonParser; +import org.hl7.fhir.r4.formats.XmlParser; +import org.hl7.fhir.r4.model.Resource; +import org.hl7.fhir.exceptions.FHIRException; +import org.hl7.fhir.r5.context.SimpleWorkerContext.IContextResourceLoader; +import org.hl7.fhir.r5.model.Bundle; +import org.hl7.fhir.r5.model.Bundle.BundleEntryComponent; +import org.hl7.fhir.r5.model.Bundle.BundleType; +import org.hl7.fhir.r5.model.CanonicalType; +import org.hl7.fhir.r5.model.CodeSystem; +import org.hl7.fhir.r5.model.ElementDefinition; +import org.hl7.fhir.r5.model.ElementDefinition.TypeRefComponent; +import org.hl7.fhir.r5.model.MetadataResource; +import org.hl7.fhir.r5.model.StructureDefinition; +import org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionKind; +import org.hl7.fhir.r5.model.UriType; +import org.hl7.fhir.r5.model.ValueSet; + +public class R4ToR5Loader implements IContextResourceLoader, VersionConvertorAdvisor50 { + + private List cslist = new ArrayList<>(); + private boolean patchUrls; + private boolean killPrimitives;; + + @Override + public Bundle loadBundle(InputStream stream, boolean isJson) throws FHIRException, IOException { + Resource r4 = null; + if (isJson) + r4 = new JsonParser().parse(stream); + else + r4 = new XmlParser().parse(stream); + org.hl7.fhir.r5.model.Resource r5 = VersionConvertor_40_50.convertResource(r4); + + Bundle b; + if (r5 instanceof Bundle) + b = (Bundle) r5; + else { + b = new Bundle(); + b.setId(UUID.randomUUID().toString().toLowerCase()); + b.setType(BundleType.COLLECTION); + b.addEntry().setResource(r5).setFullUrl(r5 instanceof MetadataResource ? ((MetadataResource) r5).getUrl() : null); + } + for (CodeSystem cs : cslist) { + BundleEntryComponent be = b.addEntry(); + be.setFullUrl(cs.getUrl()); + be.setResource(cs); + } + if (killPrimitives) { + List remove = new ArrayList(); + for (BundleEntryComponent be : b.getEntry()) { + if (be.hasResource() && be.getResource() instanceof StructureDefinition) { + StructureDefinition sd = (StructureDefinition) be.getResource(); + if (sd.getKind() == StructureDefinitionKind.PRIMITIVETYPE) + remove.add(be); + } + } + b.getEntry().removeAll(remove); + } + if (patchUrls) { + for (BundleEntryComponent be : b.getEntry()) { + if (be.hasResource() && be.getResource() instanceof StructureDefinition) { + StructureDefinition sd = (StructureDefinition) be.getResource(); + sd.setUrl(sd.getUrl().replace("http://hl7.org/fhir/", "http://hl7.org/fhir/4.0/")); + sd.addExtension().setUrl("http://hl7.org/fhir/StructureDefinition/elementdefinition-namespace").setValue(new UriType("http://hl7.org/fhir")); + for (ElementDefinition ed : sd.getSnapshot().getElement()) + patchUrl(ed); + for (ElementDefinition ed : sd.getDifferential().getElement()) + patchUrl(ed); + } + } + } + return b; + } + + private void patchUrl(ElementDefinition ed) { + for (TypeRefComponent tr : ed.getType()) { + for (CanonicalType s : tr.getTargetProfile()) { + s.setValue(s.getValue().replace("http://hl7.org/fhir/", "http://hl7.org/fhir/4.0/")); + } + for (CanonicalType s : tr.getProfile()) { + s.setValue(s.getValue().replace("http://hl7.org/fhir/", "http://hl7.org/fhir/4.0/")); + } + } + } + + @Override + public boolean ignoreEntry(BundleEntryComponent src) { + return false; + } + + @Override + public org.hl7.fhir.dstu2.model.Resource convertR2(org.hl7.fhir.r5.model.Resource resource) throws FHIRException { + return null; + } + + @Override + public org.hl7.fhir.dstu2016may.model.Resource convertR2016May(org.hl7.fhir.r5.model.Resource resource) throws FHIRException { + return null; + } + + @Override + public Resource convertR4(org.hl7.fhir.r5.model.Resource resource) throws FHIRException { + return null; + } + + @Override + public void handleCodeSystem(CodeSystem cs, ValueSet vs) { + cs.setId(vs.getId()); + cs.setValueSet(vs.getUrl()); + cslist.add(cs); + + } + + @Override + public CodeSystem getCodeSystem(ValueSet src) { + return null; + } + + public boolean isPatchUrls() { + return patchUrls; + } + + public R4ToR5Loader setPatchUrls(boolean patchUrls) { + this.patchUrls = patchUrls; + return this; + } + + public boolean isKillPrimitives() { + return killPrimitives; + } + + public R4ToR5Loader setKillPrimitives(boolean killPrimitives) { + this.killPrimitives = killPrimitives; + return this; + } + + @Override + public org.hl7.fhir.dstu3.model.Resource convertR3(org.hl7.fhir.r5.model.Resource resource) throws FHIRException { + return null; + } + +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/SpecDifferenceEvaluator.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/SpecDifferenceEvaluator.java index 74dd4697d..882c13f71 100644 --- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/SpecDifferenceEvaluator.java +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/SpecDifferenceEvaluator.java @@ -34,27 +34,27 @@ import java.util.Set; import org.hl7.fhir.exceptions.FHIRException; import org.hl7.fhir.exceptions.FHIRFormatError; -import org.hl7.fhir.r4.elementmodel.Manager.FhirFormat; -import org.hl7.fhir.r4.formats.IParser.OutputStyle; -import org.hl7.fhir.r4.formats.JsonParser; -import org.hl7.fhir.r4.formats.XmlParser; -import org.hl7.fhir.r4.model.Base; -import org.hl7.fhir.r4.model.Bundle; -import org.hl7.fhir.r4.model.Bundle.BundleEntryComponent; -import org.hl7.fhir.r4.model.CanonicalType; -import org.hl7.fhir.r4.model.ElementDefinition; -import org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionBindingComponent; -import org.hl7.fhir.r4.model.ElementDefinition.TypeRefComponent; -import org.hl7.fhir.r4.model.Enumerations.BindingStrength; -import org.hl7.fhir.r4.model.PrimitiveType; -import org.hl7.fhir.r4.model.Resource; -import org.hl7.fhir.r4.model.StructureDefinition; -import org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionKind; -import org.hl7.fhir.r4.model.Type; -import org.hl7.fhir.r4.model.UriType; -import org.hl7.fhir.r4.model.ValueSet; -import org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionContainsComponent; -import org.hl7.fhir.r4.utils.ToolingExtensions; +import org.hl7.fhir.r5.elementmodel.Manager.FhirFormat; +import org.hl7.fhir.r5.formats.IParser.OutputStyle; +import org.hl7.fhir.r5.formats.JsonParser; +import org.hl7.fhir.r5.formats.XmlParser; +import org.hl7.fhir.r5.model.Base; +import org.hl7.fhir.r5.model.Bundle; +import org.hl7.fhir.r5.model.Bundle.BundleEntryComponent; +import org.hl7.fhir.r5.model.CanonicalType; +import org.hl7.fhir.r5.model.ElementDefinition; +import org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionBindingComponent; +import org.hl7.fhir.r5.model.ElementDefinition.TypeRefComponent; +import org.hl7.fhir.r5.model.Enumerations.BindingStrength; +import org.hl7.fhir.r5.model.PrimitiveType; +import org.hl7.fhir.r5.model.Resource; +import org.hl7.fhir.r5.model.StructureDefinition; +import org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionKind; +import org.hl7.fhir.r5.model.Type; +import org.hl7.fhir.r5.model.UriType; +import org.hl7.fhir.r5.model.ValueSet; +import org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionContainsComponent; +import org.hl7.fhir.r5.utils.ToolingExtensions; import org.hl7.fhir.utilities.CommaSeparatedStringBuilder; import org.hl7.fhir.utilities.IniFile; import org.hl7.fhir.utilities.TextFile; @@ -117,10 +117,11 @@ public class SpecDifferenceEvaluator { public void loadFromIni(IniFile ini) { - String[] names = ini.getPropertyNames("r3-renames"); - for (String n : names) - // note reverse of order - renames.put(ini.getStringProperty("r3-renames", n), n); + String[] names = ini.getPropertyNames("r5-renames"); + if (names != null) + for (String n : names) + // note reverse of order + renames.put(ini.getStringProperty("r5-renames", n), n); } public SpecPackage getOriginal() { @@ -137,13 +138,13 @@ public class SpecDifferenceEvaluator { // loadVS2(self.original.valuesets, "C:\\work\\org.hl7.fhir.dstu2.original\\build\\publish\\valuesets.xml"); // loadVS(self.revision.valuesets, "C:\\work\\org.hl7.fhir.dstu2.original\\build\\publish\\valuesets.xml"); - loadSD3(self.original.types, "C:\\work\\org.hl7.fhir\\build\\source\\release3\\profiles-types.xml"); + loadSD4(self.original.types, "C:\\work\\org.hl7.fhir\\build\\source\\release4\\profiles-types.xml"); loadSD(self.revision.types, "C:\\work\\org.hl7.fhir\\build\\publish\\profiles-types.xml"); - loadSD3(self.original.resources, "C:\\work\\org.hl7.fhir\\build\\source\\release3\\profiles-resources.xml"); + loadSD4(self.original.resources, "C:\\work\\org.hl7.fhir\\build\\source\\release4\\profiles-resources.xml"); loadSD(self.revision.resources, "C:\\work\\org.hl7.fhir\\build\\publish\\profiles-resources.xml"); - loadVS3(self.original.expansions, "C:\\work\\org.hl7.fhir\\build\\source\\release3\\expansions.xml"); + loadVS4(self.original.expansions, "C:\\work\\org.hl7.fhir\\build\\source\\release4\\expansions.xml"); loadVS(self.revision.expansions, "C:\\work\\org.hl7.fhir\\build\\publish\\expansions.xml"); - loadVS3(self.original.valuesets, "C:\\work\\org.hl7.fhir\\build\\source\\release3\\valuesets.xml"); + loadVS4(self.original.valuesets, "C:\\work\\org.hl7.fhir\\build\\source\\release4\\valuesets.xml"); loadVS(self.revision.valuesets, "C:\\work\\org.hl7.fhir\\build\\publish\\valuesets.xml"); StringBuilder b = new StringBuilder(); b.append("\r\n"); @@ -158,12 +159,12 @@ public class SpecDifferenceEvaluator { System.out.println("done"); } - private static void loadSD3(Map map, String fn) throws FHIRException, FileNotFoundException, IOException { - org.hl7.fhir.dstu3.model.Bundle bundle = (org.hl7.fhir.dstu3.model.Bundle) new org.hl7.fhir.dstu3.formats.XmlParser().parse(new FileInputStream(fn)); - for (org.hl7.fhir.dstu3.model.Bundle.BundleEntryComponent be : bundle.getEntry()) { - if (be.getResource() instanceof org.hl7.fhir.dstu3.model.StructureDefinition) { - org.hl7.fhir.dstu3.model.StructureDefinition sd = (org.hl7.fhir.dstu3.model.StructureDefinition) be.getResource(); - map.put(sd.getName(), VersionConvertor_30_40.convertStructureDefinition(sd)); + private static void loadSD4(Map map, String fn) throws FHIRException, FileNotFoundException, IOException { + org.hl7.fhir.r4.model.Bundle bundle = (org.hl7.fhir.r4.model.Bundle) new org.hl7.fhir.r4.formats.XmlParser().parse(new FileInputStream(fn)); + for (org.hl7.fhir.r4.model.Bundle.BundleEntryComponent be : bundle.getEntry()) { + if (be.getResource() instanceof org.hl7.fhir.r4.model.StructureDefinition) { + org.hl7.fhir.r4.model.StructureDefinition sd = (org.hl7.fhir.r4.model.StructureDefinition) be.getResource(); + map.put(sd.getName(), org.hl7.fhir.convertors.conv40_50.StructureDefinition.convertStructureDefinition(sd)); } } @@ -178,12 +179,12 @@ public class SpecDifferenceEvaluator { } } - private static void loadVS3(Map map, String fn) throws FHIRException, FileNotFoundException, IOException { - org.hl7.fhir.dstu3.model.Bundle bundle = (org.hl7.fhir.dstu3.model.Bundle) new org.hl7.fhir.dstu3.formats.XmlParser().parse(new FileInputStream(fn)); - for (org.hl7.fhir.dstu3.model.Bundle.BundleEntryComponent be : bundle.getEntry()) { - if (be.getResource() instanceof org.hl7.fhir.dstu3.model.ValueSet) { - org.hl7.fhir.dstu3.model.ValueSet sd = (org.hl7.fhir.dstu3.model.ValueSet) be.getResource(); - map.put(sd.getName(), VersionConvertor_30_40.convertValueSet(sd)); + private static void loadVS4(Map map, String fn) throws FHIRException, FileNotFoundException, IOException { + org.hl7.fhir.r4.model.Bundle bundle = (org.hl7.fhir.r4.model.Bundle) new org.hl7.fhir.r4.formats.XmlParser().parse(new FileInputStream(fn)); + for (org.hl7.fhir.r4.model.Bundle.BundleEntryComponent be : bundle.getEntry()) { + if (be.getResource() instanceof org.hl7.fhir.r4.model.ValueSet) { + org.hl7.fhir.r4.model.ValueSet sd = (org.hl7.fhir.r4.model.ValueSet) be.getResource(); + map.put(sd.getName(), org.hl7.fhir.convertors.conv40_50.ValueSet.convertValueSet(sd)); } } } @@ -540,11 +541,11 @@ public class SpecDifferenceEvaluator { // now, look for matches by name (ignoring slicing for now) String tp = mapPath(tn, target.getPath()); if (tp.endsWith("[x]")) - tp = tp.substring(0, tp.length()-3); + tp = tp.substring(0, tp.length()-4); for (ElementDefinition ed : list) { String p = ed.getPath(); if (p.endsWith("[x]")) - p = p.substring(0, p.length()-3); + p = p.substring(0, p.length()-4); if (p.equals(tp)) return ed; } @@ -966,7 +967,7 @@ public class SpecDifferenceEvaluator { } } - public void saveR2AsR3(ZipGenerator zip, FhirFormat fmt) throws IOException { + public void saveR4AsR5(ZipGenerator zip, FhirFormat fmt) throws IOException { for (StructureDefinition t : original.types.values()) saveResource(zip, t, fmt); for (StructureDefinition t : original.resources.values()) @@ -1242,6 +1243,8 @@ public class SpecDifferenceEvaluator { if (Utilities.noString(r) && Utilities.existsInList(rev.getId(), "Element.id", "Extension.url")) r = "string"; String o = describeType(orig.getType().get(0)); + if (Utilities.noString(o) && Utilities.existsInList(orig.getId(), "Element.id", "Extension.url")) + o = "string"; if (!o.equals(r)) { oa.add(new JsonPrimitive(o)); ra.add(new JsonPrimitive(r)); @@ -1297,6 +1300,8 @@ public class SpecDifferenceEvaluator { if (Utilities.noString(r) && Utilities.existsInList(rev.getId(), "Element.id", "Extension.url")) r = "string"; String o = describeType(orig.getType().get(0)); + if (Utilities.noString(o) && Utilities.existsInList(orig.getId(), "Element.id", "Extension.url")) + o = "string"; if (!o.equals(r)) { element.appendChild(makeElementWithAttribute(doc, "removed-type", "name", o)); element.appendChild(makeElementWithAttribute(doc, "added-type", "name", r)); diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/TerminologyClientFactory.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/TerminologyClientFactory.java index a3e925f34..698c8e3e6 100644 --- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/TerminologyClientFactory.java +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/TerminologyClientFactory.java @@ -23,26 +23,27 @@ package org.hl7.fhir.convertors; import java.net.URISyntaxException; -import org.hl7.fhir.r4.model.FhirPublication; -import org.hl7.fhir.r4.terminologies.TerminologyClient; -import org.hl7.fhir.r4.terminologies.TerminologyClientR4; +import org.hl7.fhir.r5.model.FhirPublication; +import org.hl7.fhir.r5.terminologies.TerminologyClient; +import org.hl7.fhir.r5.terminologies.TerminologyClientR5; import org.hl7.fhir.utilities.Utilities; public class TerminologyClientFactory { public static TerminologyClient makeClient(String url, FhirPublication v) throws URISyntaxException { if (v == null) - return new TerminologyClientR4(checkEndsWith("/r4", url)); + return new TerminologyClientR5(checkEndsWith("/r4", url)); switch (v) { case DSTU2016May: return new TerminologyClientR3(checkEndsWith("/r3", url)); // r3 is the least worst match case DSTU1: throw new Error("The version "+v.toString()+" is not currently supported"); case DSTU2: return new TerminologyClientR2(checkEndsWith("/r2", url)); - case R4: return new TerminologyClientR4(checkEndsWith("/r4", url)); + case R4: return new TerminologyClientR5(checkEndsWith("/r4", url)); + case R5: return new TerminologyClientR5(checkEndsWith("/r4", url)); // r4 for now, since the terminology is currently the same case STU3: return new TerminologyClientR3(checkEndsWith("/r3", url)); default: throw new Error("The version "+v.toString()+" is not currently supported"); } - } + private static String checkEndsWith(String term, String url) { if (url.endsWith(term)) return url; diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/TerminologyClientR2.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/TerminologyClientR2.java index 0784699bd..82e468d56 100644 --- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/TerminologyClientR2.java +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/TerminologyClientR2.java @@ -26,21 +26,21 @@ import java.util.Map; import org.hl7.fhir.dstu2.utils.client.FHIRToolingClient; import org.hl7.fhir.exceptions.FHIRException; -import org.hl7.fhir.r4.context.HTMLClientLogger; -import org.hl7.fhir.r4.model.CapabilityStatement; -import org.hl7.fhir.r4.model.Parameters; -import org.hl7.fhir.r4.model.TerminologyCapabilities; -import org.hl7.fhir.r4.model.ValueSet; -import org.hl7.fhir.r4.terminologies.TerminologyClient; +import org.hl7.fhir.r5.context.HTMLClientLogger; +import org.hl7.fhir.r5.model.CapabilityStatement; +import org.hl7.fhir.r5.model.Parameters; +import org.hl7.fhir.r5.model.TerminologyCapabilities; +import org.hl7.fhir.r5.model.ValueSet; +import org.hl7.fhir.r5.terminologies.TerminologyClient; public class TerminologyClientR2 implements TerminologyClient { private FHIRToolingClient client; // todo: use the R2 client - private VersionConvertor_10_40 conv; + private VersionConvertor_10_50 conv; public TerminologyClientR2(String address) throws URISyntaxException { client = new FHIRToolingClient(address); - conv = new VersionConvertor_10_40(null); + conv = new VersionConvertor_10_50(null); } @Override diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/TerminologyClientR3.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/TerminologyClientR3.java index d3ba54a7f..eac4201a1 100644 --- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/TerminologyClientR3.java +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/TerminologyClientR3.java @@ -26,12 +26,12 @@ import java.util.Map; import org.hl7.fhir.dstu3.utils.client.FHIRToolingClient; import org.hl7.fhir.exceptions.FHIRException; -import org.hl7.fhir.r4.context.HTMLClientLogger; -import org.hl7.fhir.r4.model.CapabilityStatement; -import org.hl7.fhir.r4.model.Parameters; -import org.hl7.fhir.r4.model.TerminologyCapabilities; -import org.hl7.fhir.r4.model.ValueSet; -import org.hl7.fhir.r4.terminologies.TerminologyClient; +import org.hl7.fhir.r5.context.HTMLClientLogger; +import org.hl7.fhir.r5.model.CapabilityStatement; +import org.hl7.fhir.r5.model.Parameters; +import org.hl7.fhir.r5.model.TerminologyCapabilities; +import org.hl7.fhir.r5.model.ValueSet; +import org.hl7.fhir.r5.terminologies.TerminologyClient; public class TerminologyClientR3 implements TerminologyClient { @@ -43,7 +43,7 @@ public class TerminologyClientR3 implements TerminologyClient { @Override public TerminologyCapabilities getTerminologyCapabilities() throws FHIRException { - return (TerminologyCapabilities) VersionConvertor_30_40.convertTerminologyCapabilities(client.getTerminologyCapabilities(), false); + return (TerminologyCapabilities) VersionConvertor_30_50.convertTerminologyCapabilities(client.getTerminologyCapabilities(), false); } @Override @@ -53,24 +53,24 @@ public class TerminologyClientR3 implements TerminologyClient { @Override public ValueSet expandValueset(ValueSet vs, Parameters p, Map params) throws FHIRException { - org.hl7.fhir.dstu3.model.ValueSet vs2 = (org.hl7.fhir.dstu3.model.ValueSet) VersionConvertor_30_40.convertResource(vs, false); - org.hl7.fhir.dstu3.model.ExpansionProfile p2 = (org.hl7.fhir.dstu3.model.ExpansionProfile) VersionConvertor_30_40.convertResource(p, false); + org.hl7.fhir.dstu3.model.ValueSet vs2 = (org.hl7.fhir.dstu3.model.ValueSet) VersionConvertor_30_50.convertResource(vs, false); + org.hl7.fhir.dstu3.model.ExpansionProfile p2 = (org.hl7.fhir.dstu3.model.ExpansionProfile) VersionConvertor_30_50.convertResource(p, false); vs2 = client.expandValueset(vs2, p2, params); // todo: second parameter - return (ValueSet) VersionConvertor_30_40.convertResource(vs2, false); + return (ValueSet) VersionConvertor_30_50.convertResource(vs2, false); } @Override public Parameters validateCS(Parameters pin) throws FHIRException { - org.hl7.fhir.dstu3.model.Parameters p2 = (org.hl7.fhir.dstu3.model.Parameters) VersionConvertor_30_40.convertResource(pin, false); + org.hl7.fhir.dstu3.model.Parameters p2 = (org.hl7.fhir.dstu3.model.Parameters) VersionConvertor_30_50.convertResource(pin, false); p2 = client.operateType(org.hl7.fhir.dstu3.model.CodeSystem.class, "validate-code", p2); - return (Parameters) VersionConvertor_30_40.convertResource(p2, false); + return (Parameters) VersionConvertor_30_50.convertResource(p2, false); } @Override public Parameters validateVS(Parameters pin) throws FHIRException { - org.hl7.fhir.dstu3.model.Parameters p2 = (org.hl7.fhir.dstu3.model.Parameters) VersionConvertor_30_40.convertResource(pin, false); + org.hl7.fhir.dstu3.model.Parameters p2 = (org.hl7.fhir.dstu3.model.Parameters) VersionConvertor_30_50.convertResource(pin, false); p2 = client.operateType(org.hl7.fhir.dstu3.model.ValueSet.class, "validate-code", p2); - return (Parameters) VersionConvertor_30_40.convertResource(p2, false); + return (Parameters) VersionConvertor_30_50.convertResource(p2, false); } @Override @@ -85,12 +85,12 @@ public class TerminologyClientR3 implements TerminologyClient { @Override public CapabilityStatement getCapabilitiesStatementQuick() throws FHIRException { - return (CapabilityStatement) VersionConvertor_30_40.convertResource(client.getCapabilitiesStatementQuick(), false); + return (CapabilityStatement) VersionConvertor_30_50.convertResource(client.getCapabilitiesStatementQuick(), false); } @Override public Parameters lookupCode(Map params) throws FHIRException { - return (Parameters) VersionConvertor_30_40.convertResource(client.lookupCode(params), false); + return (Parameters) VersionConvertor_30_50.convertResource(client.lookupCode(params), false); } } diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/TerminologyClientR4.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/TerminologyClientR4.java new file mode 100644 index 000000000..5cdc46c82 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/TerminologyClientR4.java @@ -0,0 +1,96 @@ +package org.hl7.fhir.convertors; + +/*- + * #%L + * org.hl7.fhir.convertors + * %% + * Copyright (C) 2014 - 2019 Health Level 7 + * %% + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * #L% + */ + + +import java.net.URISyntaxException; +import java.util.Map; + +import org.hl7.fhir.r4.utils.client.FHIRToolingClient; +import org.hl7.fhir.exceptions.FHIRException; +import org.hl7.fhir.r5.context.HTMLClientLogger; +import org.hl7.fhir.r5.model.CapabilityStatement; +import org.hl7.fhir.r5.model.Parameters; +import org.hl7.fhir.r5.model.TerminologyCapabilities; +import org.hl7.fhir.r5.model.ValueSet; +import org.hl7.fhir.r5.terminologies.TerminologyClient; + +public class TerminologyClientR4 implements TerminologyClient { + + private FHIRToolingClient client; // todo: use the R2 client + + public TerminologyClientR4(String address) throws URISyntaxException { + client = new FHIRToolingClient(address); + } + + @Override + public TerminologyCapabilities getTerminologyCapabilities() throws FHIRException { + return (TerminologyCapabilities) org.hl7.fhir.convertors.conv40_50.TerminologyCapabilities.convertTerminologyCapabilities(client.getTerminologyCapabilities()); + } + + @Override + public String getAddress() { + return client.getAddress(); + } + + @Override + public ValueSet expandValueset(ValueSet vs, Parameters p, Map params) throws FHIRException { + org.hl7.fhir.r4.model.ValueSet vs2 = (org.hl7.fhir.r4.model.ValueSet) VersionConvertor_40_50.convertResource(vs); + org.hl7.fhir.r4.model.Parameters p2 = (org.hl7.fhir.r4.model.Parameters) VersionConvertor_40_50.convertResource(p); + vs2 = client.expandValueset(vs2, p2, params); // todo: second parameter + return (ValueSet) VersionConvertor_40_50.convertResource(vs2); + } + + @Override + public Parameters validateCS(Parameters pin) throws FHIRException { + org.hl7.fhir.r4.model.Parameters p2 = (org.hl7.fhir.r4.model.Parameters) VersionConvertor_40_50.convertResource(pin); + p2 = client.operateType(org.hl7.fhir.r4.model.CodeSystem.class, "validate-code", p2); + return (Parameters) VersionConvertor_40_50.convertResource(p2); + } + + @Override + public Parameters validateVS(Parameters pin) throws FHIRException { + org.hl7.fhir.r4.model.Parameters p2 = (org.hl7.fhir.r4.model.Parameters) VersionConvertor_40_50.convertResource(pin); + p2 = client.operateType(org.hl7.fhir.r4.model.ValueSet.class, "validate-code", p2); + return (Parameters) VersionConvertor_40_50.convertResource(p2); + } + + @Override + public void setTimeout(int i) { + // ignored in this version - need to roll R4 internal changes back to R2 if desired + } + + @Override + public void setLogger(HTMLClientLogger txLog) { + // ignored in this version - need to roll R4 internal changes back to R2 if desired + } + + @Override + public CapabilityStatement getCapabilitiesStatementQuick() throws FHIRException { + return (CapabilityStatement) VersionConvertor_40_50.convertResource(client.getCapabilitiesStatementQuick()); + } + + @Override + public Parameters lookupCode(Map params) throws FHIRException { + return (Parameters) VersionConvertor_40_50.convertResource(client.lookupCode(params)); + } + +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/VersionConvertorAdvisor50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/VersionConvertorAdvisor50.java new file mode 100644 index 000000000..ec79a1e79 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/VersionConvertorAdvisor50.java @@ -0,0 +1,39 @@ +package org.hl7.fhir.convertors; + +/*- + * #%L + * org.hl7.fhir.convertors + * %% + * Copyright (C) 2014 - 2019 Health Level 7 + * %% + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * #L% + */ + + +import org.hl7.fhir.exceptions.FHIRException; + +public interface VersionConvertorAdvisor50 { + boolean ignoreEntry(org.hl7.fhir.r5.model.Bundle.BundleEntryComponent src); + + // called ? + org.hl7.fhir.dstu2.model.Resource convertR2(org.hl7.fhir.r5.model.Resource resource) throws FHIRException; + org.hl7.fhir.dstu2016may.model.Resource convertR2016May(org.hl7.fhir.r5.model.Resource resource) throws FHIRException; + org.hl7.fhir.dstu3.model.Resource convertR3(org.hl7.fhir.r5.model.Resource resource) throws FHIRException; + org.hl7.fhir.r4.model.Resource convertR4(org.hl7.fhir.r5.model.Resource resource) throws FHIRException; + + // called when an r2 value set has a codeSystem in it + void handleCodeSystem(org.hl7.fhir.r5.model.CodeSystem tgtcs, org.hl7.fhir.r5.model.ValueSet source) throws FHIRException; + + org.hl7.fhir.r5.model.CodeSystem getCodeSystem(org.hl7.fhir.r5.model.ValueSet src) throws FHIRException; +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/VersionConvertor_10_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/VersionConvertor_10_50.java new file mode 100644 index 000000000..26dd1d656 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/VersionConvertor_10_50.java @@ -0,0 +1,12260 @@ +package org.hl7.fhir.convertors; + +/*- + * #%L + * org.hl7.fhir.convertors + * %% + * Copyright (C) 2014 - 2019 Health Level 7 + * %% + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * #L% + */ + + +import java.util.ArrayList; +import java.util.List; + +import org.hl7.fhir.dstu2.model.CodeableConcept; +import org.hl7.fhir.dstu2.model.ImplementationGuide.GuidePageKind; +import org.hl7.fhir.dstu2.model.Parameters; +import org.hl7.fhir.dstu2.model.Parameters.ParametersParameterComponent; +import org.hl7.fhir.dstu2.model.Reference; +import org.hl7.fhir.dstu2.utils.ToolingExtensions; +import org.hl7.fhir.exceptions.FHIRException; +import org.hl7.fhir.r5.conformance.ProfileUtilities; +import org.hl7.fhir.r5.model.Annotation; +import org.hl7.fhir.r5.model.BooleanType; +import org.hl7.fhir.r5.model.CanonicalType; +import org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestComponent; +import org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceComponent; +import org.hl7.fhir.r5.model.CapabilityStatement.SystemRestfulInteraction; +import org.hl7.fhir.r5.model.CodeSystem; +import org.hl7.fhir.r5.model.CodeSystem.CodeSystemContentMode; +import org.hl7.fhir.r5.model.CodeSystem.ConceptDefinitionComponent; +import org.hl7.fhir.r5.model.CodeSystem.ConceptDefinitionDesignationComponent; +import org.hl7.fhir.r5.model.ConceptMap; +import org.hl7.fhir.r5.model.ConceptMap.ConceptMapGroupComponent; +import org.hl7.fhir.r5.model.ConceptMap.SourceElementComponent; +import org.hl7.fhir.r5.model.ContactDetail; +import org.hl7.fhir.r5.model.DocumentReference.ReferredDocumentStatus; +import org.hl7.fhir.r5.model.Dosage; +import org.hl7.fhir.r5.model.Dosage.DosageDoseAndRateComponent; +import org.hl7.fhir.r5.model.ElementDefinition; +import org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent; +import org.hl7.fhir.r5.model.Enumeration; +import org.hl7.fhir.r5.model.Immunization.ImmunizationPerformerComponent; +import org.hl7.fhir.r5.model.ImplementationGuide.GuidePageGeneration; +import org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemAnswerOptionComponent; +import org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionKind; +import org.hl7.fhir.r5.model.StructureDefinition.TypeDerivationRule; +import org.hl7.fhir.r5.model.TerminologyCapabilities; +import org.hl7.fhir.r5.model.Timing.EventTiming; +import org.hl7.fhir.r5.model.Type; +import org.hl7.fhir.r5.terminologies.CodeSystemUtilities; +import org.hl7.fhir.utilities.Utilities; + +/* + Copyright (c) 2011+, HL7, Inc. + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of HL7 nor the names of its contributors may be used to + endorse or promote products derived from this software without specific + prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + + */ + +// Generated on Thu, Apr 7, 2016 02:14+1000 for FHIR v1.4.0 + + +public class VersionConvertor_10_50 { + + private static List CANONICAL_URLS = new ArrayList(); + static { + CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/11179-permitted-value-conceptmap"); + CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/11179-permitted-value-valueset"); + CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/codesystem-map"); + CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/cqif-library"); + CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/elementdefinition-allowedUnits"); + CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/elementdefinition-inheritedExtensibleValueSet"); + CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/elementdefinition-maxValueSet"); + CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/elementdefinition-minValueSet"); + CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/event-instantiatesCanonical"); + CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/questionnaire-allowedProfile"); + CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/questionnaire-deMap"); + CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/questionnaire-sourceStructureMap"); + CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/questionnaire-targetStructureMap"); + CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/questionnaire-unit-valueSet"); + CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/valueset-map"); + CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/valueset-supplement"); + CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/valueset-system"); + } + + public VersionConvertorAdvisor50 advisor; + + public VersionConvertor_10_50(VersionConvertorAdvisor50 advisor) { + super(); + this.advisor = advisor; + } + + public void copyElement(org.hl7.fhir.dstu2.model.Element src, org.hl7.fhir.r5.model.Element tgt) throws FHIRException { + tgt.setId(src.getId()); + for (org.hl7.fhir.dstu2.model.Extension e : src.getExtension()) { + tgt.addExtension(convertExtension(e)); + } + } + + public void copyElement(org.hl7.fhir.r5.model.Element src, org.hl7.fhir.dstu2.model.Element tgt) throws FHIRException { + tgt.setId(src.getId()); + for (org.hl7.fhir.r5.model.Extension e : src.getExtension()) { + tgt.addExtension(convertExtension(e)); + } + } + + public void copyElement(org.hl7.fhir.r5.model.DomainResource src, org.hl7.fhir.dstu2.model.Element tgt) throws FHIRException { + tgt.setId(src.getId()); + for (org.hl7.fhir.r5.model.Extension e : src.getExtension()) { + tgt.addExtension(convertExtension(e)); + } + } + + public void copyBackboneElement(org.hl7.fhir.dstu2.model.BackboneElement src, org.hl7.fhir.r5.model.BackboneElement tgt) throws FHIRException { + copyElement(src, tgt); + for (org.hl7.fhir.dstu2.model.Extension e : src.getModifierExtension()) { + tgt.addModifierExtension(convertExtension(e)); + } + } + + public void copyBackboneElement(org.hl7.fhir.r5.model.BackboneElement src, org.hl7.fhir.dstu2.model.BackboneElement tgt) throws FHIRException { + copyElement(src, tgt); + for (org.hl7.fhir.r5.model.Extension e : src.getModifierExtension()) { + tgt.addModifierExtension(convertExtension(e)); + } + } + + public org.hl7.fhir.r5.model.Base64BinaryType convertBase64Binary(org.hl7.fhir.dstu2.model.Base64BinaryType src) throws FHIRException { + org.hl7.fhir.r5.model.Base64BinaryType tgt = new org.hl7.fhir.r5.model.Base64BinaryType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public org.hl7.fhir.dstu2.model.Base64BinaryType convertBase64Binary(org.hl7.fhir.r5.model.Base64BinaryType src) throws FHIRException { + org.hl7.fhir.dstu2.model.Base64BinaryType tgt = new org.hl7.fhir.dstu2.model.Base64BinaryType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public org.hl7.fhir.r5.model.BooleanType convertBoolean(org.hl7.fhir.dstu2.model.BooleanType src) throws FHIRException { + org.hl7.fhir.r5.model.BooleanType tgt = new org.hl7.fhir.r5.model.BooleanType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public org.hl7.fhir.dstu2.model.BooleanType convertBoolean(org.hl7.fhir.r5.model.BooleanType src) throws FHIRException { + org.hl7.fhir.dstu2.model.BooleanType tgt = new org.hl7.fhir.dstu2.model.BooleanType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public org.hl7.fhir.r5.model.CodeType convertCode(org.hl7.fhir.dstu2.model.CodeType src) throws FHIRException { + org.hl7.fhir.r5.model.CodeType tgt = new org.hl7.fhir.r5.model.CodeType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public org.hl7.fhir.dstu2.model.CodeType convertCode(org.hl7.fhir.r5.model.CodeType src) throws FHIRException { + org.hl7.fhir.dstu2.model.CodeType tgt = new org.hl7.fhir.dstu2.model.CodeType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public org.hl7.fhir.r5.model.UriType convertCodeToUri(org.hl7.fhir.dstu2.model.CodeType src) throws FHIRException { + org.hl7.fhir.r5.model.UriType tgt = new org.hl7.fhir.r5.model.UriType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public org.hl7.fhir.dstu2.model.CodeType convertUriToCode(org.hl7.fhir.r5.model.UriType src) throws FHIRException { + org.hl7.fhir.dstu2.model.CodeType tgt = new org.hl7.fhir.dstu2.model.CodeType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public org.hl7.fhir.r5.model.DateType convertDate(org.hl7.fhir.dstu2.model.DateType src) throws FHIRException { + org.hl7.fhir.r5.model.DateType tgt = new org.hl7.fhir.r5.model.DateType(src.getValueAsString()); + copyElement(src, tgt); + return tgt; + } + + public org.hl7.fhir.r5.model.DateType convertDate(org.hl7.fhir.dstu2.model.DateTimeType src) throws FHIRException { + org.hl7.fhir.r5.model.DateType tgt = new org.hl7.fhir.r5.model.DateType(src.getValueAsString()); + copyElement(src, tgt); + return tgt; + } + + public org.hl7.fhir.r5.model.DateTimeType convertDateToDateTime(org.hl7.fhir.dstu2.model.DateType src) throws FHIRException { + org.hl7.fhir.r5.model.DateTimeType tgt = new org.hl7.fhir.r5.model.DateTimeType(src.getValueAsString()); + copyElement(src, tgt); + return tgt; + } + + public org.hl7.fhir.dstu2.model.DateType convertDateTimeToDate(org.hl7.fhir.r5.model.DateTimeType src) throws FHIRException { + org.hl7.fhir.dstu2.model.DateType tgt = new org.hl7.fhir.dstu2.model.DateType(src.getValueAsString()); + copyElement(src, tgt); + return tgt; + } + + public org.hl7.fhir.dstu2.model.DateType convertDate(org.hl7.fhir.r5.model.DateType src) throws FHIRException { + org.hl7.fhir.dstu2.model.DateType tgt = new org.hl7.fhir.dstu2.model.DateType(src.getValueAsString()); + copyElement(src, tgt); + return tgt; + } + + public org.hl7.fhir.dstu2.model.DateType convertDate(org.hl7.fhir.r5.model.DateTimeType src) throws FHIRException { + org.hl7.fhir.dstu2.model.DateType tgt = new org.hl7.fhir.dstu2.model.DateType(src.getValueAsString()); + copyElement(src, tgt); + return tgt; + } + + public org.hl7.fhir.r5.model.DateTimeType convertDateTime(org.hl7.fhir.dstu2.model.DateTimeType src) throws FHIRException { + org.hl7.fhir.r5.model.DateTimeType tgt = new org.hl7.fhir.r5.model.DateTimeType(src.getValueAsString()); + copyElement(src, tgt); + return tgt; + } + + public org.hl7.fhir.dstu2.model.DateTimeType convertDateTime(org.hl7.fhir.r5.model.DateTimeType src) throws FHIRException { + org.hl7.fhir.dstu2.model.DateTimeType tgt = new org.hl7.fhir.dstu2.model.DateTimeType(src.getValueAsString()); + copyElement(src, tgt); + return tgt; + } + + public org.hl7.fhir.r5.model.DecimalType convertDecimal(org.hl7.fhir.dstu2.model.DecimalType src) throws FHIRException { + org.hl7.fhir.r5.model.DecimalType tgt = new org.hl7.fhir.r5.model.DecimalType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public org.hl7.fhir.dstu2.model.DecimalType convertDecimal(org.hl7.fhir.r5.model.DecimalType src) throws FHIRException { + org.hl7.fhir.dstu2.model.DecimalType tgt = new org.hl7.fhir.dstu2.model.DecimalType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public org.hl7.fhir.r5.model.IdType convertId(org.hl7.fhir.dstu2.model.IdType src) throws FHIRException { + org.hl7.fhir.r5.model.IdType tgt = new org.hl7.fhir.r5.model.IdType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public org.hl7.fhir.dstu2.model.IdType convertId(org.hl7.fhir.r5.model.IdType src) throws FHIRException { + org.hl7.fhir.dstu2.model.IdType tgt = new org.hl7.fhir.dstu2.model.IdType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public org.hl7.fhir.r5.model.InstantType convertInstant(org.hl7.fhir.dstu2.model.InstantType src) throws FHIRException { + org.hl7.fhir.r5.model.InstantType tgt = new org.hl7.fhir.r5.model.InstantType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public org.hl7.fhir.dstu2.model.InstantType convertInstant(org.hl7.fhir.r5.model.InstantType src) throws FHIRException { + org.hl7.fhir.dstu2.model.InstantType tgt = new org.hl7.fhir.dstu2.model.InstantType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public org.hl7.fhir.r5.model.IntegerType convertInteger(org.hl7.fhir.dstu2.model.IntegerType src) throws FHIRException { + org.hl7.fhir.r5.model.IntegerType tgt = new org.hl7.fhir.r5.model.IntegerType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public org.hl7.fhir.dstu2.model.IntegerType convertInteger(org.hl7.fhir.r5.model.IntegerType src) throws FHIRException { + org.hl7.fhir.dstu2.model.IntegerType tgt = new org.hl7.fhir.dstu2.model.IntegerType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public org.hl7.fhir.r5.model.MarkdownType convertMarkdown(org.hl7.fhir.dstu2.model.MarkdownType src) throws FHIRException { + org.hl7.fhir.r5.model.MarkdownType tgt = new org.hl7.fhir.r5.model.MarkdownType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public org.hl7.fhir.dstu2.model.MarkdownType convertMarkdown(org.hl7.fhir.r5.model.MarkdownType src) throws FHIRException { + org.hl7.fhir.dstu2.model.MarkdownType tgt = new org.hl7.fhir.dstu2.model.MarkdownType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public org.hl7.fhir.r5.model.OidType convertOid(org.hl7.fhir.dstu2.model.OidType src) throws FHIRException { + org.hl7.fhir.r5.model.OidType tgt = new org.hl7.fhir.r5.model.OidType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public org.hl7.fhir.dstu2.model.OidType convertOid(org.hl7.fhir.r5.model.OidType src) throws FHIRException { + org.hl7.fhir.dstu2.model.OidType tgt = new org.hl7.fhir.dstu2.model.OidType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public org.hl7.fhir.r5.model.PositiveIntType convertPositiveInt(org.hl7.fhir.dstu2.model.PositiveIntType src) throws FHIRException { + org.hl7.fhir.r5.model.PositiveIntType tgt = new org.hl7.fhir.r5.model.PositiveIntType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public org.hl7.fhir.dstu2.model.PositiveIntType convertPositiveInt(org.hl7.fhir.r5.model.PositiveIntType src) throws FHIRException { + org.hl7.fhir.dstu2.model.PositiveIntType tgt = new org.hl7.fhir.dstu2.model.PositiveIntType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public org.hl7.fhir.r5.model.StringType convertString(org.hl7.fhir.dstu2.model.StringType src) throws FHIRException { + org.hl7.fhir.r5.model.StringType tgt = new org.hl7.fhir.r5.model.StringType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public org.hl7.fhir.dstu2.model.StringType convertString(org.hl7.fhir.r5.model.StringType src) throws FHIRException { + org.hl7.fhir.dstu2.model.StringType tgt = new org.hl7.fhir.dstu2.model.StringType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public org.hl7.fhir.r5.model.TimeType convertTime(org.hl7.fhir.dstu2.model.TimeType src) throws FHIRException { + org.hl7.fhir.r5.model.TimeType tgt = new org.hl7.fhir.r5.model.TimeType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public org.hl7.fhir.dstu2.model.TimeType convertTime(org.hl7.fhir.r5.model.TimeType src) throws FHIRException { + org.hl7.fhir.dstu2.model.TimeType tgt = new org.hl7.fhir.dstu2.model.TimeType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public org.hl7.fhir.r5.model.UnsignedIntType convertUnsignedInt(org.hl7.fhir.dstu2.model.UnsignedIntType src) throws FHIRException { + org.hl7.fhir.r5.model.UnsignedIntType tgt = new org.hl7.fhir.r5.model.UnsignedIntType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public org.hl7.fhir.dstu2.model.UnsignedIntType convertUnsignedInt(org.hl7.fhir.r5.model.UnsignedIntType src) throws FHIRException { + org.hl7.fhir.dstu2.model.UnsignedIntType tgt = new org.hl7.fhir.dstu2.model.UnsignedIntType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public org.hl7.fhir.r5.model.UriType convertUri(org.hl7.fhir.dstu2.model.UriType src) throws FHIRException { + org.hl7.fhir.r5.model.UriType tgt = new org.hl7.fhir.r5.model.UriType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public org.hl7.fhir.r5.model.UrlType convertUriToUrl(org.hl7.fhir.dstu2.model.UriType src) throws FHIRException { + org.hl7.fhir.r5.model.UrlType tgt = new org.hl7.fhir.r5.model.UrlType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public org.hl7.fhir.dstu2.model.UriType convertUri(org.hl7.fhir.r5.model.UriType src) throws FHIRException { + org.hl7.fhir.dstu2.model.UriType tgt = new org.hl7.fhir.dstu2.model.UriType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public org.hl7.fhir.r5.model.UuidType convertUuid(org.hl7.fhir.dstu2.model.UuidType src) throws FHIRException { + org.hl7.fhir.r5.model.UuidType tgt = new org.hl7.fhir.r5.model.UuidType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public org.hl7.fhir.dstu2.model.UuidType convertUuid(org.hl7.fhir.r5.model.UuidType src) throws FHIRException { + org.hl7.fhir.dstu2.model.UuidType tgt = new org.hl7.fhir.dstu2.model.UuidType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public org.hl7.fhir.r5.model.Extension convertExtension(org.hl7.fhir.dstu2.model.Extension src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Extension tgt = new org.hl7.fhir.r5.model.Extension(); + copyElement(src, tgt); + tgt.setUrl(src.getUrl()); + if (src.hasValue()) + if (CANONICAL_URLS.contains(src.getUrl()) && src.getValue() instanceof org.hl7.fhir.dstu2.model.Reference) + tgt.setValue(convertReferenceToCanonical((Reference)src.getValue())); + else + tgt.setValue(convertType(src.getValue())); + return tgt; + } + + public org.hl7.fhir.dstu2.model.Extension convertExtension(org.hl7.fhir.r5.model.Extension src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Extension tgt = new org.hl7.fhir.dstu2.model.Extension(); + copyElement(src, tgt); + tgt.setUrl(src.getUrl()); + if (src.hasValue()) + if (CANONICAL_URLS.contains(src.getUrl()) && src.getValue() instanceof org.hl7.fhir.r5.model.CanonicalType) + tgt.setValue(convertCanonicalToReference((CanonicalType)src.getValue())); + else + tgt.setValue(convertType(src.getValue())); + tgt.setValue(convertType(src.getValue())); + return tgt; + } + + public org.hl7.fhir.r5.model.Narrative convertNarrative(org.hl7.fhir.dstu2.model.Narrative src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Narrative tgt = new org.hl7.fhir.r5.model.Narrative(); + copyElement(src, tgt); + tgt.setStatus(convertNarrativeStatus(src.getStatus())); + tgt.setDiv(src.getDiv()); + return tgt; + } + + public org.hl7.fhir.dstu2.model.Narrative convertNarrative(org.hl7.fhir.r5.model.Narrative src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Narrative tgt = new org.hl7.fhir.dstu2.model.Narrative(); + copyElement(src, tgt); + tgt.setStatus(convertNarrativeStatus(src.getStatus())); + tgt.setDiv(src.getDiv()); + return tgt; + } + + public org.hl7.fhir.r5.model.Narrative.NarrativeStatus convertNarrativeStatus(org.hl7.fhir.dstu2.model.Narrative.NarrativeStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case GENERATED: return org.hl7.fhir.r5.model.Narrative.NarrativeStatus.GENERATED; + case EXTENSIONS: return org.hl7.fhir.r5.model.Narrative.NarrativeStatus.EXTENSIONS; + case ADDITIONAL: return org.hl7.fhir.r5.model.Narrative.NarrativeStatus.ADDITIONAL; + case EMPTY: return org.hl7.fhir.r5.model.Narrative.NarrativeStatus.EMPTY; + default: return org.hl7.fhir.r5.model.Narrative.NarrativeStatus.NULL; + } + } + + public org.hl7.fhir.dstu2.model.Narrative.NarrativeStatus convertNarrativeStatus(org.hl7.fhir.r5.model.Narrative.NarrativeStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case GENERATED: return org.hl7.fhir.dstu2.model.Narrative.NarrativeStatus.GENERATED; + case EXTENSIONS: return org.hl7.fhir.dstu2.model.Narrative.NarrativeStatus.EXTENSIONS; + case ADDITIONAL: return org.hl7.fhir.dstu2.model.Narrative.NarrativeStatus.ADDITIONAL; + case EMPTY: return org.hl7.fhir.dstu2.model.Narrative.NarrativeStatus.EMPTY; + default: return org.hl7.fhir.dstu2.model.Narrative.NarrativeStatus.NULL; + } + } + + public org.hl7.fhir.r5.model.Annotation convertAnnotation(org.hl7.fhir.dstu2.model.Annotation src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Annotation tgt = new org.hl7.fhir.r5.model.Annotation(); + copyElement(src, tgt); + tgt.setAuthor(convertType(src.getAuthor())); + tgt.setTime(src.getTime()); + tgt.setText(src.getText()); + return tgt; + } + + public org.hl7.fhir.dstu2.model.Annotation convertAnnotation(org.hl7.fhir.r5.model.Annotation src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Annotation tgt = new org.hl7.fhir.dstu2.model.Annotation(); + copyElement(src, tgt); + tgt.setAuthor(convertType(src.getAuthor())); + tgt.setTime(src.getTime()); + tgt.setText(src.getText()); + return tgt; + } + + public org.hl7.fhir.r5.model.Attachment convertAttachment(org.hl7.fhir.dstu2.model.Attachment src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Attachment tgt = new org.hl7.fhir.r5.model.Attachment(); + copyElement(src, tgt); + tgt.setContentType(src.getContentType()); + tgt.setLanguage(src.getLanguage()); + tgt.setData(src.getData()); + tgt.setUrl(src.getUrl()); + tgt.setSize(src.getSize()); + tgt.setHash(src.getHash()); + tgt.setTitle(src.getTitle()); + tgt.setCreation(src.getCreation()); + return tgt; + } + + public org.hl7.fhir.dstu2.model.Attachment convertAttachment(org.hl7.fhir.r5.model.Attachment src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Attachment tgt = new org.hl7.fhir.dstu2.model.Attachment(); + copyElement(src, tgt); + tgt.setContentType(src.getContentType()); + tgt.setLanguage(src.getLanguage()); + tgt.setData(src.getData()); + tgt.setUrl(src.getUrl()); + tgt.setSize(src.getSize()); + tgt.setHash(src.getHash()); + tgt.setTitle(src.getTitle()); + tgt.setCreation(src.getCreation()); + return tgt; + } + + public org.hl7.fhir.r5.model.CodeableConcept convertCodeableConcept(org.hl7.fhir.dstu2.model.CodeableConcept src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.CodeableConcept tgt = new org.hl7.fhir.r5.model.CodeableConcept(); + copyElement(src, tgt); + for (org.hl7.fhir.dstu2.model.Coding t : src.getCoding()) + tgt.addCoding(convertCoding(t)); + tgt.setText(src.getText()); + return tgt; + } + + public org.hl7.fhir.dstu2.model.CodeableConcept convertCodeableConcept(org.hl7.fhir.r5.model.CodeableConcept src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.CodeableConcept tgt = new org.hl7.fhir.dstu2.model.CodeableConcept(); + copyElement(src, tgt); + for (org.hl7.fhir.r5.model.Coding t : src.getCoding()) + tgt.addCoding(convertCoding(t)); + tgt.setText(src.getText()); + return tgt; + } + + public org.hl7.fhir.r5.model.Coding convertCoding(org.hl7.fhir.dstu2.model.Coding src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Coding tgt = new org.hl7.fhir.r5.model.Coding(); + copyElement(src, tgt); + tgt.setSystem(src.getSystem()); + tgt.setVersion(src.getVersion()); + tgt.setCode(src.getCode()); + tgt.setDisplay(src.getDisplay()); + tgt.setUserSelected(src.getUserSelected()); + return tgt; + } + + public org.hl7.fhir.dstu2.model.Coding convertCoding(org.hl7.fhir.r5.model.Coding src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Coding tgt = new org.hl7.fhir.dstu2.model.Coding(); + copyElement(src, tgt); + tgt.setSystem(src.getSystem()); + tgt.setVersion(src.getVersion()); + tgt.setCode(src.getCode()); + tgt.setDisplay(src.getDisplay()); + tgt.setUserSelected(src.getUserSelected()); + return tgt; + } + + + + public org.hl7.fhir.r5.model.Identifier convertIdentifier(org.hl7.fhir.dstu2.model.Identifier src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Identifier tgt = new org.hl7.fhir.r5.model.Identifier(); + copyElement(src, tgt); + tgt.setUse(convertIdentifierUse(src.getUse())); + tgt.setType(convertCodeableConcept(src.getType())); + tgt.setSystem(src.getSystem()); + tgt.setValue(src.getValue()); + tgt.setPeriod(convertPeriod(src.getPeriod())); + tgt.setAssigner(convertReference(src.getAssigner())); + return tgt; + } + + public org.hl7.fhir.dstu2.model.Identifier convertIdentifier(org.hl7.fhir.r5.model.Identifier src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Identifier tgt = new org.hl7.fhir.dstu2.model.Identifier(); + copyElement(src, tgt); + if (src.hasUse()) + tgt.setUse(convertIdentifierUse(src.getUse())); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + if (src.hasSystem()) + tgt.setSystem(src.getSystem()); + if (src.hasValue()) + tgt.setValue(src.getValue()); + if (src.hasPeriod()) + tgt.setPeriod(convertPeriod(src.getPeriod())); + if (src.hasAssigner()) + tgt.setAssigner(convertReference(src.getAssigner())); + return tgt; + } + + public org.hl7.fhir.r5.model.Identifier.IdentifierUse convertIdentifierUse(org.hl7.fhir.dstu2.model.Identifier.IdentifierUse src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case USUAL: return org.hl7.fhir.r5.model.Identifier.IdentifierUse.USUAL; + case OFFICIAL: return org.hl7.fhir.r5.model.Identifier.IdentifierUse.OFFICIAL; + case TEMP: return org.hl7.fhir.r5.model.Identifier.IdentifierUse.TEMP; + case SECONDARY: return org.hl7.fhir.r5.model.Identifier.IdentifierUse.SECONDARY; + default: return org.hl7.fhir.r5.model.Identifier.IdentifierUse.NULL; + } + } + + public org.hl7.fhir.dstu2.model.Identifier.IdentifierUse convertIdentifierUse(org.hl7.fhir.r5.model.Identifier.IdentifierUse src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case USUAL: return org.hl7.fhir.dstu2.model.Identifier.IdentifierUse.USUAL; + case OFFICIAL: return org.hl7.fhir.dstu2.model.Identifier.IdentifierUse.OFFICIAL; + case TEMP: return org.hl7.fhir.dstu2.model.Identifier.IdentifierUse.TEMP; + case SECONDARY: return org.hl7.fhir.dstu2.model.Identifier.IdentifierUse.SECONDARY; + default: return org.hl7.fhir.dstu2.model.Identifier.IdentifierUse.NULL; + } + } + + public org.hl7.fhir.r5.model.Period convertPeriod(org.hl7.fhir.dstu2.model.Period src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Period tgt = new org.hl7.fhir.r5.model.Period(); + copyElement(src, tgt); + tgt.setStart(src.getStart()); + tgt.setEnd(src.getEnd()); + return tgt; + } + + public org.hl7.fhir.dstu2.model.Period convertPeriod(org.hl7.fhir.r5.model.Period src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Period tgt = new org.hl7.fhir.dstu2.model.Period(); + copyElement(src, tgt); + tgt.setStart(src.getStart()); + tgt.setEnd(src.getEnd()); + return tgt; + } + + public org.hl7.fhir.r5.model.Quantity convertQuantity(org.hl7.fhir.dstu2.model.Quantity src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Quantity tgt = new org.hl7.fhir.r5.model.Quantity(); + copyElement(src, tgt); + tgt.setValue(src.getValue()); + tgt.setComparator(convertQuantityComparator(src.getComparator())); + tgt.setUnit(src.getUnit()); + tgt.setSystem(src.getSystem()); + tgt.setCode(src.getCode()); + return tgt; + } + + public org.hl7.fhir.dstu2.model.Quantity convertQuantity(org.hl7.fhir.r5.model.Quantity src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Quantity tgt = new org.hl7.fhir.dstu2.model.Quantity(); + copyElement(src, tgt); + tgt.setValue(src.getValue()); + tgt.setComparator(convertQuantityComparator(src.getComparator())); + tgt.setUnit(src.getUnit()); + tgt.setSystem(src.getSystem()); + tgt.setCode(src.getCode()); + return tgt; + } + + public org.hl7.fhir.r5.model.Quantity.QuantityComparator convertQuantityComparator(org.hl7.fhir.dstu2.model.Quantity.QuantityComparator src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case LESS_THAN: return org.hl7.fhir.r5.model.Quantity.QuantityComparator.LESS_THAN; + case LESS_OR_EQUAL: return org.hl7.fhir.r5.model.Quantity.QuantityComparator.LESS_OR_EQUAL; + case GREATER_OR_EQUAL: return org.hl7.fhir.r5.model.Quantity.QuantityComparator.GREATER_OR_EQUAL; + case GREATER_THAN: return org.hl7.fhir.r5.model.Quantity.QuantityComparator.GREATER_THAN; + default: return org.hl7.fhir.r5.model.Quantity.QuantityComparator.NULL; + } + } + + public org.hl7.fhir.dstu2.model.Quantity.QuantityComparator convertQuantityComparator(org.hl7.fhir.r5.model.Quantity.QuantityComparator src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case LESS_THAN: return org.hl7.fhir.dstu2.model.Quantity.QuantityComparator.LESS_THAN; + case LESS_OR_EQUAL: return org.hl7.fhir.dstu2.model.Quantity.QuantityComparator.LESS_OR_EQUAL; + case GREATER_OR_EQUAL: return org.hl7.fhir.dstu2.model.Quantity.QuantityComparator.GREATER_OR_EQUAL; + case GREATER_THAN: return org.hl7.fhir.dstu2.model.Quantity.QuantityComparator.GREATER_THAN; + default: return org.hl7.fhir.dstu2.model.Quantity.QuantityComparator.NULL; + } + } + + public org.hl7.fhir.r5.model.Range convertRange(org.hl7.fhir.dstu2.model.Range src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Range tgt = new org.hl7.fhir.r5.model.Range(); + copyElement(src, tgt); + tgt.setLow(convertSimpleQuantity(src.getLow())); + tgt.setHigh(convertSimpleQuantity(src.getHigh())); + return tgt; + } + + public org.hl7.fhir.dstu2.model.Range convertRange(org.hl7.fhir.r5.model.Range src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Range tgt = new org.hl7.fhir.dstu2.model.Range(); + copyElement(src, tgt); + tgt.setLow(convertSimpleQuantity(src.getLow())); + tgt.setHigh(convertSimpleQuantity(src.getHigh())); + return tgt; + } + + public org.hl7.fhir.r5.model.Ratio convertRatio(org.hl7.fhir.dstu2.model.Ratio src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Ratio tgt = new org.hl7.fhir.r5.model.Ratio(); + copyElement(src, tgt); + tgt.setNumerator(convertQuantity(src.getNumerator())); + tgt.setDenominator(convertQuantity(src.getDenominator())); + return tgt; + } + + public org.hl7.fhir.dstu2.model.Ratio convertRatio(org.hl7.fhir.r5.model.Ratio src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Ratio tgt = new org.hl7.fhir.dstu2.model.Ratio(); + copyElement(src, tgt); + tgt.setNumerator(convertQuantity(src.getNumerator())); + tgt.setDenominator(convertQuantity(src.getDenominator())); + return tgt; + } + + public org.hl7.fhir.r5.model.Reference convertReference(org.hl7.fhir.dstu2.model.Reference src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Reference tgt = new org.hl7.fhir.r5.model.Reference(); + copyElement(src, tgt); + tgt.setReference(src.getReference()); + tgt.setDisplay(src.getDisplay()); + return tgt; + } + + public org.hl7.fhir.dstu2.model.Reference convertReference(org.hl7.fhir.r5.model.Reference src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Reference tgt = new org.hl7.fhir.dstu2.model.Reference(); + copyElement(src, tgt); + tgt.setReference(src.getReference()); + tgt.setDisplay(src.getDisplay()); + return tgt; + } + + public org.hl7.fhir.r5.model.SampledData convertSampledData(org.hl7.fhir.dstu2.model.SampledData src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.SampledData tgt = new org.hl7.fhir.r5.model.SampledData(); + copyElement(src, tgt); + tgt.setOrigin(convertSimpleQuantity(src.getOrigin())); + tgt.setPeriod(src.getPeriod()); + tgt.setFactor(src.getFactor()); + tgt.setLowerLimit(src.getLowerLimit()); + tgt.setUpperLimit(src.getUpperLimit()); + tgt.setDimensions(src.getDimensions()); + tgt.setData(src.getData()); + return tgt; + } + + public org.hl7.fhir.dstu2.model.SampledData convertSampledData(org.hl7.fhir.r5.model.SampledData src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.SampledData tgt = new org.hl7.fhir.dstu2.model.SampledData(); + copyElement(src, tgt); + tgt.setOrigin(convertSimpleQuantity(src.getOrigin())); + tgt.setPeriod(src.getPeriod()); + tgt.setFactor(src.getFactor()); + tgt.setLowerLimit(src.getLowerLimit()); + tgt.setUpperLimit(src.getUpperLimit()); + tgt.setDimensions(src.getDimensions()); + tgt.setData(src.getData()); + return tgt; + } + + public org.hl7.fhir.r5.model.Signature convertSignature(org.hl7.fhir.dstu2.model.Signature src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Signature tgt = new org.hl7.fhir.r5.model.Signature(); + copyElement(src, tgt); + for (org.hl7.fhir.dstu2.model.Coding t : src.getType()) + tgt.addType(convertCoding(t)); + tgt.setWhen(src.getWhen()); + if (src.hasWhoUriType()) + tgt.setWho(new org.hl7.fhir.r5.model.Reference(src.getWhoUriType().getValue())); + else + tgt.setWho(convertReference(src.getWhoReference())); + tgt.setSigFormat(src.getContentType()); + tgt.setData(src.getBlob()); + return tgt; + } + + public org.hl7.fhir.dstu2.model.Signature convertSignature(org.hl7.fhir.r5.model.Signature src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Signature tgt = new org.hl7.fhir.dstu2.model.Signature(); + copyElement(src, tgt); + for (org.hl7.fhir.r5.model.Coding t : src.getType()) + tgt.addType(convertCoding(t)); + tgt.setWhen(src.getWhen()); + tgt.setWho(convertType(src.getWho())); + tgt.setContentType(src.getSigFormat()); + tgt.setBlob(src.getData()); + return tgt; + } + + public org.hl7.fhir.r5.model.Address convertAddress(org.hl7.fhir.dstu2.model.Address src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Address tgt = new org.hl7.fhir.r5.model.Address(); + copyElement(src, tgt); + tgt.setUse(convertAddressUse(src.getUse())); + tgt.setType(convertAddressType(src.getType())); + tgt.setText(src.getText()); + for (org.hl7.fhir.dstu2.model.StringType t : src.getLine()) + tgt.addLine(t.getValue()); + tgt.setCity(src.getCity()); + tgt.setDistrict(src.getDistrict()); + tgt.setState(src.getState()); + tgt.setPostalCode(src.getPostalCode()); + tgt.setCountry(src.getCountry()); + tgt.setPeriod(convertPeriod(src.getPeriod())); + return tgt; + } + + public org.hl7.fhir.dstu2.model.Address convertAddress(org.hl7.fhir.r5.model.Address src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Address tgt = new org.hl7.fhir.dstu2.model.Address(); + copyElement(src, tgt); + tgt.setUse(convertAddressUse(src.getUse())); + tgt.setType(convertAddressType(src.getType())); + tgt.setText(src.getText()); + for (org.hl7.fhir.r5.model.StringType t : src.getLine()) + tgt.addLine(t.getValue()); + tgt.setCity(src.getCity()); + tgt.setDistrict(src.getDistrict()); + tgt.setState(src.getState()); + tgt.setPostalCode(src.getPostalCode()); + tgt.setCountry(src.getCountry()); + tgt.setPeriod(convertPeriod(src.getPeriod())); + return tgt; + } + + public org.hl7.fhir.r5.model.Address.AddressUse convertAddressUse(org.hl7.fhir.dstu2.model.Address.AddressUse src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case HOME: return org.hl7.fhir.r5.model.Address.AddressUse.HOME; + case WORK: return org.hl7.fhir.r5.model.Address.AddressUse.WORK; + case TEMP: return org.hl7.fhir.r5.model.Address.AddressUse.TEMP; + case OLD: return org.hl7.fhir.r5.model.Address.AddressUse.OLD; + default: return org.hl7.fhir.r5.model.Address.AddressUse.NULL; + } + } + + public org.hl7.fhir.dstu2.model.Address.AddressUse convertAddressUse(org.hl7.fhir.r5.model.Address.AddressUse src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case HOME: return org.hl7.fhir.dstu2.model.Address.AddressUse.HOME; + case WORK: return org.hl7.fhir.dstu2.model.Address.AddressUse.WORK; + case TEMP: return org.hl7.fhir.dstu2.model.Address.AddressUse.TEMP; + case OLD: return org.hl7.fhir.dstu2.model.Address.AddressUse.OLD; + default: return org.hl7.fhir.dstu2.model.Address.AddressUse.NULL; + } + } + + public org.hl7.fhir.r5.model.Address.AddressType convertAddressType(org.hl7.fhir.dstu2.model.Address.AddressType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case POSTAL: return org.hl7.fhir.r5.model.Address.AddressType.POSTAL; + case PHYSICAL: return org.hl7.fhir.r5.model.Address.AddressType.PHYSICAL; + case BOTH: return org.hl7.fhir.r5.model.Address.AddressType.BOTH; + default: return org.hl7.fhir.r5.model.Address.AddressType.NULL; + } + } + + public org.hl7.fhir.dstu2.model.Address.AddressType convertAddressType(org.hl7.fhir.r5.model.Address.AddressType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case POSTAL: return org.hl7.fhir.dstu2.model.Address.AddressType.POSTAL; + case PHYSICAL: return org.hl7.fhir.dstu2.model.Address.AddressType.PHYSICAL; + case BOTH: return org.hl7.fhir.dstu2.model.Address.AddressType.BOTH; + default: return org.hl7.fhir.dstu2.model.Address.AddressType.NULL; + } + } + + public org.hl7.fhir.r5.model.ContactPoint convertContactPoint(org.hl7.fhir.dstu2.model.ContactPoint src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.ContactPoint tgt = new org.hl7.fhir.r5.model.ContactPoint(); + copyElement(src, tgt); + tgt.setSystem(convertContactPointSystem(src.getSystem())); + tgt.setValue(src.getValue()); + tgt.setUse(convertContactPointUse(src.getUse())); + if (src.hasRank()) + tgt.setRank(src.getRank()); + tgt.setPeriod(convertPeriod(src.getPeriod())); + return tgt; + } + + public org.hl7.fhir.dstu2.model.ContactPoint convertContactPoint(org.hl7.fhir.r5.model.ContactPoint src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.ContactPoint tgt = new org.hl7.fhir.dstu2.model.ContactPoint(); + copyElement(src, tgt); + if (src.hasSystem()) + tgt.setSystem(convertContactPointSystem(src.getSystem())); + tgt.setValue(src.getValue()); + tgt.setUse(convertContactPointUse(src.getUse())); + tgt.setRank(src.getRank()); + if (src.hasPeriod()) + tgt.setPeriod(convertPeriod(src.getPeriod())); + return tgt; + } + + public org.hl7.fhir.r5.model.ContactPoint.ContactPointSystem convertContactPointSystem(org.hl7.fhir.dstu2.model.ContactPoint.ContactPointSystem src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PHONE: return org.hl7.fhir.r5.model.ContactPoint.ContactPointSystem.PHONE; + case FAX: return org.hl7.fhir.r5.model.ContactPoint.ContactPointSystem.FAX; + case EMAIL: return org.hl7.fhir.r5.model.ContactPoint.ContactPointSystem.EMAIL; + case PAGER: return org.hl7.fhir.r5.model.ContactPoint.ContactPointSystem.PAGER; + case OTHER: return org.hl7.fhir.r5.model.ContactPoint.ContactPointSystem.OTHER; + default: return org.hl7.fhir.r5.model.ContactPoint.ContactPointSystem.NULL; + } + } + + public org.hl7.fhir.dstu2.model.ContactPoint.ContactPointSystem convertContactPointSystem(org.hl7.fhir.r5.model.ContactPoint.ContactPointSystem src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PHONE: return org.hl7.fhir.dstu2.model.ContactPoint.ContactPointSystem.PHONE; + case FAX: return org.hl7.fhir.dstu2.model.ContactPoint.ContactPointSystem.FAX; + case EMAIL: return org.hl7.fhir.dstu2.model.ContactPoint.ContactPointSystem.EMAIL; + case PAGER: return org.hl7.fhir.dstu2.model.ContactPoint.ContactPointSystem.PAGER; + case OTHER: return org.hl7.fhir.dstu2.model.ContactPoint.ContactPointSystem.OTHER; + case URL: return org.hl7.fhir.dstu2.model.ContactPoint.ContactPointSystem.OTHER; + default: return org.hl7.fhir.dstu2.model.ContactPoint.ContactPointSystem.NULL; + } + } + + public org.hl7.fhir.r5.model.ContactPoint.ContactPointUse convertContactPointUse(org.hl7.fhir.dstu2.model.ContactPoint.ContactPointUse src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case HOME: return org.hl7.fhir.r5.model.ContactPoint.ContactPointUse.HOME; + case WORK: return org.hl7.fhir.r5.model.ContactPoint.ContactPointUse.WORK; + case TEMP: return org.hl7.fhir.r5.model.ContactPoint.ContactPointUse.TEMP; + case OLD: return org.hl7.fhir.r5.model.ContactPoint.ContactPointUse.OLD; + case MOBILE: return org.hl7.fhir.r5.model.ContactPoint.ContactPointUse.MOBILE; + default: return org.hl7.fhir.r5.model.ContactPoint.ContactPointUse.NULL; + } + } + + public org.hl7.fhir.dstu2.model.ContactPoint.ContactPointUse convertContactPointUse(org.hl7.fhir.r5.model.ContactPoint.ContactPointUse src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case HOME: return org.hl7.fhir.dstu2.model.ContactPoint.ContactPointUse.HOME; + case WORK: return org.hl7.fhir.dstu2.model.ContactPoint.ContactPointUse.WORK; + case TEMP: return org.hl7.fhir.dstu2.model.ContactPoint.ContactPointUse.TEMP; + case OLD: return org.hl7.fhir.dstu2.model.ContactPoint.ContactPointUse.OLD; + case MOBILE: return org.hl7.fhir.dstu2.model.ContactPoint.ContactPointUse.MOBILE; + default: return org.hl7.fhir.dstu2.model.ContactPoint.ContactPointUse.NULL; + } + } + + public org.hl7.fhir.r5.model.ElementDefinition convertElementDefinition(org.hl7.fhir.dstu2.model.ElementDefinition src, List slicePaths, List context, int pos) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.ElementDefinition tgt = new org.hl7.fhir.r5.model.ElementDefinition(); + copyElement(src, tgt); + tgt.setPath(src.getPath()); + for (org.hl7.fhir.dstu2.model.Enumeration t : src.getRepresentation()) + tgt.addRepresentation(convertPropertyRepresentation(t.getValue())); + if (src.hasName()) { + if (slicePaths.contains(src.getPath())) + tgt.setSliceName(src.getName()); + tgt.setId(src.getName()); + } + if (src.hasLabel()) + tgt.setLabel(src.getLabel()); + for (org.hl7.fhir.dstu2.model.Coding t : src.getCode()) + tgt.addCode(convertCoding(t)); + if (src.hasSlicing()) + tgt.setSlicing(convertElementDefinitionSlicingComponent(src.getSlicing(), context, pos)); + if (src.hasShort()) + tgt.setShort(src.getShort()); + if (src.hasDefinition()) + tgt.setDefinition(src.getDefinition()); + if (src.hasComments()) + tgt.setComment(src.getComments()); + if (src.hasRequirements()) + tgt.setRequirements(src.getRequirements()); + for (org.hl7.fhir.dstu2.model.StringType t : src.getAlias()) + tgt.addAlias(t.getValue()); + if (src.hasMin()) + tgt.setMin(src.getMin()); + if (src.hasMax()) + tgt.setMax(src.getMax()); + if (src.hasBase()) + tgt.setBase(convertElementDefinitionBaseComponent(src.getBase())); + if (src.hasNameReference()) + tgt.setContentReference("#"+src.getNameReference()); + for (org.hl7.fhir.dstu2.model.ElementDefinition.TypeRefComponent t : src.getType()) + convertElementDefinitionTypeComponent(t, tgt.getType()); + if (src.hasDefaultValue()) + tgt.setDefaultValue(convertType(src.getDefaultValue())); + if (src.hasMeaningWhenMissing()) + tgt.setMeaningWhenMissing(src.getMeaningWhenMissing()); + if (src.hasFixed()) + tgt.setFixed(convertType(src.getFixed())); + if (src.hasPattern()) + tgt.setPattern(convertType(src.getPattern())); + if (src.hasExample()) + tgt.addExample().setLabel("General").setValue(convertType(src.getExample())); + if (src.hasMinValue()) + tgt.setMinValue(convertType(src.getMinValue())); + if (src.hasMaxValue()) + tgt.setMaxValue(convertType(src.getMaxValue())); + if (src.hasMaxLength()) + tgt.setMaxLength(src.getMaxLength()); + for (org.hl7.fhir.dstu2.model.IdType t : src.getCondition()) + tgt.addCondition(t.getValue()); + for (org.hl7.fhir.dstu2.model.ElementDefinition.ElementDefinitionConstraintComponent t : src.getConstraint()) + tgt.addConstraint(convertElementDefinitionConstraintComponent(t)); + if (src.hasMustSupport()) + tgt.setMustSupport(src.getMustSupport()); + if (src.hasIsModifier()) + tgt.setIsModifier(src.getIsModifier()); + if (tgt.getIsModifier()) { + String reason = org.hl7.fhir.dstu2.utils.ToolingExtensions.readStringExtension(src, VersionConvertorConstants.MODIFIER_REASON_EXTENSION); + if (Utilities.noString(reason)) + reason = VersionConvertorConstants.MODIFIER_REASON_LEGACY; + tgt.setIsModifierReason(reason); + } + if (src.hasIsSummary()) + tgt.setIsSummary(src.getIsSummary()); + if (src.hasBinding()) + tgt.setBinding(convertElementDefinitionBindingComponent(src.getBinding())); + for (org.hl7.fhir.dstu2.model.ElementDefinition.ElementDefinitionMappingComponent t : src.getMapping()) + tgt.addMapping(convertElementDefinitionMappingComponent(t)); + if (!tgt.hasId()) + tgt.setId(tgt.getPath()); + return tgt; + } + + public org.hl7.fhir.dstu2.model.ElementDefinition convertElementDefinition(org.hl7.fhir.r5.model.ElementDefinition src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.ElementDefinition tgt = new org.hl7.fhir.dstu2.model.ElementDefinition(); + copyElement(src, tgt); + tgt.setPath(src.getPath()); + for (org.hl7.fhir.r5.model.Enumeration t : src.getRepresentation()) + tgt.addRepresentation(convertPropertyRepresentation(t.getValue())); + if (src.hasSliceName()) + tgt.setName(src.getSliceName()); + else + tgt.setName(src.getId()); + tgt.setLabel(src.getLabel()); + for (org.hl7.fhir.r5.model.Coding t : src.getCode()) + tgt.addCode(convertCoding(t)); + if (src.hasSlicing()) + tgt.setSlicing(convertElementDefinitionSlicingComponent(src.getSlicing())); + tgt.setShort(src.getShort()); + tgt.setDefinition(src.getDefinition()); + tgt.setComments(src.getComment()); + tgt.setRequirements(src.getRequirements()); + for (org.hl7.fhir.r5.model.StringType t : src.getAlias()) + tgt.addAlias(t.getValue()); + tgt.setMin(src.getMin()); + tgt.setMax(src.getMax()); + if (src.hasBase()) + tgt.setBase(convertElementDefinitionBaseComponent(src.getBase())); + if (src.hasContentReference()) + tgt.setNameReference(src.getContentReference().substring(1)); + for (org.hl7.fhir.r5.model.ElementDefinition.TypeRefComponent t : src.getType()) + convertElementDefinitionTypeComponent(t, tgt.getType()); + tgt.setDefaultValue(convertType(src.getDefaultValue())); + tgt.setMeaningWhenMissing(src.getMeaningWhenMissing()); + tgt.setFixed(convertType(src.getFixed())); + tgt.setPattern(convertType(src.getPattern())); + if (src.hasExample()) + tgt.setExample(convertType(src.getExampleFirstRep().getValue())); + tgt.setMinValue(convertType(src.getMinValue())); + tgt.setMaxValue(convertType(src.getMaxValue())); + tgt.setMaxLength(src.getMaxLength()); + for (org.hl7.fhir.r5.model.IdType t : src.getCondition()) + tgt.addCondition(t.getValue()); + for (org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionConstraintComponent t : src.getConstraint()) + tgt.addConstraint(convertElementDefinitionConstraintComponent(t)); + tgt.setMustSupport(src.getMustSupport()); + tgt.setIsModifier(src.getIsModifier()); + if (src.hasIsModifierReason() && !VersionConvertorConstants.MODIFIER_REASON_LEGACY.equals(src.getIsModifierReason())) + org.hl7.fhir.dstu2.utils.ToolingExtensions.setStringExtension(tgt, VersionConvertorConstants.MODIFIER_REASON_EXTENSION, src.getIsModifierReason()); + tgt.setIsSummary(src.getIsSummary()); + if (src.hasBinding()) + tgt.setBinding(convertElementDefinitionBindingComponent(src.getBinding())); + for (org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionMappingComponent t : src.getMapping()) + tgt.addMapping(convertElementDefinitionMappingComponent(t)); + return tgt; + } + + public org.hl7.fhir.r5.model.ElementDefinition.PropertyRepresentation convertPropertyRepresentation(org.hl7.fhir.dstu2.model.ElementDefinition.PropertyRepresentation src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case XMLATTR: return org.hl7.fhir.r5.model.ElementDefinition.PropertyRepresentation.XMLATTR; + default: return org.hl7.fhir.r5.model.ElementDefinition.PropertyRepresentation.NULL; + } + } + + public org.hl7.fhir.dstu2.model.ElementDefinition.PropertyRepresentation convertPropertyRepresentation(org.hl7.fhir.r5.model.ElementDefinition.PropertyRepresentation src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case XMLATTR: return org.hl7.fhir.dstu2.model.ElementDefinition.PropertyRepresentation.XMLATTR; + default: return org.hl7.fhir.dstu2.model.ElementDefinition.PropertyRepresentation.NULL; + } + } + + public org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionSlicingComponent convertElementDefinitionSlicingComponent(org.hl7.fhir.dstu2.model.ElementDefinition.ElementDefinitionSlicingComponent src, List context, int pos) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionSlicingComponent tgt = new org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionSlicingComponent(); + copyElement(src, tgt); + org.hl7.fhir.dstu2.model.ElementDefinition slicingElement = context.get(pos); + for (org.hl7.fhir.dstu2.model.StringType t : src.getDiscriminator()) { + boolean isExists = false; + if (!t.asStringValue().contains("@")) { + int slices = 0; + boolean existsSlicePresent = false; + boolean notExistsSlicePresent = false; + String existsPath = slicingElement.getPath() + "." + t.asStringValue(); + for (int i = pos + 1; i < context.size(); i++) { + org.hl7.fhir.dstu2.model.ElementDefinition e = context.get(i); + if (e.getPath().equals(slicingElement.getPath())) + slices++; + else if (!e.getPath().startsWith(slicingElement.getPath() + ".")) + break; + else if (e.getPath().equals(existsPath)) { + if (e.hasMin() && e.getMin() > 0) + existsSlicePresent = true; + else if (e.hasMax() && e.getMax().equals("0")) + notExistsSlicePresent = true; + } + } + isExists = (slices==2 && existsSlicePresent && notExistsSlicePresent) || (slices==1 && existsSlicePresent!=notExistsSlicePresent); + } + tgt.addDiscriminator(ProfileUtilities.interpretR2Discriminator(t.getValue(), isExists)); + } + tgt.setDescription(src.getDescription()); + tgt.setOrdered(src.getOrdered()); + tgt.setRules(convertSlicingRules(src.getRules())); + return tgt; + } + + public org.hl7.fhir.dstu2.model.ElementDefinition.ElementDefinitionSlicingComponent convertElementDefinitionSlicingComponent(org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionSlicingComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.ElementDefinition.ElementDefinitionSlicingComponent tgt = new org.hl7.fhir.dstu2.model.ElementDefinition.ElementDefinitionSlicingComponent(); + copyElement(src, tgt); + for (ElementDefinitionSlicingDiscriminatorComponent t : src.getDiscriminator()) + tgt.addDiscriminator(ProfileUtilities.buildR2Discriminator(t)); + tgt.setDescription(src.getDescription()); + tgt.setOrdered(src.getOrdered()); + tgt.setRules(convertSlicingRules(src.getRules())); + return tgt; + } + + public org.hl7.fhir.r5.model.ElementDefinition.SlicingRules convertSlicingRules(org.hl7.fhir.dstu2.model.ElementDefinition.SlicingRules src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case CLOSED: return org.hl7.fhir.r5.model.ElementDefinition.SlicingRules.CLOSED; + case OPEN: return org.hl7.fhir.r5.model.ElementDefinition.SlicingRules.OPEN; + case OPENATEND: return org.hl7.fhir.r5.model.ElementDefinition.SlicingRules.OPENATEND; + default: return org.hl7.fhir.r5.model.ElementDefinition.SlicingRules.NULL; + } + } + + public org.hl7.fhir.dstu2.model.ElementDefinition.SlicingRules convertSlicingRules(org.hl7.fhir.r5.model.ElementDefinition.SlicingRules src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case CLOSED: return org.hl7.fhir.dstu2.model.ElementDefinition.SlicingRules.CLOSED; + case OPEN: return org.hl7.fhir.dstu2.model.ElementDefinition.SlicingRules.OPEN; + case OPENATEND: return org.hl7.fhir.dstu2.model.ElementDefinition.SlicingRules.OPENATEND; + default: return org.hl7.fhir.dstu2.model.ElementDefinition.SlicingRules.NULL; + } + } + + public org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionBaseComponent convertElementDefinitionBaseComponent(org.hl7.fhir.dstu2.model.ElementDefinition.ElementDefinitionBaseComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionBaseComponent tgt = new org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionBaseComponent(); + copyElement(src, tgt); + tgt.setPath(src.getPath()); + tgt.setMin(src.getMin()); + tgt.setMax(src.getMax()); + return tgt; + } + + public org.hl7.fhir.dstu2.model.ElementDefinition.ElementDefinitionBaseComponent convertElementDefinitionBaseComponent(org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionBaseComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.ElementDefinition.ElementDefinitionBaseComponent tgt = new org.hl7.fhir.dstu2.model.ElementDefinition.ElementDefinitionBaseComponent(); + copyElement(src, tgt); + tgt.setPath(src.getPath()); + tgt.setMin(src.getMin()); + tgt.setMax(src.getMax()); + return tgt; + } + + public void convertElementDefinitionTypeComponent(org.hl7.fhir.dstu2.model.ElementDefinition.TypeRefComponent src, List list) throws FHIRException { + if (src == null) + return ; + org.hl7.fhir.r5.model.ElementDefinition.TypeRefComponent tgt = null; + for (org.hl7.fhir.r5.model.ElementDefinition.TypeRefComponent t : list) + if (t.getCode().equals(src.getCode())) + tgt = t; + if (tgt == null) { + tgt = new org.hl7.fhir.r5.model.ElementDefinition.TypeRefComponent(); + list.add(tgt); + copyElement(src, tgt); + tgt.setCode(src.getCode()); + } + if (tgt.hasTarget()) { + for (org.hl7.fhir.dstu2.model.UriType u : src.getProfile()) + tgt.addTargetProfile(u.getValue()); + } else { + for (org.hl7.fhir.dstu2.model.UriType u : src.getProfile()) + tgt.addProfile(u.getValue()); + } + for (org.hl7.fhir.dstu2.model.Enumeration t : src.getAggregation()) { + org.hl7.fhir.r5.model.ElementDefinition.AggregationMode a = convertAggregationMode(t.getValue()); + if (!tgt.hasAggregation(a)) + tgt.addAggregation(a); + } + } + + public void convertElementDefinitionTypeComponent(org.hl7.fhir.r5.model.ElementDefinition.TypeRefComponent src, List list) throws FHIRException { + if (src == null) + return; + org.hl7.fhir.dstu2.model.ElementDefinition.TypeRefComponent tgt = new org.hl7.fhir.dstu2.model.ElementDefinition.TypeRefComponent(); + copyElement(src, tgt); + tgt.setCode(src.getCode()); + list.add(tgt); + if (src.hasTarget()) { + for (org.hl7.fhir.r5.model.UriType u : src.getTargetProfile()) { + tgt.addProfile(u.getValue()); + } + } else { + for (org.hl7.fhir.r5.model.UriType u : src.getProfile()) { + tgt.addProfile(u.getValue()); + } + } + } + + public org.hl7.fhir.r5.model.ElementDefinition.AggregationMode convertAggregationMode(org.hl7.fhir.dstu2.model.ElementDefinition.AggregationMode src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case CONTAINED: return org.hl7.fhir.r5.model.ElementDefinition.AggregationMode.CONTAINED; + case REFERENCED: return org.hl7.fhir.r5.model.ElementDefinition.AggregationMode.REFERENCED; + case BUNDLED: return org.hl7.fhir.r5.model.ElementDefinition.AggregationMode.BUNDLED; + default: return org.hl7.fhir.r5.model.ElementDefinition.AggregationMode.NULL; + } + } + + public org.hl7.fhir.dstu2.model.ElementDefinition.AggregationMode convertAggregationMode(org.hl7.fhir.r5.model.ElementDefinition.AggregationMode src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case CONTAINED: return org.hl7.fhir.dstu2.model.ElementDefinition.AggregationMode.CONTAINED; + case REFERENCED: return org.hl7.fhir.dstu2.model.ElementDefinition.AggregationMode.REFERENCED; + case BUNDLED: return org.hl7.fhir.dstu2.model.ElementDefinition.AggregationMode.BUNDLED; + default: return org.hl7.fhir.dstu2.model.ElementDefinition.AggregationMode.NULL; + } + } + + public org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionConstraintComponent convertElementDefinitionConstraintComponent(org.hl7.fhir.dstu2.model.ElementDefinition.ElementDefinitionConstraintComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionConstraintComponent tgt = new org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionConstraintComponent(); + copyElement(src, tgt); + tgt.setKey(src.getKey()); + tgt.setRequirements(src.getRequirements()); + tgt.setSeverity(convertConstraintSeverity(src.getSeverity())); + tgt.setHuman(src.getHuman()); + tgt.setExpression(ToolingExtensions.readStringExtension(src, ToolingExtensions.EXT_EXPRESSION)); + tgt.setXpath(src.getXpath()); + return tgt; + } + + public org.hl7.fhir.dstu2.model.ElementDefinition.ElementDefinitionConstraintComponent convertElementDefinitionConstraintComponent(org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionConstraintComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.ElementDefinition.ElementDefinitionConstraintComponent tgt = new org.hl7.fhir.dstu2.model.ElementDefinition.ElementDefinitionConstraintComponent(); + copyElement(src, tgt); + tgt.setKey(src.getKey()); + tgt.setRequirements(src.getRequirements()); + tgt.setSeverity(convertConstraintSeverity(src.getSeverity())); + tgt.setHuman(src.getHuman()); + if (src.hasExpression()) + ToolingExtensions.addStringExtension(tgt, ToolingExtensions.EXT_EXPRESSION, src.getExpression()); + tgt.setXpath(src.getXpath()); + return tgt; + } + + public org.hl7.fhir.r5.model.ElementDefinition.ConstraintSeverity convertConstraintSeverity(org.hl7.fhir.dstu2.model.ElementDefinition.ConstraintSeverity src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case ERROR: return org.hl7.fhir.r5.model.ElementDefinition.ConstraintSeverity.ERROR; + case WARNING: return org.hl7.fhir.r5.model.ElementDefinition.ConstraintSeverity.WARNING; + default: return org.hl7.fhir.r5.model.ElementDefinition.ConstraintSeverity.NULL; + } + } + + public org.hl7.fhir.dstu2.model.ElementDefinition.ConstraintSeverity convertConstraintSeverity(org.hl7.fhir.r5.model.ElementDefinition.ConstraintSeverity src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case ERROR: return org.hl7.fhir.dstu2.model.ElementDefinition.ConstraintSeverity.ERROR; + case WARNING: return org.hl7.fhir.dstu2.model.ElementDefinition.ConstraintSeverity.WARNING; + default: return org.hl7.fhir.dstu2.model.ElementDefinition.ConstraintSeverity.NULL; + } + } + + public org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionBindingComponent convertElementDefinitionBindingComponent(org.hl7.fhir.dstu2.model.ElementDefinition.ElementDefinitionBindingComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionBindingComponent tgt = new org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionBindingComponent(); + copyElement(src, tgt); + tgt.setStrength(convertBindingStrength(src.getStrength())); + tgt.setDescription(src.getDescription()); + org.hl7.fhir.r5.model.Type vs = convertType(src.getValueSet()); + if (vs != null) { + tgt.setValueSet(vs instanceof org.hl7.fhir.r5.model.Reference ? ((org.hl7.fhir.r5.model.Reference) vs).getReference() : vs.primitiveValue()); + tgt.setValueSet(VersionConvertorConstants.refToVS(tgt.getValueSet())); + } + return tgt; + } + + public org.hl7.fhir.dstu2.model.ElementDefinition.ElementDefinitionBindingComponent convertElementDefinitionBindingComponent(org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionBindingComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.ElementDefinition.ElementDefinitionBindingComponent tgt = new org.hl7.fhir.dstu2.model.ElementDefinition.ElementDefinitionBindingComponent(); + copyElement(src, tgt); + tgt.setStrength(convertBindingStrength(src.getStrength())); + tgt.setDescription(src.getDescription()); + if (src.hasValueSet()) { + String vsr = VersionConvertorConstants.vsToRef(src.getValueSet()); + if (vsr != null) + tgt.setValueSet(new org.hl7.fhir.dstu2.model.UriType(vsr)); + else + tgt.setValueSet(new org.hl7.fhir.dstu2.model.Reference(src.getValueSet())); + } + return tgt; + } + + public org.hl7.fhir.r5.model.Enumerations.BindingStrength convertBindingStrength(org.hl7.fhir.dstu2.model.Enumerations.BindingStrength src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case REQUIRED: return org.hl7.fhir.r5.model.Enumerations.BindingStrength.REQUIRED; + case EXTENSIBLE: return org.hl7.fhir.r5.model.Enumerations.BindingStrength.EXTENSIBLE; + case PREFERRED: return org.hl7.fhir.r5.model.Enumerations.BindingStrength.PREFERRED; + case EXAMPLE: return org.hl7.fhir.r5.model.Enumerations.BindingStrength.EXAMPLE; + default: return org.hl7.fhir.r5.model.Enumerations.BindingStrength.NULL; + } + } + + public org.hl7.fhir.dstu2.model.Enumerations.BindingStrength convertBindingStrength(org.hl7.fhir.r5.model.Enumerations.BindingStrength src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case REQUIRED: return org.hl7.fhir.dstu2.model.Enumerations.BindingStrength.REQUIRED; + case EXTENSIBLE: return org.hl7.fhir.dstu2.model.Enumerations.BindingStrength.EXTENSIBLE; + case PREFERRED: return org.hl7.fhir.dstu2.model.Enumerations.BindingStrength.PREFERRED; + case EXAMPLE: return org.hl7.fhir.dstu2.model.Enumerations.BindingStrength.EXAMPLE; + default: return org.hl7.fhir.dstu2.model.Enumerations.BindingStrength.NULL; + } + } + + public org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionMappingComponent convertElementDefinitionMappingComponent(org.hl7.fhir.dstu2.model.ElementDefinition.ElementDefinitionMappingComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionMappingComponent tgt = new org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionMappingComponent(); + copyElement(src, tgt); + tgt.setIdentity(src.getIdentity()); + tgt.setLanguage(src.getLanguage()); + tgt.setMap(src.getMap()); + return tgt; + } + + public org.hl7.fhir.dstu2.model.ElementDefinition.ElementDefinitionMappingComponent convertElementDefinitionMappingComponent(org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionMappingComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.ElementDefinition.ElementDefinitionMappingComponent tgt = new org.hl7.fhir.dstu2.model.ElementDefinition.ElementDefinitionMappingComponent(); + copyElement(src, tgt); + tgt.setIdentity(src.getIdentity()); + tgt.setLanguage(src.getLanguage()); + tgt.setMap(src.getMap()); + return tgt; + } + + public org.hl7.fhir.r5.model.HumanName convertHumanName(org.hl7.fhir.dstu2.model.HumanName src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.HumanName tgt = new org.hl7.fhir.r5.model.HumanName(); + copyElement(src, tgt); + tgt.setUse(convertNameUse(src.getUse())); + tgt.setText(src.getText()); + for (org.hl7.fhir.dstu2.model.StringType t : src.getFamily()) + tgt.setFamily(t.getValue()); + for (org.hl7.fhir.dstu2.model.StringType t : src.getGiven()) + tgt.addGiven(t.getValue()); + for (org.hl7.fhir.dstu2.model.StringType t : src.getPrefix()) + tgt.addPrefix(t.getValue()); + for (org.hl7.fhir.dstu2.model.StringType t : src.getSuffix()) + tgt.addSuffix(t.getValue()); + tgt.setPeriod(convertPeriod(src.getPeriod())); + return tgt; + } + + public org.hl7.fhir.dstu2.model.HumanName convertHumanName(org.hl7.fhir.r5.model.HumanName src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.HumanName tgt = new org.hl7.fhir.dstu2.model.HumanName(); + copyElement(src, tgt); + tgt.setUse(convertNameUse(src.getUse())); + tgt.setText(src.getText()); + if (src.hasFamily()) + tgt.addFamily(src.getFamily()); + for (org.hl7.fhir.r5.model.StringType t : src.getGiven()) + tgt.addGiven(t.getValue()); + for (org.hl7.fhir.r5.model.StringType t : src.getPrefix()) + tgt.addPrefix(t.getValue()); + for (org.hl7.fhir.r5.model.StringType t : src.getSuffix()) + tgt.addSuffix(t.getValue()); + tgt.setPeriod(convertPeriod(src.getPeriod())); + return tgt; + } + + public org.hl7.fhir.r5.model.HumanName.NameUse convertNameUse(org.hl7.fhir.dstu2.model.HumanName.NameUse src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case USUAL: return org.hl7.fhir.r5.model.HumanName.NameUse.USUAL; + case OFFICIAL: return org.hl7.fhir.r5.model.HumanName.NameUse.OFFICIAL; + case TEMP: return org.hl7.fhir.r5.model.HumanName.NameUse.TEMP; + case NICKNAME: return org.hl7.fhir.r5.model.HumanName.NameUse.NICKNAME; + case ANONYMOUS: return org.hl7.fhir.r5.model.HumanName.NameUse.ANONYMOUS; + case OLD: return org.hl7.fhir.r5.model.HumanName.NameUse.OLD; + case MAIDEN: return org.hl7.fhir.r5.model.HumanName.NameUse.MAIDEN; + default: return org.hl7.fhir.r5.model.HumanName.NameUse.NULL; + } + } + + public org.hl7.fhir.dstu2.model.HumanName.NameUse convertNameUse(org.hl7.fhir.r5.model.HumanName.NameUse src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case USUAL: return org.hl7.fhir.dstu2.model.HumanName.NameUse.USUAL; + case OFFICIAL: return org.hl7.fhir.dstu2.model.HumanName.NameUse.OFFICIAL; + case TEMP: return org.hl7.fhir.dstu2.model.HumanName.NameUse.TEMP; + case NICKNAME: return org.hl7.fhir.dstu2.model.HumanName.NameUse.NICKNAME; + case ANONYMOUS: return org.hl7.fhir.dstu2.model.HumanName.NameUse.ANONYMOUS; + case OLD: return org.hl7.fhir.dstu2.model.HumanName.NameUse.OLD; + case MAIDEN: return org.hl7.fhir.dstu2.model.HumanName.NameUse.MAIDEN; + default: return org.hl7.fhir.dstu2.model.HumanName.NameUse.NULL; + } + } + + public org.hl7.fhir.r5.model.Meta convertMeta(org.hl7.fhir.dstu2.model.Meta src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Meta tgt = new org.hl7.fhir.r5.model.Meta(); + copyElement(src, tgt); + tgt.setVersionId(src.getVersionId()); + tgt.setLastUpdated(src.getLastUpdated()); + for (org.hl7.fhir.dstu2.model.UriType t : src.getProfile()) + tgt.addProfile(t.getValue()); + for (org.hl7.fhir.dstu2.model.Coding t : src.getSecurity()) + tgt.addSecurity(convertCoding(t)); + for (org.hl7.fhir.dstu2.model.Coding t : src.getTag()) + tgt.addTag(convertCoding(t)); + return tgt; + } + + public org.hl7.fhir.dstu2.model.Meta convertMeta(org.hl7.fhir.r5.model.Meta src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Meta tgt = new org.hl7.fhir.dstu2.model.Meta(); + copyElement(src, tgt); + tgt.setVersionId(src.getVersionId()); + tgt.setLastUpdated(src.getLastUpdated()); + for (org.hl7.fhir.r5.model.UriType t : src.getProfile()) + tgt.addProfile(t.getValue()); + for (org.hl7.fhir.r5.model.Coding t : src.getSecurity()) + tgt.addSecurity(convertCoding(t)); + for (org.hl7.fhir.r5.model.Coding t : src.getTag()) + tgt.addTag(convertCoding(t)); + return tgt; + } + + public org.hl7.fhir.r5.model.Timing convertTiming(org.hl7.fhir.dstu2.model.Timing src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Timing tgt = new org.hl7.fhir.r5.model.Timing(); + copyElement(src, tgt); + for (org.hl7.fhir.dstu2.model.DateTimeType t : src.getEvent()) + tgt.addEvent(t.getValue()); + tgt.setRepeat(convertTimingRepeatComponent(src.getRepeat())); + tgt.setCode(convertCodeableConcept(src.getCode())); + return tgt; + } + + public org.hl7.fhir.dstu2.model.Timing convertTiming(org.hl7.fhir.r5.model.Timing src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Timing tgt = new org.hl7.fhir.dstu2.model.Timing(); + copyElement(src, tgt); + for (org.hl7.fhir.r5.model.DateTimeType t : src.getEvent()) + tgt.addEvent(t.getValue()); + tgt.setRepeat(convertTimingRepeatComponent(src.getRepeat())); + tgt.setCode(convertCodeableConcept(src.getCode())); + return tgt; + } + + public org.hl7.fhir.r5.model.Timing.TimingRepeatComponent convertTimingRepeatComponent(org.hl7.fhir.dstu2.model.Timing.TimingRepeatComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Timing.TimingRepeatComponent tgt = new org.hl7.fhir.r5.model.Timing.TimingRepeatComponent(); + copyElement(src, tgt); + tgt.setBounds(convertType(src.getBounds())); + tgt.setCount(src.getCount()); + tgt.setDuration(src.getDuration()); + tgt.setDurationMax(src.getDurationMax()); + tgt.setDurationUnit(convertUnitsOfTime(src.getDurationUnits())); + tgt.setFrequency(src.getFrequency()); + tgt.setFrequencyMax(src.getFrequencyMax()); + tgt.setPeriod(src.getPeriod()); + tgt.setPeriodMax(src.getPeriodMax()); + tgt.setPeriodUnit(convertUnitsOfTime(src.getPeriodUnits())); + tgt.addWhen(convertEventTiming(src.getWhen())); + return tgt; + } + + public org.hl7.fhir.dstu2.model.Timing.TimingRepeatComponent convertTimingRepeatComponent(org.hl7.fhir.r5.model.Timing.TimingRepeatComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Timing.TimingRepeatComponent tgt = new org.hl7.fhir.dstu2.model.Timing.TimingRepeatComponent(); + copyElement(src, tgt); + tgt.setBounds(convertType(src.getBounds())); + tgt.setCount(src.getCount()); + tgt.setDuration(src.getDuration()); + tgt.setDurationMax(src.getDurationMax()); + tgt.setDurationUnits(convertUnitsOfTime(src.getDurationUnit())); + tgt.setFrequency(src.getFrequency()); + tgt.setFrequencyMax(src.getFrequencyMax()); + tgt.setPeriod(src.getPeriod()); + tgt.setPeriodMax(src.getPeriodMax()); + tgt.setPeriodUnits(convertUnitsOfTime(src.getPeriodUnit())); + for (Enumeration t : src.getWhen()) + tgt.setWhen(convertEventTiming(t.getValue())); + return tgt; + } + + public org.hl7.fhir.r5.model.Timing.UnitsOfTime convertUnitsOfTime(org.hl7.fhir.dstu2.model.Timing.UnitsOfTime src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case S: return org.hl7.fhir.r5.model.Timing.UnitsOfTime.S; + case MIN: return org.hl7.fhir.r5.model.Timing.UnitsOfTime.MIN; + case H: return org.hl7.fhir.r5.model.Timing.UnitsOfTime.H; + case D: return org.hl7.fhir.r5.model.Timing.UnitsOfTime.D; + case WK: return org.hl7.fhir.r5.model.Timing.UnitsOfTime.WK; + case MO: return org.hl7.fhir.r5.model.Timing.UnitsOfTime.MO; + case A: return org.hl7.fhir.r5.model.Timing.UnitsOfTime.A; + default: return org.hl7.fhir.r5.model.Timing.UnitsOfTime.NULL; + } + } + + public org.hl7.fhir.dstu2.model.Timing.UnitsOfTime convertUnitsOfTime(org.hl7.fhir.r5.model.Timing.UnitsOfTime src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case S: return org.hl7.fhir.dstu2.model.Timing.UnitsOfTime.S; + case MIN: return org.hl7.fhir.dstu2.model.Timing.UnitsOfTime.MIN; + case H: return org.hl7.fhir.dstu2.model.Timing.UnitsOfTime.H; + case D: return org.hl7.fhir.dstu2.model.Timing.UnitsOfTime.D; + case WK: return org.hl7.fhir.dstu2.model.Timing.UnitsOfTime.WK; + case MO: return org.hl7.fhir.dstu2.model.Timing.UnitsOfTime.MO; + case A: return org.hl7.fhir.dstu2.model.Timing.UnitsOfTime.A; + default: return org.hl7.fhir.dstu2.model.Timing.UnitsOfTime.NULL; + } + } + + public org.hl7.fhir.r5.model.Timing.EventTiming convertEventTiming(org.hl7.fhir.dstu2.model.Timing.EventTiming src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case HS: return org.hl7.fhir.r5.model.Timing.EventTiming.HS; + case WAKE: return org.hl7.fhir.r5.model.Timing.EventTiming.WAKE; + case C: return org.hl7.fhir.r5.model.Timing.EventTiming.C; + case CM: return org.hl7.fhir.r5.model.Timing.EventTiming.CM; + case CD: return org.hl7.fhir.r5.model.Timing.EventTiming.CD; + case CV: return org.hl7.fhir.r5.model.Timing.EventTiming.CV; + case AC: return org.hl7.fhir.r5.model.Timing.EventTiming.AC; + case ACM: return org.hl7.fhir.r5.model.Timing.EventTiming.ACM; + case ACD: return org.hl7.fhir.r5.model.Timing.EventTiming.ACD; + case ACV: return org.hl7.fhir.r5.model.Timing.EventTiming.ACV; + case PC: return org.hl7.fhir.r5.model.Timing.EventTiming.PC; + case PCM: return org.hl7.fhir.r5.model.Timing.EventTiming.PCM; + case PCD: return org.hl7.fhir.r5.model.Timing.EventTiming.PCD; + case PCV: return org.hl7.fhir.r5.model.Timing.EventTiming.PCV; + default: return org.hl7.fhir.r5.model.Timing.EventTiming.NULL; + } + } + + public org.hl7.fhir.dstu2.model.Timing.EventTiming convertEventTiming(org.hl7.fhir.r5.model.Timing.EventTiming src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case HS: return org.hl7.fhir.dstu2.model.Timing.EventTiming.HS; + case WAKE: return org.hl7.fhir.dstu2.model.Timing.EventTiming.WAKE; + case C: return org.hl7.fhir.dstu2.model.Timing.EventTiming.C; + case CM: return org.hl7.fhir.dstu2.model.Timing.EventTiming.CM; + case CD: return org.hl7.fhir.dstu2.model.Timing.EventTiming.CD; + case CV: return org.hl7.fhir.dstu2.model.Timing.EventTiming.CV; + case AC: return org.hl7.fhir.dstu2.model.Timing.EventTiming.AC; + case ACM: return org.hl7.fhir.dstu2.model.Timing.EventTiming.ACM; + case ACD: return org.hl7.fhir.dstu2.model.Timing.EventTiming.ACD; + case ACV: return org.hl7.fhir.dstu2.model.Timing.EventTiming.ACV; + case PC: return org.hl7.fhir.dstu2.model.Timing.EventTiming.PC; + case PCM: return org.hl7.fhir.dstu2.model.Timing.EventTiming.PCM; + case PCD: return org.hl7.fhir.dstu2.model.Timing.EventTiming.PCD; + case PCV: return org.hl7.fhir.dstu2.model.Timing.EventTiming.PCV; + default: return org.hl7.fhir.dstu2.model.Timing.EventTiming.NULL; + } + } + + public org.hl7.fhir.r5.model.Age convertAge(org.hl7.fhir.dstu2.model.Age src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Age tgt = new org.hl7.fhir.r5.model.Age(); + copyElement(src, tgt); + tgt.setValue(src.getValue()); + tgt.setComparator(convertQuantityComparator(src.getComparator())); + tgt.setUnit(src.getUnit()); + tgt.setSystem(src.getSystem()); + tgt.setCode(src.getCode()); + return tgt; + } + + public org.hl7.fhir.dstu2.model.Age convertAge(org.hl7.fhir.r5.model.Age src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Age tgt = new org.hl7.fhir.dstu2.model.Age(); + copyElement(src, tgt); + tgt.setValue(src.getValue()); + tgt.setComparator(convertQuantityComparator(src.getComparator())); + tgt.setUnit(src.getUnit()); + tgt.setSystem(src.getSystem()); + tgt.setCode(src.getCode()); + return tgt; + } + + public org.hl7.fhir.r5.model.Count convertCount(org.hl7.fhir.dstu2.model.Count src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Count tgt = new org.hl7.fhir.r5.model.Count(); + copyElement(src, tgt); + tgt.setValue(src.getValue()); + tgt.setComparator(convertQuantityComparator(src.getComparator())); + tgt.setUnit(src.getUnit()); + tgt.setSystem(src.getSystem()); + tgt.setCode(src.getCode()); + return tgt; + } + + public org.hl7.fhir.dstu2.model.Count convertCount(org.hl7.fhir.r5.model.Count src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Count tgt = new org.hl7.fhir.dstu2.model.Count(); + copyElement(src, tgt); + tgt.setValue(src.getValue()); + tgt.setComparator(convertQuantityComparator(src.getComparator())); + tgt.setUnit(src.getUnit()); + tgt.setSystem(src.getSystem()); + tgt.setCode(src.getCode()); + return tgt; + } + + public org.hl7.fhir.r5.model.Distance convertDistance(org.hl7.fhir.dstu2.model.Distance src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Distance tgt = new org.hl7.fhir.r5.model.Distance(); + copyElement(src, tgt); + tgt.setValue(src.getValue()); + tgt.setComparator(convertQuantityComparator(src.getComparator())); + tgt.setUnit(src.getUnit()); + tgt.setSystem(src.getSystem()); + tgt.setCode(src.getCode()); + return tgt; + } + + public org.hl7.fhir.dstu2.model.Distance convertDistance(org.hl7.fhir.r5.model.Distance src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Distance tgt = new org.hl7.fhir.dstu2.model.Distance(); + copyElement(src, tgt); + tgt.setValue(src.getValue()); + tgt.setComparator(convertQuantityComparator(src.getComparator())); + tgt.setUnit(src.getUnit()); + tgt.setSystem(src.getSystem()); + tgt.setCode(src.getCode()); + return tgt; + } + + public org.hl7.fhir.r5.model.Duration convertDuration(org.hl7.fhir.dstu2.model.Duration src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Duration tgt = new org.hl7.fhir.r5.model.Duration(); + copyElement(src, tgt); + tgt.setValue(src.getValue()); + tgt.setComparator(convertQuantityComparator(src.getComparator())); + tgt.setUnit(src.getUnit()); + tgt.setSystem(src.getSystem()); + tgt.setCode(src.getCode()); + return tgt; + } + + public org.hl7.fhir.dstu2.model.Duration convertDuration(org.hl7.fhir.r5.model.Duration src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Duration tgt = new org.hl7.fhir.dstu2.model.Duration(); + copyElement(src, tgt); + tgt.setValue(src.getValue()); + tgt.setComparator(convertQuantityComparator(src.getComparator())); + tgt.setUnit(src.getUnit()); + tgt.setSystem(src.getSystem()); + tgt.setCode(src.getCode()); + return tgt; + } + + public org.hl7.fhir.r5.model.Money convertMoney(org.hl7.fhir.dstu2.model.Money src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Money tgt = new org.hl7.fhir.r5.model.Money(); + copyElement(src, tgt); + tgt.setValue(src.getValue()); + tgt.setCurrency(src.getCode()); + return tgt; + } + + public org.hl7.fhir.dstu2.model.Money convertMoney(org.hl7.fhir.r5.model.Money src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Money tgt = new org.hl7.fhir.dstu2.model.Money(); + copyElement(src, tgt); + tgt.setValue(src.getValue()); + tgt.setCode(src.getCurrency()); + return tgt; + } + + public org.hl7.fhir.r5.model.Quantity convertSimpleQuantity(org.hl7.fhir.dstu2.model.SimpleQuantity src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.SimpleQuantity tgt = new org.hl7.fhir.r5.model.SimpleQuantity(); + copyElement(src, tgt); + tgt.setValue(src.getValue()); + tgt.setComparator(convertQuantityComparator(src.getComparator())); + tgt.setUnit(src.getUnit()); + tgt.setSystem(src.getSystem()); + tgt.setCode(src.getCode()); + return tgt; + } + + public org.hl7.fhir.dstu2.model.SimpleQuantity convertSimpleQuantity(org.hl7.fhir.r5.model.Quantity src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.SimpleQuantity tgt = new org.hl7.fhir.dstu2.model.SimpleQuantity(); + copyElement(src, tgt); + tgt.setValue(src.getValue()); + tgt.setComparator(convertQuantityComparator(src.getComparator())); + tgt.setUnit(src.getUnit()); + tgt.setSystem(src.getSystem()); + tgt.setCode(src.getCode()); + return tgt; + } + + public org.hl7.fhir.r5.model.Type convertType(org.hl7.fhir.dstu2.model.Type src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + if (src instanceof org.hl7.fhir.dstu2.model.Base64BinaryType) + return convertBase64Binary((org.hl7.fhir.dstu2.model.Base64BinaryType) src); + if (src instanceof org.hl7.fhir.dstu2.model.BooleanType) + return convertBoolean((org.hl7.fhir.dstu2.model.BooleanType) src); + if (src instanceof org.hl7.fhir.dstu2.model.CodeType) + return convertCode((org.hl7.fhir.dstu2.model.CodeType) src); + if (src instanceof org.hl7.fhir.dstu2.model.DateType) + return convertDate((org.hl7.fhir.dstu2.model.DateType) src); + if (src instanceof org.hl7.fhir.dstu2.model.DateTimeType) + return convertDateTime((org.hl7.fhir.dstu2.model.DateTimeType) src); + if (src instanceof org.hl7.fhir.dstu2.model.DecimalType) + return convertDecimal((org.hl7.fhir.dstu2.model.DecimalType) src); + if (src instanceof org.hl7.fhir.dstu2.model.IdType) + return convertId((org.hl7.fhir.dstu2.model.IdType) src); + if (src instanceof org.hl7.fhir.dstu2.model.InstantType) + return convertInstant((org.hl7.fhir.dstu2.model.InstantType) src); + if (src instanceof org.hl7.fhir.dstu2.model.IntegerType) + return convertInteger((org.hl7.fhir.dstu2.model.IntegerType) src); + if (src instanceof org.hl7.fhir.dstu2.model.MarkdownType) + return convertMarkdown((org.hl7.fhir.dstu2.model.MarkdownType) src); + if (src instanceof org.hl7.fhir.dstu2.model.OidType) + return convertOid((org.hl7.fhir.dstu2.model.OidType) src); + if (src instanceof org.hl7.fhir.dstu2.model.PositiveIntType) + return convertPositiveInt((org.hl7.fhir.dstu2.model.PositiveIntType) src); + if (src instanceof org.hl7.fhir.dstu2.model.StringType) + return convertString((org.hl7.fhir.dstu2.model.StringType) src); + if (src instanceof org.hl7.fhir.dstu2.model.TimeType) + return convertTime((org.hl7.fhir.dstu2.model.TimeType) src); + if (src instanceof org.hl7.fhir.dstu2.model.UnsignedIntType) + return convertUnsignedInt((org.hl7.fhir.dstu2.model.UnsignedIntType) src); + if (src instanceof org.hl7.fhir.dstu2.model.UriType) + return convertUri((org.hl7.fhir.dstu2.model.UriType) src); + if (src instanceof org.hl7.fhir.dstu2.model.UuidType) + return convertUuid((org.hl7.fhir.dstu2.model.UuidType) src); + if (src instanceof org.hl7.fhir.dstu2.model.Extension) + return convertExtension((org.hl7.fhir.dstu2.model.Extension) src); + if (src instanceof org.hl7.fhir.dstu2.model.Narrative) + return convertNarrative((org.hl7.fhir.dstu2.model.Narrative) src); + if (src instanceof org.hl7.fhir.dstu2.model.Annotation) + return convertAnnotation((org.hl7.fhir.dstu2.model.Annotation) src); + if (src instanceof org.hl7.fhir.dstu2.model.Attachment) + return convertAttachment((org.hl7.fhir.dstu2.model.Attachment) src); + if (src instanceof org.hl7.fhir.dstu2.model.CodeableConcept) + return convertCodeableConcept((org.hl7.fhir.dstu2.model.CodeableConcept) src); + if (src instanceof org.hl7.fhir.dstu2.model.Coding) + return convertCoding((org.hl7.fhir.dstu2.model.Coding) src); + if (src instanceof org.hl7.fhir.dstu2.model.Identifier) + return convertIdentifier((org.hl7.fhir.dstu2.model.Identifier) src); + if (src instanceof org.hl7.fhir.dstu2.model.Period) + return convertPeriod((org.hl7.fhir.dstu2.model.Period) src); + if (src instanceof org.hl7.fhir.dstu2.model.Quantity) + return convertQuantity((org.hl7.fhir.dstu2.model.Quantity) src); + if (src instanceof org.hl7.fhir.dstu2.model.Range) + return convertRange((org.hl7.fhir.dstu2.model.Range) src); + if (src instanceof org.hl7.fhir.dstu2.model.Ratio) + return convertRatio((org.hl7.fhir.dstu2.model.Ratio) src); + if (src instanceof org.hl7.fhir.dstu2.model.Reference) + return convertReference((org.hl7.fhir.dstu2.model.Reference) src); + if (src instanceof org.hl7.fhir.dstu2.model.SampledData) + return convertSampledData((org.hl7.fhir.dstu2.model.SampledData) src); + if (src instanceof org.hl7.fhir.dstu2.model.Signature) + return convertSignature((org.hl7.fhir.dstu2.model.Signature) src); + if (src instanceof org.hl7.fhir.dstu2.model.Address) + return convertAddress((org.hl7.fhir.dstu2.model.Address) src); + if (src instanceof org.hl7.fhir.dstu2.model.ContactPoint) + return convertContactPoint((org.hl7.fhir.dstu2.model.ContactPoint) src); + if (src instanceof org.hl7.fhir.dstu2.model.HumanName) + return convertHumanName((org.hl7.fhir.dstu2.model.HumanName) src); + if (src instanceof org.hl7.fhir.dstu2.model.Meta) + return convertMeta((org.hl7.fhir.dstu2.model.Meta) src); + if (src instanceof org.hl7.fhir.dstu2.model.Timing) + return convertTiming((org.hl7.fhir.dstu2.model.Timing) src); + if (src instanceof org.hl7.fhir.dstu2.model.Age) + return convertAge((org.hl7.fhir.dstu2.model.Age) src); + if (src instanceof org.hl7.fhir.dstu2.model.Count) + return convertCount((org.hl7.fhir.dstu2.model.Count) src); + if (src instanceof org.hl7.fhir.dstu2.model.Distance) + return convertDistance((org.hl7.fhir.dstu2.model.Distance) src); + if (src instanceof org.hl7.fhir.dstu2.model.Duration) + return convertDuration((org.hl7.fhir.dstu2.model.Duration) src); + if (src instanceof org.hl7.fhir.dstu2.model.Money) + return convertMoney((org.hl7.fhir.dstu2.model.Money) src); + if (src instanceof org.hl7.fhir.dstu2.model.SimpleQuantity) + return convertSimpleQuantity((org.hl7.fhir.dstu2.model.SimpleQuantity) src); + throw new FHIRException("Unknown type "+src.fhirType()); + } + + public org.hl7.fhir.dstu2.model.Type convertType(org.hl7.fhir.r5.model.Type src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + if (src instanceof org.hl7.fhir.r5.model.Base64BinaryType) + return convertBase64Binary((org.hl7.fhir.r5.model.Base64BinaryType) src); + if (src instanceof org.hl7.fhir.r5.model.BooleanType) + return convertBoolean((org.hl7.fhir.r5.model.BooleanType) src); + if (src instanceof org.hl7.fhir.r5.model.CodeType) + return convertCode((org.hl7.fhir.r5.model.CodeType) src); + if (src instanceof org.hl7.fhir.r5.model.DateType) + return convertDate((org.hl7.fhir.r5.model.DateType) src); + if (src instanceof org.hl7.fhir.r5.model.DateTimeType) + return convertDateTime((org.hl7.fhir.r5.model.DateTimeType) src); + if (src instanceof org.hl7.fhir.r5.model.DecimalType) + return convertDecimal((org.hl7.fhir.r5.model.DecimalType) src); + if (src instanceof org.hl7.fhir.r5.model.IdType) + return convertId((org.hl7.fhir.r5.model.IdType) src); + if (src instanceof org.hl7.fhir.r5.model.InstantType) + return convertInstant((org.hl7.fhir.r5.model.InstantType) src); + if (src instanceof org.hl7.fhir.r5.model.IntegerType) + return convertInteger((org.hl7.fhir.r5.model.IntegerType) src); + if (src instanceof org.hl7.fhir.r5.model.MarkdownType) + return convertMarkdown((org.hl7.fhir.r5.model.MarkdownType) src); + if (src instanceof org.hl7.fhir.r5.model.OidType) + return convertOid((org.hl7.fhir.r5.model.OidType) src); + if (src instanceof org.hl7.fhir.r5.model.PositiveIntType) + return convertPositiveInt((org.hl7.fhir.r5.model.PositiveIntType) src); + if (src instanceof org.hl7.fhir.r5.model.StringType) + return convertString((org.hl7.fhir.r5.model.StringType) src); + if (src instanceof org.hl7.fhir.r5.model.TimeType) + return convertTime((org.hl7.fhir.r5.model.TimeType) src); + if (src instanceof org.hl7.fhir.r5.model.UnsignedIntType) + return convertUnsignedInt((org.hl7.fhir.r5.model.UnsignedIntType) src); + if (src instanceof org.hl7.fhir.r5.model.UriType) + return convertUri((org.hl7.fhir.r5.model.UriType) src); + if (src instanceof org.hl7.fhir.r5.model.UuidType) + return convertUuid((org.hl7.fhir.r5.model.UuidType) src); + if (src instanceof org.hl7.fhir.r5.model.Extension) + return convertExtension((org.hl7.fhir.r5.model.Extension) src); + if (src instanceof org.hl7.fhir.r5.model.Narrative) + return convertNarrative((org.hl7.fhir.r5.model.Narrative) src); + if (src instanceof org.hl7.fhir.r5.model.Annotation) + return convertAnnotation((org.hl7.fhir.r5.model.Annotation) src); + if (src instanceof org.hl7.fhir.r5.model.Attachment) + return convertAttachment((org.hl7.fhir.r5.model.Attachment) src); + if (src instanceof org.hl7.fhir.r5.model.CodeableConcept) + return convertCodeableConcept((org.hl7.fhir.r5.model.CodeableConcept) src); + if (src instanceof org.hl7.fhir.r5.model.Coding) + return convertCoding((org.hl7.fhir.r5.model.Coding) src); + if (src instanceof org.hl7.fhir.r5.model.Identifier) + return convertIdentifier((org.hl7.fhir.r5.model.Identifier) src); + if (src instanceof org.hl7.fhir.r5.model.Period) + return convertPeriod((org.hl7.fhir.r5.model.Period) src); + if (src instanceof org.hl7.fhir.r5.model.Quantity) + return convertQuantity((org.hl7.fhir.r5.model.Quantity) src); + if (src instanceof org.hl7.fhir.r5.model.Range) + return convertRange((org.hl7.fhir.r5.model.Range) src); + if (src instanceof org.hl7.fhir.r5.model.Ratio) + return convertRatio((org.hl7.fhir.r5.model.Ratio) src); + if (src instanceof org.hl7.fhir.r5.model.Reference) + return convertReference((org.hl7.fhir.r5.model.Reference) src); + if (src instanceof org.hl7.fhir.r5.model.SampledData) + return convertSampledData((org.hl7.fhir.r5.model.SampledData) src); + if (src instanceof org.hl7.fhir.r5.model.Signature) + return convertSignature((org.hl7.fhir.r5.model.Signature) src); + if (src instanceof org.hl7.fhir.r5.model.Address) + return convertAddress((org.hl7.fhir.r5.model.Address) src); + if (src instanceof org.hl7.fhir.r5.model.ContactPoint) + return convertContactPoint((org.hl7.fhir.r5.model.ContactPoint) src); + if (src instanceof org.hl7.fhir.r5.model.HumanName) + return convertHumanName((org.hl7.fhir.r5.model.HumanName) src); + if (src instanceof org.hl7.fhir.r5.model.Meta) + return convertMeta((org.hl7.fhir.r5.model.Meta) src); + if (src instanceof org.hl7.fhir.r5.model.Timing) + return convertTiming((org.hl7.fhir.r5.model.Timing) src); + if (src instanceof org.hl7.fhir.r5.model.Age) + return convertAge((org.hl7.fhir.r5.model.Age) src); + if (src instanceof org.hl7.fhir.r5.model.Count) + return convertCount((org.hl7.fhir.r5.model.Count) src); + if (src instanceof org.hl7.fhir.r5.model.Distance) + return convertDistance((org.hl7.fhir.r5.model.Distance) src); + if (src instanceof org.hl7.fhir.r5.model.Duration) + return convertDuration((org.hl7.fhir.r5.model.Duration) src); + if (src instanceof org.hl7.fhir.r5.model.Money) + return convertMoney((org.hl7.fhir.r5.model.Money) src); + if (src instanceof org.hl7.fhir.r5.model.SimpleQuantity) + return convertSimpleQuantity((org.hl7.fhir.r5.model.SimpleQuantity) src); + throw new FHIRException("Unknown type "+src.fhirType()); + } + + public void copyDomainResource(org.hl7.fhir.dstu2.model.DomainResource src, org.hl7.fhir.r5.model.DomainResource tgt) throws FHIRException { + copyResource(src, tgt); + tgt.setText(convertNarrative(src.getText())); + for (org.hl7.fhir.dstu2.model.Resource t : src.getContained()) + tgt.addContained(convertResource(t)); + for (org.hl7.fhir.dstu2.model.Extension t : src.getExtension()) + tgt.addExtension(convertExtension(t)); + for (org.hl7.fhir.dstu2.model.Extension t : src.getModifierExtension()) + tgt.addModifierExtension(convertExtension(t)); + } + public void copyDomainResource(org.hl7.fhir.r5.model.DomainResource src, org.hl7.fhir.dstu2.model.DomainResource tgt) throws FHIRException { + copyResource(src, tgt); + tgt.setText(convertNarrative(src.getText())); + for (org.hl7.fhir.r5.model.Resource t : src.getContained()) + tgt.addContained(convertResource(t)); + for (org.hl7.fhir.r5.model.Extension t : src.getExtension()) + tgt.addExtension(convertExtension(t)); + for (org.hl7.fhir.r5.model.Extension t : src.getModifierExtension()) + tgt.addModifierExtension(convertExtension(t)); + } + + public org.hl7.fhir.r5.model.Parameters convertParameters(org.hl7.fhir.dstu2.model.Parameters src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Parameters tgt = new org.hl7.fhir.r5.model.Parameters(); + copyResource(src, tgt); + for (org.hl7.fhir.dstu2.model.Parameters.ParametersParameterComponent t : src.getParameter()) + tgt.addParameter(convertParametersParameterComponent(t)); + return tgt; + } + + public org.hl7.fhir.dstu2.model.Parameters convertParameters(org.hl7.fhir.r5.model.Parameters src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Parameters tgt = new org.hl7.fhir.dstu2.model.Parameters(); + copyResource(src, tgt); + for (org.hl7.fhir.r5.model.Parameters.ParametersParameterComponent t : src.getParameter()) + tgt.addParameter(convertParametersParameterComponent(t)); + return tgt; + } + + public org.hl7.fhir.r5.model.Parameters.ParametersParameterComponent convertParametersParameterComponent(org.hl7.fhir.dstu2.model.Parameters.ParametersParameterComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Parameters.ParametersParameterComponent tgt = new org.hl7.fhir.r5.model.Parameters.ParametersParameterComponent(); + copyElement(src, tgt); + tgt.setName(src.getName()); + tgt.setValue(convertType(src.getValue())); + tgt.setResource(convertResource(src.getResource())); + for (org.hl7.fhir.dstu2.model.Parameters.ParametersParameterComponent t : src.getPart()) + tgt.addPart(convertParametersParameterComponent(t)); + return tgt; + } + + public org.hl7.fhir.dstu2.model.Parameters.ParametersParameterComponent convertParametersParameterComponent(org.hl7.fhir.r5.model.Parameters.ParametersParameterComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Parameters.ParametersParameterComponent tgt = new org.hl7.fhir.dstu2.model.Parameters.ParametersParameterComponent(); + copyElement(src, tgt); + tgt.setName(src.getName()); + tgt.setValue(convertType(src.getValue())); + tgt.setResource(convertResource(src.getResource())); + for (org.hl7.fhir.r5.model.Parameters.ParametersParameterComponent t : src.getPart()) + tgt.addPart(convertParametersParameterComponent(t)); + return tgt; + } + + public void copyResource(org.hl7.fhir.dstu2.model.Resource src, org.hl7.fhir.r5.model.Resource tgt) throws FHIRException { + tgt.setId(src.getId()); + tgt.setMeta(convertMeta(src.getMeta())); + tgt.setImplicitRules(src.getImplicitRules()); + tgt.setLanguage(src.getLanguage()); + } + public void copyResource(org.hl7.fhir.r5.model.Resource src, org.hl7.fhir.dstu2.model.Resource tgt) throws FHIRException { + tgt.setId(src.getId()); + if (src.hasMeta()) + tgt.setMeta(convertMeta(src.getMeta())); + if (src.hasImplicitRules()) + tgt.setImplicitRules(src.getImplicitRules()); + if (src.hasLanguage()) + tgt.setLanguage(src.getLanguage()); + } + + public org.hl7.fhir.r5.model.Enumerations.AdministrativeGender convertAdministrativeGender(org.hl7.fhir.dstu2.model.Enumerations.AdministrativeGender src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case MALE: return org.hl7.fhir.r5.model.Enumerations.AdministrativeGender.MALE; + case FEMALE: return org.hl7.fhir.r5.model.Enumerations.AdministrativeGender.FEMALE; + case OTHER: return org.hl7.fhir.r5.model.Enumerations.AdministrativeGender.OTHER; + case UNKNOWN: return org.hl7.fhir.r5.model.Enumerations.AdministrativeGender.UNKNOWN; + default: return org.hl7.fhir.r5.model.Enumerations.AdministrativeGender.NULL; + } + } + + public org.hl7.fhir.dstu2.model.Enumerations.AdministrativeGender convertAdministrativeGender(org.hl7.fhir.r5.model.Enumerations.AdministrativeGender src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case MALE: return org.hl7.fhir.dstu2.model.Enumerations.AdministrativeGender.MALE; + case FEMALE: return org.hl7.fhir.dstu2.model.Enumerations.AdministrativeGender.FEMALE; + case OTHER: return org.hl7.fhir.dstu2.model.Enumerations.AdministrativeGender.OTHER; + case UNKNOWN: return org.hl7.fhir.dstu2.model.Enumerations.AdministrativeGender.UNKNOWN; + default: return org.hl7.fhir.dstu2.model.Enumerations.AdministrativeGender.NULL; + } + } + + public org.hl7.fhir.r5.model.Enumerations.SearchParamType convertSearchParamType(org.hl7.fhir.dstu2.model.Enumerations.SearchParamType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case NUMBER: return org.hl7.fhir.r5.model.Enumerations.SearchParamType.NUMBER; + case DATE: return org.hl7.fhir.r5.model.Enumerations.SearchParamType.DATE; + case STRING: return org.hl7.fhir.r5.model.Enumerations.SearchParamType.STRING; + case TOKEN: return org.hl7.fhir.r5.model.Enumerations.SearchParamType.TOKEN; + case REFERENCE: return org.hl7.fhir.r5.model.Enumerations.SearchParamType.REFERENCE; + case COMPOSITE: return org.hl7.fhir.r5.model.Enumerations.SearchParamType.COMPOSITE; + case QUANTITY: return org.hl7.fhir.r5.model.Enumerations.SearchParamType.QUANTITY; + case URI: return org.hl7.fhir.r5.model.Enumerations.SearchParamType.URI; + default: return org.hl7.fhir.r5.model.Enumerations.SearchParamType.NULL; + } + } + + public org.hl7.fhir.dstu2.model.Enumerations.SearchParamType convertSearchParamType(org.hl7.fhir.r5.model.Enumerations.SearchParamType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case NUMBER: return org.hl7.fhir.dstu2.model.Enumerations.SearchParamType.NUMBER; + case DATE: return org.hl7.fhir.dstu2.model.Enumerations.SearchParamType.DATE; + case STRING: return org.hl7.fhir.dstu2.model.Enumerations.SearchParamType.STRING; + case TOKEN: return org.hl7.fhir.dstu2.model.Enumerations.SearchParamType.TOKEN; + case REFERENCE: return org.hl7.fhir.dstu2.model.Enumerations.SearchParamType.REFERENCE; + case COMPOSITE: return org.hl7.fhir.dstu2.model.Enumerations.SearchParamType.COMPOSITE; + case QUANTITY: return org.hl7.fhir.dstu2.model.Enumerations.SearchParamType.QUANTITY; + case URI: return org.hl7.fhir.dstu2.model.Enumerations.SearchParamType.URI; + default: return org.hl7.fhir.dstu2.model.Enumerations.SearchParamType.NULL; + } + } + + + + public org.hl7.fhir.r5.model.Appointment convertAppointment(org.hl7.fhir.dstu2.model.Appointment src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Appointment tgt = new org.hl7.fhir.r5.model.Appointment(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + tgt.setStatus(convertAppointmentStatus(src.getStatus())); + if (src.hasType()) + tgt.addServiceType(convertCodeableConcept(src.getType())); +// tgt.setReason(convertCodeableConcept(src.getReason())); + tgt.setPriority(src.getPriority()); + tgt.setDescription(src.getDescription()); + tgt.setStart(src.getStart()); + tgt.setEnd(src.getEnd()); + tgt.setMinutesDuration(src.getMinutesDuration()); + for (org.hl7.fhir.dstu2.model.Reference t : src.getSlot()) + tgt.addSlot(convertReference(t)); + tgt.setComment(src.getComment()); + for (org.hl7.fhir.dstu2.model.Appointment.AppointmentParticipantComponent t : src.getParticipant()) + tgt.addParticipant(convertAppointmentParticipantComponent(t)); + return tgt; + } + + public org.hl7.fhir.dstu2.model.Appointment convertAppointment(org.hl7.fhir.r5.model.Appointment src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Appointment tgt = new org.hl7.fhir.dstu2.model.Appointment(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + tgt.setStatus(convertAppointmentStatus(src.getStatus())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getServiceType()) + tgt.setType(convertCodeableConcept(t)); +// tgt.setReason(convertCodeableConcept(src.getReason())); + tgt.setPriority(src.getPriority()); + tgt.setDescription(src.getDescription()); + tgt.setStart(src.getStart()); + tgt.setEnd(src.getEnd()); + tgt.setMinutesDuration(src.getMinutesDuration()); + for (org.hl7.fhir.r5.model.Reference t : src.getSlot()) + tgt.addSlot(convertReference(t)); + tgt.setComment(src.getComment()); + for (org.hl7.fhir.r5.model.Appointment.AppointmentParticipantComponent t : src.getParticipant()) + tgt.addParticipant(convertAppointmentParticipantComponent(t)); + return tgt; + } + + public org.hl7.fhir.r5.model.Appointment.AppointmentStatus convertAppointmentStatus(org.hl7.fhir.dstu2.model.Appointment.AppointmentStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PROPOSED: return org.hl7.fhir.r5.model.Appointment.AppointmentStatus.PROPOSED; + case PENDING: return org.hl7.fhir.r5.model.Appointment.AppointmentStatus.PENDING; + case BOOKED: return org.hl7.fhir.r5.model.Appointment.AppointmentStatus.BOOKED; + case ARRIVED: return org.hl7.fhir.r5.model.Appointment.AppointmentStatus.ARRIVED; + case FULFILLED: return org.hl7.fhir.r5.model.Appointment.AppointmentStatus.FULFILLED; + case CANCELLED: return org.hl7.fhir.r5.model.Appointment.AppointmentStatus.CANCELLED; + case NOSHOW: return org.hl7.fhir.r5.model.Appointment.AppointmentStatus.NOSHOW; + default: return org.hl7.fhir.r5.model.Appointment.AppointmentStatus.NULL; + } + } + + public org.hl7.fhir.dstu2.model.Appointment.AppointmentStatus convertAppointmentStatus(org.hl7.fhir.r5.model.Appointment.AppointmentStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PROPOSED: return org.hl7.fhir.dstu2.model.Appointment.AppointmentStatus.PROPOSED; + case PENDING: return org.hl7.fhir.dstu2.model.Appointment.AppointmentStatus.PENDING; + case BOOKED: return org.hl7.fhir.dstu2.model.Appointment.AppointmentStatus.BOOKED; + case ARRIVED: return org.hl7.fhir.dstu2.model.Appointment.AppointmentStatus.ARRIVED; + case FULFILLED: return org.hl7.fhir.dstu2.model.Appointment.AppointmentStatus.FULFILLED; + case CANCELLED: return org.hl7.fhir.dstu2.model.Appointment.AppointmentStatus.CANCELLED; + case NOSHOW: return org.hl7.fhir.dstu2.model.Appointment.AppointmentStatus.NOSHOW; + default: return org.hl7.fhir.dstu2.model.Appointment.AppointmentStatus.NULL; + } + } + + public org.hl7.fhir.r5.model.Appointment.AppointmentParticipantComponent convertAppointmentParticipantComponent(org.hl7.fhir.dstu2.model.Appointment.AppointmentParticipantComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Appointment.AppointmentParticipantComponent tgt = new org.hl7.fhir.r5.model.Appointment.AppointmentParticipantComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getType()) + tgt.addType(convertCodeableConcept(t)); + tgt.setActor(convertReference(src.getActor())); + tgt.setRequired(convertParticipantRequired(src.getRequired())); + tgt.setStatus(convertParticipationStatus(src.getStatus())); + return tgt; + } + + public org.hl7.fhir.dstu2.model.Appointment.AppointmentParticipantComponent convertAppointmentParticipantComponent(org.hl7.fhir.r5.model.Appointment.AppointmentParticipantComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Appointment.AppointmentParticipantComponent tgt = new org.hl7.fhir.dstu2.model.Appointment.AppointmentParticipantComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getType()) + tgt.addType(convertCodeableConcept(t)); + tgt.setActor(convertReference(src.getActor())); + tgt.setRequired(convertParticipantRequired(src.getRequired())); + tgt.setStatus(convertParticipationStatus(src.getStatus())); + return tgt; + } + + public org.hl7.fhir.r5.model.Appointment.ParticipantRequired convertParticipantRequired(org.hl7.fhir.dstu2.model.Appointment.ParticipantRequired src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case REQUIRED: return org.hl7.fhir.r5.model.Appointment.ParticipantRequired.REQUIRED; + case OPTIONAL: return org.hl7.fhir.r5.model.Appointment.ParticipantRequired.OPTIONAL; + case INFORMATIONONLY: return org.hl7.fhir.r5.model.Appointment.ParticipantRequired.INFORMATIONONLY; + default: return org.hl7.fhir.r5.model.Appointment.ParticipantRequired.NULL; + } + } + + public org.hl7.fhir.dstu2.model.Appointment.ParticipantRequired convertParticipantRequired(org.hl7.fhir.r5.model.Appointment.ParticipantRequired src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case REQUIRED: return org.hl7.fhir.dstu2.model.Appointment.ParticipantRequired.REQUIRED; + case OPTIONAL: return org.hl7.fhir.dstu2.model.Appointment.ParticipantRequired.OPTIONAL; + case INFORMATIONONLY: return org.hl7.fhir.dstu2.model.Appointment.ParticipantRequired.INFORMATIONONLY; + default: return org.hl7.fhir.dstu2.model.Appointment.ParticipantRequired.NULL; + } + } + + public org.hl7.fhir.r5.model.Appointment.ParticipationStatus convertParticipationStatus(org.hl7.fhir.dstu2.model.Appointment.ParticipationStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case ACCEPTED: return org.hl7.fhir.r5.model.Appointment.ParticipationStatus.ACCEPTED; + case DECLINED: return org.hl7.fhir.r5.model.Appointment.ParticipationStatus.DECLINED; + case TENTATIVE: return org.hl7.fhir.r5.model.Appointment.ParticipationStatus.TENTATIVE; + case NEEDSACTION: return org.hl7.fhir.r5.model.Appointment.ParticipationStatus.NEEDSACTION; + default: return org.hl7.fhir.r5.model.Appointment.ParticipationStatus.NULL; + } + } + + public org.hl7.fhir.dstu2.model.Appointment.ParticipationStatus convertParticipationStatus(org.hl7.fhir.r5.model.Appointment.ParticipationStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case ACCEPTED: return org.hl7.fhir.dstu2.model.Appointment.ParticipationStatus.ACCEPTED; + case DECLINED: return org.hl7.fhir.dstu2.model.Appointment.ParticipationStatus.DECLINED; + case TENTATIVE: return org.hl7.fhir.dstu2.model.Appointment.ParticipationStatus.TENTATIVE; + case NEEDSACTION: return org.hl7.fhir.dstu2.model.Appointment.ParticipationStatus.NEEDSACTION; + default: return org.hl7.fhir.dstu2.model.Appointment.ParticipationStatus.NULL; + } + } + + public org.hl7.fhir.r5.model.AppointmentResponse convertAppointmentResponse(org.hl7.fhir.dstu2.model.AppointmentResponse src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.AppointmentResponse tgt = new org.hl7.fhir.r5.model.AppointmentResponse(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + tgt.setAppointment(convertReference(src.getAppointment())); + tgt.setStart(src.getStart()); + tgt.setEnd(src.getEnd()); + for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getParticipantType()) + tgt.addParticipantType(convertCodeableConcept(t)); + tgt.setActor(convertReference(src.getActor())); + tgt.setParticipantStatus(convertParticipantStatus(src.getParticipantStatus())); + tgt.setComment(src.getComment()); + return tgt; + } + + private org.hl7.fhir.r5.model.AppointmentResponse.ParticipantStatus convertParticipantStatus(org.hl7.fhir.dstu2.model.AppointmentResponse.ParticipantStatus src) { + if (src == null) + return null; + switch (src) { + case ACCEPTED: return org.hl7.fhir.r5.model.AppointmentResponse.ParticipantStatus.ACCEPTED; + case DECLINED: return org.hl7.fhir.r5.model.AppointmentResponse.ParticipantStatus.DECLINED; + case TENTATIVE: return org.hl7.fhir.r5.model.AppointmentResponse.ParticipantStatus.TENTATIVE; + case INPROCESS: return org.hl7.fhir.r5.model.AppointmentResponse.ParticipantStatus.ACCEPTED; + case COMPLETED: return org.hl7.fhir.r5.model.AppointmentResponse.ParticipantStatus.ACCEPTED; + case NEEDSACTION: return org.hl7.fhir.r5.model.AppointmentResponse.ParticipantStatus.NEEDSACTION; + default: return org.hl7.fhir.r5.model.AppointmentResponse.ParticipantStatus.NULL; + } + } + + private org.hl7.fhir.dstu2.model.AppointmentResponse.ParticipantStatus convertParticipantStatus(org.hl7.fhir.r5.model.AppointmentResponse.ParticipantStatus src) { + if (src == null) + return null; + switch (src) { + case ACCEPTED: return org.hl7.fhir.dstu2.model.AppointmentResponse.ParticipantStatus.ACCEPTED; + case DECLINED: return org.hl7.fhir.dstu2.model.AppointmentResponse.ParticipantStatus.DECLINED; + case TENTATIVE: return org.hl7.fhir.dstu2.model.AppointmentResponse.ParticipantStatus.TENTATIVE; + case NEEDSACTION: return org.hl7.fhir.dstu2.model.AppointmentResponse.ParticipantStatus.NEEDSACTION; + default: return org.hl7.fhir.dstu2.model.AppointmentResponse.ParticipantStatus.NULL; + } + } + + public org.hl7.fhir.dstu2.model.AppointmentResponse convertAppointmentResponse(org.hl7.fhir.r5.model.AppointmentResponse src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.AppointmentResponse tgt = new org.hl7.fhir.dstu2.model.AppointmentResponse(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + tgt.setAppointment(convertReference(src.getAppointment())); + tgt.setStart(src.getStart()); + tgt.setEnd(src.getEnd()); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getParticipantType()) + tgt.addParticipantType(convertCodeableConcept(t)); + tgt.setActor(convertReference(src.getActor())); + tgt.setParticipantStatus(convertParticipantStatus(src.getParticipantStatus())); + tgt.setComment(src.getComment()); + return tgt; + } + + public org.hl7.fhir.r5.model.AuditEvent convertAuditEvent(org.hl7.fhir.dstu2.model.AuditEvent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.AuditEvent tgt = new org.hl7.fhir.r5.model.AuditEvent(); + copyDomainResource(src, tgt); + if (src.hasEvent()) { + tgt.setType(convertCoding(src.getEvent().getType())); + for (org.hl7.fhir.dstu2.model.Coding t : src.getEvent().getSubtype()) + tgt.addSubtype(convertCoding(t)); + tgt.setAction(convertAuditEventAction(src.getEvent().getAction())); + tgt.setRecorded(src.getEvent().getDateTime()); + tgt.setOutcome(convertAuditEventOutcome(src.getEvent().getOutcome())); + tgt.setOutcomeDesc(src.getEvent().getOutcomeDesc()); + for (org.hl7.fhir.dstu2.model.Coding t : src.getEvent().getPurposeOfEvent()) + tgt.addPurposeOfEvent().addCoding(convertCoding(t)); + } + for (org.hl7.fhir.dstu2.model.AuditEvent.AuditEventParticipantComponent t : src.getParticipant()) + tgt.addAgent(convertAuditEventAgentComponent(t)); + tgt.setSource(convertAuditEventSourceComponent(src.getSource())); + for (org.hl7.fhir.dstu2.model.AuditEvent.AuditEventObjectComponent t : src.getObject()) + tgt.addEntity(convertAuditEventEntityComponent(t)); + return tgt; + } + + public org.hl7.fhir.dstu2.model.AuditEvent convertAuditEvent(org.hl7.fhir.r5.model.AuditEvent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.AuditEvent tgt = new org.hl7.fhir.dstu2.model.AuditEvent(); + copyDomainResource(src, tgt); + tgt.getEvent().setType(convertCoding(src.getType())); + for (org.hl7.fhir.r5.model.Coding t : src.getSubtype()) + tgt.getEvent().addSubtype(convertCoding(t)); + tgt.getEvent().setAction(convertAuditEventAction(src.getAction())); + tgt.getEvent().setDateTime(src.getRecorded()); + tgt.getEvent().setOutcome(convertAuditEventOutcome(src.getOutcome())); + tgt.getEvent().setOutcomeDesc(src.getOutcomeDesc()); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getPurposeOfEvent()) + for (org.hl7.fhir.r5.model.Coding cc : t.getCoding()) + tgt.getEvent().addPurposeOfEvent(convertCoding(cc)); + for (org.hl7.fhir.r5.model.AuditEvent.AuditEventAgentComponent t : src.getAgent()) + tgt.addParticipant(convertAuditEventAgentComponent(t)); + tgt.setSource(convertAuditEventSourceComponent(src.getSource())); + for (org.hl7.fhir.r5.model.AuditEvent.AuditEventEntityComponent t : src.getEntity()) + tgt.addObject(convertAuditEventEntityComponent(t)); + return tgt; + } + + public org.hl7.fhir.r5.model.AuditEvent.AuditEventAction convertAuditEventAction(org.hl7.fhir.dstu2.model.AuditEvent.AuditEventAction src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case C: return org.hl7.fhir.r5.model.AuditEvent.AuditEventAction.C; + case R: return org.hl7.fhir.r5.model.AuditEvent.AuditEventAction.R; + case U: return org.hl7.fhir.r5.model.AuditEvent.AuditEventAction.U; + case D: return org.hl7.fhir.r5.model.AuditEvent.AuditEventAction.D; + case E: return org.hl7.fhir.r5.model.AuditEvent.AuditEventAction.E; + default: return org.hl7.fhir.r5.model.AuditEvent.AuditEventAction.NULL; + } + } + + public org.hl7.fhir.dstu2.model.AuditEvent.AuditEventAction convertAuditEventAction(org.hl7.fhir.r5.model.AuditEvent.AuditEventAction src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case C: return org.hl7.fhir.dstu2.model.AuditEvent.AuditEventAction.C; + case R: return org.hl7.fhir.dstu2.model.AuditEvent.AuditEventAction.R; + case U: return org.hl7.fhir.dstu2.model.AuditEvent.AuditEventAction.U; + case D: return org.hl7.fhir.dstu2.model.AuditEvent.AuditEventAction.D; + case E: return org.hl7.fhir.dstu2.model.AuditEvent.AuditEventAction.E; + default: return org.hl7.fhir.dstu2.model.AuditEvent.AuditEventAction.NULL; + } + } + + public org.hl7.fhir.r5.model.AuditEvent.AuditEventOutcome convertAuditEventOutcome(org.hl7.fhir.dstu2.model.AuditEvent.AuditEventOutcome src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case _0: return org.hl7.fhir.r5.model.AuditEvent.AuditEventOutcome._0; + case _4: return org.hl7.fhir.r5.model.AuditEvent.AuditEventOutcome._4; + case _8: return org.hl7.fhir.r5.model.AuditEvent.AuditEventOutcome._8; + case _12: return org.hl7.fhir.r5.model.AuditEvent.AuditEventOutcome._12; + default: return org.hl7.fhir.r5.model.AuditEvent.AuditEventOutcome.NULL; + } + } + + public org.hl7.fhir.dstu2.model.AuditEvent.AuditEventOutcome convertAuditEventOutcome(org.hl7.fhir.r5.model.AuditEvent.AuditEventOutcome src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case _0: return org.hl7.fhir.dstu2.model.AuditEvent.AuditEventOutcome._0; + case _4: return org.hl7.fhir.dstu2.model.AuditEvent.AuditEventOutcome._4; + case _8: return org.hl7.fhir.dstu2.model.AuditEvent.AuditEventOutcome._8; + case _12: return org.hl7.fhir.dstu2.model.AuditEvent.AuditEventOutcome._12; + default: return org.hl7.fhir.dstu2.model.AuditEvent.AuditEventOutcome.NULL; + } + } + + public org.hl7.fhir.r5.model.AuditEvent.AuditEventAgentComponent convertAuditEventAgentComponent(org.hl7.fhir.dstu2.model.AuditEvent.AuditEventParticipantComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.AuditEvent.AuditEventAgentComponent tgt = new org.hl7.fhir.r5.model.AuditEvent.AuditEventAgentComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getRole()) + tgt.addRole(convertCodeableConcept(t)); + tgt.setWho(convertReference(src.getReference())); + if (src.hasUserId()) + tgt.getWho().setIdentifier(convertIdentifier(src.getUserId())); + tgt.setAltId(src.getAltId()); + tgt.setName(src.getName()); + tgt.setRequestor(src.getRequestor()); + tgt.setLocation(convertReference(src.getLocation())); + for (org.hl7.fhir.dstu2.model.UriType t : src.getPolicy()) + tgt.addPolicy(t.getValue()); + tgt.setMedia(convertCoding(src.getMedia())); + tgt.setNetwork(convertAuditEventAgentNetworkComponent(src.getNetwork())); + for (org.hl7.fhir.dstu2.model.Coding t : src.getPurposeOfUse()) + tgt.addPurposeOfUse().addCoding(convertCoding(t)); + return tgt; + } + + public org.hl7.fhir.dstu2.model.AuditEvent.AuditEventParticipantComponent convertAuditEventAgentComponent(org.hl7.fhir.r5.model.AuditEvent.AuditEventAgentComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.AuditEvent.AuditEventParticipantComponent tgt = new org.hl7.fhir.dstu2.model.AuditEvent.AuditEventParticipantComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getRole()) + tgt.addRole(convertCodeableConcept(t)); + if (src.hasWho()) { + if (src.getWho().hasIdentifier()) + tgt.setUserId(convertIdentifier(src.getWho().getIdentifier())); + if (src.getWho().hasReference() || src.getWho().hasDisplay() || src.getWho().hasExtension() || src.getWho().hasId()) + tgt.setReference(convertReference(src.getWho())); + } + tgt.setAltId(src.getAltId()); + tgt.setName(src.getName()); + tgt.setRequestor(src.getRequestor()); + tgt.setLocation(convertReference(src.getLocation())); + for (org.hl7.fhir.r5.model.UriType t : src.getPolicy()) + tgt.addPolicy(t.getValue()); + tgt.setMedia(convertCoding(src.getMedia())); + tgt.setNetwork(convertAuditEventAgentNetworkComponent(src.getNetwork())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getPurposeOfUse()) + for (org.hl7.fhir.r5.model.Coding cc : t.getCoding()) + tgt.addPurposeOfUse(convertCoding(cc)); + return tgt; + } + + public org.hl7.fhir.r5.model.AuditEvent.AuditEventAgentNetworkComponent convertAuditEventAgentNetworkComponent(org.hl7.fhir.dstu2.model.AuditEvent.AuditEventParticipantNetworkComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.AuditEvent.AuditEventAgentNetworkComponent tgt = new org.hl7.fhir.r5.model.AuditEvent.AuditEventAgentNetworkComponent(); + copyElement(src, tgt); + tgt.setAddress(src.getAddress()); + tgt.setType(convertAuditEventParticipantNetworkType(src.getType())); + return tgt; + } + + public org.hl7.fhir.dstu2.model.AuditEvent.AuditEventParticipantNetworkComponent convertAuditEventAgentNetworkComponent(org.hl7.fhir.r5.model.AuditEvent.AuditEventAgentNetworkComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.AuditEvent.AuditEventParticipantNetworkComponent tgt = new org.hl7.fhir.dstu2.model.AuditEvent.AuditEventParticipantNetworkComponent(); + copyElement(src, tgt); + tgt.setAddress(src.getAddress()); + tgt.setType(convertAuditEventParticipantNetworkType(src.getType())); + return tgt; + } + + public org.hl7.fhir.r5.model.AuditEvent.AuditEventAgentNetworkType convertAuditEventParticipantNetworkType(org.hl7.fhir.dstu2.model.AuditEvent.AuditEventParticipantNetworkType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case _1: return org.hl7.fhir.r5.model.AuditEvent.AuditEventAgentNetworkType._1; + case _2: return org.hl7.fhir.r5.model.AuditEvent.AuditEventAgentNetworkType._2; + case _3: return org.hl7.fhir.r5.model.AuditEvent.AuditEventAgentNetworkType._3; + case _4: return org.hl7.fhir.r5.model.AuditEvent.AuditEventAgentNetworkType._4; + case _5: return org.hl7.fhir.r5.model.AuditEvent.AuditEventAgentNetworkType._5; + default: return org.hl7.fhir.r5.model.AuditEvent.AuditEventAgentNetworkType.NULL; + } + } + + public org.hl7.fhir.dstu2.model.AuditEvent.AuditEventParticipantNetworkType convertAuditEventParticipantNetworkType(org.hl7.fhir.r5.model.AuditEvent.AuditEventAgentNetworkType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case _1: return org.hl7.fhir.dstu2.model.AuditEvent.AuditEventParticipantNetworkType._1; + case _2: return org.hl7.fhir.dstu2.model.AuditEvent.AuditEventParticipantNetworkType._2; + case _3: return org.hl7.fhir.dstu2.model.AuditEvent.AuditEventParticipantNetworkType._3; + case _4: return org.hl7.fhir.dstu2.model.AuditEvent.AuditEventParticipantNetworkType._4; + case _5: return org.hl7.fhir.dstu2.model.AuditEvent.AuditEventParticipantNetworkType._5; + default: return org.hl7.fhir.dstu2.model.AuditEvent.AuditEventParticipantNetworkType.NULL; + } + } + + public org.hl7.fhir.r5.model.AuditEvent.AuditEventSourceComponent convertAuditEventSourceComponent(org.hl7.fhir.dstu2.model.AuditEvent.AuditEventSourceComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.AuditEvent.AuditEventSourceComponent tgt = new org.hl7.fhir.r5.model.AuditEvent.AuditEventSourceComponent(); + copyElement(src, tgt); + tgt.setSite(src.getSite()); + if (src.hasIdentifier()) + tgt.getObserver().setIdentifier(convertIdentifier(src.getIdentifier())); + for (org.hl7.fhir.dstu2.model.Coding t : src.getType()) + tgt.addType(convertCoding(t)); + return tgt; + } + + public org.hl7.fhir.dstu2.model.AuditEvent.AuditEventSourceComponent convertAuditEventSourceComponent(org.hl7.fhir.r5.model.AuditEvent.AuditEventSourceComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.AuditEvent.AuditEventSourceComponent tgt = new org.hl7.fhir.dstu2.model.AuditEvent.AuditEventSourceComponent(); + copyElement(src, tgt); + tgt.setSite(src.getSite()); + if (src.hasObserver()) + tgt.setIdentifier(convertIdentifier(src.getObserver().getIdentifier())); + for (org.hl7.fhir.r5.model.Coding t : src.getType()) + tgt.addType(convertCoding(t)); + return tgt; + } + + public org.hl7.fhir.r5.model.AuditEvent.AuditEventEntityComponent convertAuditEventEntityComponent(org.hl7.fhir.dstu2.model.AuditEvent.AuditEventObjectComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.AuditEvent.AuditEventEntityComponent tgt = new org.hl7.fhir.r5.model.AuditEvent.AuditEventEntityComponent(); + copyElement(src, tgt); + if (src.hasIdentifier()) + tgt.getWhat().setIdentifier(convertIdentifier(src.getIdentifier())); + if (src.hasReference()) + tgt.setWhat(convertReference(src.getReference())); + tgt.setType(convertCoding(src.getType())); + tgt.setRole(convertCoding(src.getRole())); + tgt.setLifecycle(convertCoding(src.getLifecycle())); + for (org.hl7.fhir.dstu2.model.Coding t : src.getSecurityLabel()) + tgt.addSecurityLabel(convertCoding(t)); + tgt.setName(src.getName()); + tgt.setDescription(src.getDescription()); + tgt.setQuery(src.getQuery()); + for (org.hl7.fhir.dstu2.model.AuditEvent.AuditEventObjectDetailComponent t : src.getDetail()) + tgt.addDetail(convertAuditEventEntityDetailComponent(t)); + return tgt; + } + + public org.hl7.fhir.dstu2.model.AuditEvent.AuditEventObjectComponent convertAuditEventEntityComponent(org.hl7.fhir.r5.model.AuditEvent.AuditEventEntityComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.AuditEvent.AuditEventObjectComponent tgt = new org.hl7.fhir.dstu2.model.AuditEvent.AuditEventObjectComponent(); + copyElement(src, tgt); + if (src.hasWhat()) { + if (src.getWhat().hasIdentifier()) + tgt.setIdentifier(convertIdentifier(src.getWhat().getIdentifier())); + if (src.getWhat().hasReference() || src.getWhat().hasDisplay() || src.getWhat().hasExtension() || src.getWhat().hasId()) + tgt.setReference(convertReference(src.getWhat())); + } + tgt.setType(convertCoding(src.getType())); + tgt.setRole(convertCoding(src.getRole())); + tgt.setLifecycle(convertCoding(src.getLifecycle())); + for (org.hl7.fhir.r5.model.Coding t : src.getSecurityLabel()) + tgt.addSecurityLabel(convertCoding(t)); + tgt.setName(src.getName()); + tgt.setDescription(src.getDescription()); + tgt.setQuery(src.getQuery()); + for (org.hl7.fhir.r5.model.AuditEvent.AuditEventEntityDetailComponent t : src.getDetail()) + tgt.addDetail(convertAuditEventEntityDetailComponent(t)); + return tgt; + } + + public org.hl7.fhir.r5.model.AuditEvent.AuditEventEntityDetailComponent convertAuditEventEntityDetailComponent(org.hl7.fhir.dstu2.model.AuditEvent.AuditEventObjectDetailComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.AuditEvent.AuditEventEntityDetailComponent tgt = new org.hl7.fhir.r5.model.AuditEvent.AuditEventEntityDetailComponent(); + copyElement(src, tgt); + tgt.setType(src.getType()); + if (src.hasValue()) + tgt.setValue(new org.hl7.fhir.r5.model.Base64BinaryType(src.getValue())); + return tgt; + } + + public org.hl7.fhir.dstu2.model.AuditEvent.AuditEventObjectDetailComponent convertAuditEventEntityDetailComponent(org.hl7.fhir.r5.model.AuditEvent.AuditEventEntityDetailComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.AuditEvent.AuditEventObjectDetailComponent tgt = new org.hl7.fhir.dstu2.model.AuditEvent.AuditEventObjectDetailComponent(); + copyElement(src, tgt); + tgt.setType(src.getType()); + if (src.hasValueStringType()) + tgt.setValue(src.getValueStringType().getValue().getBytes()); + else if (src.hasValueBase64BinaryType()) + tgt.setValue(src.getValueBase64BinaryType().getValue()); + return tgt; + } + + public org.hl7.fhir.r5.model.Basic convertBasic(org.hl7.fhir.dstu2.model.Basic src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Basic tgt = new org.hl7.fhir.r5.model.Basic(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + tgt.setCode(convertCodeableConcept(src.getCode())); + tgt.setSubject(convertReference(src.getSubject())); + tgt.setCreated(src.getCreated()); + tgt.setAuthor(convertReference(src.getAuthor())); + return tgt; + } + + public org.hl7.fhir.dstu2.model.Basic convertBasic(org.hl7.fhir.r5.model.Basic src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Basic tgt = new org.hl7.fhir.dstu2.model.Basic(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + tgt.setCode(convertCodeableConcept(src.getCode())); + tgt.setSubject(convertReference(src.getSubject())); + tgt.setCreated(src.getCreated()); + tgt.setAuthor(convertReference(src.getAuthor())); + return tgt; + } + + public org.hl7.fhir.r5.model.Binary convertBinary(org.hl7.fhir.dstu2.model.Binary src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Binary tgt = new org.hl7.fhir.r5.model.Binary(); + copyResource(src, tgt); + tgt.setContentType(src.getContentType()); + tgt.setContent(src.getContent()); + return tgt; + } + + public org.hl7.fhir.dstu2.model.Binary convertBinary(org.hl7.fhir.r5.model.Binary src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Binary tgt = new org.hl7.fhir.dstu2.model.Binary(); + copyResource(src, tgt); + tgt.setContentType(src.getContentType()); + tgt.setContent(src.getContent()); + return tgt; + } + + public org.hl7.fhir.r5.model.Bundle convertBundle(org.hl7.fhir.dstu2.model.Bundle src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Bundle tgt = new org.hl7.fhir.r5.model.Bundle(); + copyResource(src, tgt); + tgt.setType(convertBundleType(src.getType())); + if (src.hasTotal()) + tgt.setTotal(src.getTotal()); + for (org.hl7.fhir.dstu2.model.Bundle.BundleLinkComponent t : src.getLink()) + tgt.addLink(convertBundleLinkComponent(t)); + for (org.hl7.fhir.dstu2.model.Bundle.BundleEntryComponent t : src.getEntry()) + tgt.addEntry(convertBundleEntryComponent(t)); + tgt.setSignature(convertSignature(src.getSignature())); + return tgt; + } + + public org.hl7.fhir.dstu2.model.Bundle convertBundle(org.hl7.fhir.r5.model.Bundle src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Bundle tgt = new org.hl7.fhir.dstu2.model.Bundle(); + copyResource(src, tgt); + tgt.setType(convertBundleType(src.getType())); + if (src.hasTotal()) + tgt.setTotal(src.getTotal()); + for (org.hl7.fhir.r5.model.Bundle.BundleLinkComponent t : src.getLink()) + tgt.addLink(convertBundleLinkComponent(t)); + for (org.hl7.fhir.r5.model.Bundle.BundleEntryComponent t : src.getEntry()) + tgt.addEntry(convertBundleEntryComponent(t)); + if (src.hasSignature()) + tgt.setSignature(convertSignature(src.getSignature())); + return tgt; + } + + public org.hl7.fhir.r5.model.Bundle.BundleType convertBundleType(org.hl7.fhir.dstu2.model.Bundle.BundleType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case DOCUMENT: return org.hl7.fhir.r5.model.Bundle.BundleType.DOCUMENT; + case MESSAGE: return org.hl7.fhir.r5.model.Bundle.BundleType.MESSAGE; + case TRANSACTION: return org.hl7.fhir.r5.model.Bundle.BundleType.TRANSACTION; + case TRANSACTIONRESPONSE: return org.hl7.fhir.r5.model.Bundle.BundleType.TRANSACTIONRESPONSE; + case BATCH: return org.hl7.fhir.r5.model.Bundle.BundleType.BATCH; + case BATCHRESPONSE: return org.hl7.fhir.r5.model.Bundle.BundleType.BATCHRESPONSE; + case HISTORY: return org.hl7.fhir.r5.model.Bundle.BundleType.HISTORY; + case SEARCHSET: return org.hl7.fhir.r5.model.Bundle.BundleType.SEARCHSET; + case COLLECTION: return org.hl7.fhir.r5.model.Bundle.BundleType.COLLECTION; + default: return org.hl7.fhir.r5.model.Bundle.BundleType.NULL; + } + } + + public org.hl7.fhir.dstu2.model.Bundle.BundleType convertBundleType(org.hl7.fhir.r5.model.Bundle.BundleType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case DOCUMENT: return org.hl7.fhir.dstu2.model.Bundle.BundleType.DOCUMENT; + case MESSAGE: return org.hl7.fhir.dstu2.model.Bundle.BundleType.MESSAGE; + case TRANSACTION: return org.hl7.fhir.dstu2.model.Bundle.BundleType.TRANSACTION; + case TRANSACTIONRESPONSE: return org.hl7.fhir.dstu2.model.Bundle.BundleType.TRANSACTIONRESPONSE; + case BATCH: return org.hl7.fhir.dstu2.model.Bundle.BundleType.BATCH; + case BATCHRESPONSE: return org.hl7.fhir.dstu2.model.Bundle.BundleType.BATCHRESPONSE; + case HISTORY: return org.hl7.fhir.dstu2.model.Bundle.BundleType.HISTORY; + case SEARCHSET: return org.hl7.fhir.dstu2.model.Bundle.BundleType.SEARCHSET; + case COLLECTION: return org.hl7.fhir.dstu2.model.Bundle.BundleType.COLLECTION; + default: return org.hl7.fhir.dstu2.model.Bundle.BundleType.NULL; + } + } + + public org.hl7.fhir.r5.model.Bundle.BundleLinkComponent convertBundleLinkComponent(org.hl7.fhir.dstu2.model.Bundle.BundleLinkComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Bundle.BundleLinkComponent tgt = new org.hl7.fhir.r5.model.Bundle.BundleLinkComponent(); + copyElement(src, tgt); + tgt.setRelation(src.getRelation()); + tgt.setUrl(src.getUrl()); + return tgt; + } + + public org.hl7.fhir.dstu2.model.Bundle.BundleLinkComponent convertBundleLinkComponent(org.hl7.fhir.r5.model.Bundle.BundleLinkComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Bundle.BundleLinkComponent tgt = new org.hl7.fhir.dstu2.model.Bundle.BundleLinkComponent(); + copyElement(src, tgt); + tgt.setRelation(src.getRelation()); + tgt.setUrl(src.getUrl()); + return tgt; + } + + public org.hl7.fhir.r5.model.Bundle.BundleEntryComponent convertBundleEntryComponent(org.hl7.fhir.dstu2.model.Bundle.BundleEntryComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Bundle.BundleEntryComponent tgt = new org.hl7.fhir.r5.model.Bundle.BundleEntryComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.dstu2.model.Bundle.BundleLinkComponent t : src.getLink()) + tgt.addLink(convertBundleLinkComponent(t)); + tgt.setFullUrl(src.getFullUrl()); + tgt.setResource(convertResource(src.getResource())); + tgt.setSearch(convertBundleEntrySearchComponent(src.getSearch())); + tgt.setRequest(convertBundleEntryRequestComponent(src.getRequest())); + tgt.setResponse(convertBundleEntryResponseComponent(src.getResponse())); + return tgt; + } + + public org.hl7.fhir.dstu2.model.Bundle.BundleEntryComponent convertBundleEntryComponent(org.hl7.fhir.r5.model.Bundle.BundleEntryComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + if (advisor.ignoreEntry(src)) + return null; + + org.hl7.fhir.dstu2.model.Bundle.BundleEntryComponent tgt = new org.hl7.fhir.dstu2.model.Bundle.BundleEntryComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.r5.model.Bundle.BundleLinkComponent t : src.getLink()) + tgt.addLink(convertBundleLinkComponent(t)); + tgt.setFullUrl(src.getFullUrl()); + org.hl7.fhir.dstu2.model.Resource res = advisor.convertR2(src.getResource()); + if (res == null) + res = convertResource(src.getResource()); + tgt.setResource(res); + if (src.hasSearch()) + tgt.setSearch(convertBundleEntrySearchComponent(src.getSearch())); + if (src.hasRequest()) + tgt.setRequest(convertBundleEntryRequestComponent(src.getRequest())); + if (src.hasResponse()) + tgt.setResponse(convertBundleEntryResponseComponent(src.getResponse())); + return tgt; + } + + public org.hl7.fhir.r5.model.Bundle.BundleEntrySearchComponent convertBundleEntrySearchComponent(org.hl7.fhir.dstu2.model.Bundle.BundleEntrySearchComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Bundle.BundleEntrySearchComponent tgt = new org.hl7.fhir.r5.model.Bundle.BundleEntrySearchComponent(); + copyElement(src, tgt); + tgt.setMode(convertSearchEntryMode(src.getMode())); + tgt.setScore(src.getScore()); + return tgt; + } + + public org.hl7.fhir.dstu2.model.Bundle.BundleEntrySearchComponent convertBundleEntrySearchComponent(org.hl7.fhir.r5.model.Bundle.BundleEntrySearchComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Bundle.BundleEntrySearchComponent tgt = new org.hl7.fhir.dstu2.model.Bundle.BundleEntrySearchComponent(); + copyElement(src, tgt); + tgt.setMode(convertSearchEntryMode(src.getMode())); + tgt.setScore(src.getScore()); + return tgt; + } + + public org.hl7.fhir.r5.model.Bundle.SearchEntryMode convertSearchEntryMode(org.hl7.fhir.dstu2.model.Bundle.SearchEntryMode src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case MATCH: return org.hl7.fhir.r5.model.Bundle.SearchEntryMode.MATCH; + case INCLUDE: return org.hl7.fhir.r5.model.Bundle.SearchEntryMode.INCLUDE; + case OUTCOME: return org.hl7.fhir.r5.model.Bundle.SearchEntryMode.OUTCOME; + default: return org.hl7.fhir.r5.model.Bundle.SearchEntryMode.NULL; + } + } + + public org.hl7.fhir.dstu2.model.Bundle.SearchEntryMode convertSearchEntryMode(org.hl7.fhir.r5.model.Bundle.SearchEntryMode src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case MATCH: return org.hl7.fhir.dstu2.model.Bundle.SearchEntryMode.MATCH; + case INCLUDE: return org.hl7.fhir.dstu2.model.Bundle.SearchEntryMode.INCLUDE; + case OUTCOME: return org.hl7.fhir.dstu2.model.Bundle.SearchEntryMode.OUTCOME; + default: return org.hl7.fhir.dstu2.model.Bundle.SearchEntryMode.NULL; + } + } + + public org.hl7.fhir.r5.model.Bundle.BundleEntryRequestComponent convertBundleEntryRequestComponent(org.hl7.fhir.dstu2.model.Bundle.BundleEntryRequestComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Bundle.BundleEntryRequestComponent tgt = new org.hl7.fhir.r5.model.Bundle.BundleEntryRequestComponent(); + copyElement(src, tgt); + tgt.setMethod(convertHTTPVerb(src.getMethod())); + tgt.setUrl(src.getUrl()); + tgt.setIfNoneMatch(src.getIfNoneMatch()); + tgt.setIfModifiedSince(src.getIfModifiedSince()); + tgt.setIfMatch(src.getIfMatch()); + tgt.setIfNoneExist(src.getIfNoneExist()); + return tgt; + } + + public org.hl7.fhir.dstu2.model.Bundle.BundleEntryRequestComponent convertBundleEntryRequestComponent(org.hl7.fhir.r5.model.Bundle.BundleEntryRequestComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Bundle.BundleEntryRequestComponent tgt = new org.hl7.fhir.dstu2.model.Bundle.BundleEntryRequestComponent(); + copyElement(src, tgt); + tgt.setMethod(convertHTTPVerb(src.getMethod())); + tgt.setUrl(src.getUrl()); + tgt.setIfNoneMatch(src.getIfNoneMatch()); + tgt.setIfModifiedSince(src.getIfModifiedSince()); + tgt.setIfMatch(src.getIfMatch()); + tgt.setIfNoneExist(src.getIfNoneExist()); + return tgt; + } + + public org.hl7.fhir.r5.model.Bundle.HTTPVerb convertHTTPVerb(org.hl7.fhir.dstu2.model.Bundle.HTTPVerb src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case GET: return org.hl7.fhir.r5.model.Bundle.HTTPVerb.GET; + case POST: return org.hl7.fhir.r5.model.Bundle.HTTPVerb.POST; + case PUT: return org.hl7.fhir.r5.model.Bundle.HTTPVerb.PUT; + case DELETE: return org.hl7.fhir.r5.model.Bundle.HTTPVerb.DELETE; + default: return org.hl7.fhir.r5.model.Bundle.HTTPVerb.NULL; + } + } + + public org.hl7.fhir.dstu2.model.Bundle.HTTPVerb convertHTTPVerb(org.hl7.fhir.r5.model.Bundle.HTTPVerb src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case GET: return org.hl7.fhir.dstu2.model.Bundle.HTTPVerb.GET; + case POST: return org.hl7.fhir.dstu2.model.Bundle.HTTPVerb.POST; + case PUT: return org.hl7.fhir.dstu2.model.Bundle.HTTPVerb.PUT; + case DELETE: return org.hl7.fhir.dstu2.model.Bundle.HTTPVerb.DELETE; + default: return org.hl7.fhir.dstu2.model.Bundle.HTTPVerb.NULL; + } + } + + public org.hl7.fhir.r5.model.Bundle.BundleEntryResponseComponent convertBundleEntryResponseComponent(org.hl7.fhir.dstu2.model.Bundle.BundleEntryResponseComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Bundle.BundleEntryResponseComponent tgt = new org.hl7.fhir.r5.model.Bundle.BundleEntryResponseComponent(); + copyElement(src, tgt); + tgt.setStatus(src.getStatus()); + tgt.setLocation(src.getLocation()); + tgt.setEtag(src.getEtag()); + tgt.setLastModified(src.getLastModified()); + return tgt; + } + + public org.hl7.fhir.dstu2.model.Bundle.BundleEntryResponseComponent convertBundleEntryResponseComponent(org.hl7.fhir.r5.model.Bundle.BundleEntryResponseComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Bundle.BundleEntryResponseComponent tgt = new org.hl7.fhir.dstu2.model.Bundle.BundleEntryResponseComponent(); + copyElement(src, tgt); + tgt.setStatus(src.getStatus()); + tgt.setLocation(src.getLocation()); + tgt.setEtag(src.getEtag()); + tgt.setLastModified(src.getLastModified()); + return tgt; + } + + public org.hl7.fhir.r5.model.CarePlan convertCarePlan(org.hl7.fhir.dstu2.model.CarePlan src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.CarePlan tgt = new org.hl7.fhir.r5.model.CarePlan(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + tgt.setSubject(convertReference(src.getSubject())); + tgt.setStatus(convertCarePlanStatus(src.getStatus())); + tgt.setEncounter(convertReference(src.getContext())); + tgt.setPeriod(convertPeriod(src.getPeriod())); + for (org.hl7.fhir.dstu2.model.Reference t : src.getAuthor()) + if (!tgt.hasAuthor()) + tgt.setAuthor(convertReference(t)); + else + tgt.addContributor(convertReference(t)); +// tgt.setModified(src.getModified()); + for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getCategory()) + tgt.addCategory(convertCodeableConcept(t)); + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu2.model.Reference t : src.getAddresses()) + tgt.addAddresses(convertReference(t)); +// for (org.hl7.fhir.dstu2.model.Reference t : src.getSupport()) +// tgt.addSupport(convertReference(t)); +// for (org.hl7.fhir.dstu2.model.CarePlan.CarePlanRelatedPlanComponent t : src.getRelatedPlan()) +// tgt.addRelatedPlan(convertCarePlanRelatedPlanComponent(t)); +// for (org.hl7.fhir.dstu2.model.CarePlan.CarePlanParticipantComponent t : src.getParticipant()) +// tgt.addParticipant(convertCarePlanParticipantComponent(t)); + for (org.hl7.fhir.dstu2.model.Reference t : src.getGoal()) + tgt.addGoal(convertReference(t)); + for (org.hl7.fhir.dstu2.model.CarePlan.CarePlanActivityComponent t : src.getActivity()) + tgt.addActivity(convertCarePlanActivityComponent(t)); +// tgt.setNote(convertAnnotation(src.getNote())); + return tgt; + } + + public org.hl7.fhir.dstu2.model.CarePlan convertCarePlan(org.hl7.fhir.r5.model.CarePlan src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.CarePlan tgt = new org.hl7.fhir.dstu2.model.CarePlan(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + tgt.setSubject(convertReference(src.getSubject())); + tgt.setStatus(convertCarePlanStatus(src.getStatus())); + tgt.setContext(convertReference(src.getEncounter())); + tgt.setPeriod(convertPeriod(src.getPeriod())); + if (src.hasAuthor()) + tgt.addAuthor(convertReference(src.getAuthor())); + for (org.hl7.fhir.r5.model.Reference t : src.getContributor()) + tgt.addAuthor(convertReference(t)); +// tgt.setModified(src.getModified()); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getCategory()) + tgt.addCategory(convertCodeableConcept(t)); + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.r5.model.Reference t : src.getAddresses()) + tgt.addAddresses(convertReference(t)); +// for (org.hl7.fhir.r5.model.Reference t : src.getSupport()) +// tgt.addSupport(convertReference(t)); +// for (org.hl7.fhir.r5.model.CarePlan.CarePlanRelatedPlanComponent t : src.getRelatedPlan()) +// tgt.addRelatedPlan(convertCarePlanRelatedPlanComponent(t)); +// for (org.hl7.fhir.r5.model.CarePlan.CarePlanParticipantComponent t : src.getParticipant()) +// tgt.addParticipant(convertCarePlanParticipantComponent(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getGoal()) + tgt.addGoal(convertReference(t)); + for (org.hl7.fhir.r5.model.CarePlan.CarePlanActivityComponent t : src.getActivity()) + tgt.addActivity(convertCarePlanActivityComponent(t)); +// tgt.setNote(convertAnnotation(src.getNote())); + return tgt; + } + + public org.hl7.fhir.r5.model.CarePlan.CarePlanStatus convertCarePlanStatus(org.hl7.fhir.dstu2.model.CarePlan.CarePlanStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PROPOSED: return org.hl7.fhir.r5.model.CarePlan.CarePlanStatus.DRAFT; + case DRAFT: return org.hl7.fhir.r5.model.CarePlan.CarePlanStatus.DRAFT; + case ACTIVE: return org.hl7.fhir.r5.model.CarePlan.CarePlanStatus.ACTIVE; + case COMPLETED: return org.hl7.fhir.r5.model.CarePlan.CarePlanStatus.COMPLETED; + case CANCELLED: return org.hl7.fhir.r5.model.CarePlan.CarePlanStatus.REVOKED; + default: return org.hl7.fhir.r5.model.CarePlan.CarePlanStatus.NULL; + } + } + + public org.hl7.fhir.dstu2.model.CarePlan.CarePlanStatus convertCarePlanStatus(org.hl7.fhir.r5.model.CarePlan.CarePlanStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { +// case PROPOSED: return org.hl7.fhir.dstu2.model.CarePlan.CarePlanStatus.PROPOSED; + case DRAFT: return org.hl7.fhir.dstu2.model.CarePlan.CarePlanStatus.DRAFT; + case ACTIVE: return org.hl7.fhir.dstu2.model.CarePlan.CarePlanStatus.ACTIVE; + case COMPLETED: return org.hl7.fhir.dstu2.model.CarePlan.CarePlanStatus.COMPLETED; + case REVOKED: return org.hl7.fhir.dstu2.model.CarePlan.CarePlanStatus.CANCELLED; + default: return org.hl7.fhir.dstu2.model.CarePlan.CarePlanStatus.NULL; + } + } + +// public org.hl7.fhir.r5.model.CarePlan.CarePlanRelatedPlanComponent convertCarePlanRelatedPlanComponent(org.hl7.fhir.dstu2.model.CarePlan.CarePlanRelatedPlanComponent src) throws FHIRException { +// if (src == null || src.isEmpty()) +// return null; +// org.hl7.fhir.r5.model.CarePlan.CarePlanRelatedPlanComponent tgt = new org.hl7.fhir.r5.model.CarePlan.CarePlanRelatedPlanComponent(); +// copyElement(src, tgt); +// tgt.setCode(convertCarePlanRelationship(src.getCode())); +// tgt.setPlan(convertReference(src.getPlan())); +// return tgt; +// } + +// public org.hl7.fhir.dstu2.model.CarePlan.CarePlanRelatedPlanComponent convertCarePlanRelatedPlanComponent(org.hl7.fhir.r5.model.CarePlan.CarePlanRelatedPlanComponent src) throws FHIRException { +// if (src == null || src.isEmpty()) +// return null; +// org.hl7.fhir.dstu2.model.CarePlan.CarePlanRelatedPlanComponent tgt = new org.hl7.fhir.dstu2.model.CarePlan.CarePlanRelatedPlanComponent(); +// copyElement(src, tgt); +// tgt.setCode(convertCarePlanRelationship(src.getCode())); +// tgt.setPlan(convertReference(src.getPlan())); +// return tgt; +// } + +// public org.hl7.fhir.r5.model.CarePlan.CarePlanRelationship convertCarePlanRelationship(org.hl7.fhir.dstu2.model.CarePlan.CarePlanRelationship src) throws FHIRException { +// if (src == null) +// return null; +// switch (src) { +// case INCLUDES: return org.hl7.fhir.r5.model.CarePlan.CarePlanRelationship.INCLUDES; +// case REPLACES: return org.hl7.fhir.r5.model.CarePlan.CarePlanRelationship.REPLACES; +// case FULFILLS: return org.hl7.fhir.r5.model.CarePlan.CarePlanRelationship.FULFILLS; +// default: return org.hl7.fhir.r5.model.CarePlan.CarePlanRelationship.NULL; +// } +// } + +// public org.hl7.fhir.dstu2.model.CarePlan.CarePlanRelationship convertCarePlanRelationship(org.hl7.fhir.r5.model.CarePlan.CarePlanRelationship src) throws FHIRException { +// if (src == null) +// return null; +// switch (src) { +// case INCLUDES: return org.hl7.fhir.dstu2.model.CarePlan.CarePlanRelationship.INCLUDES; +// case REPLACES: return org.hl7.fhir.dstu2.model.CarePlan.CarePlanRelationship.REPLACES; +// case FULFILLS: return org.hl7.fhir.dstu2.model.CarePlan.CarePlanRelationship.FULFILLS; +// default: return org.hl7.fhir.dstu2.model.CarePlan.CarePlanRelationship.NULL; +// } +// } + +// public org.hl7.fhir.r5.model.CarePlan.CarePlanParticipantComponent convertCarePlanParticipantComponent(org.hl7.fhir.dstu2.model.CarePlan.CarePlanParticipantComponent src) throws FHIRException { +// if (src == null || src.isEmpty()) +// return null; +// org.hl7.fhir.r5.model.CarePlan.CarePlanParticipantComponent tgt = new org.hl7.fhir.r5.model.CarePlan.CarePlanParticipantComponent(); +// copyElement(src, tgt); +// tgt.setRole(convertCodeableConcept(src.getRole())); +// tgt.setMember(convertReference(src.getMember())); +// return tgt; +// } +// +// public org.hl7.fhir.dstu2.model.CarePlan.CarePlanParticipantComponent convertCarePlanParticipantComponent(org.hl7.fhir.r5.model.CarePlan.CarePlanParticipantComponent src) throws FHIRException { +// if (src == null || src.isEmpty()) +// return null; +// org.hl7.fhir.dstu2.model.CarePlan.CarePlanParticipantComponent tgt = new org.hl7.fhir.dstu2.model.CarePlan.CarePlanParticipantComponent(); +// copyElement(src, tgt); +// tgt.setRole(convertCodeableConcept(src.getRole())); +// tgt.setMember(convertReference(src.getMember())); +// return tgt; +// } +// + public org.hl7.fhir.r5.model.CarePlan.CarePlanActivityComponent convertCarePlanActivityComponent(org.hl7.fhir.dstu2.model.CarePlan.CarePlanActivityComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.CarePlan.CarePlanActivityComponent tgt = new org.hl7.fhir.r5.model.CarePlan.CarePlanActivityComponent(); + copyElement(src, tgt); +// for (org.hl7.fhir.dstu2.model.Reference t : src.getActionResulting()) +// tgt.addActionResulting(convertReference(t)); + for (org.hl7.fhir.dstu2.model.Annotation t : src.getProgress()) + tgt.addProgress(convertAnnotation(t)); + tgt.setReference(convertReference(src.getReference())); + tgt.setDetail(convertCarePlanActivityDetailComponent(src.getDetail())); + return tgt; + } + + public org.hl7.fhir.dstu2.model.CarePlan.CarePlanActivityComponent convertCarePlanActivityComponent(org.hl7.fhir.r5.model.CarePlan.CarePlanActivityComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.CarePlan.CarePlanActivityComponent tgt = new org.hl7.fhir.dstu2.model.CarePlan.CarePlanActivityComponent(); + copyElement(src, tgt); +// for (org.hl7.fhir.r5.model.Reference t : src.getActionResulting()) +// tgt.addActionResulting(convertReference(t)); + for (org.hl7.fhir.r5.model.Annotation t : src.getProgress()) + tgt.addProgress(convertAnnotation(t)); + tgt.setReference(convertReference(src.getReference())); + tgt.setDetail(convertCarePlanActivityDetailComponent(src.getDetail())); + return tgt; + } + + public org.hl7.fhir.r5.model.CarePlan.CarePlanActivityDetailComponent convertCarePlanActivityDetailComponent(org.hl7.fhir.dstu2.model.CarePlan.CarePlanActivityDetailComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.CarePlan.CarePlanActivityDetailComponent tgt = new org.hl7.fhir.r5.model.CarePlan.CarePlanActivityDetailComponent(); + copyElement(src, tgt); +// tgt.setKind().add(convertCodeableConcept(src.getCategory())); + tgt.setCode(convertCodeableConcept(src.getCode())); + for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getReasonCode()) + tgt.addReasonCode(convertCodeableConcept(t)); + for (org.hl7.fhir.dstu2.model.Reference t : src.getReasonReference()) + tgt.addReasonReference(convertReference(t)); + for (org.hl7.fhir.dstu2.model.Reference t : src.getGoal()) + tgt.addGoal(convertReference(t)); + tgt.setStatus(convertCarePlanActivityStatus(src.getStatus())); +// tgt.setStatusReason(convertCodeableConcept(src.getStatusReason())); + tgt.setDoNotPerform(src.getProhibited()); + tgt.setScheduled(convertType(src.getScheduled())); + tgt.setLocation(convertReference(src.getLocation())); + for (org.hl7.fhir.dstu2.model.Reference t : src.getPerformer()) + tgt.addPerformer(convertReference(t)); + tgt.setProduct(convertType(src.getProduct())); + tgt.setDailyAmount(convertSimpleQuantity(src.getDailyAmount())); + tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); + tgt.setDescription(src.getDescription()); + return tgt; + } + + public org.hl7.fhir.dstu2.model.CarePlan.CarePlanActivityDetailComponent convertCarePlanActivityDetailComponent(org.hl7.fhir.r5.model.CarePlan.CarePlanActivityDetailComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.CarePlan.CarePlanActivityDetailComponent tgt = new org.hl7.fhir.dstu2.model.CarePlan.CarePlanActivityDetailComponent(); + copyElement(src, tgt); + // tgt.setCategory(convertCodeableConcept(src.getKind())); + tgt.setCode(convertCodeableConcept(src.getCode())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getReasonCode()) + tgt.addReasonCode(convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getReasonReference()) + tgt.addReasonReference(convertReference(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getGoal()) + tgt.addGoal(convertReference(t)); + tgt.setStatus(convertCarePlanActivityStatus(src.getStatus())); +// tgt.setStatusReason(convertCodeableConcept(src.getStatusReason())); + tgt.setProhibited(src.getDoNotPerform()); + tgt.setScheduled(convertType(src.getScheduled())); + tgt.setLocation(convertReference(src.getLocation())); + for (org.hl7.fhir.r5.model.Reference t : src.getPerformer()) + tgt.addPerformer(convertReference(t)); + tgt.setProduct(convertType(src.getProduct())); + tgt.setDailyAmount(convertSimpleQuantity(src.getDailyAmount())); + tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); + tgt.setDescription(src.getDescription()); + return tgt; + } + + public org.hl7.fhir.r5.model.CarePlan.CarePlanActivityStatus convertCarePlanActivityStatus(org.hl7.fhir.dstu2.model.CarePlan.CarePlanActivityStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case NOTSTARTED: return org.hl7.fhir.r5.model.CarePlan.CarePlanActivityStatus.NOTSTARTED; + case SCHEDULED: return org.hl7.fhir.r5.model.CarePlan.CarePlanActivityStatus.SCHEDULED; + case INPROGRESS: return org.hl7.fhir.r5.model.CarePlan.CarePlanActivityStatus.INPROGRESS; + case ONHOLD: return org.hl7.fhir.r5.model.CarePlan.CarePlanActivityStatus.ONHOLD; + case COMPLETED: return org.hl7.fhir.r5.model.CarePlan.CarePlanActivityStatus.COMPLETED; + case CANCELLED: return org.hl7.fhir.r5.model.CarePlan.CarePlanActivityStatus.CANCELLED; + default: return org.hl7.fhir.r5.model.CarePlan.CarePlanActivityStatus.NULL; + } + } + + public org.hl7.fhir.dstu2.model.CarePlan.CarePlanActivityStatus convertCarePlanActivityStatus(org.hl7.fhir.r5.model.CarePlan.CarePlanActivityStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case NOTSTARTED: return org.hl7.fhir.dstu2.model.CarePlan.CarePlanActivityStatus.NOTSTARTED; + case SCHEDULED: return org.hl7.fhir.dstu2.model.CarePlan.CarePlanActivityStatus.SCHEDULED; + case INPROGRESS: return org.hl7.fhir.dstu2.model.CarePlan.CarePlanActivityStatus.INPROGRESS; + case ONHOLD: return org.hl7.fhir.dstu2.model.CarePlan.CarePlanActivityStatus.ONHOLD; + case COMPLETED: return org.hl7.fhir.dstu2.model.CarePlan.CarePlanActivityStatus.COMPLETED; + case CANCELLED: return org.hl7.fhir.dstu2.model.CarePlan.CarePlanActivityStatus.CANCELLED; + default: return org.hl7.fhir.dstu2.model.CarePlan.CarePlanActivityStatus.NULL; + } + } + +// public org.hl7.fhir.r5.model.ClinicalImpression convertClinicalImpression(org.hl7.fhir.dstu2.model.ClinicalImpression src) throws FHIRException { +// if (src == null || src.isEmpty()) +// return null; +// org.hl7.fhir.r5.model.ClinicalImpression tgt = new org.hl7.fhir.r5.model.ClinicalImpression(); +// copyDomainResource(src, tgt); +// tgt.setSubject(convertReference(src.getPatient())); +// tgt.setAssessor(convertReference(src.getAssessor())); +// tgt.setStatus(convertClinicalImpressionStatus(src.getStatus())); +// if (src.hasDate()) +// tgt.setDate(src.getDate()); +// tgt.setDescription(src.getDescription()); +// tgt.setPrevious(convertReference(src.getPrevious())); +// for (org.hl7.fhir.dstu2.model.Reference t : src.getProblem()) +// tgt.addProblem(convertReference(t)); +//// for (org.hl7.fhir.dstu2.model.ClinicalImpression.ClinicalImpressionInvestigationsComponent t : src.getInvestigations()) +//// tgt.addInvestigations(convertClinicalImpressionInvestigationsComponent(t)); +// tgt.addProtocol(src.getProtocol()); +// tgt.setSummary(src.getSummary()); +// for (org.hl7.fhir.dstu2.model.ClinicalImpression.ClinicalImpressionFindingComponent t : src.getFinding()) +// tgt.addFinding(convertClinicalImpressionFindingComponent(t)); +// if (src.hasPrognosis()) +// tgt.addPrognosisCodeableConcept ().setText(src.getPrognosis()); +//// for (org.hl7.fhir.dstu2.model.Reference t : src.getPlan()) +//// tgt.addPlan(convertReference(t)); +// for (org.hl7.fhir.dstu2.model.Reference t : src.getAction()) +// tgt.addAction(convertReference(t)); +// return tgt; +// } +// +// public org.hl7.fhir.dstu2.model.ClinicalImpression convertClinicalImpression(org.hl7.fhir.r5.model.ClinicalImpression src) throws FHIRException { +// if (src == null || src.isEmpty()) +// return null; +// org.hl7.fhir.dstu2.model.ClinicalImpression tgt = new org.hl7.fhir.dstu2.model.ClinicalImpression(); +// copyDomainResource(src, tgt); +// tgt.setPatient(convertReference(src.getSubject())); +// tgt.setAssessor(convertReference(src.getAssessor())); +// tgt.setStatus(convertClinicalImpressionStatus(src.getStatus())); +// if (src.hasDate()) +// tgt.setDate(src.getDate()); +// tgt.setDescription(src.getDescription()); +// tgt.setPrevious(convertReference(src.getPrevious())); +// for (org.hl7.fhir.r5.model.Reference t : src.getProblem()) +// tgt.addProblem(convertReference(t)); +//// for (org.hl7.fhir.r5.model.ClinicalImpression.ClinicalImpressionInvestigationsComponent t : src.getInvestigations()) +//// tgt.addInvestigations(convertClinicalImpressionInvestigationsComponent(t)); +// for (UriType t : src.getProtocol()) +// tgt.setProtocol(t.asStringValue()); +// tgt.setSummary(src.getSummary()); +// for (org.hl7.fhir.r5.model.ClinicalImpression.ClinicalImpressionFindingComponent t : src.getFinding()) +// tgt.addFinding(convertClinicalImpressionFindingComponent(t)); +// tgt.setPrognosis(src.getPrognosisCodeableConceptFirstRep().getText()); +//// for (org.hl7.fhir.r5.model.Reference t : src.getPlan()) +//// tgt.addPlan(convertReference(t)); +// for (org.hl7.fhir.r5.model.Reference t : src.getAction()) +// tgt.addAction(convertReference(t)); +// return tgt; +// } +// +// public org.hl7.fhir.r5.model.ClinicalImpression.ClinicalImpressionStatus convertClinicalImpressionStatus(org.hl7.fhir.dstu2.model.ClinicalImpression.ClinicalImpressionStatus src) throws FHIRException { +// if (src == null) +// return null; +// switch (src) { +// case INPROGRESS: return org.hl7.fhir.r5.model.ClinicalImpression.ClinicalImpressionStatus.DRAFT; +// case COMPLETED: return org.hl7.fhir.r5.model.ClinicalImpression.ClinicalImpressionStatus.COMPLETED; +// case ENTEREDINERROR: return org.hl7.fhir.r5.model.ClinicalImpression.ClinicalImpressionStatus.ENTEREDINERROR; +// default: return org.hl7.fhir.r5.model.ClinicalImpression.ClinicalImpressionStatus.NULL; +// } +// } +// +// public org.hl7.fhir.dstu2.model.ClinicalImpression.ClinicalImpressionStatus convertClinicalImpressionStatus(org.hl7.fhir.r5.model.ClinicalImpression.ClinicalImpressionStatus src) throws FHIRException { +// if (src == null) +// return null; +// switch (src) { +// case DRAFT: return org.hl7.fhir.dstu2.model.ClinicalImpression.ClinicalImpressionStatus.INPROGRESS; +// case COMPLETED: return org.hl7.fhir.dstu2.model.ClinicalImpression.ClinicalImpressionStatus.COMPLETED; +// case ENTEREDINERROR: return org.hl7.fhir.dstu2.model.ClinicalImpression.ClinicalImpressionStatus.ENTEREDINERROR; +// default: return org.hl7.fhir.dstu2.model.ClinicalImpression.ClinicalImpressionStatus.NULL; +// } +// } +// +//// public org.hl7.fhir.r5.model.ClinicalImpression.ClinicalImpressionInvestigationsComponent convertClinicalImpressionInvestigationsComponent(org.hl7.fhir.dstu2.model.ClinicalImpression.ClinicalImpressionInvestigationsComponent src) throws FHIRException { +//// if (src == null || src.isEmpty()) +//// return null; +//// org.hl7.fhir.r5.model.ClinicalImpression.ClinicalImpressionInvestigationsComponent tgt = new org.hl7.fhir.r5.model.ClinicalImpression.ClinicalImpressionInvestigationsComponent(); +//// copyElement(src, tgt); +//// tgt.setCode(convertCodeableConcept(src.getCode())); +//// for (org.hl7.fhir.dstu2.model.Reference t : src.getItem()) +//// tgt.addItem(convertReference(t)); +//// return tgt; +//// } +//// +//// public org.hl7.fhir.dstu2.model.ClinicalImpression.ClinicalImpressionInvestigationsComponent convertClinicalImpressionInvestigationsComponent(org.hl7.fhir.r5.model.ClinicalImpression.ClinicalImpressionInvestigationsComponent src) throws FHIRException { +//// if (src == null || src.isEmpty()) +//// return null; +//// org.hl7.fhir.dstu2.model.ClinicalImpression.ClinicalImpressionInvestigationsComponent tgt = new org.hl7.fhir.dstu2.model.ClinicalImpression.ClinicalImpressionInvestigationsComponent(); +//// copyElement(src, tgt); +//// tgt.setCode(convertCodeableConcept(src.getCode())); +//// for (org.hl7.fhir.r5.model.Reference t : src.getItem()) +//// tgt.addItem(convertReference(t)); +//// return tgt; +//// } +// +// public org.hl7.fhir.r5.model.ClinicalImpression.ClinicalImpressionFindingComponent convertClinicalImpressionFindingComponent(org.hl7.fhir.dstu2.model.ClinicalImpression.ClinicalImpressionFindingComponent src) throws FHIRException { +// if (src == null || src.isEmpty()) +// return null; +// org.hl7.fhir.r5.model.ClinicalImpression.ClinicalImpressionFindingComponent tgt = new org.hl7.fhir.r5.model.ClinicalImpression.ClinicalImpressionFindingComponent(); +// copyElement(src, tgt); +// tgt.setItem(convertCodeableConcept(src.getItem())); +//// tgt.setCause(src.getCause()); +// return tgt; +// } +// +// public org.hl7.fhir.dstu2.model.ClinicalImpression.ClinicalImpressionFindingComponent convertClinicalImpressionFindingComponent(org.hl7.fhir.r5.model.ClinicalImpression.ClinicalImpressionFindingComponent src) throws FHIRException { +// if (src == null || src.isEmpty()) +// return null; +// org.hl7.fhir.dstu2.model.ClinicalImpression.ClinicalImpressionFindingComponent tgt = new org.hl7.fhir.dstu2.model.ClinicalImpression.ClinicalImpressionFindingComponent(); +// copyElement(src, tgt); +// if (src.hasItemCodeableConcept()) +// try { +// tgt.setItem(convertCodeableConcept(src.getItemCodeableConcept())); +// } catch (org.hl7.fhir.exceptions.FHIRException e) { +// } +//// tgt.setCause(src.getCause()); +// return tgt; +// } +// + public org.hl7.fhir.r5.model.Communication convertCommunication(org.hl7.fhir.dstu2.model.Communication src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Communication tgt = new org.hl7.fhir.r5.model.Communication(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + tgt.addCategory(convertCodeableConcept(src.getCategory())); + tgt.setSender(convertReference(src.getSender())); + for (org.hl7.fhir.dstu2.model.Reference t : src.getRecipient()) + tgt.addRecipient(convertReference(t)); + for (org.hl7.fhir.dstu2.model.Communication.CommunicationPayloadComponent t : src.getPayload()) + tgt.addPayload(convertCommunicationPayloadComponent(t)); + for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getMedium()) + tgt.addMedium(convertCodeableConcept(t)); + tgt.setStatus(convertCommunicationStatus(src.getStatus())); + tgt.setEncounter(convertReference(src.getEncounter())); + tgt.setSent(src.getSent()); + tgt.setReceived(src.getReceived()); + for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getReason()) + tgt.addReasonCode(convertCodeableConcept(t)); + tgt.setSubject(convertReference(src.getSubject())); + return tgt; + } + + public org.hl7.fhir.dstu2.model.Communication convertCommunication(org.hl7.fhir.r5.model.Communication src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Communication tgt = new org.hl7.fhir.dstu2.model.Communication(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + tgt.setCategory(convertCodeableConcept(src.getCategoryFirstRep())); + tgt.setSender(convertReference(src.getSender())); + for (org.hl7.fhir.r5.model.Reference t : src.getRecipient()) + tgt.addRecipient(convertReference(t)); + for (org.hl7.fhir.r5.model.Communication.CommunicationPayloadComponent t : src.getPayload()) + tgt.addPayload(convertCommunicationPayloadComponent(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getMedium()) + tgt.addMedium(convertCodeableConcept(t)); + tgt.setStatus(convertCommunicationStatus(src.getStatus())); + tgt.setEncounter(convertReference(src.getEncounter())); + tgt.setSent(src.getSent()); + tgt.setReceived(src.getReceived()); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getReasonCode()) + tgt.addReason(convertCodeableConcept(t)); + tgt.setSubject(convertReference(src.getSubject())); + return tgt; + } + + public org.hl7.fhir.r5.model.Communication.CommunicationStatus convertCommunicationStatus(org.hl7.fhir.dstu2.model.Communication.CommunicationStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case INPROGRESS: return org.hl7.fhir.r5.model.Communication.CommunicationStatus.INPROGRESS; + case COMPLETED: return org.hl7.fhir.r5.model.Communication.CommunicationStatus.COMPLETED; + case SUSPENDED: return org.hl7.fhir.r5.model.Communication.CommunicationStatus.ONHOLD; + case REJECTED: return org.hl7.fhir.r5.model.Communication.CommunicationStatus.ENTEREDINERROR; + case FAILED: return org.hl7.fhir.r5.model.Communication.CommunicationStatus.NOTDONE; + default: return org.hl7.fhir.r5.model.Communication.CommunicationStatus.NULL; + } + } + + public org.hl7.fhir.dstu2.model.Communication.CommunicationStatus convertCommunicationStatus(org.hl7.fhir.r5.model.Communication.CommunicationStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case INPROGRESS: return org.hl7.fhir.dstu2.model.Communication.CommunicationStatus.INPROGRESS; + case COMPLETED: return org.hl7.fhir.dstu2.model.Communication.CommunicationStatus.COMPLETED; + case ONHOLD: return org.hl7.fhir.dstu2.model.Communication.CommunicationStatus.SUSPENDED; + case ENTEREDINERROR: return org.hl7.fhir.dstu2.model.Communication.CommunicationStatus.REJECTED; + case NOTDONE: return org.hl7.fhir.dstu2.model.Communication.CommunicationStatus.FAILED; + default: return org.hl7.fhir.dstu2.model.Communication.CommunicationStatus.NULL; + } + } + + public org.hl7.fhir.r5.model.Communication.CommunicationPayloadComponent convertCommunicationPayloadComponent(org.hl7.fhir.dstu2.model.Communication.CommunicationPayloadComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Communication.CommunicationPayloadComponent tgt = new org.hl7.fhir.r5.model.Communication.CommunicationPayloadComponent(); + copyElement(src, tgt); + tgt.setContent(convertType(src.getContent())); + return tgt; + } + + public org.hl7.fhir.dstu2.model.Communication.CommunicationPayloadComponent convertCommunicationPayloadComponent(org.hl7.fhir.r5.model.Communication.CommunicationPayloadComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Communication.CommunicationPayloadComponent tgt = new org.hl7.fhir.dstu2.model.Communication.CommunicationPayloadComponent(); + copyElement(src, tgt); + tgt.setContent(convertType(src.getContent())); + return tgt; + } + + public org.hl7.fhir.r5.model.CommunicationRequest convertCommunicationRequest(org.hl7.fhir.dstu2.model.CommunicationRequest src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.CommunicationRequest tgt = new org.hl7.fhir.r5.model.CommunicationRequest(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + tgt.addCategory(convertCodeableConcept(src.getCategory())); + tgt.setSender(convertReference(src.getSender())); + for (org.hl7.fhir.dstu2.model.Reference t : src.getRecipient()) + tgt.addRecipient(convertReference(t)); + for (org.hl7.fhir.dstu2.model.CommunicationRequest.CommunicationRequestPayloadComponent t : src.getPayload()) + tgt.addPayload(convertCommunicationRequestPayloadComponent(t)); + for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getMedium()) + tgt.addMedium(convertCodeableConcept(t)); + tgt.setRequester(convertReference(src.getRequester())); + tgt.setStatus(convertCommunicationRequestStatus(src.getStatus())); + tgt.setEncounter(convertReference(src.getEncounter())); + tgt.setOccurrence(convertType(src.getScheduled())); + for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getReason()) + tgt.addReasonCode(convertCodeableConcept(t)); + tgt.setAuthoredOn(src.getRequestedOn()); + tgt.setSubject(convertReference(src.getSubject())); + tgt.setPriority(convertPriorityCode(src.getPriority())); + return tgt; + } + + private org.hl7.fhir.r5.model.CommunicationRequest.CommunicationPriority convertPriorityCode(org.hl7.fhir.dstu2.model.CodeableConcept priority) { + for (org.hl7.fhir.dstu2.model.Coding c : priority.getCoding()) { + if ("http://hl7.org/fhir/diagnostic-order-priority".equals(c.getSystem()) && "routine".equals(c.getCode())) + return org.hl7.fhir.r5.model.CommunicationRequest.CommunicationPriority.ROUTINE; + if ("http://hl7.org/fhir/diagnostic-order-priority".equals(c.getSystem()) && "urgent".equals(c.getCode())) + return org.hl7.fhir.r5.model.CommunicationRequest.CommunicationPriority.URGENT; + if ("http://hl7.org/fhir/diagnostic-order-priority".equals(c.getSystem()) && "stat".equals(c.getCode())) + return org.hl7.fhir.r5.model.CommunicationRequest.CommunicationPriority.STAT; + if ("http://hl7.org/fhir/diagnostic-order-priority".equals(c.getSystem()) && "asap".equals(c.getCode())) + return org.hl7.fhir.r5.model.CommunicationRequest.CommunicationPriority.ASAP; + } + return null; + } + + public org.hl7.fhir.dstu2.model.CommunicationRequest convertCommunicationRequest(org.hl7.fhir.r5.model.CommunicationRequest src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.CommunicationRequest tgt = new org.hl7.fhir.dstu2.model.CommunicationRequest(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + tgt.setCategory(convertCodeableConcept(src.getCategoryFirstRep())); + tgt.setSender(convertReference(src.getSender())); + for (org.hl7.fhir.r5.model.Reference t : src.getRecipient()) + tgt.addRecipient(convertReference(t)); + for (org.hl7.fhir.r5.model.CommunicationRequest.CommunicationRequestPayloadComponent t : src.getPayload()) + tgt.addPayload(convertCommunicationRequestPayloadComponent(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getMedium()) + tgt.addMedium(convertCodeableConcept(t)); + tgt.setRequester(convertReference(src.getRequester())); + tgt.setStatus(convertCommunicationRequestStatus(src.getStatus())); + tgt.setEncounter(convertReference(src.getEncounter())); + tgt.setScheduled(convertType(src.getOccurrence())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getReasonCode()) + tgt.addReason(convertCodeableConcept(t)); + tgt.setRequestedOn(src.getAuthoredOn()); + tgt.setSubject(convertReference(src.getSubject())); + tgt.setPriority(convertPriorityCode(src.getPriority())); + return tgt; + } + + private org.hl7.fhir.dstu2.model.CodeableConcept convertPriorityCode(org.hl7.fhir.r5.model.CommunicationRequest.CommunicationPriority priority) { + org.hl7.fhir.dstu2.model.CodeableConcept cc = new org.hl7.fhir.dstu2.model.CodeableConcept(); + switch (priority) { + case ROUTINE: cc.addCoding().setSystem("http://hl7.org/fhir/diagnostic-order-priority").setCode("routine"); break; + case URGENT: cc.addCoding().setSystem("http://hl7.org/fhir/diagnostic-order-priority").setCode("urgent"); break; + case STAT: cc.addCoding().setSystem("http://hl7.org/fhir/diagnostic-order-priority").setCode("stat"); break; + case ASAP: cc.addCoding().setSystem("http://hl7.org/fhir/diagnostic-order-priority").setCode("asap"); break; + default: return null; + } + return cc; + } + + public org.hl7.fhir.r5.model.CommunicationRequest.CommunicationRequestStatus convertCommunicationRequestStatus(org.hl7.fhir.dstu2.model.CommunicationRequest.CommunicationRequestStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PROPOSED: return org.hl7.fhir.r5.model.CommunicationRequest.CommunicationRequestStatus.DRAFT; + case PLANNED: return org.hl7.fhir.r5.model.CommunicationRequest.CommunicationRequestStatus.ACTIVE; + case REQUESTED: return org.hl7.fhir.r5.model.CommunicationRequest.CommunicationRequestStatus.ACTIVE; + case RECEIVED: return org.hl7.fhir.r5.model.CommunicationRequest.CommunicationRequestStatus.ACTIVE; + case ACCEPTED: return org.hl7.fhir.r5.model.CommunicationRequest.CommunicationRequestStatus.ACTIVE; + case INPROGRESS: return org.hl7.fhir.r5.model.CommunicationRequest.CommunicationRequestStatus.ACTIVE; + case COMPLETED: return org.hl7.fhir.r5.model.CommunicationRequest.CommunicationRequestStatus.COMPLETED; + case SUSPENDED: return org.hl7.fhir.r5.model.CommunicationRequest.CommunicationRequestStatus.ONHOLD; + case REJECTED: return org.hl7.fhir.r5.model.CommunicationRequest.CommunicationRequestStatus.ENTEREDINERROR; +// case FAILED: return org.hl7.fhir.r5.model.CommunicationRequest.CommunicationRequestStatus.FAILED; + default: return org.hl7.fhir.r5.model.CommunicationRequest.CommunicationRequestStatus.NULL; + } + } + + public org.hl7.fhir.dstu2.model.CommunicationRequest.CommunicationRequestStatus convertCommunicationRequestStatus(org.hl7.fhir.r5.model.CommunicationRequest.CommunicationRequestStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case DRAFT: return org.hl7.fhir.dstu2.model.CommunicationRequest.CommunicationRequestStatus.PROPOSED; +// case PLANNED: return org.hl7.fhir.dstu2.model.CommunicationRequest.CommunicationRequestStatus.PLANNED; +// case REQUESTED: return org.hl7.fhir.dstu2.model.CommunicationRequest.CommunicationRequestStatus.REQUESTED; +// case RECEIVED: return org.hl7.fhir.dstu2.model.CommunicationRequest.CommunicationRequestStatus.RECEIVED; +// case ACCEPTED: return org.hl7.fhir.dstu2.model.CommunicationRequest.CommunicationRequestStatus.ACCEPTED; + case ACTIVE: return org.hl7.fhir.dstu2.model.CommunicationRequest.CommunicationRequestStatus.INPROGRESS; + case COMPLETED: return org.hl7.fhir.dstu2.model.CommunicationRequest.CommunicationRequestStatus.COMPLETED; + case ONHOLD: return org.hl7.fhir.dstu2.model.CommunicationRequest.CommunicationRequestStatus.SUSPENDED; + case ENTEREDINERROR: return org.hl7.fhir.dstu2.model.CommunicationRequest.CommunicationRequestStatus.REJECTED; +// case FAILED: return org.hl7.fhir.dstu2.model.CommunicationRequest.CommunicationRequestStatus.FAILED; + default: return org.hl7.fhir.dstu2.model.CommunicationRequest.CommunicationRequestStatus.NULL; + } + } + + public org.hl7.fhir.r5.model.CommunicationRequest.CommunicationRequestPayloadComponent convertCommunicationRequestPayloadComponent(org.hl7.fhir.dstu2.model.CommunicationRequest.CommunicationRequestPayloadComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.CommunicationRequest.CommunicationRequestPayloadComponent tgt = new org.hl7.fhir.r5.model.CommunicationRequest.CommunicationRequestPayloadComponent(); + copyElement(src, tgt); + tgt.setContent(convertType(src.getContent())); + return tgt; + } + + public org.hl7.fhir.dstu2.model.CommunicationRequest.CommunicationRequestPayloadComponent convertCommunicationRequestPayloadComponent(org.hl7.fhir.r5.model.CommunicationRequest.CommunicationRequestPayloadComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.CommunicationRequest.CommunicationRequestPayloadComponent tgt = new org.hl7.fhir.dstu2.model.CommunicationRequest.CommunicationRequestPayloadComponent(); + copyElement(src, tgt); + tgt.setContent(convertType(src.getContent())); + return tgt; + } + + public org.hl7.fhir.r5.model.Composition convertComposition(org.hl7.fhir.dstu2.model.Composition src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Composition tgt = new org.hl7.fhir.r5.model.Composition(); + copyDomainResource(src, tgt); + tgt.setIdentifier(convertIdentifier(src.getIdentifier())); + if (src.hasDate()) + tgt.setDate(src.getDate()); + tgt.setType(convertCodeableConcept(src.getType())); + tgt.addCategory(convertCodeableConcept(src.getClass_())); + tgt.setTitle(src.getTitle()); + tgt.setStatus(convertCompositionStatus(src.getStatus())); + try { + tgt.setConfidentiality(org.hl7.fhir.r5.model.Composition.DocumentConfidentiality.fromCode(src.getConfidentiality())); + } catch (org.hl7.fhir.exceptions.FHIRException e) { + throw new FHIRException(e); + } + tgt.setSubject(convertReference(src.getSubject())); + for (org.hl7.fhir.dstu2.model.Reference t : src.getAuthor()) + tgt.addAuthor(convertReference(t)); + for (org.hl7.fhir.dstu2.model.Composition.CompositionAttesterComponent t : src.getAttester()) + tgt.addAttester(convertCompositionAttesterComponent(t)); + tgt.setCustodian(convertReference(src.getCustodian())); + for (org.hl7.fhir.dstu2.model.Composition.CompositionEventComponent t : src.getEvent()) + tgt.addEvent(convertCompositionEventComponent(t)); + tgt.setEncounter(convertReference(src.getEncounter())); + for (org.hl7.fhir.dstu2.model.Composition.SectionComponent t : src.getSection()) + tgt.addSection(convertSectionComponent(t)); + return tgt; + } + + public org.hl7.fhir.dstu2.model.Composition convertComposition(org.hl7.fhir.r5.model.Composition src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Composition tgt = new org.hl7.fhir.dstu2.model.Composition(); + copyDomainResource(src, tgt); + tgt.setIdentifier(convertIdentifier(src.getIdentifier())); + if (src.hasDate()) + tgt.setDate(src.getDate()); + tgt.setType(convertCodeableConcept(src.getType())); + if (src.hasCategory()) + tgt.setClass_(convertCodeableConcept(src.getCategoryFirstRep())); + tgt.setTitle(src.getTitle()); + tgt.setStatus(convertCompositionStatus(src.getStatus())); + tgt.setConfidentiality(src.getConfidentiality().toCode()); + tgt.setSubject(convertReference(src.getSubject())); + for (org.hl7.fhir.r5.model.Reference t : src.getAuthor()) + tgt.addAuthor(convertReference(t)); + for (org.hl7.fhir.r5.model.Composition.CompositionAttesterComponent t : src.getAttester()) + tgt.addAttester(convertCompositionAttesterComponent(t)); + tgt.setCustodian(convertReference(src.getCustodian())); + for (org.hl7.fhir.r5.model.Composition.CompositionEventComponent t : src.getEvent()) + tgt.addEvent(convertCompositionEventComponent(t)); + tgt.setEncounter(convertReference(src.getEncounter())); + for (org.hl7.fhir.r5.model.Composition.SectionComponent t : src.getSection()) + tgt.addSection(convertSectionComponent(t)); + return tgt; + } + + public org.hl7.fhir.r5.model.Composition.CompositionStatus convertCompositionStatus(org.hl7.fhir.dstu2.model.Composition.CompositionStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PRELIMINARY: return org.hl7.fhir.r5.model.Composition.CompositionStatus.PRELIMINARY; + case FINAL: return org.hl7.fhir.r5.model.Composition.CompositionStatus.FINAL; + case AMENDED: return org.hl7.fhir.r5.model.Composition.CompositionStatus.AMENDED; + case ENTEREDINERROR: return org.hl7.fhir.r5.model.Composition.CompositionStatus.ENTEREDINERROR; + default: return org.hl7.fhir.r5.model.Composition.CompositionStatus.NULL; + } + } + + public org.hl7.fhir.dstu2.model.Composition.CompositionStatus convertCompositionStatus(org.hl7.fhir.r5.model.Composition.CompositionStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PRELIMINARY: return org.hl7.fhir.dstu2.model.Composition.CompositionStatus.PRELIMINARY; + case FINAL: return org.hl7.fhir.dstu2.model.Composition.CompositionStatus.FINAL; + case AMENDED: return org.hl7.fhir.dstu2.model.Composition.CompositionStatus.AMENDED; + case ENTEREDINERROR: return org.hl7.fhir.dstu2.model.Composition.CompositionStatus.ENTEREDINERROR; + default: return org.hl7.fhir.dstu2.model.Composition.CompositionStatus.NULL; + } + } + + public org.hl7.fhir.r5.model.Composition.CompositionAttesterComponent convertCompositionAttesterComponent(org.hl7.fhir.dstu2.model.Composition.CompositionAttesterComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Composition.CompositionAttesterComponent tgt = new org.hl7.fhir.r5.model.Composition.CompositionAttesterComponent(); + copyElement(src, tgt); + if (src.hasMode()) + tgt.setMode(convertCompositionAttestationMode(src.getMode().get(0).getValue())); + tgt.setTime(src.getTime()); + tgt.setParty(convertReference(src.getParty())); + return tgt; + } + + public org.hl7.fhir.dstu2.model.Composition.CompositionAttesterComponent convertCompositionAttesterComponent(org.hl7.fhir.r5.model.Composition.CompositionAttesterComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Composition.CompositionAttesterComponent tgt = new org.hl7.fhir.dstu2.model.Composition.CompositionAttesterComponent(); + copyElement(src, tgt); + if (src.hasMode()) + tgt.addMode(convertCompositionAttestationMode(src.getMode())); + tgt.setTime(src.getTime()); + tgt.setParty(convertReference(src.getParty())); + return tgt; + } + + public org.hl7.fhir.r5.model.Composition.CompositionAttestationMode convertCompositionAttestationMode(org.hl7.fhir.dstu2.model.Composition.CompositionAttestationMode src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PERSONAL: return org.hl7.fhir.r5.model.Composition.CompositionAttestationMode.PERSONAL; + case PROFESSIONAL: return org.hl7.fhir.r5.model.Composition.CompositionAttestationMode.PROFESSIONAL; + case LEGAL: return org.hl7.fhir.r5.model.Composition.CompositionAttestationMode.LEGAL; + case OFFICIAL: return org.hl7.fhir.r5.model.Composition.CompositionAttestationMode.OFFICIAL; + default: return org.hl7.fhir.r5.model.Composition.CompositionAttestationMode.NULL; + } + } + + public org.hl7.fhir.dstu2.model.Composition.CompositionAttestationMode convertCompositionAttestationMode(org.hl7.fhir.r5.model.Composition.CompositionAttestationMode src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PERSONAL: return org.hl7.fhir.dstu2.model.Composition.CompositionAttestationMode.PERSONAL; + case PROFESSIONAL: return org.hl7.fhir.dstu2.model.Composition.CompositionAttestationMode.PROFESSIONAL; + case LEGAL: return org.hl7.fhir.dstu2.model.Composition.CompositionAttestationMode.LEGAL; + case OFFICIAL: return org.hl7.fhir.dstu2.model.Composition.CompositionAttestationMode.OFFICIAL; + default: return org.hl7.fhir.dstu2.model.Composition.CompositionAttestationMode.NULL; + } + } + + public org.hl7.fhir.r5.model.Composition.CompositionEventComponent convertCompositionEventComponent(org.hl7.fhir.dstu2.model.Composition.CompositionEventComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Composition.CompositionEventComponent tgt = new org.hl7.fhir.r5.model.Composition.CompositionEventComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getCode()) + tgt.addCode(convertCodeableConcept(t)); + tgt.setPeriod(convertPeriod(src.getPeriod())); + for (org.hl7.fhir.dstu2.model.Reference t : src.getDetail()) + tgt.addDetail(convertReference(t)); + return tgt; + } + + public org.hl7.fhir.dstu2.model.Composition.CompositionEventComponent convertCompositionEventComponent(org.hl7.fhir.r5.model.Composition.CompositionEventComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Composition.CompositionEventComponent tgt = new org.hl7.fhir.dstu2.model.Composition.CompositionEventComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getCode()) + tgt.addCode(convertCodeableConcept(t)); + tgt.setPeriod(convertPeriod(src.getPeriod())); + for (org.hl7.fhir.r5.model.Reference t : src.getDetail()) + tgt.addDetail(convertReference(t)); + return tgt; + } + + public org.hl7.fhir.r5.model.Composition.SectionComponent convertSectionComponent(org.hl7.fhir.dstu2.model.Composition.SectionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Composition.SectionComponent tgt = new org.hl7.fhir.r5.model.Composition.SectionComponent(); + copyElement(src, tgt); + tgt.setTitle(src.getTitle()); + tgt.setCode(convertCodeableConcept(src.getCode())); + tgt.setText(convertNarrative(src.getText())); + try { + tgt.setMode(org.hl7.fhir.r5.model.Composition.SectionMode.fromCode(src.getMode())); + } catch (org.hl7.fhir.exceptions.FHIRException e) { + throw new FHIRException(e); + } + tgt.setOrderedBy(convertCodeableConcept(src.getOrderedBy())); + for (org.hl7.fhir.dstu2.model.Reference t : src.getEntry()) + tgt.addEntry(convertReference(t)); + tgt.setEmptyReason(convertCodeableConcept(src.getEmptyReason())); + for (org.hl7.fhir.dstu2.model.Composition.SectionComponent t : src.getSection()) + tgt.addSection(convertSectionComponent(t)); + return tgt; + } + + public org.hl7.fhir.dstu2.model.Composition.SectionComponent convertSectionComponent(org.hl7.fhir.r5.model.Composition.SectionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Composition.SectionComponent tgt = new org.hl7.fhir.dstu2.model.Composition.SectionComponent(); + copyElement(src, tgt); + tgt.setTitle(src.getTitle()); + tgt.setCode(convertCodeableConcept(src.getCode())); + tgt.setText(convertNarrative(src.getText())); + tgt.setMode(src.getMode().toCode()); + tgt.setOrderedBy(convertCodeableConcept(src.getOrderedBy())); + for (org.hl7.fhir.r5.model.Reference t : src.getEntry()) + tgt.addEntry(convertReference(t)); + tgt.setEmptyReason(convertCodeableConcept(src.getEmptyReason())); + for (org.hl7.fhir.r5.model.Composition.SectionComponent t : src.getSection()) + tgt.addSection(convertSectionComponent(t)); + return tgt; + } + + private class SourceElementComponentWrapper { + public SourceElementComponentWrapper(SourceElementComponent comp, String source, String target) { + super(); + this.source = source; + this.target = target; + this.comp = comp; + } + private String source; + private String target; + private org.hl7.fhir.r5.model.ConceptMap.SourceElementComponent comp; + + } + + public org.hl7.fhir.r5.model.ConceptMap convertConceptMap(org.hl7.fhir.dstu2.model.ConceptMap src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.ConceptMap tgt = new org.hl7.fhir.r5.model.ConceptMap(); + copyDomainResource(src, tgt); + tgt.setUrl(src.getUrl()); + tgt.setIdentifier(convertIdentifier(src.getIdentifier())); + tgt.setVersion(src.getVersion()); + tgt.setName(src.getName()); + tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.dstu2.model.ConceptMap.ConceptMapContactComponent t : src.getContact()) + tgt.addContact(convertConceptMapContactComponent(t)); + if (src.hasDate()) + tgt.setDate(src.getDate()); + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getUseContext()) + if (isJurisdiction(t)) + tgt.addJurisdiction(convertCodeableConcept(t)); + else + tgt.addUseContext(convertCodeableConceptToUsageContext(t)); + tgt.setPurpose(src.getRequirements()); + tgt.setCopyright(src.getCopyright()); + org.hl7.fhir.r5.model.Type r = convertType(src.getSource()); + tgt.setSource(r instanceof org.hl7.fhir.r5.model.Reference ? new CanonicalType(((org.hl7.fhir.r5.model.Reference) r).getReference()) : r); + r = convertType(src.getTarget()); + tgt.setTarget(r instanceof org.hl7.fhir.r5.model.Reference ? new CanonicalType(((org.hl7.fhir.r5.model.Reference) r).getReference()) : r); + for (org.hl7.fhir.dstu2.model.ConceptMap.SourceElementComponent t : src.getElement()) { + List ws = convertSourceElementComponent(t); + for (SourceElementComponentWrapper w : ws) + getGroup(tgt, w.source, w.target).addElement(w.comp); + } + return tgt; + } + + public org.hl7.fhir.r5.model.UsageContext convertCodeableConceptToUsageContext(org.hl7.fhir.dstu2.model.CodeableConcept t) throws FHIRException { + org.hl7.fhir.r5.model.UsageContext result = new org.hl7.fhir.r5.model.UsageContext(); + // todo: set type.. + result.setValue(convertCodeableConcept(t)); + return result; + } + + + private ConceptMapGroupComponent getGroup(ConceptMap map, String srcs, String tgts) { + for (ConceptMapGroupComponent grp : map.getGroup()) { + if (grp.getSource().equals(srcs) && grp.getTarget().equals(tgts)) + return grp; + } + ConceptMapGroupComponent grp = map.addGroup(); + grp.setSource(srcs); + grp.setTarget(tgts); + return grp; + } + + + public org.hl7.fhir.dstu2.model.ConceptMap convertConceptMap(org.hl7.fhir.r5.model.ConceptMap src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.ConceptMap tgt = new org.hl7.fhir.dstu2.model.ConceptMap(); + copyDomainResource(src, tgt); + tgt.setUrl(src.getUrl()); + tgt.setIdentifier(convertIdentifier(src.getIdentifier())); + tgt.setVersion(src.getVersion()); + tgt.setName(src.getName()); + tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.r5.model.ContactDetail t : src.getContact()) + tgt.addContact(convertConceptMapContactComponent(t)); + if (src.hasDate()) + tgt.setDate(src.getDate()); + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.r5.model.UsageContext t : src.getUseContext()) + if (t.hasValueCodeableConcept()) + tgt.addUseContext(convertCodeableConcept(t.getValueCodeableConcept())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getJurisdiction()) + tgt.addUseContext(convertCodeableConcept(t)); + tgt.setRequirements(src.getPurpose()); + tgt.setCopyright(src.getCopyright()); + tgt.setSource(convertType(src.getSource())); + tgt.setTarget(convertType(src.getTarget())); + for (org.hl7.fhir.r5.model.ConceptMap.ConceptMapGroupComponent g : src.getGroup()) + for (org.hl7.fhir.r5.model.ConceptMap.SourceElementComponent t : g.getElement()) + tgt.addElement(convertSourceElementComponent(t, g)); + return tgt; + } + + public org.hl7.fhir.r5.model.Enumerations.PublicationStatus convertConformanceResourceStatus(org.hl7.fhir.dstu2.model.Enumerations.ConformanceResourceStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case DRAFT: return org.hl7.fhir.r5.model.Enumerations.PublicationStatus.DRAFT; + case ACTIVE: return org.hl7.fhir.r5.model.Enumerations.PublicationStatus.ACTIVE; + case RETIRED: return org.hl7.fhir.r5.model.Enumerations.PublicationStatus.RETIRED; + default: return org.hl7.fhir.r5.model.Enumerations.PublicationStatus.NULL; + } + } + + public org.hl7.fhir.dstu2.model.Enumerations.ConformanceResourceStatus convertConformanceResourceStatus(org.hl7.fhir.r5.model.Enumerations.PublicationStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case DRAFT: return org.hl7.fhir.dstu2.model.Enumerations.ConformanceResourceStatus.DRAFT; + case ACTIVE: return org.hl7.fhir.dstu2.model.Enumerations.ConformanceResourceStatus.ACTIVE; + case RETIRED: return org.hl7.fhir.dstu2.model.Enumerations.ConformanceResourceStatus.RETIRED; + default: return org.hl7.fhir.dstu2.model.Enumerations.ConformanceResourceStatus.NULL; + } + } + + public org.hl7.fhir.r5.model.ContactDetail convertConceptMapContactComponent(org.hl7.fhir.dstu2.model.ConceptMap.ConceptMapContactComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.ContactDetail tgt = new org.hl7.fhir.r5.model.ContactDetail(); + copyElement(src, tgt); + tgt.setName(src.getName()); + for (org.hl7.fhir.dstu2.model.ContactPoint t : src.getTelecom()) + tgt.addTelecom(convertContactPoint(t)); + return tgt; + } + + public org.hl7.fhir.dstu2.model.ConceptMap.ConceptMapContactComponent convertConceptMapContactComponent(org.hl7.fhir.r5.model.ContactDetail src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.ConceptMap.ConceptMapContactComponent tgt = new org.hl7.fhir.dstu2.model.ConceptMap.ConceptMapContactComponent(); + copyElement(src, tgt); + tgt.setName(src.getName()); + for (org.hl7.fhir.r5.model.ContactPoint t : src.getTelecom()) + tgt.addTelecom(convertContactPoint(t)); + return tgt; + } + + public List convertSourceElementComponent(org.hl7.fhir.dstu2.model.ConceptMap.SourceElementComponent src) throws FHIRException { + List res = new ArrayList(); + if (src == null || src.isEmpty()) + return res; + for (org.hl7.fhir.dstu2.model.ConceptMap.TargetElementComponent t : src.getTarget()) { + org.hl7.fhir.r5.model.ConceptMap.SourceElementComponent tgt = new org.hl7.fhir.r5.model.ConceptMap.SourceElementComponent(); + copyElement(src, tgt); + tgt.setCode(src.getCode()); + tgt.addTarget(convertTargetElementComponent(t)); + res.add(new SourceElementComponentWrapper(tgt, src.getCodeSystem(), t.getCodeSystem())); + } + return res; + } + + public org.hl7.fhir.dstu2.model.ConceptMap.SourceElementComponent convertSourceElementComponent(org.hl7.fhir.r5.model.ConceptMap.SourceElementComponent src, org.hl7.fhir.r5.model.ConceptMap.ConceptMapGroupComponent g) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.ConceptMap.SourceElementComponent tgt = new org.hl7.fhir.dstu2.model.ConceptMap.SourceElementComponent(); + copyElement(src, tgt); + tgt.setCodeSystem(g.getSource()); + tgt.setCode(src.getCode()); + for (org.hl7.fhir.r5.model.ConceptMap.TargetElementComponent t : src.getTarget()) + tgt.addTarget(convertTargetElementComponent(t, g)); + return tgt; + } + + public org.hl7.fhir.r5.model.ConceptMap.TargetElementComponent convertTargetElementComponent(org.hl7.fhir.dstu2.model.ConceptMap.TargetElementComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.ConceptMap.TargetElementComponent tgt = new org.hl7.fhir.r5.model.ConceptMap.TargetElementComponent(); + copyElement(src, tgt); + tgt.setCode(src.getCode()); + tgt.setEquivalence(convertConceptMapEquivalence(src.getEquivalence())); + tgt.setComment(src.getComments()); + for (org.hl7.fhir.dstu2.model.ConceptMap.OtherElementComponent t : src.getDependsOn()) + tgt.addDependsOn(convertOtherElementComponent(t)); + for (org.hl7.fhir.dstu2.model.ConceptMap.OtherElementComponent t : src.getProduct()) + tgt.addProduct(convertOtherElementComponent(t)); + return tgt; + } + + public org.hl7.fhir.dstu2.model.ConceptMap.TargetElementComponent convertTargetElementComponent(org.hl7.fhir.r5.model.ConceptMap.TargetElementComponent src, org.hl7.fhir.r5.model.ConceptMap.ConceptMapGroupComponent g) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.ConceptMap.TargetElementComponent tgt = new org.hl7.fhir.dstu2.model.ConceptMap.TargetElementComponent(); + copyElement(src, tgt); + tgt.setCodeSystem(g.getTarget()); + tgt.setCode(src.getCode()); + tgt.setEquivalence(convertConceptMapEquivalence(src.getEquivalence())); + tgt.setComments(src.getComment()); + for (org.hl7.fhir.r5.model.ConceptMap.OtherElementComponent t : src.getDependsOn()) + tgt.addDependsOn(convertOtherElementComponent(t)); + for (org.hl7.fhir.r5.model.ConceptMap.OtherElementComponent t : src.getProduct()) + tgt.addProduct(convertOtherElementComponent(t)); + return tgt; + } + + public org.hl7.fhir.r5.model.Enumerations.ConceptMapEquivalence convertConceptMapEquivalence(org.hl7.fhir.dstu2.model.Enumerations.ConceptMapEquivalence src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case EQUIVALENT: return org.hl7.fhir.r5.model.Enumerations.ConceptMapEquivalence.EQUIVALENT; + case EQUAL: return org.hl7.fhir.r5.model.Enumerations.ConceptMapEquivalence.EQUAL; + case WIDER: return org.hl7.fhir.r5.model.Enumerations.ConceptMapEquivalence.WIDER; + case SUBSUMES: return org.hl7.fhir.r5.model.Enumerations.ConceptMapEquivalence.SUBSUMES; + case NARROWER: return org.hl7.fhir.r5.model.Enumerations.ConceptMapEquivalence.NARROWER; + case SPECIALIZES: return org.hl7.fhir.r5.model.Enumerations.ConceptMapEquivalence.SPECIALIZES; + case INEXACT: return org.hl7.fhir.r5.model.Enumerations.ConceptMapEquivalence.INEXACT; + case UNMATCHED: return org.hl7.fhir.r5.model.Enumerations.ConceptMapEquivalence.UNMATCHED; + case DISJOINT: return org.hl7.fhir.r5.model.Enumerations.ConceptMapEquivalence.DISJOINT; + default: return org.hl7.fhir.r5.model.Enumerations.ConceptMapEquivalence.NULL; + } + } + + public org.hl7.fhir.dstu2.model.Enumerations.ConceptMapEquivalence convertConceptMapEquivalence(org.hl7.fhir.r5.model.Enumerations.ConceptMapEquivalence src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case EQUIVALENT: return org.hl7.fhir.dstu2.model.Enumerations.ConceptMapEquivalence.EQUIVALENT; + case EQUAL: return org.hl7.fhir.dstu2.model.Enumerations.ConceptMapEquivalence.EQUAL; + case WIDER: return org.hl7.fhir.dstu2.model.Enumerations.ConceptMapEquivalence.WIDER; + case SUBSUMES: return org.hl7.fhir.dstu2.model.Enumerations.ConceptMapEquivalence.SUBSUMES; + case NARROWER: return org.hl7.fhir.dstu2.model.Enumerations.ConceptMapEquivalence.NARROWER; + case SPECIALIZES: return org.hl7.fhir.dstu2.model.Enumerations.ConceptMapEquivalence.SPECIALIZES; + case INEXACT: return org.hl7.fhir.dstu2.model.Enumerations.ConceptMapEquivalence.INEXACT; + case UNMATCHED: return org.hl7.fhir.dstu2.model.Enumerations.ConceptMapEquivalence.UNMATCHED; + case DISJOINT: return org.hl7.fhir.dstu2.model.Enumerations.ConceptMapEquivalence.DISJOINT; + default: return org.hl7.fhir.dstu2.model.Enumerations.ConceptMapEquivalence.NULL; + } + } + + public org.hl7.fhir.r5.model.ConceptMap.OtherElementComponent convertOtherElementComponent(org.hl7.fhir.dstu2.model.ConceptMap.OtherElementComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.ConceptMap.OtherElementComponent tgt = new org.hl7.fhir.r5.model.ConceptMap.OtherElementComponent(); + copyElement(src, tgt); + tgt.setProperty(src.getElement()); + tgt.setSystem(src.getCodeSystem()); + tgt.setValue(src.getCode()); + return tgt; + } + + public org.hl7.fhir.dstu2.model.ConceptMap.OtherElementComponent convertOtherElementComponent(org.hl7.fhir.r5.model.ConceptMap.OtherElementComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.ConceptMap.OtherElementComponent tgt = new org.hl7.fhir.dstu2.model.ConceptMap.OtherElementComponent(); + copyElement(src, tgt); + tgt.setElement(src.getProperty()); + tgt.setCodeSystem(src.getSystem()); + tgt.setCode(src.getValue()); + return tgt; + } + + public org.hl7.fhir.r5.model.Condition convertCondition(org.hl7.fhir.dstu2.model.Condition src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Condition tgt = new org.hl7.fhir.r5.model.Condition(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + tgt.setSubject(convertReference(src.getPatient())); + tgt.setEncounter(convertReference(src.getEncounter())); + tgt.setAsserter(convertReference(src.getAsserter())); + if (src.hasDateRecorded()) + tgt.setRecordedDate(src.getDateRecorded()); + tgt.setCode(convertCodeableConcept(src.getCode())); + tgt.addCategory(convertCodeableConcept(src.getCategory())); + if (src.hasClinicalStatus()) + tgt.setClinicalStatus(convertConditionClinicalStatus(src.getClinicalStatus())); + tgt.setVerificationStatus(convertConditionVerificationStatus(src.getVerificationStatus())); + tgt.setSeverity(convertCodeableConcept(src.getSeverity())); + tgt.setOnset(convertType(src.getOnset())); + tgt.setAbatement(convertType(src.getAbatement())); + tgt.addStage(convertConditionStageComponent(src.getStage())); + for (org.hl7.fhir.dstu2.model.Condition.ConditionEvidenceComponent t : src.getEvidence()) + tgt.addEvidence(convertConditionEvidenceComponent(t)); + for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getBodySite()) + tgt.addBodySite(convertCodeableConcept(t)); +// tgt.setNotes(src.getNotes()); + return tgt; + } + + public org.hl7.fhir.dstu2.model.Condition convertCondition(org.hl7.fhir.r5.model.Condition src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Condition tgt = new org.hl7.fhir.dstu2.model.Condition(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + tgt.setPatient(convertReference(src.getSubject())); + tgt.setEncounter(convertReference(src.getEncounter())); + tgt.setAsserter(convertReference(src.getAsserter())); + if (src.hasRecordedDate()) + tgt.setDateRecorded(src.getRecordedDate()); + tgt.setCode(convertCodeableConcept(src.getCode())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getCategory()) + tgt.setCategory(convertCodeableConcept(t)); + if (src.hasClinicalStatus()) + tgt.setClinicalStatus(convertConditionClinicalStatus(src.getClinicalStatus())); + tgt.setVerificationStatus(convertConditionVerificationStatus(src.getVerificationStatus())); + tgt.setSeverity(convertCodeableConcept(src.getSeverity())); + tgt.setOnset(convertType(src.getOnset())); + tgt.setAbatement(convertType(src.getAbatement())); + tgt.setStage(convertConditionStageComponent(src.getStageFirstRep())); + for (org.hl7.fhir.r5.model.Condition.ConditionEvidenceComponent t : src.getEvidence()) + tgt.addEvidence(convertConditionEvidenceComponent(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getBodySite()) + tgt.addBodySite(convertCodeableConcept(t)); +// tgt.setNotes(src.getNotes()); + return tgt; + } + + private static org.hl7.fhir.r5.model.CodeableConcept convertConditionClinicalStatus(String src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.CodeableConcept cc = new org.hl7.fhir.r5.model.CodeableConcept(); + cc.addCoding().setSystem("http://hl7.org/fhir/condition-clinical").setCode(src); + return cc; + } + + private static String convertConditionClinicalStatus(org.hl7.fhir.r5.model.CodeableConcept src) throws FHIRException { + if (src == null) + return null; + for (org.hl7.fhir.r5.model.Coding c : src.getCoding()) { + if ("http://hl7.org/fhir/condition-clinical".equals(c.getSystem())) + return c.getCode(); + } + return null; + } + + private static org.hl7.fhir.r5.model.CodeableConcept convertConditionVerificationStatus(org.hl7.fhir.dstu2.model.Condition.ConditionVerificationStatus src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.CodeableConcept cc = new org.hl7.fhir.r5.model.CodeableConcept(); + switch (src) { + case PROVISIONAL: + cc.addCoding().setSystem("http://hl7.org/fhir/condition-ver-status").setCode("provisional"); + return cc; + case DIFFERENTIAL: + cc.addCoding().setSystem("http://hl7.org/fhir/condition-ver-status").setCode("differential"); + return cc; + case CONFIRMED: + cc.addCoding().setSystem("http://hl7.org/fhir/condition-ver-status").setCode("confirmed"); + return cc; + case REFUTED: + cc.addCoding().setSystem("http://hl7.org/fhir/condition-ver-status").setCode("refuted"); + return cc; + case ENTEREDINERROR: + cc.addCoding().setSystem("http://hl7.org/fhir/condition-ver-status").setCode("entered-in-error"); + return cc; + default: return null; + } + } + + + private static org.hl7.fhir.dstu2.model.Condition.ConditionVerificationStatus convertConditionVerificationStatus(org.hl7.fhir.r5.model.CodeableConcept src) throws FHIRException { + if (src == null) + return null; + if (src.hasCoding("http://hl7.org/fhir/condition-clinical", "provisional")) return org.hl7.fhir.dstu2.model.Condition.ConditionVerificationStatus.PROVISIONAL; + if (src.hasCoding("http://hl7.org/fhir/condition-clinical", "differential")) return org.hl7.fhir.dstu2.model.Condition.ConditionVerificationStatus.DIFFERENTIAL; + if (src.hasCoding("http://hl7.org/fhir/condition-clinical", "confirmed")) return org.hl7.fhir.dstu2.model.Condition.ConditionVerificationStatus.CONFIRMED; + if (src.hasCoding("http://hl7.org/fhir/condition-clinical", "refuted")) return org.hl7.fhir.dstu2.model.Condition.ConditionVerificationStatus.REFUTED; + if (src.hasCoding("http://hl7.org/fhir/condition-clinical", "entered-in-error")) return org.hl7.fhir.dstu2.model.Condition.ConditionVerificationStatus.ENTEREDINERROR; + return org.hl7.fhir.dstu2.model.Condition.ConditionVerificationStatus.NULL; + } + + + + public org.hl7.fhir.r5.model.Condition.ConditionStageComponent convertConditionStageComponent(org.hl7.fhir.dstu2.model.Condition.ConditionStageComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Condition.ConditionStageComponent tgt = new org.hl7.fhir.r5.model.Condition.ConditionStageComponent(); + copyElement(src, tgt); + tgt.setSummary(convertCodeableConcept(src.getSummary())); + for (org.hl7.fhir.dstu2.model.Reference t : src.getAssessment()) + tgt.addAssessment(convertReference(t)); + return tgt; + } + + public org.hl7.fhir.dstu2.model.Condition.ConditionStageComponent convertConditionStageComponent(org.hl7.fhir.r5.model.Condition.ConditionStageComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Condition.ConditionStageComponent tgt = new org.hl7.fhir.dstu2.model.Condition.ConditionStageComponent(); + copyElement(src, tgt); + tgt.setSummary(convertCodeableConcept(src.getSummary())); + for (org.hl7.fhir.r5.model.Reference t : src.getAssessment()) + tgt.addAssessment(convertReference(t)); + return tgt; + } + + public org.hl7.fhir.r5.model.Condition.ConditionEvidenceComponent convertConditionEvidenceComponent(org.hl7.fhir.dstu2.model.Condition.ConditionEvidenceComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Condition.ConditionEvidenceComponent tgt = new org.hl7.fhir.r5.model.Condition.ConditionEvidenceComponent(); + copyElement(src, tgt); + tgt.addCode(convertCodeableConcept(src.getCode())); + for (org.hl7.fhir.dstu2.model.Reference t : src.getDetail()) + tgt.addDetail(convertReference(t)); + return tgt; + } + + public org.hl7.fhir.dstu2.model.Condition.ConditionEvidenceComponent convertConditionEvidenceComponent(org.hl7.fhir.r5.model.Condition.ConditionEvidenceComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Condition.ConditionEvidenceComponent tgt = new org.hl7.fhir.dstu2.model.Condition.ConditionEvidenceComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.r5.model.CodeableConcept cc : src.getCode()) + tgt.setCode(convertCodeableConcept(cc)); + for (org.hl7.fhir.r5.model.Reference t : src.getDetail()) + tgt.addDetail(convertReference(t)); + return tgt; + } + + private CanonicalType convertReferenceToCanonical(Reference src) throws FHIRException { + CanonicalType dst = new CanonicalType(src.getReference()); + copyElement(src, dst); + return dst; + } + + private Reference convertCanonicalToReference(CanonicalType src) throws FHIRException { + Reference dst = new Reference(src.getValue()); + copyElement(src, dst); + return dst; + } + + public org.hl7.fhir.r5.model.CapabilityStatement convertConformance(org.hl7.fhir.dstu2.model.Conformance src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.CapabilityStatement tgt = new org.hl7.fhir.r5.model.CapabilityStatement(); + copyDomainResource(src, tgt); + tgt.setUrl(src.getUrl()); + tgt.setVersion(src.getVersion()); + tgt.setName(src.getName()); + tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasDate()) + tgt.setDate(src.getDate()); + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.dstu2.model.Conformance.ConformanceContactComponent t : src.getContact()) + tgt.addContact(convertConformanceContactComponent(t)); + tgt.setDescription(src.getDescription()); + tgt.setPurpose(src.getRequirements()); + tgt.setCopyright(src.getCopyright()); + tgt.setKind(convertConformanceStatementKind(src.getKind())); + tgt.setSoftware(convertConformanceSoftwareComponent(src.getSoftware())); + tgt.setImplementation(convertConformanceImplementationComponent(src.getImplementation())); + tgt.setFhirVersion(org.hl7.fhir.r5.model.Enumerations.FHIRVersion.fromCode(src.getFhirVersion())); +// tgt.setAcceptUnknown(convertUnknownContentCode(src.getAcceptUnknown())); + for (org.hl7.fhir.dstu2.model.CodeType t : src.getFormat()) + tgt.addFormat(t.getValue()); +// for (org.hl7.fhir.dstu2.model.Reference t : src.getProfile()) +// tgt.addProfile(convertReference(t)); + for (org.hl7.fhir.dstu2.model.Conformance.ConformanceRestComponent t : src.getRest()) + tgt.addRest(convertConformanceRestComponent(t)); + for (org.hl7.fhir.dstu2.model.Conformance.ConformanceMessagingComponent t : src.getMessaging()) + tgt.addMessaging(convertConformanceMessagingComponent(t)); + for (org.hl7.fhir.dstu2.model.Conformance.ConformanceDocumentComponent t : src.getDocument()) + tgt.addDocument(convertConformanceDocumentComponent(t)); + return tgt; + } + + public org.hl7.fhir.dstu2.model.Conformance convertConformance(org.hl7.fhir.r5.model.CapabilityStatement src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Conformance tgt = new org.hl7.fhir.dstu2.model.Conformance(); + copyDomainResource(src, tgt); + tgt.setUrl(src.getUrl()); + tgt.setVersion(src.getVersion()); + tgt.setName(src.getName()); + tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasDate()) + tgt.setDate(src.getDate()); + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.r5.model.ContactDetail t : src.getContact()) + tgt.addContact(convertConformanceContactComponent(t)); + tgt.setDescription(src.getDescription()); + tgt.setRequirements(src.getPurpose()); + tgt.setCopyright(src.getCopyright()); + tgt.setKind(convertConformanceStatementKind(src.getKind())); + tgt.setSoftware(convertConformanceSoftwareComponent(src.getSoftware())); + if (src.hasImplementation()) + tgt.setImplementation(convertConformanceImplementationComponent(src.getImplementation())); + if (src.hasFhirVersion()) + tgt.setFhirVersion(src.getFhirVersion().toCode()); +// tgt.setAcceptUnknown(convertUnknownContentCode(src.getAcceptUnknown())); + for (org.hl7.fhir.r5.model.CodeType t : src.getFormat()) + tgt.addFormat(t.getValue()); + for (CapabilityStatementRestComponent r : src.getRest()) + for (CapabilityStatementRestResourceComponent rr : r.getResource()) + for (org.hl7.fhir.r5.model.CanonicalType t : rr.getSupportedProfile()) + tgt.addProfile(convertCanonicalToReference(t)); + for (org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestComponent t : src.getRest()) + tgt.addRest(convertConformanceRestComponent(t)); + for (org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementMessagingComponent t : src.getMessaging()) + tgt.addMessaging(convertConformanceMessagingComponent(t)); + for (org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementDocumentComponent t : src.getDocument()) + tgt.addDocument(convertConformanceDocumentComponent(t)); + return tgt; + } + + public org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementKind convertConformanceStatementKind(org.hl7.fhir.dstu2.model.Conformance.ConformanceStatementKind src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case INSTANCE: return org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementKind.INSTANCE; + case CAPABILITY: return org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementKind.CAPABILITY; + case REQUIREMENTS: return org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementKind.REQUIREMENTS; + default: return org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementKind.NULL; + } + } + + public org.hl7.fhir.dstu2.model.Conformance.ConformanceStatementKind convertConformanceStatementKind(org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementKind src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case INSTANCE: return org.hl7.fhir.dstu2.model.Conformance.ConformanceStatementKind.INSTANCE; + case CAPABILITY: return org.hl7.fhir.dstu2.model.Conformance.ConformanceStatementKind.CAPABILITY; + case REQUIREMENTS: return org.hl7.fhir.dstu2.model.Conformance.ConformanceStatementKind.REQUIREMENTS; + default: return org.hl7.fhir.dstu2.model.Conformance.ConformanceStatementKind.NULL; + } + } + +// public org.hl7.fhir.r5.model.CapabilityStatement.UnknownContentCode convertUnknownContentCode(org.hl7.fhir.dstu2.model.Conformance.UnknownContentCode src) throws FHIRException { +// if (src == null) +// return null; +// switch (src) { +// case NO: return org.hl7.fhir.r5.model.CapabilityStatement.UnknownContentCode.NO; +// case EXTENSIONS: return org.hl7.fhir.r5.model.CapabilityStatement.UnknownContentCode.EXTENSIONS; +// case ELEMENTS: return org.hl7.fhir.r5.model.CapabilityStatement.UnknownContentCode.ELEMENTS; +// case BOTH: return org.hl7.fhir.r5.model.CapabilityStatement.UnknownContentCode.BOTH; +// default: return org.hl7.fhir.r5.model.CapabilityStatement.UnknownContentCode.NULL; +// } +// } +// +// public org.hl7.fhir.dstu2.model.Conformance.UnknownContentCode convertUnknownContentCode(org.hl7.fhir.r5.model.CapabilityStatement.UnknownContentCode src) throws FHIRException { +// if (src == null) +// return null; +// switch (src) { +// case NO: return org.hl7.fhir.dstu2.model.Conformance.UnknownContentCode.NO; +// case EXTENSIONS: return org.hl7.fhir.dstu2.model.Conformance.UnknownContentCode.EXTENSIONS; +// case ELEMENTS: return org.hl7.fhir.dstu2.model.Conformance.UnknownContentCode.ELEMENTS; +// case BOTH: return org.hl7.fhir.dstu2.model.Conformance.UnknownContentCode.BOTH; +// default: return org.hl7.fhir.dstu2.model.Conformance.UnknownContentCode.NULL; +// } +// } + + public org.hl7.fhir.r5.model.ContactDetail convertConformanceContactComponent(org.hl7.fhir.dstu2.model.Conformance.ConformanceContactComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.ContactDetail tgt = new org.hl7.fhir.r5.model.ContactDetail(); + copyElement(src, tgt); + tgt.setName(src.getName()); + for (org.hl7.fhir.dstu2.model.ContactPoint t : src.getTelecom()) + tgt.addTelecom(convertContactPoint(t)); + return tgt; + } + + public org.hl7.fhir.dstu2.model.Conformance.ConformanceContactComponent convertConformanceContactComponent(org.hl7.fhir.r5.model.ContactDetail src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Conformance.ConformanceContactComponent tgt = new org.hl7.fhir.dstu2.model.Conformance.ConformanceContactComponent(); + copyElement(src, tgt); + tgt.setName(src.getName()); + for (org.hl7.fhir.r5.model.ContactPoint t : src.getTelecom()) + tgt.addTelecom(convertContactPoint(t)); + return tgt; + } + + public org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementSoftwareComponent convertConformanceSoftwareComponent(org.hl7.fhir.dstu2.model.Conformance.ConformanceSoftwareComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementSoftwareComponent tgt = new org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementSoftwareComponent(); + copyElement(src, tgt); + tgt.setName(src.getName()); + tgt.setVersion(src.getVersion()); + tgt.setReleaseDate(src.getReleaseDate()); + return tgt; + } + + public org.hl7.fhir.dstu2.model.Conformance.ConformanceSoftwareComponent convertConformanceSoftwareComponent(org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementSoftwareComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Conformance.ConformanceSoftwareComponent tgt = new org.hl7.fhir.dstu2.model.Conformance.ConformanceSoftwareComponent(); + copyElement(src, tgt); + tgt.setName(src.getName()); + tgt.setVersion(src.getVersion()); + tgt.setReleaseDate(src.getReleaseDate()); + return tgt; + } + + public org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementImplementationComponent convertConformanceImplementationComponent(org.hl7.fhir.dstu2.model.Conformance.ConformanceImplementationComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementImplementationComponent tgt = new org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementImplementationComponent(); + copyElement(src, tgt); + tgt.setDescription(src.getDescription()); + tgt.setUrl(src.getUrl()); + return tgt; + } + + public org.hl7.fhir.dstu2.model.Conformance.ConformanceImplementationComponent convertConformanceImplementationComponent(org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementImplementationComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Conformance.ConformanceImplementationComponent tgt = new org.hl7.fhir.dstu2.model.Conformance.ConformanceImplementationComponent(); + copyElement(src, tgt); + tgt.setDescription(src.getDescription()); + tgt.setUrl(src.getUrl()); + return tgt; + } + + public org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestComponent convertConformanceRestComponent(org.hl7.fhir.dstu2.model.Conformance.ConformanceRestComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestComponent tgt = new org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestComponent(); + copyElement(src, tgt); + tgt.setMode(convertRestfulConformanceMode(src.getMode())); + tgt.setDocumentation(src.getDocumentation()); + tgt.setSecurity(convertConformanceRestSecurityComponent(src.getSecurity())); + for (org.hl7.fhir.dstu2.model.Conformance.ConformanceRestResourceComponent t : src.getResource()) + tgt.addResource(convertConformanceRestResourceComponent(t)); + for (org.hl7.fhir.dstu2.model.Conformance.SystemInteractionComponent t : src.getInteraction()) + tgt.addInteraction(convertSystemInteractionComponent(t)); + if (src.getTransactionMode() == org.hl7.fhir.dstu2.model.Conformance.TransactionMode.BATCH || src.getTransactionMode() == org.hl7.fhir.dstu2.model.Conformance.TransactionMode.BOTH) + tgt.addInteraction().setCode(SystemRestfulInteraction.BATCH); + for (org.hl7.fhir.dstu2.model.Conformance.ConformanceRestResourceSearchParamComponent t : src.getSearchParam()) + tgt.addSearchParam(convertConformanceRestResourceSearchParamComponent(t)); + for (org.hl7.fhir.dstu2.model.Conformance.ConformanceRestOperationComponent t : src.getOperation()) + tgt.addOperation(convertConformanceRestOperationComponent(t)); + for (org.hl7.fhir.dstu2.model.UriType t : src.getCompartment()) + tgt.addCompartment(t.getValue()); + return tgt; + } + + public org.hl7.fhir.dstu2.model.Conformance.ConformanceRestComponent convertConformanceRestComponent(org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Conformance.ConformanceRestComponent tgt = new org.hl7.fhir.dstu2.model.Conformance.ConformanceRestComponent(); + copyElement(src, tgt); + tgt.setMode(convertRestfulConformanceMode(src.getMode())); + tgt.setDocumentation(src.getDocumentation()); + tgt.setSecurity(convertConformanceRestSecurityComponent(src.getSecurity())); + for (org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceComponent t : src.getResource()) + tgt.addResource(convertConformanceRestResourceComponent(t)); + boolean batch = false; + boolean transaction = false; + for (org.hl7.fhir.r5.model.CapabilityStatement.SystemInteractionComponent t : src.getInteraction()) { + if (t.getCode().equals(SystemRestfulInteraction.BATCH)) + batch = true; + else + tgt.addInteraction(convertSystemInteractionComponent(t)); + if (t.getCode().equals(SystemRestfulInteraction.TRANSACTION)) + transaction = true; + } + if (batch) + tgt.setTransactionMode(transaction ? org.hl7.fhir.dstu2.model.Conformance.TransactionMode.BOTH : org.hl7.fhir.dstu2.model.Conformance.TransactionMode.BATCH); + else + tgt.setTransactionMode(transaction ? org.hl7.fhir.dstu2.model.Conformance.TransactionMode.TRANSACTION : org.hl7.fhir.dstu2.model.Conformance.TransactionMode.NOTSUPPORTED); + for (org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent t : src.getSearchParam()) + tgt.addSearchParam(convertConformanceRestResourceSearchParamComponent(t)); + for (org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceOperationComponent t : src.getOperation()) + tgt.addOperation(convertConformanceRestOperationComponent(t)); + for (org.hl7.fhir.r5.model.UriType t : src.getCompartment()) + tgt.addCompartment(t.getValue()); + return tgt; + } + + public org.hl7.fhir.r5.model.CapabilityStatement.RestfulCapabilityMode convertRestfulConformanceMode(org.hl7.fhir.dstu2.model.Conformance.RestfulConformanceMode src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case CLIENT: return org.hl7.fhir.r5.model.CapabilityStatement.RestfulCapabilityMode.CLIENT; + case SERVER: return org.hl7.fhir.r5.model.CapabilityStatement.RestfulCapabilityMode.SERVER; + default: return org.hl7.fhir.r5.model.CapabilityStatement.RestfulCapabilityMode.NULL; + } + } + + public org.hl7.fhir.dstu2.model.Conformance.RestfulConformanceMode convertRestfulConformanceMode(org.hl7.fhir.r5.model.CapabilityStatement.RestfulCapabilityMode src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case CLIENT: return org.hl7.fhir.dstu2.model.Conformance.RestfulConformanceMode.CLIENT; + case SERVER: return org.hl7.fhir.dstu2.model.Conformance.RestfulConformanceMode.SERVER; + default: return org.hl7.fhir.dstu2.model.Conformance.RestfulConformanceMode.NULL; + } + } + + + public org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestSecurityComponent convertConformanceRestSecurityComponent(org.hl7.fhir.dstu2.model.Conformance.ConformanceRestSecurityComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestSecurityComponent tgt = new org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestSecurityComponent(); + copyElement(src, tgt); + tgt.setCors(src.getCors()); + for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getService()) + tgt.addService(convertCodeableConcept(t)); + tgt.setDescription(src.getDescription()); + return tgt; + } + + public org.hl7.fhir.dstu2.model.Conformance.ConformanceRestSecurityComponent convertConformanceRestSecurityComponent(org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestSecurityComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Conformance.ConformanceRestSecurityComponent tgt = new org.hl7.fhir.dstu2.model.Conformance.ConformanceRestSecurityComponent(); + copyElement(src, tgt); + tgt.setCors(src.getCors()); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getService()) + tgt.addService(convertCodeableConcept(t)); + tgt.setDescription(src.getDescription()); + return tgt; + } + + public org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceComponent convertConformanceRestResourceComponent(org.hl7.fhir.dstu2.model.Conformance.ConformanceRestResourceComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceComponent tgt = new org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceComponent(); + copyElement(src, tgt); + tgt.setType(src.getType()); + tgt.setProfileElement(convertReferenceToCanonical(src.getProfile())); + for (org.hl7.fhir.dstu2.model.Conformance.ResourceInteractionComponent t : src.getInteraction()) + tgt.addInteraction(convertResourceInteractionComponent(t)); + tgt.setVersioning(convertResourceVersionPolicy(src.getVersioning())); + tgt.setReadHistory(src.getReadHistory()); + tgt.setUpdateCreate(src.getUpdateCreate()); + tgt.setConditionalCreate(src.getConditionalCreate()); + tgt.setConditionalUpdate(src.getConditionalUpdate()); + tgt.setConditionalDelete(convertConditionalDeleteStatus(src.getConditionalDelete())); + for (org.hl7.fhir.dstu2.model.StringType t : src.getSearchInclude()) + tgt.addSearchInclude(t.getValue()); + for (org.hl7.fhir.dstu2.model.StringType t : src.getSearchRevInclude()) + tgt.addSearchRevInclude(t.getValue()); + for (org.hl7.fhir.dstu2.model.Conformance.ConformanceRestResourceSearchParamComponent t : src.getSearchParam()) + tgt.addSearchParam(convertConformanceRestResourceSearchParamComponent(t)); + return tgt; + } + + public org.hl7.fhir.dstu2.model.Conformance.ConformanceRestResourceComponent convertConformanceRestResourceComponent(org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Conformance.ConformanceRestResourceComponent tgt = new org.hl7.fhir.dstu2.model.Conformance.ConformanceRestResourceComponent(); + copyElement(src, tgt); + tgt.setType(src.getType()); + if (src.hasProfile()) + tgt.setProfile(convertCanonicalToReference(src.getProfileElement())); + for (org.hl7.fhir.r5.model.CapabilityStatement.ResourceInteractionComponent t : src.getInteraction()) + tgt.addInteraction(convertResourceInteractionComponent(t)); + tgt.setVersioning(convertResourceVersionPolicy(src.getVersioning())); + tgt.setReadHistory(src.getReadHistory()); + tgt.setUpdateCreate(src.getUpdateCreate()); + tgt.setConditionalCreate(src.getConditionalCreate()); + tgt.setConditionalUpdate(src.getConditionalUpdate()); + tgt.setConditionalDelete(convertConditionalDeleteStatus(src.getConditionalDelete())); + for (org.hl7.fhir.r5.model.StringType t : src.getSearchInclude()) + tgt.addSearchInclude(t.getValue()); + for (org.hl7.fhir.r5.model.StringType t : src.getSearchRevInclude()) + tgt.addSearchRevInclude(t.getValue()); + for (org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent t : src.getSearchParam()) + tgt.addSearchParam(convertConformanceRestResourceSearchParamComponent(t)); + return tgt; + } + + public org.hl7.fhir.r5.model.CapabilityStatement.ResourceVersionPolicy convertResourceVersionPolicy(org.hl7.fhir.dstu2.model.Conformance.ResourceVersionPolicy src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case NOVERSION: return org.hl7.fhir.r5.model.CapabilityStatement.ResourceVersionPolicy.NOVERSION; + case VERSIONED: return org.hl7.fhir.r5.model.CapabilityStatement.ResourceVersionPolicy.VERSIONED; + case VERSIONEDUPDATE: return org.hl7.fhir.r5.model.CapabilityStatement.ResourceVersionPolicy.VERSIONEDUPDATE; + default: return org.hl7.fhir.r5.model.CapabilityStatement.ResourceVersionPolicy.NULL; + } + } + + public org.hl7.fhir.dstu2.model.Conformance.ResourceVersionPolicy convertResourceVersionPolicy(org.hl7.fhir.r5.model.CapabilityStatement.ResourceVersionPolicy src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case NOVERSION: return org.hl7.fhir.dstu2.model.Conformance.ResourceVersionPolicy.NOVERSION; + case VERSIONED: return org.hl7.fhir.dstu2.model.Conformance.ResourceVersionPolicy.VERSIONED; + case VERSIONEDUPDATE: return org.hl7.fhir.dstu2.model.Conformance.ResourceVersionPolicy.VERSIONEDUPDATE; + default: return org.hl7.fhir.dstu2.model.Conformance.ResourceVersionPolicy.NULL; + } + } + + public org.hl7.fhir.r5.model.CapabilityStatement.ConditionalDeleteStatus convertConditionalDeleteStatus(org.hl7.fhir.dstu2.model.Conformance.ConditionalDeleteStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case NOTSUPPORTED: return org.hl7.fhir.r5.model.CapabilityStatement.ConditionalDeleteStatus.NOTSUPPORTED; + case SINGLE: return org.hl7.fhir.r5.model.CapabilityStatement.ConditionalDeleteStatus.SINGLE; + case MULTIPLE: return org.hl7.fhir.r5.model.CapabilityStatement.ConditionalDeleteStatus.MULTIPLE; + default: return org.hl7.fhir.r5.model.CapabilityStatement.ConditionalDeleteStatus.NULL; + } + } + + public org.hl7.fhir.dstu2.model.Conformance.ConditionalDeleteStatus convertConditionalDeleteStatus(org.hl7.fhir.r5.model.CapabilityStatement.ConditionalDeleteStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case NOTSUPPORTED: return org.hl7.fhir.dstu2.model.Conformance.ConditionalDeleteStatus.NOTSUPPORTED; + case SINGLE: return org.hl7.fhir.dstu2.model.Conformance.ConditionalDeleteStatus.SINGLE; + case MULTIPLE: return org.hl7.fhir.dstu2.model.Conformance.ConditionalDeleteStatus.MULTIPLE; + default: return org.hl7.fhir.dstu2.model.Conformance.ConditionalDeleteStatus.NULL; + } + } + + public org.hl7.fhir.r5.model.CapabilityStatement.ResourceInteractionComponent convertResourceInteractionComponent(org.hl7.fhir.dstu2.model.Conformance.ResourceInteractionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.CapabilityStatement.ResourceInteractionComponent tgt = new org.hl7.fhir.r5.model.CapabilityStatement.ResourceInteractionComponent(); + copyElement(src, tgt); + tgt.setCode(convertTypeRestfulInteraction(src.getCode())); + tgt.setDocumentation(src.getDocumentation()); + return tgt; + } + + public org.hl7.fhir.dstu2.model.Conformance.ResourceInteractionComponent convertResourceInteractionComponent(org.hl7.fhir.r5.model.CapabilityStatement.ResourceInteractionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Conformance.ResourceInteractionComponent tgt = new org.hl7.fhir.dstu2.model.Conformance.ResourceInteractionComponent(); + copyElement(src, tgt); + tgt.setCode(convertTypeRestfulInteraction(src.getCode())); + tgt.setDocumentation(src.getDocumentation()); + return tgt; + } + + public org.hl7.fhir.r5.model.CapabilityStatement.TypeRestfulInteraction convertTypeRestfulInteraction(org.hl7.fhir.dstu2.model.Conformance.TypeRestfulInteraction src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case READ: return org.hl7.fhir.r5.model.CapabilityStatement.TypeRestfulInteraction.READ; + case VREAD: return org.hl7.fhir.r5.model.CapabilityStatement.TypeRestfulInteraction.VREAD; + case UPDATE: return org.hl7.fhir.r5.model.CapabilityStatement.TypeRestfulInteraction.UPDATE; + case DELETE: return org.hl7.fhir.r5.model.CapabilityStatement.TypeRestfulInteraction.DELETE; + case HISTORYINSTANCE: return org.hl7.fhir.r5.model.CapabilityStatement.TypeRestfulInteraction.HISTORYINSTANCE; + case HISTORYTYPE: return org.hl7.fhir.r5.model.CapabilityStatement.TypeRestfulInteraction.HISTORYTYPE; + case CREATE: return org.hl7.fhir.r5.model.CapabilityStatement.TypeRestfulInteraction.CREATE; + case SEARCHTYPE: return org.hl7.fhir.r5.model.CapabilityStatement.TypeRestfulInteraction.SEARCHTYPE; + default: return org.hl7.fhir.r5.model.CapabilityStatement.TypeRestfulInteraction.NULL; + } + } + + public org.hl7.fhir.dstu2.model.Conformance.TypeRestfulInteraction convertTypeRestfulInteraction(org.hl7.fhir.r5.model.CapabilityStatement.TypeRestfulInteraction src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case READ: return org.hl7.fhir.dstu2.model.Conformance.TypeRestfulInteraction.READ; + case VREAD: return org.hl7.fhir.dstu2.model.Conformance.TypeRestfulInteraction.VREAD; + case UPDATE: return org.hl7.fhir.dstu2.model.Conformance.TypeRestfulInteraction.UPDATE; + case DELETE: return org.hl7.fhir.dstu2.model.Conformance.TypeRestfulInteraction.DELETE; + case HISTORYINSTANCE: return org.hl7.fhir.dstu2.model.Conformance.TypeRestfulInteraction.HISTORYINSTANCE; + case HISTORYTYPE: return org.hl7.fhir.dstu2.model.Conformance.TypeRestfulInteraction.HISTORYTYPE; + case CREATE: return org.hl7.fhir.dstu2.model.Conformance.TypeRestfulInteraction.CREATE; + case SEARCHTYPE: return org.hl7.fhir.dstu2.model.Conformance.TypeRestfulInteraction.SEARCHTYPE; + default: return org.hl7.fhir.dstu2.model.Conformance.TypeRestfulInteraction.NULL; + } + } + + public org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent convertConformanceRestResourceSearchParamComponent(org.hl7.fhir.dstu2.model.Conformance.ConformanceRestResourceSearchParamComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent tgt = new org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent(); + copyElement(src, tgt); + tgt.setName(src.getName()); + tgt.setDefinition(src.getDefinition()); + tgt.setType(convertSearchParamType(src.getType())); + tgt.setDocumentation(src.getDocumentation()); + return tgt; + } + + public org.hl7.fhir.dstu2.model.Conformance.ConformanceRestResourceSearchParamComponent convertConformanceRestResourceSearchParamComponent(org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Conformance.ConformanceRestResourceSearchParamComponent tgt = new org.hl7.fhir.dstu2.model.Conformance.ConformanceRestResourceSearchParamComponent(); + copyElement(src, tgt); + tgt.setName(src.getName()); + tgt.setDefinition(src.getDefinition()); + tgt.setType(convertSearchParamType(src.getType())); + tgt.setDocumentation(src.getDocumentation()); + return tgt; + } + + public org.hl7.fhir.r5.model.CapabilityStatement.SystemInteractionComponent convertSystemInteractionComponent(org.hl7.fhir.dstu2.model.Conformance.SystemInteractionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.CapabilityStatement.SystemInteractionComponent tgt = new org.hl7.fhir.r5.model.CapabilityStatement.SystemInteractionComponent(); + copyElement(src, tgt); + tgt.setCode(convertSystemRestfulInteraction(src.getCode())); + tgt.setDocumentation(src.getDocumentation()); + return tgt; + } + + public org.hl7.fhir.dstu2.model.Conformance.SystemInteractionComponent convertSystemInteractionComponent(org.hl7.fhir.r5.model.CapabilityStatement.SystemInteractionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Conformance.SystemInteractionComponent tgt = new org.hl7.fhir.dstu2.model.Conformance.SystemInteractionComponent(); + copyElement(src, tgt); + tgt.setCode(convertSystemRestfulInteraction(src.getCode())); + tgt.setDocumentation(src.getDocumentation()); + return tgt; + } + + public org.hl7.fhir.r5.model.CapabilityStatement.SystemRestfulInteraction convertSystemRestfulInteraction(org.hl7.fhir.dstu2.model.Conformance.SystemRestfulInteraction src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case TRANSACTION: return org.hl7.fhir.r5.model.CapabilityStatement.SystemRestfulInteraction.TRANSACTION; + case SEARCHSYSTEM: return org.hl7.fhir.r5.model.CapabilityStatement.SystemRestfulInteraction.SEARCHSYSTEM; + case HISTORYSYSTEM: return org.hl7.fhir.r5.model.CapabilityStatement.SystemRestfulInteraction.HISTORYSYSTEM; + default: return org.hl7.fhir.r5.model.CapabilityStatement.SystemRestfulInteraction.NULL; + } + } + + public org.hl7.fhir.dstu2.model.Conformance.SystemRestfulInteraction convertSystemRestfulInteraction(org.hl7.fhir.r5.model.CapabilityStatement.SystemRestfulInteraction src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case TRANSACTION: return org.hl7.fhir.dstu2.model.Conformance.SystemRestfulInteraction.TRANSACTION; + case SEARCHSYSTEM: return org.hl7.fhir.dstu2.model.Conformance.SystemRestfulInteraction.SEARCHSYSTEM; + case HISTORYSYSTEM: return org.hl7.fhir.dstu2.model.Conformance.SystemRestfulInteraction.HISTORYSYSTEM; + default: return org.hl7.fhir.dstu2.model.Conformance.SystemRestfulInteraction.NULL; + } + } + + public org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceOperationComponent convertConformanceRestOperationComponent(org.hl7.fhir.dstu2.model.Conformance.ConformanceRestOperationComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceOperationComponent tgt = new org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceOperationComponent(); + copyElement(src, tgt); + tgt.setName(src.getName()); + tgt.setDefinitionElement(convertReferenceToCanonical(src.getDefinition())); + return tgt; + } + + public org.hl7.fhir.dstu2.model.Conformance.ConformanceRestOperationComponent convertConformanceRestOperationComponent(org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceOperationComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Conformance.ConformanceRestOperationComponent tgt = new org.hl7.fhir.dstu2.model.Conformance.ConformanceRestOperationComponent(); + copyElement(src, tgt); + tgt.setName(src.getName()); + tgt.setDefinition(convertCanonicalToReference(src.getDefinitionElement())); + return tgt; + } + + public org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementMessagingComponent convertConformanceMessagingComponent(org.hl7.fhir.dstu2.model.Conformance.ConformanceMessagingComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementMessagingComponent tgt = new org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementMessagingComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.dstu2.model.Conformance.ConformanceMessagingEndpointComponent t : src.getEndpoint()) + tgt.addEndpoint(convertConformanceMessagingEndpointComponent(t)); + tgt.setReliableCache(src.getReliableCache()); + tgt.setDocumentation(src.getDocumentation()); + return tgt; + } + + public org.hl7.fhir.dstu2.model.Conformance.ConformanceMessagingComponent convertConformanceMessagingComponent(org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementMessagingComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Conformance.ConformanceMessagingComponent tgt = new org.hl7.fhir.dstu2.model.Conformance.ConformanceMessagingComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementMessagingEndpointComponent t : src.getEndpoint()) + tgt.addEndpoint(convertConformanceMessagingEndpointComponent(t)); + tgt.setReliableCache(src.getReliableCache()); + tgt.setDocumentation(src.getDocumentation()); + return tgt; + } + + public org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementMessagingEndpointComponent convertConformanceMessagingEndpointComponent(org.hl7.fhir.dstu2.model.Conformance.ConformanceMessagingEndpointComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementMessagingEndpointComponent tgt = new org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementMessagingEndpointComponent(); + copyElement(src, tgt); + tgt.setProtocol(convertCoding(src.getProtocol())); + tgt.setAddress(src.getAddress()); + return tgt; + } + + public org.hl7.fhir.dstu2.model.Conformance.ConformanceMessagingEndpointComponent convertConformanceMessagingEndpointComponent(org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementMessagingEndpointComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Conformance.ConformanceMessagingEndpointComponent tgt = new org.hl7.fhir.dstu2.model.Conformance.ConformanceMessagingEndpointComponent(); + copyElement(src, tgt); + tgt.setProtocol(convertCoding(src.getProtocol())); + tgt.setAddress(src.getAddress()); + return tgt; + } + + + public org.hl7.fhir.r5.model.CapabilityStatement.EventCapabilityMode convertConformanceEventMode(org.hl7.fhir.dstu2.model.Conformance.ConformanceEventMode src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case SENDER: return org.hl7.fhir.r5.model.CapabilityStatement.EventCapabilityMode.SENDER; + case RECEIVER: return org.hl7.fhir.r5.model.CapabilityStatement.EventCapabilityMode.RECEIVER; + default: return org.hl7.fhir.r5.model.CapabilityStatement.EventCapabilityMode.NULL; + } + } + + public org.hl7.fhir.dstu2.model.Conformance.ConformanceEventMode convertConformanceEventMode(org.hl7.fhir.r5.model.CapabilityStatement.EventCapabilityMode src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case SENDER: return org.hl7.fhir.dstu2.model.Conformance.ConformanceEventMode.SENDER; + case RECEIVER: return org.hl7.fhir.dstu2.model.Conformance.ConformanceEventMode.RECEIVER; + default: return org.hl7.fhir.dstu2.model.Conformance.ConformanceEventMode.NULL; + } + } + + public org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementDocumentComponent convertConformanceDocumentComponent(org.hl7.fhir.dstu2.model.Conformance.ConformanceDocumentComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementDocumentComponent tgt = new org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementDocumentComponent(); + copyElement(src, tgt); + tgt.setMode(convertDocumentMode(src.getMode())); + tgt.setDocumentation(src.getDocumentation()); + tgt.setProfileElement(convertReferenceToCanonical(src.getProfile())); + return tgt; + } + + public org.hl7.fhir.dstu2.model.Conformance.ConformanceDocumentComponent convertConformanceDocumentComponent(org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementDocumentComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Conformance.ConformanceDocumentComponent tgt = new org.hl7.fhir.dstu2.model.Conformance.ConformanceDocumentComponent(); + copyElement(src, tgt); + tgt.setMode(convertDocumentMode(src.getMode())); + tgt.setDocumentation(src.getDocumentation()); + tgt.setProfile(convertCanonicalToReference(src.getProfileElement())); + return tgt; + } + + public org.hl7.fhir.r5.model.CapabilityStatement.DocumentMode convertDocumentMode(org.hl7.fhir.dstu2.model.Conformance.DocumentMode src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PRODUCER: return org.hl7.fhir.r5.model.CapabilityStatement.DocumentMode.PRODUCER; + case CONSUMER: return org.hl7.fhir.r5.model.CapabilityStatement.DocumentMode.CONSUMER; + default: return org.hl7.fhir.r5.model.CapabilityStatement.DocumentMode.NULL; + } + } + + public org.hl7.fhir.dstu2.model.Conformance.DocumentMode convertDocumentMode(org.hl7.fhir.r5.model.CapabilityStatement.DocumentMode src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PRODUCER: return org.hl7.fhir.dstu2.model.Conformance.DocumentMode.PRODUCER; + case CONSUMER: return org.hl7.fhir.dstu2.model.Conformance.DocumentMode.CONSUMER; + default: return org.hl7.fhir.dstu2.model.Conformance.DocumentMode.NULL; + } + } + +// public org.hl7.fhir.r5.model.Contract convertContract(org.hl7.fhir.dstu2.model.Contract src) throws FHIRException { +// if (src == null || src.isEmpty()) +// return null; +// org.hl7.fhir.r5.model.Contract tgt = new org.hl7.fhir.r5.model.Contract(); +// copyDomainResource(src, tgt); +// tgt.addIdentifier(convertIdentifier(src.getIdentifier())); +// tgt.setIssued(src.getIssued()); +// tgt.setApplies(convertPeriod(src.getApplies())); +// for (org.hl7.fhir.dstu2.model.Reference t : src.getSubject()) +// tgt.addSubject(convertReference(t)); +// for (org.hl7.fhir.dstu2.model.Reference t : src.getAuthority()) +// tgt.addAuthority(convertReference(t)); +// for (org.hl7.fhir.dstu2.model.Reference t : src.getDomain()) +// tgt.addDomain(convertReference(t)); +// tgt.setType(convertCodeableConcept(src.getType())); +// for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getSubType()) +// tgt.addSubType(convertCodeableConcept(t)); +// for (org.hl7.fhir.dstu2.model.Contract.SignatoryComponent t : src.getSigner()) +// tgt.addSigner(convertSignatoryComponent(t)); +// for (org.hl7.fhir.dstu2.model.Contract.TermComponent t : src.getTerm()) +// tgt.addTerm(convertTermComponent(t)); +// for (org.hl7.fhir.dstu2.model.Contract.FriendlyLanguageComponent t : src.getFriendly()) +// tgt.addFriendly(convertFriendlyLanguageComponent(t)); +// for (org.hl7.fhir.dstu2.model.Contract.LegalLanguageComponent t : src.getLegal()) +// tgt.addLegal(convertLegalLanguageComponent(t)); +// for (org.hl7.fhir.dstu2.model.Contract.ComputableLanguageComponent t : src.getRule()) +// tgt.setRule(convertComputableLanguageComponent(t)); +// return tgt; +// } +// +// public org.hl7.fhir.dstu2.model.Contract convertContract(org.hl7.fhir.r5.model.Contract src) throws FHIRException { +// if (src == null || src.isEmpty()) +// return null; +// org.hl7.fhir.dstu2.model.Contract tgt = new org.hl7.fhir.dstu2.model.Contract(); +// copyDomainResource(src, tgt); +// tgt.setIdentifier(convertIdentifier(src.getIdentifierFirstRep())); +// tgt.setIssued(src.getIssued()); +// tgt.setApplies(convertPeriod(src.getApplies())); +// for (org.hl7.fhir.r5.model.Reference t : src.getSubject()) +// tgt.addSubject(convertReference(t)); +// for (org.hl7.fhir.r5.model.Reference t : src.getAuthority()) +// tgt.addAuthority(convertReference(t)); +// for (org.hl7.fhir.r5.model.Reference t : src.getDomain()) +// tgt.addDomain(convertReference(t)); +// tgt.setType(convertCodeableConcept(src.getType())); +// for (org.hl7.fhir.r5.model.CodeableConcept t : src.getSubType()) +// tgt.addSubType(convertCodeableConcept(t)); +// for (org.hl7.fhir.r5.model.Contract.SignatoryComponent t : src.getSigner()) +// tgt.addSigner(convertSignatoryComponent(t)); +// for (org.hl7.fhir.r5.model.Contract.TermComponent t : src.getTerm()) +// tgt.addTerm(convertTermComponent(t)); +// for (org.hl7.fhir.r5.model.Contract.FriendlyLanguageComponent t : src.getFriendly()) +// tgt.addFriendly(convertFriendlyLanguageComponent(t)); +// for (org.hl7.fhir.r5.model.Contract.LegalLanguageComponent t : src.getLegal()) +// tgt.addLegal(convertLegalLanguageComponent(t)); +// if (src.hasRule()) +// tgt.addRule(convertComputableLanguageComponent(src.getRule())); +// return tgt; +// } +// +// public org.hl7.fhir.r5.model.Contract.AgentComponent convertAgentComponent(org.hl7.fhir.dstu2.model.Contract.ActorComponent src) throws FHIRException { +// if (src == null || src.isEmpty()) +// return null; +// org.hl7.fhir.r5.model.Contract.AgentComponent tgt = new org.hl7.fhir.r5.model.Contract.AgentComponent(); +// copyElement(src, tgt); +// tgt.setActor(convertReference(src.getEntity())); +// for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getRole()) +// tgt.addRole(convertCodeableConcept(t)); +// return tgt; +// } +// +// public org.hl7.fhir.dstu2.model.Contract.ActorComponent convertAgentComponent(org.hl7.fhir.r5.model.Contract.AgentComponent src) throws FHIRException { +// if (src == null || src.isEmpty()) +// return null; +// org.hl7.fhir.dstu2.model.Contract.ActorComponent tgt = new org.hl7.fhir.dstu2.model.Contract.ActorComponent(); +// copyElement(src, tgt); +// tgt.setEntity(convertReference(src.getActor())); +// for (org.hl7.fhir.r5.model.CodeableConcept t : src.getRole()) +// tgt.addRole(convertCodeableConcept(t)); +// return tgt; +// } +// +// public org.hl7.fhir.r5.model.Contract.SignatoryComponent convertSignatoryComponent(org.hl7.fhir.dstu2.model.Contract.SignatoryComponent src) throws FHIRException { +// if (src == null || src.isEmpty()) +// return null; +// org.hl7.fhir.r5.model.Contract.SignatoryComponent tgt = new org.hl7.fhir.r5.model.Contract.SignatoryComponent(); +// copyElement(src, tgt); +// tgt.setType(convertCoding(src.getType())); +// tgt.setParty(convertReference(src.getParty())); +// if (src.hasSignature()) +// tgt.addSignature(new org.hl7.fhir.r5.model.Signature().setData(src.getSignature().getBytes())); +// return tgt; +// } +// +// public org.hl7.fhir.dstu2.model.Contract.SignatoryComponent convertSignatoryComponent(org.hl7.fhir.r5.model.Contract.SignatoryComponent src) throws FHIRException { +// if (src == null || src.isEmpty()) +// return null; +// org.hl7.fhir.dstu2.model.Contract.SignatoryComponent tgt = new org.hl7.fhir.dstu2.model.Contract.SignatoryComponent(); +// copyElement(src, tgt); +// tgt.setType(convertCoding(src.getType())); +// tgt.setParty(convertReference(src.getParty())); +// for (org.hl7.fhir.r5.model.Signature t : src.getSignature()) +// tgt.setSignature(Base64.encodeBase64String(t.getData())); +// return tgt; +// } +// +// public org.hl7.fhir.r5.model.Contract.ValuedItemComponent convertValuedItemComponent(org.hl7.fhir.dstu2.model.Contract.ValuedItemComponent src) throws FHIRException { +// if (src == null || src.isEmpty()) +// return null; +// org.hl7.fhir.r5.model.Contract.ValuedItemComponent tgt = new org.hl7.fhir.r5.model.Contract.ValuedItemComponent(); +// copyElement(src, tgt); +// tgt.setEntity(convertType(src.getEntity())); +// tgt.setIdentifier(convertIdentifier(src.getIdentifier())); +// tgt.setEffectiveTime(src.getEffectiveTime()); +// tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); +// tgt.setUnitPrice(convertMoney(src.getUnitPrice())); +// tgt.setFactor(src.getFactor()); +// tgt.setPoints(src.getPoints()); +// tgt.setNet(convertMoney(src.getNet())); +// return tgt; +// } +// +// public org.hl7.fhir.dstu2.model.Contract.ValuedItemComponent convertValuedItemComponent(org.hl7.fhir.r5.model.Contract.ValuedItemComponent src) throws FHIRException { +// if (src == null || src.isEmpty()) +// return null; +// org.hl7.fhir.dstu2.model.Contract.ValuedItemComponent tgt = new org.hl7.fhir.dstu2.model.Contract.ValuedItemComponent(); +// copyElement(src, tgt); +// tgt.setEntity(convertType(src.getEntity())); +// tgt.setIdentifier(convertIdentifier(src.getIdentifier())); +// tgt.setEffectiveTime(src.getEffectiveTime()); +// tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); +// tgt.setUnitPrice(convertMoney(src.getUnitPrice())); +// tgt.setFactor(src.getFactor()); +// tgt.setPoints(src.getPoints()); +// tgt.setNet(convertMoney(src.getNet())); +// return tgt; +// } +// +// public org.hl7.fhir.r5.model.Contract.TermComponent convertTermComponent(org.hl7.fhir.dstu2.model.Contract.TermComponent src) throws FHIRException { +// if (src == null || src.isEmpty()) +// return null; +// org.hl7.fhir.r5.model.Contract.TermComponent tgt = new org.hl7.fhir.r5.model.Contract.TermComponent(); +// copyElement(src, tgt); +// tgt.setIdentifier(convertIdentifier(src.getIdentifier())); +// tgt.setIssued(src.getIssued()); +// tgt.setApplies(convertPeriod(src.getApplies())); +// tgt.setType(convertCodeableConcept(src.getType())); +// tgt.setSubType(convertCodeableConcept(src.getSubType())); +// for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getAction()) +// tgt.addAction(convertCodeableConcept(t)); +// for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getActionReason()) +// tgt.addActionReason(convertCodeableConcept(t)); +// for (org.hl7.fhir.dstu2.model.Contract.TermActorComponent t : src.getActor()) +// tgt.addAgent(convertTermAgentComponent(t)); +// for (org.hl7.fhir.dstu2.model.Contract.TermComponent t : src.getGroup()) +// tgt.addGroup(convertTermComponent(t)); +// return tgt; +// } +// +// public org.hl7.fhir.dstu2.model.Contract.TermComponent convertTermComponent(org.hl7.fhir.r5.model.Contract.TermComponent src) throws FHIRException { +// if (src == null || src.isEmpty()) +// return null; +// org.hl7.fhir.dstu2.model.Contract.TermComponent tgt = new org.hl7.fhir.dstu2.model.Contract.TermComponent(); +// copyElement(src, tgt); +// tgt.setIdentifier(convertIdentifier(src.getIdentifier())); +// tgt.setIssued(src.getIssued()); +// tgt.setApplies(convertPeriod(src.getApplies())); +// tgt.setType(convertCodeableConcept(src.getType())); +// tgt.setSubType(convertCodeableConcept(src.getSubType())); +// for (org.hl7.fhir.r5.model.CodeableConcept t : src.getAction()) +// tgt.addAction(convertCodeableConcept(t)); +// for (org.hl7.fhir.r5.model.CodeableConcept t : src.getActionReason()) +// tgt.addActionReason(convertCodeableConcept(t)); +// for (org.hl7.fhir.r5.model.Contract.AgentComponent t : src.getAgent()) +// tgt.addActor(convertTermAgentComponent(t)); +// for (org.hl7.fhir.r5.model.Contract.TermComponent t : src.getGroup()) +// tgt.addGroup(convertTermComponent(t)); +// return tgt; +// } +// +// public org.hl7.fhir.r5.model.Contract.AgentComponent convertTermAgentComponent(org.hl7.fhir.dstu2.model.Contract.TermActorComponent src) throws FHIRException { +// if (src == null || src.isEmpty()) +// return null; +// org.hl7.fhir.r5.model.Contract.AgentComponent tgt = new org.hl7.fhir.r5.model.Contract.AgentComponent(); +// copyElement(src, tgt); +// tgt.setActor(convertReference(src.getEntity())); +// for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getRole()) +// tgt.addRole(convertCodeableConcept(t)); +// return tgt; +// } +// +// public org.hl7.fhir.dstu2.model.Contract.TermActorComponent convertTermAgentComponent(org.hl7.fhir.r5.model.Contract.AgentComponent src) throws FHIRException { +// if (src == null || src.isEmpty()) +// return null; +// org.hl7.fhir.dstu2.model.Contract.TermActorComponent tgt = new org.hl7.fhir.dstu2.model.Contract.TermActorComponent(); +// copyElement(src, tgt); +// tgt.setEntity(convertReference(src.getActor())); +// for (org.hl7.fhir.r5.model.CodeableConcept t : src.getRole()) +// tgt.addRole(convertCodeableConcept(t)); +// return tgt; +// } +// +// public org.hl7.fhir.r5.model.Contract.ValuedItemComponent convertTermValuedItemComponent(org.hl7.fhir.dstu2.model.Contract.TermValuedItemComponent src) throws FHIRException { +// if (src == null || src.isEmpty()) +// return null; +// org.hl7.fhir.r5.model.Contract.ValuedItemComponent tgt = new org.hl7.fhir.r5.model.Contract.ValuedItemComponent(); +// copyElement(src, tgt); +// tgt.setEntity(convertType(src.getEntity())); +// tgt.setIdentifier(convertIdentifier(src.getIdentifier())); +// tgt.setEffectiveTime(src.getEffectiveTime()); +// tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); +// tgt.setUnitPrice(convertMoney(src.getUnitPrice())); +// tgt.setFactor(src.getFactor()); +// tgt.setPoints(src.getPoints()); +// tgt.setNet(convertMoney(src.getNet())); +// return tgt; +// } +// +// public org.hl7.fhir.dstu2.model.Contract.TermValuedItemComponent convertTermValuedItemComponent(org.hl7.fhir.r5.model.Contract.ValuedItemComponent src) throws FHIRException { +// if (src == null || src.isEmpty()) +// return null; +// org.hl7.fhir.dstu2.model.Contract.TermValuedItemComponent tgt = new org.hl7.fhir.dstu2.model.Contract.TermValuedItemComponent(); +// copyElement(src, tgt); +// tgt.setEntity(convertType(src.getEntity())); +// tgt.setIdentifier(convertIdentifier(src.getIdentifier())); +// tgt.setEffectiveTime(src.getEffectiveTime()); +// tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); +// tgt.setUnitPrice(convertMoney(src.getUnitPrice())); +// tgt.setFactor(src.getFactor()); +// tgt.setPoints(src.getPoints()); +// tgt.setNet(convertMoney(src.getNet())); +// return tgt; +// } +// +// public org.hl7.fhir.r5.model.Contract.FriendlyLanguageComponent convertFriendlyLanguageComponent(org.hl7.fhir.dstu2.model.Contract.FriendlyLanguageComponent src) throws FHIRException { +// if (src == null || src.isEmpty()) +// return null; +// org.hl7.fhir.r5.model.Contract.FriendlyLanguageComponent tgt = new org.hl7.fhir.r5.model.Contract.FriendlyLanguageComponent(); +// copyElement(src, tgt); +// tgt.setContent(convertType(src.getContent())); +// return tgt; +// } +// +// public org.hl7.fhir.dstu2.model.Contract.FriendlyLanguageComponent convertFriendlyLanguageComponent(org.hl7.fhir.r5.model.Contract.FriendlyLanguageComponent src) throws FHIRException { +// if (src == null || src.isEmpty()) +// return null; +// org.hl7.fhir.dstu2.model.Contract.FriendlyLanguageComponent tgt = new org.hl7.fhir.dstu2.model.Contract.FriendlyLanguageComponent(); +// copyElement(src, tgt); +// tgt.setContent(convertType(src.getContent())); +// return tgt; +// } +// +// public org.hl7.fhir.r5.model.Contract.LegalLanguageComponent convertLegalLanguageComponent(org.hl7.fhir.dstu2.model.Contract.LegalLanguageComponent src) throws FHIRException { +// if (src == null || src.isEmpty()) +// return null; +// org.hl7.fhir.r5.model.Contract.LegalLanguageComponent tgt = new org.hl7.fhir.r5.model.Contract.LegalLanguageComponent(); +// copyElement(src, tgt); +// tgt.setContent(convertType(src.getContent())); +// return tgt; +// } +// +// public org.hl7.fhir.dstu2.model.Contract.LegalLanguageComponent convertLegalLanguageComponent(org.hl7.fhir.r5.model.Contract.LegalLanguageComponent src) throws FHIRException { +// if (src == null || src.isEmpty()) +// return null; +// org.hl7.fhir.dstu2.model.Contract.LegalLanguageComponent tgt = new org.hl7.fhir.dstu2.model.Contract.LegalLanguageComponent(); +// copyElement(src, tgt); +// tgt.setContent(convertType(src.getContent())); +// return tgt; +// } +// +// public org.hl7.fhir.r5.model.Contract.ComputableLanguageComponent convertComputableLanguageComponent(org.hl7.fhir.dstu2.model.Contract.ComputableLanguageComponent src) throws FHIRException { +// if (src == null || src.isEmpty()) +// return null; +// org.hl7.fhir.r5.model.Contract.ComputableLanguageComponent tgt = new org.hl7.fhir.r5.model.Contract.ComputableLanguageComponent(); +// copyElement(src, tgt); +// tgt.setContent(convertType(src.getContent())); +// return tgt; +// } +// +// public org.hl7.fhir.dstu2.model.Contract.ComputableLanguageComponent convertComputableLanguageComponent(org.hl7.fhir.r5.model.Contract.ComputableLanguageComponent src) throws FHIRException { +// if (src == null || src.isEmpty()) +// return null; +// org.hl7.fhir.dstu2.model.Contract.ComputableLanguageComponent tgt = new org.hl7.fhir.dstu2.model.Contract.ComputableLanguageComponent(); +// copyElement(src, tgt); +// tgt.setContent(convertType(src.getContent())); +// return tgt; +// } + + + public org.hl7.fhir.r5.model.StructureDefinition convertDataElement(org.hl7.fhir.dstu2.model.DataElement src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.StructureDefinition tgt = new org.hl7.fhir.r5.model.StructureDefinition(); + copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl().replace("/DataElement/", "/StructureDefinition/de-")); + for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + tgt.setVersion(src.getVersion()); + tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + tgt.setPublisher(src.getPublisher()); + if (src.hasDate()) + tgt.setDate(src.getDate()); + tgt.setName(src.getName()); + for (org.hl7.fhir.dstu2.model.DataElement.DataElementContactComponent t : src.getContact()) + tgt.addContact(convertDataElementContactComponent(t)); + for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getUseContext()) + if (isJurisdiction(t)) + tgt.addJurisdiction(convertCodeableConcept(t)); + else + tgt.addUseContext(convertCodeableConceptToUsageContext(t)); + tgt.setCopyright(src.getCopyright()); +// tgt.setStringency(convertDataElementStringency(src.getStringency())); + for (org.hl7.fhir.dstu2.model.DataElement.DataElementMappingComponent t : src.getMapping()) + tgt.addMapping(convertDataElementMappingComponent(t)); + List slicePaths = new ArrayList(); + for (org.hl7.fhir.dstu2.model.ElementDefinition t : src.getElement()) { + if (t.hasSlicing()) + slicePaths.add(t.getPath()); + tgt.getSnapshot().addElement(convertElementDefinition(t, slicePaths, src.getElement(), src.getElement().indexOf(t))); + } + tgt.setKind(StructureDefinitionKind.COMPLEXTYPE); + tgt.setAbstract(false); + tgt.setType(tgt.getName()); + tgt.setBaseDefinition("http://hl7.org/fhir/StructureDefinition/Element"); + tgt.setDerivation(TypeDerivationRule.SPECIALIZATION); + return tgt; + } + +// public org.hl7.fhir.dstu2.model.DataElement convertDataElement(org.hl7.fhir.r5.model.DataElement src) throws FHIRException { +// if (src == null || src.isEmpty()) +// return null; +// org.hl7.fhir.dstu2.model.DataElement tgt = new org.hl7.fhir.dstu2.model.DataElement(); +// copyDomainResource(src, tgt); +// tgt.setUrl(src.getUrl()); +// for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) +// tgt.addIdentifier(convertIdentifier(t)); +// tgt.setVersion(src.getVersion()); +// tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); +// if (src.hasExperimental()) +// tgt.setExperimental(src.getExperimental()); +// tgt.setPublisher(src.getPublisher()); +// if (src.hasDate()) +// tgt.setDate(src.getDate()); +// tgt.setName(src.getName()); +// for (org.hl7.fhir.r5.model.ContactDetail t : src.getContact()) +// tgt.addContact(convertDataElementContactComponent(t)); +// for (org.hl7.fhir.r5.model.UsageContext t : src.getUseContext()) +// if (t.hasValueCodeableConcept()) +// tgt.addUseContext(convertCodeableConcept(t.getValueCodeableConcept())); +// for (org.hl7.fhir.r5.model.CodeableConcept t : src.getJurisdiction()) +// tgt.addUseContext(convertCodeableConcept(t)); +// tgt.setCopyright(src.getCopyright()); +// tgt.setStringency(convertDataElementStringency(src.getStringency())); +// for (org.hl7.fhir.r5.model.DataElement.DataElementMappingComponent t : src.getMapping()) +// tgt.addMapping(convertDataElementMappingComponent(t)); +// for (org.hl7.fhir.r5.model.ElementDefinition t : src.getElement()) +// tgt.addElement(convertElementDefinition(t)); +// return tgt; +// } + +// public org.hl7.fhir.r5.model.DataElement.DataElementStringency convertDataElementStringency(org.hl7.fhir.dstu2.model.DataElement.DataElementStringency src) throws FHIRException { +// if (src == null) +// return null; +// switch (src) { +// case COMPARABLE: return org.hl7.fhir.r5.model.DataElement.DataElementStringency.COMPARABLE; +// case FULLYSPECIFIED: return org.hl7.fhir.r5.model.DataElement.DataElementStringency.FULLYSPECIFIED; +// case EQUIVALENT: return org.hl7.fhir.r5.model.DataElement.DataElementStringency.EQUIVALENT; +// case CONVERTABLE: return org.hl7.fhir.r5.model.DataElement.DataElementStringency.CONVERTABLE; +// case SCALEABLE: return org.hl7.fhir.r5.model.DataElement.DataElementStringency.SCALEABLE; +// case FLEXIBLE: return org.hl7.fhir.r5.model.DataElement.DataElementStringency.FLEXIBLE; +// default: return org.hl7.fhir.r5.model.DataElement.DataElementStringency.NULL; +// } +// } +// +// public org.hl7.fhir.dstu2.model.DataElement.DataElementStringency convertDataElementStringency(org.hl7.fhir.r5.model.DataElement.DataElementStringency src) throws FHIRException { +// if (src == null) +// return null; +// switch (src) { +// case COMPARABLE: return org.hl7.fhir.dstu2.model.DataElement.DataElementStringency.COMPARABLE; +// case FULLYSPECIFIED: return org.hl7.fhir.dstu2.model.DataElement.DataElementStringency.FULLYSPECIFIED; +// case EQUIVALENT: return org.hl7.fhir.dstu2.model.DataElement.DataElementStringency.EQUIVALENT; +// case CONVERTABLE: return org.hl7.fhir.dstu2.model.DataElement.DataElementStringency.CONVERTABLE; +// case SCALEABLE: return org.hl7.fhir.dstu2.model.DataElement.DataElementStringency.SCALEABLE; +// case FLEXIBLE: return org.hl7.fhir.dstu2.model.DataElement.DataElementStringency.FLEXIBLE; +// default: return org.hl7.fhir.dstu2.model.DataElement.DataElementStringency.NULL; +// } +// } + + public org.hl7.fhir.r5.model.ContactDetail convertDataElementContactComponent(org.hl7.fhir.dstu2.model.DataElement.DataElementContactComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.ContactDetail tgt = new org.hl7.fhir.r5.model.ContactDetail(); + copyElement(src, tgt); + tgt.setName(src.getName()); + for (org.hl7.fhir.dstu2.model.ContactPoint t : src.getTelecom()) + tgt.addTelecom(convertContactPoint(t)); + return tgt; + } + + public org.hl7.fhir.dstu2.model.DataElement.DataElementContactComponent convertDataElementContactComponent(org.hl7.fhir.r5.model.ContactDetail src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.DataElement.DataElementContactComponent tgt = new org.hl7.fhir.dstu2.model.DataElement.DataElementContactComponent(); + copyElement(src, tgt); + tgt.setName(src.getName()); + for (org.hl7.fhir.r5.model.ContactPoint t : src.getTelecom()) + tgt.addTelecom(convertContactPoint(t)); + return tgt; + } + + public org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionMappingComponent convertDataElementMappingComponent(org.hl7.fhir.dstu2.model.DataElement.DataElementMappingComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionMappingComponent tgt = new org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionMappingComponent(); + copyElement(src, tgt); + tgt.setIdentity(src.getIdentity()); + tgt.setUri(src.getUri()); + tgt.setName(src.getName()); + tgt.setComment(src.getComments()); + return tgt; + } + +// public org.hl7.fhir.dstu2.model.DataElement.DataElementMappingComponent convertDataElementMappingComponent(org.hl7.fhir.r5.model.DataElement.DataElementMappingComponent src) throws FHIRException { +// if (src == null || src.isEmpty()) +// return null; +// org.hl7.fhir.dstu2.model.DataElement.DataElementMappingComponent tgt = new org.hl7.fhir.dstu2.model.DataElement.DataElementMappingComponent(); +// copyElement(src, tgt); +// tgt.setIdentity(src.getIdentity()); +// tgt.setUri(src.getUri()); +// tgt.setName(src.getName()); +// tgt.setComments(src.getComment()); +// return tgt; +// } + + public org.hl7.fhir.r5.model.DetectedIssue convertDetectedIssue(org.hl7.fhir.dstu2.model.DetectedIssue src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.DetectedIssue tgt = new org.hl7.fhir.r5.model.DetectedIssue(); + copyDomainResource(src, tgt); + tgt.setPatient(convertReference(src.getPatient())); + tgt.setCode(convertCodeableConcept(src.getCategory())); + tgt.setSeverity(convertDetectedIssueSeverity(src.getSeverity())); + for (org.hl7.fhir.dstu2.model.Reference t : src.getImplicated()) + tgt.addImplicated(convertReference(t)); + tgt.setDetail(src.getDetail()); + if (src.hasDate()) + tgt.setIdentified(convertDateTime(src.getDateElement())); + tgt.setAuthor(convertReference(src.getAuthor())); + tgt.addIdentifier(convertIdentifier(src.getIdentifier())); + tgt.setReference(src.getReference()); + for (org.hl7.fhir.dstu2.model.DetectedIssue.DetectedIssueMitigationComponent t : src.getMitigation()) + tgt.addMitigation(convertDetectedIssueMitigationComponent(t)); + return tgt; + } + + public org.hl7.fhir.dstu2.model.DetectedIssue convertDetectedIssue(org.hl7.fhir.r5.model.DetectedIssue src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.DetectedIssue tgt = new org.hl7.fhir.dstu2.model.DetectedIssue(); + copyDomainResource(src, tgt); + tgt.setPatient(convertReference(src.getPatient())); + tgt.setCategory(convertCodeableConcept(src.getCode())); + tgt.setSeverity(convertDetectedIssueSeverity(src.getSeverity())); + for (org.hl7.fhir.r5.model.Reference t : src.getImplicated()) + tgt.addImplicated(convertReference(t)); + tgt.setDetail(src.getDetail()); + if (src.hasIdentifiedDateTimeType()) + tgt.setDateElement(convertDateTime(src.getIdentifiedDateTimeType())); + tgt.setAuthor(convertReference(src.getAuthor())); + tgt.setIdentifier(convertIdentifier(src.getIdentifierFirstRep())); + tgt.setReference(src.getReference()); + for (org.hl7.fhir.r5.model.DetectedIssue.DetectedIssueMitigationComponent t : src.getMitigation()) + tgt.addMitigation(convertDetectedIssueMitigationComponent(t)); + return tgt; + } + + public org.hl7.fhir.r5.model.DetectedIssue.DetectedIssueSeverity convertDetectedIssueSeverity(org.hl7.fhir.dstu2.model.DetectedIssue.DetectedIssueSeverity src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case HIGH: return org.hl7.fhir.r5.model.DetectedIssue.DetectedIssueSeverity.HIGH; + case MODERATE: return org.hl7.fhir.r5.model.DetectedIssue.DetectedIssueSeverity.MODERATE; + case LOW: return org.hl7.fhir.r5.model.DetectedIssue.DetectedIssueSeverity.LOW; + default: return org.hl7.fhir.r5.model.DetectedIssue.DetectedIssueSeverity.NULL; + } + } + + public org.hl7.fhir.dstu2.model.DetectedIssue.DetectedIssueSeverity convertDetectedIssueSeverity(org.hl7.fhir.r5.model.DetectedIssue.DetectedIssueSeverity src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case HIGH: return org.hl7.fhir.dstu2.model.DetectedIssue.DetectedIssueSeverity.HIGH; + case MODERATE: return org.hl7.fhir.dstu2.model.DetectedIssue.DetectedIssueSeverity.MODERATE; + case LOW: return org.hl7.fhir.dstu2.model.DetectedIssue.DetectedIssueSeverity.LOW; + default: return org.hl7.fhir.dstu2.model.DetectedIssue.DetectedIssueSeverity.NULL; + } + } + + public org.hl7.fhir.r5.model.DetectedIssue.DetectedIssueMitigationComponent convertDetectedIssueMitigationComponent(org.hl7.fhir.dstu2.model.DetectedIssue.DetectedIssueMitigationComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.DetectedIssue.DetectedIssueMitigationComponent tgt = new org.hl7.fhir.r5.model.DetectedIssue.DetectedIssueMitigationComponent(); + copyElement(src, tgt); + tgt.setAction(convertCodeableConcept(src.getAction())); + if (src.hasDate()) + tgt.setDate(src.getDate()); + tgt.setAuthor(convertReference(src.getAuthor())); + return tgt; + } + + public org.hl7.fhir.dstu2.model.DetectedIssue.DetectedIssueMitigationComponent convertDetectedIssueMitigationComponent(org.hl7.fhir.r5.model.DetectedIssue.DetectedIssueMitigationComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.DetectedIssue.DetectedIssueMitigationComponent tgt = new org.hl7.fhir.dstu2.model.DetectedIssue.DetectedIssueMitigationComponent(); + copyElement(src, tgt); + tgt.setAction(convertCodeableConcept(src.getAction())); + if (src.hasDate()) + tgt.setDate(src.getDate()); + tgt.setAuthor(convertReference(src.getAuthor())); + return tgt; + } + +// public org.hl7.fhir.r5.model.Device convertDevice(org.hl7.fhir.dstu2.model.Device src) throws FHIRException { +// if (src == null || src.isEmpty()) +// return null; +// org.hl7.fhir.r5.model.Device tgt = new org.hl7.fhir.r5.model.Device(); +// copyDomainResource(src, tgt); +// for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) +// tgt.addIdentifier(convertIdentifier(t)); +// tgt.setUdi((new org.hl7.fhir.r5.model.Device.DeviceUdiComponent()).setDeviceIdentifier(src.getUdi())); +// tgt.setStatus(convertDeviceStatus(src.getStatus())); +// tgt.setType(convertCodeableConcept(src.getType())); +// tgt.setLotNumber(src.getLotNumber()); +// tgt.setManufacturer(src.getManufacturer()); +// tgt.setManufactureDate(src.getManufactureDate()); +// tgt.setExpirationDate(src.getExpiry()); +// tgt.setModel(src.getModel()); +// tgt.setVersion(src.getVersion()); +// tgt.setPatient(convertReference(src.getPatient())); +// tgt.setOwner(convertReference(src.getOwner())); +// for (org.hl7.fhir.dstu2.model.ContactPoint t : src.getContact()) +// tgt.addContact(convertContactPoint(t)); +// tgt.setLocation(convertReference(src.getLocation())); +// tgt.setUrl(src.getUrl()); +// for (org.hl7.fhir.dstu2.model.Annotation t : src.getNote()) +// tgt.addNote(convertAnnotation(t)); +// return tgt; +// } +// +// public org.hl7.fhir.dstu2.model.Device convertDevice(org.hl7.fhir.r5.model.Device src) throws FHIRException { +// if (src == null || src.isEmpty()) +// return null; +// org.hl7.fhir.dstu2.model.Device tgt = new org.hl7.fhir.dstu2.model.Device(); +// copyDomainResource(src, tgt); +// for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) +// tgt.addIdentifier(convertIdentifier(t)); +// if (src.hasUdi()) +// tgt.setUdi(src.getUdi().getDeviceIdentifier()); +// tgt.setStatus(convertDeviceStatus(src.getStatus())); +// tgt.setType(convertCodeableConcept(src.getType())); +// tgt.setLotNumber(src.getLotNumber()); +// tgt.setManufacturer(src.getManufacturer()); +// tgt.setManufactureDate(src.getManufactureDate()); +// tgt.setExpiry(src.getExpirationDate()); +// tgt.setModel(src.getModel()); +// tgt.setVersion(src.getVersion()); +// tgt.setPatient(convertReference(src.getPatient())); +// tgt.setOwner(convertReference(src.getOwner())); +// for (org.hl7.fhir.r5.model.ContactPoint t : src.getContact()) +// tgt.addContact(convertContactPoint(t)); +// tgt.setLocation(convertReference(src.getLocation())); +// tgt.setUrl(src.getUrl()); +// for (org.hl7.fhir.r5.model.Annotation t : src.getNote()) +// tgt.addNote(convertAnnotation(t)); +// return tgt; +// } +// +// public org.hl7.fhir.r5.model.Device.FHIRDeviceStatus convertDeviceStatus(org.hl7.fhir.dstu2.model.Device.DeviceStatus src) throws FHIRException { +// if (src == null) +// return null; +// switch (src) { +// case AVAILABLE: return org.hl7.fhir.r5.model.Device.FHIRDeviceStatus.ACTIVE; +// case NOTAVAILABLE: return org.hl7.fhir.r5.model.Device.FHIRDeviceStatus.INACTIVE; +// case ENTEREDINERROR: return org.hl7.fhir.r5.model.Device.FHIRDeviceStatus.ENTEREDINERROR; +// default: return org.hl7.fhir.r5.model.Device.FHIRDeviceStatus.NULL; +// } +// } +// +// public org.hl7.fhir.dstu2.model.Device.DeviceStatus convertDeviceStatus(org.hl7.fhir.r5.model.Device.FHIRDeviceStatus src) throws FHIRException { +// if (src == null) +// return null; +// switch (src) { +// case ACTIVE: return org.hl7.fhir.dstu2.model.Device.DeviceStatus.AVAILABLE; +// case INACTIVE: return org.hl7.fhir.dstu2.model.Device.DeviceStatus.NOTAVAILABLE; +// case ENTEREDINERROR: return org.hl7.fhir.dstu2.model.Device.DeviceStatus.ENTEREDINERROR; +// default: return org.hl7.fhir.dstu2.model.Device.DeviceStatus.NULL; +// } +// } +// +// public org.hl7.fhir.r5.model.DeviceComponent convertDeviceComponent(org.hl7.fhir.dstu2.model.DeviceComponent src) throws FHIRException { +// if (src == null || src.isEmpty()) +// return null; +// org.hl7.fhir.r5.model.DeviceComponent tgt = new org.hl7.fhir.r5.model.DeviceComponent(); +// copyDomainResource(src, tgt); +// tgt.setType(convertCodeableConcept(src.getType())); +// tgt.addIdentifier(convertIdentifier(src.getIdentifier())); +// tgt.setLastSystemChange(src.getLastSystemChange()); +// tgt.setSource(convertReference(src.getSource())); +// tgt.setParent(convertReference(src.getParent())); +// for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getOperationalStatus()) +// tgt.addOperationalStatus(convertCodeableConcept(t)); +// tgt.setParameterGroup(convertCodeableConcept(src.getParameterGroup())); +// tgt.setMeasurementPrinciple(convertMeasmntPrinciple(src.getMeasurementPrinciple())); +// for (org.hl7.fhir.dstu2.model.DeviceComponent.DeviceComponentProductionSpecificationComponent t : src.getProductionSpecification()) +// tgt.addProductionSpecification(convertDeviceComponentProductionSpecificationComponent(t)); +// tgt.setLanguageCode(convertCodeableConcept(src.getLanguageCode())); +// return tgt; +// } +// +// public org.hl7.fhir.dstu2.model.DeviceComponent convertDeviceComponent(org.hl7.fhir.r5.model.DeviceComponent src) throws FHIRException { +// if (src == null || src.isEmpty()) +// return null; +// org.hl7.fhir.dstu2.model.DeviceComponent tgt = new org.hl7.fhir.dstu2.model.DeviceComponent(); +// copyDomainResource(src, tgt); +// tgt.setType(convertCodeableConcept(src.getType())); +// tgt.setIdentifier(convertIdentifier(src.getIdentifierFirstRep())); +// tgt.setLastSystemChange(src.getLastSystemChange()); +// tgt.setSource(convertReference(src.getSource())); +// tgt.setParent(convertReference(src.getParent())); +// for (org.hl7.fhir.r5.model.CodeableConcept t : src.getOperationalStatus()) +// tgt.addOperationalStatus(convertCodeableConcept(t)); +// tgt.setParameterGroup(convertCodeableConcept(src.getParameterGroup())); +// tgt.setMeasurementPrinciple(convertMeasmntPrinciple(src.getMeasurementPrinciple())); +// for (org.hl7.fhir.r5.model.DeviceComponent.DeviceComponentProductionSpecificationComponent t : src.getProductionSpecification()) +// tgt.addProductionSpecification(convertDeviceComponentProductionSpecificationComponent(t)); +// tgt.setLanguageCode(convertCodeableConcept(src.getLanguageCode())); +// return tgt; +// } + +// public org.hl7.fhir.r5.model.DeviceComponent.MeasmntPrinciple convertMeasmntPrinciple(org.hl7.fhir.dstu2.model.DeviceComponent.MeasmntPrinciple src) throws FHIRException { +// if (src == null) +// return null; +// switch (src) { +// case OTHER: return org.hl7.fhir.r5.model.DeviceComponent.MeasmntPrinciple.OTHER; +// case CHEMICAL: return org.hl7.fhir.r5.model.DeviceComponent.MeasmntPrinciple.CHEMICAL; +// case ELECTRICAL: return org.hl7.fhir.r5.model.DeviceComponent.MeasmntPrinciple.ELECTRICAL; +// case IMPEDANCE: return org.hl7.fhir.r5.model.DeviceComponent.MeasmntPrinciple.IMPEDANCE; +// case NUCLEAR: return org.hl7.fhir.r5.model.DeviceComponent.MeasmntPrinciple.NUCLEAR; +// case OPTICAL: return org.hl7.fhir.r5.model.DeviceComponent.MeasmntPrinciple.OPTICAL; +// case THERMAL: return org.hl7.fhir.r5.model.DeviceComponent.MeasmntPrinciple.THERMAL; +// case BIOLOGICAL: return org.hl7.fhir.r5.model.DeviceComponent.MeasmntPrinciple.BIOLOGICAL; +// case MECHANICAL: return org.hl7.fhir.r5.model.DeviceComponent.MeasmntPrinciple.MECHANICAL; +// case ACOUSTICAL: return org.hl7.fhir.r5.model.DeviceComponent.MeasmntPrinciple.ACOUSTICAL; +// case MANUAL: return org.hl7.fhir.r5.model.DeviceComponent.MeasmntPrinciple.MANUAL; +// default: return org.hl7.fhir.r5.model.DeviceComponent.MeasmntPrinciple.NULL; +// } +// } +// +// public org.hl7.fhir.dstu2.model.DeviceComponent.MeasmntPrinciple convertMeasmntPrinciple(org.hl7.fhir.r5.model.DeviceComponent.MeasmntPrinciple src) throws FHIRException { +// if (src == null) +// return null; +// switch (src) { +// case OTHER: return org.hl7.fhir.dstu2.model.DeviceComponent.MeasmntPrinciple.OTHER; +// case CHEMICAL: return org.hl7.fhir.dstu2.model.DeviceComponent.MeasmntPrinciple.CHEMICAL; +// case ELECTRICAL: return org.hl7.fhir.dstu2.model.DeviceComponent.MeasmntPrinciple.ELECTRICAL; +// case IMPEDANCE: return org.hl7.fhir.dstu2.model.DeviceComponent.MeasmntPrinciple.IMPEDANCE; +// case NUCLEAR: return org.hl7.fhir.dstu2.model.DeviceComponent.MeasmntPrinciple.NUCLEAR; +// case OPTICAL: return org.hl7.fhir.dstu2.model.DeviceComponent.MeasmntPrinciple.OPTICAL; +// case THERMAL: return org.hl7.fhir.dstu2.model.DeviceComponent.MeasmntPrinciple.THERMAL; +// case BIOLOGICAL: return org.hl7.fhir.dstu2.model.DeviceComponent.MeasmntPrinciple.BIOLOGICAL; +// case MECHANICAL: return org.hl7.fhir.dstu2.model.DeviceComponent.MeasmntPrinciple.MECHANICAL; +// case ACOUSTICAL: return org.hl7.fhir.dstu2.model.DeviceComponent.MeasmntPrinciple.ACOUSTICAL; +// case MANUAL: return org.hl7.fhir.dstu2.model.DeviceComponent.MeasmntPrinciple.MANUAL; +// default: return org.hl7.fhir.dstu2.model.DeviceComponent.MeasmntPrinciple.NULL; +// } +// } +// +// public org.hl7.fhir.r5.model.DeviceComponent.DeviceComponentProductionSpecificationComponent convertDeviceComponentProductionSpecificationComponent(org.hl7.fhir.dstu2.model.DeviceComponent.DeviceComponentProductionSpecificationComponent src) throws FHIRException { +// if (src == null || src.isEmpty()) +// return null; +// org.hl7.fhir.r5.model.DeviceComponent.DeviceComponentProductionSpecificationComponent tgt = new org.hl7.fhir.r5.model.DeviceComponent.DeviceComponentProductionSpecificationComponent(); +// copyElement(src, tgt); +// tgt.setSpecType(convertCodeableConcept(src.getSpecType())); +// tgt.setComponentId(convertIdentifier(src.getComponentId())); +// tgt.setProductionSpec(src.getProductionSpec()); +// return tgt; +// } +// +// public org.hl7.fhir.dstu2.model.DeviceComponent.DeviceComponentProductionSpecificationComponent convertDeviceComponentProductionSpecificationComponent(org.hl7.fhir.r5.model.DeviceComponent.DeviceComponentProductionSpecificationComponent src) throws FHIRException { +// if (src == null || src.isEmpty()) +// return null; +// org.hl7.fhir.dstu2.model.DeviceComponent.DeviceComponentProductionSpecificationComponent tgt = new org.hl7.fhir.dstu2.model.DeviceComponent.DeviceComponentProductionSpecificationComponent(); +// copyElement(src, tgt); +// tgt.setSpecType(convertCodeableConcept(src.getSpecType())); +// tgt.setComponentId(convertIdentifier(src.getComponentId())); +// tgt.setProductionSpec(src.getProductionSpec()); +// return tgt; +// } +// + public org.hl7.fhir.r5.model.DeviceMetric convertDeviceMetric(org.hl7.fhir.dstu2.model.DeviceMetric src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.DeviceMetric tgt = new org.hl7.fhir.r5.model.DeviceMetric(); + copyDomainResource(src, tgt); + tgt.setType(convertCodeableConcept(src.getType())); + tgt.addIdentifier(convertIdentifier(src.getIdentifier())); + tgt.setUnit(convertCodeableConcept(src.getUnit())); + tgt.setSource(convertReference(src.getSource())); + tgt.setParent(convertReference(src.getParent())); + tgt.setOperationalStatus(convertDeviceMetricOperationalStatus(src.getOperationalStatus())); + tgt.setColor(convertDeviceMetricColor(src.getColor())); + tgt.setCategory(convertDeviceMetricCategory(src.getCategory())); + tgt.setMeasurementPeriod(convertTiming(src.getMeasurementPeriod())); + for (org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCalibrationComponent t : src.getCalibration()) + tgt.addCalibration(convertDeviceMetricCalibrationComponent(t)); + return tgt; + } + + public org.hl7.fhir.dstu2.model.DeviceMetric convertDeviceMetric(org.hl7.fhir.r5.model.DeviceMetric src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.DeviceMetric tgt = new org.hl7.fhir.dstu2.model.DeviceMetric(); + copyDomainResource(src, tgt); + tgt.setType(convertCodeableConcept(src.getType())); + tgt.setIdentifier(convertIdentifier(src.getIdentifierFirstRep())); + tgt.setUnit(convertCodeableConcept(src.getUnit())); + tgt.setSource(convertReference(src.getSource())); + tgt.setParent(convertReference(src.getParent())); + tgt.setOperationalStatus(convertDeviceMetricOperationalStatus(src.getOperationalStatus())); + tgt.setColor(convertDeviceMetricColor(src.getColor())); + tgt.setCategory(convertDeviceMetricCategory(src.getCategory())); + tgt.setMeasurementPeriod(convertTiming(src.getMeasurementPeriod())); + for (org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricCalibrationComponent t : src.getCalibration()) + tgt.addCalibration(convertDeviceMetricCalibrationComponent(t)); + return tgt; + } + + public org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricOperationalStatus convertDeviceMetricOperationalStatus(org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricOperationalStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case ON: return org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricOperationalStatus.ON; + case OFF: return org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricOperationalStatus.OFF; + case STANDBY: return org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricOperationalStatus.STANDBY; + default: return org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricOperationalStatus.NULL; + } + } + + public org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricOperationalStatus convertDeviceMetricOperationalStatus(org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricOperationalStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case ON: return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricOperationalStatus.ON; + case OFF: return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricOperationalStatus.OFF; + case STANDBY: return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricOperationalStatus.STANDBY; + default: return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricOperationalStatus.NULL; + } + } + + public org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricColor convertDeviceMetricColor(org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricColor src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case BLACK: return org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricColor.BLACK; + case RED: return org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricColor.RED; + case GREEN: return org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricColor.GREEN; + case YELLOW: return org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricColor.YELLOW; + case BLUE: return org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricColor.BLUE; + case MAGENTA: return org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricColor.MAGENTA; + case CYAN: return org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricColor.CYAN; + case WHITE: return org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricColor.WHITE; + default: return org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricColor.NULL; + } + } + + public org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricColor convertDeviceMetricColor(org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricColor src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case BLACK: return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricColor.BLACK; + case RED: return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricColor.RED; + case GREEN: return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricColor.GREEN; + case YELLOW: return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricColor.YELLOW; + case BLUE: return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricColor.BLUE; + case MAGENTA: return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricColor.MAGENTA; + case CYAN: return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricColor.CYAN; + case WHITE: return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricColor.WHITE; + default: return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricColor.NULL; + } + } + + public org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricCategory convertDeviceMetricCategory(org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCategory src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case MEASUREMENT: return org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricCategory.MEASUREMENT; + case SETTING: return org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricCategory.SETTING; + case CALCULATION: return org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricCategory.CALCULATION; + case UNSPECIFIED: return org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricCategory.UNSPECIFIED; + default: return org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricCategory.NULL; + } + } + + public org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCategory convertDeviceMetricCategory(org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricCategory src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case MEASUREMENT: return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCategory.MEASUREMENT; + case SETTING: return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCategory.SETTING; + case CALCULATION: return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCategory.CALCULATION; + case UNSPECIFIED: return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCategory.UNSPECIFIED; + default: return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCategory.NULL; + } + } + + public org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricCalibrationComponent convertDeviceMetricCalibrationComponent(org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCalibrationComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricCalibrationComponent tgt = new org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricCalibrationComponent(); + copyElement(src, tgt); + tgt.setType(convertDeviceMetricCalibrationType(src.getType())); + tgt.setState(convertDeviceMetricCalibrationState(src.getState())); + tgt.setTime(src.getTime()); + return tgt; + } + + public org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCalibrationComponent convertDeviceMetricCalibrationComponent(org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricCalibrationComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCalibrationComponent tgt = new org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCalibrationComponent(); + copyElement(src, tgt); + tgt.setType(convertDeviceMetricCalibrationType(src.getType())); + tgt.setState(convertDeviceMetricCalibrationState(src.getState())); + tgt.setTime(src.getTime()); + return tgt; + } + + public org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricCalibrationType convertDeviceMetricCalibrationType(org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCalibrationType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case UNSPECIFIED: return org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricCalibrationType.UNSPECIFIED; + case OFFSET: return org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricCalibrationType.OFFSET; + case GAIN: return org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricCalibrationType.GAIN; + case TWOPOINT: return org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricCalibrationType.TWOPOINT; + default: return org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricCalibrationType.NULL; + } + } + + public org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCalibrationType convertDeviceMetricCalibrationType(org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricCalibrationType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case UNSPECIFIED: return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCalibrationType.UNSPECIFIED; + case OFFSET: return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCalibrationType.OFFSET; + case GAIN: return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCalibrationType.GAIN; + case TWOPOINT: return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCalibrationType.TWOPOINT; + default: return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCalibrationType.NULL; + } + } + + public org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricCalibrationState convertDeviceMetricCalibrationState(org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCalibrationState src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case NOTCALIBRATED: return org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricCalibrationState.NOTCALIBRATED; + case CALIBRATIONREQUIRED: return org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricCalibrationState.CALIBRATIONREQUIRED; + case CALIBRATED: return org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricCalibrationState.CALIBRATED; + case UNSPECIFIED: return org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricCalibrationState.UNSPECIFIED; + default: return org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricCalibrationState.NULL; + } + } + + public org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCalibrationState convertDeviceMetricCalibrationState(org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricCalibrationState src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case NOTCALIBRATED: return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCalibrationState.NOTCALIBRATED; + case CALIBRATIONREQUIRED: return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCalibrationState.CALIBRATIONREQUIRED; + case CALIBRATED: return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCalibrationState.CALIBRATED; + case UNSPECIFIED: return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCalibrationState.UNSPECIFIED; + default: return org.hl7.fhir.dstu2.model.DeviceMetric.DeviceMetricCalibrationState.NULL; + } + } + + public org.hl7.fhir.r5.model.DeviceUseStatement convertDeviceUseStatement(org.hl7.fhir.dstu2.model.DeviceUseStatement src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.DeviceUseStatement tgt = new org.hl7.fhir.r5.model.DeviceUseStatement(); + copyDomainResource(src, tgt); + if (src.hasBodySiteCodeableConcept()) + tgt.setBodySite(convertCodeableConcept(src.getBodySiteCodeableConcept())); + tgt.setDevice(convertReference(src.getDevice())); + for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getIndication()) + tgt.addReasonCode(convertCodeableConcept(t)); + for (org.hl7.fhir.dstu2.model.StringType t : src.getNotes()) + tgt.addNote().setText(t.getValue()); + tgt.setRecordedOn(src.getRecordedOn()); + tgt.setSubject(convertReference(src.getSubject())); + tgt.setTiming(convertType(src.getTiming())); + return tgt; + } + + public org.hl7.fhir.dstu2.model.DeviceUseStatement convertDeviceUseStatement(org.hl7.fhir.r5.model.DeviceUseStatement src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.DeviceUseStatement tgt = new org.hl7.fhir.dstu2.model.DeviceUseStatement(); + copyDomainResource(src, tgt); + tgt.setBodySite(convertType(src.getBodySite())); + tgt.setDevice(convertReference(src.getDevice())); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getReasonCode()) + tgt.addIndication(convertCodeableConcept(t)); + for (Annotation t : src.getNote()) + tgt.addNotes(t.getText()); + tgt.setRecordedOn(src.getRecordedOn()); + tgt.setSubject(convertReference(src.getSubject())); + tgt.setTiming(convertType(src.getTiming())); + return tgt; + } + +// public org.hl7.fhir.r5.model.DiagnosticRequest.DiagnosticRequestStatus convertDiagnosticOrderStatus(org.hl7.fhir.dstu2.model.DiagnosticOrder.DiagnosticOrderStatus src) throws FHIRException { +// if (src ==/* null || src.isEmpty()*/) +// return null; +// switch (src) { +// case PROPOSED: return org.hl7.fhir.r5.model.DiagnosticRequest.DiagnosticRequestStatus.PROPOSED; +// case DRAFT: return org.hl7.fhir.r5.model.DiagnosticRequest.DiagnosticRequestStatus.DRAFT; +// case PLANNED: return org.hl7.fhir.r5.model.DiagnosticRequest.DiagnosticRequestStatus.PLANNED; +// case REQUESTED: return org.hl7.fhir.r5.model.DiagnosticRequest.DiagnosticRequestStatus.REQUESTED; +// case RECEIVED: return org.hl7.fhir.r5.model.DiagnosticRequest.DiagnosticRequestStatus.RECEIVED; +// case ACCEPTED: return org.hl7.fhir.r5.model.DiagnosticRequest.DiagnosticRequestStatus.ACCEPTED; +// case INPROGRESS: return org.hl7.fhir.r5.model.DiagnosticRequest.DiagnosticRequestStatus.INPROGRESS; +// case REVIEW: return org.hl7.fhir.r5.model.DiagnosticRequest.DiagnosticRequestStatus.REVIEW; +// case COMPLETED: return org.hl7.fhir.r5.model.DiagnosticRequest.DiagnosticRequestStatus.COMPLETED; +// case CANCELLED: return org.hl7.fhir.r5.model.DiagnosticRequest.DiagnosticRequestStatus.CANCELLED; +// case SUSPENDED: return org.hl7.fhir.r5.model.DiagnosticRequest.DiagnosticRequestStatus.SUSPENDED; +// case REJECTED: return org.hl7.fhir.r5.model.DiagnosticRequest.DiagnosticRequestStatus.REJECTED; +// case FAILED: return org.hl7.fhir.r5.model.DiagnosticRequest.DiagnosticRequestStatus.FAILED; +// default: return org.hl7.fhir.r5.model.DiagnosticRequest.DiagnosticRequestStatus.NULL; +// } +// } +// +// public org.hl7.fhir.dstu2.model.DiagnosticOrder.DiagnosticOrderStatus convertDiagnosticOrderStatus(org.hl7.fhir.r5.model.DiagnosticRequest.DiagnosticRequestStatus src) throws FHIRException { +// if (src ==/* null || src.isEmpty()*/) +// return null; +// switch (src) { +// case PROPOSED: return org.hl7.fhir.dstu2.model.DiagnosticOrder.DiagnosticOrderStatus.PROPOSED; +// case DRAFT: return org.hl7.fhir.dstu2.model.DiagnosticOrder.DiagnosticOrderStatus.DRAFT; +// case PLANNED: return org.hl7.fhir.dstu2.model.DiagnosticOrder.DiagnosticOrderStatus.PLANNED; +// case REQUESTED: return org.hl7.fhir.dstu2.model.DiagnosticOrder.DiagnosticOrderStatus.REQUESTED; +// case RECEIVED: return org.hl7.fhir.dstu2.model.DiagnosticOrder.DiagnosticOrderStatus.RECEIVED; +// case ACCEPTED: return org.hl7.fhir.dstu2.model.DiagnosticOrder.DiagnosticOrderStatus.ACCEPTED; +// case INPROGRESS: return org.hl7.fhir.dstu2.model.DiagnosticOrder.DiagnosticOrderStatus.INPROGRESS; +// case REVIEW: return org.hl7.fhir.dstu2.model.DiagnosticOrder.DiagnosticOrderStatus.REVIEW; +// case COMPLETED: return org.hl7.fhir.dstu2.model.DiagnosticOrder.DiagnosticOrderStatus.COMPLETED; +// case CANCELLED: return org.hl7.fhir.dstu2.model.DiagnosticOrder.DiagnosticOrderStatus.CANCELLED; +// case SUSPENDED: return org.hl7.fhir.dstu2.model.DiagnosticOrder.DiagnosticOrderStatus.SUSPENDED; +// case REJECTED: return org.hl7.fhir.dstu2.model.DiagnosticOrder.DiagnosticOrderStatus.REJECTED; +// case FAILED: return org.hl7.fhir.dstu2.model.DiagnosticOrder.DiagnosticOrderStatus.FAILED; +// default: return org.hl7.fhir.dstu2.model.DiagnosticOrder.DiagnosticOrderStatus.NULL; +// } +// } + + + public org.hl7.fhir.r5.model.DiagnosticReport convertDiagnosticReport(org.hl7.fhir.dstu2.model.DiagnosticReport src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.DiagnosticReport tgt = new org.hl7.fhir.r5.model.DiagnosticReport(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + tgt.setStatus(convertDiagnosticReportStatus(src.getStatus())); + tgt.addCategory(convertCodeableConcept(src.getCategory())); + tgt.setCode(convertCodeableConcept(src.getCode())); + tgt.setSubject(convertReference(src.getSubject())); + tgt.setEncounter(convertReference(src.getEncounter())); + tgt.setEffective(convertType(src.getEffective())); + tgt.setIssued(src.getIssued()); +// tgt.setPerformer(convertReference(src.getPerformer())); +// for (org.hl7.fhir.dstu2.model.Reference t : src.getRequest()) +// tgt.addRequest(convertReference(t)); + for (org.hl7.fhir.dstu2.model.Reference t : src.getSpecimen()) + tgt.addSpecimen(convertReference(t)); + for (org.hl7.fhir.dstu2.model.Reference t : src.getResult()) + tgt.addResult(convertReference(t)); + for (org.hl7.fhir.dstu2.model.Reference t : src.getImagingStudy()) + tgt.addImagingStudy(convertReference(t)); + for (org.hl7.fhir.dstu2.model.DiagnosticReport.DiagnosticReportImageComponent t : src.getImage()) + tgt.addMedia(convertDiagnosticReportImageComponent(t)); + tgt.setConclusion(src.getConclusion()); + for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getCodedDiagnosis()) + tgt.addConclusionCode(convertCodeableConcept(t)); + for (org.hl7.fhir.dstu2.model.Attachment t : src.getPresentedForm()) + tgt.addPresentedForm(convertAttachment(t)); + return tgt; + } + + public org.hl7.fhir.dstu2.model.DiagnosticReport convertDiagnosticReport(org.hl7.fhir.r5.model.DiagnosticReport src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.DiagnosticReport tgt = new org.hl7.fhir.dstu2.model.DiagnosticReport(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + tgt.setStatus(convertDiagnosticReportStatus(src.getStatus())); + tgt.setCategory(convertCodeableConcept(src.getCategoryFirstRep())); + tgt.setCode(convertCodeableConcept(src.getCode())); + tgt.setSubject(convertReference(src.getSubject())); + tgt.setEncounter(convertReference(src.getEncounter())); + tgt.setEffective(convertType(src.getEffective())); + tgt.setIssued(src.getIssued()); +// tgt.setPerformer(convertReference(src.getPerformer())); +// for (org.hl7.fhir.r5.model.Reference t : src.getRequest()) +// tgt.addRequest(convertReference(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getSpecimen()) + tgt.addSpecimen(convertReference(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getResult()) + tgt.addResult(convertReference(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getImagingStudy()) + tgt.addImagingStudy(convertReference(t)); + for (org.hl7.fhir.r5.model.DiagnosticReport.DiagnosticReportMediaComponent t : src.getMedia()) + tgt.addImage(convertDiagnosticReportImageComponent(t)); + tgt.setConclusion(src.getConclusion()); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getConclusionCode()) + tgt.addCodedDiagnosis(convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.Attachment t : src.getPresentedForm()) + tgt.addPresentedForm(convertAttachment(t)); + return tgt; + } + + public org.hl7.fhir.r5.model.DiagnosticReport.DiagnosticReportStatus convertDiagnosticReportStatus(org.hl7.fhir.dstu2.model.DiagnosticReport.DiagnosticReportStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case REGISTERED: return org.hl7.fhir.r5.model.DiagnosticReport.DiagnosticReportStatus.REGISTERED; + case PARTIAL: return org.hl7.fhir.r5.model.DiagnosticReport.DiagnosticReportStatus.PARTIAL; + case FINAL: return org.hl7.fhir.r5.model.DiagnosticReport.DiagnosticReportStatus.FINAL; + case CORRECTED: return org.hl7.fhir.r5.model.DiagnosticReport.DiagnosticReportStatus.CORRECTED; + case APPENDED: return org.hl7.fhir.r5.model.DiagnosticReport.DiagnosticReportStatus.APPENDED; + case CANCELLED: return org.hl7.fhir.r5.model.DiagnosticReport.DiagnosticReportStatus.CANCELLED; + case ENTEREDINERROR: return org.hl7.fhir.r5.model.DiagnosticReport.DiagnosticReportStatus.ENTEREDINERROR; + default: return org.hl7.fhir.r5.model.DiagnosticReport.DiagnosticReportStatus.NULL; + } + } + + public org.hl7.fhir.dstu2.model.DiagnosticReport.DiagnosticReportStatus convertDiagnosticReportStatus(org.hl7.fhir.r5.model.DiagnosticReport.DiagnosticReportStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case REGISTERED: return org.hl7.fhir.dstu2.model.DiagnosticReport.DiagnosticReportStatus.REGISTERED; + case PARTIAL: return org.hl7.fhir.dstu2.model.DiagnosticReport.DiagnosticReportStatus.PARTIAL; + case FINAL: return org.hl7.fhir.dstu2.model.DiagnosticReport.DiagnosticReportStatus.FINAL; + case CORRECTED: return org.hl7.fhir.dstu2.model.DiagnosticReport.DiagnosticReportStatus.CORRECTED; + case APPENDED: return org.hl7.fhir.dstu2.model.DiagnosticReport.DiagnosticReportStatus.APPENDED; + case CANCELLED: return org.hl7.fhir.dstu2.model.DiagnosticReport.DiagnosticReportStatus.CANCELLED; + case ENTEREDINERROR: return org.hl7.fhir.dstu2.model.DiagnosticReport.DiagnosticReportStatus.ENTEREDINERROR; + default: return org.hl7.fhir.dstu2.model.DiagnosticReport.DiagnosticReportStatus.NULL; + } + } + + public org.hl7.fhir.r5.model.DiagnosticReport.DiagnosticReportMediaComponent convertDiagnosticReportImageComponent(org.hl7.fhir.dstu2.model.DiagnosticReport.DiagnosticReportImageComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.DiagnosticReport.DiagnosticReportMediaComponent tgt = new org.hl7.fhir.r5.model.DiagnosticReport.DiagnosticReportMediaComponent(); + copyElement(src, tgt); + tgt.setComment(src.getComment()); + tgt.setLink(convertReference(src.getLink())); + return tgt; + } + + public org.hl7.fhir.dstu2.model.DiagnosticReport.DiagnosticReportImageComponent convertDiagnosticReportImageComponent(org.hl7.fhir.r5.model.DiagnosticReport.DiagnosticReportMediaComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.DiagnosticReport.DiagnosticReportImageComponent tgt = new org.hl7.fhir.dstu2.model.DiagnosticReport.DiagnosticReportImageComponent(); + copyElement(src, tgt); + tgt.setComment(src.getComment()); + tgt.setLink(convertReference(src.getLink())); + return tgt; + } + +// public org.hl7.fhir.r5.model.DocumentManifest convertDocumentManifest(org.hl7.fhir.dstu2.model.DocumentManifest src) throws FHIRException { +// if (src == null || src.isEmpty()) +// return null; +// org.hl7.fhir.r5.model.DocumentManifest tgt = new org.hl7.fhir.r5.model.DocumentManifest(); +// copyDomainResource(src, tgt); +// tgt.setMasterIdentifier(convertIdentifier(src.getMasterIdentifier())); +// for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) +// tgt.addIdentifier(convertIdentifier(t)); +// tgt.setSubject(convertReference(src.getSubject())); +// for (org.hl7.fhir.dstu2.model.Reference t : src.getRecipient()) +// tgt.addRecipient(convertReference(t)); +// tgt.setType(convertCodeableConcept(src.getType())); +// for (org.hl7.fhir.dstu2.model.Reference t : src.getAuthor()) +// tgt.addAuthor(convertReference(t)); +// tgt.setCreated(src.getCreated()); +// tgt.setSource(src.getSource()); +// tgt.setStatus(convertDocumentReferenceStatus(src.getStatus())); +// tgt.setDescription(src.getDescription()); +// for (org.hl7.fhir.dstu2.model.DocumentManifest.DocumentManifestContentComponent t : src.getContent()) +// tgt.addContent(convertDocumentManifestContentComponent(t)); +// for (org.hl7.fhir.dstu2.model.DocumentManifest.DocumentManifestRelatedComponent t : src.getRelated()) +// tgt.addRelated(convertDocumentManifestRelatedComponent(t)); +// return tgt; +// } +// +// public org.hl7.fhir.dstu2.model.DocumentManifest convertDocumentManifest(org.hl7.fhir.r5.model.DocumentManifest src) throws FHIRException { +// if (src == null || src.isEmpty()) +// return null; +// org.hl7.fhir.dstu2.model.DocumentManifest tgt = new org.hl7.fhir.dstu2.model.DocumentManifest(); +// copyDomainResource(src, tgt); +// tgt.setMasterIdentifier(convertIdentifier(src.getMasterIdentifier())); +// for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) +// tgt.addIdentifier(convertIdentifier(t)); +// tgt.setSubject(convertReference(src.getSubject())); +// for (org.hl7.fhir.r5.model.Reference t : src.getRecipient()) +// tgt.addRecipient(convertReference(t)); +// tgt.setType(convertCodeableConcept(src.getType())); +// for (org.hl7.fhir.r5.model.Reference t : src.getAuthor()) +// tgt.addAuthor(convertReference(t)); +// tgt.setCreated(src.getCreated()); +// tgt.setSource(src.getSource()); +// tgt.setStatus(convertDocumentReferenceStatus(src.getStatus())); +// tgt.setDescription(src.getDescription()); +// for (org.hl7.fhir.r5.model.DocumentManifest.DocumentManifestContentComponent t : src.getContent()) +// tgt.addContent(convertDocumentManifestContentComponent(t)); +// for (org.hl7.fhir.r5.model.DocumentManifest.DocumentManifestRelatedComponent t : src.getRelated()) +// tgt.addRelated(convertDocumentManifestRelatedComponent(t)); +// return tgt; +// } + + public org.hl7.fhir.r5.model.Enumerations.DocumentReferenceStatus convertDocumentReferenceStatus(org.hl7.fhir.dstu2.model.Enumerations.DocumentReferenceStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case CURRENT: return org.hl7.fhir.r5.model.Enumerations.DocumentReferenceStatus.CURRENT; + case SUPERSEDED: return org.hl7.fhir.r5.model.Enumerations.DocumentReferenceStatus.SUPERSEDED; + case ENTEREDINERROR: return org.hl7.fhir.r5.model.Enumerations.DocumentReferenceStatus.ENTEREDINERROR; + default: return org.hl7.fhir.r5.model.Enumerations.DocumentReferenceStatus.NULL; + } + } + + public org.hl7.fhir.dstu2.model.Enumerations.DocumentReferenceStatus convertDocumentReferenceStatus(org.hl7.fhir.r5.model.Enumerations.DocumentReferenceStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case CURRENT: return org.hl7.fhir.dstu2.model.Enumerations.DocumentReferenceStatus.CURRENT; + case SUPERSEDED: return org.hl7.fhir.dstu2.model.Enumerations.DocumentReferenceStatus.SUPERSEDED; + case ENTEREDINERROR: return org.hl7.fhir.dstu2.model.Enumerations.DocumentReferenceStatus.ENTEREDINERROR; + default: return org.hl7.fhir.dstu2.model.Enumerations.DocumentReferenceStatus.NULL; + } + } + +// public org.hl7.fhir.r5.model.DocumentManifest.DocumentManifestContentComponent convertDocumentManifestContentComponent(org.hl7.fhir.dstu2.model.DocumentManifest.DocumentManifestContentComponent src) throws FHIRException { +// if (src == null || src.isEmpty()) +// return null; +// org.hl7.fhir.r5.model.DocumentManifest.DocumentManifestContentComponent tgt = new org.hl7.fhir.r5.model.DocumentManifest.DocumentManifestContentComponent(); +// copyElement(src, tgt); +// tgt.setP(convertType(src.getP())); +// return tgt; +// } +// +// public org.hl7.fhir.dstu2.model.DocumentManifest.DocumentManifestContentComponent convertDocumentManifestContentComponent(org.hl7.fhir.r5.model.DocumentManifest.DocumentManifestContentComponent src) throws FHIRException { +// if (src == null || src.isEmpty()) +// return null; +// org.hl7.fhir.dstu2.model.DocumentManifest.DocumentManifestContentComponent tgt = new org.hl7.fhir.dstu2.model.DocumentManifest.DocumentManifestContentComponent(); +// copyElement(src, tgt); +// tgt.setP(convertType(src.getP())); +// return tgt; +// } + + public org.hl7.fhir.r5.model.DocumentManifest.DocumentManifestRelatedComponent convertDocumentManifestRelatedComponent(org.hl7.fhir.dstu2.model.DocumentManifest.DocumentManifestRelatedComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.DocumentManifest.DocumentManifestRelatedComponent tgt = new org.hl7.fhir.r5.model.DocumentManifest.DocumentManifestRelatedComponent(); + copyElement(src, tgt); + tgt.setIdentifier(convertIdentifier(src.getIdentifier())); + tgt.setRef(convertReference(src.getRef())); + return tgt; + } + + public org.hl7.fhir.dstu2.model.DocumentManifest.DocumentManifestRelatedComponent convertDocumentManifestRelatedComponent(org.hl7.fhir.r5.model.DocumentManifest.DocumentManifestRelatedComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.DocumentManifest.DocumentManifestRelatedComponent tgt = new org.hl7.fhir.dstu2.model.DocumentManifest.DocumentManifestRelatedComponent(); + copyElement(src, tgt); + tgt.setIdentifier(convertIdentifier(src.getIdentifier())); + tgt.setRef(convertReference(src.getRef())); + return tgt; + } + + public org.hl7.fhir.r5.model.DocumentReference convertDocumentReference(org.hl7.fhir.dstu2.model.DocumentReference src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.DocumentReference tgt = new org.hl7.fhir.r5.model.DocumentReference(); + copyDomainResource(src, tgt); + tgt.setMasterIdentifier(convertIdentifier(src.getMasterIdentifier())); + for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + tgt.setSubject(convertReference(src.getSubject())); + tgt.setType(convertCodeableConcept(src.getType())); + tgt.addCategory(convertCodeableConcept(src.getClass_())); +// for (org.hl7.fhir.dstu2.model.Reference t : src.getAuthor()) +// tgt.addAuthor(convertReference(t)); + tgt.setCustodian(convertReference(src.getCustodian())); + tgt.setAuthenticator(convertReference(src.getAuthenticator())); + tgt.setDate(src.getCreated()); + tgt.setStatus(convertDocumentReferenceStatus(src.getStatus())); + tgt.setDocStatus(convertDocStatus(src.getDocStatus())); + for (org.hl7.fhir.dstu2.model.DocumentReference.DocumentReferenceRelatesToComponent t : src.getRelatesTo()) + tgt.addRelatesTo(convertDocumentReferenceRelatesToComponent(t)); + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getSecurityLabel()) + tgt.addSecurityLabel(convertCodeableConcept(t)); + for (org.hl7.fhir.dstu2.model.DocumentReference.DocumentReferenceContentComponent t : src.getContent()) + tgt.addContent(convertDocumentReferenceContentComponent(t)); + tgt.setContext(convertDocumentReferenceContextComponent(src.getContext())); + return tgt; + } + + private ReferredDocumentStatus convertDocStatus(CodeableConcept cc) { + if (hasConcept(cc, "http://hl7.org/fhir/composition-status", "preliminary")) + return ReferredDocumentStatus.PRELIMINARY; + if (hasConcept(cc, "http://hl7.org/fhir/composition-status", "final")) + return ReferredDocumentStatus.FINAL; + if (hasConcept(cc, "http://hl7.org/fhir/composition-status", "amended")) + return ReferredDocumentStatus.AMENDED; + if (hasConcept(cc, "http://hl7.org/fhir/composition-status", "entered-in-error")) + return ReferredDocumentStatus.ENTEREDINERROR; + + return null; + } + + private CodeableConcept convertDocStatus(ReferredDocumentStatus docStatus) { + CodeableConcept cc = new CodeableConcept (); + switch (docStatus) { + case AMENDED: cc.addCoding(). setSystem("http://hl7.org/fhir/composition-status").setCode("amended"); break; + case ENTEREDINERROR: cc.addCoding(). setSystem("http://hl7.org/fhir/composition-status").setCode("entered-in-error"); break; + case FINAL: cc.addCoding(). setSystem("http://hl7.org/fhir/composition-status").setCode("final"); break; + case PRELIMINARY: cc.addCoding(). setSystem("http://hl7.org/fhir/composition-status").setCode("preliminary"); break; + default: return null; + } + return cc; + } + + public org.hl7.fhir.dstu2.model.DocumentReference convertDocumentReference(org.hl7.fhir.r5.model.DocumentReference src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.DocumentReference tgt = new org.hl7.fhir.dstu2.model.DocumentReference(); + copyDomainResource(src, tgt); + tgt.setMasterIdentifier(convertIdentifier(src.getMasterIdentifier())); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + tgt.setSubject(convertReference(src.getSubject())); + tgt.setType(convertCodeableConcept(src.getType())); + tgt.setClass_(convertCodeableConcept(src.getCategoryFirstRep())); +// for (org.hl7.fhir.r5.model.Reference t : src.getAuthor()) +// tgt.addAuthor(convertReference(t)); + tgt.setCustodian(convertReference(src.getCustodian())); + tgt.setAuthenticator(convertReference(src.getAuthenticator())); + tgt.setCreated(src.getDate()); + tgt.setStatus(convertDocumentReferenceStatus(src.getStatus())); + tgt.setDocStatus(convertDocStatus(src.getDocStatus())); + for (org.hl7.fhir.r5.model.DocumentReference.DocumentReferenceRelatesToComponent t : src.getRelatesTo()) + tgt.addRelatesTo(convertDocumentReferenceRelatesToComponent(t)); + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getSecurityLabel()) + tgt.addSecurityLabel(convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.DocumentReference.DocumentReferenceContentComponent t : src.getContent()) + tgt.addContent(convertDocumentReferenceContentComponent(t)); + tgt.setContext(convertDocumentReferenceContextComponent(src.getContext())); + return tgt; + } + + + public org.hl7.fhir.r5.model.DocumentReference.DocumentReferenceRelatesToComponent convertDocumentReferenceRelatesToComponent(org.hl7.fhir.dstu2.model.DocumentReference.DocumentReferenceRelatesToComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.DocumentReference.DocumentReferenceRelatesToComponent tgt = new org.hl7.fhir.r5.model.DocumentReference.DocumentReferenceRelatesToComponent(); + copyElement(src, tgt); + tgt.setCode(convertDocumentRelationshipType(src.getCode())); + tgt.setTarget(convertReference(src.getTarget())); + return tgt; + } + + public org.hl7.fhir.dstu2.model.DocumentReference.DocumentReferenceRelatesToComponent convertDocumentReferenceRelatesToComponent(org.hl7.fhir.r5.model.DocumentReference.DocumentReferenceRelatesToComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.DocumentReference.DocumentReferenceRelatesToComponent tgt = new org.hl7.fhir.dstu2.model.DocumentReference.DocumentReferenceRelatesToComponent(); + copyElement(src, tgt); + tgt.setCode(convertDocumentRelationshipType(src.getCode())); + tgt.setTarget(convertReference(src.getTarget())); + return tgt; + } + + public org.hl7.fhir.r5.model.DocumentReference.DocumentRelationshipType convertDocumentRelationshipType(org.hl7.fhir.dstu2.model.DocumentReference.DocumentRelationshipType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case REPLACES: return org.hl7.fhir.r5.model.DocumentReference.DocumentRelationshipType.REPLACES; + case TRANSFORMS: return org.hl7.fhir.r5.model.DocumentReference.DocumentRelationshipType.TRANSFORMS; + case SIGNS: return org.hl7.fhir.r5.model.DocumentReference.DocumentRelationshipType.SIGNS; + case APPENDS: return org.hl7.fhir.r5.model.DocumentReference.DocumentRelationshipType.APPENDS; + default: return org.hl7.fhir.r5.model.DocumentReference.DocumentRelationshipType.NULL; + } + } + + public org.hl7.fhir.dstu2.model.DocumentReference.DocumentRelationshipType convertDocumentRelationshipType(org.hl7.fhir.r5.model.DocumentReference.DocumentRelationshipType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case REPLACES: return org.hl7.fhir.dstu2.model.DocumentReference.DocumentRelationshipType.REPLACES; + case TRANSFORMS: return org.hl7.fhir.dstu2.model.DocumentReference.DocumentRelationshipType.TRANSFORMS; + case SIGNS: return org.hl7.fhir.dstu2.model.DocumentReference.DocumentRelationshipType.SIGNS; + case APPENDS: return org.hl7.fhir.dstu2.model.DocumentReference.DocumentRelationshipType.APPENDS; + default: return org.hl7.fhir.dstu2.model.DocumentReference.DocumentRelationshipType.NULL; + } + } + + public org.hl7.fhir.r5.model.DocumentReference.DocumentReferenceContentComponent convertDocumentReferenceContentComponent(org.hl7.fhir.dstu2.model.DocumentReference.DocumentReferenceContentComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.DocumentReference.DocumentReferenceContentComponent tgt = new org.hl7.fhir.r5.model.DocumentReference.DocumentReferenceContentComponent(); + copyElement(src, tgt); + tgt.setAttachment(convertAttachment(src.getAttachment())); + for (org.hl7.fhir.dstu2.model.Coding t : src.getFormat()) + tgt.setFormat(convertCoding(t)); + return tgt; + } + + public org.hl7.fhir.dstu2.model.DocumentReference.DocumentReferenceContentComponent convertDocumentReferenceContentComponent(org.hl7.fhir.r5.model.DocumentReference.DocumentReferenceContentComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.DocumentReference.DocumentReferenceContentComponent tgt = new org.hl7.fhir.dstu2.model.DocumentReference.DocumentReferenceContentComponent(); + copyElement(src, tgt); + tgt.setAttachment(convertAttachment(src.getAttachment())); + tgt.addFormat(convertCoding(src.getFormat())); + return tgt; + } + + public org.hl7.fhir.r5.model.DocumentReference.DocumentReferenceContextComponent convertDocumentReferenceContextComponent(org.hl7.fhir.dstu2.model.DocumentReference.DocumentReferenceContextComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.DocumentReference.DocumentReferenceContextComponent tgt = new org.hl7.fhir.r5.model.DocumentReference.DocumentReferenceContextComponent(); + copyElement(src, tgt); + tgt.addEncounter(convertReference(src.getEncounter())); + for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getEvent()) + tgt.addEvent(convertCodeableConcept(t)); + tgt.setPeriod(convertPeriod(src.getPeriod())); + tgt.setFacilityType(convertCodeableConcept(src.getFacilityType())); + tgt.setPracticeSetting(convertCodeableConcept(src.getPracticeSetting())); + tgt.setSourcePatientInfo(convertReference(src.getSourcePatientInfo())); + for (org.hl7.fhir.dstu2.model.DocumentReference.DocumentReferenceContextRelatedComponent t : src.getRelated()) + tgt.addRelated(convertDocumentReferenceContextRelatedComponent(t)); + return tgt; + } + + public org.hl7.fhir.dstu2.model.DocumentReference.DocumentReferenceContextComponent convertDocumentReferenceContextComponent(org.hl7.fhir.r5.model.DocumentReference.DocumentReferenceContextComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.DocumentReference.DocumentReferenceContextComponent tgt = new org.hl7.fhir.dstu2.model.DocumentReference.DocumentReferenceContextComponent(); + copyElement(src, tgt); + if (src.hasEncounter()) + tgt.setEncounter(convertReference(src.getEncounterFirstRep())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getEvent()) + tgt.addEvent(convertCodeableConcept(t)); + tgt.setPeriod(convertPeriod(src.getPeriod())); + tgt.setFacilityType(convertCodeableConcept(src.getFacilityType())); + tgt.setPracticeSetting(convertCodeableConcept(src.getPracticeSetting())); + tgt.setSourcePatientInfo(convertReference(src.getSourcePatientInfo())); + for (org.hl7.fhir.r5.model.Reference t : src.getRelated()) + tgt.addRelated(convertDocumentReferenceContextRelatedComponent(t)); + return tgt; + } + + public org.hl7.fhir.r5.model.Reference convertDocumentReferenceContextRelatedComponent(org.hl7.fhir.dstu2.model.DocumentReference.DocumentReferenceContextRelatedComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Reference tgt = convertReference(src.getRef()); + copyElement(src, tgt); + tgt.setIdentifier(convertIdentifier(src.getIdentifier())); + return tgt; + } + + public org.hl7.fhir.dstu2.model.DocumentReference.DocumentReferenceContextRelatedComponent convertDocumentReferenceContextRelatedComponent(org.hl7.fhir.r5.model.Reference src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.DocumentReference.DocumentReferenceContextRelatedComponent tgt = new org.hl7.fhir.dstu2.model.DocumentReference.DocumentReferenceContextRelatedComponent(); + copyElement(src, tgt); + tgt.setIdentifier(convertIdentifier(src.getIdentifier())); + tgt.setRef(convertReference(src)); + return tgt; + } + + + public org.hl7.fhir.r5.model.Encounter convertEncounter(org.hl7.fhir.dstu2.model.Encounter src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Encounter tgt = new org.hl7.fhir.r5.model.Encounter(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + tgt.setStatus(convertEncounterState(src.getStatus())); +// for (org.hl7.fhir.dstu2.model.Encounter.EncounterStatusHistoryComponent t : src.getStatusHistory()) +// tgt.addStatusHistory(convertEncounterStatusHistoryComponent(t)); + tgt.setClass_(convertEncounterClass(src.getClass_())); + for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getType()) + tgt.addType(convertCodeableConcept(t)); + tgt.setPriority(convertCodeableConcept(src.getPriority())); + tgt.setSubject(convertReference(src.getPatient())); + for (org.hl7.fhir.dstu2.model.Reference t : src.getEpisodeOfCare()) + tgt.addEpisodeOfCare(convertReference(t)); + for (org.hl7.fhir.dstu2.model.Reference t : src.getIncomingReferral()) + tgt.addBasedOn(convertReference(t)); + for (org.hl7.fhir.dstu2.model.Encounter.EncounterParticipantComponent t : src.getParticipant()) + tgt.addParticipant(convertEncounterParticipantComponent(t)); + tgt.addAppointment(convertReference(src.getAppointment())); + tgt.setPeriod(convertPeriod(src.getPeriod())); + tgt.setLength(convertDuration(src.getLength())); + for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getReason()) + tgt.addReasonCode(convertCodeableConcept(t)); + tgt.setHospitalization(convertEncounterHospitalizationComponent(src.getHospitalization())); + for (org.hl7.fhir.dstu2.model.Encounter.EncounterLocationComponent t : src.getLocation()) + tgt.addLocation(convertEncounterLocationComponent(t)); + tgt.setServiceProvider(convertReference(src.getServiceProvider())); + tgt.setPartOf(convertReference(src.getPartOf())); + return tgt; + } + + public org.hl7.fhir.dstu2.model.Encounter convertEncounter(org.hl7.fhir.r5.model.Encounter src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Encounter tgt = new org.hl7.fhir.dstu2.model.Encounter(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + tgt.setStatus(convertEncounterState(src.getStatus())); +// for (org.hl7.fhir.r5.model.Encounter.EncounterStatusHistoryComponent t : src.getStatusHistory()) +// tgt.addStatusHistory(convertEncounterStatusHistoryComponent(t)); + tgt.setClass_(convertEncounterClass(src.getClass_())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getType()) + tgt.addType(convertCodeableConcept(t)); + tgt.setPriority(convertCodeableConcept(src.getPriority())); + tgt.setPatient(convertReference(src.getSubject())); + for (org.hl7.fhir.r5.model.Reference t : src.getEpisodeOfCare()) + tgt.addEpisodeOfCare(convertReference(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getBasedOn()) + tgt.addIncomingReferral(convertReference(t)); + for (org.hl7.fhir.r5.model.Encounter.EncounterParticipantComponent t : src.getParticipant()) + tgt.addParticipant(convertEncounterParticipantComponent(t)); + tgt.setAppointment(convertReference(src.getAppointmentFirstRep())); + tgt.setPeriod(convertPeriod(src.getPeriod())); + tgt.setLength(convertDuration(src.getLength())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getReasonCode()) + tgt.addReason(convertCodeableConcept(t)); + tgt.setHospitalization(convertEncounterHospitalizationComponent(src.getHospitalization())); + for (org.hl7.fhir.r5.model.Encounter.EncounterLocationComponent t : src.getLocation()) + tgt.addLocation(convertEncounterLocationComponent(t)); + tgt.setServiceProvider(convertReference(src.getServiceProvider())); + tgt.setPartOf(convertReference(src.getPartOf())); + return tgt; + } + + public org.hl7.fhir.r5.model.Encounter.EncounterStatus convertEncounterState(org.hl7.fhir.dstu2.model.Encounter.EncounterState src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PLANNED: return org.hl7.fhir.r5.model.Encounter.EncounterStatus.PLANNED; + case ARRIVED: return org.hl7.fhir.r5.model.Encounter.EncounterStatus.ARRIVED; + case INPROGRESS: return org.hl7.fhir.r5.model.Encounter.EncounterStatus.INPROGRESS; + case ONLEAVE: return org.hl7.fhir.r5.model.Encounter.EncounterStatus.ONLEAVE; + case FINISHED: return org.hl7.fhir.r5.model.Encounter.EncounterStatus.FINISHED; + case CANCELLED: return org.hl7.fhir.r5.model.Encounter.EncounterStatus.CANCELLED; + default: return org.hl7.fhir.r5.model.Encounter.EncounterStatus.NULL; + } + } + + public org.hl7.fhir.dstu2.model.Encounter.EncounterState convertEncounterState(org.hl7.fhir.r5.model.Encounter.EncounterStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PLANNED: return org.hl7.fhir.dstu2.model.Encounter.EncounterState.PLANNED; + case ARRIVED: return org.hl7.fhir.dstu2.model.Encounter.EncounterState.ARRIVED; + case INPROGRESS: return org.hl7.fhir.dstu2.model.Encounter.EncounterState.INPROGRESS; + case ONLEAVE: return org.hl7.fhir.dstu2.model.Encounter.EncounterState.ONLEAVE; + case FINISHED: return org.hl7.fhir.dstu2.model.Encounter.EncounterState.FINISHED; + case CANCELLED: return org.hl7.fhir.dstu2.model.Encounter.EncounterState.CANCELLED; + default: return org.hl7.fhir.dstu2.model.Encounter.EncounterState.NULL; + } + } + + public org.hl7.fhir.r5.model.Coding convertEncounterClass(org.hl7.fhir.dstu2.model.Encounter.EncounterClass src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case INPATIENT: return new org.hl7.fhir.r5.model.Coding().setSystem("http://terminology.hl7.org/v3/ActCode").setCode("IMP"); + case OUTPATIENT: return new org.hl7.fhir.r5.model.Coding().setSystem("http://terminology.hl7.org/v3/ActCode").setCode("AMB"); + case AMBULATORY: return new org.hl7.fhir.r5.model.Coding().setSystem("http://terminology.hl7.org/v3/ActCode").setCode("AMB"); + case EMERGENCY: return new org.hl7.fhir.r5.model.Coding().setSystem("http://terminology.hl7.org/v3/ActCode").setCode("EMER"); + case HOME: return new org.hl7.fhir.r5.model.Coding().setSystem("http://terminology.hl7.org/v3/ActCode").setCode("HH"); + case FIELD: return new org.hl7.fhir.r5.model.Coding().setSystem("http://terminology.hl7.org/v3/ActCode").setCode("FLD"); + case DAYTIME: return new org.hl7.fhir.r5.model.Coding().setSystem("http://terminology.hl7.org/v3/ActCode").setCode("SS"); + case VIRTUAL: return new org.hl7.fhir.r5.model.Coding().setSystem("http://terminology.hl7.org/v3/ActCode").setCode("VR"); + default: return null; + } + } + + public org.hl7.fhir.dstu2.model.Encounter.EncounterClass convertEncounterClass(org.hl7.fhir.r5.model.Coding src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + if (src.getSystem().equals("http://terminology.hl7.org/v3/ActCode")) { + if (src.getCode().equals("IMP")) return org.hl7.fhir.dstu2.model.Encounter.EncounterClass.INPATIENT; + if (src.getCode().equals("AMB")) return org.hl7.fhir.dstu2.model.Encounter.EncounterClass.AMBULATORY; + if (src.getCode().equals("EMER")) return org.hl7.fhir.dstu2.model.Encounter.EncounterClass.EMERGENCY; + if (src.getCode().equals("HH")) return org.hl7.fhir.dstu2.model.Encounter.EncounterClass.HOME; + if (src.getCode().equals("FLD")) return org.hl7.fhir.dstu2.model.Encounter.EncounterClass.FIELD; + if (src.getCode().equals("")) return org.hl7.fhir.dstu2.model.Encounter.EncounterClass.DAYTIME; + if (src.getCode().equals("VR")) return org.hl7.fhir.dstu2.model.Encounter.EncounterClass.VIRTUAL; + } + return org.hl7.fhir.dstu2.model.Encounter.EncounterClass.NULL; + } + +// public org.hl7.fhir.r5.model.Encounter.EncounterStatusHistoryComponent convertEncounterStatusHistoryComponent(org.hl7.fhir.dstu2.model.Encounter.EncounterStatusHistoryComponent src) throws FHIRException { +// if (src == null || src.isEmpty()) +// return null; +// org.hl7.fhir.r5.model.Encounter.EncounterStatusHistoryComponent tgt = new org.hl7.fhir.r5.model.Encounter.EncounterStatusHistoryComponent(); +// copyElement(src, tgt); +// tgt.setStatus(convertEncounterState(src.getStatus())); +// tgt.setPeriod(convertPeriod(src.getPeriod())); +// return tgt; +// } + +// public org.hl7.fhir.dstu2.model.Encounter.EncounterStatusHistoryComponent convertEncounterStatusHistoryComponent(org.hl7.fhir.r5.model.Encounter.EncounterStatusHistoryComponent src) throws FHIRException { +// if (src == null || src.isEmpty()) +// return null; +// org.hl7.fhir.dstu2.model.Encounter.EncounterStatusHistoryComponent tgt = new org.hl7.fhir.dstu2.model.Encounter.EncounterStatusHistoryComponent(); +// copyElement(src, tgt); +// tgt.setStatus(convertEncounterState(src.getStatus())); +// tgt.setPeriod(convertPeriod(src.getPeriod())); +// return tgt; +// } + + public org.hl7.fhir.r5.model.Encounter.EncounterParticipantComponent convertEncounterParticipantComponent(org.hl7.fhir.dstu2.model.Encounter.EncounterParticipantComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Encounter.EncounterParticipantComponent tgt = new org.hl7.fhir.r5.model.Encounter.EncounterParticipantComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getType()) + tgt.addType(convertCodeableConcept(t)); + tgt.setPeriod(convertPeriod(src.getPeriod())); + tgt.setIndividual(convertReference(src.getIndividual())); + return tgt; + } + + public org.hl7.fhir.dstu2.model.Encounter.EncounterParticipantComponent convertEncounterParticipantComponent(org.hl7.fhir.r5.model.Encounter.EncounterParticipantComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Encounter.EncounterParticipantComponent tgt = new org.hl7.fhir.dstu2.model.Encounter.EncounterParticipantComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getType()) + tgt.addType(convertCodeableConcept(t)); + tgt.setPeriod(convertPeriod(src.getPeriod())); + tgt.setIndividual(convertReference(src.getIndividual())); + return tgt; + } + + public org.hl7.fhir.r5.model.Encounter.EncounterHospitalizationComponent convertEncounterHospitalizationComponent(org.hl7.fhir.dstu2.model.Encounter.EncounterHospitalizationComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Encounter.EncounterHospitalizationComponent tgt = new org.hl7.fhir.r5.model.Encounter.EncounterHospitalizationComponent(); + copyElement(src, tgt); + tgt.setPreAdmissionIdentifier(convertIdentifier(src.getPreAdmissionIdentifier())); + tgt.setOrigin(convertReference(src.getOrigin())); + tgt.setAdmitSource(convertCodeableConcept(src.getAdmitSource())); + tgt.setReAdmission(convertCodeableConcept(src.getReAdmission())); + for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getDietPreference()) + tgt.addDietPreference(convertCodeableConcept(t)); + for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getSpecialCourtesy()) + tgt.addSpecialCourtesy(convertCodeableConcept(t)); + for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getSpecialArrangement()) + tgt.addSpecialArrangement(convertCodeableConcept(t)); + tgt.setDestination(convertReference(src.getDestination())); + tgt.setDischargeDisposition(convertCodeableConcept(src.getDischargeDisposition())); + return tgt; + } + + public org.hl7.fhir.dstu2.model.Encounter.EncounterHospitalizationComponent convertEncounterHospitalizationComponent(org.hl7.fhir.r5.model.Encounter.EncounterHospitalizationComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Encounter.EncounterHospitalizationComponent tgt = new org.hl7.fhir.dstu2.model.Encounter.EncounterHospitalizationComponent(); + copyElement(src, tgt); + tgt.setPreAdmissionIdentifier(convertIdentifier(src.getPreAdmissionIdentifier())); + tgt.setOrigin(convertReference(src.getOrigin())); + tgt.setAdmitSource(convertCodeableConcept(src.getAdmitSource())); + tgt.setReAdmission(convertCodeableConcept(src.getReAdmission())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getDietPreference()) + tgt.addDietPreference(convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getSpecialCourtesy()) + tgt.addSpecialCourtesy(convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getSpecialArrangement()) + tgt.addSpecialArrangement(convertCodeableConcept(t)); + tgt.setDestination(convertReference(src.getDestination())); + tgt.setDischargeDisposition(convertCodeableConcept(src.getDischargeDisposition())); + return tgt; + } + + public org.hl7.fhir.r5.model.Encounter.EncounterLocationComponent convertEncounterLocationComponent(org.hl7.fhir.dstu2.model.Encounter.EncounterLocationComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Encounter.EncounterLocationComponent tgt = new org.hl7.fhir.r5.model.Encounter.EncounterLocationComponent(); + copyElement(src, tgt); + tgt.setLocation(convertReference(src.getLocation())); + tgt.setStatus(convertEncounterLocationStatus(src.getStatus())); + tgt.setPeriod(convertPeriod(src.getPeriod())); + return tgt; + } + + public org.hl7.fhir.dstu2.model.Encounter.EncounterLocationComponent convertEncounterLocationComponent(org.hl7.fhir.r5.model.Encounter.EncounterLocationComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Encounter.EncounterLocationComponent tgt = new org.hl7.fhir.dstu2.model.Encounter.EncounterLocationComponent(); + copyElement(src, tgt); + tgt.setLocation(convertReference(src.getLocation())); + tgt.setStatus(convertEncounterLocationStatus(src.getStatus())); + tgt.setPeriod(convertPeriod(src.getPeriod())); + return tgt; + } + + public org.hl7.fhir.r5.model.Encounter.EncounterLocationStatus convertEncounterLocationStatus(org.hl7.fhir.dstu2.model.Encounter.EncounterLocationStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PLANNED: return org.hl7.fhir.r5.model.Encounter.EncounterLocationStatus.PLANNED; + case ACTIVE: return org.hl7.fhir.r5.model.Encounter.EncounterLocationStatus.ACTIVE; + case RESERVED: return org.hl7.fhir.r5.model.Encounter.EncounterLocationStatus.RESERVED; + case COMPLETED: return org.hl7.fhir.r5.model.Encounter.EncounterLocationStatus.COMPLETED; + default: return org.hl7.fhir.r5.model.Encounter.EncounterLocationStatus.NULL; + } + } + + public org.hl7.fhir.dstu2.model.Encounter.EncounterLocationStatus convertEncounterLocationStatus(org.hl7.fhir.r5.model.Encounter.EncounterLocationStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PLANNED: return org.hl7.fhir.dstu2.model.Encounter.EncounterLocationStatus.PLANNED; + case ACTIVE: return org.hl7.fhir.dstu2.model.Encounter.EncounterLocationStatus.ACTIVE; + case RESERVED: return org.hl7.fhir.dstu2.model.Encounter.EncounterLocationStatus.RESERVED; + case COMPLETED: return org.hl7.fhir.dstu2.model.Encounter.EncounterLocationStatus.COMPLETED; + default: return org.hl7.fhir.dstu2.model.Encounter.EncounterLocationStatus.NULL; + } + } + + public org.hl7.fhir.r5.model.EnrollmentRequest convertEnrollmentRequest(org.hl7.fhir.dstu2.model.EnrollmentRequest src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.EnrollmentRequest tgt = new org.hl7.fhir.r5.model.EnrollmentRequest(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + tgt.setCreated(src.getCreated()); +// tgt.setTarget(convertReference(src.getTarget())); + tgt.setProvider(convertReference(src.getProvider())); +// tgt.setOrganization(convertReference(src.getOrganization())); + tgt.setCandidate(convertReference(src.getSubject())); + tgt.setCoverage(convertReference(src.getCoverage())); +// tgt.setRelationship(convertCoding(src.getRelationship())); + return tgt; + } + + public org.hl7.fhir.dstu2.model.EnrollmentRequest convertEnrollmentRequest(org.hl7.fhir.r5.model.EnrollmentRequest src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.EnrollmentRequest tgt = new org.hl7.fhir.dstu2.model.EnrollmentRequest(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + tgt.setCreated(src.getCreated()); +// tgt.setTarget(convertReference(src.getTarget())); +// tgt.setProvider(convertReference(src.getProvider())); +// tgt.setOrganization(convertReference(src.getOrganization())); +// tgt.setSubject(convertReference(src.getSubject())); + tgt.setCoverage(convertReference(src.getCoverage())); +// tgt.setRelationship(convertCoding(src.getRelationship())); + return tgt; + } + + public org.hl7.fhir.r5.model.EnrollmentResponse convertEnrollmentResponse(org.hl7.fhir.dstu2.model.EnrollmentResponse src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.EnrollmentResponse tgt = new org.hl7.fhir.r5.model.EnrollmentResponse(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + tgt.setRequest(convertReference(src.getRequest())); +// tgt.setOutcome(convertRemittanceOutcome(src.getOutcome())); + tgt.setDisposition(src.getDisposition()); + tgt.setCreated(src.getCreated()); + tgt.setOrganization(convertReference(src.getOrganization())); + tgt.setRequestProvider(convertReference(src.getRequestProvider())); +// tgt.setRequestOrganization(convertReference(src.getRequestOrganization())); + return tgt; + } + + public org.hl7.fhir.dstu2.model.EnrollmentResponse convertEnrollmentResponse(org.hl7.fhir.r5.model.EnrollmentResponse src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.EnrollmentResponse tgt = new org.hl7.fhir.dstu2.model.EnrollmentResponse(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); +// tgt.setRequest(convertReference(src.getRequestReference())); +// tgt.setOutcome(convertRemittanceOutcome(src.getOutcome())); + tgt.setDisposition(src.getDisposition()); + tgt.setCreated(src.getCreated()); +// tgt.setOrganization(convertReference(src.getOrganizationReference())); +// tgt.setRequestProvider(convertReference(src.getRequestProviderReference())); +// tgt.setRequestOrganization(convertReference(src.getRequestOrganizationReference())); + return tgt; + } + + public org.hl7.fhir.r5.model.EpisodeOfCare convertEpisodeOfCare(org.hl7.fhir.dstu2.model.EpisodeOfCare src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.EpisodeOfCare tgt = new org.hl7.fhir.r5.model.EpisodeOfCare(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + tgt.setStatus(convertEpisodeOfCareStatus(src.getStatus())); + for (org.hl7.fhir.dstu2.model.EpisodeOfCare.EpisodeOfCareStatusHistoryComponent t : src.getStatusHistory()) + tgt.addStatusHistory(convertEpisodeOfCareStatusHistoryComponent(t)); + for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getType()) + tgt.addType(convertCodeableConcept(t)); + tgt.setPatient(convertReference(src.getPatient())); + tgt.setManagingOrganization(convertReference(src.getManagingOrganization())); + tgt.setPeriod(convertPeriod(src.getPeriod())); + for (org.hl7.fhir.dstu2.model.Reference t : src.getReferralRequest()) + tgt.addReferralRequest(convertReference(t)); + tgt.setCareManager(convertReference(src.getCareManager())); + return tgt; + } + + public org.hl7.fhir.dstu2.model.EpisodeOfCare convertEpisodeOfCare(org.hl7.fhir.r5.model.EpisodeOfCare src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.EpisodeOfCare tgt = new org.hl7.fhir.dstu2.model.EpisodeOfCare(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + tgt.setStatus(convertEpisodeOfCareStatus(src.getStatus())); + for (org.hl7.fhir.r5.model.EpisodeOfCare.EpisodeOfCareStatusHistoryComponent t : src.getStatusHistory()) + tgt.addStatusHistory(convertEpisodeOfCareStatusHistoryComponent(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getType()) + tgt.addType(convertCodeableConcept(t)); + tgt.setPatient(convertReference(src.getPatient())); + tgt.setManagingOrganization(convertReference(src.getManagingOrganization())); + tgt.setPeriod(convertPeriod(src.getPeriod())); + for (org.hl7.fhir.r5.model.Reference t : src.getReferralRequest()) + tgt.addReferralRequest(convertReference(t)); + tgt.setCareManager(convertReference(src.getCareManager())); + return tgt; + } + + public org.hl7.fhir.r5.model.EpisodeOfCare.EpisodeOfCareStatus convertEpisodeOfCareStatus(org.hl7.fhir.dstu2.model.EpisodeOfCare.EpisodeOfCareStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PLANNED: return org.hl7.fhir.r5.model.EpisodeOfCare.EpisodeOfCareStatus.PLANNED; + case WAITLIST: return org.hl7.fhir.r5.model.EpisodeOfCare.EpisodeOfCareStatus.WAITLIST; + case ACTIVE: return org.hl7.fhir.r5.model.EpisodeOfCare.EpisodeOfCareStatus.ACTIVE; + case ONHOLD: return org.hl7.fhir.r5.model.EpisodeOfCare.EpisodeOfCareStatus.ONHOLD; + case FINISHED: return org.hl7.fhir.r5.model.EpisodeOfCare.EpisodeOfCareStatus.FINISHED; + case CANCELLED: return org.hl7.fhir.r5.model.EpisodeOfCare.EpisodeOfCareStatus.CANCELLED; + default: return org.hl7.fhir.r5.model.EpisodeOfCare.EpisodeOfCareStatus.NULL; + } + } + + public org.hl7.fhir.dstu2.model.EpisodeOfCare.EpisodeOfCareStatus convertEpisodeOfCareStatus(org.hl7.fhir.r5.model.EpisodeOfCare.EpisodeOfCareStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PLANNED: return org.hl7.fhir.dstu2.model.EpisodeOfCare.EpisodeOfCareStatus.PLANNED; + case WAITLIST: return org.hl7.fhir.dstu2.model.EpisodeOfCare.EpisodeOfCareStatus.WAITLIST; + case ACTIVE: return org.hl7.fhir.dstu2.model.EpisodeOfCare.EpisodeOfCareStatus.ACTIVE; + case ONHOLD: return org.hl7.fhir.dstu2.model.EpisodeOfCare.EpisodeOfCareStatus.ONHOLD; + case FINISHED: return org.hl7.fhir.dstu2.model.EpisodeOfCare.EpisodeOfCareStatus.FINISHED; + case CANCELLED: return org.hl7.fhir.dstu2.model.EpisodeOfCare.EpisodeOfCareStatus.CANCELLED; + default: return org.hl7.fhir.dstu2.model.EpisodeOfCare.EpisodeOfCareStatus.NULL; + } + } + + public org.hl7.fhir.r5.model.EpisodeOfCare.EpisodeOfCareStatusHistoryComponent convertEpisodeOfCareStatusHistoryComponent(org.hl7.fhir.dstu2.model.EpisodeOfCare.EpisodeOfCareStatusHistoryComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.EpisodeOfCare.EpisodeOfCareStatusHistoryComponent tgt = new org.hl7.fhir.r5.model.EpisodeOfCare.EpisodeOfCareStatusHistoryComponent(); + copyElement(src, tgt); + tgt.setStatus(convertEpisodeOfCareStatus(src.getStatus())); + tgt.setPeriod(convertPeriod(src.getPeriod())); + return tgt; + } + + public org.hl7.fhir.dstu2.model.EpisodeOfCare.EpisodeOfCareStatusHistoryComponent convertEpisodeOfCareStatusHistoryComponent(org.hl7.fhir.r5.model.EpisodeOfCare.EpisodeOfCareStatusHistoryComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.EpisodeOfCare.EpisodeOfCareStatusHistoryComponent tgt = new org.hl7.fhir.dstu2.model.EpisodeOfCare.EpisodeOfCareStatusHistoryComponent(); + copyElement(src, tgt); + tgt.setStatus(convertEpisodeOfCareStatus(src.getStatus())); + tgt.setPeriod(convertPeriod(src.getPeriod())); + return tgt; + } + + + public org.hl7.fhir.r5.model.FamilyMemberHistory convertFamilyMemberHistory(org.hl7.fhir.dstu2.model.FamilyMemberHistory src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.FamilyMemberHistory tgt = new org.hl7.fhir.r5.model.FamilyMemberHistory(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + tgt.setPatient(convertReference(src.getPatient())); + if (src.hasDate()) + tgt.setDate(src.getDate()); + tgt.setStatus(convertFamilyHistoryStatus(src.getStatus())); + tgt.setName(src.getName()); + tgt.setRelationship(convertCodeableConcept(src.getRelationship())); +// tgt.setGender(convertAdministrativeGender(src.getGender())); + tgt.setBorn(convertType(src.getBorn())); + tgt.setAge(convertType(src.getAge())); + tgt.setDeceased(convertType(src.getDeceased())); +// tgt.setNote(convertAnnotation(src.getNote())); + for (org.hl7.fhir.dstu2.model.FamilyMemberHistory.FamilyMemberHistoryConditionComponent t : src.getCondition()) + tgt.addCondition(convertFamilyMemberHistoryConditionComponent(t)); + return tgt; + } + + public org.hl7.fhir.dstu2.model.FamilyMemberHistory convertFamilyMemberHistory(org.hl7.fhir.r5.model.FamilyMemberHistory src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.FamilyMemberHistory tgt = new org.hl7.fhir.dstu2.model.FamilyMemberHistory(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + tgt.setPatient(convertReference(src.getPatient())); + if (src.hasDate()) + tgt.setDate(src.getDate()); + tgt.setStatus(convertFamilyHistoryStatus(src.getStatus())); + tgt.setName(src.getName()); + tgt.setRelationship(convertCodeableConcept(src.getRelationship())); +// tgt.setGender(convertAdministrativeGender(src.getGender())); + tgt.setBorn(convertType(src.getBorn())); + tgt.setAge(convertType(src.getAge())); + tgt.setDeceased(convertType(src.getDeceased())); +// tgt.setNote(convertAnnotation(src.getNote())); + for (org.hl7.fhir.r5.model.FamilyMemberHistory.FamilyMemberHistoryConditionComponent t : src.getCondition()) + tgt.addCondition(convertFamilyMemberHistoryConditionComponent(t)); + return tgt; + } + + public org.hl7.fhir.r5.model.FamilyMemberHistory.FamilyHistoryStatus convertFamilyHistoryStatus(org.hl7.fhir.dstu2.model.FamilyMemberHistory.FamilyHistoryStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PARTIAL: return org.hl7.fhir.r5.model.FamilyMemberHistory.FamilyHistoryStatus.PARTIAL; + case COMPLETED: return org.hl7.fhir.r5.model.FamilyMemberHistory.FamilyHistoryStatus.COMPLETED; + case ENTEREDINERROR: return org.hl7.fhir.r5.model.FamilyMemberHistory.FamilyHistoryStatus.ENTEREDINERROR; + case HEALTHUNKNOWN: return org.hl7.fhir.r5.model.FamilyMemberHistory.FamilyHistoryStatus.HEALTHUNKNOWN; + default: return org.hl7.fhir.r5.model.FamilyMemberHistory.FamilyHistoryStatus.NULL; + } + } + + public org.hl7.fhir.dstu2.model.FamilyMemberHistory.FamilyHistoryStatus convertFamilyHistoryStatus(org.hl7.fhir.r5.model.FamilyMemberHistory.FamilyHistoryStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PARTIAL: return org.hl7.fhir.dstu2.model.FamilyMemberHistory.FamilyHistoryStatus.PARTIAL; + case COMPLETED: return org.hl7.fhir.dstu2.model.FamilyMemberHistory.FamilyHistoryStatus.COMPLETED; + case ENTEREDINERROR: return org.hl7.fhir.dstu2.model.FamilyMemberHistory.FamilyHistoryStatus.ENTEREDINERROR; + case HEALTHUNKNOWN: return org.hl7.fhir.dstu2.model.FamilyMemberHistory.FamilyHistoryStatus.HEALTHUNKNOWN; + default: return org.hl7.fhir.dstu2.model.FamilyMemberHistory.FamilyHistoryStatus.NULL; + } + } + + public org.hl7.fhir.r5.model.FamilyMemberHistory.FamilyMemberHistoryConditionComponent convertFamilyMemberHistoryConditionComponent(org.hl7.fhir.dstu2.model.FamilyMemberHistory.FamilyMemberHistoryConditionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.FamilyMemberHistory.FamilyMemberHistoryConditionComponent tgt = new org.hl7.fhir.r5.model.FamilyMemberHistory.FamilyMemberHistoryConditionComponent(); + copyElement(src, tgt); + tgt.setCode(convertCodeableConcept(src.getCode())); + tgt.setOutcome(convertCodeableConcept(src.getOutcome())); + tgt.setOnset(convertType(src.getOnset())); +// tgt.setNote(convertAnnotation(src.getNote())); + return tgt; + } + + public org.hl7.fhir.dstu2.model.FamilyMemberHistory.FamilyMemberHistoryConditionComponent convertFamilyMemberHistoryConditionComponent(org.hl7.fhir.r5.model.FamilyMemberHistory.FamilyMemberHistoryConditionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.FamilyMemberHistory.FamilyMemberHistoryConditionComponent tgt = new org.hl7.fhir.dstu2.model.FamilyMemberHistory.FamilyMemberHistoryConditionComponent(); + copyElement(src, tgt); + tgt.setCode(convertCodeableConcept(src.getCode())); + tgt.setOutcome(convertCodeableConcept(src.getOutcome())); + tgt.setOnset(convertType(src.getOnset())); +// tgt.setNote(convertAnnotation(src.getNote())); + return tgt; + } + + public org.hl7.fhir.r5.model.Flag convertFlag(org.hl7.fhir.dstu2.model.Flag src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Flag tgt = new org.hl7.fhir.r5.model.Flag(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + tgt.addCategory(convertCodeableConcept(src.getCategory())); + tgt.setStatus(convertFlagStatus(src.getStatus())); + tgt.setPeriod(convertPeriod(src.getPeriod())); + tgt.setSubject(convertReference(src.getSubject())); + tgt.setEncounter(convertReference(src.getEncounter())); + tgt.setAuthor(convertReference(src.getAuthor())); + tgt.setCode(convertCodeableConcept(src.getCode())); + return tgt; + } + + public org.hl7.fhir.dstu2.model.Flag convertFlag(org.hl7.fhir.r5.model.Flag src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Flag tgt = new org.hl7.fhir.dstu2.model.Flag(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + tgt.setCategory(convertCodeableConcept(src.getCategoryFirstRep())); + tgt.setStatus(convertFlagStatus(src.getStatus())); + tgt.setPeriod(convertPeriod(src.getPeriod())); + tgt.setSubject(convertReference(src.getSubject())); + tgt.setEncounter(convertReference(src.getEncounter())); + tgt.setAuthor(convertReference(src.getAuthor())); + tgt.setCode(convertCodeableConcept(src.getCode())); + return tgt; + } + + public org.hl7.fhir.r5.model.Flag.FlagStatus convertFlagStatus(org.hl7.fhir.dstu2.model.Flag.FlagStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case ACTIVE: return org.hl7.fhir.r5.model.Flag.FlagStatus.ACTIVE; + case INACTIVE: return org.hl7.fhir.r5.model.Flag.FlagStatus.INACTIVE; + case ENTEREDINERROR: return org.hl7.fhir.r5.model.Flag.FlagStatus.ENTEREDINERROR; + default: return org.hl7.fhir.r5.model.Flag.FlagStatus.NULL; + } + } + + public org.hl7.fhir.dstu2.model.Flag.FlagStatus convertFlagStatus(org.hl7.fhir.r5.model.Flag.FlagStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case ACTIVE: return org.hl7.fhir.dstu2.model.Flag.FlagStatus.ACTIVE; + case INACTIVE: return org.hl7.fhir.dstu2.model.Flag.FlagStatus.INACTIVE; + case ENTEREDINERROR: return org.hl7.fhir.dstu2.model.Flag.FlagStatus.ENTEREDINERROR; + default: return org.hl7.fhir.dstu2.model.Flag.FlagStatus.NULL; + } + } + + public org.hl7.fhir.r5.model.Group convertGroup(org.hl7.fhir.dstu2.model.Group src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Group tgt = new org.hl7.fhir.r5.model.Group(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + tgt.setType(convertGroupType(src.getType())); + tgt.setActual(src.getActual()); + tgt.setCode(convertCodeableConcept(src.getCode())); + tgt.setName(src.getName()); + tgt.setQuantity(src.getQuantity()); + for (org.hl7.fhir.dstu2.model.Group.GroupCharacteristicComponent t : src.getCharacteristic()) + tgt.addCharacteristic(convertGroupCharacteristicComponent(t)); + for (org.hl7.fhir.dstu2.model.Group.GroupMemberComponent t : src.getMember()) + tgt.addMember(convertGroupMemberComponent(t)); + return tgt; + } + + public org.hl7.fhir.dstu2.model.Group convertGroup(org.hl7.fhir.r5.model.Group src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Group tgt = new org.hl7.fhir.dstu2.model.Group(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + tgt.setType(convertGroupType(src.getType())); + tgt.setActual(src.getActual()); + tgt.setCode(convertCodeableConcept(src.getCode())); + tgt.setName(src.getName()); + tgt.setQuantity(src.getQuantity()); + for (org.hl7.fhir.r5.model.Group.GroupCharacteristicComponent t : src.getCharacteristic()) + tgt.addCharacteristic(convertGroupCharacteristicComponent(t)); + for (org.hl7.fhir.r5.model.Group.GroupMemberComponent t : src.getMember()) + tgt.addMember(convertGroupMemberComponent(t)); + return tgt; + } + + public org.hl7.fhir.r5.model.Group.GroupType convertGroupType(org.hl7.fhir.dstu2.model.Group.GroupType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PERSON: return org.hl7.fhir.r5.model.Group.GroupType.PERSON; + case ANIMAL: return org.hl7.fhir.r5.model.Group.GroupType.ANIMAL; + case PRACTITIONER: return org.hl7.fhir.r5.model.Group.GroupType.PRACTITIONER; + case DEVICE: return org.hl7.fhir.r5.model.Group.GroupType.DEVICE; + case MEDICATION: return org.hl7.fhir.r5.model.Group.GroupType.MEDICATION; + case SUBSTANCE: return org.hl7.fhir.r5.model.Group.GroupType.SUBSTANCE; + default: return org.hl7.fhir.r5.model.Group.GroupType.NULL; + } + } + + public org.hl7.fhir.dstu2.model.Group.GroupType convertGroupType(org.hl7.fhir.r5.model.Group.GroupType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PERSON: return org.hl7.fhir.dstu2.model.Group.GroupType.PERSON; + case ANIMAL: return org.hl7.fhir.dstu2.model.Group.GroupType.ANIMAL; + case PRACTITIONER: return org.hl7.fhir.dstu2.model.Group.GroupType.PRACTITIONER; + case DEVICE: return org.hl7.fhir.dstu2.model.Group.GroupType.DEVICE; + case MEDICATION: return org.hl7.fhir.dstu2.model.Group.GroupType.MEDICATION; + case SUBSTANCE: return org.hl7.fhir.dstu2.model.Group.GroupType.SUBSTANCE; + default: return org.hl7.fhir.dstu2.model.Group.GroupType.NULL; + } + } + + public org.hl7.fhir.r5.model.Group.GroupCharacteristicComponent convertGroupCharacteristicComponent(org.hl7.fhir.dstu2.model.Group.GroupCharacteristicComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Group.GroupCharacteristicComponent tgt = new org.hl7.fhir.r5.model.Group.GroupCharacteristicComponent(); + copyElement(src, tgt); + tgt.setCode(convertCodeableConcept(src.getCode())); + tgt.setValue(convertType(src.getValue())); + tgt.setExclude(src.getExclude()); + tgt.setPeriod(convertPeriod(src.getPeriod())); + return tgt; + } + + public org.hl7.fhir.dstu2.model.Group.GroupCharacteristicComponent convertGroupCharacteristicComponent(org.hl7.fhir.r5.model.Group.GroupCharacteristicComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Group.GroupCharacteristicComponent tgt = new org.hl7.fhir.dstu2.model.Group.GroupCharacteristicComponent(); + copyElement(src, tgt); + tgt.setCode(convertCodeableConcept(src.getCode())); + tgt.setValue(convertType(src.getValue())); + tgt.setExclude(src.getExclude()); + tgt.setPeriod(convertPeriod(src.getPeriod())); + return tgt; + } + + public org.hl7.fhir.r5.model.Group.GroupMemberComponent convertGroupMemberComponent(org.hl7.fhir.dstu2.model.Group.GroupMemberComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Group.GroupMemberComponent tgt = new org.hl7.fhir.r5.model.Group.GroupMemberComponent(); + copyElement(src, tgt); + tgt.setEntity(convertReference(src.getEntity())); + tgt.setPeriod(convertPeriod(src.getPeriod())); + tgt.setInactive(src.getInactive()); + return tgt; + } + + public org.hl7.fhir.dstu2.model.Group.GroupMemberComponent convertGroupMemberComponent(org.hl7.fhir.r5.model.Group.GroupMemberComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Group.GroupMemberComponent tgt = new org.hl7.fhir.dstu2.model.Group.GroupMemberComponent(); + copyElement(src, tgt); + tgt.setEntity(convertReference(src.getEntity())); + tgt.setPeriod(convertPeriod(src.getPeriod())); + tgt.setInactive(src.getInactive()); + return tgt; + } + + public org.hl7.fhir.r5.model.HealthcareService convertHealthcareService(org.hl7.fhir.dstu2.model.HealthcareService src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.HealthcareService tgt = new org.hl7.fhir.r5.model.HealthcareService(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + tgt.setProvidedBy(convertReference(src.getProvidedBy())); +// tgt.setServiceCategory(convertCodeableConcept(src.getServiceCategory())); + for (org.hl7.fhir.dstu2.model.HealthcareService.ServiceTypeComponent t : src.getServiceType()) { +// if (t.hasType()) +// tgt.addServiceType(convertCodeableConcept(t.getType())); + for (org.hl7.fhir.dstu2.model.CodeableConcept tj : t.getSpecialty()) + tgt.addSpecialty(convertCodeableConcept(tj)); + } + tgt.addLocation(convertReference(src.getLocation())); +// tgt.setServiceName(src.getServiceName()); + tgt.setComment(src.getComment()); + tgt.setExtraDetails(src.getExtraDetails()); + tgt.setPhoto(convertAttachment(src.getPhoto())); + for (org.hl7.fhir.dstu2.model.ContactPoint t : src.getTelecom()) + tgt.addTelecom(convertContactPoint(t)); + for (org.hl7.fhir.dstu2.model.Reference t : src.getCoverageArea()) + tgt.addCoverageArea(convertReference(t)); + for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getServiceProvisionCode()) + tgt.addServiceProvisionCode(convertCodeableConcept(t)); + if (src.hasEligibility()) + tgt.getEligibilityFirstRep().setCode(convertCodeableConcept(src.getEligibility())); + if (src.hasEligibilityNote()) + tgt.getEligibilityFirstRep().setComment(src.getEligibilityNote()); + for (org.hl7.fhir.dstu2.model.StringType t : src.getProgramName()) + tgt.addProgram().setText(t.getValue()); + for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getCharacteristic()) + tgt.addCharacteristic(convertCodeableConcept(t)); + for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getReferralMethod()) + tgt.addReferralMethod(convertCodeableConcept(t)); +// tgt.setPublicKey(src.getPublicKey()); + tgt.setAppointmentRequired(src.getAppointmentRequired()); + for (org.hl7.fhir.dstu2.model.HealthcareService.HealthcareServiceAvailableTimeComponent t : src.getAvailableTime()) + tgt.addAvailableTime(convertHealthcareServiceAvailableTimeComponent(t)); + for (org.hl7.fhir.dstu2.model.HealthcareService.HealthcareServiceNotAvailableComponent t : src.getNotAvailable()) + tgt.addNotAvailable(convertHealthcareServiceNotAvailableComponent(t)); + tgt.setAvailabilityExceptions(src.getAvailabilityExceptions()); + return tgt; + } + + public org.hl7.fhir.dstu2.model.HealthcareService convertHealthcareService(org.hl7.fhir.r5.model.HealthcareService src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.HealthcareService tgt = new org.hl7.fhir.dstu2.model.HealthcareService(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + tgt.setProvidedBy(convertReference(src.getProvidedBy())); +// tgt.setServiceCategory(convertCodeableConcept(src.getServiceCategory())); +// for (org.hl7.fhir.r5.model.CodeableConcept t : src.getServiceType()) +// tgt.addServiceType().setType(convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getSpecialty()) { + if (!tgt.hasServiceType()) + tgt.addServiceType(); + tgt.getServiceType().get(0).addSpecialty(convertCodeableConcept(t)); + } + for (org.hl7.fhir.r5.model.Reference t : src.getLocation()) + tgt.setLocation(convertReference(t)); +// tgt.setServiceName(src.getServiceName()); + tgt.setComment(src.getComment()); + tgt.setExtraDetails(src.getExtraDetails()); + tgt.setPhoto(convertAttachment(src.getPhoto())); + for (org.hl7.fhir.r5.model.ContactPoint t : src.getTelecom()) + tgt.addTelecom(convertContactPoint(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getCoverageArea()) + tgt.addCoverageArea(convertReference(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getServiceProvisionCode()) + tgt.addServiceProvisionCode(convertCodeableConcept(t)); + tgt.setEligibility(convertCodeableConcept(src.getEligibilityFirstRep().getCode())); + tgt.setEligibilityNote(src.getEligibilityFirstRep().getComment()); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getProgram()) + if (t.hasText()) + tgt.addProgramName(t.getText()); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getCharacteristic()) + tgt.addCharacteristic(convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getReferralMethod()) + tgt.addReferralMethod(convertCodeableConcept(t)); +// tgt.setPublicKey(src.getPublicKey()); + tgt.setAppointmentRequired(src.getAppointmentRequired()); + for (org.hl7.fhir.r5.model.HealthcareService.HealthcareServiceAvailableTimeComponent t : src.getAvailableTime()) + tgt.addAvailableTime(convertHealthcareServiceAvailableTimeComponent(t)); + for (org.hl7.fhir.r5.model.HealthcareService.HealthcareServiceNotAvailableComponent t : src.getNotAvailable()) + tgt.addNotAvailable(convertHealthcareServiceNotAvailableComponent(t)); + tgt.setAvailabilityExceptions(src.getAvailabilityExceptions()); + return tgt; + } + + public org.hl7.fhir.r5.model.HealthcareService.HealthcareServiceAvailableTimeComponent convertHealthcareServiceAvailableTimeComponent(org.hl7.fhir.dstu2.model.HealthcareService.HealthcareServiceAvailableTimeComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.HealthcareService.HealthcareServiceAvailableTimeComponent tgt = new org.hl7.fhir.r5.model.HealthcareService.HealthcareServiceAvailableTimeComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.dstu2.model.Enumeration t : src.getDaysOfWeek()) + tgt.addDaysOfWeek(convertDaysOfWeek(t.getValue())); + tgt.setAllDay(src.getAllDay()); + tgt.setAvailableStartTime(src.getAvailableStartTime()); + tgt.setAvailableEndTime(src.getAvailableEndTime()); + return tgt; + } + + public org.hl7.fhir.dstu2.model.HealthcareService.HealthcareServiceAvailableTimeComponent convertHealthcareServiceAvailableTimeComponent(org.hl7.fhir.r5.model.HealthcareService.HealthcareServiceAvailableTimeComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.HealthcareService.HealthcareServiceAvailableTimeComponent tgt = new org.hl7.fhir.dstu2.model.HealthcareService.HealthcareServiceAvailableTimeComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.r5.model.Enumeration t : src.getDaysOfWeek()) + tgt.addDaysOfWeek(convertDaysOfWeek(t.getValue())); + tgt.setAllDay(src.getAllDay()); + tgt.setAvailableStartTime(src.getAvailableStartTime()); + tgt.setAvailableEndTime(src.getAvailableEndTime()); + return tgt; + } + + public org.hl7.fhir.r5.model.HealthcareService.DaysOfWeek convertDaysOfWeek(org.hl7.fhir.dstu2.model.HealthcareService.DaysOfWeek src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case MON: return org.hl7.fhir.r5.model.HealthcareService.DaysOfWeek.MON; + case TUE: return org.hl7.fhir.r5.model.HealthcareService.DaysOfWeek.TUE; + case WED: return org.hl7.fhir.r5.model.HealthcareService.DaysOfWeek.WED; + case THU: return org.hl7.fhir.r5.model.HealthcareService.DaysOfWeek.THU; + case FRI: return org.hl7.fhir.r5.model.HealthcareService.DaysOfWeek.FRI; + case SAT: return org.hl7.fhir.r5.model.HealthcareService.DaysOfWeek.SAT; + case SUN: return org.hl7.fhir.r5.model.HealthcareService.DaysOfWeek.SUN; + default: return org.hl7.fhir.r5.model.HealthcareService.DaysOfWeek.NULL; + } + } + + public org.hl7.fhir.dstu2.model.HealthcareService.DaysOfWeek convertDaysOfWeek(org.hl7.fhir.r5.model.HealthcareService.DaysOfWeek src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case MON: return org.hl7.fhir.dstu2.model.HealthcareService.DaysOfWeek.MON; + case TUE: return org.hl7.fhir.dstu2.model.HealthcareService.DaysOfWeek.TUE; + case WED: return org.hl7.fhir.dstu2.model.HealthcareService.DaysOfWeek.WED; + case THU: return org.hl7.fhir.dstu2.model.HealthcareService.DaysOfWeek.THU; + case FRI: return org.hl7.fhir.dstu2.model.HealthcareService.DaysOfWeek.FRI; + case SAT: return org.hl7.fhir.dstu2.model.HealthcareService.DaysOfWeek.SAT; + case SUN: return org.hl7.fhir.dstu2.model.HealthcareService.DaysOfWeek.SUN; + default: return org.hl7.fhir.dstu2.model.HealthcareService.DaysOfWeek.NULL; + } + } + + public org.hl7.fhir.r5.model.HealthcareService.HealthcareServiceNotAvailableComponent convertHealthcareServiceNotAvailableComponent(org.hl7.fhir.dstu2.model.HealthcareService.HealthcareServiceNotAvailableComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.HealthcareService.HealthcareServiceNotAvailableComponent tgt = new org.hl7.fhir.r5.model.HealthcareService.HealthcareServiceNotAvailableComponent(); + copyElement(src, tgt); + tgt.setDescription(src.getDescription()); + tgt.setDuring(convertPeriod(src.getDuring())); + return tgt; + } + + public org.hl7.fhir.dstu2.model.HealthcareService.HealthcareServiceNotAvailableComponent convertHealthcareServiceNotAvailableComponent(org.hl7.fhir.r5.model.HealthcareService.HealthcareServiceNotAvailableComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.HealthcareService.HealthcareServiceNotAvailableComponent tgt = new org.hl7.fhir.dstu2.model.HealthcareService.HealthcareServiceNotAvailableComponent(); + copyElement(src, tgt); + tgt.setDescription(src.getDescription()); + tgt.setDuring(convertPeriod(src.getDuring())); + return tgt; + } + +// public org.hl7.fhir.r5.model.ImagingObjectSelection convertImagingObjectSelection(org.hl7.fhir.dstu2.model.ImagingObjectSelection src) throws FHIRException { +// if (src == null || src.isEmpty()) +// return null; +// org.hl7.fhir.r5.model.ImagingObjectSelection tgt = new org.hl7.fhir.r5.model.ImagingObjectSelection(); +// copyDomainResource(src, tgt); +// tgt.setUid(src.getUid()); +// tgt.setPatient(convertReference(src.getPatient())); +// tgt.setAuthoringTime(src.getAuthoringTime()); +// tgt.setAuthor(convertReference(src.getAuthor())); +// tgt.setTitle(convertCodeableConcept(src.getTitle())); +// tgt.setDescription(src.getDescription()); +// for (org.hl7.fhir.dstu2.model.ImagingObjectSelection.StudyComponent t : src.getStudy()) +// tgt.addStudy(convertStudyComponent(t)); +// return tgt; +// } +// +// public org.hl7.fhir.dstu2.model.ImagingObjectSelection convertImagingObjectSelection(org.hl7.fhir.r5.model.ImagingObjectSelection src) throws FHIRException { +// if (src == null || src.isEmpty()) +// return null; +// org.hl7.fhir.dstu2.model.ImagingObjectSelection tgt = new org.hl7.fhir.dstu2.model.ImagingObjectSelection(); +// copyDomainResource(src, tgt); +// tgt.setUid(src.getUid()); +// tgt.setPatient(convertReference(src.getPatient())); +// tgt.setAuthoringTime(src.getAuthoringTime()); +// tgt.setAuthor(convertReference(src.getAuthor())); +// tgt.setTitle(convertCodeableConcept(src.getTitle())); +// tgt.setDescription(src.getDescription()); +// for (org.hl7.fhir.r5.model.ImagingObjectSelection.StudyComponent t : src.getStudy()) +// tgt.addStudy(convertStudyComponent(t)); +// return tgt; +// } +// +// public org.hl7.fhir.r5.model.ImagingObjectSelection.StudyComponent convertStudyComponent(org.hl7.fhir.dstu2.model.ImagingObjectSelection.StudyComponent src) throws FHIRException { +// if (src == null || src.isEmpty()) +// return null; +// org.hl7.fhir.r5.model.ImagingObjectSelection.StudyComponent tgt = new org.hl7.fhir.r5.model.ImagingObjectSelection.StudyComponent(); +// copyElement(src, tgt); +// tgt.setUid(src.getUid()); +// tgt.setUrl(src.getUrl()); +// tgt.setImagingStudy(convertReference(src.getImagingStudy())); +// for (org.hl7.fhir.dstu2.model.ImagingObjectSelection.SeriesComponent t : src.getSeries()) +// tgt.addSeries(convertSeriesComponent(t)); +// return tgt; +// } +// +// public org.hl7.fhir.dstu2.model.ImagingObjectSelection.StudyComponent convertStudyComponent(org.hl7.fhir.r5.model.ImagingObjectSelection.StudyComponent src) throws FHIRException { +// if (src == null || src.isEmpty()) +// return null; +// org.hl7.fhir.dstu2.model.ImagingObjectSelection.StudyComponent tgt = new org.hl7.fhir.dstu2.model.ImagingObjectSelection.StudyComponent(); +// copyElement(src, tgt); +// tgt.setUid(src.getUid()); +// tgt.setUrl(src.getUrl()); +// tgt.setImagingStudy(convertReference(src.getImagingStudy())); +// for (org.hl7.fhir.r5.model.ImagingObjectSelection.SeriesComponent t : src.getSeries()) +// tgt.addSeries(convertSeriesComponent(t)); +// return tgt; +// } +// +// public org.hl7.fhir.r5.model.ImagingObjectSelection.SeriesComponent convertSeriesComponent(org.hl7.fhir.dstu2.model.ImagingObjectSelection.SeriesComponent src) throws FHIRException { +// if (src == null || src.isEmpty()) +// return null; +// org.hl7.fhir.r5.model.ImagingObjectSelection.SeriesComponent tgt = new org.hl7.fhir.r5.model.ImagingObjectSelection.SeriesComponent(); +// copyElement(src, tgt); +// tgt.setUid(src.getUid()); +// tgt.setUrl(src.getUrl()); +// for (org.hl7.fhir.dstu2.model.ImagingObjectSelection.InstanceComponent t : src.getInstance()) +// tgt.addInstance(convertInstanceComponent(t)); +// return tgt; +// } +// +// public org.hl7.fhir.dstu2.model.ImagingObjectSelection.SeriesComponent convertSeriesComponent(org.hl7.fhir.r5.model.ImagingObjectSelection.SeriesComponent src) throws FHIRException { +// if (src == null || src.isEmpty()) +// return null; +// org.hl7.fhir.dstu2.model.ImagingObjectSelection.SeriesComponent tgt = new org.hl7.fhir.dstu2.model.ImagingObjectSelection.SeriesComponent(); +// copyElement(src, tgt); +// tgt.setUid(src.getUid()); +// tgt.setUrl(src.getUrl()); +// for (org.hl7.fhir.r5.model.ImagingObjectSelection.InstanceComponent t : src.getInstance()) +// tgt.addInstance(convertInstanceComponent(t)); +// return tgt; +// } +// +// public org.hl7.fhir.r5.model.ImagingObjectSelection.InstanceComponent convertInstanceComponent(org.hl7.fhir.dstu2.model.ImagingObjectSelection.InstanceComponent src) throws FHIRException { +// if (src == null || src.isEmpty()) +// return null; +// org.hl7.fhir.r5.model.ImagingObjectSelection.InstanceComponent tgt = new org.hl7.fhir.r5.model.ImagingObjectSelection.InstanceComponent(); +// copyElement(src, tgt); +// tgt.setSopClass(src.getSopClass()); +// tgt.setUid(src.getUid()); +// tgt.setUrl(src.getUrl()); +// for (org.hl7.fhir.dstu2.model.ImagingObjectSelection.FramesComponent t : src.getFrames()) +// tgt.addFrame(convertFramesComponent(t)); +// return tgt; +// } +// +// public org.hl7.fhir.dstu2.model.ImagingObjectSelection.InstanceComponent convertInstanceComponent(org.hl7.fhir.r5.model.ImagingObjectSelection.InstanceComponent src) throws FHIRException { +// if (src == null || src.isEmpty()) +// return null; +// org.hl7.fhir.dstu2.model.ImagingObjectSelection.InstanceComponent tgt = new org.hl7.fhir.dstu2.model.ImagingObjectSelection.InstanceComponent(); +// copyElement(src, tgt); +// tgt.setSopClass(src.getSopClass()); +// tgt.setUid(src.getUid()); +// tgt.setUrl(src.getUrl()); +// for (org.hl7.fhir.r5.model.ImagingObjectSelection.FramesComponent t : src.getFrame()) +// tgt.addFrames(convertFramesComponent(t)); +// return tgt; +// } +// +// public org.hl7.fhir.r5.model.ImagingObjectSelection.FramesComponent convertFramesComponent(org.hl7.fhir.dstu2.model.ImagingObjectSelection.FramesComponent src) throws FHIRException { +// if (src == null || src.isEmpty()) +// return null; +// org.hl7.fhir.r5.model.ImagingObjectSelection.FramesComponent tgt = new org.hl7.fhir.r5.model.ImagingObjectSelection.FramesComponent(); +// copyElement(src, tgt); +// for (org.hl7.fhir.dstu2.model.UnsignedIntType t : src.getFrameNumbers()) +// tgt.addNumber(t.getValue()); +// tgt.setUrl(src.getUrl()); +// return tgt; +// } +// +// public org.hl7.fhir.dstu2.model.ImagingObjectSelection.FramesComponent convertFramesComponent(org.hl7.fhir.r5.model.ImagingObjectSelection.FramesComponent src) throws FHIRException { +// if (src == null || src.isEmpty()) +// return null; +// org.hl7.fhir.dstu2.model.ImagingObjectSelection.FramesComponent tgt = new org.hl7.fhir.dstu2.model.ImagingObjectSelection.FramesComponent(); +// copyElement(src, tgt); +// for (org.hl7.fhir.r5.model.UnsignedIntType t : src.getNumber()) +// tgt.addFrameNumbers(t.getValue()); +// tgt.setUrl(src.getUrl()); +// return tgt; +// } +// + + private org.hl7.fhir.r5.model.Reference getPerformer(List practitioner) { + for (ImmunizationPerformerComponent p : practitioner) { + if (hasConcept(p.getFunction(), "http://hl7.org/fhir/v2/0443", "AP")) + return p.getActor(); + } + return null; + } + + private org.hl7.fhir.r5.model.Reference getRequester(List practitioner) { + for (ImmunizationPerformerComponent p : practitioner) { + if (hasConcept(p.getFunction(), "http://hl7.org/fhir/v2/0443", "OP")) + return p.getActor(); + } + return null; + } + + private boolean hasConcept(org.hl7.fhir.r5.model.CodeableConcept cc, String system, String code) { + for (org.hl7.fhir.r5.model.Coding c : cc.getCoding()) { + if (system.equals(c.getSystem()) && code.equals(c.getCode())) + return true; + } + return false; + } + + private boolean hasConcept(org.hl7.fhir.dstu2.model.CodeableConcept cc, String system, String code) { + for (org.hl7.fhir.dstu2.model.Coding c : cc.getCoding()) { + if (system.equals(c.getSystem()) && code.equals(c.getCode())) + return true; + } + return false; + } + + + public org.hl7.fhir.r5.model.ImplementationGuide convertImplementationGuide(org.hl7.fhir.dstu2.model.ImplementationGuide src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.ImplementationGuide tgt = new org.hl7.fhir.r5.model.ImplementationGuide(); + copyDomainResource(src, tgt); + tgt.setUrl(src.getUrl()); + tgt.setVersion(src.getVersion()); + tgt.setName(src.getName()); + tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuideContactComponent t : src.getContact()) + tgt.addContact(convertImplementationGuideContactComponent(t)); + if (src.hasDate()) + tgt.setDate(src.getDate()); + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getUseContext()) + if (isJurisdiction(t)) + tgt.addJurisdiction(convertCodeableConcept(t)); + else + tgt.addUseContext(convertCodeableConceptToUsageContext(t)); + tgt.setCopyright(src.getCopyright()); + tgt.addFhirVersion(org.hl7.fhir.r5.model.Enumerations.FHIRVersion.fromCode(src.getFhirVersion())); + for (org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuideDependencyComponent t : src.getDependency()) + tgt.addDependsOn(convertImplementationGuideDependencyComponent(t)); + for (org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuidePackageComponent t : src.getPackage()) + tgt.getDefinition().addGrouping(convertImplementationGuidePackageComponent(tgt.getDefinition(), t)); + for (org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuideGlobalComponent t : src.getGlobal()) + tgt.addGlobal(convertImplementationGuideGlobalComponent(t)); +// for (org.hl7.fhir.dstu2.model.UriType t : src.getBinary()) +// tgt.addBinary(t.getValue()); + tgt.getDefinition().setPage(convertImplementationGuidePageComponent(src.getPage())); + return tgt; + } + + public org.hl7.fhir.dstu2.model.ImplementationGuide convertImplementationGuide(org.hl7.fhir.r5.model.ImplementationGuide src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.ImplementationGuide tgt = new org.hl7.fhir.dstu2.model.ImplementationGuide(); + copyDomainResource(src, tgt); + tgt.setUrl(src.getUrl()); + tgt.setVersion(src.getVersion()); + tgt.setName(src.getName()); + tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.r5.model.ContactDetail t : src.getContact()) + tgt.addContact(convertImplementationGuideContactComponent(t)); + if (src.hasDate()) + tgt.setDate(src.getDate()); + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.r5.model.UsageContext t : src.getUseContext()) + if (t.hasValueCodeableConcept()) + tgt.addUseContext(convertCodeableConcept(t.getValueCodeableConcept())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getJurisdiction()) + tgt.addUseContext(convertCodeableConcept(t)); + tgt.setCopyright(src.getCopyright()); + for (Enumeration v : src.getFhirVersion()) { + tgt.setFhirVersion(v.asStringValue()); + } + for (org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDependsOnComponent t : src.getDependsOn()) + tgt.addDependency(convertImplementationGuideDependencyComponent(t)); + for (org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionGroupingComponent t : src.getDefinition().getGrouping()) + tgt.addPackage(convertImplementationGuidePackageComponent(t)); + for (org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionResourceComponent t : src.getDefinition().getResource()) + findPackage(tgt.getPackage(), t.getGroupingId()).addResource(convertImplementationGuidePackageResourceComponent(t)); + for (org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideGlobalComponent t : src.getGlobal()) + tgt.addGlobal(convertImplementationGuideGlobalComponent(t)); +// for (org.hl7.fhir.r5.model.UriType t : src.getBinary()) +// tgt.addBinary(t.getValue()); + tgt.setPage(convertImplementationGuidePageComponent(src.getDefinition().getPage())); + return tgt; + } + + private static org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuidePackageComponent findPackage(List definition, String id) { + if (id != null) + for (org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuidePackageComponent t : definition) + if (id.equals(t.getId())) + return t; + org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuidePackageComponent t = new org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuidePackageComponent(); + t.setName("Default Package"); + t.setId(id); + return t; + } + + public org.hl7.fhir.r5.model.ContactDetail convertImplementationGuideContactComponent(org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuideContactComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.ContactDetail tgt = new org.hl7.fhir.r5.model.ContactDetail(); + copyElement(src, tgt); + tgt.setName(src.getName()); + for (org.hl7.fhir.dstu2.model.ContactPoint t : src.getTelecom()) + tgt.addTelecom(convertContactPoint(t)); + return tgt; + } + + public org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuideContactComponent convertImplementationGuideContactComponent(org.hl7.fhir.r5.model.ContactDetail src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuideContactComponent tgt = new org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuideContactComponent(); + copyElement(src, tgt); + tgt.setName(src.getName()); + for (org.hl7.fhir.r5.model.ContactPoint t : src.getTelecom()) + tgt.addTelecom(convertContactPoint(t)); + return tgt; + } + + public org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDependsOnComponent convertImplementationGuideDependencyComponent(org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuideDependencyComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDependsOnComponent tgt = new org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDependsOnComponent(); + copyElement(src, tgt); + tgt.setUri(src.getUri()); + return tgt; + } + + public org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuideDependencyComponent convertImplementationGuideDependencyComponent(org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDependsOnComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuideDependencyComponent tgt = new org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuideDependencyComponent(); + copyElement(src, tgt); + tgt.setType(org.hl7.fhir.dstu2.model.ImplementationGuide.GuideDependencyType.REFERENCE); + tgt.setUri(src.getUri()); + return tgt; + } + + + public org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionGroupingComponent convertImplementationGuidePackageComponent(org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionComponent context, org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuidePackageComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionGroupingComponent tgt = new org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionGroupingComponent(); + tgt.setId("p"+(context.getGrouping().size()+1)); + copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuidePackageResourceComponent t : src.getResource()) { + org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionResourceComponent tn = convertImplementationGuidePackageResourceComponent(t); + tn.setGroupingId(tgt.getId()); + context.addResource(tn); + } + return tgt; + } + + public org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuidePackageComponent convertImplementationGuidePackageComponent(org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionGroupingComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuidePackageComponent tgt = new org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuidePackageComponent(); + copyElement(src, tgt); + tgt.setId(src.getId()); + tgt.setName(src.getName()); + tgt.setDescription(src.getDescription()); + return tgt; + } + + public org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionResourceComponent convertImplementationGuidePackageResourceComponent(org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuidePackageResourceComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionResourceComponent tgt = new org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionResourceComponent(); + copyElement(src, tgt); + if (src.hasExampleFor()) + tgt.setExample(convertReferenceToCanonical(src.getExampleFor())); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + if (src.hasSourceReference()) + tgt.setReference(convertReference(src.getSourceReference())); + else if (src.hasSourceUriType()) + tgt.setReference(new org.hl7.fhir.r5.model.Reference(src.getSourceUriType().getValue())); + return tgt; + } + + public org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuidePackageResourceComponent convertImplementationGuidePackageResourceComponent(org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionResourceComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuidePackageResourceComponent tgt = new org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuidePackageResourceComponent(); + copyElement(src, tgt); + if (src.hasExampleCanonicalType()) + tgt.setExampleFor(convertCanonicalToReference(src.getExampleCanonicalType())); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + if (src.hasReference()) + tgt.setSource(convertReference(src.getReference())); + return tgt; + } + + public org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideGlobalComponent convertImplementationGuideGlobalComponent(org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuideGlobalComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideGlobalComponent tgt = new org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideGlobalComponent(); + copyElement(src, tgt); + tgt.setType(src.getType()); + tgt.setProfileElement(convertReferenceToCanonical(src.getProfile())); + return tgt; + } + + public org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuideGlobalComponent convertImplementationGuideGlobalComponent(org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideGlobalComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuideGlobalComponent tgt = new org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuideGlobalComponent(); + copyElement(src, tgt); + tgt.setType(src.getType()); + tgt.setProfile(convertCanonicalToReference(src.getProfileElement())); + return tgt; + } + + public org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionPageComponent convertImplementationGuidePageComponent(org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuidePageComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionPageComponent tgt = new org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionPageComponent(); + copyElement(src, tgt); + if (src.hasSource()) { + tgt.setName(convertUriToUrl(src.getSourceElement())); + } + tgt.setTitle(src.getName()); + if (src.hasKind()) + tgt.setGeneration(convertPageGeneration(src.getKind())); + for (org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuidePageComponent t : src.getPage()) + tgt.addPage(convertImplementationGuidePageComponent(t)); + return tgt; + } + + private static GuidePageGeneration convertPageGeneration(GuidePageKind kind) { + switch (kind) { + case PAGE: return GuidePageGeneration.HTML; + default: return GuidePageGeneration.GENERATED; + } + } + + + private static GuidePageKind convertPageGeneration(GuidePageGeneration generation) { + switch (generation) { + case HTML: return GuidePageKind.PAGE; + default: return GuidePageKind.RESOURCE; + } + } + + public org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuidePageComponent convertImplementationGuidePageComponent(org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionPageComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuidePageComponent tgt = new org.hl7.fhir.dstu2.model.ImplementationGuide.ImplementationGuidePageComponent(); + copyElement(src, tgt); + if (src.hasNameUrlType()) + tgt.setSource(src.getNameUrlType().getValue()); + tgt.setName(src.getTitle()); + if (src.hasGeneration()) + tgt.setKind(convertPageGeneration(src.getGeneration())); + for (org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionPageComponent t : src.getPage()) + tgt.addPage(convertImplementationGuidePageComponent(t)); + return tgt; + } + + + public org.hl7.fhir.r5.model.Location convertLocation(org.hl7.fhir.dstu2.model.Location src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Location tgt = new org.hl7.fhir.r5.model.Location(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + tgt.setStatus(convertLocationStatus(src.getStatus())); + tgt.setName(src.getName()); + tgt.setDescription(src.getDescription()); + tgt.setMode(convertLocationMode(src.getMode())); + tgt.addType(convertCodeableConcept(src.getType())); + for (org.hl7.fhir.dstu2.model.ContactPoint t : src.getTelecom()) + tgt.addTelecom(convertContactPoint(t)); + tgt.setAddress(convertAddress(src.getAddress())); + tgt.setPhysicalType(convertCodeableConcept(src.getPhysicalType())); + tgt.setPosition(convertLocationPositionComponent(src.getPosition())); + tgt.setManagingOrganization(convertReference(src.getManagingOrganization())); + tgt.setPartOf(convertReference(src.getPartOf())); + return tgt; + } + + public org.hl7.fhir.dstu2.model.Location convertLocation(org.hl7.fhir.r5.model.Location src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Location tgt = new org.hl7.fhir.dstu2.model.Location(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + tgt.setStatus(convertLocationStatus(src.getStatus())); + tgt.setName(src.getName()); + tgt.setDescription(src.getDescription()); + tgt.setMode(convertLocationMode(src.getMode())); + tgt.setType(convertCodeableConcept(src.getTypeFirstRep())); + for (org.hl7.fhir.r5.model.ContactPoint t : src.getTelecom()) + tgt.addTelecom(convertContactPoint(t)); + tgt.setAddress(convertAddress(src.getAddress())); + tgt.setPhysicalType(convertCodeableConcept(src.getPhysicalType())); + tgt.setPosition(convertLocationPositionComponent(src.getPosition())); + tgt.setManagingOrganization(convertReference(src.getManagingOrganization())); + tgt.setPartOf(convertReference(src.getPartOf())); + return tgt; + } + + public org.hl7.fhir.r5.model.Location.LocationStatus convertLocationStatus(org.hl7.fhir.dstu2.model.Location.LocationStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case ACTIVE: return org.hl7.fhir.r5.model.Location.LocationStatus.ACTIVE; + case SUSPENDED: return org.hl7.fhir.r5.model.Location.LocationStatus.SUSPENDED; + case INACTIVE: return org.hl7.fhir.r5.model.Location.LocationStatus.INACTIVE; + default: return org.hl7.fhir.r5.model.Location.LocationStatus.NULL; + } + } + + public org.hl7.fhir.dstu2.model.Location.LocationStatus convertLocationStatus(org.hl7.fhir.r5.model.Location.LocationStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case ACTIVE: return org.hl7.fhir.dstu2.model.Location.LocationStatus.ACTIVE; + case SUSPENDED: return org.hl7.fhir.dstu2.model.Location.LocationStatus.SUSPENDED; + case INACTIVE: return org.hl7.fhir.dstu2.model.Location.LocationStatus.INACTIVE; + default: return org.hl7.fhir.dstu2.model.Location.LocationStatus.NULL; + } + } + + public org.hl7.fhir.r5.model.Location.LocationMode convertLocationMode(org.hl7.fhir.dstu2.model.Location.LocationMode src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case INSTANCE: return org.hl7.fhir.r5.model.Location.LocationMode.INSTANCE; + case KIND: return org.hl7.fhir.r5.model.Location.LocationMode.KIND; + default: return org.hl7.fhir.r5.model.Location.LocationMode.NULL; + } + } + + public org.hl7.fhir.dstu2.model.Location.LocationMode convertLocationMode(org.hl7.fhir.r5.model.Location.LocationMode src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case INSTANCE: return org.hl7.fhir.dstu2.model.Location.LocationMode.INSTANCE; + case KIND: return org.hl7.fhir.dstu2.model.Location.LocationMode.KIND; + default: return org.hl7.fhir.dstu2.model.Location.LocationMode.NULL; + } + } + + public org.hl7.fhir.r5.model.Location.LocationPositionComponent convertLocationPositionComponent(org.hl7.fhir.dstu2.model.Location.LocationPositionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Location.LocationPositionComponent tgt = new org.hl7.fhir.r5.model.Location.LocationPositionComponent(); + copyElement(src, tgt); + tgt.setLongitude(src.getLongitude()); + tgt.setLatitude(src.getLatitude()); + tgt.setAltitude(src.getAltitude()); + return tgt; + } + + public org.hl7.fhir.dstu2.model.Location.LocationPositionComponent convertLocationPositionComponent(org.hl7.fhir.r5.model.Location.LocationPositionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Location.LocationPositionComponent tgt = new org.hl7.fhir.dstu2.model.Location.LocationPositionComponent(); + copyElement(src, tgt); + tgt.setLongitude(src.getLongitude()); + tgt.setLatitude(src.getLatitude()); + tgt.setAltitude(src.getAltitude()); + return tgt; + } +// +// public org.hl7.fhir.r5.model.Media convertMedia(org.hl7.fhir.dstu2.model.Media src) throws FHIRException { +// if (src == null || src.isEmpty()) +// return null; +// org.hl7.fhir.r5.model.Media tgt = new org.hl7.fhir.r5.model.Media(); +// copyDomainResource(src, tgt); +// for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) +// tgt.addIdentifier(convertIdentifier(t)); +// tgt.setType(convertDigitalMediaType(src.getType())); +// tgt.setSubtype(convertCodeableConcept(src.getSubtype())); +// tgt.setView(convertCodeableConcept(src.getView())); +// tgt.setSubject(convertReference(src.getSubject())); +// tgt.setOperator(convertReference(src.getOperator())); +// tgt.getDevice().setDisplay(src.getDeviceName()); +// tgt.setHeight(src.getHeight()); +// tgt.setWidth(src.getWidth()); +// tgt.setFrames(src.getFrames()); +// tgt.setDuration(src.getDuration()); +// tgt.setContent(convertAttachment(src.getContent())); +// return tgt; +// } +// +// public org.hl7.fhir.dstu2.model.Media convertMedia(org.hl7.fhir.r5.model.Media src) throws FHIRException { +// if (src == null || src.isEmpty()) +// return null; +// org.hl7.fhir.dstu2.model.Media tgt = new org.hl7.fhir.dstu2.model.Media(); +// copyDomainResource(src, tgt); +// for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) +// tgt.addIdentifier(convertIdentifier(t)); +// tgt.setType(convertDigitalMediaType(src.getType())); +// tgt.setSubtype(convertCodeableConcept(src.getSubtype())); +// tgt.setView(convertCodeableConcept(src.getView())); +// tgt.setSubject(convertReference(src.getSubject())); +// tgt.setOperator(convertReference(src.getOperator())); +// tgt.setDeviceName(src.getDevice().getDisplay()); +// tgt.setHeight(src.getHeight()); +// tgt.setWidth(src.getWidth()); +// tgt.setFrames(src.getFrames()); +// tgt.setDuration(src.getDuration()); +// tgt.setContent(convertAttachment(src.getContent())); +// return tgt; +// } +// +// public org.hl7.fhir.r5.model.Media.DigitalCategoryType convertDigitalMediaType(org.hl7.fhir.dstu2.model.Media.DigitalMediaType src) throws FHIRException { +// if (src == null) +// return null; +// switch (src) { +// case PHOTO: return org.hl7.fhir.r5.model.Media.DigitalMediaType.PHOTO; +// case VIDEO: return org.hl7.fhir.r5.model.Media.DigitalMediaType.VIDEO; +// case AUDIO: return org.hl7.fhir.r5.model.Media.DigitalMediaType.AUDIO; +// default: return org.hl7.fhir.r5.model.Media.DigitalMediaType.NULL; +// } +// } +// +// public org.hl7.fhir.dstu2.model.Media.DigitalMediaType convertDigitalMediaType(org.hl7.fhir.r5.model.Media.DigitalMediaType src) throws FHIRException { +// if (src == null) +// return null; +// switch (src) { +// case PHOTO: return org.hl7.fhir.dstu2.model.Media.DigitalMediaType.PHOTO; +// case VIDEO: return org.hl7.fhir.dstu2.model.Media.DigitalMediaType.VIDEO; +// case AUDIO: return org.hl7.fhir.dstu2.model.Media.DigitalMediaType.AUDIO; +// default: return org.hl7.fhir.dstu2.model.Media.DigitalMediaType.NULL; +// } +// } +// +// public org.hl7.fhir.r5.model.Medication convertMedication(org.hl7.fhir.dstu2.model.Medication src) throws FHIRException { +// if (src == null || src.isEmpty()) +// return null; +// org.hl7.fhir.r5.model.Medication tgt = new org.hl7.fhir.r5.model.Medication(); +// copyDomainResource(src, tgt); +// tgt.setCode(convertCodeableConcept(src.getCode())); +// tgt.setIsBrand(src.getIsBrand()); +// tgt.setManufacturer(convertReference(src.getManufacturer())); +//// tgt.setProduct(convertMedicationProductComponent(src.getProduct())); +//// tgt.setPackage(convertMedicationPackageComponent(src.getPackage())); +// return tgt; +// } +// +// public org.hl7.fhir.dstu2.model.Medication convertMedication(org.hl7.fhir.r5.model.Medication src) throws FHIRException { +// if (src == null || src.isEmpty()) +// return null; +// org.hl7.fhir.dstu2.model.Medication tgt = new org.hl7.fhir.dstu2.model.Medication(); +// copyDomainResource(src, tgt); +// tgt.setCode(convertCodeableConcept(src.getCode())); +// tgt.setIsBrand(src.getIsBrand()); +// tgt.setManufacturer(convertReference(src.getManufacturer())); +//// tgt.setProduct(convertMedicationProductComponent(src.getProduct())); +//// tgt.setPackage(convertMedicationPackageComponent(src.getPackage())); +// return tgt; +// } + +// public org.hl7.fhir.r5.model.Medication.MedicationProductComponent convertMedicationProductComponent(org.hl7.fhir.dstu2.model.Medication.MedicationProductComponent src) throws FHIRException { +// if (src == null || src.isEmpty()) +// return null; +// org.hl7.fhir.r5.model.Medication.MedicationProductComponent tgt = new org.hl7.fhir.r5.model.Medication.MedicationProductComponent(); +// copyElement(src, tgt); +// tgt.setForm(convertCodeableConcept(src.getForm())); +// for (org.hl7.fhir.dstu2.model.Medication.MedicationProductIngredientComponent t : src.getIngredient()) +// tgt.addIngredient(convertMedicationProductIngredientComponent(t)); +// for (org.hl7.fhir.dstu2.model.Medication.MedicationProductBatchComponent t : src.getBatch()) +// tgt.addBatch(convertMedicationProductBatchComponent(t)); +// return tgt; +// } + +// public org.hl7.fhir.dstu2.model.Medication.MedicationProductComponent convertMedicationProductComponent(org.hl7.fhir.r5.model.Medication.MedicationProductComponent src) throws FHIRException { +// if (src == null || src.isEmpty()) +// return null; +// org.hl7.fhir.dstu2.model.Medication.MedicationProductComponent tgt = new org.hl7.fhir.dstu2.model.Medication.MedicationProductComponent(); +// copyElement(src, tgt); +// tgt.setForm(convertCodeableConcept(src.getForm())); +// for (org.hl7.fhir.r5.model.Medication.MedicationProductIngredientComponent t : src.getIngredient()) +// tgt.addIngredient(convertMedicationProductIngredientComponent(t)); +// for (org.hl7.fhir.r5.model.Medication.MedicationProductBatchComponent t : src.getBatch()) +// tgt.addBatch(convertMedicationProductBatchComponent(t)); +// return tgt; +// } + +// public org.hl7.fhir.r5.model.Medication.MedicationProductIngredientComponent convertMedicationProductIngredientComponent(org.hl7.fhir.dstu2.model.Medication.MedicationProductIngredientComponent src) throws FHIRException { +// if (src == null || src.isEmpty()) +// return null; +// org.hl7.fhir.r5.model.Medication.MedicationProductIngredientComponent tgt = new org.hl7.fhir.r5.model.Medication.MedicationProductIngredientComponent(); +// copyElement(src, tgt); +// tgt.setItem(convertType(src.getItem())); +// tgt.setAmount(convertRatio(src.getAmount())); +// return tgt; +// } + +// public org.hl7.fhir.dstu2.model.Medication.MedicationProductIngredientComponent convertMedicationProductIngredientComponent(org.hl7.fhir.r5.model.Medication.MedicationProductIngredientComponent src) throws FHIRException { +// if (src == null || src.isEmpty()) +// return null; +// org.hl7.fhir.dstu2.model.Medication.MedicationProductIngredientComponent tgt = new org.hl7.fhir.dstu2.model.Medication.MedicationProductIngredientComponent(); +// copyElement(src, tgt); +// if (src.hasItemReference()) +// tgt.setItem((org.hl7.fhir.dstu2.model.Reference) convertType(src.getItem())); +// tgt.setAmount(convertRatio(src.getAmount())); +// return tgt; +// } + +// public org.hl7.fhir.r5.model.Medication.MedicationProductBatchComponent convertMedicationProductBatchComponent(org.hl7.fhir.dstu2.model.Medication.MedicationProductBatchComponent src) throws FHIRException { +// if (src == null || src.isEmpty()) +// return null; +// org.hl7.fhir.r5.model.Medication.MedicationProductBatchComponent tgt = new org.hl7.fhir.r5.model.Medication.MedicationProductBatchComponent(); +// copyElement(src, tgt); +// tgt.setLotNumber(src.getLotNumber()); +// tgt.setExpirationDate(src.getExpirationDate()); +// return tgt; +// } + +// public org.hl7.fhir.dstu2.model.Medication.MedicationProductBatchComponent convertMedicationProductBatchComponent(org.hl7.fhir.r5.model.Medication.MedicationProductBatchComponent src) throws FHIRException { +// if (src == null || src.isEmpty()) +// return null; +// org.hl7.fhir.dstu2.model.Medication.MedicationProductBatchComponent tgt = new org.hl7.fhir.dstu2.model.Medication.MedicationProductBatchComponent(); +// copyElement(src, tgt); +// tgt.setLotNumber(src.getLotNumber()); +// tgt.setExpirationDate(src.getExpirationDate()); +// return tgt; +// } +// +// public org.hl7.fhir.r5.model.Medication.MedicationPackageComponent convertMedicationPackageComponent(org.hl7.fhir.dstu2.model.Medication.MedicationPackageComponent src) throws FHIRException { +// if (src == null || src.isEmpty()) +// return null; +// org.hl7.fhir.r5.model.Medication.MedicationPackageComponent tgt = new org.hl7.fhir.r5.model.Medication.MedicationPackageComponent(); +// copyElement(src, tgt); +// tgt.setContainer(convertCodeableConcept(src.getContainer())); +// for (org.hl7.fhir.dstu2.model.Medication.MedicationPackageContentComponent t : src.getContent()) +// tgt.addContent(convertMedicationPackageContentComponent(t)); +// return tgt; +// } +// +// public org.hl7.fhir.dstu2.model.Medication.MedicationPackageComponent convertMedicationPackageComponent(org.hl7.fhir.r5.model.Medication.MedicationPackageComponent src) throws FHIRException { +// if (src == null || src.isEmpty()) +// return null; +// org.hl7.fhir.dstu2.model.Medication.MedicationPackageComponent tgt = new org.hl7.fhir.dstu2.model.Medication.MedicationPackageComponent(); +// copyElement(src, tgt); +// tgt.setContainer(convertCodeableConcept(src.getContainer())); +// for (org.hl7.fhir.r5.model.Medication.MedicationPackageContentComponent t : src.getContent()) +// tgt.addContent(convertMedicationPackageContentComponent(t)); +// return tgt; +// } +// +// public org.hl7.fhir.r5.model.Medication.MedicationPackageContentComponent convertMedicationPackageContentComponent(org.hl7.fhir.dstu2.model.Medication.MedicationPackageContentComponent src) throws FHIRException { +// if (src == null || src.isEmpty()) +// return null; +// org.hl7.fhir.r5.model.Medication.MedicationPackageContentComponent tgt = new org.hl7.fhir.r5.model.Medication.MedicationPackageContentComponent(); +// copyElement(src, tgt); +// tgt.setItem(convertType(src.getItem())); +// tgt.setAmount(convertSimpleQuantity(src.getAmount())); +// return tgt; +// } +// +// public org.hl7.fhir.dstu2.model.Medication.MedicationPackageContentComponent convertMedicationPackageContentComponent(org.hl7.fhir.r5.model.Medication.MedicationPackageContentComponent src) throws FHIRException { +// if (src == null || src.isEmpty()) +// return null; +// org.hl7.fhir.dstu2.model.Medication.MedicationPackageContentComponent tgt = new org.hl7.fhir.dstu2.model.Medication.MedicationPackageContentComponent(); +// copyElement(src, tgt); +// if (src.hasItemReference()) +// tgt.setItem((org.hl7.fhir.dstu2.model.Reference) convertType(src.getItem())); +// tgt.setAmount(convertSimpleQuantity(src.getAmount())); +// return tgt; +// } + + public org.hl7.fhir.r5.model.MedicationDispense convertMedicationDispense(org.hl7.fhir.dstu2.model.MedicationDispense src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.MedicationDispense tgt = new org.hl7.fhir.r5.model.MedicationDispense(); + copyDomainResource(src, tgt); + tgt.addIdentifier(convertIdentifier(src.getIdentifier())); + tgt.setStatus(convertMedicationDispenseStatus(src.getStatus())); + tgt.setMedication(convertType(src.getMedication())); + tgt.setSubject(convertReference(src.getPatient())); +// tgt.setDispenser(convertReference(src.getDispenser())); + for (org.hl7.fhir.dstu2.model.Reference t : src.getAuthorizingPrescription()) + tgt.addAuthorizingPrescription(convertReference(t)); + tgt.setType(convertCodeableConcept(src.getType())); + tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); + tgt.setDaysSupply(convertSimpleQuantity(src.getDaysSupply())); + tgt.setWhenPrepared(src.getWhenPrepared()); + tgt.setWhenHandedOver(src.getWhenHandedOver()); + tgt.setDestination(convertReference(src.getDestination())); + for (org.hl7.fhir.dstu2.model.Reference t : src.getReceiver()) + tgt.addReceiver(convertReference(t)); + if (src.hasNote()) + tgt.addNote().setText(src.getNote()); + for (org.hl7.fhir.dstu2.model.MedicationDispense.MedicationDispenseDosageInstructionComponent t : src.getDosageInstruction()) + tgt.addDosageInstruction(convertMedicationDispenseDosageInstructionComponent(t)); + tgt.setSubstitution(convertMedicationDispenseSubstitutionComponent(src.getSubstitution())); + return tgt; + } + + public org.hl7.fhir.dstu2.model.MedicationDispense convertMedicationDispense(org.hl7.fhir.r5.model.MedicationDispense src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.MedicationDispense tgt = new org.hl7.fhir.dstu2.model.MedicationDispense(); + copyDomainResource(src, tgt); + tgt.setIdentifier(convertIdentifier(src.getIdentifierFirstRep())); + tgt.setStatus(convertMedicationDispenseStatus(src.getStatus())); + tgt.setMedication(convertType(src.getMedication())); + tgt.setPatient(convertReference(src.getSubject())); +// tgt.setDispenser(convertReference(src.getDispenser())); + for (org.hl7.fhir.r5.model.Reference t : src.getAuthorizingPrescription()) + tgt.addAuthorizingPrescription(convertReference(t)); + tgt.setType(convertCodeableConcept(src.getType())); + tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); + tgt.setDaysSupply(convertSimpleQuantity(src.getDaysSupply())); + tgt.setWhenPrepared(src.getWhenPrepared()); + tgt.setWhenHandedOver(src.getWhenHandedOver()); + tgt.setDestination(convertReference(src.getDestination())); + for (org.hl7.fhir.r5.model.Reference t : src.getReceiver()) + tgt.addReceiver(convertReference(t)); + for (org.hl7.fhir.r5.model.Annotation t : src.getNote()) + tgt.setNote(t.getText()); + for (org.hl7.fhir.r5.model.Dosage t : src.getDosageInstruction()) + tgt.addDosageInstruction(convertMedicationDispenseDosageInstructionComponent(t)); + tgt.setSubstitution(convertMedicationDispenseSubstitutionComponent(src.getSubstitution())); + return tgt; + } + + public String convertMedicationDispenseStatus(org.hl7.fhir.dstu2.model.MedicationDispense.MedicationDispenseStatus src) throws FHIRException { + if (src == null) + return null; + return src.toCode(); + } + + public org.hl7.fhir.dstu2.model.MedicationDispense.MedicationDispenseStatus convertMedicationDispenseStatus(String src) throws FHIRException { + if (src == null) + return null; + return org.hl7.fhir.dstu2.model.MedicationDispense.MedicationDispenseStatus.fromCode(src); + } + + public org.hl7.fhir.r5.model.Dosage convertMedicationDispenseDosageInstructionComponent(org.hl7.fhir.dstu2.model.MedicationDispense.MedicationDispenseDosageInstructionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Dosage tgt = new org.hl7.fhir.r5.model.Dosage(); + copyElement(src, tgt); + tgt.setText(src.getText()); +// tgt.setAdditionalInstructions(convertCodeableConcept(src.getAdditionalInstructions())); + tgt.setTiming(convertTiming(src.getTiming())); + tgt.setAsNeeded(convertType(src.getAsNeeded())); + if (src.hasSiteCodeableConcept()) + tgt.setSite(convertCodeableConcept(src.getSiteCodeableConcept())); + tgt.setRoute(convertCodeableConcept(src.getRoute())); + tgt.setMethod(convertCodeableConcept(src.getMethod())); + if (src.hasDose() || src.hasRate()) { + DosageDoseAndRateComponent dr = tgt.addDoseAndRate(); + if (src.hasDose()) + dr.setDose(convertType(src.getDose())); + if (src.hasRate()) + dr.setRate(convertType(src.getRate())); + } + tgt.setMaxDosePerPeriod(convertRatio(src.getMaxDosePerPeriod())); + return tgt; + } + + public org.hl7.fhir.dstu2.model.MedicationDispense.MedicationDispenseDosageInstructionComponent convertMedicationDispenseDosageInstructionComponent(Dosage src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.MedicationDispense.MedicationDispenseDosageInstructionComponent tgt = new org.hl7.fhir.dstu2.model.MedicationDispense.MedicationDispenseDosageInstructionComponent(); + copyElement(src, tgt); + tgt.setText(src.getText()); +// tgt.setAdditionalInstructions(convertCodeableConcept(src.getAdditionalInstructions())); + tgt.setTiming(convertTiming(src.getTiming())); + tgt.setAsNeeded(convertType(src.getAsNeeded())); + tgt.setSite(convertType(src.getSite())); + tgt.setRoute(convertCodeableConcept(src.getRoute())); + tgt.setMethod(convertCodeableConcept(src.getMethod())); + if (src.hasDoseAndRate() && src.getDoseAndRate().get(0).hasDose()) + tgt.setDose(convertType(src.getDoseAndRate().get(0).getDose())); + tgt.setMaxDosePerPeriod(convertRatio(src.getMaxDosePerPeriod())); + if (src.hasDoseAndRate() && src.getDoseAndRate().get(0).hasRate()) + tgt.setRate(convertType(src.getDoseAndRate().get(0).getRate())); + return tgt; + } + + public org.hl7.fhir.r5.model.MedicationDispense.MedicationDispenseSubstitutionComponent convertMedicationDispenseSubstitutionComponent(org.hl7.fhir.dstu2.model.MedicationDispense.MedicationDispenseSubstitutionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.MedicationDispense.MedicationDispenseSubstitutionComponent tgt = new org.hl7.fhir.r5.model.MedicationDispense.MedicationDispenseSubstitutionComponent(); + copyElement(src, tgt); + tgt.setType(convertCodeableConcept(src.getType())); + for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getReason()) + tgt.addReason(convertCodeableConcept(t)); + for (org.hl7.fhir.dstu2.model.Reference t : src.getResponsibleParty()) + tgt.addResponsibleParty(convertReference(t)); + return tgt; + } + + public org.hl7.fhir.dstu2.model.MedicationDispense.MedicationDispenseSubstitutionComponent convertMedicationDispenseSubstitutionComponent(org.hl7.fhir.r5.model.MedicationDispense.MedicationDispenseSubstitutionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.MedicationDispense.MedicationDispenseSubstitutionComponent tgt = new org.hl7.fhir.dstu2.model.MedicationDispense.MedicationDispenseSubstitutionComponent(); + copyElement(src, tgt); + tgt.setType(convertCodeableConcept(src.getType())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getReason()) + tgt.addReason(convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getResponsibleParty()) + tgt.addResponsibleParty(convertReference(t)); + return tgt; + } + +// public org.hl7.fhir.r5.model.MedicationOrder convertMedicationOrder(org.hl7.fhir.dstu2.model.MedicationOrder src) throws FHIRException { +// if (src == null || src.isEmpty()) +// return null; +// org.hl7.fhir.r5.model.MedicationOrder tgt = new org.hl7.fhir.r5.model.MedicationOrder(); +// copyDomainResource(src, tgt); +// for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) +// tgt.addIdentifier(convertIdentifier(t)); +// tgt.setStatus(convertMedicationOrderStatus(src.getStatus())); +// tgt.setMedication(convertType(src.getMedication())); +// tgt.setPatient(convertReference(src.getPatient())); +// tgt.setEncounter(convertReference(src.getEncounter())); +// if (src.hasDateWritten()) +// tgt.setDateWritten(src.getDateWritten()); +// tgt.setPrescriber(convertReference(src.getPrescriber())); +// if (src.hasReasonCodeableConcept()) +// tgt.addReasonCode(convertCodeableConcept(src.getReasonCodeableConcept())); +// if (src.hasReasonReference()) +// tgt.addReasonReference(convertReference(src.getReasonReference())); +//// tgt.setDateEnded(src.getDateEnded()); +//// tgt.setReasonEnded(convertCodeableConcept(src.getReasonEnded())); +// if (src.hasNote()) +// tgt.addNote().setText(src.getNote()); +// for (org.hl7.fhir.dstu2.model.MedicationOrder.MedicationOrderDosageInstructionComponent t : src.getDosageInstruction()) +// tgt.addDosageInstruction(convertMedicationOrderDosageInstructionComponent(t)); +// tgt.setDispenseRequest(convertMedicationOrderDispenseRequestComponent(src.getDispenseRequest())); +// tgt.setSubstitution(convertMedicationOrderSubstitutionComponent(src.getSubstitution())); +// tgt.setPriorPrescription(convertReference(src.getPriorPrescription())); +// return tgt; +// } +// +// public org.hl7.fhir.dstu2.model.MedicationOrder convertMedicationOrder(org.hl7.fhir.r5.model.MedicationOrder src) throws FHIRException { +// if (src == null || src.isEmpty()) +// return null; +// org.hl7.fhir.dstu2.model.MedicationOrder tgt = new org.hl7.fhir.dstu2.model.MedicationOrder(); +// copyDomainResource(src, tgt); +// for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) +// tgt.addIdentifier(convertIdentifier(t)); +// tgt.setStatus(convertMedicationOrderStatus(src.getStatus())); +// tgt.setMedication(convertType(src.getMedication())); +// tgt.setPatient(convertReference(src.getPatient())); +// tgt.setEncounter(convertReference(src.getEncounter())); +// if (src.hasDateWritten()) +// tgt.setDateWritten(src.getDateWritten()); +// tgt.setPrescriber(convertReference(src.getPrescriber())); +// for (org.hl7.fhir.r5.model.CodeableConcept t : src.getReasonCode()) +// tgt.setReason(convertCodeableConcept(t)); +// for (org.hl7.fhir.r5.model.Reference t : src.getReasonReference()) +// tgt.setReason(convertReference(t)); +//// tgt.setDateEnded(src.getDateEnded()); +//// tgt.setReasonEnded(convertCodeableConcept(src.getReasonEnded())); +// for (org.hl7.fhir.r5.model.Annotation t : src.getNote()) +// tgt.setNote(t.getText()); +// for (org.hl7.fhir.r5.model.DosageInstruction t : src.getDosageInstruction()) +// tgt.addDosageInstruction(convertMedicationOrderDosageInstructionComponent(t)); +// tgt.setDispenseRequest(convertMedicationOrderDispenseRequestComponent(src.getDispenseRequest())); +// tgt.setSubstitution(convertMedicationOrderSubstitutionComponent(src.getSubstitution())); +// tgt.setPriorPrescription(convertReference(src.getPriorPrescription())); +// return tgt; +// } +// +// public org.hl7.fhir.r5.model.MedicationOrder.MedicationOrderStatus convertMedicationOrderStatus(org.hl7.fhir.dstu2.model.MedicationOrder.MedicationOrderStatus src) throws FHIRException { +// if (src == null) +// return null; +// switch (src) { +// case ACTIVE: return org.hl7.fhir.r5.model.MedicationOrder.MedicationOrderStatus.ACTIVE; +// case ONHOLD: return org.hl7.fhir.r5.model.MedicationOrder.MedicationOrderStatus.ONHOLD; +// case COMPLETED: return org.hl7.fhir.r5.model.MedicationOrder.MedicationOrderStatus.COMPLETED; +// case ENTEREDINERROR: return org.hl7.fhir.r5.model.MedicationOrder.MedicationOrderStatus.ENTEREDINERROR; +// case STOPPED: return org.hl7.fhir.r5.model.MedicationOrder.MedicationOrderStatus.STOPPED; +// case DRAFT: return org.hl7.fhir.r5.model.MedicationOrder.MedicationOrderStatus.DRAFT; +// default: return org.hl7.fhir.r5.model.MedicationOrder.MedicationOrderStatus.NULL; +// } +// } +// +// public org.hl7.fhir.dstu2.model.MedicationOrder.MedicationOrderStatus convertMedicationOrderStatus(org.hl7.fhir.r5.model.MedicationOrder.MedicationOrderStatus src) throws FHIRException { +// if (src == null) +// return null; +// switch (src) { +// case ACTIVE: return org.hl7.fhir.dstu2.model.MedicationOrder.MedicationOrderStatus.ACTIVE; +// case ONHOLD: return org.hl7.fhir.dstu2.model.MedicationOrder.MedicationOrderStatus.ONHOLD; +// case COMPLETED: return org.hl7.fhir.dstu2.model.MedicationOrder.MedicationOrderStatus.COMPLETED; +// case ENTEREDINERROR: return org.hl7.fhir.dstu2.model.MedicationOrder.MedicationOrderStatus.ENTEREDINERROR; +// case STOPPED: return org.hl7.fhir.dstu2.model.MedicationOrder.MedicationOrderStatus.STOPPED; +// case DRAFT: return org.hl7.fhir.dstu2.model.MedicationOrder.MedicationOrderStatus.DRAFT; +// default: return org.hl7.fhir.dstu2.model.MedicationOrder.MedicationOrderStatus.NULL; +// } +// } + + public org.hl7.fhir.r5.model.Dosage convertMedicationOrderDosageInstructionComponent(org.hl7.fhir.dstu2.model.MedicationOrder.MedicationOrderDosageInstructionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Dosage tgt = new org.hl7.fhir.r5.model.Dosage(); + copyElement(src, tgt); + tgt.setText(src.getText()); +// tgt.setAdditionalInstructions(convertCodeableConcept(src.getAdditionalInstructions())); + tgt.setTiming(convertTiming(src.getTiming())); + tgt.setAsNeeded(convertType(src.getAsNeeded())); + if (src.hasSiteCodeableConcept()) + tgt.setSite(convertCodeableConcept(src.getSiteCodeableConcept())); + tgt.setRoute(convertCodeableConcept(src.getRoute())); + tgt.setMethod(convertCodeableConcept(src.getMethod())); + if (src.hasDose() || src.hasRate()) { + DosageDoseAndRateComponent dr = tgt.addDoseAndRate(); + if (src.hasDose()) + dr.setDose(convertType(src.getDose())); + if (src.hasRate()) + dr.setRate(convertType(src.getRate())); + } + tgt.setMaxDosePerPeriod(convertRatio(src.getMaxDosePerPeriod())); + return tgt; + } + + public org.hl7.fhir.dstu2.model.MedicationOrder.MedicationOrderDosageInstructionComponent convertMedicationOrderDosageInstructionComponent(org.hl7.fhir.r5.model.Dosage src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.MedicationOrder.MedicationOrderDosageInstructionComponent tgt = new org.hl7.fhir.dstu2.model.MedicationOrder.MedicationOrderDosageInstructionComponent(); + copyElement(src, tgt); + tgt.setText(src.getText()); +// tgt.setAdditionalInstructions(convertCodeableConcept(src.getAdditionalInstructions())); + tgt.setTiming(convertTiming(src.getTiming())); + tgt.setAsNeeded(convertType(src.getAsNeeded())); + tgt.setSite(convertType(src.getSite())); + tgt.setRoute(convertCodeableConcept(src.getRoute())); + tgt.setMethod(convertCodeableConcept(src.getMethod())); + if (src.hasDoseAndRate() && src.getDoseAndRate().get(0).hasDose()) + tgt.setDose(convertType(src.getDoseAndRate().get(0).getDose())); + if (src.hasDoseAndRate() && src.getDoseAndRate().get(0).hasRate()) + tgt.setRate(convertType(src.getDoseAndRate().get(0).getRate())); + tgt.setMaxDosePerPeriod(convertRatio(src.getMaxDosePerPeriod())); + return tgt; + } + +// public org.hl7.fhir.r5.model.MedicationOrder.MedicationOrderDispenseRequestComponent convertMedicationOrderDispenseRequestComponent(org.hl7.fhir.dstu2.model.MedicationOrder.MedicationOrderDispenseRequestComponent src) throws FHIRException { +// if (src == null || src.isEmpty()) +// return null; +// org.hl7.fhir.r5.model.MedicationOrder.MedicationOrderDispenseRequestComponent tgt = new org.hl7.fhir.r5.model.MedicationOrder.MedicationOrderDispenseRequestComponent(); +// copyElement(src, tgt); +//// tgt.setMedication(convertType(src.getMedication())); +// tgt.setValidityPeriod(convertPeriod(src.getValidityPeriod())); +// tgt.setNumberOfRepeatsAllowed(src.getNumberOfRepeatsAllowed()); +// tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); +// tgt.setExpectedSupplyDuration(convertDuration(src.getExpectedSupplyDuration())); +// return tgt; +// } +// +// public org.hl7.fhir.dstu2.model.MedicationOrder.MedicationOrderDispenseRequestComponent convertMedicationOrderDispenseRequestComponent(org.hl7.fhir.r5.model.MedicationOrder.MedicationOrderDispenseRequestComponent src) throws FHIRException { +// if (src == null || src.isEmpty()) +// return null; +// org.hl7.fhir.dstu2.model.MedicationOrder.MedicationOrderDispenseRequestComponent tgt = new org.hl7.fhir.dstu2.model.MedicationOrder.MedicationOrderDispenseRequestComponent(); +// copyElement(src, tgt); +//// tgt.setMedication(convertType(src.getMedication())); +// tgt.setValidityPeriod(convertPeriod(src.getValidityPeriod())); +// tgt.setNumberOfRepeatsAllowed(src.getNumberOfRepeatsAllowed()); +// tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); +// tgt.setExpectedSupplyDuration(convertDuration(src.getExpectedSupplyDuration())); +// return tgt; +// } +// +// public org.hl7.fhir.r5.model.MedicationOrder.MedicationOrderSubstitutionComponent convertMedicationOrderSubstitutionComponent(org.hl7.fhir.dstu2.model.MedicationOrder.MedicationOrderSubstitutionComponent src) throws FHIRException { +// if (src == null || src.isEmpty()) +// return null; +// org.hl7.fhir.r5.model.MedicationOrder.MedicationOrderSubstitutionComponent tgt = new org.hl7.fhir.r5.model.MedicationOrder.MedicationOrderSubstitutionComponent(); +// copyElement(src, tgt); +//// tgt.setType(convertCodeableConcept(src.getType())); +// tgt.setReason(convertCodeableConcept(src.getReason())); +// return tgt; +// } +// +// public org.hl7.fhir.dstu2.model.MedicationOrder.MedicationOrderSubstitutionComponent convertMedicationOrderSubstitutionComponent(org.hl7.fhir.r5.model.MedicationOrder.MedicationOrderSubstitutionComponent src) throws FHIRException { +// if (src == null || src.isEmpty()) +// return null; +// org.hl7.fhir.dstu2.model.MedicationOrder.MedicationOrderSubstitutionComponent tgt = new org.hl7.fhir.dstu2.model.MedicationOrder.MedicationOrderSubstitutionComponent(); +// copyElement(src, tgt); +//// tgt.setType(convertCodeableConcept(src.getType())); +// tgt.setReason(convertCodeableConcept(src.getReason())); +// return tgt; +// } + + public org.hl7.fhir.r5.model.MedicationStatement convertMedicationStatement(org.hl7.fhir.dstu2.model.MedicationStatement src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.MedicationStatement tgt = new org.hl7.fhir.r5.model.MedicationStatement(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + tgt.setStatus(convertMedicationStatementStatus(src.getStatus())); + tgt.setMedication(convertType(src.getMedication())); + tgt.setSubject(convertReference(src.getPatient())); + tgt.setEffective(convertType(src.getEffective())); + tgt.setInformationSource(convertReference(src.getInformationSource())); + for (org.hl7.fhir.dstu2.model.Reference t : src.getSupportingInformation()) + tgt.addDerivedFrom(convertReference(t)); + if (src.hasDateAsserted()) + tgt.setDateAsserted(src.getDateAsserted()); +// tgt.getNotTakenElement().setValueAsString(src.getWasNotTaken() ? "Y" : "N"); +// for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getReasonNotTaken()) +// tgt.addReasonNotTaken(convertCodeableConcept(t)); +// tgt.setReasonForUse(convertType(src.getReasonForUse())); + if (src.hasNote()) + tgt.addNote().setText(src.getNote()); + for (org.hl7.fhir.dstu2.model.MedicationStatement.MedicationStatementDosageComponent t : src.getDosage()) + tgt.addDosage(convertMedicationStatementDosageComponent(t)); + return tgt; + } + + public org.hl7.fhir.dstu2.model.MedicationStatement convertMedicationStatement(org.hl7.fhir.r5.model.MedicationStatement src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.MedicationStatement tgt = new org.hl7.fhir.dstu2.model.MedicationStatement(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + tgt.setStatus(convertMedicationStatementStatus(src.getStatus())); + tgt.setMedication(convertType(src.getMedication())); + tgt.setPatient(convertReference(src.getSubject())); + tgt.setEffective(convertType(src.getEffective())); + tgt.setInformationSource(convertReference(src.getInformationSource())); + for (org.hl7.fhir.r5.model.Reference t : src.getDerivedFrom()) + tgt.addSupportingInformation(convertReference(t)); + if (src.hasDateAsserted()) + tgt.setDateAsserted(src.getDateAsserted()); +// tgt.setWasNotTaken("Y".equals(src.getNotTakenElement().getValueAsString())); +// for (org.hl7.fhir.r5.model.CodeableConcept t : src.getReasonNotTaken()) +// tgt.addReasonNotTaken(convertCodeableConcept(t)); +// tgt.setReasonForUse(convertType(src.getReasonForUse())); + for (org.hl7.fhir.r5.model.Annotation t : src.getNote()) + tgt.setNote(t.getText()); + for (org.hl7.fhir.r5.model.Dosage t : src.getDosage()) + tgt.addDosage(convertMedicationStatementDosageComponent(t)); + return tgt; + } + + public org.hl7.fhir.r5.model.MedicationStatement.MedicationStatementStatus convertMedicationStatementStatus(org.hl7.fhir.dstu2.model.MedicationStatement.MedicationStatementStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case ACTIVE: return org.hl7.fhir.r5.model.MedicationStatement.MedicationStatementStatus.ACTIVE; + case COMPLETED: return org.hl7.fhir.r5.model.MedicationStatement.MedicationStatementStatus.COMPLETED; + case ENTEREDINERROR: return org.hl7.fhir.r5.model.MedicationStatement.MedicationStatementStatus.ENTEREDINERROR; + case INTENDED: return org.hl7.fhir.r5.model.MedicationStatement.MedicationStatementStatus.INTENDED; + default: return org.hl7.fhir.r5.model.MedicationStatement.MedicationStatementStatus.NULL; + } + } + + public org.hl7.fhir.dstu2.model.MedicationStatement.MedicationStatementStatus convertMedicationStatementStatus(org.hl7.fhir.r5.model.MedicationStatement.MedicationStatementStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case ACTIVE: return org.hl7.fhir.dstu2.model.MedicationStatement.MedicationStatementStatus.ACTIVE; + case COMPLETED: return org.hl7.fhir.dstu2.model.MedicationStatement.MedicationStatementStatus.COMPLETED; + case ENTEREDINERROR: return org.hl7.fhir.dstu2.model.MedicationStatement.MedicationStatementStatus.ENTEREDINERROR; + case INTENDED: return org.hl7.fhir.dstu2.model.MedicationStatement.MedicationStatementStatus.INTENDED; + default: return org.hl7.fhir.dstu2.model.MedicationStatement.MedicationStatementStatus.NULL; + } + } + + public org.hl7.fhir.r5.model.Dosage convertMedicationStatementDosageComponent(org.hl7.fhir.dstu2.model.MedicationStatement.MedicationStatementDosageComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Dosage tgt = new org.hl7.fhir.r5.model.Dosage(); + copyElement(src, tgt); + tgt.setText(src.getText()); + tgt.setTiming(convertTiming(src.getTiming())); + tgt.setAsNeeded(convertType(src.getAsNeeded())); + if (src.hasSiteCodeableConcept()) + tgt.setSite(convertCodeableConcept(src.getSiteCodeableConcept())); + tgt.setRoute(convertCodeableConcept(src.getRoute())); + tgt.setMethod(convertCodeableConcept(src.getMethod())); +// tgt.setQuantity(convertType(src.getQuantity())); + if (src.hasRate()) { + DosageDoseAndRateComponent dr = tgt.addDoseAndRate(); + if (src.hasRate()) + dr.setRate(convertType(src.getRate())); + } + tgt.setMaxDosePerPeriod(convertRatio(src.getMaxDosePerPeriod())); + return tgt; + } + + public org.hl7.fhir.dstu2.model.MedicationStatement.MedicationStatementDosageComponent convertMedicationStatementDosageComponent(org.hl7.fhir.r5.model.Dosage src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.MedicationStatement.MedicationStatementDosageComponent tgt = new org.hl7.fhir.dstu2.model.MedicationStatement.MedicationStatementDosageComponent(); + copyElement(src, tgt); + tgt.setText(src.getText()); + tgt.setTiming(convertTiming(src.getTiming())); + tgt.setAsNeeded(convertType(src.getAsNeeded())); + tgt.setSite(convertType(src.getSite())); + tgt.setRoute(convertCodeableConcept(src.getRoute())); + tgt.setMethod(convertCodeableConcept(src.getMethod())); +// tgt.setQuantity(convertType(src.getQuantity())); + if (src.hasDoseAndRate() && src.getDoseAndRate().get(0).hasRate()) + tgt.setRate(convertType(src.getDoseAndRate().get(0).getRate())); + tgt.setMaxDosePerPeriod(convertRatio(src.getMaxDosePerPeriod())); + return tgt; + } + + public org.hl7.fhir.r5.model.MessageHeader convertMessageHeader(org.hl7.fhir.dstu2.model.MessageHeader src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.MessageHeader tgt = new org.hl7.fhir.r5.model.MessageHeader(); + copyDomainResource(src, tgt); +// tgt.setTimestamp(src.getTimestamp()); + tgt.setEvent(convertCoding(src.getEvent())); + tgt.setResponse(convertMessageHeaderResponseComponent(src.getResponse())); + tgt.setSource(convertMessageSourceComponent(src.getSource())); + for (org.hl7.fhir.dstu2.model.MessageHeader.MessageDestinationComponent t : src.getDestination()) + tgt.addDestination(convertMessageDestinationComponent(t)); + tgt.setEnterer(convertReference(src.getEnterer())); + tgt.setAuthor(convertReference(src.getAuthor())); + tgt.setResponsible(convertReference(src.getResponsible())); + tgt.setReason(convertCodeableConcept(src.getReason())); + for (org.hl7.fhir.dstu2.model.Reference t : src.getData()) + tgt.addFocus(convertReference(t)); + return tgt; + } + + public org.hl7.fhir.dstu2.model.MessageHeader convertMessageHeader(org.hl7.fhir.r5.model.MessageHeader src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.MessageHeader tgt = new org.hl7.fhir.dstu2.model.MessageHeader(); + copyDomainResource(src, tgt); +// tgt.setTimestamp(src.getTimestamp()); + if (src.hasEventCoding()) + tgt.setEvent(convertCoding(src.getEventCoding())); + tgt.setResponse(convertMessageHeaderResponseComponent(src.getResponse())); + tgt.setSource(convertMessageSourceComponent(src.getSource())); + for (org.hl7.fhir.r5.model.MessageHeader.MessageDestinationComponent t : src.getDestination()) + tgt.addDestination(convertMessageDestinationComponent(t)); + tgt.setEnterer(convertReference(src.getEnterer())); + tgt.setAuthor(convertReference(src.getAuthor())); + tgt.setResponsible(convertReference(src.getResponsible())); + tgt.setReason(convertCodeableConcept(src.getReason())); + for (org.hl7.fhir.r5.model.Reference t : src.getFocus()) + tgt.addData(convertReference(t)); + return tgt; + } + + public org.hl7.fhir.r5.model.MessageHeader.MessageHeaderResponseComponent convertMessageHeaderResponseComponent(org.hl7.fhir.dstu2.model.MessageHeader.MessageHeaderResponseComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.MessageHeader.MessageHeaderResponseComponent tgt = new org.hl7.fhir.r5.model.MessageHeader.MessageHeaderResponseComponent(); + copyElement(src, tgt); + tgt.setIdentifier(src.getIdentifier()); + tgt.setCode(convertResponseType(src.getCode())); + tgt.setDetails(convertReference(src.getDetails())); + return tgt; + } + + public org.hl7.fhir.dstu2.model.MessageHeader.MessageHeaderResponseComponent convertMessageHeaderResponseComponent(org.hl7.fhir.r5.model.MessageHeader.MessageHeaderResponseComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.MessageHeader.MessageHeaderResponseComponent tgt = new org.hl7.fhir.dstu2.model.MessageHeader.MessageHeaderResponseComponent(); + copyElement(src, tgt); + tgt.setIdentifier(src.getIdentifier()); + tgt.setCode(convertResponseType(src.getCode())); + tgt.setDetails(convertReference(src.getDetails())); + return tgt; + } + + public org.hl7.fhir.r5.model.MessageHeader.ResponseType convertResponseType(org.hl7.fhir.dstu2.model.MessageHeader.ResponseType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case OK: return org.hl7.fhir.r5.model.MessageHeader.ResponseType.OK; + case TRANSIENTERROR: return org.hl7.fhir.r5.model.MessageHeader.ResponseType.TRANSIENTERROR; + case FATALERROR: return org.hl7.fhir.r5.model.MessageHeader.ResponseType.FATALERROR; + default: return org.hl7.fhir.r5.model.MessageHeader.ResponseType.NULL; + } + } + + public org.hl7.fhir.dstu2.model.MessageHeader.ResponseType convertResponseType(org.hl7.fhir.r5.model.MessageHeader.ResponseType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case OK: return org.hl7.fhir.dstu2.model.MessageHeader.ResponseType.OK; + case TRANSIENTERROR: return org.hl7.fhir.dstu2.model.MessageHeader.ResponseType.TRANSIENTERROR; + case FATALERROR: return org.hl7.fhir.dstu2.model.MessageHeader.ResponseType.FATALERROR; + default: return org.hl7.fhir.dstu2.model.MessageHeader.ResponseType.NULL; + } + } + + public org.hl7.fhir.r5.model.MessageHeader.MessageSourceComponent convertMessageSourceComponent(org.hl7.fhir.dstu2.model.MessageHeader.MessageSourceComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.MessageHeader.MessageSourceComponent tgt = new org.hl7.fhir.r5.model.MessageHeader.MessageSourceComponent(); + copyElement(src, tgt); + tgt.setName(src.getName()); + tgt.setSoftware(src.getSoftware()); + tgt.setVersion(src.getVersion()); + tgt.setContact(convertContactPoint(src.getContact())); + tgt.setEndpoint(src.getEndpoint()); + return tgt; + } + + public org.hl7.fhir.dstu2.model.MessageHeader.MessageSourceComponent convertMessageSourceComponent(org.hl7.fhir.r5.model.MessageHeader.MessageSourceComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.MessageHeader.MessageSourceComponent tgt = new org.hl7.fhir.dstu2.model.MessageHeader.MessageSourceComponent(); + copyElement(src, tgt); + tgt.setName(src.getName()); + tgt.setSoftware(src.getSoftware()); + tgt.setVersion(src.getVersion()); + tgt.setContact(convertContactPoint(src.getContact())); + tgt.setEndpoint(src.getEndpoint()); + return tgt; + } + + public org.hl7.fhir.r5.model.MessageHeader.MessageDestinationComponent convertMessageDestinationComponent(org.hl7.fhir.dstu2.model.MessageHeader.MessageDestinationComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.MessageHeader.MessageDestinationComponent tgt = new org.hl7.fhir.r5.model.MessageHeader.MessageDestinationComponent(); + copyElement(src, tgt); + tgt.setName(src.getName()); + tgt.setTarget(convertReference(src.getTarget())); + tgt.setEndpoint(src.getEndpoint()); + return tgt; + } + + public org.hl7.fhir.dstu2.model.MessageHeader.MessageDestinationComponent convertMessageDestinationComponent(org.hl7.fhir.r5.model.MessageHeader.MessageDestinationComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.MessageHeader.MessageDestinationComponent tgt = new org.hl7.fhir.dstu2.model.MessageHeader.MessageDestinationComponent(); + copyElement(src, tgt); + tgt.setName(src.getName()); + tgt.setTarget(convertReference(src.getTarget())); + tgt.setEndpoint(src.getEndpoint()); + return tgt; + } + + public org.hl7.fhir.r5.model.NamingSystem convertNamingSystem(org.hl7.fhir.dstu2.model.NamingSystem src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.NamingSystem tgt = new org.hl7.fhir.r5.model.NamingSystem(); + copyDomainResource(src, tgt); + tgt.setName(src.getName()); + tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); + tgt.setKind(convertNamingSystemType(src.getKind())); + if (src.hasDate()) + tgt.setDate(src.getDate()); + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.dstu2.model.NamingSystem.NamingSystemContactComponent t : src.getContact()) + tgt.addContact(convertNamingSystemContactComponent(t)); + tgt.setResponsible(src.getResponsible()); + tgt.setType(convertCodeableConcept(src.getType())); + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getUseContext()) + if (isJurisdiction(t)) + tgt.addJurisdiction(convertCodeableConcept(t)); + else + tgt.addUseContext(convertCodeableConceptToUsageContext(t)); + tgt.setUsage(src.getUsage()); + for (org.hl7.fhir.dstu2.model.NamingSystem.NamingSystemUniqueIdComponent t : src.getUniqueId()) + tgt.addUniqueId(convertNamingSystemUniqueIdComponent(t)); + return tgt; + } + + public org.hl7.fhir.dstu2.model.NamingSystem convertNamingSystem(org.hl7.fhir.r5.model.NamingSystem src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.NamingSystem tgt = new org.hl7.fhir.dstu2.model.NamingSystem(); + copyDomainResource(src, tgt); + tgt.setName(src.getName()); + tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); + tgt.setKind(convertNamingSystemType(src.getKind())); + if (src.hasDate()) + tgt.setDate(src.getDate()); + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.r5.model.ContactDetail t : src.getContact()) + tgt.addContact(convertNamingSystemContactComponent(t)); + tgt.setResponsible(src.getResponsible()); + tgt.setType(convertCodeableConcept(src.getType())); + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.r5.model.UsageContext t : src.getUseContext()) + if (t.hasValueCodeableConcept()) + tgt.addUseContext(convertCodeableConcept(t.getValueCodeableConcept())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getJurisdiction()) + tgt.addUseContext(convertCodeableConcept(t)); + tgt.setUsage(src.getUsage()); + for (org.hl7.fhir.r5.model.NamingSystem.NamingSystemUniqueIdComponent t : src.getUniqueId()) + tgt.addUniqueId(convertNamingSystemUniqueIdComponent(t)); + return tgt; + } + + public org.hl7.fhir.r5.model.NamingSystem.NamingSystemType convertNamingSystemType(org.hl7.fhir.dstu2.model.NamingSystem.NamingSystemType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case CODESYSTEM: return org.hl7.fhir.r5.model.NamingSystem.NamingSystemType.CODESYSTEM; + case IDENTIFIER: return org.hl7.fhir.r5.model.NamingSystem.NamingSystemType.IDENTIFIER; + case ROOT: return org.hl7.fhir.r5.model.NamingSystem.NamingSystemType.ROOT; + default: return org.hl7.fhir.r5.model.NamingSystem.NamingSystemType.NULL; + } + } + + public org.hl7.fhir.dstu2.model.NamingSystem.NamingSystemType convertNamingSystemType(org.hl7.fhir.r5.model.NamingSystem.NamingSystemType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case CODESYSTEM: return org.hl7.fhir.dstu2.model.NamingSystem.NamingSystemType.CODESYSTEM; + case IDENTIFIER: return org.hl7.fhir.dstu2.model.NamingSystem.NamingSystemType.IDENTIFIER; + case ROOT: return org.hl7.fhir.dstu2.model.NamingSystem.NamingSystemType.ROOT; + default: return org.hl7.fhir.dstu2.model.NamingSystem.NamingSystemType.NULL; + } + } + + public org.hl7.fhir.r5.model.ContactDetail convertNamingSystemContactComponent(org.hl7.fhir.dstu2.model.NamingSystem.NamingSystemContactComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.ContactDetail tgt = new org.hl7.fhir.r5.model.ContactDetail(); + copyElement(src, tgt); + tgt.setName(src.getName()); + for (org.hl7.fhir.dstu2.model.ContactPoint t : src.getTelecom()) + tgt.addTelecom(convertContactPoint(t)); + return tgt; + } + + public org.hl7.fhir.dstu2.model.NamingSystem.NamingSystemContactComponent convertNamingSystemContactComponent(org.hl7.fhir.r5.model.ContactDetail src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.NamingSystem.NamingSystemContactComponent tgt = new org.hl7.fhir.dstu2.model.NamingSystem.NamingSystemContactComponent(); + copyElement(src, tgt); + tgt.setName(src.getName()); + for (org.hl7.fhir.r5.model.ContactPoint t : src.getTelecom()) + tgt.addTelecom(convertContactPoint(t)); + return tgt; + } + + public org.hl7.fhir.r5.model.NamingSystem.NamingSystemUniqueIdComponent convertNamingSystemUniqueIdComponent(org.hl7.fhir.dstu2.model.NamingSystem.NamingSystemUniqueIdComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.NamingSystem.NamingSystemUniqueIdComponent tgt = new org.hl7.fhir.r5.model.NamingSystem.NamingSystemUniqueIdComponent(); + copyElement(src, tgt); + tgt.setType(convertNamingSystemIdentifierType(src.getType())); + tgt.setValue(src.getValue()); + tgt.setPreferred(src.getPreferred()); + tgt.setPeriod(convertPeriod(src.getPeriod())); + return tgt; + } + + public org.hl7.fhir.dstu2.model.NamingSystem.NamingSystemUniqueIdComponent convertNamingSystemUniqueIdComponent(org.hl7.fhir.r5.model.NamingSystem.NamingSystemUniqueIdComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.NamingSystem.NamingSystemUniqueIdComponent tgt = new org.hl7.fhir.dstu2.model.NamingSystem.NamingSystemUniqueIdComponent(); + copyElement(src, tgt); + tgt.setType(convertNamingSystemIdentifierType(src.getType())); + tgt.setValue(src.getValue()); + tgt.setPreferred(src.getPreferred()); + tgt.setPeriod(convertPeriod(src.getPeriod())); + return tgt; + } + + public org.hl7.fhir.r5.model.NamingSystem.NamingSystemIdentifierType convertNamingSystemIdentifierType(org.hl7.fhir.dstu2.model.NamingSystem.NamingSystemIdentifierType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case OID: return org.hl7.fhir.r5.model.NamingSystem.NamingSystemIdentifierType.OID; + case UUID: return org.hl7.fhir.r5.model.NamingSystem.NamingSystemIdentifierType.UUID; + case URI: return org.hl7.fhir.r5.model.NamingSystem.NamingSystemIdentifierType.URI; + case OTHER: return org.hl7.fhir.r5.model.NamingSystem.NamingSystemIdentifierType.OTHER; + default: return org.hl7.fhir.r5.model.NamingSystem.NamingSystemIdentifierType.NULL; + } + } + + public org.hl7.fhir.dstu2.model.NamingSystem.NamingSystemIdentifierType convertNamingSystemIdentifierType(org.hl7.fhir.r5.model.NamingSystem.NamingSystemIdentifierType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case OID: return org.hl7.fhir.dstu2.model.NamingSystem.NamingSystemIdentifierType.OID; + case UUID: return org.hl7.fhir.dstu2.model.NamingSystem.NamingSystemIdentifierType.UUID; + case URI: return org.hl7.fhir.dstu2.model.NamingSystem.NamingSystemIdentifierType.URI; + case OTHER: return org.hl7.fhir.dstu2.model.NamingSystem.NamingSystemIdentifierType.OTHER; + default: return org.hl7.fhir.dstu2.model.NamingSystem.NamingSystemIdentifierType.NULL; + } + } + + public org.hl7.fhir.r5.model.Observation convertObservation(org.hl7.fhir.dstu2.model.Observation src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Observation tgt = new org.hl7.fhir.r5.model.Observation(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + tgt.setStatus(convertObservationStatus(src.getStatus())); + tgt.addCategory(convertCodeableConcept(src.getCategory())); + tgt.setCode(convertCodeableConcept(src.getCode())); + tgt.setSubject(convertReference(src.getSubject())); + tgt.setEncounter(convertReference(src.getEncounter())); + tgt.setEffective(convertType(src.getEffective())); + tgt.setIssued(src.getIssued()); + for (org.hl7.fhir.dstu2.model.Reference t : src.getPerformer()) + tgt.addPerformer(convertReference(t)); + tgt.setValue(convertType(src.getValue())); + tgt.setDataAbsentReason(convertCodeableConcept(src.getDataAbsentReason())); + tgt.addInterpretation(convertCodeableConcept(src.getInterpretation())); + tgt.addNote().setText(src.getComments()); + tgt.setBodySite(convertCodeableConcept(src.getBodySite())); + tgt.setMethod(convertCodeableConcept(src.getMethod())); + tgt.setSpecimen(convertReference(src.getSpecimen())); + tgt.setDevice(convertReference(src.getDevice())); + for (org.hl7.fhir.dstu2.model.Observation.ObservationReferenceRangeComponent t : src.getReferenceRange()) + tgt.addReferenceRange(convertObservationReferenceRangeComponent(t)); + for (org.hl7.fhir.dstu2.model.Observation.ObservationRelatedComponent t : src.getRelated()) + if (t.getType() == org.hl7.fhir.dstu2.model.Observation.ObservationRelationshipType.HASMEMBER) + tgt.addHasMember(convertReference(t.getTarget())); + else if (t.getType() == org.hl7.fhir.dstu2.model.Observation.ObservationRelationshipType.DERIVEDFROM) + tgt.addDerivedFrom(convertReference(t.getTarget())); for (org.hl7.fhir.dstu2.model.Observation.ObservationComponentComponent t : src.getComponent()) + tgt.addComponent(convertObservationComponentComponent(t)); + return tgt; + } + + public org.hl7.fhir.dstu2.model.Observation convertObservation(org.hl7.fhir.r5.model.Observation src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Observation tgt = new org.hl7.fhir.dstu2.model.Observation(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + tgt.setStatus(convertObservationStatus(src.getStatus())); + for (org.hl7.fhir.r5.model.CodeableConcept c : src.getCategory()) + tgt.setCategory(convertCodeableConcept(c)); + tgt.setCode(convertCodeableConcept(src.getCode())); + tgt.setSubject(convertReference(src.getSubject())); + tgt.setEncounter(convertReference(src.getEncounter())); + tgt.setEffective(convertType(src.getEffective())); + tgt.setIssued(src.getIssued()); + for (org.hl7.fhir.r5.model.Reference t : src.getPerformer()) + tgt.addPerformer(convertReference(t)); + tgt.setValue(convertType(src.getValue())); + tgt.setDataAbsentReason(convertCodeableConcept(src.getDataAbsentReason())); + tgt.setInterpretation(convertCodeableConcept(src.getInterpretationFirstRep())); + if (src.hasNote()) + tgt.setComments(src.getNoteFirstRep().getText()); + tgt.setBodySite(convertCodeableConcept(src.getBodySite())); + tgt.setMethod(convertCodeableConcept(src.getMethod())); + tgt.setSpecimen(convertReference(src.getSpecimen())); + tgt.setDevice(convertReference(src.getDevice())); + for (org.hl7.fhir.r5.model.Observation.ObservationReferenceRangeComponent t : src.getReferenceRange()) + tgt.addReferenceRange(convertObservationReferenceRangeComponent(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getHasMember()) + tgt.addRelated(convertObservationRelatedComponent(t, org.hl7.fhir.dstu2.model.Observation.ObservationRelationshipType.HASMEMBER)); + for (org.hl7.fhir.r5.model.Reference t : src.getDerivedFrom()) + tgt.addRelated(convertObservationRelatedComponent(t, org.hl7.fhir.dstu2.model.Observation.ObservationRelationshipType.DERIVEDFROM)); + for (org.hl7.fhir.r5.model.Observation.ObservationComponentComponent t : src.getComponent()) + tgt.addComponent(convertObservationComponentComponent(t)); + return tgt; + } + + public org.hl7.fhir.r5.model.Observation.ObservationStatus convertObservationStatus(org.hl7.fhir.dstu2.model.Observation.ObservationStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case REGISTERED: return org.hl7.fhir.r5.model.Observation.ObservationStatus.REGISTERED; + case PRELIMINARY: return org.hl7.fhir.r5.model.Observation.ObservationStatus.PRELIMINARY; + case FINAL: return org.hl7.fhir.r5.model.Observation.ObservationStatus.FINAL; + case AMENDED: return org.hl7.fhir.r5.model.Observation.ObservationStatus.AMENDED; + case CANCELLED: return org.hl7.fhir.r5.model.Observation.ObservationStatus.CANCELLED; + case ENTEREDINERROR: return org.hl7.fhir.r5.model.Observation.ObservationStatus.ENTEREDINERROR; + case UNKNOWN: return org.hl7.fhir.r5.model.Observation.ObservationStatus.UNKNOWN; + default: return org.hl7.fhir.r5.model.Observation.ObservationStatus.NULL; + } + } + + public org.hl7.fhir.dstu2.model.Observation.ObservationStatus convertObservationStatus(org.hl7.fhir.r5.model.Observation.ObservationStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case REGISTERED: return org.hl7.fhir.dstu2.model.Observation.ObservationStatus.REGISTERED; + case PRELIMINARY: return org.hl7.fhir.dstu2.model.Observation.ObservationStatus.PRELIMINARY; + case FINAL: return org.hl7.fhir.dstu2.model.Observation.ObservationStatus.FINAL; + case AMENDED: return org.hl7.fhir.dstu2.model.Observation.ObservationStatus.AMENDED; + case CANCELLED: return org.hl7.fhir.dstu2.model.Observation.ObservationStatus.CANCELLED; + case ENTEREDINERROR: return org.hl7.fhir.dstu2.model.Observation.ObservationStatus.ENTEREDINERROR; + case UNKNOWN: return org.hl7.fhir.dstu2.model.Observation.ObservationStatus.UNKNOWN; + default: return org.hl7.fhir.dstu2.model.Observation.ObservationStatus.NULL; + } + } + + public org.hl7.fhir.r5.model.Observation.ObservationReferenceRangeComponent convertObservationReferenceRangeComponent(org.hl7.fhir.dstu2.model.Observation.ObservationReferenceRangeComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Observation.ObservationReferenceRangeComponent tgt = new org.hl7.fhir.r5.model.Observation.ObservationReferenceRangeComponent(); + copyElement(src, tgt); + tgt.setLow(convertSimpleQuantity(src.getLow())); + tgt.setHigh(convertSimpleQuantity(src.getHigh())); + tgt.setType(convertCodeableConcept(src.getMeaning())); + tgt.setAge(convertRange(src.getAge())); + tgt.setText(src.getText()); + return tgt; + } + + public org.hl7.fhir.dstu2.model.Observation.ObservationReferenceRangeComponent convertObservationReferenceRangeComponent(org.hl7.fhir.r5.model.Observation.ObservationReferenceRangeComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Observation.ObservationReferenceRangeComponent tgt = new org.hl7.fhir.dstu2.model.Observation.ObservationReferenceRangeComponent(); + copyElement(src, tgt); + tgt.setLow(convertSimpleQuantity(src.getLow())); + tgt.setHigh(convertSimpleQuantity(src.getHigh())); +// for (org.hl7.fhir.r5.model.CodeableConcept c : src.getMeaning()) + tgt.setMeaning(convertCodeableConcept(src.getType())); + tgt.setAge(convertRange(src.getAge())); + tgt.setText(src.getText()); + return tgt; + } + + + public org.hl7.fhir.dstu2.model.Observation.ObservationRelatedComponent convertObservationRelatedComponent(org.hl7.fhir.r5.model.Reference src, org.hl7.fhir.dstu2.model.Observation.ObservationRelationshipType type) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu2.model.Observation.ObservationRelatedComponent tgt = new org.hl7.fhir.dstu2.model.Observation.ObservationRelatedComponent(); + copyElement(src, tgt); + tgt.setType(type); + tgt.setTarget(convertReference(src)); + return tgt; + } + + + public org.hl7.fhir.r5.model.Observation.ObservationComponentComponent convertObservationComponentComponent(org.hl7.fhir.dstu2.model.Observation.ObservationComponentComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Observation.ObservationComponentComponent tgt = new org.hl7.fhir.r5.model.Observation.ObservationComponentComponent(); + copyElement(src, tgt); + tgt.setCode(convertCodeableConcept(src.getCode())); + tgt.setValue(convertType(src.getValue())); + tgt.setDataAbsentReason(convertCodeableConcept(src.getDataAbsentReason())); + for (org.hl7.fhir.dstu2.model.Observation.ObservationReferenceRangeComponent t : src.getReferenceRange()) + tgt.addReferenceRange(convertObservationReferenceRangeComponent(t)); + return tgt; + } + + public org.hl7.fhir.dstu2.model.Observation.ObservationComponentComponent convertObservationComponentComponent(org.hl7.fhir.r5.model.Observation.ObservationComponentComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Observation.ObservationComponentComponent tgt = new org.hl7.fhir.dstu2.model.Observation.ObservationComponentComponent(); + copyElement(src, tgt); + tgt.setCode(convertCodeableConcept(src.getCode())); + tgt.setValue(convertType(src.getValue())); + tgt.setDataAbsentReason(convertCodeableConcept(src.getDataAbsentReason())); + for (org.hl7.fhir.r5.model.Observation.ObservationReferenceRangeComponent t : src.getReferenceRange()) + tgt.addReferenceRange(convertObservationReferenceRangeComponent(t)); + return tgt; + } + + public org.hl7.fhir.r5.model.OperationDefinition convertOperationDefinition(org.hl7.fhir.dstu2.model.OperationDefinition src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.OperationDefinition tgt = new org.hl7.fhir.r5.model.OperationDefinition(); + copyDomainResource(src, tgt); + tgt.setUrl(src.getUrl()); + tgt.setVersion(src.getVersion()); + tgt.setName(src.getName()); + tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); + tgt.setKind(convertOperationKind(src.getKind())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasDate()) + tgt.setDate(src.getDate()); + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.dstu2.model.OperationDefinition.OperationDefinitionContactComponent t : src.getContact()) + tgt.addContact(convertOperationDefinitionContactComponent(t)); + tgt.setDescription(src.getDescription()); + tgt.setPurpose(src.getRequirements()); + if (src.hasIdempotent()) + tgt.setAffectsState(!src.getIdempotent()); + tgt.setCode(src.getCode()); + tgt.setComment(src.getNotes()); + tgt.setBaseElement(convertReferenceToCanonical(src.getBase())); + tgt.setSystem(src.getSystem()); + for (org.hl7.fhir.dstu2.model.CodeType t : src.getType()) + tgt.addResource(t.getValue()); + tgt.setType(tgt.hasResource()); + tgt.setInstance(src.getInstance()); + for (org.hl7.fhir.dstu2.model.OperationDefinition.OperationDefinitionParameterComponent t : src.getParameter()) + tgt.addParameter(convertOperationDefinitionParameterComponent(t)); + return tgt; + } + + public org.hl7.fhir.dstu2.model.OperationDefinition convertOperationDefinition(org.hl7.fhir.r5.model.OperationDefinition src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.OperationDefinition tgt = new org.hl7.fhir.dstu2.model.OperationDefinition(); + copyDomainResource(src, tgt); + tgt.setUrl(src.getUrl()); + tgt.setVersion(src.getVersion()); + tgt.setName(src.getName()); + tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); + tgt.setKind(convertOperationKind(src.getKind())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasDate()) + tgt.setDate(src.getDate()); + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.r5.model.ContactDetail t : src.getContact()) + tgt.addContact(convertOperationDefinitionContactComponent(t)); + tgt.setDescription(src.getDescription()); + tgt.setRequirements(src.getPurpose()); + tgt.setIdempotent(!src.getAffectsState()); + tgt.setCode(src.getCode()); + tgt.setNotes(src.getComment()); + if (src.hasBase()) + tgt.setBase(convertCanonicalToReference(src.getBaseElement())); + tgt.setSystem(src.getSystem()); + if (src.getType()) + for (org.hl7.fhir.r5.model.CodeType t : src.getResource()) + tgt.addType(t.getValue()); + tgt.setInstance(src.getInstance()); + for (org.hl7.fhir.r5.model.OperationDefinition.OperationDefinitionParameterComponent t : src.getParameter()) + tgt.addParameter(convertOperationDefinitionParameterComponent(t)); + return tgt; + } + + public org.hl7.fhir.r5.model.OperationDefinition.OperationKind convertOperationKind(org.hl7.fhir.dstu2.model.OperationDefinition.OperationKind src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case OPERATION: return org.hl7.fhir.r5.model.OperationDefinition.OperationKind.OPERATION; + case QUERY: return org.hl7.fhir.r5.model.OperationDefinition.OperationKind.QUERY; + default: return org.hl7.fhir.r5.model.OperationDefinition.OperationKind.NULL; + } + } + + public org.hl7.fhir.dstu2.model.OperationDefinition.OperationKind convertOperationKind(org.hl7.fhir.r5.model.OperationDefinition.OperationKind src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case OPERATION: return org.hl7.fhir.dstu2.model.OperationDefinition.OperationKind.OPERATION; + case QUERY: return org.hl7.fhir.dstu2.model.OperationDefinition.OperationKind.QUERY; + default: return org.hl7.fhir.dstu2.model.OperationDefinition.OperationKind.NULL; + } + } + + public org.hl7.fhir.r5.model.ContactDetail convertOperationDefinitionContactComponent(org.hl7.fhir.dstu2.model.OperationDefinition.OperationDefinitionContactComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.ContactDetail tgt = new org.hl7.fhir.r5.model.ContactDetail(); + copyElement(src, tgt); + tgt.setName(src.getName()); + for (org.hl7.fhir.dstu2.model.ContactPoint t : src.getTelecom()) + tgt.addTelecom(convertContactPoint(t)); + return tgt; + } + + public org.hl7.fhir.dstu2.model.OperationDefinition.OperationDefinitionContactComponent convertOperationDefinitionContactComponent(org.hl7.fhir.r5.model.ContactDetail src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.OperationDefinition.OperationDefinitionContactComponent tgt = new org.hl7.fhir.dstu2.model.OperationDefinition.OperationDefinitionContactComponent(); + copyElement(src, tgt); + tgt.setName(src.getName()); + for (org.hl7.fhir.r5.model.ContactPoint t : src.getTelecom()) + tgt.addTelecom(convertContactPoint(t)); + return tgt; + } + + public org.hl7.fhir.r5.model.OperationDefinition.OperationDefinitionParameterComponent convertOperationDefinitionParameterComponent(org.hl7.fhir.dstu2.model.OperationDefinition.OperationDefinitionParameterComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.OperationDefinition.OperationDefinitionParameterComponent tgt = new org.hl7.fhir.r5.model.OperationDefinition.OperationDefinitionParameterComponent(); + copyElement(src, tgt); + tgt.setName(src.getName()); + tgt.setUse(convertOperationParameterUse(src.getUse())); + tgt.setMin(src.getMin()); + tgt.setMax(src.getMax()); + tgt.setDocumentation(src.getDocumentation()); + tgt.setType(src.getType()); + tgt.addTargetProfile(src.getProfile().getReference()); + tgt.setBinding(convertOperationDefinitionParameterBindingComponent(src.getBinding())); + for (org.hl7.fhir.dstu2.model.OperationDefinition.OperationDefinitionParameterComponent t : src.getPart()) + tgt.addPart(convertOperationDefinitionParameterComponent(t)); + return tgt; + } + + public org.hl7.fhir.dstu2.model.OperationDefinition.OperationDefinitionParameterComponent convertOperationDefinitionParameterComponent(org.hl7.fhir.r5.model.OperationDefinition.OperationDefinitionParameterComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.OperationDefinition.OperationDefinitionParameterComponent tgt = new org.hl7.fhir.dstu2.model.OperationDefinition.OperationDefinitionParameterComponent(); + copyElement(src, tgt); + tgt.setName(src.getName()); + tgt.setUse(convertOperationParameterUse(src.getUse())); + tgt.setMin(src.getMin()); + tgt.setMax(src.getMax()); + tgt.setDocumentation(src.getDocumentation()); + if (src.hasSearchType()) { + tgt.setType(src.getSearchType().toCode()); + tgt.setType("string"); + } else + tgt.setType(src.getType()); + for (org.hl7.fhir.r5.model.UriType t: src.getTargetProfile()) + tgt.setProfile(new Reference(t.getValue())); + if (src.hasBinding()) + tgt.setBinding(convertOperationDefinitionParameterBindingComponent(src.getBinding())); + for (org.hl7.fhir.r5.model.OperationDefinition.OperationDefinitionParameterComponent t : src.getPart()) + tgt.addPart(convertOperationDefinitionParameterComponent(t)); + return tgt; + } + + public org.hl7.fhir.r5.model.OperationDefinition.OperationParameterUse convertOperationParameterUse(org.hl7.fhir.dstu2.model.OperationDefinition.OperationParameterUse src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case IN: return org.hl7.fhir.r5.model.OperationDefinition.OperationParameterUse.IN; + case OUT: return org.hl7.fhir.r5.model.OperationDefinition.OperationParameterUse.OUT; + default: return org.hl7.fhir.r5.model.OperationDefinition.OperationParameterUse.NULL; + } + } + + public org.hl7.fhir.dstu2.model.OperationDefinition.OperationParameterUse convertOperationParameterUse(org.hl7.fhir.r5.model.OperationDefinition.OperationParameterUse src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case IN: return org.hl7.fhir.dstu2.model.OperationDefinition.OperationParameterUse.IN; + case OUT: return org.hl7.fhir.dstu2.model.OperationDefinition.OperationParameterUse.OUT; + default: return org.hl7.fhir.dstu2.model.OperationDefinition.OperationParameterUse.NULL; + } + } + + public org.hl7.fhir.r5.model.OperationDefinition.OperationDefinitionParameterBindingComponent convertOperationDefinitionParameterBindingComponent(org.hl7.fhir.dstu2.model.OperationDefinition.OperationDefinitionParameterBindingComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.OperationDefinition.OperationDefinitionParameterBindingComponent tgt = new org.hl7.fhir.r5.model.OperationDefinition.OperationDefinitionParameterBindingComponent(); + copyElement(src, tgt); + tgt.setStrength(convertBindingStrength(src.getStrength())); + Type t = convertType(src.getValueSet()); + if (t != null) { + if (t instanceof org.hl7.fhir.r5.model.Reference) + tgt.setValueSet(((org.hl7.fhir.r5.model.Reference) t).getReference()); + else + tgt.setValueSet(t.primitiveValue()); + tgt.setValueSet(VersionConvertorConstants.refToVS(tgt.getValueSet())); + } + return tgt; + } + + public org.hl7.fhir.dstu2.model.OperationDefinition.OperationDefinitionParameterBindingComponent convertOperationDefinitionParameterBindingComponent(org.hl7.fhir.r5.model.OperationDefinition.OperationDefinitionParameterBindingComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.OperationDefinition.OperationDefinitionParameterBindingComponent tgt = new org.hl7.fhir.dstu2.model.OperationDefinition.OperationDefinitionParameterBindingComponent(); + copyElement(src, tgt); + tgt.setStrength(convertBindingStrength(src.getStrength())); + if (src.hasValueSet()) { + String vsr = VersionConvertorConstants.vsToRef(src.getValueSet()); + if (vsr != null) + tgt.setValueSet(new org.hl7.fhir.dstu2.model.UriType(vsr)); + else + tgt.setValueSet(new org.hl7.fhir.dstu2.model.Reference(src.getValueSet())); + } + return tgt; + } + + public org.hl7.fhir.r5.model.OperationOutcome convertOperationOutcome(org.hl7.fhir.dstu2.model.OperationOutcome src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.OperationOutcome tgt = new org.hl7.fhir.r5.model.OperationOutcome(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu2.model.OperationOutcome.OperationOutcomeIssueComponent t : src.getIssue()) + tgt.addIssue(convertOperationOutcomeIssueComponent(t)); + return tgt; + } + + public org.hl7.fhir.dstu2.model.OperationOutcome convertOperationOutcome(org.hl7.fhir.r5.model.OperationOutcome src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.OperationOutcome tgt = new org.hl7.fhir.dstu2.model.OperationOutcome(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.OperationOutcome.OperationOutcomeIssueComponent t : src.getIssue()) + tgt.addIssue(convertOperationOutcomeIssueComponent(t)); + return tgt; + } + + public org.hl7.fhir.r5.model.OperationOutcome.OperationOutcomeIssueComponent convertOperationOutcomeIssueComponent(org.hl7.fhir.dstu2.model.OperationOutcome.OperationOutcomeIssueComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.OperationOutcome.OperationOutcomeIssueComponent tgt = new org.hl7.fhir.r5.model.OperationOutcome.OperationOutcomeIssueComponent(); + copyElement(src, tgt); + tgt.setSeverity(convertIssueSeverity(src.getSeverity())); + tgt.setCode(convertIssueType(src.getCode())); + tgt.setDetails(convertCodeableConcept(src.getDetails())); + tgt.setDiagnostics(src.getDiagnostics()); + for (org.hl7.fhir.dstu2.model.StringType t : src.getLocation()) + tgt.addLocation(t.getValue()); + return tgt; + } + + public org.hl7.fhir.dstu2.model.OperationOutcome.OperationOutcomeIssueComponent convertOperationOutcomeIssueComponent(org.hl7.fhir.r5.model.OperationOutcome.OperationOutcomeIssueComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.OperationOutcome.OperationOutcomeIssueComponent tgt = new org.hl7.fhir.dstu2.model.OperationOutcome.OperationOutcomeIssueComponent(); + copyElement(src, tgt); + tgt.setSeverity(convertIssueSeverity(src.getSeverity())); + tgt.setCode(convertIssueType(src.getCode())); + tgt.setDetails(convertCodeableConcept(src.getDetails())); + tgt.setDiagnostics(src.getDiagnostics()); + for (org.hl7.fhir.r5.model.StringType t : src.getLocation()) + tgt.addLocation(t.getValue()); + return tgt; + } + + public org.hl7.fhir.r5.model.OperationOutcome.IssueSeverity convertIssueSeverity(org.hl7.fhir.dstu2.model.OperationOutcome.IssueSeverity src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case FATAL: return org.hl7.fhir.r5.model.OperationOutcome.IssueSeverity.FATAL; + case ERROR: return org.hl7.fhir.r5.model.OperationOutcome.IssueSeverity.ERROR; + case WARNING: return org.hl7.fhir.r5.model.OperationOutcome.IssueSeverity.WARNING; + case INFORMATION: return org.hl7.fhir.r5.model.OperationOutcome.IssueSeverity.INFORMATION; + default: return org.hl7.fhir.r5.model.OperationOutcome.IssueSeverity.NULL; + } + } + + public org.hl7.fhir.dstu2.model.OperationOutcome.IssueSeverity convertIssueSeverity(org.hl7.fhir.r5.model.OperationOutcome.IssueSeverity src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case FATAL: return org.hl7.fhir.dstu2.model.OperationOutcome.IssueSeverity.FATAL; + case ERROR: return org.hl7.fhir.dstu2.model.OperationOutcome.IssueSeverity.ERROR; + case WARNING: return org.hl7.fhir.dstu2.model.OperationOutcome.IssueSeverity.WARNING; + case INFORMATION: return org.hl7.fhir.dstu2.model.OperationOutcome.IssueSeverity.INFORMATION; + default: return org.hl7.fhir.dstu2.model.OperationOutcome.IssueSeverity.NULL; + } + } + + public org.hl7.fhir.r5.model.OperationOutcome.IssueType convertIssueType(org.hl7.fhir.dstu2.model.OperationOutcome.IssueType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case INVALID: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.INVALID; + case STRUCTURE: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.STRUCTURE; + case REQUIRED: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.REQUIRED; + case VALUE: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.VALUE; + case INVARIANT: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.INVARIANT; + case SECURITY: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.SECURITY; + case LOGIN: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.LOGIN; + case UNKNOWN: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.UNKNOWN; + case EXPIRED: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.EXPIRED; + case FORBIDDEN: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.FORBIDDEN; + case SUPPRESSED: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.SUPPRESSED; + case PROCESSING: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.PROCESSING; + case NOTSUPPORTED: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.NOTSUPPORTED; + case DUPLICATE: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.DUPLICATE; + case NOTFOUND: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.NOTFOUND; + case TOOLONG: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.TOOLONG; + case CODEINVALID: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.CODEINVALID; + case EXTENSION: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.EXTENSION; + case TOOCOSTLY: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.TOOCOSTLY; + case BUSINESSRULE: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.BUSINESSRULE; + case CONFLICT: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.CONFLICT; + case INCOMPLETE: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.INCOMPLETE; + case TRANSIENT: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.TRANSIENT; + case LOCKERROR: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.LOCKERROR; + case NOSTORE: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.NOSTORE; + case EXCEPTION: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.EXCEPTION; + case TIMEOUT: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.TIMEOUT; + case THROTTLED: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.THROTTLED; + case INFORMATIONAL: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.INFORMATIONAL; + default: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.NULL; + } + } + + public org.hl7.fhir.dstu2.model.OperationOutcome.IssueType convertIssueType(org.hl7.fhir.r5.model.OperationOutcome.IssueType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case INVALID: return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.INVALID; + case STRUCTURE: return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.STRUCTURE; + case REQUIRED: return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.REQUIRED; + case VALUE: return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.VALUE; + case INVARIANT: return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.INVARIANT; + case SECURITY: return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.SECURITY; + case LOGIN: return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.LOGIN; + case UNKNOWN: return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.UNKNOWN; + case EXPIRED: return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.EXPIRED; + case FORBIDDEN: return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.FORBIDDEN; + case SUPPRESSED: return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.SUPPRESSED; + case PROCESSING: return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.PROCESSING; + case NOTSUPPORTED: return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.NOTSUPPORTED; + case DUPLICATE: return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.DUPLICATE; + case NOTFOUND: return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.NOTFOUND; + case TOOLONG: return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.TOOLONG; + case CODEINVALID: return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.CODEINVALID; + case EXTENSION: return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.EXTENSION; + case TOOCOSTLY: return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.TOOCOSTLY; + case BUSINESSRULE: return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.BUSINESSRULE; + case CONFLICT: return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.CONFLICT; + case INCOMPLETE: return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.INCOMPLETE; + case TRANSIENT: return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.TRANSIENT; + case LOCKERROR: return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.LOCKERROR; + case NOSTORE: return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.NOSTORE; + case EXCEPTION: return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.EXCEPTION; + case TIMEOUT: return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.TIMEOUT; + case THROTTLED: return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.THROTTLED; + case INFORMATIONAL: return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.INFORMATIONAL; + default: return org.hl7.fhir.dstu2.model.OperationOutcome.IssueType.NULL; + } + } + + + public org.hl7.fhir.r5.model.Organization convertOrganization(org.hl7.fhir.dstu2.model.Organization src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Organization tgt = new org.hl7.fhir.r5.model.Organization(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + tgt.setActive(src.getActive()); + tgt.addType(convertCodeableConcept(src.getType())); + tgt.setName(src.getName()); + for (org.hl7.fhir.dstu2.model.ContactPoint t : src.getTelecom()) + tgt.addTelecom(convertContactPoint(t)); + for (org.hl7.fhir.dstu2.model.Address t : src.getAddress()) + tgt.addAddress(convertAddress(t)); + tgt.setPartOf(convertReference(src.getPartOf())); + for (org.hl7.fhir.dstu2.model.Organization.OrganizationContactComponent t : src.getContact()) + tgt.addContact(convertOrganizationContactComponent(t)); + return tgt; + } + + public org.hl7.fhir.dstu2.model.Organization convertOrganization(org.hl7.fhir.r5.model.Organization src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Organization tgt = new org.hl7.fhir.dstu2.model.Organization(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + tgt.setActive(src.getActive()); + tgt.setType(convertCodeableConcept(src.getTypeFirstRep())); + tgt.setName(src.getName()); + for (org.hl7.fhir.r5.model.ContactPoint t : src.getTelecom()) + tgt.addTelecom(convertContactPoint(t)); + for (org.hl7.fhir.r5.model.Address t : src.getAddress()) + tgt.addAddress(convertAddress(t)); + tgt.setPartOf(convertReference(src.getPartOf())); + for (org.hl7.fhir.r5.model.Organization.OrganizationContactComponent t : src.getContact()) + tgt.addContact(convertOrganizationContactComponent(t)); + return tgt; + } + + public org.hl7.fhir.r5.model.Organization.OrganizationContactComponent convertOrganizationContactComponent(org.hl7.fhir.dstu2.model.Organization.OrganizationContactComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Organization.OrganizationContactComponent tgt = new org.hl7.fhir.r5.model.Organization.OrganizationContactComponent(); + copyElement(src, tgt); + tgt.setPurpose(convertCodeableConcept(src.getPurpose())); + tgt.setName(convertHumanName(src.getName())); + for (org.hl7.fhir.dstu2.model.ContactPoint t : src.getTelecom()) + tgt.addTelecom(convertContactPoint(t)); + tgt.setAddress(convertAddress(src.getAddress())); + return tgt; + } + + public org.hl7.fhir.dstu2.model.Organization.OrganizationContactComponent convertOrganizationContactComponent(org.hl7.fhir.r5.model.Organization.OrganizationContactComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Organization.OrganizationContactComponent tgt = new org.hl7.fhir.dstu2.model.Organization.OrganizationContactComponent(); + copyElement(src, tgt); + tgt.setPurpose(convertCodeableConcept(src.getPurpose())); + tgt.setName(convertHumanName(src.getName())); + for (org.hl7.fhir.r5.model.ContactPoint t : src.getTelecom()) + tgt.addTelecom(convertContactPoint(t)); + tgt.setAddress(convertAddress(src.getAddress())); + return tgt; + } + + + public org.hl7.fhir.r5.model.Patient convertPatient(org.hl7.fhir.dstu2.model.Patient src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Patient tgt = new org.hl7.fhir.r5.model.Patient(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + tgt.setActive(src.getActive()); + for (org.hl7.fhir.dstu2.model.HumanName t : src.getName()) + tgt.addName(convertHumanName(t)); + for (org.hl7.fhir.dstu2.model.ContactPoint t : src.getTelecom()) + tgt.addTelecom(convertContactPoint(t)); + tgt.setGender(convertAdministrativeGender(src.getGender())); + tgt.setBirthDate(src.getBirthDate()); + tgt.setDeceased(convertType(src.getDeceased())); + for (org.hl7.fhir.dstu2.model.Address t : src.getAddress()) + tgt.addAddress(convertAddress(t)); + tgt.setMaritalStatus(convertCodeableConcept(src.getMaritalStatus())); + tgt.setMultipleBirth(convertType(src.getMultipleBirth())); + for (org.hl7.fhir.dstu2.model.Attachment t : src.getPhoto()) + tgt.addPhoto(convertAttachment(t)); + for (org.hl7.fhir.dstu2.model.Patient.ContactComponent t : src.getContact()) + tgt.addContact(convertContactComponent(t)); + if (src.hasAnimal()) + tgt.addExtension(convertAnimalComponent(src.getAnimal())); + for (org.hl7.fhir.dstu2.model.Patient.PatientCommunicationComponent t : src.getCommunication()) + tgt.addCommunication(convertPatientCommunicationComponent(t)); + for (org.hl7.fhir.dstu2.model.Reference t : src.getCareProvider()) + tgt.addGeneralPractitioner(convertReference(t)); + tgt.setManagingOrganization(convertReference(src.getManagingOrganization())); + for (org.hl7.fhir.dstu2.model.Patient.PatientLinkComponent t : src.getLink()) + tgt.addLink(convertPatientLinkComponent(t)); + return tgt; + } + + public org.hl7.fhir.dstu2.model.Patient convertPatient(org.hl7.fhir.r5.model.Patient src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Patient tgt = new org.hl7.fhir.dstu2.model.Patient(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + tgt.setActive(src.getActive()); + for (org.hl7.fhir.r5.model.HumanName t : src.getName()) + tgt.addName(convertHumanName(t)); + for (org.hl7.fhir.r5.model.ContactPoint t : src.getTelecom()) + tgt.addTelecom(convertContactPoint(t)); + tgt.setGender(convertAdministrativeGender(src.getGender())); + tgt.setBirthDate(src.getBirthDate()); + tgt.setDeceased(convertType(src.getDeceased())); + for (org.hl7.fhir.r5.model.Address t : src.getAddress()) + tgt.addAddress(convertAddress(t)); + tgt.setMaritalStatus(convertCodeableConcept(src.getMaritalStatus())); + tgt.setMultipleBirth(convertType(src.getMultipleBirth())); + for (org.hl7.fhir.r5.model.Attachment t : src.getPhoto()) + tgt.addPhoto(convertAttachment(t)); + for (org.hl7.fhir.r5.model.Patient.ContactComponent t : src.getContact()) + tgt.addContact(convertContactComponent(t)); + if (src.hasExtension("http://hl7.org/fhir/StructureDefinition/patient-animal")) + tgt.setAnimal(convertAnimalComponent(src.getExtensionByUrl("http://hl7.org/fhir/StructureDefinition/patient-animal"))); + for (org.hl7.fhir.r5.model.Patient.PatientCommunicationComponent t : src.getCommunication()) + tgt.addCommunication(convertPatientCommunicationComponent(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getGeneralPractitioner()) + tgt.addCareProvider(convertReference(t)); + tgt.setManagingOrganization(convertReference(src.getManagingOrganization())); + for (org.hl7.fhir.r5.model.Patient.PatientLinkComponent t : src.getLink()) + tgt.addLink(convertPatientLinkComponent(t)); + return tgt; + } + + public org.hl7.fhir.r5.model.Patient.ContactComponent convertContactComponent(org.hl7.fhir.dstu2.model.Patient.ContactComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Patient.ContactComponent tgt = new org.hl7.fhir.r5.model.Patient.ContactComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getRelationship()) + tgt.addRelationship(convertCodeableConcept(t)); + tgt.setName(convertHumanName(src.getName())); + for (org.hl7.fhir.dstu2.model.ContactPoint t : src.getTelecom()) + tgt.addTelecom(convertContactPoint(t)); + tgt.setAddress(convertAddress(src.getAddress())); + tgt.setGender(convertAdministrativeGender(src.getGender())); + tgt.setOrganization(convertReference(src.getOrganization())); + tgt.setPeriod(convertPeriod(src.getPeriod())); + return tgt; + } + + public org.hl7.fhir.dstu2.model.Patient.ContactComponent convertContactComponent(org.hl7.fhir.r5.model.Patient.ContactComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Patient.ContactComponent tgt = new org.hl7.fhir.dstu2.model.Patient.ContactComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getRelationship()) + tgt.addRelationship(convertCodeableConcept(t)); + tgt.setName(convertHumanName(src.getName())); + for (org.hl7.fhir.r5.model.ContactPoint t : src.getTelecom()) + tgt.addTelecom(convertContactPoint(t)); + tgt.setAddress(convertAddress(src.getAddress())); + tgt.setGender(convertAdministrativeGender(src.getGender())); + tgt.setOrganization(convertReference(src.getOrganization())); + tgt.setPeriod(convertPeriod(src.getPeriod())); + return tgt; + } + + public org.hl7.fhir.r5.model.Extension convertAnimalComponent(org.hl7.fhir.dstu2.model.Patient.AnimalComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Extension tgt = new org.hl7.fhir.r5.model.Extension(); + tgt.setUrl("http://hl7.org/fhir/StructureDefinition/patient-animal"); + copyElement(src, tgt); + if (src.hasSpecies()) + tgt.addExtension("species", convertCodeableConcept(src.getSpecies())); + if (src.hasBreed()) + tgt.addExtension("breed", convertCodeableConcept(src.getBreed())); + if (src.hasGenderStatus()) + tgt.addExtension("genderStatus", convertCodeableConcept(src.getGenderStatus())); + return tgt; + } + + public org.hl7.fhir.dstu2.model.Patient.AnimalComponent convertAnimalComponent(org.hl7.fhir.r5.model.Extension src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Patient.AnimalComponent tgt = new org.hl7.fhir.dstu2.model.Patient.AnimalComponent(); + copyElement(src, tgt); + if (src.hasExtension("species")) + tgt.setSpecies(convertCodeableConcept((org.hl7.fhir.r5.model.CodeableConcept) src.getExtensionByUrl("species").getValue())); + if (src.hasExtension("breed")) + tgt.setBreed(convertCodeableConcept((org.hl7.fhir.r5.model.CodeableConcept) src.getExtensionByUrl("breed").getValue())); + if (src.hasExtension("genderStatus")) + tgt.setGenderStatus(convertCodeableConcept((org.hl7.fhir.r5.model.CodeableConcept) src.getExtensionByUrl("genderStatus").getValue())); + return tgt; + } + + public org.hl7.fhir.r5.model.Patient.PatientCommunicationComponent convertPatientCommunicationComponent(org.hl7.fhir.dstu2.model.Patient.PatientCommunicationComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Patient.PatientCommunicationComponent tgt = new org.hl7.fhir.r5.model.Patient.PatientCommunicationComponent(); + copyElement(src, tgt); + tgt.setLanguage(convertCodeableConcept(src.getLanguage())); + tgt.setPreferred(src.getPreferred()); + return tgt; + } + + public org.hl7.fhir.dstu2.model.Patient.PatientCommunicationComponent convertPatientCommunicationComponent(org.hl7.fhir.r5.model.Patient.PatientCommunicationComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Patient.PatientCommunicationComponent tgt = new org.hl7.fhir.dstu2.model.Patient.PatientCommunicationComponent(); + copyElement(src, tgt); + tgt.setLanguage(convertCodeableConcept(src.getLanguage())); + tgt.setPreferred(src.getPreferred()); + return tgt; + } + + public org.hl7.fhir.r5.model.Patient.PatientLinkComponent convertPatientLinkComponent(org.hl7.fhir.dstu2.model.Patient.PatientLinkComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Patient.PatientLinkComponent tgt = new org.hl7.fhir.r5.model.Patient.PatientLinkComponent(); + copyElement(src, tgt); + tgt.setOther(convertReference(src.getOther())); + tgt.setType(convertLinkType(src.getType())); + return tgt; + } + + public org.hl7.fhir.dstu2.model.Patient.PatientLinkComponent convertPatientLinkComponent(org.hl7.fhir.r5.model.Patient.PatientLinkComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Patient.PatientLinkComponent tgt = new org.hl7.fhir.dstu2.model.Patient.PatientLinkComponent(); + copyElement(src, tgt); + tgt.setOther(convertReference(src.getOther())); + tgt.setType(convertLinkType(src.getType())); + return tgt; + } + + public org.hl7.fhir.r5.model.Patient.LinkType convertLinkType(org.hl7.fhir.dstu2.model.Patient.LinkType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case REPLACE: return org.hl7.fhir.r5.model.Patient.LinkType.REPLACEDBY; + case REFER: return org.hl7.fhir.r5.model.Patient.LinkType.REFER; + case SEEALSO: return org.hl7.fhir.r5.model.Patient.LinkType.SEEALSO; + default: return org.hl7.fhir.r5.model.Patient.LinkType.NULL; + } + } + + public org.hl7.fhir.dstu2.model.Patient.LinkType convertLinkType(org.hl7.fhir.r5.model.Patient.LinkType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case REPLACEDBY: return org.hl7.fhir.dstu2.model.Patient.LinkType.REPLACE; + case REPLACES: return org.hl7.fhir.dstu2.model.Patient.LinkType.REPLACE; + case REFER: return org.hl7.fhir.dstu2.model.Patient.LinkType.REFER; + case SEEALSO: return org.hl7.fhir.dstu2.model.Patient.LinkType.SEEALSO; + default: return org.hl7.fhir.dstu2.model.Patient.LinkType.NULL; + } + } + + + public org.hl7.fhir.r5.model.Person convertPerson(org.hl7.fhir.dstu2.model.Person src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Person tgt = new org.hl7.fhir.r5.model.Person(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + for (org.hl7.fhir.dstu2.model.HumanName t : src.getName()) + tgt.addName(convertHumanName(t)); + for (org.hl7.fhir.dstu2.model.ContactPoint t : src.getTelecom()) + tgt.addTelecom(convertContactPoint(t)); + tgt.setGender(convertAdministrativeGender(src.getGender())); + tgt.setBirthDate(src.getBirthDate()); + for (org.hl7.fhir.dstu2.model.Address t : src.getAddress()) + tgt.addAddress(convertAddress(t)); + tgt.setPhoto(convertAttachment(src.getPhoto())); + tgt.setManagingOrganization(convertReference(src.getManagingOrganization())); + tgt.setActive(src.getActive()); + for (org.hl7.fhir.dstu2.model.Person.PersonLinkComponent t : src.getLink()) + tgt.addLink(convertPersonLinkComponent(t)); + return tgt; + } + + public org.hl7.fhir.dstu2.model.Person convertPerson(org.hl7.fhir.r5.model.Person src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Person tgt = new org.hl7.fhir.dstu2.model.Person(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + for (org.hl7.fhir.r5.model.HumanName t : src.getName()) + tgt.addName(convertHumanName(t)); + for (org.hl7.fhir.r5.model.ContactPoint t : src.getTelecom()) + tgt.addTelecom(convertContactPoint(t)); + tgt.setGender(convertAdministrativeGender(src.getGender())); + tgt.setBirthDate(src.getBirthDate()); + for (org.hl7.fhir.r5.model.Address t : src.getAddress()) + tgt.addAddress(convertAddress(t)); + tgt.setPhoto(convertAttachment(src.getPhoto())); + tgt.setManagingOrganization(convertReference(src.getManagingOrganization())); + tgt.setActive(src.getActive()); + for (org.hl7.fhir.r5.model.Person.PersonLinkComponent t : src.getLink()) + tgt.addLink(convertPersonLinkComponent(t)); + return tgt; + } + + public org.hl7.fhir.r5.model.Person.PersonLinkComponent convertPersonLinkComponent(org.hl7.fhir.dstu2.model.Person.PersonLinkComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Person.PersonLinkComponent tgt = new org.hl7.fhir.r5.model.Person.PersonLinkComponent(); + copyElement(src, tgt); + tgt.setTarget(convertReference(src.getTarget())); + tgt.setAssurance(convertIdentityAssuranceLevel(src.getAssurance())); + return tgt; + } + + public org.hl7.fhir.dstu2.model.Person.PersonLinkComponent convertPersonLinkComponent(org.hl7.fhir.r5.model.Person.PersonLinkComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Person.PersonLinkComponent tgt = new org.hl7.fhir.dstu2.model.Person.PersonLinkComponent(); + copyElement(src, tgt); + tgt.setTarget(convertReference(src.getTarget())); + tgt.setAssurance(convertIdentityAssuranceLevel(src.getAssurance())); + return tgt; + } + + public org.hl7.fhir.r5.model.Person.IdentityAssuranceLevel convertIdentityAssuranceLevel(org.hl7.fhir.dstu2.model.Person.IdentityAssuranceLevel src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case LEVEL1: return org.hl7.fhir.r5.model.Person.IdentityAssuranceLevel.LEVEL1; + case LEVEL2: return org.hl7.fhir.r5.model.Person.IdentityAssuranceLevel.LEVEL2; + case LEVEL3: return org.hl7.fhir.r5.model.Person.IdentityAssuranceLevel.LEVEL3; + case LEVEL4: return org.hl7.fhir.r5.model.Person.IdentityAssuranceLevel.LEVEL4; + default: return org.hl7.fhir.r5.model.Person.IdentityAssuranceLevel.NULL; + } + } + + public org.hl7.fhir.dstu2.model.Person.IdentityAssuranceLevel convertIdentityAssuranceLevel(org.hl7.fhir.r5.model.Person.IdentityAssuranceLevel src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case LEVEL1: return org.hl7.fhir.dstu2.model.Person.IdentityAssuranceLevel.LEVEL1; + case LEVEL2: return org.hl7.fhir.dstu2.model.Person.IdentityAssuranceLevel.LEVEL2; + case LEVEL3: return org.hl7.fhir.dstu2.model.Person.IdentityAssuranceLevel.LEVEL3; + case LEVEL4: return org.hl7.fhir.dstu2.model.Person.IdentityAssuranceLevel.LEVEL4; + default: return org.hl7.fhir.dstu2.model.Person.IdentityAssuranceLevel.NULL; + } + } + + public org.hl7.fhir.r5.model.Practitioner convertPractitioner(org.hl7.fhir.dstu2.model.Practitioner src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Practitioner tgt = new org.hl7.fhir.r5.model.Practitioner(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + tgt.setActive(src.getActive()); + if (src.hasName()) + tgt.addName(convertHumanName(src.getName())); + for (org.hl7.fhir.dstu2.model.ContactPoint t : src.getTelecom()) + tgt.addTelecom(convertContactPoint(t)); + for (org.hl7.fhir.dstu2.model.Address t : src.getAddress()) + tgt.addAddress(convertAddress(t)); + tgt.setGender(convertAdministrativeGender(src.getGender())); + tgt.setBirthDate(src.getBirthDate()); + for (org.hl7.fhir.dstu2.model.Attachment t : src.getPhoto()) + tgt.addPhoto(convertAttachment(t)); +// for (org.hl7.fhir.dstu2.model.Practitioner.PractitionerPractitionerRoleComponent t : src.getPractitionerRole()) +// tgt.addRole(convertPractitionerPractitionerRoleComponent(t)); + for (org.hl7.fhir.dstu2.model.Practitioner.PractitionerQualificationComponent t : src.getQualification()) + tgt.addQualification(convertPractitionerQualificationComponent(t)); + for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getCommunication()) + tgt.addCommunication(convertCodeableConcept(t)); + return tgt; + } + + public org.hl7.fhir.dstu2.model.Practitioner convertPractitioner(org.hl7.fhir.r5.model.Practitioner src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Practitioner tgt = new org.hl7.fhir.dstu2.model.Practitioner(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + tgt.setActive(src.getActive()); + for (org.hl7.fhir.r5.model.HumanName t : src.getName()) + tgt.setName(convertHumanName(t)); + for (org.hl7.fhir.r5.model.ContactPoint t : src.getTelecom()) + tgt.addTelecom(convertContactPoint(t)); + for (org.hl7.fhir.r5.model.Address t : src.getAddress()) + tgt.addAddress(convertAddress(t)); + tgt.setGender(convertAdministrativeGender(src.getGender())); + tgt.setBirthDate(src.getBirthDate()); + for (org.hl7.fhir.r5.model.Attachment t : src.getPhoto()) + tgt.addPhoto(convertAttachment(t)); +// for (org.hl7.fhir.r5.model.Practitioner.PractitionerRoleComponent t : src.getRole()) +// tgt.addPractitionerRole(convertPractitionerPractitionerRoleComponent(t)); + for (org.hl7.fhir.r5.model.Practitioner.PractitionerQualificationComponent t : src.getQualification()) + tgt.addQualification(convertPractitionerQualificationComponent(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getCommunication()) + tgt.addCommunication(convertCodeableConcept(t)); + return tgt; + } + +// public org.hl7.fhir.r5.model.Practitioner.PractitionerRoleComponent convertPractitionerPractitionerRoleComponent(org.hl7.fhir.dstu2.model.Practitioner.PractitionerPractitionerRoleComponent src) throws FHIRException { +// if (src == null || src.isEmpty()) +// return null; +// org.hl7.fhir.r5.model.Practitioner.PractitionerRoleComponent tgt = new org.hl7.fhir.r5.model.Practitioner.PractitionerRoleComponent(); +// copyElement(src, tgt); +// tgt.setOrganization(convertReference(src.getManagingOrganization())); +// tgt.setCode(convertCodeableConcept(src.getRole())); +// for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getSpecialty()) +// tgt.addSpecialty(convertCodeableConcept(t)); +// tgt.setPeriod(convertPeriod(src.getPeriod())); +// for (org.hl7.fhir.dstu2.model.Reference t : src.getLocation()) +// tgt.addLocation(convertReference(t)); +// for (org.hl7.fhir.dstu2.model.Reference t : src.getHealthcareService()) +// tgt.addHealthcareService(convertReference(t)); +// return tgt; +// } + +// public org.hl7.fhir.dstu2.model.Practitioner.PractitionerPractitionerRoleComponent convertPractitionerPractitionerRoleComponent(org.hl7.fhir.r5.model.Practitioner.PractitionerRoleComponent src) throws FHIRException { +// if (src == null || src.isEmpty()) +// return null; +// org.hl7.fhir.dstu2.model.Practitioner.PractitionerPractitionerRoleComponent tgt = new org.hl7.fhir.dstu2.model.Practitioner.PractitionerPractitionerRoleComponent(); +// copyElement(src, tgt); +// tgt.setManagingOrganization(convertReference(src.getOrganization())); +// tgt.setRole(convertCodeableConcept(src.getCode())); +// for (org.hl7.fhir.r5.model.CodeableConcept t : src.getSpecialty()) +// tgt.addSpecialty(convertCodeableConcept(t)); +// tgt.setPeriod(convertPeriod(src.getPeriod())); +// for (org.hl7.fhir.r5.model.Reference t : src.getLocation()) +// tgt.addLocation(convertReference(t)); +// for (org.hl7.fhir.r5.model.Reference t : src.getHealthcareService()) +// tgt.addHealthcareService(convertReference(t)); +// return tgt; +// } + + public org.hl7.fhir.r5.model.Practitioner.PractitionerQualificationComponent convertPractitionerQualificationComponent(org.hl7.fhir.dstu2.model.Practitioner.PractitionerQualificationComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Practitioner.PractitionerQualificationComponent tgt = new org.hl7.fhir.r5.model.Practitioner.PractitionerQualificationComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + tgt.setCode(convertCodeableConcept(src.getCode())); + tgt.setPeriod(convertPeriod(src.getPeriod())); + tgt.setIssuer(convertReference(src.getIssuer())); + return tgt; + } + + public org.hl7.fhir.dstu2.model.Practitioner.PractitionerQualificationComponent convertPractitionerQualificationComponent(org.hl7.fhir.r5.model.Practitioner.PractitionerQualificationComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Practitioner.PractitionerQualificationComponent tgt = new org.hl7.fhir.dstu2.model.Practitioner.PractitionerQualificationComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + tgt.setCode(convertCodeableConcept(src.getCode())); + tgt.setPeriod(convertPeriod(src.getPeriod())); + tgt.setIssuer(convertReference(src.getIssuer())); + return tgt; + } + + +// public org.hl7.fhir.r5.model.Provenance convertProvenance(org.hl7.fhir.dstu2.model.Provenance src) throws FHIRException { +// if (src == null || src.isEmpty()) +// return null; +// org.hl7.fhir.r5.model.Provenance tgt = new org.hl7.fhir.r5.model.Provenance(); +// copyDomainResource(src, tgt); +// for (org.hl7.fhir.dstu2.model.Reference t : src.getTarget()) +// tgt.addTarget(convertReference(t)); +// tgt.setPeriod(convertPeriod(src.getPeriod())); +// tgt.setRecorded(src.getRecorded()); +// for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getReason()) +// for (org.hl7.fhir.dstu2.model.Coding tc : t.getCoding()) +// tgt.addReason(convertCoding(tc)); +// for (org.hl7.fhir.dstu2.model.Coding t : src.getActivity().getCoding()) +// tgt.setActivity(convertCoding(t)); +// tgt.setLocation(convertReference(src.getLocation())); +// for (org.hl7.fhir.dstu2.model.UriType t : src.getPolicy()) +// tgt.addPolicy(t.getValue()); +// for (org.hl7.fhir.dstu2.model.Provenance.ProvenanceAgentComponent t : src.getAgent()) +// tgt.addAgent(convertProvenanceAgentComponent(t)); +// for (org.hl7.fhir.dstu2.model.Provenance.ProvenanceEntityComponent t : src.getEntity()) +// tgt.addEntity(convertProvenanceEntityComponent(t)); +// for (org.hl7.fhir.dstu2.model.Signature t : src.getSignature()) +// tgt.addSignature(convertSignature(t)); +// return tgt; +// } +// +// public org.hl7.fhir.dstu2.model.Provenance convertProvenance(org.hl7.fhir.r5.model.Provenance src) throws FHIRException { +// if (src == null || src.isEmpty()) +// return null; +// org.hl7.fhir.dstu2.model.Provenance tgt = new org.hl7.fhir.dstu2.model.Provenance(); +// copyDomainResource(src, tgt); +// for (org.hl7.fhir.r5.model.Reference t : src.getTarget()) +// tgt.addTarget(convertReference(t)); +// tgt.setPeriod(convertPeriod(src.getPeriod())); +// tgt.setRecorded(src.getRecorded()); +// for (org.hl7.fhir.r5.model.Coding t : src.getReason()) +// tgt.addReason().addCoding(convertCoding(t)); +// tgt.setActivity(new org.hl7.fhir.dstu2.model.CodeableConcept().addCoding(convertCoding(src.getActivity()))); +// tgt.setLocation(convertReference(src.getLocation())); +// for (org.hl7.fhir.r5.model.UriType t : src.getPolicy()) +// tgt.addPolicy(t.getValue()); +// for (org.hl7.fhir.r5.model.Provenance.ProvenanceAgentComponent t : src.getAgent()) +// tgt.addAgent(convertProvenanceAgentComponent(t)); +// for (org.hl7.fhir.r5.model.Provenance.ProvenanceEntityComponent t : src.getEntity()) +// tgt.addEntity(convertProvenanceEntityComponent(t)); +// for (org.hl7.fhir.r5.model.Signature t : src.getSignature()) +// tgt.addSignature(convertSignature(t)); +// return tgt; +// } +// +// public org.hl7.fhir.r5.model.Provenance.ProvenanceAgentComponent convertProvenanceAgentComponent(org.hl7.fhir.dstu2.model.Provenance.ProvenanceAgentComponent src) throws FHIRException { +// if (src == null || src.isEmpty()) +// return null; +// org.hl7.fhir.r5.model.Provenance.ProvenanceAgentComponent tgt = new org.hl7.fhir.r5.model.Provenance.ProvenanceAgentComponent(); +// copyElement(src, tgt); +//// tgt.setRole(convertCoding(src.getRole())); +// tgt.setWho(convertReference(src.getActor())); +// return tgt; +// } +// +// public org.hl7.fhir.dstu2.model.Provenance.ProvenanceAgentComponent convertProvenanceAgentComponent(org.hl7.fhir.r5.model.Provenance.ProvenanceAgentComponent src) throws FHIRException { +// if (src == null || src.isEmpty()) +// return null; +// org.hl7.fhir.dstu2.model.Provenance.ProvenanceAgentComponent tgt = new org.hl7.fhir.dstu2.model.Provenance.ProvenanceAgentComponent(); +// copyElement(src, tgt); +//// tgt.setRole(convertCoding(src.getRole())); +// if (src.hasWhoReference()) +// tgt.setActor(convertReference(src.getWhoReference())); +// return tgt; +// } +// +// public org.hl7.fhir.r5.model.Provenance.ProvenanceEntityComponent convertProvenanceEntityComponent(org.hl7.fhir.dstu2.model.Provenance.ProvenanceEntityComponent src) throws FHIRException { +// if (src == null || src.isEmpty()) +// return null; +// org.hl7.fhir.r5.model.Provenance.ProvenanceEntityComponent tgt = new org.hl7.fhir.r5.model.Provenance.ProvenanceEntityComponent(); +// copyElement(src, tgt); +// tgt.setRole(convertProvenanceEntityRole(src.getRole())); +// if (src.hasReference()) +// tgt.setWhat(new org.hl7.fhir.r5.model.Reference().setReference(src.getReference())); +// tgt.addAgent(convertProvenanceAgentComponent(src.getAgent())); +// return tgt; +// } +// +// public org.hl7.fhir.dstu2.model.Provenance.ProvenanceEntityComponent convertProvenanceEntityComponent(org.hl7.fhir.r5.model.Provenance.ProvenanceEntityComponent src) throws FHIRException { +// if (src == null || src.isEmpty()) +// return null; +// org.hl7.fhir.dstu2.model.Provenance.ProvenanceEntityComponent tgt = new org.hl7.fhir.dstu2.model.Provenance.ProvenanceEntityComponent(); +// copyElement(src, tgt); +// tgt.setRole(convertProvenanceEntityRole(src.getRole())); +// if (src.hasWhatReference() && src.getWhatReference().hasReference()) +// tgt.setReference(src.getWhatReference().getReference()); +// for (org.hl7.fhir.r5.model.Provenance.ProvenanceAgentComponent t : src.getAgent()) +// tgt.setAgent(convertProvenanceAgentComponent(t)); +// return tgt; +// } +// +// public org.hl7.fhir.r5.model.Provenance.ProvenanceEntityRole convertProvenanceEntityRole(org.hl7.fhir.dstu2.model.Provenance.ProvenanceEntityRole src) throws FHIRException { +// if (src == null) +// return null; +// switch (src) { +// case DERIVATION: return org.hl7.fhir.r5.model.Provenance.ProvenanceEntityRole.DERIVATION; +// case REVISION: return org.hl7.fhir.r5.model.Provenance.ProvenanceEntityRole.REVISION; +// case QUOTATION: return org.hl7.fhir.r5.model.Provenance.ProvenanceEntityRole.QUOTATION; +// case SOURCE: return org.hl7.fhir.r5.model.Provenance.ProvenanceEntityRole.SOURCE; +// default: return org.hl7.fhir.r5.model.Provenance.ProvenanceEntityRole.NULL; +// } +// } +// +// public org.hl7.fhir.dstu2.model.Provenance.ProvenanceEntityRole convertProvenanceEntityRole(org.hl7.fhir.r5.model.Provenance.ProvenanceEntityRole src) throws FHIRException { +// if (src == null) +// return null; +// switch (src) { +// case DERIVATION: return org.hl7.fhir.dstu2.model.Provenance.ProvenanceEntityRole.DERIVATION; +// case REVISION: return org.hl7.fhir.dstu2.model.Provenance.ProvenanceEntityRole.REVISION; +// case QUOTATION: return org.hl7.fhir.dstu2.model.Provenance.ProvenanceEntityRole.QUOTATION; +// case SOURCE: return org.hl7.fhir.dstu2.model.Provenance.ProvenanceEntityRole.SOURCE; +// default: return org.hl7.fhir.dstu2.model.Provenance.ProvenanceEntityRole.NULL; +// } +// } + + public org.hl7.fhir.r5.model.Questionnaire convertQuestionnaire(org.hl7.fhir.dstu2.model.Questionnaire src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Questionnaire tgt = new org.hl7.fhir.r5.model.Questionnaire(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + tgt.setVersion(src.getVersion()); + tgt.setStatus(convertQuestionnaireStatus(src.getStatus())); + if (src.hasDate()) + tgt.setDate(src.getDate()); + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.dstu2.model.ContactPoint t : src.getTelecom()) + tgt.addContact(convertQuestionnaireContactComponent(t)); + org.hl7.fhir.dstu2.model.Questionnaire.GroupComponent root = src.getGroup(); + tgt.setTitle(root.getTitle()); + for (org.hl7.fhir.dstu2.model.Coding t : root.getConcept()) + tgt.addCode(convertCoding(t)); + for (org.hl7.fhir.dstu2.model.CodeType t : src.getSubjectType()) + tgt.addSubjectType(t.getValue()); + tgt.addItem(convertQuestionnaireGroupComponent(root)); + return tgt; + } + + public org.hl7.fhir.dstu2.model.Questionnaire convertQuestionnaire(org.hl7.fhir.r5.model.Questionnaire src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Questionnaire tgt = new org.hl7.fhir.dstu2.model.Questionnaire(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + tgt.setVersion(src.getVersion()); + tgt.setStatus(convertQuestionnaireStatus(src.getStatus())); + if (src.hasDate()) + tgt.setDate(src.getDate()); + tgt.setPublisher(src.getPublisher()); + for (ContactDetail t : src.getContact()) + for (org.hl7.fhir.r5.model.ContactPoint t1 : t.getTelecom()) + tgt.addTelecom(convertContactPoint(t1)); + org.hl7.fhir.dstu2.model.Questionnaire.GroupComponent root = tgt.getGroup(); + root.setTitle(src.getTitle()); + for (org.hl7.fhir.r5.model.Coding t : src.getCode()) { + root.addConcept(convertCoding(t)); + } + for (org.hl7.fhir.r5.model.CodeType t : src.getSubjectType()) + tgt.addSubjectType(t.getValue()); + for (org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemComponent t : src.getItem()) + if (t.getType() == org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.GROUP) + root.addGroup(convertQuestionnaireGroupComponent(t)); + else + root.addQuestion(convertQuestionnaireQuestionComponent(t)); + return tgt; + } + + public org.hl7.fhir.r5.model.ContactDetail convertQuestionnaireContactComponent(org.hl7.fhir.dstu2.model.ContactPoint src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.ContactDetail tgt = new org.hl7.fhir.r5.model.ContactDetail(); + copyElement(src, tgt); + tgt.addTelecom(convertContactPoint(src)); + return tgt; + } + + private static org.hl7.fhir.r5.model.Enumerations.PublicationStatus convertQuestionnaireStatus(org.hl7.fhir.dstu2.model.Questionnaire.QuestionnaireStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case DRAFT: return org.hl7.fhir.r5.model.Enumerations.PublicationStatus.DRAFT; + case PUBLISHED: return org.hl7.fhir.r5.model.Enumerations.PublicationStatus.ACTIVE; + case RETIRED: return org.hl7.fhir.r5.model.Enumerations.PublicationStatus.RETIRED; + default: return org.hl7.fhir.r5.model.Enumerations.PublicationStatus.NULL; + } + } + + private static org.hl7.fhir.dstu2.model.Questionnaire.QuestionnaireStatus convertQuestionnaireStatus(org.hl7.fhir.r5.model.Enumerations.PublicationStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case DRAFT: return org.hl7.fhir.dstu2.model.Questionnaire.QuestionnaireStatus.DRAFT; + case ACTIVE: return org.hl7.fhir.dstu2.model.Questionnaire.QuestionnaireStatus.PUBLISHED; + case RETIRED: return org.hl7.fhir.dstu2.model.Questionnaire.QuestionnaireStatus.RETIRED; + default: return org.hl7.fhir.dstu2.model.Questionnaire.QuestionnaireStatus.NULL; + } + } + + public org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemComponent convertQuestionnaireQuestionComponent(org.hl7.fhir.dstu2.model.Questionnaire.QuestionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemComponent tgt = new org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemComponent(); + copyElement(src, tgt); + tgt.setLinkId(src.getLinkId()); + for (org.hl7.fhir.dstu2.model.Coding t : src.getConcept()) + tgt.addCode(convertCoding(t)); + tgt.setText(src.getText()); + tgt.setType(convertQuestionnaireQuestionType(src.getType())); + tgt.setRequired(src.getRequired()); + tgt.setRepeats(src.getRepeats()); + tgt.setAnswerValueSetElement(convertReferenceToCanonical(src.getOptions())); + for (org.hl7.fhir.dstu2.model.Coding t : src.getOption()) + tgt.addAnswerOption().setValue(convertCoding(t)); + for (org.hl7.fhir.dstu2.model.Questionnaire.GroupComponent t : src.getGroup()) + tgt.addItem(convertQuestionnaireGroupComponent(t)); + return tgt; + } + + public org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemComponent convertQuestionnaireGroupComponent(org.hl7.fhir.dstu2.model.Questionnaire.GroupComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemComponent tgt = new org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemComponent(); + copyElement(src, tgt); + tgt.setLinkId(src.getLinkId()); + for (org.hl7.fhir.dstu2.model.Coding t : src.getConcept()) + tgt.addCode(convertCoding(t)); + tgt.setText(src.getText()); + tgt.setType(org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.GROUP); + tgt.setRequired(src.getRequired()); + tgt.setRepeats(src.getRepeats()); + for (org.hl7.fhir.dstu2.model.Questionnaire.GroupComponent t : src.getGroup()) + tgt.addItem(convertQuestionnaireGroupComponent(t)); + for (org.hl7.fhir.dstu2.model.Questionnaire.QuestionComponent t : src.getQuestion()) + tgt.addItem(convertQuestionnaireQuestionComponent(t)); + return tgt; + } + + public org.hl7.fhir.dstu2.model.Questionnaire.GroupComponent convertQuestionnaireGroupComponent(org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Questionnaire.GroupComponent tgt = new org.hl7.fhir.dstu2.model.Questionnaire.GroupComponent(); + copyElement(src, tgt); + tgt.setLinkId(src.getLinkId()); + for (org.hl7.fhir.r5.model.Coding t : src.getCode()) + tgt.addConcept(convertCoding(t)); + tgt.setText(src.getText()); + tgt.setRequired(src.getRequired()); + tgt.setRepeats(src.getRepeats()); + for (org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemComponent t : src.getItem()) + if (t.getType() == org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.GROUP) + tgt.addGroup(convertQuestionnaireGroupComponent(t)); + else + tgt.addQuestion(convertQuestionnaireQuestionComponent(t)); + return tgt; + } + + public org.hl7.fhir.dstu2.model.Questionnaire.QuestionComponent convertQuestionnaireQuestionComponent(org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Questionnaire.QuestionComponent tgt = new org.hl7.fhir.dstu2.model.Questionnaire.QuestionComponent(); + copyElement(src, tgt); + tgt.setLinkId(src.getLinkId()); + for (org.hl7.fhir.r5.model.Coding t : src.getCode()) + tgt.addConcept(convertCoding(t)); + tgt.setText(src.getText()); + tgt.setType(convertQuestionnaireItemType(src.getType())); + tgt.setRequired(src.getRequired()); + tgt.setRepeats(src.getRepeats()); + tgt.setOptions(convertCanonicalToReference(src.getAnswerValueSetElement())); + for (QuestionnaireItemAnswerOptionComponent t : src.getAnswerOption()) + if (t.hasValueCoding()) + try { + tgt.addOption(convertCoding(t.getValueCoding())); + } catch (org.hl7.fhir.exceptions.FHIRException e) { + throw new FHIRException(e); + } + for (org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemComponent t : src.getItem()) + tgt.addGroup(convertQuestionnaireGroupComponent(t)); + return tgt; + } + + public org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType convertQuestionnaireQuestionType(org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case BOOLEAN: return org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.BOOLEAN; + case DECIMAL: return org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.DECIMAL; + case INTEGER: return org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.INTEGER; + case DATE: return org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.DATE; + case DATETIME: return org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.DATETIME; + case INSTANT: return org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.DATETIME; + case TIME: return org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.TIME; + case STRING: return org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.STRING; + case TEXT: return org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.TEXT; + case URL: return org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.URL; + case CHOICE: return org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.CHOICE; + case OPENCHOICE: return org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.OPENCHOICE; + case ATTACHMENT: return org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.ATTACHMENT; + case REFERENCE: return org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.REFERENCE; + case QUANTITY: return org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.QUANTITY; + default: return org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.NULL; + } + } + + public org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat convertQuestionnaireItemType(org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case BOOLEAN: return org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat.BOOLEAN; + case DECIMAL: return org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat.DECIMAL; + case INTEGER: return org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat.INTEGER; + case DATE: return org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat.DATE; + case DATETIME: return org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat.DATETIME; + case TIME: return org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat.TIME; + case STRING: return org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat.STRING; + case TEXT: return org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat.TEXT; + case URL: return org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat.URL; + case CHOICE: return org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat.CHOICE; + case OPENCHOICE: return org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat.OPENCHOICE; + case ATTACHMENT: return org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat.ATTACHMENT; + case REFERENCE: return org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat.REFERENCE; + case QUANTITY: return org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat.QUANTITY; + default: return org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat.NULL; + } + } + + public org.hl7.fhir.r5.model.QuestionnaireResponse convertQuestionnaireResponse(org.hl7.fhir.dstu2.model.QuestionnaireResponse src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.QuestionnaireResponse tgt = new org.hl7.fhir.r5.model.QuestionnaireResponse(); + copyDomainResource(src, tgt); + tgt.setIdentifier(convertIdentifier(src.getIdentifier())); + tgt.setQuestionnaireElement(convertReferenceToCanonical(src.getQuestionnaire())); + tgt.setStatus(convertQuestionnaireResponseStatus(src.getStatus())); + tgt.setSubject(convertReference(src.getSubject())); + tgt.setAuthor(convertReference(src.getAuthor())); + tgt.setAuthored(src.getAuthored()); + tgt.setSource(convertReference(src.getSource())); + tgt.setEncounter(convertReference(src.getEncounter())); + if (src.hasGroup()) + tgt.addItem(convertQuestionnaireResponseGroupComponent(src.getGroup())); + return tgt; + } + + public org.hl7.fhir.dstu2.model.QuestionnaireResponse convertQuestionnaireResponse(org.hl7.fhir.r5.model.QuestionnaireResponse src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.QuestionnaireResponse tgt = new org.hl7.fhir.dstu2.model.QuestionnaireResponse(); + copyDomainResource(src, tgt); + tgt.setIdentifier(convertIdentifier(src.getIdentifier())); + tgt.setQuestionnaire(convertCanonicalToReference(src.getQuestionnaireElement())); + tgt.setStatus(convertQuestionnaireResponseStatus(src.getStatus())); + tgt.setSubject(convertReference(src.getSubject())); + tgt.setAuthor(convertReference(src.getAuthor())); + tgt.setAuthored(src.getAuthored()); + tgt.setSource(convertReference(src.getSource())); + tgt.setEncounter(convertReference(src.getEncounter())); + + if (src.getItem().size() != 1) + throw new FHIRException("multiple root items not supported"); // though we could define a placeholder group? + + tgt.setGroup(convertQuestionnaireItemToGroup(src.getItem().get(0))); + return tgt; + } + + + public org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseStatus convertQuestionnaireResponseStatus(org.hl7.fhir.dstu2.model.QuestionnaireResponse.QuestionnaireResponseStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case INPROGRESS: return org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseStatus.INPROGRESS; + case COMPLETED: return org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseStatus.COMPLETED; + case AMENDED: return org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseStatus.AMENDED; + default: return org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseStatus.NULL; + } + } + + public org.hl7.fhir.dstu2.model.QuestionnaireResponse.QuestionnaireResponseStatus convertQuestionnaireResponseStatus(org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case INPROGRESS: return org.hl7.fhir.dstu2.model.QuestionnaireResponse.QuestionnaireResponseStatus.INPROGRESS; + case COMPLETED: return org.hl7.fhir.dstu2.model.QuestionnaireResponse.QuestionnaireResponseStatus.COMPLETED; + case AMENDED: return org.hl7.fhir.dstu2.model.QuestionnaireResponse.QuestionnaireResponseStatus.AMENDED; + default: return org.hl7.fhir.dstu2.model.QuestionnaireResponse.QuestionnaireResponseStatus.NULL; + } + } + + public org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseItemComponent convertQuestionnaireResponseGroupComponent(org.hl7.fhir.dstu2.model.QuestionnaireResponse.GroupComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseItemComponent tgt = new org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseItemComponent(); + copyElement(src, tgt); + tgt.setLinkId(src.getLinkId()); + tgt.setText(src.getText()); +// tgt.setSubject(convertReference(src.getSubject())); + for (org.hl7.fhir.dstu2.model.QuestionnaireResponse.GroupComponent t : src.getGroup()) + tgt.addItem(convertQuestionnaireResponseGroupComponent(t)); + for (org.hl7.fhir.dstu2.model.QuestionnaireResponse.QuestionComponent t : src.getQuestion()) + tgt.addItem(convertQuestionnaireResponseQuestionComponent(t)); + return tgt; + } + + public org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseItemComponent convertQuestionnaireResponseQuestionComponent(org.hl7.fhir.dstu2.model.QuestionnaireResponse.QuestionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseItemComponent tgt = new org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseItemComponent(); + copyElement(src, tgt); + tgt.setLinkId(src.getLinkId()); + tgt.setText(src.getText()); + for (org.hl7.fhir.dstu2.model.QuestionnaireResponse.QuestionAnswerComponent t : src.getAnswer()) + tgt.addAnswer(convertQuestionnaireResponseItemAnswerComponent(t)); + return tgt; + } + + public org.hl7.fhir.dstu2.model.QuestionnaireResponse.GroupComponent convertQuestionnaireItemToGroup(org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseItemComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.QuestionnaireResponse.GroupComponent tgt = new org.hl7.fhir.dstu2.model.QuestionnaireResponse.GroupComponent(); + copyElement(src, tgt); + tgt.setLinkId(src.getLinkId()); + tgt.setText(src.getText()); +// tgt.setSubject(convertReference(src.getSubject())); + for (org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseItemComponent t : src.getItem()) + if (t.hasAnswer()) + tgt.addQuestion(convertQuestionnaireItemToQuestion(t)); + else + tgt.addGroup(convertQuestionnaireItemToGroup(t)); + return tgt; + } + + public org.hl7.fhir.dstu2.model.QuestionnaireResponse.QuestionComponent convertQuestionnaireItemToQuestion(org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseItemComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.QuestionnaireResponse.QuestionComponent tgt = new org.hl7.fhir.dstu2.model.QuestionnaireResponse.QuestionComponent(); + copyElement(src, tgt); + tgt.setLinkId(src.getLinkId()); + tgt.setText(src.getText()); + for (org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent t : src.getAnswer()) + tgt.addAnswer(convertQuestionnaireResponseItemAnswerComponent(t)); + return tgt; + } + + public org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent convertQuestionnaireResponseItemAnswerComponent(org.hl7.fhir.dstu2.model.QuestionnaireResponse.QuestionAnswerComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent tgt = new org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent(); + copyElement(src, tgt); + tgt.setValue(convertType(src.getValue())); + for (org.hl7.fhir.dstu2.model.QuestionnaireResponse.GroupComponent t : src.getGroup()) + tgt.addItem(convertQuestionnaireResponseGroupComponent(t)); + return tgt; + } + + public org.hl7.fhir.dstu2.model.QuestionnaireResponse.QuestionAnswerComponent convertQuestionnaireResponseItemAnswerComponent(org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.QuestionnaireResponse.QuestionAnswerComponent tgt = new org.hl7.fhir.dstu2.model.QuestionnaireResponse.QuestionAnswerComponent(); + copyElement(src, tgt); + tgt.setValue(convertType(src.getValue())); + for (org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseItemComponent t : src.getItem()) + tgt.addGroup(convertQuestionnaireItemToGroup(t)); + return tgt; + } + + + public org.hl7.fhir.r5.model.RiskAssessment convertRiskAssessment(org.hl7.fhir.dstu2.model.RiskAssessment src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.RiskAssessment tgt = new org.hl7.fhir.r5.model.RiskAssessment(); + copyDomainResource(src, tgt); + tgt.setSubject(convertReference(src.getSubject())); +// tgt.setDate(src.getDate()); + tgt.setCondition(convertReference(src.getCondition())); + tgt.setEncounter(convertReference(src.getEncounter())); + tgt.setPerformer(convertReference(src.getPerformer())); + tgt.addIdentifier(convertIdentifier(src.getIdentifier())); + tgt.setMethod(convertCodeableConcept(src.getMethod())); + for (org.hl7.fhir.dstu2.model.Reference t : src.getBasis()) + tgt.addBasis(convertReference(t)); + for (org.hl7.fhir.dstu2.model.RiskAssessment.RiskAssessmentPredictionComponent t : src.getPrediction()) + tgt.addPrediction(convertRiskAssessmentPredictionComponent(t)); + tgt.setMitigation(src.getMitigation()); + return tgt; + } + + public org.hl7.fhir.dstu2.model.RiskAssessment convertRiskAssessment(org.hl7.fhir.r5.model.RiskAssessment src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.RiskAssessment tgt = new org.hl7.fhir.dstu2.model.RiskAssessment(); + copyDomainResource(src, tgt); + tgt.setSubject(convertReference(src.getSubject())); +// tgt.setDateElement(src.getOccurrenceDateTimeType()); + tgt.setCondition(convertReference(src.getCondition())); + tgt.setEncounter(convertReference(src.getEncounter())); + tgt.setPerformer(convertReference(src.getPerformer())); + tgt.setIdentifier(convertIdentifier(src.getIdentifierFirstRep())); + tgt.setMethod(convertCodeableConcept(src.getMethod())); + for (org.hl7.fhir.r5.model.Reference t : src.getBasis()) + tgt.addBasis(convertReference(t)); + for (org.hl7.fhir.r5.model.RiskAssessment.RiskAssessmentPredictionComponent t : src.getPrediction()) + tgt.addPrediction(convertRiskAssessmentPredictionComponent(t)); + tgt.setMitigation(src.getMitigation()); + return tgt; + } + + public org.hl7.fhir.r5.model.RiskAssessment.RiskAssessmentPredictionComponent convertRiskAssessmentPredictionComponent(org.hl7.fhir.dstu2.model.RiskAssessment.RiskAssessmentPredictionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.RiskAssessment.RiskAssessmentPredictionComponent tgt = new org.hl7.fhir.r5.model.RiskAssessment.RiskAssessmentPredictionComponent(); + copyElement(src, tgt); + tgt.setOutcome(convertCodeableConcept(src.getOutcome())); + tgt.setProbability(convertType(src.getProbability())); + tgt.setRelativeRisk(src.getRelativeRisk()); + tgt.setWhen(convertType(src.getWhen())); + tgt.setRationale(src.getRationale()); + return tgt; + } + + public org.hl7.fhir.dstu2.model.RiskAssessment.RiskAssessmentPredictionComponent convertRiskAssessmentPredictionComponent(org.hl7.fhir.r5.model.RiskAssessment.RiskAssessmentPredictionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.RiskAssessment.RiskAssessmentPredictionComponent tgt = new org.hl7.fhir.dstu2.model.RiskAssessment.RiskAssessmentPredictionComponent(); + copyElement(src, tgt); + tgt.setOutcome(convertCodeableConcept(src.getOutcome())); + tgt.setProbability(convertType(src.getProbability())); + tgt.setRelativeRisk(src.getRelativeRisk()); + tgt.setWhen(convertType(src.getWhen())); + tgt.setRationale(src.getRationale()); + return tgt; + } + + public org.hl7.fhir.r5.model.Schedule convertSchedule(org.hl7.fhir.dstu2.model.Schedule src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Schedule tgt = new org.hl7.fhir.r5.model.Schedule(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getType()) + tgt.addServiceType(convertCodeableConcept(t)); + tgt.addActor(convertReference(src.getActor())); + tgt.setPlanningHorizon(convertPeriod(src.getPlanningHorizon())); + tgt.setComment(src.getComment()); + return tgt; + } + + public org.hl7.fhir.dstu2.model.Schedule convertSchedule(org.hl7.fhir.r5.model.Schedule src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Schedule tgt = new org.hl7.fhir.dstu2.model.Schedule(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getServiceType()) + tgt.addType(convertCodeableConcept(t)); + tgt.setActor(convertReference(src.getActorFirstRep())); + tgt.setPlanningHorizon(convertPeriod(src.getPlanningHorizon())); + tgt.setComment(src.getComment()); + return tgt; + } + + public org.hl7.fhir.r5.model.SearchParameter convertSearchParameter(org.hl7.fhir.dstu2.model.SearchParameter src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.SearchParameter tgt = new org.hl7.fhir.r5.model.SearchParameter(); + copyDomainResource(src, tgt); + tgt.setUrl(src.getUrl()); + tgt.setName(src.getName()); + tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasDate()) + tgt.setDate(src.getDate()); + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.dstu2.model.SearchParameter.SearchParameterContactComponent t : src.getContact()) + tgt.addContact(convertSearchParameterContactComponent(t)); + tgt.setPurpose(src.getRequirements()); + tgt.setCode(src.getCode()); + tgt.addBase(src.getBase()); + tgt.setType(convertSearchParamType(src.getType())); + tgt.setDescription(src.getDescription()); + tgt.setExpression(ToolingExtensions.readStringExtension(src, ToolingExtensions.EXT_EXPRESSION)); + tgt.setXpath(src.getXpath()); + tgt.setXpathUsage(convertXPathUsageType(src.getXpathUsage())); + for (org.hl7.fhir.dstu2.model.CodeType t : src.getTarget()) + tgt.addTarget(t.getValue()); + return tgt; + } + + public org.hl7.fhir.dstu2.model.SearchParameter convertSearchParameter(org.hl7.fhir.r5.model.SearchParameter src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.SearchParameter tgt = new org.hl7.fhir.dstu2.model.SearchParameter(); + copyDomainResource(src, tgt); + tgt.setUrl(src.getUrl()); + tgt.setName(src.getName()); + tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasDate()) + tgt.setDate(src.getDate()); + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.r5.model.ContactDetail t : src.getContact()) + tgt.addContact(convertSearchParameterContactComponent(t)); + tgt.setRequirements(src.getPurpose()); + tgt.setCode(src.getCode()); + for (org.hl7.fhir.r5.model.CodeType t : src.getBase()) + tgt.setBase(t.asStringValue()); + tgt.setType(convertSearchParamType(src.getType())); + tgt.setDescription(src.getDescription()); + org.hl7.fhir.dstu2.utils.ToolingExtensions.setStringExtension(tgt, ToolingExtensions.EXT_EXPRESSION, src.getExpression()); + tgt.setXpath(src.getXpath()); + tgt.setXpathUsage(convertXPathUsageType(src.getXpathUsage())); + for (org.hl7.fhir.r5.model.CodeType t : src.getTarget()) + tgt.addTarget(t.getValue()); + return tgt; + } + + public org.hl7.fhir.r5.model.SearchParameter.XPathUsageType convertXPathUsageType(org.hl7.fhir.dstu2.model.SearchParameter.XPathUsageType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case NORMAL: return org.hl7.fhir.r5.model.SearchParameter.XPathUsageType.NORMAL; + case PHONETIC: return org.hl7.fhir.r5.model.SearchParameter.XPathUsageType.PHONETIC; + case NEARBY: return org.hl7.fhir.r5.model.SearchParameter.XPathUsageType.NEARBY; + case DISTANCE: return org.hl7.fhir.r5.model.SearchParameter.XPathUsageType.DISTANCE; + case OTHER: return org.hl7.fhir.r5.model.SearchParameter.XPathUsageType.OTHER; + default: return org.hl7.fhir.r5.model.SearchParameter.XPathUsageType.NULL; + } + } + + public org.hl7.fhir.dstu2.model.SearchParameter.XPathUsageType convertXPathUsageType(org.hl7.fhir.r5.model.SearchParameter.XPathUsageType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case NORMAL: return org.hl7.fhir.dstu2.model.SearchParameter.XPathUsageType.NORMAL; + case PHONETIC: return org.hl7.fhir.dstu2.model.SearchParameter.XPathUsageType.PHONETIC; + case NEARBY: return org.hl7.fhir.dstu2.model.SearchParameter.XPathUsageType.NEARBY; + case DISTANCE: return org.hl7.fhir.dstu2.model.SearchParameter.XPathUsageType.DISTANCE; + case OTHER: return org.hl7.fhir.dstu2.model.SearchParameter.XPathUsageType.OTHER; + default: return org.hl7.fhir.dstu2.model.SearchParameter.XPathUsageType.NULL; + } + } + + public org.hl7.fhir.r5.model.ContactDetail convertSearchParameterContactComponent(org.hl7.fhir.dstu2.model.SearchParameter.SearchParameterContactComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.ContactDetail tgt = new org.hl7.fhir.r5.model.ContactDetail(); + copyElement(src, tgt); + tgt.setName(src.getName()); + for (org.hl7.fhir.dstu2.model.ContactPoint t : src.getTelecom()) + tgt.addTelecom(convertContactPoint(t)); + return tgt; + } + + public org.hl7.fhir.dstu2.model.SearchParameter.SearchParameterContactComponent convertSearchParameterContactComponent(org.hl7.fhir.r5.model.ContactDetail src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.SearchParameter.SearchParameterContactComponent tgt = new org.hl7.fhir.dstu2.model.SearchParameter.SearchParameterContactComponent(); + copyElement(src, tgt); + tgt.setName(src.getName()); + for (org.hl7.fhir.r5.model.ContactPoint t : src.getTelecom()) + tgt.addTelecom(convertContactPoint(t)); + return tgt; + } + + public org.hl7.fhir.r5.model.Slot convertSlot(org.hl7.fhir.dstu2.model.Slot src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Slot tgt = new org.hl7.fhir.r5.model.Slot(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasType()) + tgt.addServiceType(convertCodeableConcept(src.getType())); + tgt.setSchedule(convertReference(src.getSchedule())); + tgt.setStart(src.getStart()); + tgt.setEnd(src.getEnd()); + tgt.setOverbooked(src.getOverbooked()); + tgt.setComment(src.getComment()); + return tgt; + } + + public org.hl7.fhir.dstu2.model.Slot convertSlot(org.hl7.fhir.r5.model.Slot src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Slot tgt = new org.hl7.fhir.dstu2.model.Slot(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getServiceType()) + tgt.setType(convertCodeableConcept(t)); + tgt.setSchedule(convertReference(src.getSchedule())); + tgt.setStart(src.getStart()); + tgt.setEnd(src.getEnd()); + tgt.setOverbooked(src.getOverbooked()); + tgt.setComment(src.getComment()); + return tgt; + } + + public org.hl7.fhir.r5.model.Slot.SlotStatus convertSlotStatus(org.hl7.fhir.dstu2.model.Slot.SlotStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case BUSY: return org.hl7.fhir.r5.model.Slot.SlotStatus.BUSY; + case FREE: return org.hl7.fhir.r5.model.Slot.SlotStatus.FREE; + case BUSYUNAVAILABLE: return org.hl7.fhir.r5.model.Slot.SlotStatus.BUSYUNAVAILABLE; + case BUSYTENTATIVE: return org.hl7.fhir.r5.model.Slot.SlotStatus.BUSYTENTATIVE; + default: return org.hl7.fhir.r5.model.Slot.SlotStatus.NULL; + } + } + + public org.hl7.fhir.dstu2.model.Slot.SlotStatus convertSlotStatus(org.hl7.fhir.r5.model.Slot.SlotStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case BUSY: return org.hl7.fhir.dstu2.model.Slot.SlotStatus.BUSY; + case FREE: return org.hl7.fhir.dstu2.model.Slot.SlotStatus.FREE; + case BUSYUNAVAILABLE: return org.hl7.fhir.dstu2.model.Slot.SlotStatus.BUSYUNAVAILABLE; + case BUSYTENTATIVE: return org.hl7.fhir.dstu2.model.Slot.SlotStatus.BUSYTENTATIVE; + default: return org.hl7.fhir.dstu2.model.Slot.SlotStatus.NULL; + } + } + + public org.hl7.fhir.r5.model.StructureDefinition convertStructureDefinition(org.hl7.fhir.dstu2.model.StructureDefinition src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.StructureDefinition tgt = new org.hl7.fhir.r5.model.StructureDefinition(); + copyDomainResource(src, tgt); + tgt.setUrl(src.getUrl()); + for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + tgt.setVersion(src.getVersion()); + tgt.setName(src.getName()); + tgt.setTitle(src.getDisplay()); + tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionContactComponent t : src.getContact()) + tgt.addContact(convertStructureDefinitionContactComponent(t)); + if (src.hasDate()) + tgt.setDate(src.getDate()); + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getUseContext()) + if (isJurisdiction(t)) + tgt.addJurisdiction(convertCodeableConcept(t)); + else + tgt.addUseContext(convertCodeableConceptToUsageContext(t)); + tgt.setPurpose(src.getRequirements()); + tgt.setCopyright(src.getCopyright()); + for (org.hl7.fhir.dstu2.model.Coding t : src.getCode()) + tgt.addKeyword(convertCoding(t)); + tgt.setFhirVersion(org.hl7.fhir.r5.model.Enumerations.FHIRVersion.fromCode(src.getFhirVersion())); + for (org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionMappingComponent t : src.getMapping()) + tgt.addMapping(convertStructureDefinitionMappingComponent(t)); + tgt.setKind(convertStructureDefinitionKind(src.getKind(), tgt.getId())); + tgt.setAbstract(src.getAbstract()); + for (org.hl7.fhir.dstu2.model.StringType t : src.getContext()) { + org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionContextComponent ec = tgt.addContext(); + ec.setType(convertExtensionContext(src.getContextType())); + ec.setExpression(t.getValue()); + } + if (src.hasConstrainedType()) + tgt.setType(src.getConstrainedType()); + else if (src.getSnapshot().hasElement()) + tgt.setType(src.getSnapshot().getElement().get(0).getPath()); + else if (src.getDifferential().hasElement() && !src.getDifferential().getElement().get(0).getPath().contains(".")) + tgt.setType(src.getDifferential().getElement().get(0).getPath()); + else + tgt.setType(src.getDifferential().getElement().get(0).getPath().substring(0, src.getDifferential().getElement().get(0).getPath().indexOf("."))); + tgt.setBaseDefinition(src.getBase()); + tgt.setDerivation(src.hasConstrainedType() ? org.hl7.fhir.r5.model.StructureDefinition.TypeDerivationRule.CONSTRAINT : org.hl7.fhir.r5.model.StructureDefinition.TypeDerivationRule.SPECIALIZATION); + tgt.setSnapshot(convertStructureDefinitionSnapshotComponent(src.getSnapshot())); + tgt.setDifferential(convertStructureDefinitionDifferentialComponent(src.getDifferential())); + if (tgt.hasSnapshot()) + tgt.getSnapshot().getElementFirstRep().getType().clear(); + if (tgt.hasDifferential()) + tgt.getDifferential().getElementFirstRep().getType().clear(); + + + if (tgt.getKind() == StructureDefinitionKind.PRIMITIVETYPE && !tgt.getType().equals(tgt.getId())) { + tgt.setDerivation(TypeDerivationRule.SPECIALIZATION); + tgt.setBaseDefinition("http://hl7.org/fhir/StructureDefinition/"+tgt.getType()); +// for (ElementDefinition ed : tgt.getSnapshot().getElement()) { +// ed.setPath(ed.getPath().replace(tgt.getType()+".", tgt.getId()+".")); +// } +// for (ElementDefinition ed : tgt.getDifferential().getElement()) { +// ed.setPath(ed.getPath().replace(tgt.getType()+".", tgt.getId()+".")); +// } + tgt.setType(tgt.getId()); + } + if (tgt.getDerivation() == TypeDerivationRule.SPECIALIZATION) { + for (ElementDefinition ed : tgt.getSnapshot().getElement()) { + if (!ed.hasBase()) { + ed.getBase().setPath(ed.getPath()).setMin(ed.getMin()).setMax(ed.getMax()); + } + } + } + return tgt; + } + + public org.hl7.fhir.dstu2.model.StructureDefinition convertStructureDefinition(org.hl7.fhir.r5.model.StructureDefinition src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.StructureDefinition tgt = new org.hl7.fhir.dstu2.model.StructureDefinition(); + copyDomainResource(src, tgt); + tgt.setUrl(src.getUrl()); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + tgt.setVersion(src.getVersion()); + tgt.setName(src.getName()); + tgt.setDisplay(src.getTitle()); + tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.r5.model.ContactDetail t : src.getContact()) + tgt.addContact(convertStructureDefinitionContactComponent(t)); + if (src.hasDate()) + tgt.setDate(src.getDate()); + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.r5.model.UsageContext t : src.getUseContext()) + if (t.hasValueCodeableConcept()) + tgt.addUseContext(convertCodeableConcept(t.getValueCodeableConcept())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getJurisdiction()) + tgt.addUseContext(convertCodeableConcept(t)); + tgt.setRequirements(src.getPurpose()); + tgt.setCopyright(src.getCopyright()); + for (org.hl7.fhir.r5.model.Coding t : src.getKeyword()) + tgt.addCode(convertCoding(t)); + if (src.hasFhirVersion()) + tgt.setFhirVersion(src.getFhirVersion().toCode()); + for (org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionMappingComponent t : src.getMapping()) + tgt.addMapping(convertStructureDefinitionMappingComponent(t)); + tgt.setKind(convertStructureDefinitionKind(src.getKind())); + tgt.setAbstract(src.getAbstract()); + for (org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionContextComponent t : src.getContext()) { + if (!tgt.hasContextType()) + tgt.setContextType(convertExtensionContext(t.getType())); + tgt.addContext(t.getExpression()); + } + tgt.setConstrainedType(src.getType()); + tgt.setBase(src.getBaseDefinition()); + tgt.setSnapshot(convertStructureDefinitionSnapshotComponent(src.getSnapshot())); + tgt.setDifferential(convertStructureDefinitionDifferentialComponent(src.getDifferential())); + if (tgt.hasBase()) { + if (tgt.hasDifferential()) + tgt.getDifferential().getElement().get(0).addType().setCode(tail(tgt.getBase())); + if (tgt.hasSnapshot()) + tgt.getSnapshot().getElement().get(0).addType().setCode(tail(tgt.getBase())); + } + return tgt; + } + + private String tail(String base) { + return base.substring(base.lastIndexOf("/")+1); + } + + public org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionKind convertStructureDefinitionKind(org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionKind src, String dtName) throws FHIRException { + if (src == null) + return null; + switch (src) { + case DATATYPE: + if (Utilities.existsInList(dtName, "boolean", "integer", "decimal", "base64Binary", "instant", "string", "uri", "date", "dateTime", "time", "code", "oid", "uuid", "id", "unsignedInt", "positiveInt", "markdown", "xhtml", "url", "canonical")) + return org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionKind.PRIMITIVETYPE; + else + return org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionKind.COMPLEXTYPE; + case RESOURCE: return org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionKind.RESOURCE; + case LOGICAL: return org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionKind.LOGICAL; + default: return org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionKind.NULL; + } + } + + public org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionKind convertStructureDefinitionKind(org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionKind src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PRIMITIVETYPE: return org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionKind.DATATYPE; + case COMPLEXTYPE: return org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionKind.DATATYPE; + case RESOURCE: return org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionKind.RESOURCE; + case LOGICAL: return org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionKind.LOGICAL; + default: return org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionKind.NULL; + } + } + + private static org.hl7.fhir.r5.model.StructureDefinition.ExtensionContextType convertExtensionContext(org.hl7.fhir.dstu2.model.StructureDefinition.ExtensionContext src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case RESOURCE: return org.hl7.fhir.r5.model.StructureDefinition.ExtensionContextType.FHIRPATH; + case DATATYPE: return org.hl7.fhir.r5.model.StructureDefinition.ExtensionContextType.ELEMENT; + case EXTENSION: return org.hl7.fhir.r5.model.StructureDefinition.ExtensionContextType.EXTENSION; + default: return org.hl7.fhir.r5.model.StructureDefinition.ExtensionContextType.NULL; + } + } + + private static org.hl7.fhir.dstu2.model.StructureDefinition.ExtensionContext convertExtensionContext(org.hl7.fhir.r5.model.StructureDefinition.ExtensionContextType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case FHIRPATH: return org.hl7.fhir.dstu2.model.StructureDefinition.ExtensionContext.RESOURCE; + case ELEMENT: return org.hl7.fhir.dstu2.model.StructureDefinition.ExtensionContext.DATATYPE; + case EXTENSION: return org.hl7.fhir.dstu2.model.StructureDefinition.ExtensionContext.EXTENSION; + default: return org.hl7.fhir.dstu2.model.StructureDefinition.ExtensionContext.NULL; + } + } + + + public org.hl7.fhir.r5.model.ContactDetail convertStructureDefinitionContactComponent(org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionContactComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.ContactDetail tgt = new org.hl7.fhir.r5.model.ContactDetail(); + copyElement(src, tgt); + tgt.setName(src.getName()); + for (org.hl7.fhir.dstu2.model.ContactPoint t : src.getTelecom()) + tgt.addTelecom(convertContactPoint(t)); + return tgt; + } + + public org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionContactComponent convertStructureDefinitionContactComponent(org.hl7.fhir.r5.model.ContactDetail src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionContactComponent tgt = new org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionContactComponent(); + copyElement(src, tgt); + tgt.setName(src.getName()); + for (org.hl7.fhir.r5.model.ContactPoint t : src.getTelecom()) + tgt.addTelecom(convertContactPoint(t)); + return tgt; + } + + public org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionMappingComponent convertStructureDefinitionMappingComponent(org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionMappingComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionMappingComponent tgt = new org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionMappingComponent(); + copyElement(src, tgt); + tgt.setIdentity(src.getIdentity()); + tgt.setUri(src.getUri()); + tgt.setName(src.getName()); + tgt.setComment(src.getComments()); + return tgt; + } + + public org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionMappingComponent convertStructureDefinitionMappingComponent(org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionMappingComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionMappingComponent tgt = new org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionMappingComponent(); + copyElement(src, tgt); + tgt.setIdentity(src.getIdentity()); + tgt.setUri(src.getUri()); + tgt.setName(src.getName()); + tgt.setComments(src.getComment()); + return tgt; + } + + public org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionSnapshotComponent convertStructureDefinitionSnapshotComponent(org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionSnapshotComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionSnapshotComponent tgt = new org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionSnapshotComponent(); + copyElement(src, tgt); + List slicePaths = new ArrayList(); + for (org.hl7.fhir.dstu2.model.ElementDefinition t : src.getElement()) { + if (t.hasSlicing()) + slicePaths.add(t.getPath()); + tgt.addElement(convertElementDefinition(t, slicePaths, src.getElement(), src.getElement().indexOf(t))); + } + return tgt; + } + + public org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionSnapshotComponent convertStructureDefinitionSnapshotComponent(org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionSnapshotComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionSnapshotComponent tgt = new org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionSnapshotComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.r5.model.ElementDefinition t : src.getElement()) + tgt.addElement(convertElementDefinition(t)); + return tgt; + } + + public org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionDifferentialComponent convertStructureDefinitionDifferentialComponent(org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionDifferentialComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionDifferentialComponent tgt = new org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionDifferentialComponent(); + copyElement(src, tgt); + List slicePaths = new ArrayList(); + for (org.hl7.fhir.dstu2.model.ElementDefinition t : src.getElement()) { + if (t.hasSlicing()) + slicePaths.add(t.getPath()); + tgt.addElement(convertElementDefinition(t, slicePaths, src.getElement(), src.getElement().indexOf(t))); + } + return tgt; + } + + public org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionDifferentialComponent convertStructureDefinitionDifferentialComponent(org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionDifferentialComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionDifferentialComponent tgt = new org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionDifferentialComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.r5.model.ElementDefinition t : src.getElement()) + tgt.addElement(convertElementDefinition(t)); + return tgt; + } + + public org.hl7.fhir.r5.model.Subscription convertSubscription(org.hl7.fhir.dstu2.model.Subscription src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Subscription tgt = new org.hl7.fhir.r5.model.Subscription(); + copyDomainResource(src, tgt); + tgt.setCriteria(src.getCriteria()); + for (org.hl7.fhir.dstu2.model.ContactPoint t : src.getContact()) + tgt.addContact(convertContactPoint(t)); + tgt.setReason(src.getReason()); + tgt.setStatus(convertSubscriptionStatus(src.getStatus())); + tgt.setError(src.getError()); + tgt.setChannel(convertSubscriptionChannelComponent(src.getChannel())); + tgt.setEnd(src.getEnd()); + return tgt; + } + + public org.hl7.fhir.dstu2.model.Subscription convertSubscription(org.hl7.fhir.r5.model.Subscription src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Subscription tgt = new org.hl7.fhir.dstu2.model.Subscription(); + copyDomainResource(src, tgt); + tgt.setCriteria(src.getCriteria()); + for (org.hl7.fhir.r5.model.ContactPoint t : src.getContact()) + tgt.addContact(convertContactPoint(t)); + tgt.setReason(src.getReason()); + tgt.setStatus(convertSubscriptionStatus(src.getStatus())); + tgt.setError(src.getError()); + tgt.setChannel(convertSubscriptionChannelComponent(src.getChannel())); + tgt.setEnd(src.getEnd()); + return tgt; + } + + public org.hl7.fhir.r5.model.Subscription.SubscriptionStatus convertSubscriptionStatus(org.hl7.fhir.dstu2.model.Subscription.SubscriptionStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case REQUESTED: return org.hl7.fhir.r5.model.Subscription.SubscriptionStatus.REQUESTED; + case ACTIVE: return org.hl7.fhir.r5.model.Subscription.SubscriptionStatus.ACTIVE; + case ERROR: return org.hl7.fhir.r5.model.Subscription.SubscriptionStatus.ERROR; + case OFF: return org.hl7.fhir.r5.model.Subscription.SubscriptionStatus.OFF; + default: return org.hl7.fhir.r5.model.Subscription.SubscriptionStatus.NULL; + } + } + + public org.hl7.fhir.dstu2.model.Subscription.SubscriptionStatus convertSubscriptionStatus(org.hl7.fhir.r5.model.Subscription.SubscriptionStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case REQUESTED: return org.hl7.fhir.dstu2.model.Subscription.SubscriptionStatus.REQUESTED; + case ACTIVE: return org.hl7.fhir.dstu2.model.Subscription.SubscriptionStatus.ACTIVE; + case ERROR: return org.hl7.fhir.dstu2.model.Subscription.SubscriptionStatus.ERROR; + case OFF: return org.hl7.fhir.dstu2.model.Subscription.SubscriptionStatus.OFF; + default: return org.hl7.fhir.dstu2.model.Subscription.SubscriptionStatus.NULL; + } + } + + public org.hl7.fhir.r5.model.Subscription.SubscriptionChannelComponent convertSubscriptionChannelComponent(org.hl7.fhir.dstu2.model.Subscription.SubscriptionChannelComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Subscription.SubscriptionChannelComponent tgt = new org.hl7.fhir.r5.model.Subscription.SubscriptionChannelComponent(); + copyElement(src, tgt); + tgt.setType(convertSubscriptionChannelType(src.getType())); + tgt.setEndpoint(src.getEndpoint()); + tgt.setPayload(src.getPayload()); + tgt.addHeader(src.getHeader()); + return tgt; + } + + public org.hl7.fhir.dstu2.model.Subscription.SubscriptionChannelComponent convertSubscriptionChannelComponent(org.hl7.fhir.r5.model.Subscription.SubscriptionChannelComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Subscription.SubscriptionChannelComponent tgt = new org.hl7.fhir.dstu2.model.Subscription.SubscriptionChannelComponent(); + copyElement(src, tgt); + tgt.setType(convertSubscriptionChannelType(src.getType())); + tgt.setEndpoint(src.getEndpoint()); + tgt.setPayload(src.getPayload()); + if (src.hasHeader()) + tgt.setHeaderElement(convertString(src.getHeader().get(0))); + return tgt; + } + + public org.hl7.fhir.r5.model.Subscription.SubscriptionChannelType convertSubscriptionChannelType(org.hl7.fhir.dstu2.model.Subscription.SubscriptionChannelType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case RESTHOOK: return org.hl7.fhir.r5.model.Subscription.SubscriptionChannelType.RESTHOOK; + case WEBSOCKET: return org.hl7.fhir.r5.model.Subscription.SubscriptionChannelType.WEBSOCKET; + case EMAIL: return org.hl7.fhir.r5.model.Subscription.SubscriptionChannelType.EMAIL; + case SMS: return org.hl7.fhir.r5.model.Subscription.SubscriptionChannelType.SMS; + case MESSAGE: return org.hl7.fhir.r5.model.Subscription.SubscriptionChannelType.MESSAGE; + default: return org.hl7.fhir.r5.model.Subscription.SubscriptionChannelType.NULL; + } + } + + public org.hl7.fhir.dstu2.model.Subscription.SubscriptionChannelType convertSubscriptionChannelType(org.hl7.fhir.r5.model.Subscription.SubscriptionChannelType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case RESTHOOK: return org.hl7.fhir.dstu2.model.Subscription.SubscriptionChannelType.RESTHOOK; + case WEBSOCKET: return org.hl7.fhir.dstu2.model.Subscription.SubscriptionChannelType.WEBSOCKET; + case EMAIL: return org.hl7.fhir.dstu2.model.Subscription.SubscriptionChannelType.EMAIL; + case SMS: return org.hl7.fhir.dstu2.model.Subscription.SubscriptionChannelType.SMS; + case MESSAGE: return org.hl7.fhir.dstu2.model.Subscription.SubscriptionChannelType.MESSAGE; + default: return org.hl7.fhir.dstu2.model.Subscription.SubscriptionChannelType.NULL; + } + } + + public org.hl7.fhir.r5.model.Substance convertSubstance(org.hl7.fhir.dstu2.model.Substance src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Substance tgt = new org.hl7.fhir.r5.model.Substance(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getCategory()) + tgt.addCategory(convertCodeableConcept(t)); + tgt.setCode(convertCodeableConcept(src.getCode())); + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu2.model.Substance.SubstanceInstanceComponent t : src.getInstance()) + tgt.addInstance(convertSubstanceInstanceComponent(t)); + for (org.hl7.fhir.dstu2.model.Substance.SubstanceIngredientComponent t : src.getIngredient()) + tgt.addIngredient(convertSubstanceIngredientComponent(t)); + return tgt; + } + + public org.hl7.fhir.dstu2.model.Substance convertSubstance(org.hl7.fhir.r5.model.Substance src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Substance tgt = new org.hl7.fhir.dstu2.model.Substance(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getCategory()) + tgt.addCategory(convertCodeableConcept(t)); + tgt.setCode(convertCodeableConcept(src.getCode())); + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.r5.model.Substance.SubstanceInstanceComponent t : src.getInstance()) + tgt.addInstance(convertSubstanceInstanceComponent(t)); + for (org.hl7.fhir.r5.model.Substance.SubstanceIngredientComponent t : src.getIngredient()) + tgt.addIngredient(convertSubstanceIngredientComponent(t)); + return tgt; + } + + public org.hl7.fhir.r5.model.Substance.SubstanceInstanceComponent convertSubstanceInstanceComponent(org.hl7.fhir.dstu2.model.Substance.SubstanceInstanceComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Substance.SubstanceInstanceComponent tgt = new org.hl7.fhir.r5.model.Substance.SubstanceInstanceComponent(); + copyElement(src, tgt); + tgt.setIdentifier(convertIdentifier(src.getIdentifier())); + tgt.setExpiry(src.getExpiry()); + tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); + return tgt; + } + + public org.hl7.fhir.dstu2.model.Substance.SubstanceInstanceComponent convertSubstanceInstanceComponent(org.hl7.fhir.r5.model.Substance.SubstanceInstanceComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Substance.SubstanceInstanceComponent tgt = new org.hl7.fhir.dstu2.model.Substance.SubstanceInstanceComponent(); + copyElement(src, tgt); + tgt.setIdentifier(convertIdentifier(src.getIdentifier())); + tgt.setExpiry(src.getExpiry()); + tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); + return tgt; + } + + public org.hl7.fhir.r5.model.Substance.SubstanceIngredientComponent convertSubstanceIngredientComponent(org.hl7.fhir.dstu2.model.Substance.SubstanceIngredientComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Substance.SubstanceIngredientComponent tgt = new org.hl7.fhir.r5.model.Substance.SubstanceIngredientComponent(); + copyElement(src, tgt); + tgt.setQuantity(convertRatio(src.getQuantity())); + tgt.setSubstance(convertReference(src.getSubstance())); + return tgt; + } + + public org.hl7.fhir.dstu2.model.Substance.SubstanceIngredientComponent convertSubstanceIngredientComponent(org.hl7.fhir.r5.model.Substance.SubstanceIngredientComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.Substance.SubstanceIngredientComponent tgt = new org.hl7.fhir.dstu2.model.Substance.SubstanceIngredientComponent(); + copyElement(src, tgt); + tgt.setQuantity(convertRatio(src.getQuantity())); +// tgt.setSubstance(convertReference(src.getSubstance())); + return tgt; + } + + public org.hl7.fhir.r5.model.SupplyDelivery convertSupplyDelivery(org.hl7.fhir.dstu2.model.SupplyDelivery src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.SupplyDelivery tgt = new org.hl7.fhir.r5.model.SupplyDelivery(); + copyDomainResource(src, tgt); + tgt.addIdentifier(convertIdentifier(src.getIdentifier())); + tgt.setStatus(convertSupplyDeliveryStatus(src.getStatus())); + tgt.setPatient(convertReference(src.getPatient())); + tgt.setType(convertCodeableConcept(src.getType())); +// tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); +// tgt.setSuppliedItem(convertReference(src.getSuppliedItem())); + tgt.setSupplier(convertReference(src.getSupplier())); +// tgt.setWhenPrepared(convertPeriod(src.getWhenPrepared())); +// tgt.setTime(src.getTime()); + tgt.setDestination(convertReference(src.getDestination())); + for (org.hl7.fhir.dstu2.model.Reference t : src.getReceiver()) + tgt.addReceiver(convertReference(t)); + return tgt; + } + + public org.hl7.fhir.dstu2.model.SupplyDelivery convertSupplyDelivery(org.hl7.fhir.r5.model.SupplyDelivery src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.SupplyDelivery tgt = new org.hl7.fhir.dstu2.model.SupplyDelivery(); + copyDomainResource(src, tgt); + tgt.setIdentifier(convertIdentifier(src.getIdentifierFirstRep())); + tgt.setStatus(convertSupplyDeliveryStatus(src.getStatus())); + tgt.setPatient(convertReference(src.getPatient())); + tgt.setType(convertCodeableConcept(src.getType())); +// tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); +// tgt.setSuppliedItem(convertReference(src.getSuppliedItem())); + tgt.setSupplier(convertReference(src.getSupplier())); +// tgt.setWhenPrepared(convertPeriod(src.getWhenPrepared())); +// tgt.setTime(src.getTime()); + tgt.setDestination(convertReference(src.getDestination())); + for (org.hl7.fhir.r5.model.Reference t : src.getReceiver()) + tgt.addReceiver(convertReference(t)); + return tgt; + } + + public org.hl7.fhir.r5.model.SupplyDelivery.SupplyDeliveryStatus convertSupplyDeliveryStatus(org.hl7.fhir.dstu2.model.SupplyDelivery.SupplyDeliveryStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case INPROGRESS: return org.hl7.fhir.r5.model.SupplyDelivery.SupplyDeliveryStatus.INPROGRESS; + case COMPLETED: return org.hl7.fhir.r5.model.SupplyDelivery.SupplyDeliveryStatus.COMPLETED; + case ABANDONED: return org.hl7.fhir.r5.model.SupplyDelivery.SupplyDeliveryStatus.ABANDONED; + default: return org.hl7.fhir.r5.model.SupplyDelivery.SupplyDeliveryStatus.NULL; + } + } + + public org.hl7.fhir.dstu2.model.SupplyDelivery.SupplyDeliveryStatus convertSupplyDeliveryStatus(org.hl7.fhir.r5.model.SupplyDelivery.SupplyDeliveryStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case INPROGRESS: return org.hl7.fhir.dstu2.model.SupplyDelivery.SupplyDeliveryStatus.INPROGRESS; + case COMPLETED: return org.hl7.fhir.dstu2.model.SupplyDelivery.SupplyDeliveryStatus.COMPLETED; + case ABANDONED: return org.hl7.fhir.dstu2.model.SupplyDelivery.SupplyDeliveryStatus.ABANDONED; + default: return org.hl7.fhir.dstu2.model.SupplyDelivery.SupplyDeliveryStatus.NULL; + } + } + + public org.hl7.fhir.r5.model.SupplyRequest convertSupplyRequest(org.hl7.fhir.dstu2.model.SupplyRequest src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.SupplyRequest tgt = new org.hl7.fhir.r5.model.SupplyRequest(); + copyDomainResource(src, tgt); +// tgt.setPatient(convertReference(src.getPatient())); +// tgt.setSource(convertReference(src.getSource())); +// if (src.hasDate()) +// tgt.setDate(src.getDate()); +// tgt.setIdentifier(convertIdentifier(src.getIdentifier())); +// tgt.setStatus(convertSupplyRequestStatus(src.getStatus())); +// tgt.setKind(convertCodeableConcept(src.getKind())); +// tgt.getOrderedItem().setItem(convertReference(src.getOrderedItem())); +// for (org.hl7.fhir.dstu2.model.Reference t : src.getSupplier()) +// tgt.addSupplier(convertReference(t)); +// tgt.setReason(convertType(src.getReason())); +// tgt.setWhen(convertSupplyRequestWhenComponent(src.getWhen())); + return tgt; + } + + public org.hl7.fhir.dstu2.model.SupplyRequest convertSupplyRequest(org.hl7.fhir.r5.model.SupplyRequest src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.SupplyRequest tgt = new org.hl7.fhir.dstu2.model.SupplyRequest(); +// copyDomainResource(src, tgt); +// tgt.setPatient(convertReference(src.getPatient())); +// tgt.setSource(convertReference(src.getSource())); +// if (src.hasDate()) +// tgt.setDate(src.getDate()); +// tgt.setIdentifier(convertIdentifier(src.getIdentifier())); +// tgt.setStatus(convertSupplyRequestStatus(src.getStatus())); +// tgt.setKind(convertCodeableConcept(src.getKind())); +// tgt.setOrderedItem(convertReference(src.getOrderedItem().getItemReference())); +// for (org.hl7.fhir.r5.model.Reference t : src.getSupplier()) +// tgt.addSupplier(convertReference(t)); +// tgt.setReason(convertType(src.getReason())); +// tgt.setWhen(convertSupplyRequestWhenComponent(src.getWhen())); + return tgt; + } + + public org.hl7.fhir.r5.model.SupplyRequest.SupplyRequestStatus convertSupplyRequestStatus(org.hl7.fhir.dstu2.model.SupplyRequest.SupplyRequestStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case REQUESTED: return org.hl7.fhir.r5.model.SupplyRequest.SupplyRequestStatus.ACTIVE; + case COMPLETED: return org.hl7.fhir.r5.model.SupplyRequest.SupplyRequestStatus.COMPLETED; + case FAILED: return org.hl7.fhir.r5.model.SupplyRequest.SupplyRequestStatus.CANCELLED; + case CANCELLED: return org.hl7.fhir.r5.model.SupplyRequest.SupplyRequestStatus.CANCELLED; + default: return org.hl7.fhir.r5.model.SupplyRequest.SupplyRequestStatus.NULL; + } + } + + public org.hl7.fhir.dstu2.model.SupplyRequest.SupplyRequestStatus convertSupplyRequestStatus(org.hl7.fhir.r5.model.SupplyRequest.SupplyRequestStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case ACTIVE: return org.hl7.fhir.dstu2.model.SupplyRequest.SupplyRequestStatus.REQUESTED; + case COMPLETED: return org.hl7.fhir.dstu2.model.SupplyRequest.SupplyRequestStatus.COMPLETED; + case CANCELLED: return org.hl7.fhir.dstu2.model.SupplyRequest.SupplyRequestStatus.CANCELLED; + default: return org.hl7.fhir.dstu2.model.SupplyRequest.SupplyRequestStatus.NULL; + } + } + + public org.hl7.fhir.r5.model.TestScript convertTestScript(org.hl7.fhir.dstu2.model.TestScript src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.TestScript tgt = new org.hl7.fhir.r5.model.TestScript(); + copyDomainResource(src, tgt); + tgt.setUrl(src.getUrl()); + tgt.setVersion(src.getVersion()); + tgt.setName(src.getName()); + tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); + tgt.setIdentifier(convertIdentifier(src.getIdentifier())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.dstu2.model.TestScript.TestScriptContactComponent t : src.getContact()) + tgt.addContact(convertTestScriptContactComponent(t)); + if (src.hasDate()) + tgt.setDate(src.getDate()); + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getUseContext()) + if (isJurisdiction(t)) + tgt.addJurisdiction(convertCodeableConcept(t)); + else + tgt.addUseContext(convertCodeableConceptToUsageContext(t)); + tgt.setPurpose(src.getRequirements()); + tgt.setCopyright(src.getCopyright()); + tgt.setMetadata(convertTestScriptMetadataComponent(src.getMetadata())); + for (org.hl7.fhir.dstu2.model.TestScript.TestScriptFixtureComponent t : src.getFixture()) + tgt.addFixture(convertTestScriptFixtureComponent(t)); + for (org.hl7.fhir.dstu2.model.Reference t : src.getProfile()) + tgt.addProfile(convertReference(t)); + for (org.hl7.fhir.dstu2.model.TestScript.TestScriptVariableComponent t : src.getVariable()) + tgt.addVariable(convertTestScriptVariableComponent(t)); + tgt.setSetup(convertTestScriptSetupComponent(src.getSetup())); + for (org.hl7.fhir.dstu2.model.TestScript.TestScriptTestComponent t : src.getTest()) + tgt.addTest(convertTestScriptTestComponent(t)); + tgt.setTeardown(convertTestScriptTeardownComponent(src.getTeardown())); + return tgt; + } + + public org.hl7.fhir.dstu2.model.TestScript convertTestScript(org.hl7.fhir.r5.model.TestScript src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.TestScript tgt = new org.hl7.fhir.dstu2.model.TestScript(); + copyDomainResource(src, tgt); + tgt.setUrl(src.getUrl()); + tgt.setVersion(src.getVersion()); + tgt.setName(src.getName()); + tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); + tgt.setIdentifier(convertIdentifier(src.getIdentifier())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.r5.model.ContactDetail t : src.getContact()) + tgt.addContact(convertTestScriptContactComponent(t)); + if (src.hasDate()) + tgt.setDate(src.getDate()); + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.r5.model.UsageContext t : src.getUseContext()) + if (t.hasValueCodeableConcept()) + tgt.addUseContext(convertCodeableConcept(t.getValueCodeableConcept())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getJurisdiction()) + tgt.addUseContext(convertCodeableConcept(t)); + tgt.setRequirements(src.getPurpose()); + tgt.setCopyright(src.getCopyright()); + tgt.setMetadata(convertTestScriptMetadataComponent(src.getMetadata())); + for (org.hl7.fhir.r5.model.TestScript.TestScriptFixtureComponent t : src.getFixture()) + tgt.addFixture(convertTestScriptFixtureComponent(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getProfile()) + tgt.addProfile(convertReference(t)); + for (org.hl7.fhir.r5.model.TestScript.TestScriptVariableComponent t : src.getVariable()) + tgt.addVariable(convertTestScriptVariableComponent(t)); + tgt.setSetup(convertTestScriptSetupComponent(src.getSetup())); + for (org.hl7.fhir.r5.model.TestScript.TestScriptTestComponent t : src.getTest()) + tgt.addTest(convertTestScriptTestComponent(t)); + tgt.setTeardown(convertTestScriptTeardownComponent(src.getTeardown())); + return tgt; + } + + public org.hl7.fhir.r5.model.ContactDetail convertTestScriptContactComponent(org.hl7.fhir.dstu2.model.TestScript.TestScriptContactComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.ContactDetail tgt = new org.hl7.fhir.r5.model.ContactDetail(); + copyElement(src, tgt); + tgt.setName(src.getName()); + for (org.hl7.fhir.dstu2.model.ContactPoint t : src.getTelecom()) + tgt.addTelecom(convertContactPoint(t)); + return tgt; + } + + public org.hl7.fhir.dstu2.model.TestScript.TestScriptContactComponent convertTestScriptContactComponent(org.hl7.fhir.r5.model.ContactDetail src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.TestScript.TestScriptContactComponent tgt = new org.hl7.fhir.dstu2.model.TestScript.TestScriptContactComponent(); + copyElement(src, tgt); + tgt.setName(src.getName()); + for (org.hl7.fhir.r5.model.ContactPoint t : src.getTelecom()) + tgt.addTelecom(convertContactPoint(t)); + return tgt; + } + + public org.hl7.fhir.r5.model.TestScript.TestScriptMetadataComponent convertTestScriptMetadataComponent(org.hl7.fhir.dstu2.model.TestScript.TestScriptMetadataComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.TestScript.TestScriptMetadataComponent tgt = new org.hl7.fhir.r5.model.TestScript.TestScriptMetadataComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.dstu2.model.TestScript.TestScriptMetadataLinkComponent t : src.getLink()) + tgt.addLink(convertTestScriptMetadataLinkComponent(t)); + for (org.hl7.fhir.dstu2.model.TestScript.TestScriptMetadataCapabilityComponent t : src.getCapability()) + tgt.addCapability(convertTestScriptMetadataCapabilityComponent(t)); + return tgt; + } + + public org.hl7.fhir.dstu2.model.TestScript.TestScriptMetadataComponent convertTestScriptMetadataComponent(org.hl7.fhir.r5.model.TestScript.TestScriptMetadataComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.TestScript.TestScriptMetadataComponent tgt = new org.hl7.fhir.dstu2.model.TestScript.TestScriptMetadataComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.r5.model.TestScript.TestScriptMetadataLinkComponent t : src.getLink()) + tgt.addLink(convertTestScriptMetadataLinkComponent(t)); + for (org.hl7.fhir.r5.model.TestScript.TestScriptMetadataCapabilityComponent t : src.getCapability()) + tgt.addCapability(convertTestScriptMetadataCapabilityComponent(t)); + return tgt; + } + + public org.hl7.fhir.r5.model.TestScript.TestScriptMetadataLinkComponent convertTestScriptMetadataLinkComponent(org.hl7.fhir.dstu2.model.TestScript.TestScriptMetadataLinkComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.TestScript.TestScriptMetadataLinkComponent tgt = new org.hl7.fhir.r5.model.TestScript.TestScriptMetadataLinkComponent(); + copyElement(src, tgt); + tgt.setUrl(src.getUrl()); + tgt.setDescription(src.getDescription()); + return tgt; + } + + public org.hl7.fhir.dstu2.model.TestScript.TestScriptMetadataLinkComponent convertTestScriptMetadataLinkComponent(org.hl7.fhir.r5.model.TestScript.TestScriptMetadataLinkComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.TestScript.TestScriptMetadataLinkComponent tgt = new org.hl7.fhir.dstu2.model.TestScript.TestScriptMetadataLinkComponent(); + copyElement(src, tgt); + tgt.setUrl(src.getUrl()); + tgt.setDescription(src.getDescription()); + return tgt; + } + + public org.hl7.fhir.r5.model.TestScript.TestScriptMetadataCapabilityComponent convertTestScriptMetadataCapabilityComponent(org.hl7.fhir.dstu2.model.TestScript.TestScriptMetadataCapabilityComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.TestScript.TestScriptMetadataCapabilityComponent tgt = new org.hl7.fhir.r5.model.TestScript.TestScriptMetadataCapabilityComponent(); + copyElement(src, tgt); + tgt.setRequired(src.getRequired()); + tgt.setValidated(src.getValidated()); + tgt.setDescription(src.getDescription()); + tgt.setDestination(src.getDestination()); + for (org.hl7.fhir.dstu2.model.UriType t : src.getLink()) + tgt.addLink(t.getValue()); + tgt.setCapabilitiesElement(convertReferenceToCanonical(src.getConformance())); + return tgt; + } + + public org.hl7.fhir.dstu2.model.TestScript.TestScriptMetadataCapabilityComponent convertTestScriptMetadataCapabilityComponent(org.hl7.fhir.r5.model.TestScript.TestScriptMetadataCapabilityComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.TestScript.TestScriptMetadataCapabilityComponent tgt = new org.hl7.fhir.dstu2.model.TestScript.TestScriptMetadataCapabilityComponent(); + copyElement(src, tgt); + tgt.setRequired(src.getRequired()); + tgt.setValidated(src.getValidated()); + tgt.setDescription(src.getDescription()); + tgt.setDestination(src.getDestination()); + for (org.hl7.fhir.r5.model.UriType t : src.getLink()) + tgt.addLink(t.getValue()); + tgt.setConformance(convertCanonicalToReference(src.getCapabilitiesElement())); + return tgt; + } + + public org.hl7.fhir.r5.model.TestScript.TestScriptFixtureComponent convertTestScriptFixtureComponent(org.hl7.fhir.dstu2.model.TestScript.TestScriptFixtureComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.TestScript.TestScriptFixtureComponent tgt = new org.hl7.fhir.r5.model.TestScript.TestScriptFixtureComponent(); + copyElement(src, tgt); + tgt.setAutocreate(src.getAutocreate()); + tgt.setAutodelete(src.getAutodelete()); + tgt.setResource(convertReference(src.getResource())); + return tgt; + } + + public org.hl7.fhir.dstu2.model.TestScript.TestScriptFixtureComponent convertTestScriptFixtureComponent(org.hl7.fhir.r5.model.TestScript.TestScriptFixtureComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.TestScript.TestScriptFixtureComponent tgt = new org.hl7.fhir.dstu2.model.TestScript.TestScriptFixtureComponent(); + copyElement(src, tgt); + tgt.setAutocreate(src.getAutocreate()); + tgt.setAutodelete(src.getAutodelete()); + tgt.setResource(convertReference(src.getResource())); + return tgt; + } + + public org.hl7.fhir.r5.model.TestScript.TestScriptVariableComponent convertTestScriptVariableComponent(org.hl7.fhir.dstu2.model.TestScript.TestScriptVariableComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.TestScript.TestScriptVariableComponent tgt = new org.hl7.fhir.r5.model.TestScript.TestScriptVariableComponent(); + copyElement(src, tgt); + tgt.setName(src.getName()); + tgt.setHeaderField(src.getHeaderField()); + tgt.setPath(src.getPath()); + tgt.setSourceId(src.getSourceId()); + return tgt; + } + + public org.hl7.fhir.dstu2.model.TestScript.TestScriptVariableComponent convertTestScriptVariableComponent(org.hl7.fhir.r5.model.TestScript.TestScriptVariableComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.TestScript.TestScriptVariableComponent tgt = new org.hl7.fhir.dstu2.model.TestScript.TestScriptVariableComponent(); + copyElement(src, tgt); + tgt.setName(src.getName()); + tgt.setHeaderField(src.getHeaderField()); + tgt.setPath(src.getPath()); + tgt.setSourceId(src.getSourceId()); + return tgt; + } + + public org.hl7.fhir.r5.model.TestScript.TestScriptSetupComponent convertTestScriptSetupComponent(org.hl7.fhir.dstu2.model.TestScript.TestScriptSetupComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.TestScript.TestScriptSetupComponent tgt = new org.hl7.fhir.r5.model.TestScript.TestScriptSetupComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.dstu2.model.TestScript.TestScriptSetupActionComponent t : src.getAction()) + tgt.addAction(convertSetupActionComponent(t)); + return tgt; + } + + public org.hl7.fhir.dstu2.model.TestScript.TestScriptSetupComponent convertTestScriptSetupComponent(org.hl7.fhir.r5.model.TestScript.TestScriptSetupComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.TestScript.TestScriptSetupComponent tgt = new org.hl7.fhir.dstu2.model.TestScript.TestScriptSetupComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.r5.model.TestScript.SetupActionComponent t : src.getAction()) + tgt.addAction(convertSetupActionComponent(t)); + return tgt; + } + + public org.hl7.fhir.r5.model.TestScript.SetupActionComponent convertSetupActionComponent(org.hl7.fhir.dstu2.model.TestScript.TestScriptSetupActionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.TestScript.SetupActionComponent tgt = new org.hl7.fhir.r5.model.TestScript.SetupActionComponent(); + copyElement(src, tgt); + tgt.setOperation(convertSetupActionOperationComponent(src.getOperation())); + tgt.setAssert(convertSetupActionAssertComponent(src.getAssert())); + return tgt; + } + + public org.hl7.fhir.dstu2.model.TestScript.TestScriptSetupActionComponent convertSetupActionComponent(org.hl7.fhir.r5.model.TestScript.SetupActionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.TestScript.TestScriptSetupActionComponent tgt = new org.hl7.fhir.dstu2.model.TestScript.TestScriptSetupActionComponent(); + copyElement(src, tgt); + tgt.setOperation(convertSetupActionOperationComponent(src.getOperation())); + tgt.setAssert(convertSetupActionAssertComponent(src.getAssert())); + return tgt; + } + + public org.hl7.fhir.r5.model.TestScript.SetupActionOperationComponent convertSetupActionOperationComponent(org.hl7.fhir.dstu2.model.TestScript.TestScriptSetupActionOperationComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.TestScript.SetupActionOperationComponent tgt = new org.hl7.fhir.r5.model.TestScript.SetupActionOperationComponent(); + copyElement(src, tgt); + tgt.setType(convertCoding(src.getType())); + tgt.setResource(src.getResource()); + tgt.setLabel(src.getLabel()); + tgt.setDescription(src.getDescription()); + tgt.setAccept(convertContentType(src.getAccept())); + tgt.setContentType(convertContentType(src.getContentType())); + tgt.setDestination(src.getDestination()); + tgt.setEncodeRequestUrl(src.getEncodeRequestUrl()); + tgt.setParams(src.getParams()); + for (org.hl7.fhir.dstu2.model.TestScript.TestScriptSetupActionOperationRequestHeaderComponent t : src.getRequestHeader()) + tgt.addRequestHeader(convertSetupActionOperationRequestHeaderComponent(t)); + tgt.setResponseId(src.getResponseId()); + tgt.setSourceId(src.getSourceId()); + tgt.setTargetId(src.getTargetId()); + tgt.setUrl(src.getUrl()); + return tgt; + } + + public org.hl7.fhir.dstu2.model.TestScript.TestScriptSetupActionOperationComponent convertSetupActionOperationComponent(org.hl7.fhir.r5.model.TestScript.SetupActionOperationComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.TestScript.TestScriptSetupActionOperationComponent tgt = new org.hl7.fhir.dstu2.model.TestScript.TestScriptSetupActionOperationComponent(); + copyElement(src, tgt); + tgt.setType(convertCoding(src.getType())); + tgt.setResource(src.getResource()); + tgt.setLabel(src.getLabel()); + tgt.setDescription(src.getDescription()); + tgt.setAccept(convertContentType(src.getAccept())); + tgt.setContentType(convertContentType(src.getContentType())); + tgt.setDestination(src.getDestination()); + tgt.setEncodeRequestUrl(src.getEncodeRequestUrl()); + tgt.setParams(src.getParams()); + for (org.hl7.fhir.r5.model.TestScript.SetupActionOperationRequestHeaderComponent t : src.getRequestHeader()) + tgt.addRequestHeader(convertSetupActionOperationRequestHeaderComponent(t)); + tgt.setResponseId(src.getResponseId()); + tgt.setSourceId(src.getSourceId()); + tgt.setTargetId(src.getTargetId()); + tgt.setUrl(src.getUrl()); + return tgt; + } + + private static String convertContentType(org.hl7.fhir.dstu2.model.TestScript.ContentType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case XML: return "application/fhir+xml"; + case JSON: return "application/fhir+json"; + default: return null; + } +} + + private static org.hl7.fhir.dstu2.model.TestScript.ContentType convertContentType(String src) throws FHIRException { + if (src == null) + return null; + if (src.contains("xml")) return org.hl7.fhir.dstu2.model.TestScript.ContentType.XML; + if (src.contains("json")) return org.hl7.fhir.dstu2.model.TestScript.ContentType.JSON; + return org.hl7.fhir.dstu2.model.TestScript.ContentType.NULL; + } + + + public org.hl7.fhir.r5.model.TestScript.SetupActionOperationRequestHeaderComponent convertSetupActionOperationRequestHeaderComponent(org.hl7.fhir.dstu2.model.TestScript.TestScriptSetupActionOperationRequestHeaderComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.TestScript.SetupActionOperationRequestHeaderComponent tgt = new org.hl7.fhir.r5.model.TestScript.SetupActionOperationRequestHeaderComponent(); + copyElement(src, tgt); + tgt.setField(src.getField()); + tgt.setValue(src.getValue()); + return tgt; + } + + public org.hl7.fhir.dstu2.model.TestScript.TestScriptSetupActionOperationRequestHeaderComponent convertSetupActionOperationRequestHeaderComponent(org.hl7.fhir.r5.model.TestScript.SetupActionOperationRequestHeaderComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.TestScript.TestScriptSetupActionOperationRequestHeaderComponent tgt = new org.hl7.fhir.dstu2.model.TestScript.TestScriptSetupActionOperationRequestHeaderComponent(); + copyElement(src, tgt); + tgt.setField(src.getField()); + tgt.setValue(src.getValue()); + return tgt; + } + + public org.hl7.fhir.r5.model.TestScript.SetupActionAssertComponent convertSetupActionAssertComponent(org.hl7.fhir.dstu2.model.TestScript.TestScriptSetupActionAssertComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.TestScript.SetupActionAssertComponent tgt = new org.hl7.fhir.r5.model.TestScript.SetupActionAssertComponent(); + copyElement(src, tgt); + tgt.setLabel(src.getLabel()); + tgt.setDescription(src.getDescription()); + tgt.setDirection(convertAssertionDirectionType(src.getDirection())); + tgt.setCompareToSourceId(src.getCompareToSourceId()); + tgt.setCompareToSourcePath(src.getCompareToSourcePath()); + tgt.setContentType(convertContentType(src.getContentType())); + tgt.setHeaderField(src.getHeaderField()); + tgt.setMinimumId(src.getMinimumId()); + tgt.setNavigationLinks(src.getNavigationLinks()); + tgt.setOperator(convertAssertionOperatorType(src.getOperator())); + tgt.setPath(src.getPath()); + tgt.setResource(src.getResource()); + tgt.setResponse(convertAssertionResponseTypes(src.getResponse())); + tgt.setResponseCode(src.getResponseCode()); + tgt.setSourceId(src.getSourceId()); + tgt.setValidateProfileId(src.getValidateProfileId()); + tgt.setValue(src.getValue()); + tgt.setWarningOnly(src.getWarningOnly()); + return tgt; + } + + public org.hl7.fhir.dstu2.model.TestScript.TestScriptSetupActionAssertComponent convertSetupActionAssertComponent(org.hl7.fhir.r5.model.TestScript.SetupActionAssertComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.TestScript.TestScriptSetupActionAssertComponent tgt = new org.hl7.fhir.dstu2.model.TestScript.TestScriptSetupActionAssertComponent(); + copyElement(src, tgt); + tgt.setLabel(src.getLabel()); + tgt.setDescription(src.getDescription()); + tgt.setDirection(convertAssertionDirectionType(src.getDirection())); + tgt.setCompareToSourceId(src.getCompareToSourceId()); + tgt.setCompareToSourcePath(src.getCompareToSourcePath()); + tgt.setContentType(convertContentType(src.getContentType())); + tgt.setHeaderField(src.getHeaderField()); + tgt.setMinimumId(src.getMinimumId()); + tgt.setNavigationLinks(src.getNavigationLinks()); + tgt.setOperator(convertAssertionOperatorType(src.getOperator())); + tgt.setPath(src.getPath()); + tgt.setResource(src.getResource()); + tgt.setResponse(convertAssertionResponseTypes(src.getResponse())); + tgt.setResponseCode(src.getResponseCode()); + tgt.setSourceId(src.getSourceId()); + tgt.setValidateProfileId(src.getValidateProfileId()); + tgt.setValue(src.getValue()); + tgt.setWarningOnly(src.getWarningOnly()); + return tgt; + } + + public org.hl7.fhir.r5.model.TestScript.AssertionDirectionType convertAssertionDirectionType(org.hl7.fhir.dstu2.model.TestScript.AssertionDirectionType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case RESPONSE: return org.hl7.fhir.r5.model.TestScript.AssertionDirectionType.RESPONSE; + case REQUEST: return org.hl7.fhir.r5.model.TestScript.AssertionDirectionType.REQUEST; + default: return org.hl7.fhir.r5.model.TestScript.AssertionDirectionType.NULL; + } + } + + public org.hl7.fhir.dstu2.model.TestScript.AssertionDirectionType convertAssertionDirectionType(org.hl7.fhir.r5.model.TestScript.AssertionDirectionType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case RESPONSE: return org.hl7.fhir.dstu2.model.TestScript.AssertionDirectionType.RESPONSE; + case REQUEST: return org.hl7.fhir.dstu2.model.TestScript.AssertionDirectionType.REQUEST; + default: return org.hl7.fhir.dstu2.model.TestScript.AssertionDirectionType.NULL; + } + } + + public org.hl7.fhir.r5.model.TestScript.AssertionOperatorType convertAssertionOperatorType(org.hl7.fhir.dstu2.model.TestScript.AssertionOperatorType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case EQUALS: return org.hl7.fhir.r5.model.TestScript.AssertionOperatorType.EQUALS; + case NOTEQUALS: return org.hl7.fhir.r5.model.TestScript.AssertionOperatorType.NOTEQUALS; + case IN: return org.hl7.fhir.r5.model.TestScript.AssertionOperatorType.IN; + case NOTIN: return org.hl7.fhir.r5.model.TestScript.AssertionOperatorType.NOTIN; + case GREATERTHAN: return org.hl7.fhir.r5.model.TestScript.AssertionOperatorType.GREATERTHAN; + case LESSTHAN: return org.hl7.fhir.r5.model.TestScript.AssertionOperatorType.LESSTHAN; + case EMPTY: return org.hl7.fhir.r5.model.TestScript.AssertionOperatorType.EMPTY; + case NOTEMPTY: return org.hl7.fhir.r5.model.TestScript.AssertionOperatorType.NOTEMPTY; + case CONTAINS: return org.hl7.fhir.r5.model.TestScript.AssertionOperatorType.CONTAINS; + case NOTCONTAINS: return org.hl7.fhir.r5.model.TestScript.AssertionOperatorType.NOTCONTAINS; + default: return org.hl7.fhir.r5.model.TestScript.AssertionOperatorType.NULL; + } + } + + public org.hl7.fhir.dstu2.model.TestScript.AssertionOperatorType convertAssertionOperatorType(org.hl7.fhir.r5.model.TestScript.AssertionOperatorType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case EQUALS: return org.hl7.fhir.dstu2.model.TestScript.AssertionOperatorType.EQUALS; + case NOTEQUALS: return org.hl7.fhir.dstu2.model.TestScript.AssertionOperatorType.NOTEQUALS; + case IN: return org.hl7.fhir.dstu2.model.TestScript.AssertionOperatorType.IN; + case NOTIN: return org.hl7.fhir.dstu2.model.TestScript.AssertionOperatorType.NOTIN; + case GREATERTHAN: return org.hl7.fhir.dstu2.model.TestScript.AssertionOperatorType.GREATERTHAN; + case LESSTHAN: return org.hl7.fhir.dstu2.model.TestScript.AssertionOperatorType.LESSTHAN; + case EMPTY: return org.hl7.fhir.dstu2.model.TestScript.AssertionOperatorType.EMPTY; + case NOTEMPTY: return org.hl7.fhir.dstu2.model.TestScript.AssertionOperatorType.NOTEMPTY; + case CONTAINS: return org.hl7.fhir.dstu2.model.TestScript.AssertionOperatorType.CONTAINS; + case NOTCONTAINS: return org.hl7.fhir.dstu2.model.TestScript.AssertionOperatorType.NOTCONTAINS; + default: return org.hl7.fhir.dstu2.model.TestScript.AssertionOperatorType.NULL; + } + } + + public org.hl7.fhir.r5.model.TestScript.AssertionResponseTypes convertAssertionResponseTypes(org.hl7.fhir.dstu2.model.TestScript.AssertionResponseTypes src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case OKAY: return org.hl7.fhir.r5.model.TestScript.AssertionResponseTypes.OKAY; + case CREATED: return org.hl7.fhir.r5.model.TestScript.AssertionResponseTypes.CREATED; + case NOCONTENT: return org.hl7.fhir.r5.model.TestScript.AssertionResponseTypes.NOCONTENT; + case NOTMODIFIED: return org.hl7.fhir.r5.model.TestScript.AssertionResponseTypes.NOTMODIFIED; + case BAD: return org.hl7.fhir.r5.model.TestScript.AssertionResponseTypes.BAD; + case FORBIDDEN: return org.hl7.fhir.r5.model.TestScript.AssertionResponseTypes.FORBIDDEN; + case NOTFOUND: return org.hl7.fhir.r5.model.TestScript.AssertionResponseTypes.NOTFOUND; + case METHODNOTALLOWED: return org.hl7.fhir.r5.model.TestScript.AssertionResponseTypes.METHODNOTALLOWED; + case CONFLICT: return org.hl7.fhir.r5.model.TestScript.AssertionResponseTypes.CONFLICT; + case GONE: return org.hl7.fhir.r5.model.TestScript.AssertionResponseTypes.GONE; + case PRECONDITIONFAILED: return org.hl7.fhir.r5.model.TestScript.AssertionResponseTypes.PRECONDITIONFAILED; + case UNPROCESSABLE: return org.hl7.fhir.r5.model.TestScript.AssertionResponseTypes.UNPROCESSABLE; + default: return org.hl7.fhir.r5.model.TestScript.AssertionResponseTypes.NULL; + } + } + + public org.hl7.fhir.dstu2.model.TestScript.AssertionResponseTypes convertAssertionResponseTypes(org.hl7.fhir.r5.model.TestScript.AssertionResponseTypes src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case OKAY: return org.hl7.fhir.dstu2.model.TestScript.AssertionResponseTypes.OKAY; + case CREATED: return org.hl7.fhir.dstu2.model.TestScript.AssertionResponseTypes.CREATED; + case NOCONTENT: return org.hl7.fhir.dstu2.model.TestScript.AssertionResponseTypes.NOCONTENT; + case NOTMODIFIED: return org.hl7.fhir.dstu2.model.TestScript.AssertionResponseTypes.NOTMODIFIED; + case BAD: return org.hl7.fhir.dstu2.model.TestScript.AssertionResponseTypes.BAD; + case FORBIDDEN: return org.hl7.fhir.dstu2.model.TestScript.AssertionResponseTypes.FORBIDDEN; + case NOTFOUND: return org.hl7.fhir.dstu2.model.TestScript.AssertionResponseTypes.NOTFOUND; + case METHODNOTALLOWED: return org.hl7.fhir.dstu2.model.TestScript.AssertionResponseTypes.METHODNOTALLOWED; + case CONFLICT: return org.hl7.fhir.dstu2.model.TestScript.AssertionResponseTypes.CONFLICT; + case GONE: return org.hl7.fhir.dstu2.model.TestScript.AssertionResponseTypes.GONE; + case PRECONDITIONFAILED: return org.hl7.fhir.dstu2.model.TestScript.AssertionResponseTypes.PRECONDITIONFAILED; + case UNPROCESSABLE: return org.hl7.fhir.dstu2.model.TestScript.AssertionResponseTypes.UNPROCESSABLE; + default: return org.hl7.fhir.dstu2.model.TestScript.AssertionResponseTypes.NULL; + } + } + + + public org.hl7.fhir.r5.model.TestScript.TestScriptTestComponent convertTestScriptTestComponent(org.hl7.fhir.dstu2.model.TestScript.TestScriptTestComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.TestScript.TestScriptTestComponent tgt = new org.hl7.fhir.r5.model.TestScript.TestScriptTestComponent(); + copyElement(src, tgt); + tgt.setName(src.getName()); + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu2.model.TestScript.TestScriptTestActionComponent t : src.getAction()) + tgt.addAction(convertTestActionComponent(t)); + return tgt; + } + + public org.hl7.fhir.dstu2.model.TestScript.TestScriptTestComponent convertTestScriptTestComponent(org.hl7.fhir.r5.model.TestScript.TestScriptTestComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.TestScript.TestScriptTestComponent tgt = new org.hl7.fhir.dstu2.model.TestScript.TestScriptTestComponent(); + copyElement(src, tgt); + tgt.setName(src.getName()); + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.r5.model.TestScript.TestActionComponent t : src.getAction()) + tgt.addAction(convertTestActionComponent(t)); + return tgt; + } + + public org.hl7.fhir.r5.model.TestScript.TestActionComponent convertTestActionComponent(org.hl7.fhir.dstu2.model.TestScript.TestScriptTestActionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.TestScript.TestActionComponent tgt = new org.hl7.fhir.r5.model.TestScript.TestActionComponent(); + copyElement(src, tgt); + tgt.setOperation(convertSetupActionOperationComponent(src.getOperation())); + tgt.setAssert(convertSetupActionAssertComponent(src.getAssert())); + return tgt; + } + + public org.hl7.fhir.dstu2.model.TestScript.TestScriptTestActionComponent convertTestActionComponent(org.hl7.fhir.r5.model.TestScript.TestActionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.TestScript.TestScriptTestActionComponent tgt = new org.hl7.fhir.dstu2.model.TestScript.TestScriptTestActionComponent(); + copyElement(src, tgt); + tgt.setOperation(convertSetupActionOperationComponent(src.getOperation())); + tgt.setAssert(convertSetupActionAssertComponent(src.getAssert())); + return tgt; + } + + public org.hl7.fhir.r5.model.TestScript.TestScriptTeardownComponent convertTestScriptTeardownComponent(org.hl7.fhir.dstu2.model.TestScript.TestScriptTeardownComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.TestScript.TestScriptTeardownComponent tgt = new org.hl7.fhir.r5.model.TestScript.TestScriptTeardownComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.dstu2.model.TestScript.TestScriptTeardownActionComponent t : src.getAction()) + tgt.addAction(convertTeardownActionComponent(t)); + return tgt; + } + + public org.hl7.fhir.dstu2.model.TestScript.TestScriptTeardownComponent convertTestScriptTeardownComponent(org.hl7.fhir.r5.model.TestScript.TestScriptTeardownComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.TestScript.TestScriptTeardownComponent tgt = new org.hl7.fhir.dstu2.model.TestScript.TestScriptTeardownComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.r5.model.TestScript.TeardownActionComponent t : src.getAction()) + tgt.addAction(convertTeardownActionComponent(t)); + return tgt; + } + + public org.hl7.fhir.r5.model.TestScript.TeardownActionComponent convertTeardownActionComponent(org.hl7.fhir.dstu2.model.TestScript.TestScriptTeardownActionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.TestScript.TeardownActionComponent tgt = new org.hl7.fhir.r5.model.TestScript.TeardownActionComponent(); + copyElement(src, tgt); + tgt.setOperation(convertSetupActionOperationComponent(src.getOperation())); + return tgt; + } + + public org.hl7.fhir.dstu2.model.TestScript.TestScriptTeardownActionComponent convertTeardownActionComponent(org.hl7.fhir.r5.model.TestScript.TeardownActionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.TestScript.TestScriptTeardownActionComponent tgt = new org.hl7.fhir.dstu2.model.TestScript.TestScriptTeardownActionComponent(); + copyElement(src, tgt); + tgt.setOperation(convertSetupActionOperationComponent(src.getOperation())); + return tgt; + } + + public org.hl7.fhir.dstu2.model.ValueSet.ValueSetCodeSystemComponent convertCodeSystem(org.hl7.fhir.r5.model.CodeSystem src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.ValueSet.ValueSetCodeSystemComponent tgt = new org.hl7.fhir.dstu2.model.ValueSet.ValueSetCodeSystemComponent(); + copyElement(src, tgt); + tgt.setSystem(src.getUrl()); + tgt.setVersion(src.getVersion()); + tgt.setCaseSensitive(src.getCaseSensitive()); + + for (ConceptDefinitionComponent cc : src.getConcept()) + tgt.addConcept(convertCodeSystemConcept(src, cc)); + return tgt; + } + +public org.hl7.fhir.dstu2.model.ValueSet.ConceptDefinitionComponent convertCodeSystemConcept(CodeSystem cs, ConceptDefinitionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.ValueSet.ConceptDefinitionComponent tgt = new org.hl7.fhir.dstu2.model.ValueSet.ConceptDefinitionComponent(); + copyElement(src, tgt); + tgt.setAbstract(CodeSystemUtilities.isNotSelectable(cs, src)); + tgt.setCode(src.getCode()); + tgt.setDefinition(src.getDefinition()); + tgt.setDisplay(src.getDisplay()); + + for (ConceptDefinitionComponent cc : src.getConcept()) + tgt.addConcept(convertCodeSystemConcept(cs, cc)); + for (ConceptDefinitionDesignationComponent cc : src.getDesignation()) + tgt.addDesignation(convertCodeSystemDesignation(cc)); + return tgt; + } + +public org.hl7.fhir.dstu2.model.ValueSet.ConceptDefinitionDesignationComponent convertCodeSystemDesignation(ConceptDefinitionDesignationComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.ValueSet.ConceptDefinitionDesignationComponent tgt = new org.hl7.fhir.dstu2.model.ValueSet.ConceptDefinitionDesignationComponent(); + copyElement(src, tgt); + tgt.setUse(convertCoding(src.getUse())); + tgt.setLanguage(src.getLanguage()); + tgt.setValue(src.getValue()); + + return tgt; + } + + public org.hl7.fhir.r5.model.ValueSet convertValueSet(org.hl7.fhir.dstu2.model.ValueSet src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.ValueSet tgt = new org.hl7.fhir.r5.model.ValueSet(); + copyDomainResource(src, tgt); + tgt.setUrl(src.getUrl()); + tgt.addIdentifier(convertIdentifier(src.getIdentifier())); + tgt.setVersion(src.getVersion()); + tgt.setName(src.getName()); + tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.dstu2.model.ValueSet.ValueSetContactComponent t : src.getContact()) + tgt.addContact(convertValueSetContactComponent(t)); + if (src.hasDate()) + tgt.setDate(src.getDate()); + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getUseContext()) + if (isJurisdiction(t)) + tgt.addJurisdiction(convertCodeableConcept(t)); + else + tgt.addUseContext(convertCodeableConceptToUsageContext(t)); + tgt.setImmutable(src.getImmutable()); + tgt.setPurpose(src.getRequirements()); + tgt.setCopyright(src.getCopyright()); + if (src.hasExtensible()) + tgt.addExtension("http://hl7.org/fhir/StructureDefinition/valueset-extensible", new BooleanType(src.getExtensible())); + if (src.hasCompose()) { + tgt.setCompose(convertValueSetComposeComponent(src.getCompose())); + tgt.getCompose().setLockedDate(src.getLockedDate()); + } + if (src.hasCodeSystem() && advisor != null) { + org.hl7.fhir.r5.model.CodeSystem tgtcs = new org.hl7.fhir.r5.model.CodeSystem(); + copyDomainResource(src, tgtcs); + tgtcs.setUrl(src.getCodeSystem().getSystem()); + tgtcs.addIdentifier(convertIdentifier(src.getIdentifier())); + tgtcs.setVersion(src.getCodeSystem().getVersion()); + tgtcs.setName(src.getName()+" Code System"); + tgtcs.setStatus(convertConformanceResourceStatus(src.getStatus())); + if (src.hasExperimental()) + tgtcs.setExperimental(src.getExperimental()); + tgtcs.setPublisher(src.getPublisher()); + for (org.hl7.fhir.dstu2.model.ValueSet.ValueSetContactComponent t : src.getContact()) + tgtcs.addContact(convertValueSetContactComponent(t)); + if (src.hasDate()) + tgtcs.setDate(src.getDate()); + tgtcs.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getUseContext()) + if (isJurisdiction(t)) + tgtcs.addJurisdiction(convertCodeableConcept(t)); + else + tgtcs.addUseContext(convertCodeableConceptToUsageContext(t)); + tgtcs.setPurpose(src.getRequirements()); + tgtcs.setCopyright(src.getCopyright()); + tgtcs.setContent(CodeSystemContentMode.COMPLETE); + tgtcs.setCaseSensitive(src.getCodeSystem().getCaseSensitive()); + for (org.hl7.fhir.dstu2.model.ValueSet.ConceptDefinitionComponent cs : src.getCodeSystem().getConcept()) + processConcept(tgtcs.getConcept(), cs, tgtcs); + advisor.handleCodeSystem(tgtcs, tgt); + tgt.setUserData("r2-cs", tgtcs); + tgt.getCompose().addInclude().setSystem(tgtcs.getUrl()); + } + tgt.setExpansion(convertValueSetExpansionComponent(src.getExpansion())); + return tgt; + } + + private void processConcept(List concepts, org.hl7.fhir.dstu2.model.ValueSet.ConceptDefinitionComponent cs, CodeSystem tgtcs) throws FHIRException { + org.hl7.fhir.r5.model.CodeSystem.ConceptDefinitionComponent ct = new org.hl7.fhir.r5.model.CodeSystem.ConceptDefinitionComponent(); + concepts.add(ct); + ct.setCode(cs.getCode()); + ct.setDisplay(cs.getDisplay()); + ct.setDefinition(cs.getDefinition()); + if (cs.getAbstract()) + CodeSystemUtilities.setNotSelectable(tgtcs, ct); + for (org.hl7.fhir.dstu2.model.ValueSet.ConceptDefinitionDesignationComponent csd : cs.getDesignation()) { + org.hl7.fhir.r5.model.CodeSystem.ConceptDefinitionDesignationComponent cst = new org.hl7.fhir.r5.model.CodeSystem.ConceptDefinitionDesignationComponent(); + cst.setLanguage(csd.getLanguage()); + cst.setUse(convertCoding(csd.getUse())); + cst.setValue(csd.getValue()); + } + + for (org.hl7.fhir.dstu2.model.ValueSet.ConceptDefinitionComponent csc : cs.getConcept()) + processConcept(ct.getConcept(), csc, tgtcs); + } + + private void processConcept(List concepts, ConceptDefinitionComponent cs, CodeSystem srcCS) throws FHIRException { + org.hl7.fhir.dstu2.model.ValueSet.ConceptDefinitionComponent ct = new org.hl7.fhir.dstu2.model.ValueSet.ConceptDefinitionComponent(); + concepts.add(ct); + ct.setCode(cs.getCode()); + ct.setDisplay(cs.getDisplay()); + ct.setDefinition(cs.getDefinition()); + if (CodeSystemUtilities.isNotSelectable(srcCS, cs)) + ct.setAbstract(true); + for (org.hl7.fhir.r5.model.CodeSystem.ConceptDefinitionDesignationComponent csd : cs.getDesignation()) { + org.hl7.fhir.dstu2.model.ValueSet.ConceptDefinitionDesignationComponent cst = new org.hl7.fhir.dstu2.model.ValueSet.ConceptDefinitionDesignationComponent(); + cst.setLanguage(csd.getLanguage()); + cst.setUse(convertCoding(csd.getUse())); + cst.setValue(csd.getValue()); + } + + for (ConceptDefinitionComponent csc : cs.getConcept()) + processConcept(ct.getConcept(), csc, srcCS); + } + + public org.hl7.fhir.dstu2.model.ValueSet convertValueSet(org.hl7.fhir.r5.model.ValueSet src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.ValueSet tgt = new org.hl7.fhir.dstu2.model.ValueSet(); + copyDomainResource(src, tgt); + tgt.setUrl(src.getUrl()); + for (org.hl7.fhir.r5.model.Identifier i : src.getIdentifier()) + tgt.setIdentifier(convertIdentifier(i)); + tgt.setVersion(src.getVersion()); + tgt.setName(src.getName()); + tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.r5.model.ContactDetail t : src.getContact()) + tgt.addContact(convertValueSetContactComponent(t)); + if (src.hasDate()) + tgt.setDate(src.getDate()); + tgt.setLockedDate(src.getCompose().getLockedDate()); + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.r5.model.UsageContext t : src.getUseContext()) + if (t.hasValueCodeableConcept()) + tgt.addUseContext(convertCodeableConcept(t.getValueCodeableConcept())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getJurisdiction()) + tgt.addUseContext(convertCodeableConcept(t)); + tgt.setImmutable(src.getImmutable()); + tgt.setRequirements(src.getPurpose()); + tgt.setCopyright(src.getCopyright()); + if (src.hasExtension("http://hl7.org/fhir/StructureDefinition/valueset-extensible")) + tgt.setExtensible(((BooleanType) src.getExtensionByUrl("http://hl7.org/fhir/StructureDefinition/valueset-extensible").getValue()).booleanValue()); + org.hl7.fhir.r5.model.CodeSystem srcCS = (CodeSystem) src.getUserData("r2-cs"); + if (srcCS == null) + srcCS = advisor.getCodeSystem(src); + if (srcCS != null) { + tgt.getCodeSystem().setSystem(srcCS.getUrl()); + tgt.getCodeSystem().setVersion(srcCS.getVersion()); + tgt.getCodeSystem().setCaseSensitive(srcCS.getCaseSensitive()); + for (org.hl7.fhir.r5.model.CodeSystem.ConceptDefinitionComponent cs : srcCS.getConcept()) + processConcept(tgt.getCodeSystem().getConcept(), cs, srcCS); + + } + tgt.setCompose(convertValueSetComposeComponent(src.getCompose(), srcCS == null ? null : srcCS.getUrl())); + tgt.setExpansion(convertValueSetExpansionComponent(src.getExpansion())); + return tgt; + } + + private static boolean isJurisdiction(CodeableConcept t) { + return t.hasCoding() && ("http://unstats.un.org/unsd/methods/m49/m49.htm".equals(t.getCoding().get(0).getSystem()) || "urn:iso:std:iso:3166".equals(t.getCoding().get(0).getSystem()) + || "https://www.usps.com/".equals(t.getCoding().get(0).getSystem())); + } + + + public org.hl7.fhir.r5.model.ContactDetail convertValueSetContactComponent(org.hl7.fhir.dstu2.model.ValueSet.ValueSetContactComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.ContactDetail tgt = new org.hl7.fhir.r5.model.ContactDetail(); + copyElement(src, tgt); + tgt.setName(src.getName()); + for (org.hl7.fhir.dstu2.model.ContactPoint t : src.getTelecom()) + tgt.addTelecom(convertContactPoint(t)); + return tgt; + } + + public org.hl7.fhir.dstu2.model.ValueSet.ValueSetContactComponent convertValueSetContactComponent(org.hl7.fhir.r5.model.ContactDetail src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.ValueSet.ValueSetContactComponent tgt = new org.hl7.fhir.dstu2.model.ValueSet.ValueSetContactComponent(); + copyElement(src, tgt); + tgt.setName(src.getName()); + for (org.hl7.fhir.r5.model.ContactPoint t : src.getTelecom()) + tgt.addTelecom(convertContactPoint(t)); + return tgt; + } + + public org.hl7.fhir.r5.model.ValueSet.ValueSetComposeComponent convertValueSetComposeComponent(org.hl7.fhir.dstu2.model.ValueSet.ValueSetComposeComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.ValueSet.ValueSetComposeComponent tgt = new org.hl7.fhir.r5.model.ValueSet.ValueSetComposeComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.dstu2.model.UriType t : src.getImport()) + tgt.addInclude().addValueSet(t.getValue()); + for (org.hl7.fhir.dstu2.model.ValueSet.ConceptSetComponent t : src.getInclude()) + tgt.addInclude(convertConceptSetComponent(t)); + for (org.hl7.fhir.dstu2.model.ValueSet.ConceptSetComponent t : src.getExclude()) + tgt.addExclude(convertConceptSetComponent(t)); + return tgt; + } + + public org.hl7.fhir.dstu2.model.ValueSet.ValueSetComposeComponent convertValueSetComposeComponent(org.hl7.fhir.r5.model.ValueSet.ValueSetComposeComponent src, String noSystem) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.ValueSet.ValueSetComposeComponent tgt = new org.hl7.fhir.dstu2.model.ValueSet.ValueSetComposeComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.r5.model.ValueSet.ConceptSetComponent t : src.getInclude()) { + for (org.hl7.fhir.r5.model.UriType ti : t.getValueSet()) + tgt.addImport(ti.getValue()); + if (noSystem == null || !t.getSystem().equals(noSystem)) + tgt.addInclude(convertConceptSetComponent(t)); + } + for (org.hl7.fhir.r5.model.ValueSet.ConceptSetComponent t : src.getExclude()) + tgt.addExclude(convertConceptSetComponent(t)); + return tgt; + } + + public org.hl7.fhir.r5.model.ValueSet.ConceptSetComponent convertConceptSetComponent(org.hl7.fhir.dstu2.model.ValueSet.ConceptSetComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.ValueSet.ConceptSetComponent tgt = new org.hl7.fhir.r5.model.ValueSet.ConceptSetComponent(); + copyElement(src, tgt); + tgt.setSystem(src.getSystem()); + tgt.setVersion(src.getVersion()); + for (org.hl7.fhir.dstu2.model.ValueSet.ConceptReferenceComponent t : src.getConcept()) + tgt.addConcept(convertConceptReferenceComponent(t)); + for (org.hl7.fhir.dstu2.model.ValueSet.ConceptSetFilterComponent t : src.getFilter()) + tgt.addFilter(convertConceptSetFilterComponent(t)); + return tgt; + } + + public org.hl7.fhir.dstu2.model.ValueSet.ConceptSetComponent convertConceptSetComponent(org.hl7.fhir.r5.model.ValueSet.ConceptSetComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.ValueSet.ConceptSetComponent tgt = new org.hl7.fhir.dstu2.model.ValueSet.ConceptSetComponent(); + copyElement(src, tgt); + tgt.setSystem(src.getSystem()); + tgt.setVersion(src.getVersion()); + for (org.hl7.fhir.r5.model.ValueSet.ConceptReferenceComponent t : src.getConcept()) + tgt.addConcept(convertConceptReferenceComponent(t)); + for (org.hl7.fhir.r5.model.ValueSet.ConceptSetFilterComponent t : src.getFilter()) + tgt.addFilter(convertConceptSetFilterComponent(t)); + return tgt; + } + + public org.hl7.fhir.r5.model.ValueSet.ConceptReferenceComponent convertConceptReferenceComponent(org.hl7.fhir.dstu2.model.ValueSet.ConceptReferenceComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.ValueSet.ConceptReferenceComponent tgt = new org.hl7.fhir.r5.model.ValueSet.ConceptReferenceComponent(); + copyElement(src, tgt); + tgt.setCode(src.getCode()); + tgt.setDisplay(src.getDisplay()); + for (org.hl7.fhir.dstu2.model.ValueSet.ConceptDefinitionDesignationComponent t : src.getDesignation()) + tgt.addDesignation(convertConceptReferenceDesignationComponent(t)); + return tgt; + } + + public org.hl7.fhir.dstu2.model.ValueSet.ConceptReferenceComponent convertConceptReferenceComponent(org.hl7.fhir.r5.model.ValueSet.ConceptReferenceComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.ValueSet.ConceptReferenceComponent tgt = new org.hl7.fhir.dstu2.model.ValueSet.ConceptReferenceComponent(); + copyElement(src, tgt); + tgt.setCode(src.getCode()); + tgt.setDisplay(src.getDisplay()); + for (org.hl7.fhir.r5.model.ValueSet.ConceptReferenceDesignationComponent t : src.getDesignation()) + tgt.addDesignation(convertConceptReferenceDesignationComponent(t)); + return tgt; + } + + public org.hl7.fhir.r5.model.ValueSet.ConceptReferenceDesignationComponent convertConceptReferenceDesignationComponent(org.hl7.fhir.dstu2.model.ValueSet.ConceptDefinitionDesignationComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.ValueSet.ConceptReferenceDesignationComponent tgt = new org.hl7.fhir.r5.model.ValueSet.ConceptReferenceDesignationComponent(); + copyElement(src, tgt); + tgt.setLanguage(src.getLanguage()); + tgt.setUse(convertCoding(src.getUse())); + tgt.setValue(src.getValue()); + return tgt; + } + + public org.hl7.fhir.dstu2.model.ValueSet.ConceptDefinitionDesignationComponent convertConceptReferenceDesignationComponent(org.hl7.fhir.r5.model.ValueSet.ConceptReferenceDesignationComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.ValueSet.ConceptDefinitionDesignationComponent tgt = new org.hl7.fhir.dstu2.model.ValueSet.ConceptDefinitionDesignationComponent(); + copyElement(src, tgt); + tgt.setLanguage(src.getLanguage()); + tgt.setUse(convertCoding(src.getUse())); + tgt.setValue(src.getValue()); + return tgt; + } + + public org.hl7.fhir.r5.model.ValueSet.ConceptSetFilterComponent convertConceptSetFilterComponent(org.hl7.fhir.dstu2.model.ValueSet.ConceptSetFilterComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.ValueSet.ConceptSetFilterComponent tgt = new org.hl7.fhir.r5.model.ValueSet.ConceptSetFilterComponent(); + copyElement(src, tgt); + tgt.setProperty(src.getProperty()); + tgt.setOp(convertFilterOperator(src.getOp())); + tgt.setValue(src.getValue()); + return tgt; + } + + public org.hl7.fhir.dstu2.model.ValueSet.ConceptSetFilterComponent convertConceptSetFilterComponent(org.hl7.fhir.r5.model.ValueSet.ConceptSetFilterComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.ValueSet.ConceptSetFilterComponent tgt = new org.hl7.fhir.dstu2.model.ValueSet.ConceptSetFilterComponent(); + copyElement(src, tgt); + tgt.setProperty(src.getProperty()); + tgt.setOp(convertFilterOperator(src.getOp())); + tgt.setValue(src.getValue()); + return tgt; + } + + public org.hl7.fhir.r5.model.ValueSet.FilterOperator convertFilterOperator(org.hl7.fhir.dstu2.model.ValueSet.FilterOperator src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case EQUAL: return org.hl7.fhir.r5.model.ValueSet.FilterOperator.EQUAL; + case ISA: return org.hl7.fhir.r5.model.ValueSet.FilterOperator.ISA; + case ISNOTA: return org.hl7.fhir.r5.model.ValueSet.FilterOperator.ISNOTA; + case REGEX: return org.hl7.fhir.r5.model.ValueSet.FilterOperator.REGEX; + case IN: return org.hl7.fhir.r5.model.ValueSet.FilterOperator.IN; + case NOTIN: return org.hl7.fhir.r5.model.ValueSet.FilterOperator.NOTIN; + default: return org.hl7.fhir.r5.model.ValueSet.FilterOperator.NULL; + } + } + + public org.hl7.fhir.dstu2.model.ValueSet.FilterOperator convertFilterOperator(org.hl7.fhir.r5.model.ValueSet.FilterOperator src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case EQUAL: return org.hl7.fhir.dstu2.model.ValueSet.FilterOperator.EQUAL; + case ISA: return org.hl7.fhir.dstu2.model.ValueSet.FilterOperator.ISA; + case ISNOTA: return org.hl7.fhir.dstu2.model.ValueSet.FilterOperator.ISNOTA; + case REGEX: return org.hl7.fhir.dstu2.model.ValueSet.FilterOperator.REGEX; + case IN: return org.hl7.fhir.dstu2.model.ValueSet.FilterOperator.IN; + case NOTIN: return org.hl7.fhir.dstu2.model.ValueSet.FilterOperator.NOTIN; + default: return org.hl7.fhir.dstu2.model.ValueSet.FilterOperator.NULL; + } + } + + public org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionComponent convertValueSetExpansionComponent(org.hl7.fhir.dstu2.model.ValueSet.ValueSetExpansionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionComponent tgt = new org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionComponent(); + copyElement(src, tgt); + tgt.setIdentifier(src.getIdentifier()); + tgt.setTimestamp(src.getTimestamp()); + tgt.setTotal(src.getTotal()); + tgt.setOffset(src.getOffset()); + for (org.hl7.fhir.dstu2.model.ValueSet.ValueSetExpansionParameterComponent t : src.getParameter()) + tgt.addParameter(convertValueSetExpansionParameterComponent(t)); + for (org.hl7.fhir.dstu2.model.ValueSet.ValueSetExpansionContainsComponent t : src.getContains()) + tgt.addContains(convertValueSetExpansionContainsComponent(t)); + return tgt; + } + + public org.hl7.fhir.dstu2.model.ValueSet.ValueSetExpansionComponent convertValueSetExpansionComponent(org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.ValueSet.ValueSetExpansionComponent tgt = new org.hl7.fhir.dstu2.model.ValueSet.ValueSetExpansionComponent(); + copyElement(src, tgt); + tgt.setIdentifier(src.getIdentifier()); + tgt.setTimestamp(src.getTimestamp()); + tgt.setTotal(src.getTotal()); + tgt.setOffset(src.getOffset()); + for (org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionParameterComponent t : src.getParameter()) + tgt.addParameter(convertValueSetExpansionParameterComponent(t)); + for (org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionContainsComponent t : src.getContains()) + tgt.addContains(convertValueSetExpansionContainsComponent(t)); + return tgt; + } + + public org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionParameterComponent convertValueSetExpansionParameterComponent(org.hl7.fhir.dstu2.model.ValueSet.ValueSetExpansionParameterComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionParameterComponent tgt = new org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionParameterComponent(); + copyElement(src, tgt); + tgt.setName(src.getName()); + tgt.setValue(convertType(src.getValue())); + return tgt; + } + + public org.hl7.fhir.dstu2.model.ValueSet.ValueSetExpansionParameterComponent convertValueSetExpansionParameterComponent(org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionParameterComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.ValueSet.ValueSetExpansionParameterComponent tgt = new org.hl7.fhir.dstu2.model.ValueSet.ValueSetExpansionParameterComponent(); + copyElement(src, tgt); + tgt.setName(src.getName()); + tgt.setValue(convertType(src.getValue())); + return tgt; + } + + public org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionContainsComponent convertValueSetExpansionContainsComponent(org.hl7.fhir.dstu2.model.ValueSet.ValueSetExpansionContainsComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionContainsComponent tgt = new org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionContainsComponent(); + copyElement(src, tgt); + tgt.setSystem(src.getSystem()); + tgt.setAbstract(src.getAbstract()); + tgt.setVersion(src.getVersion()); + tgt.setCode(src.getCode()); + tgt.setDisplay(src.getDisplay()); + for (org.hl7.fhir.dstu2.model.ValueSet.ValueSetExpansionContainsComponent t : src.getContains()) + tgt.addContains(convertValueSetExpansionContainsComponent(t)); + return tgt; + } + + public org.hl7.fhir.dstu2.model.ValueSet.ValueSetExpansionContainsComponent convertValueSetExpansionContainsComponent(org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionContainsComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.ValueSet.ValueSetExpansionContainsComponent tgt = new org.hl7.fhir.dstu2.model.ValueSet.ValueSetExpansionContainsComponent(); + copyElement(src, tgt); + tgt.setSystem(src.getSystem()); + tgt.setAbstract(src.getAbstract()); + tgt.setVersion(src.getVersion()); + tgt.setCode(src.getCode()); + tgt.setDisplay(src.getDisplay()); + for (org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionContainsComponent t : src.getContains()) + tgt.addContains(convertValueSetExpansionContainsComponent(t)); + return tgt; + } + + public org.hl7.fhir.r5.model.ListResource convertList(org.hl7.fhir.dstu2.model.List_ src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.ListResource tgt = new org.hl7.fhir.r5.model.ListResource(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + tgt.setTitle(src.getTitle()); + tgt.setCode(convertCodeableConcept(src.getCode())); + tgt.setSubject(convertReference(src.getSubject())); + tgt.setSource(convertReference(src.getSource())); + tgt.setEncounter(convertReference(src.getEncounter())); + tgt.setStatus(convertListStatus(src.getStatus())); + if (src.hasDate()) + tgt.setDate(src.getDate()); + tgt.setOrderedBy(convertCodeableConcept(src.getOrderedBy())); + tgt.setMode(convertListMode(src.getMode())); + if (src.hasNote()) + tgt.addNote(new org.hl7.fhir.r5.model.Annotation().setText(src.getNote())); + for (org.hl7.fhir.dstu2.model.List_.ListEntryComponent t : src.getEntry()) + tgt.addEntry(convertListEntry(t)); + return tgt; + } + + + public org.hl7.fhir.r5.model.ListResource.ListStatus convertListStatus(org.hl7.fhir.dstu2.model.List_.ListStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case CURRENT: return org.hl7.fhir.r5.model.ListResource.ListStatus.CURRENT; + case RETIRED: return org.hl7.fhir.r5.model.ListResource.ListStatus.RETIRED; + case ENTEREDINERROR: return org.hl7.fhir.r5.model.ListResource.ListStatus.ENTEREDINERROR; + default: return org.hl7.fhir.r5.model.ListResource.ListStatus.NULL; + } + } + + public org.hl7.fhir.r5.model.ListResource.ListMode convertListMode(org.hl7.fhir.dstu2.model.List_.ListMode src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case WORKING: return org.hl7.fhir.r5.model.ListResource.ListMode.WORKING; + case SNAPSHOT: return org.hl7.fhir.r5.model.ListResource.ListMode.SNAPSHOT; + case CHANGES: return org.hl7.fhir.r5.model.ListResource.ListMode.CHANGES; + default: return org.hl7.fhir.r5.model.ListResource.ListMode.NULL; + } + } + + public org.hl7.fhir.r5.model.ListResource.ListEntryComponent convertListEntry(org.hl7.fhir.dstu2.model.List_.ListEntryComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.ListResource.ListEntryComponent tgt = new org.hl7.fhir.r5.model.ListResource.ListEntryComponent(); + copyBackboneElement(src, tgt); + tgt.setFlag(convertCodeableConcept(src.getFlag())); + tgt.setDeleted(src.getDeleted()); + if (src.hasDate()) + tgt.setDate(src.getDate()); + tgt.setItem(convertReference(src.getItem())); + return tgt; + } + + public org.hl7.fhir.dstu2.model.List_ convertList(org.hl7.fhir.r5.model.ListResource src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.List_ tgt = new org.hl7.fhir.dstu2.model.List_(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + tgt.setTitle(src.getTitle()); + tgt.setCode(convertCodeableConcept(src.getCode())); + tgt.setSubject(convertReference(src.getSubject())); + tgt.setSource(convertReference(src.getSource())); + tgt.setEncounter(convertReference(src.getEncounter())); + tgt.setStatus(convertListStatus(src.getStatus())); + if (src.hasDate()) + tgt.setDate(src.getDate()); + tgt.setOrderedBy(convertCodeableConcept(src.getOrderedBy())); + tgt.setMode(convertListMode(src.getMode())); + for (org.hl7.fhir.r5.model.Annotation t : src.getNote()) + tgt.setNote(t.getText()); + for (org.hl7.fhir.r5.model.ListResource.ListEntryComponent t : src.getEntry()) + tgt.addEntry(convertListEntry(t)); + return tgt; + } + + + public org.hl7.fhir.dstu2.model.List_.ListStatus convertListStatus(org.hl7.fhir.r5.model.ListResource.ListStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case CURRENT: return org.hl7.fhir.dstu2.model.List_.ListStatus.CURRENT; + case RETIRED: return org.hl7.fhir.dstu2.model.List_.ListStatus.RETIRED; + case ENTEREDINERROR: return org.hl7.fhir.dstu2.model.List_.ListStatus.ENTEREDINERROR; + default: return org.hl7.fhir.dstu2.model.List_.ListStatus.NULL; + } + } + + public org.hl7.fhir.dstu2.model.List_.ListMode convertListMode(org.hl7.fhir.r5.model.ListResource.ListMode src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case WORKING: return org.hl7.fhir.dstu2.model.List_.ListMode.WORKING; + case SNAPSHOT: return org.hl7.fhir.dstu2.model.List_.ListMode.SNAPSHOT; + case CHANGES: return org.hl7.fhir.dstu2.model.List_.ListMode.CHANGES; + default: return org.hl7.fhir.dstu2.model.List_.ListMode.NULL; + } + } + + public org.hl7.fhir.dstu2.model.List_.ListEntryComponent convertListEntry(org.hl7.fhir.r5.model.ListResource.ListEntryComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2.model.List_.ListEntryComponent tgt = new org.hl7.fhir.dstu2.model.List_.ListEntryComponent(); + copyBackboneElement(src, tgt); + tgt.setFlag(convertCodeableConcept(src.getFlag())); + tgt.setDeleted(src.getDeleted()); + if (src.hasDate()) + tgt.setDate(src.getDate()); + tgt.setItem(convertReference(src.getItem())); + return tgt; + } + + + + public org.hl7.fhir.r5.model.Resource convertResource(org.hl7.fhir.dstu2.model.Resource src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + if (src instanceof org.hl7.fhir.dstu2.model.Parameters) + return convertParameters((org.hl7.fhir.dstu2.model.Parameters) src); + if (src instanceof org.hl7.fhir.dstu2.model.Appointment) + return convertAppointment((org.hl7.fhir.dstu2.model.Appointment) src); + if (src instanceof org.hl7.fhir.dstu2.model.AppointmentResponse) + return convertAppointmentResponse((org.hl7.fhir.dstu2.model.AppointmentResponse) src); + if (src instanceof org.hl7.fhir.dstu2.model.AuditEvent) + return convertAuditEvent((org.hl7.fhir.dstu2.model.AuditEvent) src); + if (src instanceof org.hl7.fhir.dstu2.model.Basic) + return convertBasic((org.hl7.fhir.dstu2.model.Basic) src); + if (src instanceof org.hl7.fhir.dstu2.model.Binary) + return convertBinary((org.hl7.fhir.dstu2.model.Binary) src); + if (src instanceof org.hl7.fhir.dstu2.model.Bundle) + return convertBundle((org.hl7.fhir.dstu2.model.Bundle) src); + if (src instanceof org.hl7.fhir.dstu2.model.CarePlan) + return convertCarePlan((org.hl7.fhir.dstu2.model.CarePlan) src); +// if (src instanceof org.hl7.fhir.dstu2.model.ClinicalImpression) +// return convertClinicalImpression((org.hl7.fhir.dstu2.model.ClinicalImpression) src); + if (src instanceof org.hl7.fhir.dstu2.model.Communication) + return convertCommunication((org.hl7.fhir.dstu2.model.Communication) src); + if (src instanceof org.hl7.fhir.dstu2.model.CommunicationRequest) + return convertCommunicationRequest((org.hl7.fhir.dstu2.model.CommunicationRequest) src); + if (src instanceof org.hl7.fhir.dstu2.model.Composition) + return convertComposition((org.hl7.fhir.dstu2.model.Composition) src); + if (src instanceof org.hl7.fhir.dstu2.model.ConceptMap) + return convertConceptMap((org.hl7.fhir.dstu2.model.ConceptMap) src); + if (src instanceof org.hl7.fhir.dstu2.model.Condition) + return convertCondition((org.hl7.fhir.dstu2.model.Condition) src); + if (src instanceof org.hl7.fhir.dstu2.model.Conformance) + return convertConformance((org.hl7.fhir.dstu2.model.Conformance) src); +// if (src instanceof org.hl7.fhir.dstu2.model.Contract) +// return convertContract((org.hl7.fhir.dstu2.model.Contract) src); + if (src instanceof org.hl7.fhir.dstu2.model.DataElement) + return convertDataElement((org.hl7.fhir.dstu2.model.DataElement) src); + if (src instanceof org.hl7.fhir.dstu2.model.DetectedIssue) + return convertDetectedIssue((org.hl7.fhir.dstu2.model.DetectedIssue) src); +// if (src instanceof org.hl7.fhir.dstu2.model.Device) +// return convertDevice((org.hl7.fhir.dstu2.model.Device) src); +// if (src instanceof org.hl7.fhir.dstu2.model.DeviceComponent) +// return convertDeviceComponent((org.hl7.fhir.dstu2.model.DeviceComponent) src); + if (src instanceof org.hl7.fhir.dstu2.model.DeviceMetric) + return convertDeviceMetric((org.hl7.fhir.dstu2.model.DeviceMetric) src); + if (src instanceof org.hl7.fhir.dstu2.model.DeviceUseStatement) + return convertDeviceUseStatement((org.hl7.fhir.dstu2.model.DeviceUseStatement) src); + if (src instanceof org.hl7.fhir.dstu2.model.DiagnosticReport) + return convertDiagnosticReport((org.hl7.fhir.dstu2.model.DiagnosticReport) src); +// if (src instanceof org.hl7.fhir.dstu2.model.DocumentManifest) +// return convertDocumentManifest((org.hl7.fhir.dstu2.model.DocumentManifest) src); + if (src instanceof org.hl7.fhir.dstu2.model.DocumentReference) + return convertDocumentReference((org.hl7.fhir.dstu2.model.DocumentReference) src); + if (src instanceof org.hl7.fhir.dstu2.model.Encounter) + return convertEncounter((org.hl7.fhir.dstu2.model.Encounter) src); + if (src instanceof org.hl7.fhir.dstu2.model.EnrollmentRequest) + return convertEnrollmentRequest((org.hl7.fhir.dstu2.model.EnrollmentRequest) src); + if (src instanceof org.hl7.fhir.dstu2.model.EnrollmentResponse) + return convertEnrollmentResponse((org.hl7.fhir.dstu2.model.EnrollmentResponse) src); + if (src instanceof org.hl7.fhir.dstu2.model.EpisodeOfCare) + return convertEpisodeOfCare((org.hl7.fhir.dstu2.model.EpisodeOfCare) src); + if (src instanceof org.hl7.fhir.dstu2.model.FamilyMemberHistory) + return convertFamilyMemberHistory((org.hl7.fhir.dstu2.model.FamilyMemberHistory) src); + if (src instanceof org.hl7.fhir.dstu2.model.Flag) + return convertFlag((org.hl7.fhir.dstu2.model.Flag) src); + if (src instanceof org.hl7.fhir.dstu2.model.Group) + return convertGroup((org.hl7.fhir.dstu2.model.Group) src); + if (src instanceof org.hl7.fhir.dstu2.model.HealthcareService) + return convertHealthcareService((org.hl7.fhir.dstu2.model.HealthcareService) src); + if (src instanceof org.hl7.fhir.dstu2.model.ImplementationGuide) + return convertImplementationGuide((org.hl7.fhir.dstu2.model.ImplementationGuide) src); + if (src instanceof org.hl7.fhir.dstu2.model.List_) + return convertList((org.hl7.fhir.dstu2.model.List_) src); + if (src instanceof org.hl7.fhir.dstu2.model.Location) + return convertLocation((org.hl7.fhir.dstu2.model.Location) src); +// if (src instanceof org.hl7.fhir.dstu2.model.Media) +// return convertMedia((org.hl7.fhir.dstu2.model.Media) src); +// if (src instanceof org.hl7.fhir.dstu2.model.Medication) +// return convertMedication((org.hl7.fhir.dstu2.model.Medication) src); + if (src instanceof org.hl7.fhir.dstu2.model.MedicationDispense) + return convertMedicationDispense((org.hl7.fhir.dstu2.model.MedicationDispense) src); +// if (src instanceof org.hl7.fhir.dstu2.model.MedicationOrder) +// return convertMedicationOrder((org.hl7.fhir.dstu2.model.MedicationOrder) src); + if (src instanceof org.hl7.fhir.dstu2.model.MedicationStatement) + return convertMedicationStatement((org.hl7.fhir.dstu2.model.MedicationStatement) src); + if (src instanceof org.hl7.fhir.dstu2.model.MessageHeader) + return convertMessageHeader((org.hl7.fhir.dstu2.model.MessageHeader) src); + if (src instanceof org.hl7.fhir.dstu2.model.NamingSystem) + return convertNamingSystem((org.hl7.fhir.dstu2.model.NamingSystem) src); + if (src instanceof org.hl7.fhir.dstu2.model.Observation) + return convertObservation((org.hl7.fhir.dstu2.model.Observation) src); + if (src instanceof org.hl7.fhir.dstu2.model.OperationDefinition) + return convertOperationDefinition((org.hl7.fhir.dstu2.model.OperationDefinition) src); + if (src instanceof org.hl7.fhir.dstu2.model.OperationOutcome) + return convertOperationOutcome((org.hl7.fhir.dstu2.model.OperationOutcome) src); + if (src instanceof org.hl7.fhir.dstu2.model.Organization) + return convertOrganization((org.hl7.fhir.dstu2.model.Organization) src); + if (src instanceof org.hl7.fhir.dstu2.model.Patient) + return convertPatient((org.hl7.fhir.dstu2.model.Patient) src); + if (src instanceof org.hl7.fhir.dstu2.model.Person) + return convertPerson((org.hl7.fhir.dstu2.model.Person) src); + if (src instanceof org.hl7.fhir.dstu2.model.Practitioner) + return convertPractitioner((org.hl7.fhir.dstu2.model.Practitioner) src); +// if (src instanceof org.hl7.fhir.dstu2.model.Provenance) +// return convertProvenance((org.hl7.fhir.dstu2.model.Provenance) src); + if (src instanceof org.hl7.fhir.dstu2.model.Questionnaire) + return convertQuestionnaire((org.hl7.fhir.dstu2.model.Questionnaire) src); + if (src instanceof org.hl7.fhir.dstu2.model.QuestionnaireResponse) + return convertQuestionnaireResponse((org.hl7.fhir.dstu2.model.QuestionnaireResponse) src); + if (src instanceof org.hl7.fhir.dstu2.model.RiskAssessment) + return convertRiskAssessment((org.hl7.fhir.dstu2.model.RiskAssessment) src); + if (src instanceof org.hl7.fhir.dstu2.model.Schedule) + return convertSchedule((org.hl7.fhir.dstu2.model.Schedule) src); + if (src instanceof org.hl7.fhir.dstu2.model.SearchParameter) + return convertSearchParameter((org.hl7.fhir.dstu2.model.SearchParameter) src); + if (src instanceof org.hl7.fhir.dstu2.model.Slot) + return convertSlot((org.hl7.fhir.dstu2.model.Slot) src); + if (src instanceof org.hl7.fhir.dstu2.model.StructureDefinition) + return convertStructureDefinition((org.hl7.fhir.dstu2.model.StructureDefinition) src); + if (src instanceof org.hl7.fhir.dstu2.model.Subscription) + return convertSubscription((org.hl7.fhir.dstu2.model.Subscription) src); + if (src instanceof org.hl7.fhir.dstu2.model.Substance) + return convertSubstance((org.hl7.fhir.dstu2.model.Substance) src); + if (src instanceof org.hl7.fhir.dstu2.model.SupplyDelivery) + return convertSupplyDelivery((org.hl7.fhir.dstu2.model.SupplyDelivery) src); + if (src instanceof org.hl7.fhir.dstu2.model.SupplyRequest) + return convertSupplyRequest((org.hl7.fhir.dstu2.model.SupplyRequest) src); + if (src instanceof org.hl7.fhir.dstu2.model.TestScript) + return convertTestScript((org.hl7.fhir.dstu2.model.TestScript) src); + if (src instanceof org.hl7.fhir.dstu2.model.ValueSet) + return convertValueSet((org.hl7.fhir.dstu2.model.ValueSet) src); + throw new FHIRException("Unknown resource "+src.fhirType()); + } + + public org.hl7.fhir.dstu2.model.Resource convertResource(org.hl7.fhir.r5.model.Resource src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + if (src instanceof org.hl7.fhir.r5.model.Parameters) + return convertParameters((org.hl7.fhir.r5.model.Parameters) src); + if (src instanceof org.hl7.fhir.r5.model.Appointment) + return convertAppointment((org.hl7.fhir.r5.model.Appointment) src); + if (src instanceof org.hl7.fhir.r5.model.AppointmentResponse) + return convertAppointmentResponse((org.hl7.fhir.r5.model.AppointmentResponse) src); + if (src instanceof org.hl7.fhir.r5.model.AuditEvent) + return convertAuditEvent((org.hl7.fhir.r5.model.AuditEvent) src); + if (src instanceof org.hl7.fhir.r5.model.Basic) + return convertBasic((org.hl7.fhir.r5.model.Basic) src); + if (src instanceof org.hl7.fhir.r5.model.Binary) + return convertBinary((org.hl7.fhir.r5.model.Binary) src); + if (src instanceof org.hl7.fhir.r5.model.Bundle) + return convertBundle((org.hl7.fhir.r5.model.Bundle) src); + if (src instanceof org.hl7.fhir.r5.model.CarePlan) + return convertCarePlan((org.hl7.fhir.r5.model.CarePlan) src); +// if (src instanceof org.hl7.fhir.r5.model.ClinicalImpression) +// return convertClinicalImpression((org.hl7.fhir.r5.model.ClinicalImpression) src); + if (src instanceof org.hl7.fhir.r5.model.Communication) + return convertCommunication((org.hl7.fhir.r5.model.Communication) src); + if (src instanceof org.hl7.fhir.r5.model.CommunicationRequest) + return convertCommunicationRequest((org.hl7.fhir.r5.model.CommunicationRequest) src); + if (src instanceof org.hl7.fhir.r5.model.Composition) + return convertComposition((org.hl7.fhir.r5.model.Composition) src); + if (src instanceof org.hl7.fhir.r5.model.ConceptMap) + return convertConceptMap((org.hl7.fhir.r5.model.ConceptMap) src); + if (src instanceof org.hl7.fhir.r5.model.Condition) + return convertCondition((org.hl7.fhir.r5.model.Condition) src); + if (src instanceof org.hl7.fhir.r5.model.CapabilityStatement) + return convertConformance((org.hl7.fhir.r5.model.CapabilityStatement) src); +// if (src instanceof org.hl7.fhir.r5.model.Contract) +// return convertContract((org.hl7.fhir.r5.model.Contract) src); + if (src instanceof org.hl7.fhir.r5.model.DetectedIssue) + return convertDetectedIssue((org.hl7.fhir.r5.model.DetectedIssue) src); +// if (src instanceof org.hl7.fhir.r5.model.Device) +// return convertDevice((org.hl7.fhir.r5.model.Device) src); +// if (src instanceof org.hl7.fhir.r5.model.DeviceComponent) +// return convertDeviceComponent((org.hl7.fhir.r5.model.DeviceComponent) src); + if (src instanceof org.hl7.fhir.r5.model.DeviceMetric) + return convertDeviceMetric((org.hl7.fhir.r5.model.DeviceMetric) src); + if (src instanceof org.hl7.fhir.r5.model.DeviceUseStatement) + return convertDeviceUseStatement((org.hl7.fhir.r5.model.DeviceUseStatement) src); + if (src instanceof org.hl7.fhir.r5.model.DiagnosticReport) + return convertDiagnosticReport((org.hl7.fhir.r5.model.DiagnosticReport) src); +// if (src instanceof org.hl7.fhir.r5.model.DocumentManifest) +// return convertDocumentManifest((org.hl7.fhir.r5.model.DocumentManifest) src); + if (src instanceof org.hl7.fhir.r5.model.DocumentReference) + return convertDocumentReference((org.hl7.fhir.r5.model.DocumentReference) src); + if (src instanceof org.hl7.fhir.r5.model.Encounter) + return convertEncounter((org.hl7.fhir.r5.model.Encounter) src); + if (src instanceof org.hl7.fhir.r5.model.EnrollmentRequest) + return convertEnrollmentRequest((org.hl7.fhir.r5.model.EnrollmentRequest) src); + if (src instanceof org.hl7.fhir.r5.model.EnrollmentResponse) + return convertEnrollmentResponse((org.hl7.fhir.r5.model.EnrollmentResponse) src); + if (src instanceof org.hl7.fhir.r5.model.EpisodeOfCare) + return convertEpisodeOfCare((org.hl7.fhir.r5.model.EpisodeOfCare) src); + if (src instanceof org.hl7.fhir.r5.model.FamilyMemberHistory) + return convertFamilyMemberHistory((org.hl7.fhir.r5.model.FamilyMemberHistory) src); + if (src instanceof org.hl7.fhir.r5.model.Flag) + return convertFlag((org.hl7.fhir.r5.model.Flag) src); + if (src instanceof org.hl7.fhir.r5.model.Group) + return convertGroup((org.hl7.fhir.r5.model.Group) src); + if (src instanceof org.hl7.fhir.r5.model.HealthcareService) + return convertHealthcareService((org.hl7.fhir.r5.model.HealthcareService) src); + if (src instanceof org.hl7.fhir.r5.model.ImplementationGuide) + return convertImplementationGuide((org.hl7.fhir.r5.model.ImplementationGuide) src); + if (src instanceof org.hl7.fhir.r5.model.ListResource) + return convertList((org.hl7.fhir.r5.model.ListResource) src); + if (src instanceof org.hl7.fhir.r5.model.Location) + return convertLocation((org.hl7.fhir.r5.model.Location) src); +// if (src instanceof org.hl7.fhir.r5.model.Media) +// return convertMedia((org.hl7.fhir.r5.model.Media) src); +// if (src instanceof org.hl7.fhir.r5.model.Medication) +// return convertMedication((org.hl7.fhir.r5.model.Medication) src); + if (src instanceof org.hl7.fhir.r5.model.MedicationDispense) + return convertMedicationDispense((org.hl7.fhir.r5.model.MedicationDispense) src); +// if (src instanceof org.hl7.fhir.r5.model.MedicationOrder) +// return convertMedicationOrder((org.hl7.fhir.r5.model.MedicationOrder) src); + if (src instanceof org.hl7.fhir.r5.model.MedicationStatement) + return convertMedicationStatement((org.hl7.fhir.r5.model.MedicationStatement) src); + if (src instanceof org.hl7.fhir.r5.model.MessageHeader) + return convertMessageHeader((org.hl7.fhir.r5.model.MessageHeader) src); + if (src instanceof org.hl7.fhir.r5.model.NamingSystem) + return convertNamingSystem((org.hl7.fhir.r5.model.NamingSystem) src); + if (src instanceof org.hl7.fhir.r5.model.Observation) + return convertObservation((org.hl7.fhir.r5.model.Observation) src); + if (src instanceof org.hl7.fhir.r5.model.OperationDefinition) + return convertOperationDefinition((org.hl7.fhir.r5.model.OperationDefinition) src); + if (src instanceof org.hl7.fhir.r5.model.OperationOutcome) + return convertOperationOutcome((org.hl7.fhir.r5.model.OperationOutcome) src); + if (src instanceof org.hl7.fhir.r5.model.Organization) + return convertOrganization((org.hl7.fhir.r5.model.Organization) src); + if (src instanceof org.hl7.fhir.r5.model.Patient) + return convertPatient((org.hl7.fhir.r5.model.Patient) src); + if (src instanceof org.hl7.fhir.r5.model.Person) + return convertPerson((org.hl7.fhir.r5.model.Person) src); + if (src instanceof org.hl7.fhir.r5.model.Practitioner) + return convertPractitioner((org.hl7.fhir.r5.model.Practitioner) src); +// if (src instanceof org.hl7.fhir.r5.model.Provenance) +// return convertProvenance((org.hl7.fhir.r5.model.Provenance) src); + if (src instanceof org.hl7.fhir.r5.model.Questionnaire) + return convertQuestionnaire((org.hl7.fhir.r5.model.Questionnaire) src); + if (src instanceof org.hl7.fhir.r5.model.QuestionnaireResponse) + return convertQuestionnaireResponse((org.hl7.fhir.r5.model.QuestionnaireResponse) src); + if (src instanceof org.hl7.fhir.r5.model.RiskAssessment) + return convertRiskAssessment((org.hl7.fhir.r5.model.RiskAssessment) src); + if (src instanceof org.hl7.fhir.r5.model.Schedule) + return convertSchedule((org.hl7.fhir.r5.model.Schedule) src); + if (src instanceof org.hl7.fhir.r5.model.SearchParameter) + return convertSearchParameter((org.hl7.fhir.r5.model.SearchParameter) src); + if (src instanceof org.hl7.fhir.r5.model.Slot) + return convertSlot((org.hl7.fhir.r5.model.Slot) src); + if (src instanceof org.hl7.fhir.r5.model.StructureDefinition) + return convertStructureDefinition((org.hl7.fhir.r5.model.StructureDefinition) src); + if (src instanceof org.hl7.fhir.r5.model.Subscription) + return convertSubscription((org.hl7.fhir.r5.model.Subscription) src); + if (src instanceof org.hl7.fhir.r5.model.Substance) + return convertSubstance((org.hl7.fhir.r5.model.Substance) src); + if (src instanceof org.hl7.fhir.r5.model.SupplyDelivery) + return convertSupplyDelivery((org.hl7.fhir.r5.model.SupplyDelivery) src); + if (src instanceof org.hl7.fhir.r5.model.SupplyRequest) + return convertSupplyRequest((org.hl7.fhir.r5.model.SupplyRequest) src); + if (src instanceof org.hl7.fhir.r5.model.TestScript) + return convertTestScript((org.hl7.fhir.r5.model.TestScript) src); + if (src instanceof org.hl7.fhir.r5.model.ValueSet) + return convertValueSet((org.hl7.fhir.r5.model.ValueSet) src); + throw new FHIRException("Unknown resource "+src.fhirType()); + } + + public TerminologyCapabilities convertTerminologyCapabilities(Parameters src) { + TerminologyCapabilities res = new TerminologyCapabilities(); + for (ParametersParameterComponent p : src.getParameter()) { + if (p.getName().equals("system")) + res.addCodeSystem().setUri(p.getValue().primitiveValue()); + } + return res; + } + + public static boolean convertsResource(String rt) { + return Utilities.existsInList(rt, "Parameters", "Appointment", "AppointmentResponse", "AuditEvent", "Basic", "Binary", "Bundle", "CarePlan", "Communication", "CommunicationRequest", "Composition", "ConceptMap", "Condition", "CapabilityStatement", "DetectedIssue", + "DeviceMetric", "DeviceUseStatement", "DiagnosticReport", "DocumentReference", "Encounter", "EnrollmentRequest", "EnrollmentResponse", "EpisodeOfCare", "FamilyMemberHistory", "Flag", "Group", "HealthcareService", "ImplementationGuide", + "ListResource", "Location", "MedicationDispense", "MedicationStatement", "MessageHeader", "NamingSystem", "Observation", "OperationDefinition", "OperationOutcome", "Organization", "Patient", "Person", "Practitioner", "Questionnaire", + "QuestionnaireResponse", "RiskAssessment", "Schedule", "SearchParameter", "Slot", "StructureDefinition", "Subscription", "Substance", "SupplyDelivery", "SupplyRequest", "TestScript", "ValueSet"); + } + +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/VersionConvertor_14_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/VersionConvertor_14_50.java new file mode 100644 index 000000000..27e699be4 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/VersionConvertor_14_50.java @@ -0,0 +1,6933 @@ +package org.hl7.fhir.convertors; + +/*- + * #%L + * org.hl7.fhir.convertors + * %% + * Copyright (C) 2014 - 2019 Health Level 7 + * %% + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * #L% + */ + + +/* + Copyright (c) 2011+, HL7, Inc. + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of HL7 nor the names of its contributors may be used to + endorse or promote products derived from this software without specific + prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + + */ + +// Generated on Mon, Aug 15, 2016 19:58+1000 for FHIR v1.7.0 + +import java.util.ArrayList; +import java.util.List; + +import org.hl7.fhir.dstu2016may.model.CodeSystem.ConceptDefinitionPropertyComponent; +import org.hl7.fhir.dstu2016may.model.CodeableConcept; +import org.hl7.fhir.dstu2016may.model.ImplementationGuide.GuidePageKind; +import org.hl7.fhir.dstu2016may.model.Reference; +import org.hl7.fhir.dstu2016may.model.StructureMap; +import org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapContextType; +import org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapListMode; +import org.hl7.fhir.exceptions.FHIRException; +import org.hl7.fhir.r5.conformance.ProfileUtilities; +import org.hl7.fhir.r5.model.BooleanType; +import org.hl7.fhir.r5.model.CanonicalType; +import org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestComponent; +import org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceComponent; +import org.hl7.fhir.r5.model.CodeSystem; +import org.hl7.fhir.r5.model.CodeSystem.FilterOperator; +import org.hl7.fhir.r5.model.ConceptMap; +import org.hl7.fhir.r5.model.ConceptMap.ConceptMapGroupComponent; +import org.hl7.fhir.r5.model.ConceptMap.SourceElementComponent; +import org.hl7.fhir.r5.model.ContactDetail; +import org.hl7.fhir.r5.model.ElementDefinition; +import org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent; +import org.hl7.fhir.r5.model.Enumeration; +import org.hl7.fhir.r5.model.ImplementationGuide.GuidePageGeneration; +import org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemOperator; +import org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionKind; +import org.hl7.fhir.r5.model.StructureDefinition.TypeDerivationRule; +import org.hl7.fhir.r5.model.Timing.EventTiming; +import org.hl7.fhir.r5.model.Type; +import org.hl7.fhir.r5.model.UsageContext; +import org.hl7.fhir.utilities.Utilities; + +public class VersionConvertor_14_50 { + + private static List CANONICAL_URLS = new ArrayList(); + static { + CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/11179-permitted-value-conceptmap"); + CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/11179-permitted-value-valueset"); + CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/codesystem-map"); + CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/cqif-library"); + CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/elementdefinition-allowedUnits"); + CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/elementdefinition-inheritedExtensibleValueSet"); + CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/elementdefinition-maxValueSet"); + CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/elementdefinition-minValueSet"); + CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/event-instantiatesCanonical"); + CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/questionnaire-allowedProfile"); + CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/questionnaire-deMap"); + CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/questionnaire-sourceStructureMap"); + CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/questionnaire-targetStructureMap"); + CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/questionnaire-unit-valueSet"); + CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/valueset-map"); + CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/valueset-supplement"); + CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/valueset-system"); + } + + private static void copyElement(org.hl7.fhir.dstu2016may.model.Element src, org.hl7.fhir.r5.model.Element tgt) throws FHIRException { + if (src.hasId()) + tgt.setId(src.getId()); + for (org.hl7.fhir.dstu2016may.model.Extension e : src.getExtension()) { + if (!(e.getUrl().equals(VersionConvertorConstants.IG_DEPENDSON_PACKAGE_EXTENSION) || e.getUrl().equals(VersionConvertorConstants.IG_DEPENDSON_VERSION_EXTENSION))) + tgt.addExtension(convertExtension(e)); + } + } + + private static void copyElement(org.hl7.fhir.r5.model.Element src, org.hl7.fhir.dstu2016may.model.Element tgt) throws FHIRException { + if (src.hasId()) + tgt.setId(src.getId()); + for (org.hl7.fhir.r5.model.Extension e : src.getExtension()) { + tgt.addExtension(convertExtension(e)); + } + } + + private static void copyBackboneElement(org.hl7.fhir.dstu2016may.model.BackboneElement src, org.hl7.fhir.r5.model.BackboneElement tgt) throws FHIRException { + copyElement(src, tgt); + for (org.hl7.fhir.dstu2016may.model.Extension e : src.getModifierExtension()) { + tgt.addModifierExtension(convertExtension(e)); + } + } + + private static void copyBackboneElement(org.hl7.fhir.r5.model.BackboneElement src, org.hl7.fhir.dstu2016may.model.BackboneElement tgt) throws FHIRException { + copyElement(src, tgt); + for (org.hl7.fhir.r5.model.Extension e : src.getModifierExtension()) { + tgt.addModifierExtension(convertExtension(e)); + } + } + + public static org.hl7.fhir.r5.model.Base64BinaryType convertBase64Binary(org.hl7.fhir.dstu2016may.model.Base64BinaryType src) throws FHIRException { + org.hl7.fhir.r5.model.Base64BinaryType tgt = new org.hl7.fhir.r5.model.Base64BinaryType(); + if (src.hasValue()) + tgt.setValue(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Base64BinaryType convertBase64Binary(org.hl7.fhir.r5.model.Base64BinaryType src) throws FHIRException { + org.hl7.fhir.dstu2016may.model.Base64BinaryType tgt = new org.hl7.fhir.dstu2016may.model.Base64BinaryType(); + if (src.hasValue()) + tgt.setValue(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.r5.model.BooleanType convertBoolean(org.hl7.fhir.dstu2016may.model.BooleanType src) throws FHIRException { + org.hl7.fhir.r5.model.BooleanType tgt = new org.hl7.fhir.r5.model.BooleanType(); + if (src.hasValue()) + tgt.setValue(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.BooleanType convertBoolean(org.hl7.fhir.r5.model.BooleanType src) throws FHIRException { + org.hl7.fhir.dstu2016may.model.BooleanType tgt = new org.hl7.fhir.dstu2016may.model.BooleanType(); + if (src.hasValue()) + tgt.setValue(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.r5.model.CodeType convertCode(org.hl7.fhir.dstu2016may.model.CodeType src) throws FHIRException { + org.hl7.fhir.r5.model.CodeType tgt = new org.hl7.fhir.r5.model.CodeType(); + if (src.hasValue()) + tgt.setValue(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.CodeType convertCode(org.hl7.fhir.r5.model.CodeType src) throws FHIRException { + org.hl7.fhir.dstu2016may.model.CodeType tgt = new org.hl7.fhir.dstu2016may.model.CodeType(); + if (src.hasValue()) + tgt.setValue(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.r5.model.DateType convertDate(org.hl7.fhir.dstu2016may.model.DateType src) throws FHIRException { + org.hl7.fhir.r5.model.DateType tgt = new org.hl7.fhir.r5.model.DateType(); + if (src.hasValue()) + tgt.setValue(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.DateType convertDate(org.hl7.fhir.r5.model.DateType src) throws FHIRException { + org.hl7.fhir.dstu2016may.model.DateType tgt = new org.hl7.fhir.dstu2016may.model.DateType(); + if (src.hasValue()) + tgt.setValue(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.r5.model.DateTimeType convertDateTime(org.hl7.fhir.dstu2016may.model.DateTimeType src) throws FHIRException { + org.hl7.fhir.r5.model.DateTimeType tgt = new org.hl7.fhir.r5.model.DateTimeType(); + if (src.hasValue()) + tgt.setValue(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.DateTimeType convertDateTime(org.hl7.fhir.r5.model.DateTimeType src) throws FHIRException { + org.hl7.fhir.dstu2016may.model.DateTimeType tgt = new org.hl7.fhir.dstu2016may.model.DateTimeType(); + if (src.hasValue()) + tgt.setValue(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.r5.model.DecimalType convertDecimal(org.hl7.fhir.dstu2016may.model.DecimalType src) throws FHIRException { + org.hl7.fhir.r5.model.DecimalType tgt = new org.hl7.fhir.r5.model.DecimalType(); + if (src.hasValue()) + tgt.setValue(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.DecimalType convertDecimal(org.hl7.fhir.r5.model.DecimalType src) throws FHIRException { + org.hl7.fhir.dstu2016may.model.DecimalType tgt = new org.hl7.fhir.dstu2016may.model.DecimalType(); + if (src.hasValue()) + tgt.setValue(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.r5.model.IdType convertId(org.hl7.fhir.dstu2016may.model.IdType src) throws FHIRException { + org.hl7.fhir.r5.model.IdType tgt = new org.hl7.fhir.r5.model.IdType(); + if (src.hasValue()) + tgt.setValue(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.IdType convertId(org.hl7.fhir.r5.model.IdType src) throws FHIRException { + org.hl7.fhir.dstu2016may.model.IdType tgt = new org.hl7.fhir.dstu2016may.model.IdType(); + if (src.hasValue()) + tgt.setValue(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.r5.model.InstantType convertInstant(org.hl7.fhir.dstu2016may.model.InstantType src) throws FHIRException { + org.hl7.fhir.r5.model.InstantType tgt = new org.hl7.fhir.r5.model.InstantType(); + if (src.hasValue()) + tgt.setValue(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.InstantType convertInstant(org.hl7.fhir.r5.model.InstantType src) throws FHIRException { + org.hl7.fhir.dstu2016may.model.InstantType tgt = new org.hl7.fhir.dstu2016may.model.InstantType(); + if (src.hasValue()) + tgt.setValue(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.r5.model.IntegerType convertInteger(org.hl7.fhir.dstu2016may.model.IntegerType src) throws FHIRException { + org.hl7.fhir.r5.model.IntegerType tgt = new org.hl7.fhir.r5.model.IntegerType(); + if (src.hasValue()) + tgt.setValue(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.IntegerType convertInteger(org.hl7.fhir.r5.model.IntegerType src) throws FHIRException { + org.hl7.fhir.dstu2016may.model.IntegerType tgt = new org.hl7.fhir.dstu2016may.model.IntegerType(); + if (src.hasValue()) + tgt.setValue(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.r5.model.MarkdownType convertMarkdown(org.hl7.fhir.dstu2016may.model.MarkdownType src) throws FHIRException { + org.hl7.fhir.r5.model.MarkdownType tgt = new org.hl7.fhir.r5.model.MarkdownType(); + if (src.hasValue()) + tgt.setValue(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.MarkdownType convertMarkdown(org.hl7.fhir.r5.model.MarkdownType src) throws FHIRException { + org.hl7.fhir.dstu2016may.model.MarkdownType tgt = new org.hl7.fhir.dstu2016may.model.MarkdownType(); + if (src.hasValue()) + tgt.setValue(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.r5.model.OidType convertOid(org.hl7.fhir.dstu2016may.model.OidType src) throws FHIRException { + org.hl7.fhir.r5.model.OidType tgt = new org.hl7.fhir.r5.model.OidType(); + if (src.hasValue()) + tgt.setValue(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.OidType convertOid(org.hl7.fhir.r5.model.OidType src) throws FHIRException { + org.hl7.fhir.dstu2016may.model.OidType tgt = new org.hl7.fhir.dstu2016may.model.OidType(); + if (src.hasValue()) + tgt.setValue(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.r5.model.PositiveIntType convertPositiveInt(org.hl7.fhir.dstu2016may.model.PositiveIntType src) throws FHIRException { + org.hl7.fhir.r5.model.PositiveIntType tgt = new org.hl7.fhir.r5.model.PositiveIntType(); + if (src.hasValue()) + tgt.setValue(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.PositiveIntType convertPositiveInt(org.hl7.fhir.r5.model.PositiveIntType src) throws FHIRException { + org.hl7.fhir.dstu2016may.model.PositiveIntType tgt = new org.hl7.fhir.dstu2016may.model.PositiveIntType(); + if (src.hasValue()) + tgt.setValue(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.r5.model.StringType convertString(org.hl7.fhir.dstu2016may.model.StringType src) throws FHIRException { + org.hl7.fhir.r5.model.StringType tgt = new org.hl7.fhir.r5.model.StringType(); + if (src.hasValue()) + tgt.setValue(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.StringType convertString(org.hl7.fhir.r5.model.StringType src) throws FHIRException { + org.hl7.fhir.dstu2016may.model.StringType tgt = new org.hl7.fhir.dstu2016may.model.StringType(); + if (src.hasValue()) + tgt.setValue(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.r5.model.TimeType convertTime(org.hl7.fhir.dstu2016may.model.TimeType src) throws FHIRException { + org.hl7.fhir.r5.model.TimeType tgt = new org.hl7.fhir.r5.model.TimeType(); + if (src.hasValue()) + tgt.setValue(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.TimeType convertTime(org.hl7.fhir.r5.model.TimeType src) throws FHIRException { + org.hl7.fhir.dstu2016may.model.TimeType tgt = new org.hl7.fhir.dstu2016may.model.TimeType(); + if (src.hasValue()) + tgt.setValue(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.r5.model.UnsignedIntType convertUnsignedInt(org.hl7.fhir.dstu2016may.model.UnsignedIntType src) throws FHIRException { + org.hl7.fhir.r5.model.UnsignedIntType tgt = new org.hl7.fhir.r5.model.UnsignedIntType(); + if (src.hasValue()) + tgt.setValue(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.UnsignedIntType convertUnsignedInt(org.hl7.fhir.r5.model.UnsignedIntType src) throws FHIRException { + org.hl7.fhir.dstu2016may.model.UnsignedIntType tgt = new org.hl7.fhir.dstu2016may.model.UnsignedIntType(); + if (src.hasValue()) + tgt.setValue(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.r5.model.UriType convertUri(org.hl7.fhir.dstu2016may.model.UriType src) throws FHIRException { + org.hl7.fhir.r5.model.UriType tgt = new org.hl7.fhir.r5.model.UriType(); + if (src.hasValue()) + tgt.setValue(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.r5.model.UrlType convertUriToUrl(org.hl7.fhir.dstu2016may.model.UriType src) throws FHIRException { + org.hl7.fhir.r5.model.UrlType tgt = new org.hl7.fhir.r5.model.UrlType(); + if (src.hasValue()) + tgt.setValue(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.UriType convertUri(org.hl7.fhir.r5.model.UriType src) throws FHIRException { + org.hl7.fhir.dstu2016may.model.UriType tgt = new org.hl7.fhir.dstu2016may.model.UriType(); + if (src.hasValue()) + tgt.setValue(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.r5.model.UuidType convertUuid(org.hl7.fhir.dstu2016may.model.UuidType src) throws FHIRException { + org.hl7.fhir.r5.model.UuidType tgt = new org.hl7.fhir.r5.model.UuidType(); + if (src.hasValue()) + tgt.setValue(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.UuidType convertUuid(org.hl7.fhir.r5.model.UuidType src) throws FHIRException { + org.hl7.fhir.dstu2016may.model.UuidType tgt = new org.hl7.fhir.dstu2016may.model.UuidType(); + if (src.hasValue()) + tgt.setValue(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.r5.model.Extension convertExtension(org.hl7.fhir.dstu2016may.model.Extension src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Extension tgt = new org.hl7.fhir.r5.model.Extension(); + copyElement(src, tgt); + tgt.setUrl(src.getUrl()); + if (src.hasValue()) + if (CANONICAL_URLS.contains(src.getUrl()) && src.getValue() instanceof org.hl7.fhir.dstu2016may.model.Reference) + tgt.setValue(convertReferenceToCanonical((Reference)src.getValue())); + else + tgt.setValue(convertType(src.getValue())); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Extension convertExtension(org.hl7.fhir.r5.model.Extension src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Extension tgt = new org.hl7.fhir.dstu2016may.model.Extension(); + copyElement(src, tgt); + tgt.setUrl(src.getUrl()); + if (src.hasValue()) + if (CANONICAL_URLS.contains(src.getUrl()) && src.getValue() instanceof org.hl7.fhir.r5.model.CanonicalType) + tgt.setValue(convertCanonicalToReference((CanonicalType)src.getValue())); + else + tgt.setValue(convertType(src.getValue())); + return tgt; + } + + public static org.hl7.fhir.r5.model.Narrative convertNarrative(org.hl7.fhir.dstu2016may.model.Narrative src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Narrative tgt = new org.hl7.fhir.r5.model.Narrative(); + copyElement(src, tgt); + tgt.setStatus(convertNarrativeStatus(src.getStatus())); + tgt.setDiv(src.getDiv()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Narrative convertNarrative(org.hl7.fhir.r5.model.Narrative src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Narrative tgt = new org.hl7.fhir.dstu2016may.model.Narrative(); + copyElement(src, tgt); + tgt.setStatus(convertNarrativeStatus(src.getStatus())); + tgt.setDiv(src.getDiv()); + return tgt; + } + + private static org.hl7.fhir.r5.model.Narrative.NarrativeStatus convertNarrativeStatus(org.hl7.fhir.dstu2016may.model.Narrative.NarrativeStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case GENERATED: return org.hl7.fhir.r5.model.Narrative.NarrativeStatus.GENERATED; + case EXTENSIONS: return org.hl7.fhir.r5.model.Narrative.NarrativeStatus.EXTENSIONS; + case ADDITIONAL: return org.hl7.fhir.r5.model.Narrative.NarrativeStatus.ADDITIONAL; + case EMPTY: return org.hl7.fhir.r5.model.Narrative.NarrativeStatus.EMPTY; + default: return org.hl7.fhir.r5.model.Narrative.NarrativeStatus.NULL; + } + } + + private static org.hl7.fhir.dstu2016may.model.Narrative.NarrativeStatus convertNarrativeStatus(org.hl7.fhir.r5.model.Narrative.NarrativeStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case GENERATED: return org.hl7.fhir.dstu2016may.model.Narrative.NarrativeStatus.GENERATED; + case EXTENSIONS: return org.hl7.fhir.dstu2016may.model.Narrative.NarrativeStatus.EXTENSIONS; + case ADDITIONAL: return org.hl7.fhir.dstu2016may.model.Narrative.NarrativeStatus.ADDITIONAL; + case EMPTY: return org.hl7.fhir.dstu2016may.model.Narrative.NarrativeStatus.EMPTY; + default: return org.hl7.fhir.dstu2016may.model.Narrative.NarrativeStatus.NULL; + } + } + + public static org.hl7.fhir.r5.model.Age convertAge(org.hl7.fhir.dstu2016may.model.Age src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Age tgt = new org.hl7.fhir.r5.model.Age(); + copyElement(src, tgt); + if (src.hasValue()) + tgt.setValue(src.getValue()); + tgt.setComparator(convertQuantityComparator(src.getComparator())); + if (src.hasUnit()) + tgt.setUnit(src.getUnit()); + if (src.hasSystem()) + tgt.setSystem(src.getSystem()); + if (src.hasCode()) + tgt.setCode(src.getCode()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Age convertAge(org.hl7.fhir.r5.model.Age src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Age tgt = new org.hl7.fhir.dstu2016may.model.Age(); + copyElement(src, tgt); + if (src.hasValue()) + tgt.setValue(src.getValue()); + tgt.setComparator(convertQuantityComparator(src.getComparator())); + if (src.hasUnit()) + tgt.setUnit(src.getUnit()); + if (src.hasSystem()) + tgt.setSystem(src.getSystem()); + if (src.hasCode()) + tgt.setCode(src.getCode()); + return tgt; + } + + + public static org.hl7.fhir.r5.model.Annotation convertAnnotation(org.hl7.fhir.dstu2016may.model.Annotation src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Annotation tgt = new org.hl7.fhir.r5.model.Annotation(); + copyElement(src, tgt); + tgt.setAuthor(convertType(src.getAuthor())); + if (src.hasTime()) + tgt.setTime(src.getTime()); + tgt.setText(src.getText()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Annotation convertAnnotation(org.hl7.fhir.r5.model.Annotation src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Annotation tgt = new org.hl7.fhir.dstu2016may.model.Annotation(); + copyElement(src, tgt); + tgt.setAuthor(convertType(src.getAuthor())); + if (src.hasTime()) + tgt.setTime(src.getTime()); + tgt.setText(src.getText()); + return tgt; + } + + public static org.hl7.fhir.r5.model.Attachment convertAttachment(org.hl7.fhir.dstu2016may.model.Attachment src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Attachment tgt = new org.hl7.fhir.r5.model.Attachment(); + copyElement(src, tgt); + if (src.hasContentType()) + tgt.setContentType(src.getContentType()); + if (src.hasLanguage()) + tgt.setLanguage(src.getLanguage()); + if (src.hasData()) + tgt.setData(src.getData()); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + if (src.hasSize()) + tgt.setSize(src.getSize()); + if (src.hasHash()) + tgt.setHash(src.getHash()); + if (src.hasTitle()) + tgt.setTitle(src.getTitle()); + if (src.hasCreation()) + tgt.setCreation(src.getCreation()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Attachment convertAttachment(org.hl7.fhir.r5.model.Attachment src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Attachment tgt = new org.hl7.fhir.dstu2016may.model.Attachment(); + copyElement(src, tgt); + if (src.hasContentType()) + tgt.setContentType(src.getContentType()); + if (src.hasLanguage()) + tgt.setLanguage(src.getLanguage()); + if (src.hasData()) + tgt.setData(src.getData()); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + if (src.hasSize()) + tgt.setSize(src.getSize()); + if (src.hasHash()) + tgt.setHash(src.getHash()); + if (src.hasTitle()) + tgt.setTitle(src.getTitle()); + if (src.hasCreation()) + tgt.setCreation(src.getCreation()); + return tgt; + } + + public static org.hl7.fhir.r5.model.CodeableConcept convertCodeableConcept(org.hl7.fhir.dstu2016may.model.CodeableConcept src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.CodeableConcept tgt = new org.hl7.fhir.r5.model.CodeableConcept(); + copyElement(src, tgt); + for (org.hl7.fhir.dstu2016may.model.Coding t : src.getCoding()) + tgt.addCoding(convertCoding(t)); + if (src.hasText()) + tgt.setText(src.getText()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.CodeableConcept convertCodeableConcept(org.hl7.fhir.r5.model.CodeableConcept src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.CodeableConcept tgt = new org.hl7.fhir.dstu2016may.model.CodeableConcept(); + copyElement(src, tgt); + for (org.hl7.fhir.r5.model.Coding t : src.getCoding()) + tgt.addCoding(convertCoding(t)); + if (src.hasText()) + tgt.setText(src.getText()); + return tgt; + } + + public static org.hl7.fhir.r5.model.Coding convertCoding(org.hl7.fhir.dstu2016may.model.Coding src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Coding tgt = new org.hl7.fhir.r5.model.Coding(); + copyElement(src, tgt); + if (src.hasSystem()) + tgt.setSystem(src.getSystem()); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasCode()) + tgt.setCode(src.getCode()); + if (src.hasDisplay()) + tgt.setDisplay(src.getDisplay()); + if (src.hasUserSelected()) + tgt.setUserSelected(src.getUserSelected()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Coding convertCoding(org.hl7.fhir.r5.model.Coding src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Coding tgt = new org.hl7.fhir.dstu2016may.model.Coding(); + copyElement(src, tgt); + if (src.hasSystem()) + tgt.setSystem(src.getSystem()); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasCode()) + tgt.setCode(src.getCode()); + if (src.hasDisplay()) + tgt.setDisplay(src.getDisplay()); + if (src.hasUserSelected()) + tgt.setUserSelected(src.getUserSelected()); + return tgt; + } + + public static org.hl7.fhir.r5.model.Count convertCount(org.hl7.fhir.dstu2016may.model.Count src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Count tgt = new org.hl7.fhir.r5.model.Count(); + copyElement(src, tgt); + if (src.hasValue()) + tgt.setValue(src.getValue()); + tgt.setComparator(convertQuantityComparator(src.getComparator())); + if (src.hasUnit()) + tgt.setUnit(src.getUnit()); + if (src.hasSystem()) + tgt.setSystem(src.getSystem()); + if (src.hasCode()) + tgt.setCode(src.getCode()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Count convertCount(org.hl7.fhir.r5.model.Count src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Count tgt = new org.hl7.fhir.dstu2016may.model.Count(); + copyElement(src, tgt); + if (src.hasValue()) + tgt.setValue(src.getValue()); + tgt.setComparator(convertQuantityComparator(src.getComparator())); + if (src.hasUnit()) + tgt.setUnit(src.getUnit()); + if (src.hasSystem()) + tgt.setSystem(src.getSystem()); + if (src.hasCode()) + tgt.setCode(src.getCode()); + return tgt; + } + + public static org.hl7.fhir.r5.model.Distance convertDistance(org.hl7.fhir.dstu2016may.model.Distance src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Distance tgt = new org.hl7.fhir.r5.model.Distance(); + copyElement(src, tgt); + if (src.hasValue()) + tgt.setValue(src.getValue()); + tgt.setComparator(convertQuantityComparator(src.getComparator())); + if (src.hasUnit()) + tgt.setUnit(src.getUnit()); + if (src.hasSystem()) + tgt.setSystem(src.getSystem()); + if (src.hasCode()) + tgt.setCode(src.getCode()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Distance convertDistance(org.hl7.fhir.r5.model.Distance src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Distance tgt = new org.hl7.fhir.dstu2016may.model.Distance(); + copyElement(src, tgt); + if (src.hasValue()) + tgt.setValue(src.getValue()); + tgt.setComparator(convertQuantityComparator(src.getComparator())); + if (src.hasUnit()) + tgt.setUnit(src.getUnit()); + if (src.hasSystem()) + tgt.setSystem(src.getSystem()); + if (src.hasCode()) + tgt.setCode(src.getCode()); + return tgt; + } + + public static org.hl7.fhir.r5.model.Duration convertDuration(org.hl7.fhir.dstu2016may.model.Duration src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Duration tgt = new org.hl7.fhir.r5.model.Duration(); + copyElement(src, tgt); + if (src.hasValue()) + tgt.setValue(src.getValue()); + tgt.setComparator(convertQuantityComparator(src.getComparator())); + if (src.hasUnit()) + tgt.setUnit(src.getUnit()); + if (src.hasSystem()) + tgt.setSystem(src.getSystem()); + if (src.hasCode()) + tgt.setCode(src.getCode()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Duration convertDuration(org.hl7.fhir.r5.model.Duration src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Duration tgt = new org.hl7.fhir.dstu2016may.model.Duration(); + copyElement(src, tgt); + if (src.hasValue()) + tgt.setValue(src.getValue()); + tgt.setComparator(convertQuantityComparator(src.getComparator())); + if (src.hasUnit()) + tgt.setUnit(src.getUnit()); + if (src.hasSystem()) + tgt.setSystem(src.getSystem()); + if (src.hasCode()) + tgt.setCode(src.getCode()); + return tgt; + } + + public static org.hl7.fhir.r5.model.Money convertMoney(org.hl7.fhir.dstu2016may.model.Money src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Money tgt = new org.hl7.fhir.r5.model.Money(); + copyElement(src, tgt); + if (src.hasValue()) + tgt.setValue(src.getValue()); + if (src.hasCode()) + tgt.setCurrency(src.getCode()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Money convertMoney(org.hl7.fhir.r5.model.Money src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Money tgt = new org.hl7.fhir.dstu2016may.model.Money(); + copyElement(src, tgt); + if (src.hasValue()) + tgt.setValue(src.getValue()); + if (src.hasCurrency()) + tgt.setCode(src.getCurrency()); + return tgt; + } + + public static org.hl7.fhir.r5.model.Identifier convertIdentifier(org.hl7.fhir.dstu2016may.model.Identifier src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Identifier tgt = new org.hl7.fhir.r5.model.Identifier(); + copyElement(src, tgt); + tgt.setUse(convertIdentifierUse(src.getUse())); + tgt.setType(convertCodeableConcept(src.getType())); + if (src.hasSystem()) + tgt.setSystem(src.getSystem()); + if (src.hasValue()) + tgt.setValue(src.getValue()); + tgt.setPeriod(convertPeriod(src.getPeriod())); + tgt.setAssigner(convertReference(src.getAssigner())); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Identifier convertIdentifier(org.hl7.fhir.r5.model.Identifier src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Identifier tgt = new org.hl7.fhir.dstu2016may.model.Identifier(); + copyElement(src, tgt); + tgt.setUse(convertIdentifierUse(src.getUse())); + tgt.setType(convertCodeableConcept(src.getType())); + if (src.hasSystem()) + tgt.setSystem(src.getSystem()); + if (src.hasValue()) + tgt.setValue(src.getValue()); + tgt.setPeriod(convertPeriod(src.getPeriod())); + tgt.setAssigner(convertReference(src.getAssigner())); + return tgt; + } + + private static org.hl7.fhir.r5.model.Identifier.IdentifierUse convertIdentifierUse(org.hl7.fhir.dstu2016may.model.Identifier.IdentifierUse src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case USUAL: return org.hl7.fhir.r5.model.Identifier.IdentifierUse.USUAL; + case OFFICIAL: return org.hl7.fhir.r5.model.Identifier.IdentifierUse.OFFICIAL; + case TEMP: return org.hl7.fhir.r5.model.Identifier.IdentifierUse.TEMP; + case SECONDARY: return org.hl7.fhir.r5.model.Identifier.IdentifierUse.SECONDARY; + default: return org.hl7.fhir.r5.model.Identifier.IdentifierUse.NULL; + } + } + + private static org.hl7.fhir.dstu2016may.model.Identifier.IdentifierUse convertIdentifierUse(org.hl7.fhir.r5.model.Identifier.IdentifierUse src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case USUAL: return org.hl7.fhir.dstu2016may.model.Identifier.IdentifierUse.USUAL; + case OFFICIAL: return org.hl7.fhir.dstu2016may.model.Identifier.IdentifierUse.OFFICIAL; + case TEMP: return org.hl7.fhir.dstu2016may.model.Identifier.IdentifierUse.TEMP; + case SECONDARY: return org.hl7.fhir.dstu2016may.model.Identifier.IdentifierUse.SECONDARY; + default: return org.hl7.fhir.dstu2016may.model.Identifier.IdentifierUse.NULL; + } + } + + + public static org.hl7.fhir.r5.model.Period convertPeriod(org.hl7.fhir.dstu2016may.model.Period src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Period tgt = new org.hl7.fhir.r5.model.Period(); + copyElement(src, tgt); + if (src.hasStart()) + tgt.setStart(src.getStart()); + if (src.hasEnd()) + tgt.setEnd(src.getEnd()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Period convertPeriod(org.hl7.fhir.r5.model.Period src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Period tgt = new org.hl7.fhir.dstu2016may.model.Period(); + copyElement(src, tgt); + if (src.hasStart()) + tgt.setStart(src.getStart()); + if (src.hasEnd()) + tgt.setEnd(src.getEnd()); + return tgt; + } + + public static org.hl7.fhir.r5.model.Quantity convertQuantity(org.hl7.fhir.dstu2016may.model.Quantity src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Quantity tgt = new org.hl7.fhir.r5.model.Quantity(); + copyElement(src, tgt); + if (src.hasValue()) + tgt.setValue(src.getValue()); + tgt.setComparator(convertQuantityComparator(src.getComparator())); + if (src.hasUnit()) + tgt.setUnit(src.getUnit()); + if (src.hasSystem()) + tgt.setSystem(src.getSystem()); + if (src.hasCode()) + tgt.setCode(src.getCode()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Quantity convertQuantity(org.hl7.fhir.r5.model.Quantity src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Quantity tgt = new org.hl7.fhir.dstu2016may.model.Quantity(); + copyElement(src, tgt); + if (src.hasValue()) + tgt.setValue(src.getValue()); + tgt.setComparator(convertQuantityComparator(src.getComparator())); + if (src.hasUnit()) + tgt.setUnit(src.getUnit()); + if (src.hasSystem()) + tgt.setSystem(src.getSystem()); + if (src.hasCode()) + tgt.setCode(src.getCode()); + return tgt; + } + + private static org.hl7.fhir.r5.model.Quantity.QuantityComparator convertQuantityComparator(org.hl7.fhir.dstu2016may.model.Quantity.QuantityComparator src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case LESS_THAN: return org.hl7.fhir.r5.model.Quantity.QuantityComparator.LESS_THAN; + case LESS_OR_EQUAL: return org.hl7.fhir.r5.model.Quantity.QuantityComparator.LESS_OR_EQUAL; + case GREATER_OR_EQUAL: return org.hl7.fhir.r5.model.Quantity.QuantityComparator.GREATER_OR_EQUAL; + case GREATER_THAN: return org.hl7.fhir.r5.model.Quantity.QuantityComparator.GREATER_THAN; + default: return org.hl7.fhir.r5.model.Quantity.QuantityComparator.NULL; + } + } + + private static org.hl7.fhir.dstu2016may.model.Quantity.QuantityComparator convertQuantityComparator(org.hl7.fhir.r5.model.Quantity.QuantityComparator src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case LESS_THAN: return org.hl7.fhir.dstu2016may.model.Quantity.QuantityComparator.LESS_THAN; + case LESS_OR_EQUAL: return org.hl7.fhir.dstu2016may.model.Quantity.QuantityComparator.LESS_OR_EQUAL; + case GREATER_OR_EQUAL: return org.hl7.fhir.dstu2016may.model.Quantity.QuantityComparator.GREATER_OR_EQUAL; + case GREATER_THAN: return org.hl7.fhir.dstu2016may.model.Quantity.QuantityComparator.GREATER_THAN; + default: return org.hl7.fhir.dstu2016may.model.Quantity.QuantityComparator.NULL; + } + } + + public static org.hl7.fhir.r5.model.Range convertRange(org.hl7.fhir.dstu2016may.model.Range src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Range tgt = new org.hl7.fhir.r5.model.Range(); + copyElement(src, tgt); + tgt.setLow(convertSimpleQuantity(src.getLow())); + tgt.setHigh(convertSimpleQuantity(src.getHigh())); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Range convertRange(org.hl7.fhir.r5.model.Range src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Range tgt = new org.hl7.fhir.dstu2016may.model.Range(); + copyElement(src, tgt); + tgt.setLow(convertSimpleQuantity(src.getLow())); + tgt.setHigh(convertSimpleQuantity(src.getHigh())); + return tgt; + } + + public static org.hl7.fhir.r5.model.Ratio convertRatio(org.hl7.fhir.dstu2016may.model.Ratio src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Ratio tgt = new org.hl7.fhir.r5.model.Ratio(); + copyElement(src, tgt); + tgt.setNumerator(convertQuantity(src.getNumerator())); + tgt.setDenominator(convertQuantity(src.getDenominator())); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Ratio convertRatio(org.hl7.fhir.r5.model.Ratio src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Ratio tgt = new org.hl7.fhir.dstu2016may.model.Ratio(); + copyElement(src, tgt); + tgt.setNumerator(convertQuantity(src.getNumerator())); + tgt.setDenominator(convertQuantity(src.getDenominator())); + return tgt; + } + + public static org.hl7.fhir.r5.model.Reference convertReference(org.hl7.fhir.dstu2016may.model.Reference src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Reference tgt = new org.hl7.fhir.r5.model.Reference(); + copyElement(src, tgt); + if (src.hasReference()) + tgt.setReference(src.getReference()); + if (src.hasDisplay()) + tgt.setDisplay(src.getDisplay()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Reference convertReference(org.hl7.fhir.r5.model.Reference src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Reference tgt = new org.hl7.fhir.dstu2016may.model.Reference(); + copyElement(src, tgt); + if (src.hasReference()) + tgt.setReference(src.getReference()); + if (src.hasDisplay()) + tgt.setDisplay(src.getDisplay()); + return tgt; + } + + public static org.hl7.fhir.r5.model.SampledData convertSampledData(org.hl7.fhir.dstu2016may.model.SampledData src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.SampledData tgt = new org.hl7.fhir.r5.model.SampledData(); + copyElement(src, tgt); + tgt.setOrigin(convertSimpleQuantity(src.getOrigin())); + tgt.setPeriod(src.getPeriod()); + if (src.hasFactor()) + tgt.setFactor(src.getFactor()); + if (src.hasLowerLimit()) + tgt.setLowerLimit(src.getLowerLimit()); + if (src.hasUpperLimit()) + tgt.setUpperLimit(src.getUpperLimit()); + tgt.setDimensions(src.getDimensions()); + tgt.setData(src.getData()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.SampledData convertSampledData(org.hl7.fhir.r5.model.SampledData src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.SampledData tgt = new org.hl7.fhir.dstu2016may.model.SampledData(); + copyElement(src, tgt); + tgt.setOrigin(convertSimpleQuantity(src.getOrigin())); + tgt.setPeriod(src.getPeriod()); + if (src.hasFactor()) + tgt.setFactor(src.getFactor()); + if (src.hasLowerLimit()) + tgt.setLowerLimit(src.getLowerLimit()); + if (src.hasUpperLimit()) + tgt.setUpperLimit(src.getUpperLimit()); + tgt.setDimensions(src.getDimensions()); + tgt.setData(src.getData()); + return tgt; + } + + public static org.hl7.fhir.r5.model.Signature convertSignature(org.hl7.fhir.dstu2016may.model.Signature src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Signature tgt = new org.hl7.fhir.r5.model.Signature(); + copyElement(src, tgt); + for (org.hl7.fhir.dstu2016may.model.Coding t : src.getType()) + tgt.addType(convertCoding(t)); + tgt.setWhen(src.getWhen()); + if (src.hasWhoUriType()) + tgt.setWho(new org.hl7.fhir.r5.model.Reference(src.getWhoUriType().getValue())); + else + tgt.setWho(convertReference(src.getWhoReference())); + if (src.hasContentType()) + tgt.setSigFormat(src.getContentType()); + if (src.hasBlob()) + tgt.setData(src.getBlob()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Signature convertSignature(org.hl7.fhir.r5.model.Signature src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Signature tgt = new org.hl7.fhir.dstu2016may.model.Signature(); + copyElement(src, tgt); + for (org.hl7.fhir.r5.model.Coding t : src.getType()) + tgt.addType(convertCoding(t)); + tgt.setWhen(src.getWhen()); + tgt.setWho(convertType(src.getWho())); + if (src.hasSigFormat()) + tgt.setContentType(src.getSigFormat()); + if (src.hasData()) + tgt.setBlob(src.getData()); + return tgt; + } + + public static org.hl7.fhir.r5.model.Address convertAddress(org.hl7.fhir.dstu2016may.model.Address src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Address tgt = new org.hl7.fhir.r5.model.Address(); + copyElement(src, tgt); + tgt.setUse(convertAddressUse(src.getUse())); + tgt.setType(convertAddressType(src.getType())); + if (src.hasText()) + tgt.setText(src.getText()); + for (org.hl7.fhir.dstu2016may.model.StringType t : src.getLine()) + tgt.addLine(t.getValue()); + if (src.hasCity()) + tgt.setCity(src.getCity()); + if (src.hasDistrict()) + tgt.setDistrict(src.getDistrict()); + if (src.hasState()) + tgt.setState(src.getState()); + if (src.hasPostalCode()) + tgt.setPostalCode(src.getPostalCode()); + if (src.hasCountry()) + tgt.setCountry(src.getCountry()); + tgt.setPeriod(convertPeriod(src.getPeriod())); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Address convertAddress(org.hl7.fhir.r5.model.Address src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Address tgt = new org.hl7.fhir.dstu2016may.model.Address(); + copyElement(src, tgt); + tgt.setUse(convertAddressUse(src.getUse())); + tgt.setType(convertAddressType(src.getType())); + if (src.hasText()) + tgt.setText(src.getText()); + for (org.hl7.fhir.r5.model.StringType t : src.getLine()) + tgt.addLine(t.getValue()); + if (src.hasCity()) + tgt.setCity(src.getCity()); + if (src.hasDistrict()) + tgt.setDistrict(src.getDistrict()); + if (src.hasState()) + tgt.setState(src.getState()); + if (src.hasPostalCode()) + tgt.setPostalCode(src.getPostalCode()); + if (src.hasCountry()) + tgt.setCountry(src.getCountry()); + tgt.setPeriod(convertPeriod(src.getPeriod())); + return tgt; + } + + private static org.hl7.fhir.r5.model.Address.AddressUse convertAddressUse(org.hl7.fhir.dstu2016may.model.Address.AddressUse src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case HOME: return org.hl7.fhir.r5.model.Address.AddressUse.HOME; + case WORK: return org.hl7.fhir.r5.model.Address.AddressUse.WORK; + case TEMP: return org.hl7.fhir.r5.model.Address.AddressUse.TEMP; + case OLD: return org.hl7.fhir.r5.model.Address.AddressUse.OLD; + default: return org.hl7.fhir.r5.model.Address.AddressUse.NULL; + } + } + + private static org.hl7.fhir.dstu2016may.model.Address.AddressUse convertAddressUse(org.hl7.fhir.r5.model.Address.AddressUse src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case HOME: return org.hl7.fhir.dstu2016may.model.Address.AddressUse.HOME; + case WORK: return org.hl7.fhir.dstu2016may.model.Address.AddressUse.WORK; + case TEMP: return org.hl7.fhir.dstu2016may.model.Address.AddressUse.TEMP; + case OLD: return org.hl7.fhir.dstu2016may.model.Address.AddressUse.OLD; + default: return org.hl7.fhir.dstu2016may.model.Address.AddressUse.NULL; + } + } + + private static org.hl7.fhir.r5.model.Address.AddressType convertAddressType(org.hl7.fhir.dstu2016may.model.Address.AddressType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case POSTAL: return org.hl7.fhir.r5.model.Address.AddressType.POSTAL; + case PHYSICAL: return org.hl7.fhir.r5.model.Address.AddressType.PHYSICAL; + case BOTH: return org.hl7.fhir.r5.model.Address.AddressType.BOTH; + default: return org.hl7.fhir.r5.model.Address.AddressType.NULL; + } + } + + private static org.hl7.fhir.dstu2016may.model.Address.AddressType convertAddressType(org.hl7.fhir.r5.model.Address.AddressType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case POSTAL: return org.hl7.fhir.dstu2016may.model.Address.AddressType.POSTAL; + case PHYSICAL: return org.hl7.fhir.dstu2016may.model.Address.AddressType.PHYSICAL; + case BOTH: return org.hl7.fhir.dstu2016may.model.Address.AddressType.BOTH; + default: return org.hl7.fhir.dstu2016may.model.Address.AddressType.NULL; + } + } + + public static org.hl7.fhir.r5.model.ContactPoint convertContactPoint(org.hl7.fhir.dstu2016may.model.ContactPoint src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.ContactPoint tgt = new org.hl7.fhir.r5.model.ContactPoint(); + copyElement(src, tgt); + tgt.setSystem(convertContactPointSystem(src.getSystem())); + if (src.hasValue()) + tgt.setValue(src.getValue()); + tgt.setUse(convertContactPointUse(src.getUse())); + if (src.hasRank()) + tgt.setRank(src.getRank()); + tgt.setPeriod(convertPeriod(src.getPeriod())); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.ContactPoint convertContactPoint(org.hl7.fhir.r5.model.ContactPoint src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.ContactPoint tgt = new org.hl7.fhir.dstu2016may.model.ContactPoint(); + copyElement(src, tgt); + tgt.setSystem(convertContactPointSystem(src.getSystem())); + if (src.hasValue()) + tgt.setValue(src.getValue()); + tgt.setUse(convertContactPointUse(src.getUse())); + if (src.hasRank()) + tgt.setRank(src.getRank()); + tgt.setPeriod(convertPeriod(src.getPeriod())); + return tgt; + } + + private static org.hl7.fhir.r5.model.ContactPoint.ContactPointSystem convertContactPointSystem(org.hl7.fhir.dstu2016may.model.ContactPoint.ContactPointSystem src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PHONE: return org.hl7.fhir.r5.model.ContactPoint.ContactPointSystem.PHONE; + case FAX: return org.hl7.fhir.r5.model.ContactPoint.ContactPointSystem.FAX; + case EMAIL: return org.hl7.fhir.r5.model.ContactPoint.ContactPointSystem.EMAIL; + case PAGER: return org.hl7.fhir.r5.model.ContactPoint.ContactPointSystem.PAGER; + case OTHER: return org.hl7.fhir.r5.model.ContactPoint.ContactPointSystem.URL; + default: return org.hl7.fhir.r5.model.ContactPoint.ContactPointSystem.NULL; + } + } + + private static org.hl7.fhir.dstu2016may.model.ContactPoint.ContactPointSystem convertContactPointSystem(org.hl7.fhir.r5.model.ContactPoint.ContactPointSystem src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PHONE: return org.hl7.fhir.dstu2016may.model.ContactPoint.ContactPointSystem.PHONE; + case FAX: return org.hl7.fhir.dstu2016may.model.ContactPoint.ContactPointSystem.FAX; + case EMAIL: return org.hl7.fhir.dstu2016may.model.ContactPoint.ContactPointSystem.EMAIL; + case PAGER: return org.hl7.fhir.dstu2016may.model.ContactPoint.ContactPointSystem.PAGER; + case URL: return org.hl7.fhir.dstu2016may.model.ContactPoint.ContactPointSystem.OTHER; + default: return org.hl7.fhir.dstu2016may.model.ContactPoint.ContactPointSystem.NULL; + } + } + + private static org.hl7.fhir.r5.model.ContactPoint.ContactPointUse convertContactPointUse(org.hl7.fhir.dstu2016may.model.ContactPoint.ContactPointUse src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case HOME: return org.hl7.fhir.r5.model.ContactPoint.ContactPointUse.HOME; + case WORK: return org.hl7.fhir.r5.model.ContactPoint.ContactPointUse.WORK; + case TEMP: return org.hl7.fhir.r5.model.ContactPoint.ContactPointUse.TEMP; + case OLD: return org.hl7.fhir.r5.model.ContactPoint.ContactPointUse.OLD; + case MOBILE: return org.hl7.fhir.r5.model.ContactPoint.ContactPointUse.MOBILE; + default: return org.hl7.fhir.r5.model.ContactPoint.ContactPointUse.NULL; + } + } + + private static org.hl7.fhir.dstu2016may.model.ContactPoint.ContactPointUse convertContactPointUse(org.hl7.fhir.r5.model.ContactPoint.ContactPointUse src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case HOME: return org.hl7.fhir.dstu2016may.model.ContactPoint.ContactPointUse.HOME; + case WORK: return org.hl7.fhir.dstu2016may.model.ContactPoint.ContactPointUse.WORK; + case TEMP: return org.hl7.fhir.dstu2016may.model.ContactPoint.ContactPointUse.TEMP; + case OLD: return org.hl7.fhir.dstu2016may.model.ContactPoint.ContactPointUse.OLD; + case MOBILE: return org.hl7.fhir.dstu2016may.model.ContactPoint.ContactPointUse.MOBILE; + default: return org.hl7.fhir.dstu2016may.model.ContactPoint.ContactPointUse.NULL; + } + } + + public static org.hl7.fhir.r5.model.ElementDefinition convertElementDefinition(org.hl7.fhir.dstu2016may.model.ElementDefinition src, List context, int pos) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.ElementDefinition tgt = new org.hl7.fhir.r5.model.ElementDefinition(); + copyElement(src, tgt); + tgt.setPath(src.getPath()); + for (org.hl7.fhir.dstu2016may.model.Enumeration t : src.getRepresentation()) + tgt.addRepresentation(convertPropertyRepresentation(t.getValue())); + if (src.hasName()) + tgt.setSliceName(src.getName()); + if (src.hasLabel()) + tgt.setLabel(src.getLabel()); + for (org.hl7.fhir.dstu2016may.model.Coding t : src.getCode()) + tgt.addCode(convertCoding(t)); + tgt.setSlicing(convertElementDefinitionSlicingComponent(src.getSlicing(), context, pos)); + if (src.hasShort()) + tgt.setShort(src.getShort()); + if (src.hasDefinition()) + tgt.setDefinition(src.getDefinition()); + if (src.hasComments()) + tgt.setComment(src.getComments()); + if (src.hasRequirements()) + tgt.setRequirements(src.getRequirements()); + for (org.hl7.fhir.dstu2016may.model.StringType t : src.getAlias()) + tgt.addAlias(t.getValue()); + if (src.hasMin()) + tgt.setMin(src.getMin()); + if (src.hasMax()) + tgt.setMax(src.getMax()); + tgt.setBase(convertElementDefinitionBaseComponent(src.getBase())); + if (src.hasContentReference()) + tgt.setContentReference(src.getContentReference()); + for (org.hl7.fhir.dstu2016may.model.ElementDefinition.TypeRefComponent t : src.getType()) + convertTypeRefComponent(t, tgt.getType()); + tgt.setDefaultValue(convertType(src.getDefaultValue())); + if (src.hasMeaningWhenMissing()) + tgt.setMeaningWhenMissing(src.getMeaningWhenMissing()); + tgt.setFixed(convertType(src.getFixed())); + tgt.setPattern(convertType(src.getPattern())); + if (src.hasExample()) + tgt.addExample().setLabel("General").setValue(convertType(src.getExample())); + tgt.setMinValue(convertType(src.getMinValue())); + tgt.setMaxValue(convertType(src.getMaxValue())); + if (src.hasMaxLength()) + tgt.setMaxLength(src.getMaxLength()); + for (org.hl7.fhir.dstu2016may.model.IdType t : src.getCondition()) + tgt.addCondition(t.getValue()); + for (org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionConstraintComponent t : src.getConstraint()) + tgt.addConstraint(convertElementDefinitionConstraintComponent(t)); + if (src.hasMustSupport()) + tgt.setMustSupport(src.getMustSupport()); + if (src.hasIsModifier()) + tgt.setIsModifier(src.getIsModifier()); + if (tgt.getIsModifier()) { + String reason = org.hl7.fhir.dstu2016may.utils.ToolingExtensions.readStringExtension(src, VersionConvertorConstants.MODIFIER_REASON_EXTENSION); + if (Utilities.noString(reason)) + reason = VersionConvertorConstants.MODIFIER_REASON_LEGACY; + tgt.setIsModifierReason(reason); + } + if (src.hasIsSummary()) + tgt.setIsSummary(src.getIsSummary()); + tgt.setBinding(convertElementDefinitionBindingComponent(src.getBinding())); + for (org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionMappingComponent t : src.getMapping()) + tgt.addMapping(convertElementDefinitionMappingComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.ElementDefinition convertElementDefinition(org.hl7.fhir.r5.model.ElementDefinition src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.ElementDefinition tgt = new org.hl7.fhir.dstu2016may.model.ElementDefinition(); + copyElement(src, tgt); + tgt.setPath(src.getPath()); + for (org.hl7.fhir.r5.model.Enumeration t : src.getRepresentation()) + tgt.addRepresentation(convertPropertyRepresentation(t.getValue())); + if (src.hasSliceName()) + tgt.setName(src.getSliceName()); + if (src.hasLabel()) + tgt.setLabel(src.getLabel()); + for (org.hl7.fhir.r5.model.Coding t : src.getCode()) + tgt.addCode(convertCoding(t)); + if (src.hasSlicing()) + tgt.setSlicing(convertElementDefinitionSlicingComponent(src.getSlicing())); + if (src.hasShort()) + tgt.setShort(src.getShort()); + if (src.hasDefinition()) + tgt.setDefinition(src.getDefinition()); + if (src.hasComment()) + tgt.setComments(src.getComment()); + if (src.hasRequirements()) + tgt.setRequirements(src.getRequirements()); + for (org.hl7.fhir.r5.model.StringType t : src.getAlias()) + tgt.addAlias(t.getValue()); + if (src.hasMin()) + tgt.setMin(src.getMin()); + if (src.hasMax()) + tgt.setMax(src.getMax()); + if (src.hasBase()) + tgt.setBase(convertElementDefinitionBaseComponent(src.getBase())); + if (src.hasContentReference()) + tgt.setContentReference(src.getContentReference()); + for (org.hl7.fhir.r5.model.ElementDefinition.TypeRefComponent t : src.getType()) + convertTypeRefComponent(t, tgt.getType()); + tgt.setDefaultValue(convertType(src.getDefaultValue())); + if (src.hasMeaningWhenMissing()) + tgt.setMeaningWhenMissing(src.getMeaningWhenMissing()); + tgt.setFixed(convertType(src.getFixed())); + tgt.setPattern(convertType(src.getPattern())); + if (src.hasExample()) + tgt.setExample(convertType(src.getExample().get(0).getValue())); + tgt.setMinValue(convertType(src.getMinValue())); + tgt.setMaxValue(convertType(src.getMaxValue())); + if (src.hasMaxLength()) + tgt.setMaxLength(src.getMaxLength()); + for (org.hl7.fhir.r5.model.IdType t : src.getCondition()) + tgt.addCondition(t.getValue()); + for (org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionConstraintComponent t : src.getConstraint()) + tgt.addConstraint(convertElementDefinitionConstraintComponent(t)); + if (src.hasMustSupport()) + tgt.setMustSupport(src.getMustSupport()); + if (src.hasIsModifier()) + tgt.setIsModifier(src.getIsModifier()); + if (src.hasIsModifierReason() && !VersionConvertorConstants.MODIFIER_REASON_LEGACY.equals(src.getIsModifierReason())) + org.hl7.fhir.dstu2016may.utils.ToolingExtensions.setStringExtension(tgt, VersionConvertorConstants.MODIFIER_REASON_EXTENSION, src.getIsModifierReason()); + if (src.hasIsSummary()) + tgt.setIsSummary(src.getIsSummary()); + if (src.hasBinding()) + tgt.setBinding(convertElementDefinitionBindingComponent(src.getBinding())); + for (org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionMappingComponent t : src.getMapping()) + tgt.addMapping(convertElementDefinitionMappingComponent(t)); + return tgt; + } + + private static org.hl7.fhir.r5.model.ElementDefinition.PropertyRepresentation convertPropertyRepresentation(org.hl7.fhir.dstu2016may.model.ElementDefinition.PropertyRepresentation src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case XMLATTR: return org.hl7.fhir.r5.model.ElementDefinition.PropertyRepresentation.XMLATTR; + case XMLTEXT: return org.hl7.fhir.r5.model.ElementDefinition.PropertyRepresentation.XMLTEXT; + case TYPEATTR: return org.hl7.fhir.r5.model.ElementDefinition.PropertyRepresentation.TYPEATTR; + case CDATEXT: return org.hl7.fhir.r5.model.ElementDefinition.PropertyRepresentation.CDATEXT; + default: return org.hl7.fhir.r5.model.ElementDefinition.PropertyRepresentation.NULL; + } + } + + private static org.hl7.fhir.dstu2016may.model.ElementDefinition.PropertyRepresentation convertPropertyRepresentation(org.hl7.fhir.r5.model.ElementDefinition.PropertyRepresentation src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case XMLATTR: return org.hl7.fhir.dstu2016may.model.ElementDefinition.PropertyRepresentation.XMLATTR; + case XMLTEXT: return org.hl7.fhir.dstu2016may.model.ElementDefinition.PropertyRepresentation.XMLTEXT; + case TYPEATTR: return org.hl7.fhir.dstu2016may.model.ElementDefinition.PropertyRepresentation.TYPEATTR; + case CDATEXT: return org.hl7.fhir.dstu2016may.model.ElementDefinition.PropertyRepresentation.CDATEXT; + default: return org.hl7.fhir.dstu2016may.model.ElementDefinition.PropertyRepresentation.NULL; + } + } + + public static org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionSlicingComponent convertElementDefinitionSlicingComponent(org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionSlicingComponent src, List context, int pos) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionSlicingComponent tgt = new org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionSlicingComponent(); + copyElement(src, tgt); + org.hl7.fhir.dstu2016may.model.ElementDefinition slicingElement = context.get(pos); + for (org.hl7.fhir.dstu2016may.model.StringType t : src.getDiscriminator()) { + boolean isExists = false; + if (!t.asStringValue().contains("@")) { + int slices = 0; + boolean existsSlicePresent = false; + boolean notExistsSlicePresent = false; + String existsPath = slicingElement.getPath() + "." + t.asStringValue(); + for (int i = pos + 1; i < context.size(); i++) { + org.hl7.fhir.dstu2016may.model.ElementDefinition e = context.get(i); + if (e.getPath().equals(slicingElement.getPath())) + slices++; + else if (!e.getPath().startsWith(slicingElement.getPath() + ".")) + break; + else if (e.getPath().equals(existsPath)) { + if (e.hasMin() && e.getMin() > 0 && !e.hasFixed()) + existsSlicePresent = true; + else if (e.hasMax() && e.getMax().equals("0")) + notExistsSlicePresent = true; + } + } + isExists = (slices==2 && existsSlicePresent && notExistsSlicePresent) || (slices==1 && existsSlicePresent!=notExistsSlicePresent); + } + tgt.addDiscriminator(ProfileUtilities.interpretR2Discriminator(t.getValue(), isExists)); + } + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + if (src.hasOrdered()) + tgt.setOrdered(src.getOrdered()); + tgt.setRules(convertSlicingRules(src.getRules())); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionSlicingComponent convertElementDefinitionSlicingComponent(org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionSlicingComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionSlicingComponent tgt = new org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionSlicingComponent(); + copyElement(src, tgt); + for (ElementDefinitionSlicingDiscriminatorComponent t : src.getDiscriminator()) + tgt.addDiscriminator(ProfileUtilities.buildR2Discriminator(t)); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + if (src.hasOrdered()) + tgt.setOrdered(src.getOrdered()); + tgt.setRules(convertSlicingRules(src.getRules())); + return tgt; + } + + private static org.hl7.fhir.r5.model.ElementDefinition.SlicingRules convertSlicingRules(org.hl7.fhir.dstu2016may.model.ElementDefinition.SlicingRules src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case CLOSED: return org.hl7.fhir.r5.model.ElementDefinition.SlicingRules.CLOSED; + case OPEN: return org.hl7.fhir.r5.model.ElementDefinition.SlicingRules.OPEN; + case OPENATEND: return org.hl7.fhir.r5.model.ElementDefinition.SlicingRules.OPENATEND; + default: return org.hl7.fhir.r5.model.ElementDefinition.SlicingRules.NULL; + } + } + + private static org.hl7.fhir.dstu2016may.model.ElementDefinition.SlicingRules convertSlicingRules(org.hl7.fhir.r5.model.ElementDefinition.SlicingRules src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case CLOSED: return org.hl7.fhir.dstu2016may.model.ElementDefinition.SlicingRules.CLOSED; + case OPEN: return org.hl7.fhir.dstu2016may.model.ElementDefinition.SlicingRules.OPEN; + case OPENATEND: return org.hl7.fhir.dstu2016may.model.ElementDefinition.SlicingRules.OPENATEND; + default: return org.hl7.fhir.dstu2016may.model.ElementDefinition.SlicingRules.NULL; + } + } + + public static org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionBaseComponent convertElementDefinitionBaseComponent(org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionBaseComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionBaseComponent tgt = new org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionBaseComponent(); + copyElement(src, tgt); + tgt.setPath(src.getPath()); + tgt.setMin(src.getMin()); + tgt.setMax(src.getMax()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionBaseComponent convertElementDefinitionBaseComponent(org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionBaseComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionBaseComponent tgt = new org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionBaseComponent(); + copyElement(src, tgt); + tgt.setPath(src.getPath()); + tgt.setMin(src.getMin()); + tgt.setMax(src.getMax()); + return tgt; + } + + static void convertTypeRefComponent(org.hl7.fhir.dstu2016may.model.ElementDefinition.TypeRefComponent src, List list) throws FHIRException { + if (src == null) + return ; + org.hl7.fhir.r5.model.ElementDefinition.TypeRefComponent tgt = null; + for (org.hl7.fhir.r5.model.ElementDefinition.TypeRefComponent t : list) + if (t.getCode().equals(src.getCode())) + tgt = t; + if (tgt == null) { + tgt = new org.hl7.fhir.r5.model.ElementDefinition.TypeRefComponent(); + list.add(tgt); + copyElement(src, tgt); + tgt.setCode(src.getCode()); + } + if (tgt.hasTarget()) { + for (org.hl7.fhir.dstu2016may.model.UriType u : src.getProfile()) + tgt.addTargetProfile(u.getValue()); + } else { + for (org.hl7.fhir.dstu2016may.model.UriType u : src.getProfile()) + tgt.addProfile(u.getValue()); + } + for (org.hl7.fhir.dstu2016may.model.Enumeration t : src.getAggregation()) { + org.hl7.fhir.r5.model.ElementDefinition.AggregationMode a = convertAggregationMode(t.getValue()); + if (!tgt.hasAggregation(a)) + tgt.addAggregation(a); + } + if (src.hasVersioning()) + tgt.setVersioning(convertReferenceVersionRules(src.getVersioning())); + } + + public static void convertTypeRefComponent(org.hl7.fhir.r5.model.ElementDefinition.TypeRefComponent src, List list) throws FHIRException { + if (src == null) + return; + org.hl7.fhir.dstu2016may.model.ElementDefinition.TypeRefComponent tgt = new org.hl7.fhir.dstu2016may.model.ElementDefinition.TypeRefComponent(); + copyElement(src, tgt); + tgt.setCode(src.getCode()); + list.add(tgt); + if (src.hasTarget()) { + for (org.hl7.fhir.r5.model.UriType u : src.getTargetProfile()) { + tgt.addProfile(u.getValue()); + } + } else { + for (org.hl7.fhir.r5.model.UriType u : src.getProfile()) { + tgt.addProfile(u.getValue()); + } + } + for (org.hl7.fhir.r5.model.Enumeration t : src.getAggregation()) { + org.hl7.fhir.dstu2016may.model.ElementDefinition.AggregationMode a = convertAggregationMode(t.getValue()); + if (!tgt.hasAggregation(a)) + tgt.addAggregation(a); + } + if (src.hasVersioning()) + tgt.setVersioning(convertReferenceVersionRules(src.getVersioning())); + } + + private static org.hl7.fhir.r5.model.ElementDefinition.AggregationMode convertAggregationMode(org.hl7.fhir.dstu2016may.model.ElementDefinition.AggregationMode src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case CONTAINED: return org.hl7.fhir.r5.model.ElementDefinition.AggregationMode.CONTAINED; + case REFERENCED: return org.hl7.fhir.r5.model.ElementDefinition.AggregationMode.REFERENCED; + case BUNDLED: return org.hl7.fhir.r5.model.ElementDefinition.AggregationMode.BUNDLED; + default: return org.hl7.fhir.r5.model.ElementDefinition.AggregationMode.NULL; + } + } + + private static org.hl7.fhir.dstu2016may.model.ElementDefinition.AggregationMode convertAggregationMode(org.hl7.fhir.r5.model.ElementDefinition.AggregationMode src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case CONTAINED: return org.hl7.fhir.dstu2016may.model.ElementDefinition.AggregationMode.CONTAINED; + case REFERENCED: return org.hl7.fhir.dstu2016may.model.ElementDefinition.AggregationMode.REFERENCED; + case BUNDLED: return org.hl7.fhir.dstu2016may.model.ElementDefinition.AggregationMode.BUNDLED; + default: return org.hl7.fhir.dstu2016may.model.ElementDefinition.AggregationMode.NULL; + } + } + + private static org.hl7.fhir.r5.model.ElementDefinition.ReferenceVersionRules convertReferenceVersionRules(org.hl7.fhir.dstu2016may.model.ElementDefinition.ReferenceVersionRules src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case EITHER: return org.hl7.fhir.r5.model.ElementDefinition.ReferenceVersionRules.EITHER; + case INDEPENDENT: return org.hl7.fhir.r5.model.ElementDefinition.ReferenceVersionRules.INDEPENDENT; + case SPECIFIC: return org.hl7.fhir.r5.model.ElementDefinition.ReferenceVersionRules.SPECIFIC; + default: return org.hl7.fhir.r5.model.ElementDefinition.ReferenceVersionRules.NULL; + } + } + + private static org.hl7.fhir.dstu2016may.model.ElementDefinition.ReferenceVersionRules convertReferenceVersionRules(org.hl7.fhir.r5.model.ElementDefinition.ReferenceVersionRules src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case EITHER: return org.hl7.fhir.dstu2016may.model.ElementDefinition.ReferenceVersionRules.EITHER; + case INDEPENDENT: return org.hl7.fhir.dstu2016may.model.ElementDefinition.ReferenceVersionRules.INDEPENDENT; + case SPECIFIC: return org.hl7.fhir.dstu2016may.model.ElementDefinition.ReferenceVersionRules.SPECIFIC; + default: return org.hl7.fhir.dstu2016may.model.ElementDefinition.ReferenceVersionRules.NULL; + } + } + + public static org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionConstraintComponent convertElementDefinitionConstraintComponent(org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionConstraintComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionConstraintComponent tgt = new org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionConstraintComponent(); + copyElement(src, tgt); + tgt.setKey(src.getKey()); + if (src.hasRequirements()) + tgt.setRequirements(src.getRequirements()); + tgt.setSeverity(convertConstraintSeverity(src.getSeverity())); + tgt.setHuman(src.getHuman()); + if (src.hasExpression()) + tgt.setExpression(convertToR4Expression(src.getExpression())); + tgt.setXpath(src.getXpath()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionConstraintComponent convertElementDefinitionConstraintComponent(org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionConstraintComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionConstraintComponent tgt = new org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionConstraintComponent(); + copyElement(src, tgt); + tgt.setKey(src.getKey()); + if (src.hasRequirements()) + tgt.setRequirements(src.getRequirements()); + tgt.setSeverity(convertConstraintSeverity(src.getSeverity())); + tgt.setHuman(src.getHuman()); + if (src.hasExpression()) + tgt.setExpression(convertTo2016MayExpression(src.getExpression())); + tgt.setXpath(src.getXpath()); + return tgt; + } + + public static String convertToR4Expression(String oldExpression) { + String pass1 = oldExpression.replaceAll("\\$context","%context").replaceAll("\\$resource", "%resource").replaceAll("code\\+profile", "code&profile").replaceAll("path\\+'\\.'", "path&'.'").replaceAll("fullUrl\\+resource", "fullUrl&resource"); + String pass2 = pass1; + if (pass1.endsWith(".distinct()")) + pass2 = pass1.substring(0, pass2.length() - 11) + ".isDistinct()"; + String pass3 = pass2; + if (pass2.endsWith(".empty() or (type.count() = 1)")) + pass3 = pass2.substring(0, pass2.length() - 30) + ".empty() or (type.count() <= 1)"; + String pass4 = pass3; + if (pass3.equals("duration >= 0")) + pass4 = "duration.exists() implies duration >= 0"; + else if (pass3.equals("period >= 0")) + pass4 = "period.exists() implies period >= 0"; + else if (pass3.equals("fullUrl.empty() xor resource")) + pass4 = "fullUrl.empty() xor resource.exists()"; + return pass4; + } + + public static String convertTo2016MayExpression(String newExpression) { + String pass1 = newExpression.replaceAll("%context","\\$context").replaceAll("%resource", "\\$resource").replaceAll("code&profile", "code+profile").replaceAll("path&'\\.'", "path+'.'").replaceAll("fullUrl%resource", "fullUrl+resource"); + String pass2 = pass1; + if (pass1.endsWith(".isDistinct()")) + pass2 = pass1.substring(0, pass1.length() - 13) + ".distinct()"; + String pass3 = pass2; + if (pass2.endsWith(".empty() or (type.count() <= 1)")) + pass3 = pass2.substring(0, pass2.length() - 31) + ".empty() or (type.count() = 1)"; + String pass4 = pass3; + if (pass3.equals("duration.exists() implies duration >= 0")) + pass4 = "duration >= 0"; + else if (pass3.equals("period.exists() implies period >= 0")) + pass4 = "period >= 0"; + else if (pass3.equals("fullUrl.empty() xor resource.exists()")) + pass4 = "fullUrl.empty() xor resource"; + return pass4; + } + + private static org.hl7.fhir.r5.model.ElementDefinition.ConstraintSeverity convertConstraintSeverity(org.hl7.fhir.dstu2016may.model.ElementDefinition.ConstraintSeverity src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case ERROR: return org.hl7.fhir.r5.model.ElementDefinition.ConstraintSeverity.ERROR; + case WARNING: return org.hl7.fhir.r5.model.ElementDefinition.ConstraintSeverity.WARNING; + default: return org.hl7.fhir.r5.model.ElementDefinition.ConstraintSeverity.NULL; + } + } + + private static org.hl7.fhir.dstu2016may.model.ElementDefinition.ConstraintSeverity convertConstraintSeverity(org.hl7.fhir.r5.model.ElementDefinition.ConstraintSeverity src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case ERROR: return org.hl7.fhir.dstu2016may.model.ElementDefinition.ConstraintSeverity.ERROR; + case WARNING: return org.hl7.fhir.dstu2016may.model.ElementDefinition.ConstraintSeverity.WARNING; + default: return org.hl7.fhir.dstu2016may.model.ElementDefinition.ConstraintSeverity.NULL; + } + } + + public static org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionBindingComponent convertElementDefinitionBindingComponent(org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionBindingComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionBindingComponent tgt = new org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionBindingComponent(); + copyElement(src, tgt); + tgt.setStrength(convertBindingStrength(src.getStrength())); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + if (src.hasValueSet()) { + org.hl7.fhir.r5.model.Type t = convertType(src.getValueSet()); + if (t instanceof org.hl7.fhir.r5.model.Reference) + tgt.setValueSet(((org.hl7.fhir.r5.model.Reference) t).getReference()); + else + tgt.setValueSet(t.primitiveValue()); + tgt.setValueSet(VersionConvertorConstants.refToVS(tgt.getValueSet())); + } + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionBindingComponent convertElementDefinitionBindingComponent(org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionBindingComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionBindingComponent tgt = new org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionBindingComponent(); + copyElement(src, tgt); + tgt.setStrength(convertBindingStrength(src.getStrength())); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + if (src.hasValueSet()) { + String vsr = VersionConvertorConstants.vsToRef(src.getValueSet()); + if (vsr != null) + tgt.setValueSet(new org.hl7.fhir.dstu2016may.model.UriType(vsr)); + else + tgt.setValueSet(new org.hl7.fhir.dstu2016may.model.Reference(src.getValueSet())); + } + return tgt; + } + + private static org.hl7.fhir.r5.model.Enumerations.BindingStrength convertBindingStrength(org.hl7.fhir.dstu2016may.model.Enumerations.BindingStrength src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case REQUIRED: return org.hl7.fhir.r5.model.Enumerations.BindingStrength.REQUIRED; + case EXTENSIBLE: return org.hl7.fhir.r5.model.Enumerations.BindingStrength.EXTENSIBLE; + case PREFERRED: return org.hl7.fhir.r5.model.Enumerations.BindingStrength.PREFERRED; + case EXAMPLE: return org.hl7.fhir.r5.model.Enumerations.BindingStrength.EXAMPLE; + default: return org.hl7.fhir.r5.model.Enumerations.BindingStrength.NULL; + } + } + + private static org.hl7.fhir.dstu2016may.model.Enumerations.BindingStrength convertBindingStrength(org.hl7.fhir.r5.model.Enumerations.BindingStrength src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case REQUIRED: return org.hl7.fhir.dstu2016may.model.Enumerations.BindingStrength.REQUIRED; + case EXTENSIBLE: return org.hl7.fhir.dstu2016may.model.Enumerations.BindingStrength.EXTENSIBLE; + case PREFERRED: return org.hl7.fhir.dstu2016may.model.Enumerations.BindingStrength.PREFERRED; + case EXAMPLE: return org.hl7.fhir.dstu2016may.model.Enumerations.BindingStrength.EXAMPLE; + default: return org.hl7.fhir.dstu2016may.model.Enumerations.BindingStrength.NULL; + } + } + + public static org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionMappingComponent convertElementDefinitionMappingComponent(org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionMappingComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionMappingComponent tgt = new org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionMappingComponent(); + copyElement(src, tgt); + tgt.setIdentity(src.getIdentity()); + if (src.hasLanguage()) + tgt.setLanguage(src.getLanguage()); + tgt.setMap(src.getMap()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionMappingComponent convertElementDefinitionMappingComponent(org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionMappingComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionMappingComponent tgt = new org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionMappingComponent(); + copyElement(src, tgt); + tgt.setIdentity(src.getIdentity()); + if (src.hasLanguage()) + tgt.setLanguage(src.getLanguage()); + tgt.setMap(src.getMap()); + return tgt; + } + + public static org.hl7.fhir.r5.model.HumanName convertHumanName(org.hl7.fhir.dstu2016may.model.HumanName src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.HumanName tgt = new org.hl7.fhir.r5.model.HumanName(); + copyElement(src, tgt); + tgt.setUse(convertNameUse(src.getUse())); + if (src.hasText()) + tgt.setText(src.getText()); + for (org.hl7.fhir.dstu2016may.model.StringType t : src.getFamily()) + tgt.setFamily(t.getValue()); + for (org.hl7.fhir.dstu2016may.model.StringType t : src.getGiven()) + tgt.addGiven(t.getValue()); + for (org.hl7.fhir.dstu2016may.model.StringType t : src.getPrefix()) + tgt.addPrefix(t.getValue()); + for (org.hl7.fhir.dstu2016may.model.StringType t : src.getSuffix()) + tgt.addSuffix(t.getValue()); + tgt.setPeriod(convertPeriod(src.getPeriod())); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.HumanName convertHumanName(org.hl7.fhir.r5.model.HumanName src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.HumanName tgt = new org.hl7.fhir.dstu2016may.model.HumanName(); + copyElement(src, tgt); + tgt.setUse(convertNameUse(src.getUse())); + if (src.hasText()) + tgt.setText(src.getText()); + if (src.hasFamily()) + tgt.addFamily(src.getFamily()); + for (org.hl7.fhir.r5.model.StringType t : src.getGiven()) + tgt.addGiven(t.getValue()); + for (org.hl7.fhir.r5.model.StringType t : src.getPrefix()) + tgt.addPrefix(t.getValue()); + for (org.hl7.fhir.r5.model.StringType t : src.getSuffix()) + tgt.addSuffix(t.getValue()); + tgt.setPeriod(convertPeriod(src.getPeriod())); + return tgt; + } + + private static org.hl7.fhir.r5.model.HumanName.NameUse convertNameUse(org.hl7.fhir.dstu2016may.model.HumanName.NameUse src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case USUAL: return org.hl7.fhir.r5.model.HumanName.NameUse.USUAL; + case OFFICIAL: return org.hl7.fhir.r5.model.HumanName.NameUse.OFFICIAL; + case TEMP: return org.hl7.fhir.r5.model.HumanName.NameUse.TEMP; + case NICKNAME: return org.hl7.fhir.r5.model.HumanName.NameUse.NICKNAME; + case ANONYMOUS: return org.hl7.fhir.r5.model.HumanName.NameUse.ANONYMOUS; + case OLD: return org.hl7.fhir.r5.model.HumanName.NameUse.OLD; + case MAIDEN: return org.hl7.fhir.r5.model.HumanName.NameUse.MAIDEN; + default: return org.hl7.fhir.r5.model.HumanName.NameUse.NULL; + } + } + + private static org.hl7.fhir.dstu2016may.model.HumanName.NameUse convertNameUse(org.hl7.fhir.r5.model.HumanName.NameUse src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case USUAL: return org.hl7.fhir.dstu2016may.model.HumanName.NameUse.USUAL; + case OFFICIAL: return org.hl7.fhir.dstu2016may.model.HumanName.NameUse.OFFICIAL; + case TEMP: return org.hl7.fhir.dstu2016may.model.HumanName.NameUse.TEMP; + case NICKNAME: return org.hl7.fhir.dstu2016may.model.HumanName.NameUse.NICKNAME; + case ANONYMOUS: return org.hl7.fhir.dstu2016may.model.HumanName.NameUse.ANONYMOUS; + case OLD: return org.hl7.fhir.dstu2016may.model.HumanName.NameUse.OLD; + case MAIDEN: return org.hl7.fhir.dstu2016may.model.HumanName.NameUse.MAIDEN; + default: return org.hl7.fhir.dstu2016may.model.HumanName.NameUse.NULL; + } + } + + public static org.hl7.fhir.r5.model.Meta convertMeta(org.hl7.fhir.dstu2016may.model.Meta src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Meta tgt = new org.hl7.fhir.r5.model.Meta(); + copyElement(src, tgt); + if (src.hasVersionId()) + tgt.setVersionId(src.getVersionId()); + if (src.hasLastUpdated()) + tgt.setLastUpdated(src.getLastUpdated()); + for (org.hl7.fhir.dstu2016may.model.UriType t : src.getProfile()) + tgt.addProfile(t.getValue()); + for (org.hl7.fhir.dstu2016may.model.Coding t : src.getSecurity()) + tgt.addSecurity(convertCoding(t)); + for (org.hl7.fhir.dstu2016may.model.Coding t : src.getTag()) + tgt.addTag(convertCoding(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Meta convertMeta(org.hl7.fhir.r5.model.Meta src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Meta tgt = new org.hl7.fhir.dstu2016may.model.Meta(); + copyElement(src, tgt); + if (src.hasVersionId()) + tgt.setVersionId(src.getVersionId()); + if (src.hasLastUpdated()) + tgt.setLastUpdated(src.getLastUpdated()); + for (org.hl7.fhir.r5.model.UriType t : src.getProfile()) + tgt.addProfile(t.getValue()); + for (org.hl7.fhir.r5.model.Coding t : src.getSecurity()) + tgt.addSecurity(convertCoding(t)); + for (org.hl7.fhir.r5.model.Coding t : src.getTag()) + tgt.addTag(convertCoding(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.Timing convertTiming(org.hl7.fhir.dstu2016may.model.Timing src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Timing tgt = new org.hl7.fhir.r5.model.Timing(); + copyElement(src, tgt); + for (org.hl7.fhir.dstu2016may.model.DateTimeType t : src.getEvent()) + tgt.addEvent(t.getValue()); + tgt.setRepeat(convertTimingRepeatComponent(src.getRepeat())); + tgt.setCode(convertCodeableConcept(src.getCode())); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Timing convertTiming(org.hl7.fhir.r5.model.Timing src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Timing tgt = new org.hl7.fhir.dstu2016may.model.Timing(); + copyElement(src, tgt); + for (org.hl7.fhir.r5.model.DateTimeType t : src.getEvent()) + tgt.addEvent(t.getValue()); + tgt.setRepeat(convertTimingRepeatComponent(src.getRepeat())); + tgt.setCode(convertCodeableConcept(src.getCode())); + return tgt; + } + + public static org.hl7.fhir.r5.model.Timing.TimingRepeatComponent convertTimingRepeatComponent(org.hl7.fhir.dstu2016may.model.Timing.TimingRepeatComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Timing.TimingRepeatComponent tgt = new org.hl7.fhir.r5.model.Timing.TimingRepeatComponent(); + copyElement(src, tgt); + tgt.setBounds(convertType(src.getBounds())); + if (src.hasCount()) + tgt.setCount(src.getCount()); + if (src.hasCountMax()) + tgt.setCountMax(src.getCountMax()); + if (src.hasDuration()) + tgt.setDuration(src.getDuration()); + if (src.hasDurationMax()) + tgt.setDurationMax(src.getDurationMax()); + tgt.setDurationUnit(convertUnitsOfTime(src.getDurationUnit())); + if (src.hasFrequency()) + tgt.setFrequency(src.getFrequency()); + if (src.hasFrequencyMax()) + tgt.setFrequencyMax(src.getFrequencyMax()); + if (src.hasPeriod()) + tgt.setPeriod(src.getPeriod()); + if (src.hasPeriodMax()) + tgt.setPeriodMax(src.getPeriodMax()); + tgt.setPeriodUnit(convertUnitsOfTime(src.getPeriodUnit())); + tgt.addWhen(convertEventTiming(src.getWhen())); + if (src.hasOffset()) + tgt.setOffset(src.getOffset()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Timing.TimingRepeatComponent convertTimingRepeatComponent(org.hl7.fhir.r5.model.Timing.TimingRepeatComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Timing.TimingRepeatComponent tgt = new org.hl7.fhir.dstu2016may.model.Timing.TimingRepeatComponent(); + copyElement(src, tgt); + tgt.setBounds(convertType(src.getBounds())); + if (src.hasCount()) + tgt.setCount(src.getCount()); + if (src.hasCountMax()) + tgt.setCountMax(src.getCountMax()); + if (src.hasDuration()) + tgt.setDuration(src.getDuration()); + if (src.hasDurationMax()) + tgt.setDurationMax(src.getDurationMax()); + tgt.setDurationUnit(convertUnitsOfTime(src.getDurationUnit())); + if (src.hasFrequency()) + tgt.setFrequency(src.getFrequency()); + if (src.hasFrequencyMax()) + tgt.setFrequencyMax(src.getFrequencyMax()); + if (src.hasPeriod()) + tgt.setPeriod(src.getPeriod()); + if (src.hasPeriodMax()) + tgt.setPeriodMax(src.getPeriodMax()); + tgt.setPeriodUnit(convertUnitsOfTime(src.getPeriodUnit())); + for (Enumeration t : src.getWhen()) + tgt.setWhen(convertEventTiming(t.getValue())); + if (src.hasOffset()) + tgt.setOffset(src.getOffset()); + return tgt; + } + + private static org.hl7.fhir.r5.model.Timing.UnitsOfTime convertUnitsOfTime(org.hl7.fhir.dstu2016may.model.Timing.UnitsOfTime src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case S: return org.hl7.fhir.r5.model.Timing.UnitsOfTime.S; + case MIN: return org.hl7.fhir.r5.model.Timing.UnitsOfTime.MIN; + case H: return org.hl7.fhir.r5.model.Timing.UnitsOfTime.H; + case D: return org.hl7.fhir.r5.model.Timing.UnitsOfTime.D; + case WK: return org.hl7.fhir.r5.model.Timing.UnitsOfTime.WK; + case MO: return org.hl7.fhir.r5.model.Timing.UnitsOfTime.MO; + case A: return org.hl7.fhir.r5.model.Timing.UnitsOfTime.A; + default: return org.hl7.fhir.r5.model.Timing.UnitsOfTime.NULL; + } + } + + private static org.hl7.fhir.dstu2016may.model.Timing.UnitsOfTime convertUnitsOfTime(org.hl7.fhir.r5.model.Timing.UnitsOfTime src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case S: return org.hl7.fhir.dstu2016may.model.Timing.UnitsOfTime.S; + case MIN: return org.hl7.fhir.dstu2016may.model.Timing.UnitsOfTime.MIN; + case H: return org.hl7.fhir.dstu2016may.model.Timing.UnitsOfTime.H; + case D: return org.hl7.fhir.dstu2016may.model.Timing.UnitsOfTime.D; + case WK: return org.hl7.fhir.dstu2016may.model.Timing.UnitsOfTime.WK; + case MO: return org.hl7.fhir.dstu2016may.model.Timing.UnitsOfTime.MO; + case A: return org.hl7.fhir.dstu2016may.model.Timing.UnitsOfTime.A; + default: return org.hl7.fhir.dstu2016may.model.Timing.UnitsOfTime.NULL; + } + } + + private static org.hl7.fhir.r5.model.Timing.EventTiming convertEventTiming(org.hl7.fhir.dstu2016may.model.Timing.EventTiming src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case HS: return org.hl7.fhir.r5.model.Timing.EventTiming.HS; + case WAKE: return org.hl7.fhir.r5.model.Timing.EventTiming.WAKE; + case C: return org.hl7.fhir.r5.model.Timing.EventTiming.C; + case CM: return org.hl7.fhir.r5.model.Timing.EventTiming.CM; + case CD: return org.hl7.fhir.r5.model.Timing.EventTiming.CD; + case CV: return org.hl7.fhir.r5.model.Timing.EventTiming.CV; + case AC: return org.hl7.fhir.r5.model.Timing.EventTiming.AC; + case ACM: return org.hl7.fhir.r5.model.Timing.EventTiming.ACM; + case ACD: return org.hl7.fhir.r5.model.Timing.EventTiming.ACD; + case ACV: return org.hl7.fhir.r5.model.Timing.EventTiming.ACV; + case PC: return org.hl7.fhir.r5.model.Timing.EventTiming.PC; + case PCM: return org.hl7.fhir.r5.model.Timing.EventTiming.PCM; + case PCD: return org.hl7.fhir.r5.model.Timing.EventTiming.PCD; + case PCV: return org.hl7.fhir.r5.model.Timing.EventTiming.PCV; + default: return org.hl7.fhir.r5.model.Timing.EventTiming.NULL; + } + } + + private static org.hl7.fhir.dstu2016may.model.Timing.EventTiming convertEventTiming(org.hl7.fhir.r5.model.Timing.EventTiming src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case HS: return org.hl7.fhir.dstu2016may.model.Timing.EventTiming.HS; + case WAKE: return org.hl7.fhir.dstu2016may.model.Timing.EventTiming.WAKE; + case C: return org.hl7.fhir.dstu2016may.model.Timing.EventTiming.C; + case CM: return org.hl7.fhir.dstu2016may.model.Timing.EventTiming.CM; + case CD: return org.hl7.fhir.dstu2016may.model.Timing.EventTiming.CD; + case CV: return org.hl7.fhir.dstu2016may.model.Timing.EventTiming.CV; + case AC: return org.hl7.fhir.dstu2016may.model.Timing.EventTiming.AC; + case ACM: return org.hl7.fhir.dstu2016may.model.Timing.EventTiming.ACM; + case ACD: return org.hl7.fhir.dstu2016may.model.Timing.EventTiming.ACD; + case ACV: return org.hl7.fhir.dstu2016may.model.Timing.EventTiming.ACV; + case PC: return org.hl7.fhir.dstu2016may.model.Timing.EventTiming.PC; + case PCM: return org.hl7.fhir.dstu2016may.model.Timing.EventTiming.PCM; + case PCD: return org.hl7.fhir.dstu2016may.model.Timing.EventTiming.PCD; + case PCV: return org.hl7.fhir.dstu2016may.model.Timing.EventTiming.PCV; + default: return org.hl7.fhir.dstu2016may.model.Timing.EventTiming.NULL; + } + } + + public static org.hl7.fhir.r5.model.Quantity convertSimpleQuantity(org.hl7.fhir.dstu2016may.model.SimpleQuantity src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.SimpleQuantity tgt = new org.hl7.fhir.r5.model.SimpleQuantity(); + copyElement(src, tgt); + if (src.hasValue()) + tgt.setValue(src.getValue()); + tgt.setComparator(convertQuantityComparator(src.getComparator())); + if (src.hasUnit()) + tgt.setUnit(src.getUnit()); + if (src.hasSystem()) + tgt.setSystem(src.getSystem()); + if (src.hasCode()) + tgt.setCode(src.getCode()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.SimpleQuantity convertSimpleQuantity(org.hl7.fhir.r5.model.Quantity src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.SimpleQuantity tgt = new org.hl7.fhir.dstu2016may.model.SimpleQuantity(); + copyElement(src, tgt); + if (src.hasValue()) + tgt.setValue(src.getValue()); + tgt.setComparator(convertQuantityComparator(src.getComparator())); + if (src.hasUnit()) + tgt.setUnit(src.getUnit()); + if (src.hasSystem()) + tgt.setSystem(src.getSystem()); + if (src.hasCode()) + tgt.setCode(src.getCode()); + return tgt; + } + + public static org.hl7.fhir.r5.model.Type convertType(org.hl7.fhir.dstu2016may.model.Type src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + if (src instanceof org.hl7.fhir.dstu2016may.model.Base64BinaryType) + return convertBase64Binary((org.hl7.fhir.dstu2016may.model.Base64BinaryType) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.BooleanType) + return convertBoolean((org.hl7.fhir.dstu2016may.model.BooleanType) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.CodeType) + return convertCode((org.hl7.fhir.dstu2016may.model.CodeType) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.DateType) + return convertDate((org.hl7.fhir.dstu2016may.model.DateType) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.DateTimeType) + return convertDateTime((org.hl7.fhir.dstu2016may.model.DateTimeType) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.DecimalType) + return convertDecimal((org.hl7.fhir.dstu2016may.model.DecimalType) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.IdType) + return convertId((org.hl7.fhir.dstu2016may.model.IdType) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.InstantType) + return convertInstant((org.hl7.fhir.dstu2016may.model.InstantType) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.IntegerType) + return convertInteger((org.hl7.fhir.dstu2016may.model.IntegerType) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.MarkdownType) + return convertMarkdown((org.hl7.fhir.dstu2016may.model.MarkdownType) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.OidType) + return convertOid((org.hl7.fhir.dstu2016may.model.OidType) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.PositiveIntType) + return convertPositiveInt((org.hl7.fhir.dstu2016may.model.PositiveIntType) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.StringType) + return convertString((org.hl7.fhir.dstu2016may.model.StringType) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.TimeType) + return convertTime((org.hl7.fhir.dstu2016may.model.TimeType) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.UnsignedIntType) + return convertUnsignedInt((org.hl7.fhir.dstu2016may.model.UnsignedIntType) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.UriType) + return convertUri((org.hl7.fhir.dstu2016may.model.UriType) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.UuidType) + return convertUuid((org.hl7.fhir.dstu2016may.model.UuidType) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.Extension) + return convertExtension((org.hl7.fhir.dstu2016may.model.Extension) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.Narrative) + return convertNarrative((org.hl7.fhir.dstu2016may.model.Narrative) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.Age) + return convertAge((org.hl7.fhir.dstu2016may.model.Age) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.Annotation) + return convertAnnotation((org.hl7.fhir.dstu2016may.model.Annotation) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.Attachment) + return convertAttachment((org.hl7.fhir.dstu2016may.model.Attachment) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.CodeableConcept) + return convertCodeableConcept((org.hl7.fhir.dstu2016may.model.CodeableConcept) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.Coding) + return convertCoding((org.hl7.fhir.dstu2016may.model.Coding) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.Count) + return convertCount((org.hl7.fhir.dstu2016may.model.Count) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.Distance) + return convertDistance((org.hl7.fhir.dstu2016may.model.Distance) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.Duration) + return convertDuration((org.hl7.fhir.dstu2016may.model.Duration) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.Identifier) + return convertIdentifier((org.hl7.fhir.dstu2016may.model.Identifier) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.Money) + return convertMoney((org.hl7.fhir.dstu2016may.model.Money) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.Period) + return convertPeriod((org.hl7.fhir.dstu2016may.model.Period) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.Quantity) + return convertQuantity((org.hl7.fhir.dstu2016may.model.Quantity) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.Range) + return convertRange((org.hl7.fhir.dstu2016may.model.Range) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.Ratio) + return convertRatio((org.hl7.fhir.dstu2016may.model.Ratio) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.Reference) + return convertReference((org.hl7.fhir.dstu2016may.model.Reference) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.SampledData) + return convertSampledData((org.hl7.fhir.dstu2016may.model.SampledData) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.Signature) + return convertSignature((org.hl7.fhir.dstu2016may.model.Signature) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.Address) + return convertAddress((org.hl7.fhir.dstu2016may.model.Address) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.ContactPoint) + return convertContactPoint((org.hl7.fhir.dstu2016may.model.ContactPoint) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.HumanName) + return convertHumanName((org.hl7.fhir.dstu2016may.model.HumanName) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.Meta) + return convertMeta((org.hl7.fhir.dstu2016may.model.Meta) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.Timing) + return convertTiming((org.hl7.fhir.dstu2016may.model.Timing) src); + throw new FHIRException("Unknown type "+src.fhirType()); + } + + public static org.hl7.fhir.dstu2016may.model.Type convertType(org.hl7.fhir.r5.model.Type src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + if (src instanceof org.hl7.fhir.r5.model.Base64BinaryType) + return convertBase64Binary((org.hl7.fhir.r5.model.Base64BinaryType) src); + if (src instanceof org.hl7.fhir.r5.model.BooleanType) + return convertBoolean((org.hl7.fhir.r5.model.BooleanType) src); + if (src instanceof org.hl7.fhir.r5.model.CodeType) + return convertCode((org.hl7.fhir.r5.model.CodeType) src); + if (src instanceof org.hl7.fhir.r5.model.DateType) + return convertDate((org.hl7.fhir.r5.model.DateType) src); + if (src instanceof org.hl7.fhir.r5.model.DateTimeType) + return convertDateTime((org.hl7.fhir.r5.model.DateTimeType) src); + if (src instanceof org.hl7.fhir.r5.model.DecimalType) + return convertDecimal((org.hl7.fhir.r5.model.DecimalType) src); + if (src instanceof org.hl7.fhir.r5.model.IdType) + return convertId((org.hl7.fhir.r5.model.IdType) src); + if (src instanceof org.hl7.fhir.r5.model.InstantType) + return convertInstant((org.hl7.fhir.r5.model.InstantType) src); + if (src instanceof org.hl7.fhir.r5.model.IntegerType) + return convertInteger((org.hl7.fhir.r5.model.IntegerType) src); + if (src instanceof org.hl7.fhir.r5.model.MarkdownType) + return convertMarkdown((org.hl7.fhir.r5.model.MarkdownType) src); + if (src instanceof org.hl7.fhir.r5.model.OidType) + return convertOid((org.hl7.fhir.r5.model.OidType) src); + if (src instanceof org.hl7.fhir.r5.model.PositiveIntType) + return convertPositiveInt((org.hl7.fhir.r5.model.PositiveIntType) src); + if (src instanceof org.hl7.fhir.r5.model.StringType) + return convertString((org.hl7.fhir.r5.model.StringType) src); + if (src instanceof org.hl7.fhir.r5.model.TimeType) + return convertTime((org.hl7.fhir.r5.model.TimeType) src); + if (src instanceof org.hl7.fhir.r5.model.UnsignedIntType) + return convertUnsignedInt((org.hl7.fhir.r5.model.UnsignedIntType) src); + if (src instanceof org.hl7.fhir.r5.model.UriType) + return convertUri((org.hl7.fhir.r5.model.UriType) src); + if (src instanceof org.hl7.fhir.r5.model.UuidType) + return convertUuid((org.hl7.fhir.r5.model.UuidType) src); + if (src instanceof org.hl7.fhir.r5.model.Extension) + return convertExtension((org.hl7.fhir.r5.model.Extension) src); + if (src instanceof org.hl7.fhir.r5.model.Narrative) + return convertNarrative((org.hl7.fhir.r5.model.Narrative) src); + if (src instanceof org.hl7.fhir.r5.model.Age) + return convertAge((org.hl7.fhir.r5.model.Age) src); + if (src instanceof org.hl7.fhir.r5.model.Annotation) + return convertAnnotation((org.hl7.fhir.r5.model.Annotation) src); + if (src instanceof org.hl7.fhir.r5.model.Attachment) + return convertAttachment((org.hl7.fhir.r5.model.Attachment) src); + if (src instanceof org.hl7.fhir.r5.model.CodeableConcept) + return convertCodeableConcept((org.hl7.fhir.r5.model.CodeableConcept) src); + if (src instanceof org.hl7.fhir.r5.model.Coding) + return convertCoding((org.hl7.fhir.r5.model.Coding) src); + if (src instanceof org.hl7.fhir.r5.model.Count) + return convertCount((org.hl7.fhir.r5.model.Count) src); + if (src instanceof org.hl7.fhir.r5.model.Distance) + return convertDistance((org.hl7.fhir.r5.model.Distance) src); + if (src instanceof org.hl7.fhir.r5.model.Duration) + return convertDuration((org.hl7.fhir.r5.model.Duration) src); + if (src instanceof org.hl7.fhir.r5.model.Identifier) + return convertIdentifier((org.hl7.fhir.r5.model.Identifier) src); + if (src instanceof org.hl7.fhir.r5.model.Money) + return convertMoney((org.hl7.fhir.r5.model.Money) src); + if (src instanceof org.hl7.fhir.r5.model.Period) + return convertPeriod((org.hl7.fhir.r5.model.Period) src); + if (src instanceof org.hl7.fhir.r5.model.Quantity) + return convertQuantity((org.hl7.fhir.r5.model.Quantity) src); + if (src instanceof org.hl7.fhir.r5.model.Range) + return convertRange((org.hl7.fhir.r5.model.Range) src); + if (src instanceof org.hl7.fhir.r5.model.Ratio) + return convertRatio((org.hl7.fhir.r5.model.Ratio) src); + if (src instanceof org.hl7.fhir.r5.model.Reference) + return convertReference((org.hl7.fhir.r5.model.Reference) src); + if (src instanceof org.hl7.fhir.r5.model.SampledData) + return convertSampledData((org.hl7.fhir.r5.model.SampledData) src); + if (src instanceof org.hl7.fhir.r5.model.Signature) + return convertSignature((org.hl7.fhir.r5.model.Signature) src); + if (src instanceof org.hl7.fhir.r5.model.Address) + return convertAddress((org.hl7.fhir.r5.model.Address) src); + if (src instanceof org.hl7.fhir.r5.model.ContactPoint) + return convertContactPoint((org.hl7.fhir.r5.model.ContactPoint) src); + if (src instanceof org.hl7.fhir.r5.model.HumanName) + return convertHumanName((org.hl7.fhir.r5.model.HumanName) src); + if (src instanceof org.hl7.fhir.r5.model.Meta) + return convertMeta((org.hl7.fhir.r5.model.Meta) src); + if (src instanceof org.hl7.fhir.r5.model.Timing) + return convertTiming((org.hl7.fhir.r5.model.Timing) src); + throw new FHIRException("Unknown type "+src.fhirType()); + } + + private static void copyDomainResource(org.hl7.fhir.dstu2016may.model.DomainResource src, org.hl7.fhir.r5.model.DomainResource tgt) throws FHIRException { + copyResource(src, tgt); + tgt.setText(convertNarrative(src.getText())); + for (org.hl7.fhir.dstu2016may.model.Resource t : src.getContained()) + tgt.addContained(convertResource(t)); + for (org.hl7.fhir.dstu2016may.model.Extension t : src.getExtension()) + tgt.addExtension(convertExtension(t)); + for (org.hl7.fhir.dstu2016may.model.Extension t : src.getModifierExtension()) + tgt.addModifierExtension(convertExtension(t)); + } + private static void copyDomainResource(org.hl7.fhir.r5.model.DomainResource src, org.hl7.fhir.dstu2016may.model.DomainResource tgt) throws FHIRException { + copyResource(src, tgt); + if (src.hasText()) + tgt.setText(convertNarrative(src.getText())); + for (org.hl7.fhir.r5.model.Resource t : src.getContained()) + tgt.addContained(convertResource(t)); + for (org.hl7.fhir.r5.model.Extension t : src.getExtension()) + tgt.addExtension(convertExtension(t)); + for (org.hl7.fhir.r5.model.Extension t : src.getModifierExtension()) + tgt.addModifierExtension(convertExtension(t)); + } + public static org.hl7.fhir.r5.model.Parameters convertParameters(org.hl7.fhir.dstu2016may.model.Parameters src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Parameters tgt = new org.hl7.fhir.r5.model.Parameters(); + copyResource(src, tgt); + for (org.hl7.fhir.dstu2016may.model.Parameters.ParametersParameterComponent t : src.getParameter()) + tgt.addParameter(convertParametersParameterComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Parameters convertParameters(org.hl7.fhir.r5.model.Parameters src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Parameters tgt = new org.hl7.fhir.dstu2016may.model.Parameters(); + copyResource(src, tgt); + for (org.hl7.fhir.r5.model.Parameters.ParametersParameterComponent t : src.getParameter()) + tgt.addParameter(convertParametersParameterComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.Parameters.ParametersParameterComponent convertParametersParameterComponent(org.hl7.fhir.dstu2016may.model.Parameters.ParametersParameterComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Parameters.ParametersParameterComponent tgt = new org.hl7.fhir.r5.model.Parameters.ParametersParameterComponent(); + copyElement(src, tgt); + tgt.setName(src.getName()); + tgt.setValue(convertType(src.getValue())); + tgt.setResource(convertResource(src.getResource())); + for (org.hl7.fhir.dstu2016may.model.Parameters.ParametersParameterComponent t : src.getPart()) + tgt.addPart(convertParametersParameterComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Parameters.ParametersParameterComponent convertParametersParameterComponent(org.hl7.fhir.r5.model.Parameters.ParametersParameterComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Parameters.ParametersParameterComponent tgt = new org.hl7.fhir.dstu2016may.model.Parameters.ParametersParameterComponent(); + copyElement(src, tgt); + tgt.setName(src.getName()); + tgt.setValue(convertType(src.getValue())); + tgt.setResource(convertResource(src.getResource())); + for (org.hl7.fhir.r5.model.Parameters.ParametersParameterComponent t : src.getPart()) + tgt.addPart(convertParametersParameterComponent(t)); + return tgt; + } + + private static void copyResource(org.hl7.fhir.dstu2016may.model.Resource src, org.hl7.fhir.r5.model.Resource tgt) throws FHIRException { + if (src.hasId()) + tgt.setId(src.getId()); + tgt.setMeta(convertMeta(src.getMeta())); + if (src.hasImplicitRules()) + tgt.setImplicitRules(src.getImplicitRules()); + if (src.hasLanguage()) + tgt.setLanguage(src.getLanguage()); + } + private static void copyResource(org.hl7.fhir.r5.model.Resource src, org.hl7.fhir.dstu2016may.model.Resource tgt) throws FHIRException { + if (src.hasId()) + tgt.setId(src.getId()); + if (src.hasMeta()) + tgt.setMeta(convertMeta(src.getMeta())); + if (src.hasImplicitRules()) + tgt.setImplicitRules(src.getImplicitRules()); + if (src.hasLanguage()) + tgt.setLanguage(src.getLanguage()); + } + + public static org.hl7.fhir.r5.model.Binary convertBinary(org.hl7.fhir.dstu2016may.model.Binary src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Binary tgt = new org.hl7.fhir.r5.model.Binary(); + copyResource(src, tgt); + tgt.setContentType(src.getContentType()); + tgt.setContent(src.getContent()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Binary convertBinary(org.hl7.fhir.r5.model.Binary src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Binary tgt = new org.hl7.fhir.dstu2016may.model.Binary(); + copyResource(src, tgt); + tgt.setContentType(src.getContentType()); + tgt.setContent(src.getContent()); + return tgt; + } + + + public static org.hl7.fhir.r5.model.Bundle convertBundle(org.hl7.fhir.dstu2016may.model.Bundle src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Bundle tgt = new org.hl7.fhir.r5.model.Bundle(); + copyResource(src, tgt); + tgt.setType(convertBundleType(src.getType())); + if (src.hasTotal()) + tgt.setTotal(src.getTotal()); + for (org.hl7.fhir.dstu2016may.model.Bundle.BundleLinkComponent t : src.getLink()) + tgt.addLink(convertBundleLinkComponent(t)); + for (org.hl7.fhir.dstu2016may.model.Bundle.BundleEntryComponent t : src.getEntry()) + tgt.addEntry(convertBundleEntryComponent(t)); + tgt.setSignature(convertSignature(src.getSignature())); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Bundle convertBundle(org.hl7.fhir.r5.model.Bundle src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Bundle tgt = new org.hl7.fhir.dstu2016may.model.Bundle(); + copyResource(src, tgt); + tgt.setType(convertBundleType(src.getType())); + if (src.hasTotal()) + tgt.setTotal(src.getTotal()); + for (org.hl7.fhir.r5.model.Bundle.BundleLinkComponent t : src.getLink()) + tgt.addLink(convertBundleLinkComponent(t)); + for (org.hl7.fhir.r5.model.Bundle.BundleEntryComponent t : src.getEntry()) + tgt.addEntry(convertBundleEntryComponent(t)); + tgt.setSignature(convertSignature(src.getSignature())); + return tgt; + } + + private static org.hl7.fhir.r5.model.Bundle.BundleType convertBundleType(org.hl7.fhir.dstu2016may.model.Bundle.BundleType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case DOCUMENT: return org.hl7.fhir.r5.model.Bundle.BundleType.DOCUMENT; + case MESSAGE: return org.hl7.fhir.r5.model.Bundle.BundleType.MESSAGE; + case TRANSACTION: return org.hl7.fhir.r5.model.Bundle.BundleType.TRANSACTION; + case TRANSACTIONRESPONSE: return org.hl7.fhir.r5.model.Bundle.BundleType.TRANSACTIONRESPONSE; + case BATCH: return org.hl7.fhir.r5.model.Bundle.BundleType.BATCH; + case BATCHRESPONSE: return org.hl7.fhir.r5.model.Bundle.BundleType.BATCHRESPONSE; + case HISTORY: return org.hl7.fhir.r5.model.Bundle.BundleType.HISTORY; + case SEARCHSET: return org.hl7.fhir.r5.model.Bundle.BundleType.SEARCHSET; + case COLLECTION: return org.hl7.fhir.r5.model.Bundle.BundleType.COLLECTION; + default: return org.hl7.fhir.r5.model.Bundle.BundleType.NULL; + } + } + + private static org.hl7.fhir.dstu2016may.model.Bundle.BundleType convertBundleType(org.hl7.fhir.r5.model.Bundle.BundleType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case DOCUMENT: return org.hl7.fhir.dstu2016may.model.Bundle.BundleType.DOCUMENT; + case MESSAGE: return org.hl7.fhir.dstu2016may.model.Bundle.BundleType.MESSAGE; + case TRANSACTION: return org.hl7.fhir.dstu2016may.model.Bundle.BundleType.TRANSACTION; + case TRANSACTIONRESPONSE: return org.hl7.fhir.dstu2016may.model.Bundle.BundleType.TRANSACTIONRESPONSE; + case BATCH: return org.hl7.fhir.dstu2016may.model.Bundle.BundleType.BATCH; + case BATCHRESPONSE: return org.hl7.fhir.dstu2016may.model.Bundle.BundleType.BATCHRESPONSE; + case HISTORY: return org.hl7.fhir.dstu2016may.model.Bundle.BundleType.HISTORY; + case SEARCHSET: return org.hl7.fhir.dstu2016may.model.Bundle.BundleType.SEARCHSET; + case COLLECTION: return org.hl7.fhir.dstu2016may.model.Bundle.BundleType.COLLECTION; + default: return org.hl7.fhir.dstu2016may.model.Bundle.BundleType.NULL; + } + } + + public static org.hl7.fhir.r5.model.Bundle.BundleLinkComponent convertBundleLinkComponent(org.hl7.fhir.dstu2016may.model.Bundle.BundleLinkComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Bundle.BundleLinkComponent tgt = new org.hl7.fhir.r5.model.Bundle.BundleLinkComponent(); + copyElement(src, tgt); + tgt.setRelation(src.getRelation()); + tgt.setUrl(src.getUrl()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Bundle.BundleLinkComponent convertBundleLinkComponent(org.hl7.fhir.r5.model.Bundle.BundleLinkComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Bundle.BundleLinkComponent tgt = new org.hl7.fhir.dstu2016may.model.Bundle.BundleLinkComponent(); + copyElement(src, tgt); + tgt.setRelation(src.getRelation()); + tgt.setUrl(src.getUrl()); + return tgt; + } + + public static org.hl7.fhir.r5.model.Bundle.BundleEntryComponent convertBundleEntryComponent(org.hl7.fhir.dstu2016may.model.Bundle.BundleEntryComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Bundle.BundleEntryComponent tgt = new org.hl7.fhir.r5.model.Bundle.BundleEntryComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.dstu2016may.model.Bundle.BundleLinkComponent t : src.getLink()) + tgt.addLink(convertBundleLinkComponent(t)); + if (src.hasFullUrl()) + tgt.setFullUrl(src.getFullUrl()); + tgt.setResource(convertResource(src.getResource())); + tgt.setSearch(convertBundleEntrySearchComponent(src.getSearch())); + tgt.setRequest(convertBundleEntryRequestComponent(src.getRequest())); + tgt.setResponse(convertBundleEntryResponseComponent(src.getResponse())); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Bundle.BundleEntryComponent convertBundleEntryComponent(org.hl7.fhir.r5.model.Bundle.BundleEntryComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Bundle.BundleEntryComponent tgt = new org.hl7.fhir.dstu2016may.model.Bundle.BundleEntryComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.r5.model.Bundle.BundleLinkComponent t : src.getLink()) + tgt.addLink(convertBundleLinkComponent(t)); + if (src.hasFullUrl()) + tgt.setFullUrl(src.getFullUrl()); + tgt.setResource(convertResource(src.getResource())); + tgt.setSearch(convertBundleEntrySearchComponent(src.getSearch())); + tgt.setRequest(convertBundleEntryRequestComponent(src.getRequest())); + tgt.setResponse(convertBundleEntryResponseComponent(src.getResponse())); + return tgt; + } + + public static org.hl7.fhir.r5.model.Bundle.BundleEntrySearchComponent convertBundleEntrySearchComponent(org.hl7.fhir.dstu2016may.model.Bundle.BundleEntrySearchComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Bundle.BundleEntrySearchComponent tgt = new org.hl7.fhir.r5.model.Bundle.BundleEntrySearchComponent(); + copyElement(src, tgt); + tgt.setMode(convertSearchEntryMode(src.getMode())); + if (src.hasScore()) + tgt.setScore(src.getScore()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Bundle.BundleEntrySearchComponent convertBundleEntrySearchComponent(org.hl7.fhir.r5.model.Bundle.BundleEntrySearchComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Bundle.BundleEntrySearchComponent tgt = new org.hl7.fhir.dstu2016may.model.Bundle.BundleEntrySearchComponent(); + copyElement(src, tgt); + tgt.setMode(convertSearchEntryMode(src.getMode())); + if (src.hasScore()) + tgt.setScore(src.getScore()); + return tgt; + } + + private static org.hl7.fhir.r5.model.Bundle.SearchEntryMode convertSearchEntryMode(org.hl7.fhir.dstu2016may.model.Bundle.SearchEntryMode src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case MATCH: return org.hl7.fhir.r5.model.Bundle.SearchEntryMode.MATCH; + case INCLUDE: return org.hl7.fhir.r5.model.Bundle.SearchEntryMode.INCLUDE; + case OUTCOME: return org.hl7.fhir.r5.model.Bundle.SearchEntryMode.OUTCOME; + default: return org.hl7.fhir.r5.model.Bundle.SearchEntryMode.NULL; + } + } + + private static org.hl7.fhir.dstu2016may.model.Bundle.SearchEntryMode convertSearchEntryMode(org.hl7.fhir.r5.model.Bundle.SearchEntryMode src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case MATCH: return org.hl7.fhir.dstu2016may.model.Bundle.SearchEntryMode.MATCH; + case INCLUDE: return org.hl7.fhir.dstu2016may.model.Bundle.SearchEntryMode.INCLUDE; + case OUTCOME: return org.hl7.fhir.dstu2016may.model.Bundle.SearchEntryMode.OUTCOME; + default: return org.hl7.fhir.dstu2016may.model.Bundle.SearchEntryMode.NULL; + } + } + + public static org.hl7.fhir.r5.model.Bundle.BundleEntryRequestComponent convertBundleEntryRequestComponent(org.hl7.fhir.dstu2016may.model.Bundle.BundleEntryRequestComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Bundle.BundleEntryRequestComponent tgt = new org.hl7.fhir.r5.model.Bundle.BundleEntryRequestComponent(); + copyElement(src, tgt); + tgt.setMethod(convertHTTPVerb(src.getMethod())); + tgt.setUrl(src.getUrl()); + if (src.hasIfNoneMatch()) + tgt.setIfNoneMatch(src.getIfNoneMatch()); + if (src.hasIfModifiedSince()) + tgt.setIfModifiedSince(src.getIfModifiedSince()); + if (src.hasIfMatch()) + tgt.setIfMatch(src.getIfMatch()); + if (src.hasIfNoneExist()) + tgt.setIfNoneExist(src.getIfNoneExist()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Bundle.BundleEntryRequestComponent convertBundleEntryRequestComponent(org.hl7.fhir.r5.model.Bundle.BundleEntryRequestComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Bundle.BundleEntryRequestComponent tgt = new org.hl7.fhir.dstu2016may.model.Bundle.BundleEntryRequestComponent(); + copyElement(src, tgt); + tgt.setMethod(convertHTTPVerb(src.getMethod())); + tgt.setUrl(src.getUrl()); + if (src.hasIfNoneMatch()) + tgt.setIfNoneMatch(src.getIfNoneMatch()); + if (src.hasIfModifiedSince()) + tgt.setIfModifiedSince(src.getIfModifiedSince()); + if (src.hasIfMatch()) + tgt.setIfMatch(src.getIfMatch()); + if (src.hasIfNoneExist()) + tgt.setIfNoneExist(src.getIfNoneExist()); + return tgt; + } + + private static org.hl7.fhir.r5.model.Bundle.HTTPVerb convertHTTPVerb(org.hl7.fhir.dstu2016may.model.Bundle.HTTPVerb src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case GET: return org.hl7.fhir.r5.model.Bundle.HTTPVerb.GET; + case POST: return org.hl7.fhir.r5.model.Bundle.HTTPVerb.POST; + case PUT: return org.hl7.fhir.r5.model.Bundle.HTTPVerb.PUT; + case DELETE: return org.hl7.fhir.r5.model.Bundle.HTTPVerb.DELETE; + default: return org.hl7.fhir.r5.model.Bundle.HTTPVerb.NULL; + } + } + + private static org.hl7.fhir.dstu2016may.model.Bundle.HTTPVerb convertHTTPVerb(org.hl7.fhir.r5.model.Bundle.HTTPVerb src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case GET: return org.hl7.fhir.dstu2016may.model.Bundle.HTTPVerb.GET; + case POST: return org.hl7.fhir.dstu2016may.model.Bundle.HTTPVerb.POST; + case PUT: return org.hl7.fhir.dstu2016may.model.Bundle.HTTPVerb.PUT; + case DELETE: return org.hl7.fhir.dstu2016may.model.Bundle.HTTPVerb.DELETE; + default: return org.hl7.fhir.dstu2016may.model.Bundle.HTTPVerb.NULL; + } + } + + public static org.hl7.fhir.r5.model.Bundle.BundleEntryResponseComponent convertBundleEntryResponseComponent(org.hl7.fhir.dstu2016may.model.Bundle.BundleEntryResponseComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Bundle.BundleEntryResponseComponent tgt = new org.hl7.fhir.r5.model.Bundle.BundleEntryResponseComponent(); + copyElement(src, tgt); + tgt.setStatus(src.getStatus()); + if (src.hasLocation()) + tgt.setLocation(src.getLocation()); + if (src.hasEtag()) + tgt.setEtag(src.getEtag()); + if (src.hasLastModified()) + tgt.setLastModified(src.getLastModified()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Bundle.BundleEntryResponseComponent convertBundleEntryResponseComponent(org.hl7.fhir.r5.model.Bundle.BundleEntryResponseComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Bundle.BundleEntryResponseComponent tgt = new org.hl7.fhir.dstu2016may.model.Bundle.BundleEntryResponseComponent(); + copyElement(src, tgt); + tgt.setStatus(src.getStatus()); + if (src.hasLocation()) + tgt.setLocation(src.getLocation()); + if (src.hasEtag()) + tgt.setEtag(src.getEtag()); + if (src.hasLastModified()) + tgt.setLastModified(src.getLastModified()); + return tgt; + } + + public static org.hl7.fhir.r5.model.Enumerations.PublicationStatus convertConformanceResourceStatus(org.hl7.fhir.dstu2016may.model.Enumerations.ConformanceResourceStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case DRAFT: return org.hl7.fhir.r5.model.Enumerations.PublicationStatus.DRAFT; + case ACTIVE: return org.hl7.fhir.r5.model.Enumerations.PublicationStatus.ACTIVE; + case RETIRED: return org.hl7.fhir.r5.model.Enumerations.PublicationStatus.RETIRED; + default: return org.hl7.fhir.r5.model.Enumerations.PublicationStatus.NULL; + } + } + + public static org.hl7.fhir.dstu2016may.model.Enumerations.ConformanceResourceStatus convertConformanceResourceStatus(org.hl7.fhir.r5.model.Enumerations.PublicationStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case DRAFT: return org.hl7.fhir.dstu2016may.model.Enumerations.ConformanceResourceStatus.DRAFT; + case ACTIVE: return org.hl7.fhir.dstu2016may.model.Enumerations.ConformanceResourceStatus.ACTIVE; + case RETIRED: return org.hl7.fhir.dstu2016may.model.Enumerations.ConformanceResourceStatus.RETIRED; + default: return org.hl7.fhir.dstu2016may.model.Enumerations.ConformanceResourceStatus.NULL; + } + } + + public static org.hl7.fhir.r5.model.CodeSystem convertCodeSystem(org.hl7.fhir.dstu2016may.model.CodeSystem src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.CodeSystem tgt = new org.hl7.fhir.r5.model.CodeSystem(); + copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + if (src.hasIdentifier()) + tgt.addIdentifier(convertIdentifier(src.getIdentifier())); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasName()) + tgt.setName(src.getName()); + tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemContactComponent t : src.getContact()) + tgt.addContact(convertCodeSystemContactComponent(t)); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu2016may.model.CodeableConcept t : src.getUseContext()) + if (isJurisdiction(t)) + tgt.addJurisdiction(convertCodeableConcept(t)); + else + tgt.addUseContext(convertCodeableConceptToUsageContext(t)); + if (src.hasRequirements()) + tgt.setPurpose(src.getRequirements()); + if (src.hasCopyright()) + tgt.setCopyright(src.getCopyright()); + if (src.hasCaseSensitive()) + tgt.setCaseSensitive(src.getCaseSensitive()); + if (src.hasValueSet()) + tgt.setValueSet(src.getValueSet()); + if (src.hasCompositional()) + tgt.setCompositional(src.getCompositional()); + if (src.hasVersionNeeded()) + tgt.setVersionNeeded(src.getVersionNeeded()); + tgt.setContent(convertCodeSystemContentMode(src.getContent())); + if (src.hasCount()) + tgt.setCount(src.getCount()); + for (org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemFilterComponent t : src.getFilter()) + tgt.addFilter(convertCodeSystemFilterComponent(t)); + for (org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemPropertyComponent t : src.getProperty()) + tgt.addProperty(convertPropertyComponent(t)); + for (org.hl7.fhir.dstu2016may.model.CodeSystem.ConceptDefinitionComponent t : src.getConcept()) + tgt.addConcept(convertConceptDefinitionComponent(t)); + return tgt; + } + + + private static boolean isJurisdiction(CodeableConcept t) { + return t.hasCoding() && ("http://unstats.un.org/unsd/methods/m49/m49.htm".equals(t.getCoding().get(0).getSystem()) || "urn:iso:std:iso:3166".equals(t.getCoding().get(0).getSystem()) + || "https://www.usps.com/".equals(t.getCoding().get(0).getSystem())); + } + + public static org.hl7.fhir.r5.model.UsageContext convertCodeableConceptToUsageContext(org.hl7.fhir.dstu2016may.model.CodeableConcept t) throws FHIRException { + org.hl7.fhir.r5.model.UsageContext result = new org.hl7.fhir.r5.model.UsageContext(); + // todo: set type.. + result.setValue(convertCodeableConcept(t)); + return result; + } + + public static org.hl7.fhir.dstu2016may.model.CodeSystem convertCodeSystem(org.hl7.fhir.r5.model.CodeSystem src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.CodeSystem tgt = new org.hl7.fhir.dstu2016may.model.CodeSystem(); + copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + if (src.hasIdentifier()) + tgt.setIdentifier(convertIdentifier(src.getIdentifierFirstRep())); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasName()) + tgt.setName(src.getName()); + tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.r5.model.ContactDetail t : src.getContact()) + tgt.addContact(convertCodeSystemContactComponent(t)); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.r5.model.UsageContext t : src.getUseContext()) + if (t.hasValueCodeableConcept()) + tgt.addUseContext(convertCodeableConcept(t.getValueCodeableConcept())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getJurisdiction()) + tgt.addUseContext(convertCodeableConcept(t)); + if (src.hasPurpose()) + tgt.setRequirements(src.getPurpose()); + if (src.hasCopyright()) + tgt.setCopyright(src.getCopyright()); + if (src.hasCaseSensitive()) + tgt.setCaseSensitive(src.getCaseSensitive()); + if (src.hasValueSet()) + tgt.setValueSet(src.getValueSet()); + if (src.hasCompositional()) + tgt.setCompositional(src.getCompositional()); + if (src.hasVersionNeeded()) + tgt.setVersionNeeded(src.getVersionNeeded()); + tgt.setContent(convertCodeSystemContentMode(src.getContent())); + if (src.hasCount()) + tgt.setCount(src.getCount()); + for (org.hl7.fhir.r5.model.CodeSystem.CodeSystemFilterComponent t : src.getFilter()) + tgt.addFilter(convertCodeSystemFilterComponent(t)); + for (org.hl7.fhir.r5.model.CodeSystem.PropertyComponent t : src.getProperty()) + tgt.addProperty(convertPropertyComponent(t)); + for (org.hl7.fhir.r5.model.CodeSystem.ConceptDefinitionComponent t : src.getConcept()) + tgt.addConcept(convertConceptDefinitionComponent(t)); + return tgt; + } + + private static org.hl7.fhir.r5.model.CodeSystem.CodeSystemContentMode convertCodeSystemContentMode(org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemContentMode src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case NOTPRESENT: return org.hl7.fhir.r5.model.CodeSystem.CodeSystemContentMode.NOTPRESENT; + case EXAMPLAR: return org.hl7.fhir.r5.model.CodeSystem.CodeSystemContentMode.EXAMPLE; + case FRAGMENT: return org.hl7.fhir.r5.model.CodeSystem.CodeSystemContentMode.FRAGMENT; + case COMPLETE: return org.hl7.fhir.r5.model.CodeSystem.CodeSystemContentMode.COMPLETE; + default: return org.hl7.fhir.r5.model.CodeSystem.CodeSystemContentMode.NULL; + } +} + + private static org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemContentMode convertCodeSystemContentMode(org.hl7.fhir.r5.model.CodeSystem.CodeSystemContentMode src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case NOTPRESENT: return org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemContentMode.NOTPRESENT; + case EXAMPLE: return org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemContentMode.EXAMPLAR; + case FRAGMENT: return org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemContentMode.FRAGMENT; + case COMPLETE: return org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemContentMode.COMPLETE; + default: return org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemContentMode.NULL; + } +} + + public static org.hl7.fhir.r5.model.ContactDetail convertCodeSystemContactComponent(org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemContactComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.ContactDetail tgt = new org.hl7.fhir.r5.model.ContactDetail(); + copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + for (org.hl7.fhir.dstu2016may.model.ContactPoint t : src.getTelecom()) + tgt.addTelecom(convertContactPoint(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemContactComponent convertCodeSystemContactComponent(org.hl7.fhir.r5.model.ContactDetail src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemContactComponent tgt = new org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemContactComponent(); + copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + for (org.hl7.fhir.r5.model.ContactPoint t : src.getTelecom()) + tgt.addTelecom(convertContactPoint(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.CodeSystem.CodeSystemFilterComponent convertCodeSystemFilterComponent(org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemFilterComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.CodeSystem.CodeSystemFilterComponent tgt = new org.hl7.fhir.r5.model.CodeSystem.CodeSystemFilterComponent(); + copyElement(src, tgt); + tgt.setCode(src.getCode()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu2016may.model.CodeType t : src.getOperator()) + try { + tgt.addOperator(CodeSystem.FilterOperator.fromCode(t.getValue())); + } catch (org.hl7.fhir.exceptions.FHIRException e) { + throw new FHIRException(e); + } + tgt.setValue(src.getValue()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemFilterComponent convertCodeSystemFilterComponent(org.hl7.fhir.r5.model.CodeSystem.CodeSystemFilterComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemFilterComponent tgt = new org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemFilterComponent(); + copyElement(src, tgt); + tgt.setCode(src.getCode()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (Enumeration t : src.getOperator()) + tgt.addOperator(t.getValue().toCode()); + tgt.setValue(src.getValue()); + return tgt; + } + + public static org.hl7.fhir.r5.model.CodeSystem.PropertyComponent convertPropertyComponent(org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemPropertyComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.CodeSystem.PropertyComponent tgt = new org.hl7.fhir.r5.model.CodeSystem.PropertyComponent(); + copyElement(src, tgt); + tgt.setCode(src.getCode()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + tgt.setType(convertPropertyType(src.getType())); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemPropertyComponent convertPropertyComponent(org.hl7.fhir.r5.model.CodeSystem.PropertyComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemPropertyComponent tgt = new org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemPropertyComponent(); + copyElement(src, tgt); + tgt.setCode(src.getCode()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + tgt.setType(convertPropertyType(src.getType())); + return tgt; + } + + private static org.hl7.fhir.r5.model.CodeSystem.PropertyType convertPropertyType(org.hl7.fhir.dstu2016may.model.CodeSystem.PropertyType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case CODE: return org.hl7.fhir.r5.model.CodeSystem.PropertyType.CODE; + case CODING: return org.hl7.fhir.r5.model.CodeSystem.PropertyType.CODING; + case STRING: return org.hl7.fhir.r5.model.CodeSystem.PropertyType.STRING; + case INTEGER: return org.hl7.fhir.r5.model.CodeSystem.PropertyType.INTEGER; + case BOOLEAN: return org.hl7.fhir.r5.model.CodeSystem.PropertyType.BOOLEAN; + case DATETIME: return org.hl7.fhir.r5.model.CodeSystem.PropertyType.DATETIME; + default: return org.hl7.fhir.r5.model.CodeSystem.PropertyType.NULL; + } +} + + private static org.hl7.fhir.dstu2016may.model.CodeSystem.PropertyType convertPropertyType(org.hl7.fhir.r5.model.CodeSystem.PropertyType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case CODE: return org.hl7.fhir.dstu2016may.model.CodeSystem.PropertyType.CODE; + case CODING: return org.hl7.fhir.dstu2016may.model.CodeSystem.PropertyType.CODING; + case STRING: return org.hl7.fhir.dstu2016may.model.CodeSystem.PropertyType.STRING; + case INTEGER: return org.hl7.fhir.dstu2016may.model.CodeSystem.PropertyType.INTEGER; + case BOOLEAN: return org.hl7.fhir.dstu2016may.model.CodeSystem.PropertyType.BOOLEAN; + case DATETIME: return org.hl7.fhir.dstu2016may.model.CodeSystem.PropertyType.DATETIME; + default: return org.hl7.fhir.dstu2016may.model.CodeSystem.PropertyType.NULL; + } +} + + public static org.hl7.fhir.r5.model.CodeSystem.ConceptDefinitionComponent convertConceptDefinitionComponent(org.hl7.fhir.dstu2016may.model.CodeSystem.ConceptDefinitionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.CodeSystem.ConceptDefinitionComponent tgt = new org.hl7.fhir.r5.model.CodeSystem.ConceptDefinitionComponent(); + copyElement(src, tgt); + tgt.setCode(src.getCode()); + if (src.hasDisplay()) + tgt.setDisplay(src.getDisplay()); + if (src.hasDefinition()) + tgt.setDefinition(src.getDefinition()); + for (org.hl7.fhir.dstu2016may.model.CodeSystem.ConceptDefinitionDesignationComponent t : src.getDesignation()) + tgt.addDesignation(convertConceptDefinitionDesignationComponent(t)); + for (ConceptDefinitionPropertyComponent t : src.getProperty()) + tgt.addProperty(convertConceptPropertyComponent(t)); + for (org.hl7.fhir.dstu2016may.model.CodeSystem.ConceptDefinitionComponent t : src.getConcept()) + tgt.addConcept(convertConceptDefinitionComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.CodeSystem.ConceptDefinitionComponent convertConceptDefinitionComponent(org.hl7.fhir.r5.model.CodeSystem.ConceptDefinitionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.CodeSystem.ConceptDefinitionComponent tgt = new org.hl7.fhir.dstu2016may.model.CodeSystem.ConceptDefinitionComponent(); + copyElement(src, tgt); + tgt.setCode(src.getCode()); + if (src.hasDisplay()) + tgt.setDisplay(src.getDisplay()); + if (src.hasDefinition()) + tgt.setDefinition(src.getDefinition()); + for (org.hl7.fhir.r5.model.CodeSystem.ConceptDefinitionDesignationComponent t : src.getDesignation()) + tgt.addDesignation(convertConceptDefinitionDesignationComponent(t)); + for (org.hl7.fhir.r5.model.CodeSystem.ConceptPropertyComponent t : src.getProperty()) + tgt.addProperty(convertConceptPropertyComponent(t)); + for (org.hl7.fhir.r5.model.CodeSystem.ConceptDefinitionComponent t : src.getConcept()) + tgt.addConcept(convertConceptDefinitionComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.CodeSystem.ConceptDefinitionDesignationComponent convertConceptDefinitionDesignationComponent(org.hl7.fhir.dstu2016may.model.CodeSystem.ConceptDefinitionDesignationComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.CodeSystem.ConceptDefinitionDesignationComponent tgt = new org.hl7.fhir.r5.model.CodeSystem.ConceptDefinitionDesignationComponent(); + copyElement(src, tgt); + if (src.hasLanguage()) + tgt.setLanguage(src.getLanguage()); + tgt.setUse(convertCoding(src.getUse())); + tgt.setValue(src.getValue()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.CodeSystem.ConceptDefinitionDesignationComponent convertConceptDefinitionDesignationComponent(org.hl7.fhir.r5.model.CodeSystem.ConceptDefinitionDesignationComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.CodeSystem.ConceptDefinitionDesignationComponent tgt = new org.hl7.fhir.dstu2016may.model.CodeSystem.ConceptDefinitionDesignationComponent(); + copyElement(src, tgt); + if (src.hasLanguage()) + tgt.setLanguage(src.getLanguage()); + tgt.setUse(convertCoding(src.getUse())); + tgt.setValue(src.getValue()); + return tgt; + } + + public static org.hl7.fhir.r5.model.CodeSystem.ConceptPropertyComponent convertConceptPropertyComponent(org.hl7.fhir.dstu2016may.model.CodeSystem.ConceptDefinitionPropertyComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.CodeSystem.ConceptPropertyComponent tgt = new org.hl7.fhir.r5.model.CodeSystem.ConceptPropertyComponent(); + copyElement(src, tgt); + tgt.setCode(src.getCode()); + tgt.setValue(convertType(src.getValue())); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.CodeSystem.ConceptDefinitionPropertyComponent convertConceptPropertyComponent(org.hl7.fhir.r5.model.CodeSystem.ConceptPropertyComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.CodeSystem.ConceptDefinitionPropertyComponent tgt = new org.hl7.fhir.dstu2016may.model.CodeSystem.ConceptDefinitionPropertyComponent(); + copyElement(src, tgt); + tgt.setCode(src.getCode()); + tgt.setValue(convertType(src.getValue())); + return tgt; + } + + public static org.hl7.fhir.r5.model.CompartmentDefinition convertCompartmentDefinition(org.hl7.fhir.dstu2016may.model.CompartmentDefinition src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.CompartmentDefinition tgt = new org.hl7.fhir.r5.model.CompartmentDefinition(); + copyDomainResource(src, tgt); + tgt.setUrl(src.getUrl()); + tgt.setName(src.getName()); + tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.dstu2016may.model.CompartmentDefinition.CompartmentDefinitionContactComponent t : src.getContact()) + tgt.addContact(convertCompartmentDefinitionContactComponent(t)); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + if (src.hasRequirements()) + tgt.setPurpose(src.getRequirements()); + tgt.setCode(convertCompartmentType(src.getCode())); + tgt.setSearch(src.getSearch()); + for (org.hl7.fhir.dstu2016may.model.CompartmentDefinition.CompartmentDefinitionResourceComponent t : src.getResource()) + tgt.addResource(convertCompartmentDefinitionResourceComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.CompartmentDefinition convertCompartmentDefinition(org.hl7.fhir.r5.model.CompartmentDefinition src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.CompartmentDefinition tgt = new org.hl7.fhir.dstu2016may.model.CompartmentDefinition(); + copyDomainResource(src, tgt); + tgt.setUrl(src.getUrl()); + tgt.setName(src.getName()); + tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.r5.model.ContactDetail t : src.getContact()) + tgt.addContact(convertCompartmentDefinitionContactComponent(t)); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + if (src.hasPurpose()) + tgt.setRequirements(src.getPurpose()); + tgt.setCode(convertCompartmentType(src.getCode())); + tgt.setSearch(src.getSearch()); + for (org.hl7.fhir.r5.model.CompartmentDefinition.CompartmentDefinitionResourceComponent t : src.getResource()) + tgt.addResource(convertCompartmentDefinitionResourceComponent(t)); + return tgt; + } + + private static org.hl7.fhir.r5.model.CompartmentDefinition.CompartmentType convertCompartmentType(org.hl7.fhir.dstu2016may.model.CompartmentDefinition.CompartmentType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PATIENT: return org.hl7.fhir.r5.model.CompartmentDefinition.CompartmentType.PATIENT; + case ENCOUNTER: return org.hl7.fhir.r5.model.CompartmentDefinition.CompartmentType.ENCOUNTER; + case RELATEDPERSON: return org.hl7.fhir.r5.model.CompartmentDefinition.CompartmentType.RELATEDPERSON; + case PRACTITIONER: return org.hl7.fhir.r5.model.CompartmentDefinition.CompartmentType.PRACTITIONER; + case DEVICE: return org.hl7.fhir.r5.model.CompartmentDefinition.CompartmentType.DEVICE; + default: return org.hl7.fhir.r5.model.CompartmentDefinition.CompartmentType.NULL; + } +} + + private static org.hl7.fhir.dstu2016may.model.CompartmentDefinition.CompartmentType convertCompartmentType(org.hl7.fhir.r5.model.CompartmentDefinition.CompartmentType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PATIENT: return org.hl7.fhir.dstu2016may.model.CompartmentDefinition.CompartmentType.PATIENT; + case ENCOUNTER: return org.hl7.fhir.dstu2016may.model.CompartmentDefinition.CompartmentType.ENCOUNTER; + case RELATEDPERSON: return org.hl7.fhir.dstu2016may.model.CompartmentDefinition.CompartmentType.RELATEDPERSON; + case PRACTITIONER: return org.hl7.fhir.dstu2016may.model.CompartmentDefinition.CompartmentType.PRACTITIONER; + case DEVICE: return org.hl7.fhir.dstu2016may.model.CompartmentDefinition.CompartmentType.DEVICE; + default: return org.hl7.fhir.dstu2016may.model.CompartmentDefinition.CompartmentType.NULL; + } +} + + public static org.hl7.fhir.r5.model.ContactDetail convertCompartmentDefinitionContactComponent(org.hl7.fhir.dstu2016may.model.CompartmentDefinition.CompartmentDefinitionContactComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.ContactDetail tgt = new org.hl7.fhir.r5.model.ContactDetail(); + copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + for (org.hl7.fhir.dstu2016may.model.ContactPoint t : src.getTelecom()) + tgt.addTelecom(convertContactPoint(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.CompartmentDefinition.CompartmentDefinitionContactComponent convertCompartmentDefinitionContactComponent(org.hl7.fhir.r5.model.ContactDetail src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.CompartmentDefinition.CompartmentDefinitionContactComponent tgt = new org.hl7.fhir.dstu2016may.model.CompartmentDefinition.CompartmentDefinitionContactComponent(); + copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + for (org.hl7.fhir.r5.model.ContactPoint t : src.getTelecom()) + tgt.addTelecom(convertContactPoint(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.CompartmentDefinition.CompartmentDefinitionResourceComponent convertCompartmentDefinitionResourceComponent(org.hl7.fhir.dstu2016may.model.CompartmentDefinition.CompartmentDefinitionResourceComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.CompartmentDefinition.CompartmentDefinitionResourceComponent tgt = new org.hl7.fhir.r5.model.CompartmentDefinition.CompartmentDefinitionResourceComponent(); + copyElement(src, tgt); + tgt.setCode(src.getCode()); + for (org.hl7.fhir.dstu2016may.model.StringType t : src.getParam()) + tgt.addParam(t.getValue()); + if (src.hasDocumentation()) + tgt.setDocumentation(src.getDocumentation()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.CompartmentDefinition.CompartmentDefinitionResourceComponent convertCompartmentDefinitionResourceComponent(org.hl7.fhir.r5.model.CompartmentDefinition.CompartmentDefinitionResourceComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.CompartmentDefinition.CompartmentDefinitionResourceComponent tgt = new org.hl7.fhir.dstu2016may.model.CompartmentDefinition.CompartmentDefinitionResourceComponent(); + copyElement(src, tgt); + tgt.setCode(src.getCode()); + for (org.hl7.fhir.r5.model.StringType t : src.getParam()) + tgt.addParam(t.getValue()); + if (src.hasDocumentation()) + tgt.setDocumentation(src.getDocumentation()); + return tgt; + } + + + public static org.hl7.fhir.r5.model.ConceptMap convertConceptMap(org.hl7.fhir.dstu2016may.model.ConceptMap src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.ConceptMap tgt = new org.hl7.fhir.r5.model.ConceptMap(); + copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + tgt.setIdentifier(convertIdentifier(src.getIdentifier())); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasName()) + tgt.setName(src.getName()); + tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.dstu2016may.model.ConceptMap.ConceptMapContactComponent t : src.getContact()) + tgt.addContact(convertConceptMapContactComponent(t)); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu2016may.model.CodeableConcept t : src.getUseContext()) + if (isJurisdiction(t)) + tgt.addJurisdiction(convertCodeableConcept(t)); + else + tgt.addUseContext(convertCodeableConceptToUsageContext(t)); + if (src.hasRequirements()) + tgt.setPurpose(src.getRequirements()); + if (src.hasCopyright()) + tgt.setCopyright(src.getCopyright()); + org.hl7.fhir.r5.model.Type tt = convertType(src.getSource()); + tgt.setSource(tt instanceof org.hl7.fhir.r5.model.Reference ? new CanonicalType(((org.hl7.fhir.r5.model.Reference) tt).getReference()) : tt); + tt = convertType(src.getTarget()); + tgt.setTarget(tt instanceof org.hl7.fhir.r5.model.Reference ? new CanonicalType(((org.hl7.fhir.r5.model.Reference) tt).getReference()) : tt); + for (org.hl7.fhir.dstu2016may.model.ConceptMap.SourceElementComponent t : src.getElement()) { + List ws = convertSourceElementComponent(t); + for (SourceElementComponentWrapper w : ws) + getGroup(tgt, w.source, w.target).addElement(w.comp); + } + return tgt; + } + + private static ConceptMapGroupComponent getGroup(ConceptMap map, String srcs, String tgts) { + for (ConceptMapGroupComponent grp : map.getGroup()) { + if (grp.getSource().equals(srcs) && grp.getTarget().equals(tgts)) + return grp; + } + ConceptMapGroupComponent grp = map.addGroup(); + grp.setSource(srcs); + grp.setTarget(tgts); + return grp; + } + + + public static org.hl7.fhir.dstu2016may.model.ConceptMap convertConceptMap(org.hl7.fhir.r5.model.ConceptMap src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.ConceptMap tgt = new org.hl7.fhir.dstu2016may.model.ConceptMap(); + copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + tgt.setIdentifier(convertIdentifier(src.getIdentifier())); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasName()) + tgt.setName(src.getName()); + tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.r5.model.ContactDetail t : src.getContact()) + tgt.addContact(convertConceptMapContactComponent(t)); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.r5.model.UsageContext t : src.getUseContext()) + if (t.hasValueCodeableConcept()) + tgt.addUseContext(convertCodeableConcept(t.getValueCodeableConcept())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getJurisdiction()) + tgt.addUseContext(convertCodeableConcept(t)); + if (src.hasPurpose()) + tgt.setRequirements(src.getPurpose()); + if (src.hasCopyright()) + tgt.setCopyright(src.getCopyright()); + if (src.getSource() instanceof CanonicalType) + tgt.setSource(convertCanonicalToReference((CanonicalType)src.getSource())); + else + tgt.setSource(convertType(src.getSource())); + if (src.getTarget() instanceof CanonicalType) + tgt.setTarget(convertCanonicalToReference((CanonicalType)src.getTarget())); + else + tgt.setTarget(convertType(src.getTarget())); + tgt.setSource(convertType(src.getSource())); + tgt.setTarget(convertType(src.getTarget())); + for (org.hl7.fhir.r5.model.ConceptMap.ConceptMapGroupComponent g : src.getGroup()) + for (org.hl7.fhir.r5.model.ConceptMap.SourceElementComponent t : g.getElement()) + tgt.addElement(convertSourceElementComponent(t, g)); + return tgt; + } + + + public static org.hl7.fhir.r5.model.ContactDetail convertConceptMapContactComponent(org.hl7.fhir.dstu2016may.model.ConceptMap.ConceptMapContactComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.ContactDetail tgt = new org.hl7.fhir.r5.model.ContactDetail(); + copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + for (org.hl7.fhir.dstu2016may.model.ContactPoint t : src.getTelecom()) + tgt.addTelecom(convertContactPoint(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.ConceptMap.ConceptMapContactComponent convertConceptMapContactComponent(org.hl7.fhir.r5.model.ContactDetail src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.ConceptMap.ConceptMapContactComponent tgt = new org.hl7.fhir.dstu2016may.model.ConceptMap.ConceptMapContactComponent(); + copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + for (org.hl7.fhir.r5.model.ContactPoint t : src.getTelecom()) + tgt.addTelecom(convertContactPoint(t)); + return tgt; + } + + private static class SourceElementComponentWrapper { + public SourceElementComponentWrapper(SourceElementComponent comp, String source, String target) { + super(); + this.source = source; + this.target = target; + this.comp = comp; + } + private String source; + private String target; + private org.hl7.fhir.r5.model.ConceptMap.SourceElementComponent comp; + + } + public static List convertSourceElementComponent(org.hl7.fhir.dstu2016may.model.ConceptMap.SourceElementComponent src) throws FHIRException { + List res = new ArrayList(); + if (src == null || src.isEmpty()) + return res; + for (org.hl7.fhir.dstu2016may.model.ConceptMap.TargetElementComponent t : src.getTarget()) { + org.hl7.fhir.r5.model.ConceptMap.SourceElementComponent tgt = new org.hl7.fhir.r5.model.ConceptMap.SourceElementComponent(); + copyElement(src, tgt); + if (src.hasCode()) + tgt.setCode(src.getCode()); + tgt.addTarget(convertTargetElementComponent(t)); + res.add(new SourceElementComponentWrapper(tgt, src.getSystem(), t.getSystem())); + } + return res; + } + + public static org.hl7.fhir.dstu2016may.model.ConceptMap.SourceElementComponent convertSourceElementComponent(org.hl7.fhir.r5.model.ConceptMap.SourceElementComponent src, org.hl7.fhir.r5.model.ConceptMap.ConceptMapGroupComponent g) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.ConceptMap.SourceElementComponent tgt = new org.hl7.fhir.dstu2016may.model.ConceptMap.SourceElementComponent(); + copyElement(src, tgt); + if (g.hasSource()) + tgt.setSystem(g.getSource()); + if (src.hasCode()) + tgt.setCode(src.getCode()); + for (org.hl7.fhir.r5.model.ConceptMap.TargetElementComponent t : src.getTarget()) + tgt.addTarget(convertTargetElementComponent(t, g)); + return tgt; + } + + public static org.hl7.fhir.r5.model.ConceptMap.TargetElementComponent convertTargetElementComponent(org.hl7.fhir.dstu2016may.model.ConceptMap.TargetElementComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.ConceptMap.TargetElementComponent tgt = new org.hl7.fhir.r5.model.ConceptMap.TargetElementComponent(); + copyElement(src, tgt); + if (src.hasCode()) + tgt.setCode(src.getCode()); + tgt.setEquivalence(convertConceptMapEquivalence(src.getEquivalence())); + if (src.hasComments()) + tgt.setComment(src.getComments()); + for (org.hl7.fhir.dstu2016may.model.ConceptMap.OtherElementComponent t : src.getDependsOn()) + tgt.addDependsOn(convertOtherElementComponent(t)); + for (org.hl7.fhir.dstu2016may.model.ConceptMap.OtherElementComponent t : src.getProduct()) + tgt.addProduct(convertOtherElementComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.ConceptMap.TargetElementComponent convertTargetElementComponent(org.hl7.fhir.r5.model.ConceptMap.TargetElementComponent src, org.hl7.fhir.r5.model.ConceptMap.ConceptMapGroupComponent g) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.ConceptMap.TargetElementComponent tgt = new org.hl7.fhir.dstu2016may.model.ConceptMap.TargetElementComponent(); + copyElement(src, tgt); + if (g.hasTarget()) + tgt.setSystem(g.getTarget()); + if (src.hasCode()) + tgt.setCode(src.getCode()); + tgt.setEquivalence(convertConceptMapEquivalence(src.getEquivalence())); + if (src.hasComment()) + tgt.setComments(src.getComment()); + for (org.hl7.fhir.r5.model.ConceptMap.OtherElementComponent t : src.getDependsOn()) + tgt.addDependsOn(convertOtherElementComponent(t)); + for (org.hl7.fhir.r5.model.ConceptMap.OtherElementComponent t : src.getProduct()) + tgt.addProduct(convertOtherElementComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.Enumerations.ConceptMapEquivalence convertConceptMapEquivalence(org.hl7.fhir.dstu2016may.model.Enumerations.ConceptMapEquivalence src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case EQUIVALENT: return org.hl7.fhir.r5.model.Enumerations.ConceptMapEquivalence.EQUIVALENT; + case EQUAL: return org.hl7.fhir.r5.model.Enumerations.ConceptMapEquivalence.EQUAL; + case WIDER: return org.hl7.fhir.r5.model.Enumerations.ConceptMapEquivalence.WIDER; + case SUBSUMES: return org.hl7.fhir.r5.model.Enumerations.ConceptMapEquivalence.SUBSUMES; + case NARROWER: return org.hl7.fhir.r5.model.Enumerations.ConceptMapEquivalence.NARROWER; + case SPECIALIZES: return org.hl7.fhir.r5.model.Enumerations.ConceptMapEquivalence.SPECIALIZES; + case INEXACT: return org.hl7.fhir.r5.model.Enumerations.ConceptMapEquivalence.INEXACT; + case UNMATCHED: return org.hl7.fhir.r5.model.Enumerations.ConceptMapEquivalence.UNMATCHED; + case DISJOINT: return org.hl7.fhir.r5.model.Enumerations.ConceptMapEquivalence.DISJOINT; + default: return org.hl7.fhir.r5.model.Enumerations.ConceptMapEquivalence.NULL; + } + } + + public static org.hl7.fhir.dstu2016may.model.Enumerations.ConceptMapEquivalence convertConceptMapEquivalence(org.hl7.fhir.r5.model.Enumerations.ConceptMapEquivalence src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case EQUIVALENT: return org.hl7.fhir.dstu2016may.model.Enumerations.ConceptMapEquivalence.EQUIVALENT; + case EQUAL: return org.hl7.fhir.dstu2016may.model.Enumerations.ConceptMapEquivalence.EQUAL; + case WIDER: return org.hl7.fhir.dstu2016may.model.Enumerations.ConceptMapEquivalence.WIDER; + case SUBSUMES: return org.hl7.fhir.dstu2016may.model.Enumerations.ConceptMapEquivalence.SUBSUMES; + case NARROWER: return org.hl7.fhir.dstu2016may.model.Enumerations.ConceptMapEquivalence.NARROWER; + case SPECIALIZES: return org.hl7.fhir.dstu2016may.model.Enumerations.ConceptMapEquivalence.SPECIALIZES; + case INEXACT: return org.hl7.fhir.dstu2016may.model.Enumerations.ConceptMapEquivalence.INEXACT; + case UNMATCHED: return org.hl7.fhir.dstu2016may.model.Enumerations.ConceptMapEquivalence.UNMATCHED; + case DISJOINT: return org.hl7.fhir.dstu2016may.model.Enumerations.ConceptMapEquivalence.DISJOINT; + default: return org.hl7.fhir.dstu2016may.model.Enumerations.ConceptMapEquivalence.NULL; + } + } + + public static org.hl7.fhir.r5.model.ConceptMap.OtherElementComponent convertOtherElementComponent(org.hl7.fhir.dstu2016may.model.ConceptMap.OtherElementComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.ConceptMap.OtherElementComponent tgt = new org.hl7.fhir.r5.model.ConceptMap.OtherElementComponent(); + copyElement(src, tgt); + tgt.setProperty(src.getElement()); + tgt.setSystem(src.getSystem()); + tgt.setValue(src.getCode()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.ConceptMap.OtherElementComponent convertOtherElementComponent(org.hl7.fhir.r5.model.ConceptMap.OtherElementComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.ConceptMap.OtherElementComponent tgt = new org.hl7.fhir.dstu2016may.model.ConceptMap.OtherElementComponent(); + copyElement(src, tgt); + tgt.setElement(src.getProperty()); + tgt.setSystem(src.getSystem()); + tgt.setCode(src.getValue()); + return tgt; + } + + + public static org.hl7.fhir.r5.model.CapabilityStatement convertConformance(org.hl7.fhir.dstu2016may.model.Conformance src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.CapabilityStatement tgt = new org.hl7.fhir.r5.model.CapabilityStatement(); + copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasName()) + tgt.setName(src.getName()); + tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.dstu2016may.model.Conformance.ConformanceContactComponent t : src.getContact()) + tgt.addContact(convertConformanceContactComponent(t)); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu2016may.model.CodeableConcept t : src.getUseContext()) + if (isJurisdiction(t)) + tgt.addJurisdiction(convertCodeableConcept(t)); + else + tgt.addUseContext(convertCodeableConceptToUsageContext(t)); + if (src.hasRequirements()) + tgt.setPurpose(src.getRequirements()); + if (src.hasCopyright()) + tgt.setCopyright(src.getCopyright()); + tgt.setKind(convertConformanceStatementKind(src.getKind())); + tgt.setSoftware(convertConformanceSoftwareComponent(src.getSoftware())); + tgt.setImplementation(convertConformanceImplementationComponent(src.getImplementation())); + tgt.setFhirVersion(org.hl7.fhir.r5.model.Enumerations.FHIRVersion.fromCode(src.getFhirVersion())); +// tgt.setAcceptUnknown(convertUnknownContentCode(src.getAcceptUnknown())); + for (org.hl7.fhir.dstu2016may.model.CodeType t : src.getFormat()) + tgt.addFormat(t.getValue()); +// for (org.hl7.fhir.dstu2016may.model.Reference t : src.getProfile()) +// tgt.addProfile(convertReference(t)); + for (org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestComponent t : src.getRest()) + tgt.addRest(convertConformanceRestComponent(t)); + for (org.hl7.fhir.dstu2016may.model.Conformance.ConformanceMessagingComponent t : src.getMessaging()) + tgt.addMessaging(convertConformanceMessagingComponent(t)); + for (org.hl7.fhir.dstu2016may.model.Conformance.ConformanceDocumentComponent t : src.getDocument()) + tgt.addDocument(convertConformanceDocumentComponent(t)); + return tgt; + } + + private static CanonicalType convertReferenceToCanonical(Reference src) throws FHIRException { + CanonicalType dst = new CanonicalType(src.getReference()); + copyElement(src, dst); + return dst; + } + + private static Reference convertCanonicalToReference(CanonicalType src) throws FHIRException { + Reference dst = new Reference(src.getValue()); + copyElement(src, dst); + return dst; + } + + public static org.hl7.fhir.dstu2016may.model.Conformance convertConformance(org.hl7.fhir.r5.model.CapabilityStatement src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Conformance tgt = new org.hl7.fhir.dstu2016may.model.Conformance(); + copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasName()) + tgt.setName(src.getName()); + tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.r5.model.ContactDetail t : src.getContact()) + tgt.addContact(convertConformanceContactComponent(t)); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.r5.model.UsageContext t : src.getUseContext()) + if (t.hasValueCodeableConcept()) + tgt.addUseContext(convertCodeableConcept(t.getValueCodeableConcept())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getJurisdiction()) + tgt.addUseContext(convertCodeableConcept(t)); + if (src.hasPurpose()) + tgt.setRequirements(src.getPurpose()); + if (src.hasCopyright()) + tgt.setCopyright(src.getCopyright()); + tgt.setKind(convertConformanceStatementKind(src.getKind())); + tgt.setSoftware(convertConformanceSoftwareComponent(src.getSoftware())); + tgt.setImplementation(convertConformanceImplementationComponent(src.getImplementation())); + tgt.setFhirVersion(src.getFhirVersion().toCode()); +// tgt.setAcceptUnknown(convertUnknownContentCode(src.getAcceptUnknown())); + for (org.hl7.fhir.r5.model.CodeType t : src.getFormat()) + tgt.addFormat(t.getValue()); + for (CapabilityStatementRestComponent r : src.getRest()) + for (CapabilityStatementRestResourceComponent rr : r.getResource()) + for (org.hl7.fhir.r5.model.CanonicalType t : rr.getSupportedProfile()) + tgt.addProfile(convertCanonicalToReference(t)); + for (org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestComponent t : src.getRest()) + tgt.addRest(convertConformanceRestComponent(t)); + for (org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementMessagingComponent t : src.getMessaging()) + tgt.addMessaging(convertConformanceMessagingComponent(t)); + for (org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementDocumentComponent t : src.getDocument()) + tgt.addDocument(convertConformanceDocumentComponent(t)); + return tgt; + } + + private static org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementKind convertConformanceStatementKind(org.hl7.fhir.dstu2016may.model.Conformance.ConformanceStatementKind src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case INSTANCE: return org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementKind.INSTANCE; + case CAPABILITY: return org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementKind.CAPABILITY; + case REQUIREMENTS: return org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementKind.REQUIREMENTS; + default: return org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementKind.NULL; + } + } + + private static org.hl7.fhir.dstu2016may.model.Conformance.ConformanceStatementKind convertConformanceStatementKind(org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementKind src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case INSTANCE: return org.hl7.fhir.dstu2016may.model.Conformance.ConformanceStatementKind.INSTANCE; + case CAPABILITY: return org.hl7.fhir.dstu2016may.model.Conformance.ConformanceStatementKind.CAPABILITY; + case REQUIREMENTS: return org.hl7.fhir.dstu2016may.model.Conformance.ConformanceStatementKind.REQUIREMENTS; + default: return org.hl7.fhir.dstu2016may.model.Conformance.ConformanceStatementKind.NULL; + } + } +// +// private static org.hl7.fhir.r5.model.CapabilityStatement.UnknownContentCode convertUnknownContentCode(org.hl7.fhir.dstu2016may.model.Conformance.UnknownContentCode src) throws FHIRException { +// if (src == null) +// return null; +// switch (src) { +// case NO: return org.hl7.fhir.r5.model.CapabilityStatement.UnknownContentCode.NO; +// case EXTENSIONS: return org.hl7.fhir.r5.model.CapabilityStatement.UnknownContentCode.EXTENSIONS; +// case ELEMENTS: return org.hl7.fhir.r5.model.CapabilityStatement.UnknownContentCode.ELEMENTS; +// case BOTH: return org.hl7.fhir.r5.model.CapabilityStatement.UnknownContentCode.BOTH; +// default: return org.hl7.fhir.r5.model.CapabilityStatement.UnknownContentCode.NULL; +// } +// } +// +// private static org.hl7.fhir.dstu2016may.model.Conformance.UnknownContentCode convertUnknownContentCode(org.hl7.fhir.r5.model.CapabilityStatement.UnknownContentCode src) throws FHIRException { +// if (src == null) +// return null; +// switch (src) { +// case NO: return org.hl7.fhir.dstu2016may.model.Conformance.UnknownContentCode.NO; +// case EXTENSIONS: return org.hl7.fhir.dstu2016may.model.Conformance.UnknownContentCode.EXTENSIONS; +// case ELEMENTS: return org.hl7.fhir.dstu2016may.model.Conformance.UnknownContentCode.ELEMENTS; +// case BOTH: return org.hl7.fhir.dstu2016may.model.Conformance.UnknownContentCode.BOTH; +// default: return org.hl7.fhir.dstu2016may.model.Conformance.UnknownContentCode.NULL; +// } +// } + + public static org.hl7.fhir.r5.model.ContactDetail convertConformanceContactComponent(org.hl7.fhir.dstu2016may.model.Conformance.ConformanceContactComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.ContactDetail tgt = new org.hl7.fhir.r5.model.ContactDetail(); + copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + for (org.hl7.fhir.dstu2016may.model.ContactPoint t : src.getTelecom()) + tgt.addTelecom(convertContactPoint(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Conformance.ConformanceContactComponent convertConformanceContactComponent(org.hl7.fhir.r5.model.ContactDetail src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Conformance.ConformanceContactComponent tgt = new org.hl7.fhir.dstu2016may.model.Conformance.ConformanceContactComponent(); + copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + for (org.hl7.fhir.r5.model.ContactPoint t : src.getTelecom()) + tgt.addTelecom(convertContactPoint(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementSoftwareComponent convertConformanceSoftwareComponent(org.hl7.fhir.dstu2016may.model.Conformance.ConformanceSoftwareComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementSoftwareComponent tgt = new org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementSoftwareComponent(); + copyElement(src, tgt); + tgt.setName(src.getName()); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasReleaseDate()) + tgt.setReleaseDate(src.getReleaseDate()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Conformance.ConformanceSoftwareComponent convertConformanceSoftwareComponent(org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementSoftwareComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Conformance.ConformanceSoftwareComponent tgt = new org.hl7.fhir.dstu2016may.model.Conformance.ConformanceSoftwareComponent(); + copyElement(src, tgt); + tgt.setName(src.getName()); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasReleaseDate()) + tgt.setReleaseDate(src.getReleaseDate()); + return tgt; + } + + public static org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementImplementationComponent convertConformanceImplementationComponent(org.hl7.fhir.dstu2016may.model.Conformance.ConformanceImplementationComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementImplementationComponent tgt = new org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementImplementationComponent(); + copyElement(src, tgt); + tgt.setDescription(src.getDescription()); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Conformance.ConformanceImplementationComponent convertConformanceImplementationComponent(org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementImplementationComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Conformance.ConformanceImplementationComponent tgt = new org.hl7.fhir.dstu2016may.model.Conformance.ConformanceImplementationComponent(); + copyElement(src, tgt); + tgt.setDescription(src.getDescription()); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + return tgt; + } + + public static org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestComponent convertConformanceRestComponent(org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestComponent tgt = new org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestComponent(); + copyElement(src, tgt); + tgt.setMode(convertRestfulConformanceMode(src.getMode())); + if (src.hasDocumentation()) + tgt.setDocumentation(src.getDocumentation()); + tgt.setSecurity(convertConformanceRestSecurityComponent(src.getSecurity())); + for (org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestResourceComponent t : src.getResource()) + tgt.addResource(convertConformanceRestResourceComponent(t)); + for (org.hl7.fhir.dstu2016may.model.Conformance.SystemInteractionComponent t : src.getInteraction()) + tgt.addInteraction(convertSystemInteractionComponent(t)); + for (org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestResourceSearchParamComponent t : src.getSearchParam()) + tgt.addSearchParam(convertConformanceRestResourceSearchParamComponent(t)); + for (org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestOperationComponent t : src.getOperation()) + tgt.addOperation(convertConformanceRestOperationComponent(t)); + for (org.hl7.fhir.dstu2016may.model.UriType t : src.getCompartment()) + tgt.addCompartment(t.getValue()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestComponent convertConformanceRestComponent(org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestComponent tgt = new org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestComponent(); + copyElement(src, tgt); + tgt.setMode(convertRestfulConformanceMode(src.getMode())); + if (src.hasDocumentation()) + tgt.setDocumentation(src.getDocumentation()); + tgt.setSecurity(convertConformanceRestSecurityComponent(src.getSecurity())); + for (org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceComponent t : src.getResource()) + tgt.addResource(convertConformanceRestResourceComponent(t)); + for (org.hl7.fhir.r5.model.CapabilityStatement.SystemInteractionComponent t : src.getInteraction()) + tgt.addInteraction(convertSystemInteractionComponent(t)); + for (org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent t : src.getSearchParam()) + tgt.addSearchParam(convertConformanceRestResourceSearchParamComponent(t)); + for (org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceOperationComponent t : src.getOperation()) + tgt.addOperation(convertConformanceRestOperationComponent(t)); + for (org.hl7.fhir.r5.model.UriType t : src.getCompartment()) + tgt.addCompartment(t.getValue()); + return tgt; + } + + private static org.hl7.fhir.r5.model.CapabilityStatement.RestfulCapabilityMode convertRestfulConformanceMode(org.hl7.fhir.dstu2016may.model.Conformance.RestfulConformanceMode src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case CLIENT: return org.hl7.fhir.r5.model.CapabilityStatement.RestfulCapabilityMode.CLIENT; + case SERVER: return org.hl7.fhir.r5.model.CapabilityStatement.RestfulCapabilityMode.SERVER; + default: return org.hl7.fhir.r5.model.CapabilityStatement.RestfulCapabilityMode.NULL; + } + } + + private static org.hl7.fhir.dstu2016may.model.Conformance.RestfulConformanceMode convertRestfulConformanceMode(org.hl7.fhir.r5.model.CapabilityStatement.RestfulCapabilityMode src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case CLIENT: return org.hl7.fhir.dstu2016may.model.Conformance.RestfulConformanceMode.CLIENT; + case SERVER: return org.hl7.fhir.dstu2016may.model.Conformance.RestfulConformanceMode.SERVER; + default: return org.hl7.fhir.dstu2016may.model.Conformance.RestfulConformanceMode.NULL; + } + } + + public static org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestSecurityComponent convertConformanceRestSecurityComponent(org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestSecurityComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestSecurityComponent tgt = new org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestSecurityComponent(); + copyElement(src, tgt); + if (src.hasCors()) + tgt.setCors(src.getCors()); + for (org.hl7.fhir.dstu2016may.model.CodeableConcept t : src.getService()) + tgt.addService(convertCodeableConcept(t)); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestSecurityComponent convertConformanceRestSecurityComponent(org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestSecurityComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestSecurityComponent tgt = new org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestSecurityComponent(); + copyElement(src, tgt); + if (src.hasCors()) + tgt.setCors(src.getCors()); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getService()) + tgt.addService(convertCodeableConcept(t)); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + return tgt; + } + + public static org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceComponent convertConformanceRestResourceComponent(org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestResourceComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceComponent tgt = new org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceComponent(); + copyElement(src, tgt); + tgt.setType(src.getType()); + tgt.setProfileElement(convertReferenceToCanonical(src.getProfile())); + for (org.hl7.fhir.dstu2016may.model.Conformance.ResourceInteractionComponent t : src.getInteraction()) + tgt.addInteraction(convertResourceInteractionComponent(t)); + tgt.setVersioning(convertResourceVersionPolicy(src.getVersioning())); + if (src.hasReadHistory()) + tgt.setReadHistory(src.getReadHistory()); + if (src.hasUpdateCreate()) + tgt.setUpdateCreate(src.getUpdateCreate()); + if (src.hasConditionalCreate()) + tgt.setConditionalCreate(src.getConditionalCreate()); + if (src.hasConditionalUpdate()) + tgt.setConditionalUpdate(src.getConditionalUpdate()); + tgt.setConditionalDelete(convertConditionalDeleteStatus(src.getConditionalDelete())); + for (org.hl7.fhir.dstu2016may.model.StringType t : src.getSearchInclude()) + tgt.addSearchInclude(t.getValue()); + for (org.hl7.fhir.dstu2016may.model.StringType t : src.getSearchRevInclude()) + tgt.addSearchRevInclude(t.getValue()); + for (org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestResourceSearchParamComponent t : src.getSearchParam()) + tgt.addSearchParam(convertConformanceRestResourceSearchParamComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestResourceComponent convertConformanceRestResourceComponent(org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestResourceComponent tgt = new org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestResourceComponent(); + copyElement(src, tgt); + tgt.setType(src.getType()); + tgt.setProfile(convertCanonicalToReference(src.getProfileElement())); + for (org.hl7.fhir.r5.model.CapabilityStatement.ResourceInteractionComponent t : src.getInteraction()) + tgt.addInteraction(convertResourceInteractionComponent(t)); + tgt.setVersioning(convertResourceVersionPolicy(src.getVersioning())); + if (src.hasReadHistory()) + tgt.setReadHistory(src.getReadHistory()); + if (src.hasUpdateCreate()) + tgt.setUpdateCreate(src.getUpdateCreate()); + if (src.hasConditionalCreate()) + tgt.setConditionalCreate(src.getConditionalCreate()); + if (src.hasConditionalUpdate()) + tgt.setConditionalUpdate(src.getConditionalUpdate()); + tgt.setConditionalDelete(convertConditionalDeleteStatus(src.getConditionalDelete())); + for (org.hl7.fhir.r5.model.StringType t : src.getSearchInclude()) + tgt.addSearchInclude(t.getValue()); + for (org.hl7.fhir.r5.model.StringType t : src.getSearchRevInclude()) + tgt.addSearchRevInclude(t.getValue()); + for (org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent t : src.getSearchParam()) + tgt.addSearchParam(convertConformanceRestResourceSearchParamComponent(t)); + return tgt; + } + + private static org.hl7.fhir.r5.model.CapabilityStatement.ResourceVersionPolicy convertResourceVersionPolicy(org.hl7.fhir.dstu2016may.model.Conformance.ResourceVersionPolicy src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case NOVERSION: return org.hl7.fhir.r5.model.CapabilityStatement.ResourceVersionPolicy.NOVERSION; + case VERSIONED: return org.hl7.fhir.r5.model.CapabilityStatement.ResourceVersionPolicy.VERSIONED; + case VERSIONEDUPDATE: return org.hl7.fhir.r5.model.CapabilityStatement.ResourceVersionPolicy.VERSIONEDUPDATE; + default: return org.hl7.fhir.r5.model.CapabilityStatement.ResourceVersionPolicy.NULL; + } + } + + private static org.hl7.fhir.dstu2016may.model.Conformance.ResourceVersionPolicy convertResourceVersionPolicy(org.hl7.fhir.r5.model.CapabilityStatement.ResourceVersionPolicy src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case NOVERSION: return org.hl7.fhir.dstu2016may.model.Conformance.ResourceVersionPolicy.NOVERSION; + case VERSIONED: return org.hl7.fhir.dstu2016may.model.Conformance.ResourceVersionPolicy.VERSIONED; + case VERSIONEDUPDATE: return org.hl7.fhir.dstu2016may.model.Conformance.ResourceVersionPolicy.VERSIONEDUPDATE; + default: return org.hl7.fhir.dstu2016may.model.Conformance.ResourceVersionPolicy.NULL; + } + } + + private static org.hl7.fhir.r5.model.CapabilityStatement.ConditionalDeleteStatus convertConditionalDeleteStatus(org.hl7.fhir.dstu2016may.model.Conformance.ConditionalDeleteStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case NOTSUPPORTED: return org.hl7.fhir.r5.model.CapabilityStatement.ConditionalDeleteStatus.NOTSUPPORTED; + case SINGLE: return org.hl7.fhir.r5.model.CapabilityStatement.ConditionalDeleteStatus.SINGLE; + case MULTIPLE: return org.hl7.fhir.r5.model.CapabilityStatement.ConditionalDeleteStatus.MULTIPLE; + default: return org.hl7.fhir.r5.model.CapabilityStatement.ConditionalDeleteStatus.NULL; + } + } + + private static org.hl7.fhir.dstu2016may.model.Conformance.ConditionalDeleteStatus convertConditionalDeleteStatus(org.hl7.fhir.r5.model.CapabilityStatement.ConditionalDeleteStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case NOTSUPPORTED: return org.hl7.fhir.dstu2016may.model.Conformance.ConditionalDeleteStatus.NOTSUPPORTED; + case SINGLE: return org.hl7.fhir.dstu2016may.model.Conformance.ConditionalDeleteStatus.SINGLE; + case MULTIPLE: return org.hl7.fhir.dstu2016may.model.Conformance.ConditionalDeleteStatus.MULTIPLE; + default: return org.hl7.fhir.dstu2016may.model.Conformance.ConditionalDeleteStatus.NULL; + } + } + + public static org.hl7.fhir.r5.model.CapabilityStatement.ResourceInteractionComponent convertResourceInteractionComponent(org.hl7.fhir.dstu2016may.model.Conformance.ResourceInteractionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.CapabilityStatement.ResourceInteractionComponent tgt = new org.hl7.fhir.r5.model.CapabilityStatement.ResourceInteractionComponent(); + copyElement(src, tgt); + tgt.setCode(convertTypeRestfulInteraction(src.getCode())); + if (src.hasDocumentation()) + tgt.setDocumentation(src.getDocumentation()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Conformance.ResourceInteractionComponent convertResourceInteractionComponent(org.hl7.fhir.r5.model.CapabilityStatement.ResourceInteractionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Conformance.ResourceInteractionComponent tgt = new org.hl7.fhir.dstu2016may.model.Conformance.ResourceInteractionComponent(); + copyElement(src, tgt); + tgt.setCode(convertTypeRestfulInteraction(src.getCode())); + if (src.hasDocumentation()) + tgt.setDocumentation(src.getDocumentation()); + return tgt; + } + + private static org.hl7.fhir.r5.model.CapabilityStatement.TypeRestfulInteraction convertTypeRestfulInteraction(org.hl7.fhir.dstu2016may.model.Conformance.TypeRestfulInteraction src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case READ: return org.hl7.fhir.r5.model.CapabilityStatement.TypeRestfulInteraction.READ; + case VREAD: return org.hl7.fhir.r5.model.CapabilityStatement.TypeRestfulInteraction.VREAD; + case UPDATE: return org.hl7.fhir.r5.model.CapabilityStatement.TypeRestfulInteraction.UPDATE; + case DELETE: return org.hl7.fhir.r5.model.CapabilityStatement.TypeRestfulInteraction.DELETE; + case HISTORYINSTANCE: return org.hl7.fhir.r5.model.CapabilityStatement.TypeRestfulInteraction.HISTORYINSTANCE; + case HISTORYTYPE: return org.hl7.fhir.r5.model.CapabilityStatement.TypeRestfulInteraction.HISTORYTYPE; + case CREATE: return org.hl7.fhir.r5.model.CapabilityStatement.TypeRestfulInteraction.CREATE; + case SEARCHTYPE: return org.hl7.fhir.r5.model.CapabilityStatement.TypeRestfulInteraction.SEARCHTYPE; + default: return org.hl7.fhir.r5.model.CapabilityStatement.TypeRestfulInteraction.NULL; + } + } + + private static org.hl7.fhir.dstu2016may.model.Conformance.TypeRestfulInteraction convertTypeRestfulInteraction(org.hl7.fhir.r5.model.CapabilityStatement.TypeRestfulInteraction src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case READ: return org.hl7.fhir.dstu2016may.model.Conformance.TypeRestfulInteraction.READ; + case VREAD: return org.hl7.fhir.dstu2016may.model.Conformance.TypeRestfulInteraction.VREAD; + case UPDATE: return org.hl7.fhir.dstu2016may.model.Conformance.TypeRestfulInteraction.UPDATE; + case DELETE: return org.hl7.fhir.dstu2016may.model.Conformance.TypeRestfulInteraction.DELETE; + case HISTORYINSTANCE: return org.hl7.fhir.dstu2016may.model.Conformance.TypeRestfulInteraction.HISTORYINSTANCE; + case HISTORYTYPE: return org.hl7.fhir.dstu2016may.model.Conformance.TypeRestfulInteraction.HISTORYTYPE; + case CREATE: return org.hl7.fhir.dstu2016may.model.Conformance.TypeRestfulInteraction.CREATE; + case SEARCHTYPE: return org.hl7.fhir.dstu2016may.model.Conformance.TypeRestfulInteraction.SEARCHTYPE; + default: return org.hl7.fhir.dstu2016may.model.Conformance.TypeRestfulInteraction.NULL; + } + } + + public static org.hl7.fhir.r5.model.Enumerations.SearchParamType convertSearchParamType(org.hl7.fhir.dstu2016may.model.Enumerations.SearchParamType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case NUMBER: return org.hl7.fhir.r5.model.Enumerations.SearchParamType.NUMBER; + case DATE: return org.hl7.fhir.r5.model.Enumerations.SearchParamType.DATE; + case STRING: return org.hl7.fhir.r5.model.Enumerations.SearchParamType.STRING; + case TOKEN: return org.hl7.fhir.r5.model.Enumerations.SearchParamType.TOKEN; + case REFERENCE: return org.hl7.fhir.r5.model.Enumerations.SearchParamType.REFERENCE; + case COMPOSITE: return org.hl7.fhir.r5.model.Enumerations.SearchParamType.COMPOSITE; + case QUANTITY: return org.hl7.fhir.r5.model.Enumerations.SearchParamType.QUANTITY; + case URI: return org.hl7.fhir.r5.model.Enumerations.SearchParamType.URI; + default: return org.hl7.fhir.r5.model.Enumerations.SearchParamType.NULL; + } + } + + public static org.hl7.fhir.dstu2016may.model.Enumerations.SearchParamType convertSearchParamType(org.hl7.fhir.r5.model.Enumerations.SearchParamType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case NUMBER: return org.hl7.fhir.dstu2016may.model.Enumerations.SearchParamType.NUMBER; + case DATE: return org.hl7.fhir.dstu2016may.model.Enumerations.SearchParamType.DATE; + case STRING: return org.hl7.fhir.dstu2016may.model.Enumerations.SearchParamType.STRING; + case TOKEN: return org.hl7.fhir.dstu2016may.model.Enumerations.SearchParamType.TOKEN; + case REFERENCE: return org.hl7.fhir.dstu2016may.model.Enumerations.SearchParamType.REFERENCE; + case COMPOSITE: return org.hl7.fhir.dstu2016may.model.Enumerations.SearchParamType.COMPOSITE; + case QUANTITY: return org.hl7.fhir.dstu2016may.model.Enumerations.SearchParamType.QUANTITY; + case URI: return org.hl7.fhir.dstu2016may.model.Enumerations.SearchParamType.URI; + default: return org.hl7.fhir.dstu2016may.model.Enumerations.SearchParamType.NULL; + } + } + + public static org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent convertConformanceRestResourceSearchParamComponent(org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestResourceSearchParamComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent tgt = new org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent(); + copyElement(src, tgt); + tgt.setName(src.getName()); + if (src.hasDefinition()) + tgt.setDefinition(src.getDefinition()); + tgt.setType(convertSearchParamType(src.getType())); + if (src.hasDocumentation()) + tgt.setDocumentation(src.getDocumentation()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestResourceSearchParamComponent convertConformanceRestResourceSearchParamComponent(org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestResourceSearchParamComponent tgt = new org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestResourceSearchParamComponent(); + copyElement(src, tgt); + tgt.setName(src.getName()); + if (src.hasDefinition()) + tgt.setDefinition(src.getDefinition()); + tgt.setType(convertSearchParamType(src.getType())); + if (src.hasDocumentation()) + tgt.setDocumentation(src.getDocumentation()); + return tgt; + } + + public static org.hl7.fhir.r5.model.CapabilityStatement.SystemInteractionComponent convertSystemInteractionComponent(org.hl7.fhir.dstu2016may.model.Conformance.SystemInteractionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.CapabilityStatement.SystemInteractionComponent tgt = new org.hl7.fhir.r5.model.CapabilityStatement.SystemInteractionComponent(); + copyElement(src, tgt); + tgt.setCode(convertSystemRestfulInteraction(src.getCode())); + if (src.hasDocumentation()) + tgt.setDocumentation(src.getDocumentation()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Conformance.SystemInteractionComponent convertSystemInteractionComponent(org.hl7.fhir.r5.model.CapabilityStatement.SystemInteractionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Conformance.SystemInteractionComponent tgt = new org.hl7.fhir.dstu2016may.model.Conformance.SystemInteractionComponent(); + copyElement(src, tgt); + tgt.setCode(convertSystemRestfulInteraction(src.getCode())); + if (src.hasDocumentation()) + tgt.setDocumentation(src.getDocumentation()); + return tgt; + } + + private static org.hl7.fhir.r5.model.CapabilityStatement.SystemRestfulInteraction convertSystemRestfulInteraction(org.hl7.fhir.dstu2016may.model.Conformance.SystemRestfulInteraction src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case TRANSACTION: return org.hl7.fhir.r5.model.CapabilityStatement.SystemRestfulInteraction.TRANSACTION; + case SEARCHSYSTEM: return org.hl7.fhir.r5.model.CapabilityStatement.SystemRestfulInteraction.SEARCHSYSTEM; + case HISTORYSYSTEM: return org.hl7.fhir.r5.model.CapabilityStatement.SystemRestfulInteraction.HISTORYSYSTEM; + default: return org.hl7.fhir.r5.model.CapabilityStatement.SystemRestfulInteraction.NULL; + } + } + + private static org.hl7.fhir.dstu2016may.model.Conformance.SystemRestfulInteraction convertSystemRestfulInteraction(org.hl7.fhir.r5.model.CapabilityStatement.SystemRestfulInteraction src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case TRANSACTION: return org.hl7.fhir.dstu2016may.model.Conformance.SystemRestfulInteraction.TRANSACTION; + case SEARCHSYSTEM: return org.hl7.fhir.dstu2016may.model.Conformance.SystemRestfulInteraction.SEARCHSYSTEM; + case HISTORYSYSTEM: return org.hl7.fhir.dstu2016may.model.Conformance.SystemRestfulInteraction.HISTORYSYSTEM; + default: return org.hl7.fhir.dstu2016may.model.Conformance.SystemRestfulInteraction.NULL; + } + } + + public static org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceOperationComponent convertConformanceRestOperationComponent(org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestOperationComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceOperationComponent tgt = new org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceOperationComponent(); + copyElement(src, tgt); + tgt.setName(src.getName()); + tgt.setDefinitionElement(convertReferenceToCanonical(src.getDefinition())); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestOperationComponent convertConformanceRestOperationComponent(org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceOperationComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestOperationComponent tgt = new org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestOperationComponent(); + copyElement(src, tgt); + tgt.setName(src.getName()); + tgt.setDefinition(convertCanonicalToReference(src.getDefinitionElement())); + return tgt; + } + + public static org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementMessagingComponent convertConformanceMessagingComponent(org.hl7.fhir.dstu2016may.model.Conformance.ConformanceMessagingComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementMessagingComponent tgt = new org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementMessagingComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.dstu2016may.model.Conformance.ConformanceMessagingEndpointComponent t : src.getEndpoint()) + tgt.addEndpoint(convertConformanceMessagingEndpointComponent(t)); + if (src.hasReliableCache()) + tgt.setReliableCache(src.getReliableCache()); + if (src.hasDocumentation()) + tgt.setDocumentation(src.getDocumentation()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Conformance.ConformanceMessagingComponent convertConformanceMessagingComponent(org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementMessagingComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Conformance.ConformanceMessagingComponent tgt = new org.hl7.fhir.dstu2016may.model.Conformance.ConformanceMessagingComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementMessagingEndpointComponent t : src.getEndpoint()) + tgt.addEndpoint(convertConformanceMessagingEndpointComponent(t)); + if (src.hasReliableCache()) + tgt.setReliableCache(src.getReliableCache()); + if (src.hasDocumentation()) + tgt.setDocumentation(src.getDocumentation()); + return tgt; + } + + public static org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementMessagingEndpointComponent convertConformanceMessagingEndpointComponent(org.hl7.fhir.dstu2016may.model.Conformance.ConformanceMessagingEndpointComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementMessagingEndpointComponent tgt = new org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementMessagingEndpointComponent(); + copyElement(src, tgt); + tgt.setProtocol(convertCoding(src.getProtocol())); + tgt.setAddress(src.getAddress()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Conformance.ConformanceMessagingEndpointComponent convertConformanceMessagingEndpointComponent(org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementMessagingEndpointComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Conformance.ConformanceMessagingEndpointComponent tgt = new org.hl7.fhir.dstu2016may.model.Conformance.ConformanceMessagingEndpointComponent(); + copyElement(src, tgt); + tgt.setProtocol(convertCoding(src.getProtocol())); + tgt.setAddress(src.getAddress()); + return tgt; + } + + private static org.hl7.fhir.r5.model.CapabilityStatement.EventCapabilityMode convertConformanceEventMode(org.hl7.fhir.dstu2016may.model.Conformance.ConformanceEventMode src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case SENDER: return org.hl7.fhir.r5.model.CapabilityStatement.EventCapabilityMode.SENDER; + case RECEIVER: return org.hl7.fhir.r5.model.CapabilityStatement.EventCapabilityMode.RECEIVER; + default: return org.hl7.fhir.r5.model.CapabilityStatement.EventCapabilityMode.NULL; + } + } + + private static org.hl7.fhir.dstu2016may.model.Conformance.ConformanceEventMode convertConformanceEventMode(org.hl7.fhir.r5.model.CapabilityStatement.EventCapabilityMode src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case SENDER: return org.hl7.fhir.dstu2016may.model.Conformance.ConformanceEventMode.SENDER; + case RECEIVER: return org.hl7.fhir.dstu2016may.model.Conformance.ConformanceEventMode.RECEIVER; + default: return org.hl7.fhir.dstu2016may.model.Conformance.ConformanceEventMode.NULL; + } + } + + public static org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementDocumentComponent convertConformanceDocumentComponent(org.hl7.fhir.dstu2016may.model.Conformance.ConformanceDocumentComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementDocumentComponent tgt = new org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementDocumentComponent(); + copyElement(src, tgt); + tgt.setMode(convertDocumentMode(src.getMode())); + if (src.hasDocumentation()) + tgt.setDocumentation(src.getDocumentation()); + tgt.setProfileElement(convertReferenceToCanonical(src.getProfile())); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Conformance.ConformanceDocumentComponent convertConformanceDocumentComponent(org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementDocumentComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Conformance.ConformanceDocumentComponent tgt = new org.hl7.fhir.dstu2016may.model.Conformance.ConformanceDocumentComponent(); + copyElement(src, tgt); + tgt.setMode(convertDocumentMode(src.getMode())); + if (src.hasDocumentation()) + tgt.setDocumentation(src.getDocumentation()); + tgt.setProfile(convertCanonicalToReference(src.getProfileElement())); + return tgt; + } + + private static org.hl7.fhir.r5.model.CapabilityStatement.DocumentMode convertDocumentMode(org.hl7.fhir.dstu2016may.model.Conformance.DocumentMode src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PRODUCER: return org.hl7.fhir.r5.model.CapabilityStatement.DocumentMode.PRODUCER; + case CONSUMER: return org.hl7.fhir.r5.model.CapabilityStatement.DocumentMode.CONSUMER; + default: return org.hl7.fhir.r5.model.CapabilityStatement.DocumentMode.NULL; + } + } + + private static org.hl7.fhir.dstu2016may.model.Conformance.DocumentMode convertDocumentMode(org.hl7.fhir.r5.model.CapabilityStatement.DocumentMode src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PRODUCER: return org.hl7.fhir.dstu2016may.model.Conformance.DocumentMode.PRODUCER; + case CONSUMER: return org.hl7.fhir.dstu2016may.model.Conformance.DocumentMode.CONSUMER; + default: return org.hl7.fhir.dstu2016may.model.Conformance.DocumentMode.NULL; + } + } + + + public static org.hl7.fhir.r5.model.StructureDefinition convertDataElement(org.hl7.fhir.dstu2016may.model.DataElement src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.StructureDefinition tgt = new org.hl7.fhir.r5.model.StructureDefinition(); + copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + for (org.hl7.fhir.dstu2016may.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasName()) + tgt.setName(src.getName()); + for (org.hl7.fhir.dstu2016may.model.DataElement.DataElementContactComponent t : src.getContact()) + tgt.addContact(convertDataElementContactComponent(t)); + for (org.hl7.fhir.dstu2016may.model.CodeableConcept t : src.getUseContext()) + if (isJurisdiction(t)) + tgt.addJurisdiction(convertCodeableConcept(t)); + else + tgt.addUseContext(convertCodeableConceptToUsageContext(t)); + if (src.hasCopyright()) + tgt.setCopyright(src.getCopyright()); +// tgt.setStringency(convertDataElementStringency(src.getStringency())); + for (org.hl7.fhir.dstu2016may.model.DataElement.DataElementMappingComponent t : src.getMapping()) + tgt.addMapping(convertDataElementMappingComponent(t)); + for (org.hl7.fhir.dstu2016may.model.ElementDefinition t : src.getElement()) + tgt.getSnapshot().addElement(convertElementDefinition(t, src.getElement(), src.getElement().indexOf(t))); + tgt.setKind(StructureDefinitionKind.COMPLEXTYPE); + tgt.setAbstract(false); + tgt.setType(tgt.getName()); + tgt.setBaseDefinition("http://hl7.org/fhir/StructureDefinition/Element"); + tgt.setDerivation(org.hl7.fhir.r5.model.StructureDefinition.TypeDerivationRule.SPECIALIZATION); + return tgt; + } + +// public static org.hl7.fhir.dstu2016may.model.DataElement convertDataElement(org.hl7.fhir.r5.model.DataElement src) throws FHIRException { +// if (src == null || src.isEmpty()) +// return null; +// org.hl7.fhir.dstu2016may.model.DataElement tgt = new org.hl7.fhir.dstu2016may.model.DataElement(); +// copyDomainResource(src, tgt); +// if (src.hasUrl()) +// tgt.setUrl(src.getUrl()); +// for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) +// tgt.addIdentifier(convertIdentifier(t)); +// if (src.hasVersion()) +// tgt.setVersion(src.getVersion()); +// tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); +// if (src.hasExperimental()) +// tgt.setExperimental(src.getExperimental()); +// if (src.hasPublisher()) +// tgt.setPublisher(src.getPublisher()); +// if (src.hasDate()) +// tgt.setDate(src.getDate()); +// if (src.hasName()) +// tgt.setName(src.getName()); +// for (org.hl7.fhir.r5.model.ContactDetail t : src.getContact()) +// tgt.addContact(convertDataElementContactComponent(t)); +// for (org.hl7.fhir.r5.model.UsageContext t : src.getUseContext()) +// if (t.hasValueCodeableConcept()) +// tgt.addUseContext(convertCodeableConcept(t.getValueCodeableConcept())); +// for (org.hl7.fhir.r5.model.CodeableConcept t : src.getJurisdiction()) +// tgt.addUseContext(convertCodeableConcept(t)); +// if (src.hasCopyright()) +// tgt.setCopyright(src.getCopyright()); +// tgt.setStringency(convertDataElementStringency(src.getStringency())); +// for (org.hl7.fhir.r5.model.DataElement.DataElementMappingComponent t : src.getMapping()) +// tgt.addMapping(convertDataElementMappingComponent(t)); +// for (org.hl7.fhir.r5.model.ElementDefinition t : src.getElement()) +// tgt.addElement(convertElementDefinition(t)); +// return tgt; +// } +// +// private static org.hl7.fhir.r5.model.DataElement.DataElementStringency convertDataElementStringency(org.hl7.fhir.dstu2016may.model.DataElement.DataElementStringency src) throws FHIRException { +// if (src == null) +// return null; +// switch (src) { +// case COMPARABLE: return org.hl7.fhir.r5.model.DataElement.DataElementStringency.COMPARABLE; +// case FULLYSPECIFIED: return org.hl7.fhir.r5.model.DataElement.DataElementStringency.FULLYSPECIFIED; +// case EQUIVALENT: return org.hl7.fhir.r5.model.DataElement.DataElementStringency.EQUIVALENT; +// case CONVERTABLE: return org.hl7.fhir.r5.model.DataElement.DataElementStringency.CONVERTABLE; +// case SCALEABLE: return org.hl7.fhir.r5.model.DataElement.DataElementStringency.SCALEABLE; +// case FLEXIBLE: return org.hl7.fhir.r5.model.DataElement.DataElementStringency.FLEXIBLE; +// default: return org.hl7.fhir.r5.model.DataElement.DataElementStringency.NULL; +// } +// } +// +// private static org.hl7.fhir.dstu2016may.model.DataElement.DataElementStringency convertDataElementStringency(org.hl7.fhir.r5.model.DataElement.DataElementStringency src) throws FHIRException { +// if (src == null) +// return null; +// switch (src) { +// case COMPARABLE: return org.hl7.fhir.dstu2016may.model.DataElement.DataElementStringency.COMPARABLE; +// case FULLYSPECIFIED: return org.hl7.fhir.dstu2016may.model.DataElement.DataElementStringency.FULLYSPECIFIED; +// case EQUIVALENT: return org.hl7.fhir.dstu2016may.model.DataElement.DataElementStringency.EQUIVALENT; +// case CONVERTABLE: return org.hl7.fhir.dstu2016may.model.DataElement.DataElementStringency.CONVERTABLE; +// case SCALEABLE: return org.hl7.fhir.dstu2016may.model.DataElement.DataElementStringency.SCALEABLE; +// case FLEXIBLE: return org.hl7.fhir.dstu2016may.model.DataElement.DataElementStringency.FLEXIBLE; +// default: return org.hl7.fhir.dstu2016may.model.DataElement.DataElementStringency.NULL; +// } +// } + + public static org.hl7.fhir.r5.model.ContactDetail convertDataElementContactComponent(org.hl7.fhir.dstu2016may.model.DataElement.DataElementContactComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.ContactDetail tgt = new org.hl7.fhir.r5.model.ContactDetail(); + copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + for (org.hl7.fhir.dstu2016may.model.ContactPoint t : src.getTelecom()) + tgt.addTelecom(convertContactPoint(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.DataElement.DataElementContactComponent convertDataElementContactComponent(org.hl7.fhir.r5.model.ContactDetail src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.DataElement.DataElementContactComponent tgt = new org.hl7.fhir.dstu2016may.model.DataElement.DataElementContactComponent(); + copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + for (org.hl7.fhir.r5.model.ContactPoint t : src.getTelecom()) + tgt.addTelecom(convertContactPoint(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionMappingComponent convertDataElementMappingComponent(org.hl7.fhir.dstu2016may.model.DataElement.DataElementMappingComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionMappingComponent tgt = new org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionMappingComponent(); + copyElement(src, tgt); + tgt.setIdentity(src.getIdentity()); + if (src.hasUri()) + tgt.setUri(src.getUri()); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasComment()) + tgt.setComment(src.getComment()); + return tgt; + } + +// public static org.hl7.fhir.dstu2016may.model.DataElement.DataElementMappingComponent convertDataElementMappingComponent(org.hl7.fhir.r5.model.DataElement.DataElementMappingComponent src) throws FHIRException { +// if (src == null || src.isEmpty()) +// return null; +// org.hl7.fhir.dstu2016may.model.DataElement.DataElementMappingComponent tgt = new org.hl7.fhir.dstu2016may.model.DataElement.DataElementMappingComponent(); +// copyElement(src, tgt); +// tgt.setIdentity(src.getIdentity()); +// if (src.hasUri()) +// tgt.setUri(src.getUri()); +// if (src.hasName()) +// tgt.setName(src.getName()); +// if (src.hasComment()) +// tgt.setComment(src.getComment()); +// return tgt; +// } + + public static org.hl7.fhir.r5.model.ImplementationGuide convertImplementationGuide(org.hl7.fhir.dstu2016may.model.ImplementationGuide src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.ImplementationGuide tgt = new org.hl7.fhir.r5.model.ImplementationGuide(); + copyDomainResource(src, tgt); + tgt.setUrl(src.getUrl()); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + tgt.setName(src.getName()); + tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuideContactComponent t : src.getContact()) + tgt.addContact(convertImplementationGuideContactComponent(t)); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu2016may.model.CodeableConcept t : src.getUseContext()) + if (isJurisdiction(t)) + tgt.addJurisdiction(convertCodeableConcept(t)); + else + tgt.addUseContext(convertCodeableConceptToUsageContext(t)); + if (src.hasCopyright()) + tgt.setCopyright(src.getCopyright()); + if (src.hasFhirVersion()) + tgt.addFhirVersion(org.hl7.fhir.r5.model.Enumerations.FHIRVersion.fromCode(src.getFhirVersion())); + for (org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuideDependencyComponent t : src.getDependency()) + tgt.addDependsOn(convertImplementationGuideDependencyComponent(t)); + for (org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuidePackageComponent t : src.getPackage()) + tgt.getDefinition().addGrouping(convertImplementationGuidePackageComponent(tgt.getDefinition(), t)); + for (org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuideGlobalComponent t : src.getGlobal()) + tgt.addGlobal(convertImplementationGuideGlobalComponent(t)); +// for (org.hl7.fhir.dstu2016may.model.UriType t : src.getBinary()) +// tgt.addBinary(t.getValue()); + tgt.getDefinition().setPage(convertImplementationGuidePageComponent(src.getPage())); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.ImplementationGuide convertImplementationGuide(org.hl7.fhir.r5.model.ImplementationGuide src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.ImplementationGuide tgt = new org.hl7.fhir.dstu2016may.model.ImplementationGuide(); + copyDomainResource(src, tgt); + tgt.setUrl(src.getUrl()); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + tgt.setName(src.getName()); + tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.r5.model.ContactDetail t : src.getContact()) + tgt.addContact(convertImplementationGuideContactComponent(t)); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.r5.model.UsageContext t : src.getUseContext()) + if (t.hasValueCodeableConcept()) + tgt.addUseContext(convertCodeableConcept(t.getValueCodeableConcept())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getJurisdiction()) + tgt.addUseContext(convertCodeableConcept(t)); + if (src.hasCopyright()) + tgt.setCopyright(src.getCopyright()); + if (src.hasFhirVersion()) + for (Enumeration v : src.getFhirVersion()) { + tgt.setFhirVersion(v.asStringValue()); + } + for (org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDependsOnComponent t : src.getDependsOn()) + tgt.addDependency(convertImplementationGuideDependencyComponent(t)); + for (org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionGroupingComponent t : src.getDefinition().getGrouping()) + tgt.addPackage(convertImplementationGuidePackageComponent(t)); + for (org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionResourceComponent t : src.getDefinition().getResource()) + findPackage(tgt.getPackage(), t.getGroupingId()).addResource(convertImplementationGuidePackageResourceComponent(t)); + for (org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideGlobalComponent t : src.getGlobal()) + tgt.addGlobal(convertImplementationGuideGlobalComponent(t)); +// for (org.hl7.fhir.r5.model.UriType t : src.getBinary()) +// tgt.addBinary(t.getValue()); + tgt.setPage(convertImplementationGuidePageComponent(src.getDefinition().getPage())); + return tgt; + } + + private static org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuidePackageComponent findPackage(List definition, String id) { + for (org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuidePackageComponent t : definition) + if (t.getId().equals(id)) + return t; + org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuidePackageComponent t = new org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuidePackageComponent(); + t.setName("Default Package"); + t.setId(id); + return t; + } + + public static org.hl7.fhir.r5.model.ContactDetail convertImplementationGuideContactComponent(org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuideContactComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.ContactDetail tgt = new org.hl7.fhir.r5.model.ContactDetail(); + copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + for (org.hl7.fhir.dstu2016may.model.ContactPoint t : src.getTelecom()) + tgt.addTelecom(convertContactPoint(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuideContactComponent convertImplementationGuideContactComponent(org.hl7.fhir.r5.model.ContactDetail src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuideContactComponent tgt = new org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuideContactComponent(); + copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + for (org.hl7.fhir.r5.model.ContactPoint t : src.getTelecom()) + tgt.addTelecom(convertContactPoint(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDependsOnComponent convertImplementationGuideDependencyComponent(org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuideDependencyComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDependsOnComponent tgt = new org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDependsOnComponent(); + copyElement(src, tgt); + tgt.setUri(src.getUri()); + + if ( org.hl7.fhir.dstu2016may.utils.ToolingExtensions.hasExtension(src, VersionConvertorConstants.IG_DEPENDSON_PACKAGE_EXTENSION)) { + tgt.setPackageId(org.hl7.fhir.dstu2016may.utils.ToolingExtensions.readStringExtension(src, VersionConvertorConstants.IG_DEPENDSON_PACKAGE_EXTENSION)); + } + if ( org.hl7.fhir.dstu2016may.utils.ToolingExtensions.hasExtension(src, VersionConvertorConstants.IG_DEPENDSON_VERSION_EXTENSION)) { + tgt.setVersion(org.hl7.fhir.dstu2016may.utils.ToolingExtensions.readStringExtension(src, VersionConvertorConstants.IG_DEPENDSON_VERSION_EXTENSION)); + } + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuideDependencyComponent convertImplementationGuideDependencyComponent(org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDependsOnComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuideDependencyComponent tgt = new org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuideDependencyComponent(); + copyElement(src, tgt); + tgt.setType(org.hl7.fhir.dstu2016may.model.ImplementationGuide.GuideDependencyType.REFERENCE); + tgt.setUri(src.getUri()); + return tgt; + } + + public static org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionGroupingComponent convertImplementationGuidePackageComponent(org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionComponent context, org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuidePackageComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionGroupingComponent tgt = new org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionGroupingComponent(); + tgt.setId("p"+(context.getGrouping().size()+1)); + copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuidePackageResourceComponent t : src.getResource()) { + org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionResourceComponent tn = convertImplementationGuidePackageResourceComponent(t); + tn.setGroupingId(tgt.getId()); + context.addResource(tn); + } + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuidePackageComponent convertImplementationGuidePackageComponent(org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionGroupingComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuidePackageComponent tgt = new org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuidePackageComponent(); + copyElement(src, tgt); + tgt.setId(src.getId()); + tgt.setName(src.getName()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + return tgt; + } + + public static org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionResourceComponent convertImplementationGuidePackageResourceComponent(org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuidePackageResourceComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionResourceComponent tgt = new org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionResourceComponent(); + copyElement(src, tgt); + if (src.hasExampleFor()) { + Type t = convertType(src.getExampleFor()); + tgt.setExample(t instanceof org.hl7.fhir.r5.model.Reference ? new CanonicalType(((org.hl7.fhir.r5.model.Reference) t).getReference()) : t); + } else if (src.hasExample()) + tgt.setExample(new org.hl7.fhir.r5.model.BooleanType(src.getExample())); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + if (src.hasSourceReference()) + tgt.setReference(convertReference(src.getSourceReference())); + else if (src.hasSourceUriType()) + tgt.setReference(new org.hl7.fhir.r5.model.Reference(src.getSourceUriType().getValue())); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuidePackageResourceComponent convertImplementationGuidePackageResourceComponent(org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionResourceComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuidePackageResourceComponent tgt = new org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuidePackageResourceComponent(); + copyElement(src, tgt); + if (src.hasExampleCanonicalType()) { + tgt.setExampleFor(convertCanonicalToReference(src.getExampleCanonicalType())); + tgt.setExample(true); + } else if (src.hasExampleBooleanType()) + tgt.setExample(src.getExampleBooleanType().getValue()); + else + tgt.setExample(false); + + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + if (src.hasReference()) + tgt.setSource(convertReference(src.getReference())); + return tgt; + } + + public static org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideGlobalComponent convertImplementationGuideGlobalComponent(org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuideGlobalComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideGlobalComponent tgt = new org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideGlobalComponent(); + copyElement(src, tgt); + tgt.setType(src.getType()); + tgt.setProfileElement(convertReferenceToCanonical(src.getProfile())); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuideGlobalComponent convertImplementationGuideGlobalComponent(org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideGlobalComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuideGlobalComponent tgt = new org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuideGlobalComponent(); + copyElement(src, tgt); + tgt.setType(src.getType()); + tgt.setProfile(convertCanonicalToReference(src.getProfileElement())); + return tgt; + } + + public static org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionPageComponent convertImplementationGuidePageComponent(org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuidePageComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionPageComponent tgt = new org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionPageComponent(); + copyElement(src, tgt); + if (src.hasSource()) + tgt.setName(convertUriToUrl(src.getSourceElement())); + tgt.setTitle(src.getName()); + if (src.hasKind()) + tgt.setGeneration(convertPageGeneration(src.getKind())); + for (org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuidePageComponent t : src.getPage()) + tgt.addPage(convertImplementationGuidePageComponent(t)); + return tgt; + } + + private static GuidePageGeneration convertPageGeneration(GuidePageKind kind) { + switch (kind) { + case PAGE: return GuidePageGeneration.HTML; + default: return GuidePageGeneration.GENERATED; + } + } + + + private static GuidePageKind convertPageGeneration(GuidePageGeneration generation) { + switch (generation) { + case HTML: return GuidePageKind.PAGE; + default: return GuidePageKind.RESOURCE; + } + } + + public static org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuidePageComponent convertImplementationGuidePageComponent(org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionPageComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuidePageComponent tgt = new org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuidePageComponent(); + copyElement(src, tgt); + if (src.hasNameUrlType()) + tgt.setSource(src.getNameUrlType().getValue()); + tgt.setName(src.getTitle()); + if (src.hasGeneration()) + tgt.setKind(convertPageGeneration(src.getGeneration())); + + for (org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionPageComponent t : src.getPage()) + tgt.addPage(convertImplementationGuidePageComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.NamingSystem convertNamingSystem(org.hl7.fhir.dstu2016may.model.NamingSystem src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.NamingSystem tgt = new org.hl7.fhir.r5.model.NamingSystem(); + copyDomainResource(src, tgt); + tgt.setName(src.getName()); + tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); + tgt.setKind(convertNamingSystemType(src.getKind())); + tgt.setDate(src.getDate()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemContactComponent t : src.getContact()) + tgt.addContact(convertNamingSystemContactComponent(t)); + if (src.hasResponsible()) + tgt.setResponsible(src.getResponsible()); + tgt.setType(convertCodeableConcept(src.getType())); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu2016may.model.CodeableConcept t : src.getUseContext()) + if (isJurisdiction(t)) + tgt.addJurisdiction(convertCodeableConcept(t)); + else + tgt.addUseContext(convertCodeableConceptToUsageContext(t)); + if (src.hasUsage()) + tgt.setUsage(src.getUsage()); + for (org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemUniqueIdComponent t : src.getUniqueId()) + tgt.addUniqueId(convertNamingSystemUniqueIdComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.NamingSystem convertNamingSystem(org.hl7.fhir.r5.model.NamingSystem src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.NamingSystem tgt = new org.hl7.fhir.dstu2016may.model.NamingSystem(); + copyDomainResource(src, tgt); + tgt.setName(src.getName()); + tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); + tgt.setKind(convertNamingSystemType(src.getKind())); + tgt.setDate(src.getDate()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.r5.model.ContactDetail t : src.getContact()) + tgt.addContact(convertNamingSystemContactComponent(t)); + if (src.hasResponsible()) + tgt.setResponsible(src.getResponsible()); + tgt.setType(convertCodeableConcept(src.getType())); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.r5.model.UsageContext t : src.getUseContext()) + if (t.hasValueCodeableConcept()) + tgt.addUseContext(convertCodeableConcept(t.getValueCodeableConcept())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getJurisdiction()) + tgt.addUseContext(convertCodeableConcept(t)); + if (src.hasUsage()) + tgt.setUsage(src.getUsage()); + for (org.hl7.fhir.r5.model.NamingSystem.NamingSystemUniqueIdComponent t : src.getUniqueId()) + tgt.addUniqueId(convertNamingSystemUniqueIdComponent(t)); + return tgt; + } + + private static org.hl7.fhir.r5.model.NamingSystem.NamingSystemType convertNamingSystemType(org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case CODESYSTEM: return org.hl7.fhir.r5.model.NamingSystem.NamingSystemType.CODESYSTEM; + case IDENTIFIER: return org.hl7.fhir.r5.model.NamingSystem.NamingSystemType.IDENTIFIER; + case ROOT: return org.hl7.fhir.r5.model.NamingSystem.NamingSystemType.ROOT; + default: return org.hl7.fhir.r5.model.NamingSystem.NamingSystemType.NULL; + } + } + + private static org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemType convertNamingSystemType(org.hl7.fhir.r5.model.NamingSystem.NamingSystemType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case CODESYSTEM: return org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemType.CODESYSTEM; + case IDENTIFIER: return org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemType.IDENTIFIER; + case ROOT: return org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemType.ROOT; + default: return org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemType.NULL; + } + } + + public static org.hl7.fhir.r5.model.ContactDetail convertNamingSystemContactComponent(org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemContactComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.ContactDetail tgt = new org.hl7.fhir.r5.model.ContactDetail(); + copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + for (org.hl7.fhir.dstu2016may.model.ContactPoint t : src.getTelecom()) + tgt.addTelecom(convertContactPoint(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemContactComponent convertNamingSystemContactComponent(org.hl7.fhir.r5.model.ContactDetail src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemContactComponent tgt = new org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemContactComponent(); + copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + for (org.hl7.fhir.r5.model.ContactPoint t : src.getTelecom()) + tgt.addTelecom(convertContactPoint(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.NamingSystem.NamingSystemUniqueIdComponent convertNamingSystemUniqueIdComponent(org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemUniqueIdComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.NamingSystem.NamingSystemUniqueIdComponent tgt = new org.hl7.fhir.r5.model.NamingSystem.NamingSystemUniqueIdComponent(); + copyElement(src, tgt); + tgt.setType(convertNamingSystemIdentifierType(src.getType())); + tgt.setValue(src.getValue()); + if (src.hasPreferred()) + tgt.setPreferred(src.getPreferred()); + tgt.setPeriod(convertPeriod(src.getPeriod())); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemUniqueIdComponent convertNamingSystemUniqueIdComponent(org.hl7.fhir.r5.model.NamingSystem.NamingSystemUniqueIdComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemUniqueIdComponent tgt = new org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemUniqueIdComponent(); + copyElement(src, tgt); + tgt.setType(convertNamingSystemIdentifierType(src.getType())); + tgt.setValue(src.getValue()); + if (src.hasPreferred()) + tgt.setPreferred(src.getPreferred()); + tgt.setPeriod(convertPeriod(src.getPeriod())); + return tgt; + } + + private static org.hl7.fhir.r5.model.NamingSystem.NamingSystemIdentifierType convertNamingSystemIdentifierType(org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemIdentifierType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case OID: return org.hl7.fhir.r5.model.NamingSystem.NamingSystemIdentifierType.OID; + case UUID: return org.hl7.fhir.r5.model.NamingSystem.NamingSystemIdentifierType.UUID; + case URI: return org.hl7.fhir.r5.model.NamingSystem.NamingSystemIdentifierType.URI; + case OTHER: return org.hl7.fhir.r5.model.NamingSystem.NamingSystemIdentifierType.OTHER; + default: return org.hl7.fhir.r5.model.NamingSystem.NamingSystemIdentifierType.NULL; + } + } + + private static org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemIdentifierType convertNamingSystemIdentifierType(org.hl7.fhir.r5.model.NamingSystem.NamingSystemIdentifierType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case OID: return org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemIdentifierType.OID; + case UUID: return org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemIdentifierType.UUID; + case URI: return org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemIdentifierType.URI; + case OTHER: return org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemIdentifierType.OTHER; + default: return org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemIdentifierType.NULL; + } + } + + public static org.hl7.fhir.r5.model.OperationDefinition convertOperationDefinition(org.hl7.fhir.dstu2016may.model.OperationDefinition src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.OperationDefinition tgt = new org.hl7.fhir.r5.model.OperationDefinition(); + copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + tgt.setName(src.getName()); + tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); + tgt.setKind(convertOperationKind(src.getKind())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationDefinitionContactComponent t : src.getContact()) + tgt.addContact(convertOperationDefinitionContactComponent(t)); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu2016may.model.CodeableConcept t : src.getUseContext()) + if (isJurisdiction(t)) + tgt.addJurisdiction(convertCodeableConcept(t)); + else + tgt.addUseContext(convertCodeableConceptToUsageContext(t)); + if (src.hasRequirements()) + tgt.setPurpose(src.getRequirements()); + if (src.hasIdempotent()) + tgt.setAffectsState(!src.getIdempotent()); + tgt.setCode(src.getCode()); + if (src.hasComment()) + tgt.setComment(src.getComment()); + tgt.setBaseElement(convertReferenceToCanonical(src.getBase())); + tgt.setSystem(src.getSystem()); + for (org.hl7.fhir.dstu2016may.model.CodeType t : src.getType()) + tgt.addResource(t.getValue()); + tgt.setType(tgt.hasResource()); + tgt.setInstance(src.getInstance()); + for (org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationDefinitionParameterComponent t : src.getParameter()) + tgt.addParameter(convertOperationDefinitionParameterComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.OperationDefinition convertOperationDefinition(org.hl7.fhir.r5.model.OperationDefinition src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.OperationDefinition tgt = new org.hl7.fhir.dstu2016may.model.OperationDefinition(); + copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + tgt.setName(src.getName()); + tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); + tgt.setKind(convertOperationKind(src.getKind())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.r5.model.ContactDetail t : src.getContact()) + tgt.addContact(convertOperationDefinitionContactComponent(t)); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.r5.model.UsageContext t : src.getUseContext()) + if (t.hasValueCodeableConcept()) + tgt.addUseContext(convertCodeableConcept(t.getValueCodeableConcept())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getJurisdiction()) + tgt.addUseContext(convertCodeableConcept(t)); + if (src.hasPurpose()) + tgt.setRequirements(src.getPurpose()); + if (src.hasAffectsState()) + tgt.setIdempotent(!src.getAffectsState()); + tgt.setCode(src.getCode()); + if (src.hasComment()) + tgt.setComment(src.getComment()); + tgt.setBase(convertCanonicalToReference(src.getBaseElement())); + tgt.setSystem(src.getSystem()); + if (src.getType()) + for (org.hl7.fhir.r5.model.CodeType t : src.getResource()) + tgt.addType(t.getValue()); + tgt.setInstance(src.getInstance()); + for (org.hl7.fhir.r5.model.OperationDefinition.OperationDefinitionParameterComponent t : src.getParameter()) + tgt.addParameter(convertOperationDefinitionParameterComponent(t)); + return tgt; + } + + private static org.hl7.fhir.r5.model.OperationDefinition.OperationKind convertOperationKind(org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationKind src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case OPERATION: return org.hl7.fhir.r5.model.OperationDefinition.OperationKind.OPERATION; + case QUERY: return org.hl7.fhir.r5.model.OperationDefinition.OperationKind.QUERY; + default: return org.hl7.fhir.r5.model.OperationDefinition.OperationKind.NULL; + } + } + + private static org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationKind convertOperationKind(org.hl7.fhir.r5.model.OperationDefinition.OperationKind src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case OPERATION: return org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationKind.OPERATION; + case QUERY: return org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationKind.QUERY; + default: return org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationKind.NULL; + } + } + + public static org.hl7.fhir.r5.model.ContactDetail convertOperationDefinitionContactComponent(org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationDefinitionContactComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.ContactDetail tgt = new org.hl7.fhir.r5.model.ContactDetail(); + copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + for (org.hl7.fhir.dstu2016may.model.ContactPoint t : src.getTelecom()) + tgt.addTelecom(convertContactPoint(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationDefinitionContactComponent convertOperationDefinitionContactComponent(org.hl7.fhir.r5.model.ContactDetail src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationDefinitionContactComponent tgt = new org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationDefinitionContactComponent(); + copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + for (org.hl7.fhir.r5.model.ContactPoint t : src.getTelecom()) + tgt.addTelecom(convertContactPoint(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.OperationDefinition.OperationDefinitionParameterComponent convertOperationDefinitionParameterComponent(org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationDefinitionParameterComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.OperationDefinition.OperationDefinitionParameterComponent tgt = new org.hl7.fhir.r5.model.OperationDefinition.OperationDefinitionParameterComponent(); + copyElement(src, tgt); + tgt.setName(src.getName()); + tgt.setUse(convertOperationParameterUse(src.getUse())); + tgt.setMin(src.getMin()); + tgt.setMax(src.getMax()); + if (src.hasDocumentation()) + tgt.setDocumentation(src.getDocumentation()); + if (src.hasType()) + tgt.setType(src.getType()); + tgt.setSearchType(convertSearchParamType(src.getSearchType())); + tgt.addTargetProfile(src.getProfile().getReference()); + tgt.setBinding(convertOperationDefinitionParameterBindingComponent(src.getBinding())); + for (org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationDefinitionParameterComponent t : src.getPart()) + tgt.addPart(convertOperationDefinitionParameterComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationDefinitionParameterComponent convertOperationDefinitionParameterComponent(org.hl7.fhir.r5.model.OperationDefinition.OperationDefinitionParameterComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationDefinitionParameterComponent tgt = new org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationDefinitionParameterComponent(); + copyElement(src, tgt); + tgt.setName(src.getName()); + tgt.setUse(convertOperationParameterUse(src.getUse())); + tgt.setMin(src.getMin()); + tgt.setMax(src.getMax()); + if (src.hasDocumentation()) + tgt.setDocumentation(src.getDocumentation()); + if (src.hasType()) + tgt.setType(src.getType()); + tgt.setSearchType(convertSearchParamType(src.getSearchType())); + for (org.hl7.fhir.r5.model.UriType t : src.getTargetProfile()) + tgt.setProfile(new org.hl7.fhir.dstu2016may.model.Reference(t.getValue())); + tgt.setBinding(convertOperationDefinitionParameterBindingComponent(src.getBinding())); + for (org.hl7.fhir.r5.model.OperationDefinition.OperationDefinitionParameterComponent t : src.getPart()) + tgt.addPart(convertOperationDefinitionParameterComponent(t)); + return tgt; + } + + private static org.hl7.fhir.r5.model.OperationDefinition.OperationParameterUse convertOperationParameterUse(org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationParameterUse src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case IN: return org.hl7.fhir.r5.model.OperationDefinition.OperationParameterUse.IN; + case OUT: return org.hl7.fhir.r5.model.OperationDefinition.OperationParameterUse.OUT; + default: return org.hl7.fhir.r5.model.OperationDefinition.OperationParameterUse.NULL; + } + } + + private static org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationParameterUse convertOperationParameterUse(org.hl7.fhir.r5.model.OperationDefinition.OperationParameterUse src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case IN: return org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationParameterUse.IN; + case OUT: return org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationParameterUse.OUT; + default: return org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationParameterUse.NULL; + } + } + + public static org.hl7.fhir.r5.model.OperationDefinition.OperationDefinitionParameterBindingComponent convertOperationDefinitionParameterBindingComponent(org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationDefinitionParameterBindingComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.OperationDefinition.OperationDefinitionParameterBindingComponent tgt = new org.hl7.fhir.r5.model.OperationDefinition.OperationDefinitionParameterBindingComponent(); + copyElement(src, tgt); + tgt.setStrength(convertBindingStrength(src.getStrength())); + Type t = convertType(src.getValueSet()); + if (t != null) { + if (t instanceof org.hl7.fhir.r5.model.Reference) + tgt.setValueSet(((org.hl7.fhir.r5.model.Reference) t).getReference()); + else + tgt.setValueSet(t.primitiveValue()); + tgt.setValueSet(VersionConvertorConstants.refToVS(tgt.getValueSet())); + } + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationDefinitionParameterBindingComponent convertOperationDefinitionParameterBindingComponent(org.hl7.fhir.r5.model.OperationDefinition.OperationDefinitionParameterBindingComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationDefinitionParameterBindingComponent tgt = new org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationDefinitionParameterBindingComponent(); + copyElement(src, tgt); + tgt.setStrength(convertBindingStrength(src.getStrength())); + if (src.hasValueSet()) { + String vsr = VersionConvertorConstants.vsToRef(src.getValueSet()); + if (vsr != null) + tgt.setValueSet(new org.hl7.fhir.dstu2016may.model.UriType(vsr)); + else + tgt.setValueSet(new org.hl7.fhir.dstu2016may.model.Reference(src.getValueSet())); + } + return tgt; + } + + public static org.hl7.fhir.r5.model.OperationOutcome convertOperationOutcome(org.hl7.fhir.dstu2016may.model.OperationOutcome src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.OperationOutcome tgt = new org.hl7.fhir.r5.model.OperationOutcome(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu2016may.model.OperationOutcome.OperationOutcomeIssueComponent t : src.getIssue()) + tgt.addIssue(convertOperationOutcomeIssueComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.OperationOutcome convertOperationOutcome(org.hl7.fhir.r5.model.OperationOutcome src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.OperationOutcome tgt = new org.hl7.fhir.dstu2016may.model.OperationOutcome(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.OperationOutcome.OperationOutcomeIssueComponent t : src.getIssue()) + tgt.addIssue(convertOperationOutcomeIssueComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.OperationOutcome.OperationOutcomeIssueComponent convertOperationOutcomeIssueComponent(org.hl7.fhir.dstu2016may.model.OperationOutcome.OperationOutcomeIssueComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.OperationOutcome.OperationOutcomeIssueComponent tgt = new org.hl7.fhir.r5.model.OperationOutcome.OperationOutcomeIssueComponent(); + copyElement(src, tgt); + tgt.setSeverity(convertIssueSeverity(src.getSeverity())); + tgt.setCode(convertIssueType(src.getCode())); + tgt.setDetails(convertCodeableConcept(src.getDetails())); + if (src.hasDiagnostics()) + tgt.setDiagnostics(src.getDiagnostics()); + for (org.hl7.fhir.dstu2016may.model.StringType t : src.getLocation()) + tgt.addLocation(t.getValue()); + for (org.hl7.fhir.dstu2016may.model.StringType t : src.getExpression()) + tgt.addExpression(convertToR4Expression(t.getValue())); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.OperationOutcome.OperationOutcomeIssueComponent convertOperationOutcomeIssueComponent(org.hl7.fhir.r5.model.OperationOutcome.OperationOutcomeIssueComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.OperationOutcome.OperationOutcomeIssueComponent tgt = new org.hl7.fhir.dstu2016may.model.OperationOutcome.OperationOutcomeIssueComponent(); + copyElement(src, tgt); + tgt.setSeverity(convertIssueSeverity(src.getSeverity())); + tgt.setCode(convertIssueType(src.getCode())); + tgt.setDetails(convertCodeableConcept(src.getDetails())); + if (src.hasDiagnostics()) + tgt.setDiagnostics(src.getDiagnostics()); + for (org.hl7.fhir.r5.model.StringType t : src.getLocation()) + tgt.addLocation(t.getValue()); + for (org.hl7.fhir.r5.model.StringType t : src.getExpression()) + tgt.addExpression(convertTo2016MayExpression(t.getValue())); + return tgt; + } + + private static org.hl7.fhir.r5.model.OperationOutcome.IssueSeverity convertIssueSeverity(org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueSeverity src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case FATAL: return org.hl7.fhir.r5.model.OperationOutcome.IssueSeverity.FATAL; + case ERROR: return org.hl7.fhir.r5.model.OperationOutcome.IssueSeverity.ERROR; + case WARNING: return org.hl7.fhir.r5.model.OperationOutcome.IssueSeverity.WARNING; + case INFORMATION: return org.hl7.fhir.r5.model.OperationOutcome.IssueSeverity.INFORMATION; + default: return org.hl7.fhir.r5.model.OperationOutcome.IssueSeverity.NULL; + } + } + + private static org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueSeverity convertIssueSeverity(org.hl7.fhir.r5.model.OperationOutcome.IssueSeverity src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case FATAL: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueSeverity.FATAL; + case ERROR: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueSeverity.ERROR; + case WARNING: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueSeverity.WARNING; + case INFORMATION: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueSeverity.INFORMATION; + default: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueSeverity.NULL; + } + } + + private static org.hl7.fhir.r5.model.OperationOutcome.IssueType convertIssueType(org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case INVALID: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.INVALID; + case STRUCTURE: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.STRUCTURE; + case REQUIRED: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.REQUIRED; + case VALUE: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.VALUE; + case INVARIANT: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.INVARIANT; + case SECURITY: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.SECURITY; + case LOGIN: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.LOGIN; + case UNKNOWN: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.UNKNOWN; + case EXPIRED: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.EXPIRED; + case FORBIDDEN: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.FORBIDDEN; + case SUPPRESSED: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.SUPPRESSED; + case PROCESSING: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.PROCESSING; + case NOTSUPPORTED: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.NOTSUPPORTED; + case DUPLICATE: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.DUPLICATE; + case NOTFOUND: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.NOTFOUND; + case TOOLONG: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.TOOLONG; + case CODEINVALID: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.CODEINVALID; + case EXTENSION: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.EXTENSION; + case TOOCOSTLY: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.TOOCOSTLY; + case BUSINESSRULE: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.BUSINESSRULE; + case CONFLICT: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.CONFLICT; + case INCOMPLETE: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.INCOMPLETE; + case TRANSIENT: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.TRANSIENT; + case LOCKERROR: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.LOCKERROR; + case NOSTORE: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.NOSTORE; + case EXCEPTION: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.EXCEPTION; + case TIMEOUT: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.TIMEOUT; + case THROTTLED: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.THROTTLED; + case INFORMATIONAL: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.INFORMATIONAL; + default: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.NULL; + } + } + + private static org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType convertIssueType(org.hl7.fhir.r5.model.OperationOutcome.IssueType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case INVALID: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.INVALID; + case STRUCTURE: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.STRUCTURE; + case REQUIRED: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.REQUIRED; + case VALUE: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.VALUE; + case INVARIANT: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.INVARIANT; + case SECURITY: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.SECURITY; + case LOGIN: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.LOGIN; + case UNKNOWN: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.UNKNOWN; + case EXPIRED: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.EXPIRED; + case FORBIDDEN: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.FORBIDDEN; + case SUPPRESSED: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.SUPPRESSED; + case PROCESSING: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.PROCESSING; + case NOTSUPPORTED: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.NOTSUPPORTED; + case DUPLICATE: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.DUPLICATE; + case NOTFOUND: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.NOTFOUND; + case TOOLONG: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.TOOLONG; + case CODEINVALID: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.CODEINVALID; + case EXTENSION: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.EXTENSION; + case TOOCOSTLY: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.TOOCOSTLY; + case BUSINESSRULE: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.BUSINESSRULE; + case CONFLICT: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.CONFLICT; + case INCOMPLETE: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.INCOMPLETE; + case TRANSIENT: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.TRANSIENT; + case LOCKERROR: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.LOCKERROR; + case NOSTORE: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.NOSTORE; + case EXCEPTION: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.EXCEPTION; + case TIMEOUT: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.TIMEOUT; + case THROTTLED: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.THROTTLED; + case INFORMATIONAL: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.INFORMATIONAL; + default: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.NULL; + } + } + + + public static org.hl7.fhir.r5.model.Questionnaire convertQuestionnaire(org.hl7.fhir.dstu2016may.model.Questionnaire src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Questionnaire tgt = new org.hl7.fhir.r5.model.Questionnaire(); + copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + for (org.hl7.fhir.dstu2016may.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + tgt.setStatus(convertQuestionnaireStatus(src.getStatus())); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.dstu2016may.model.ContactPoint t : src.getTelecom()) + tgt.addContact(convertQuestionnaireContactComponent(t)); + for (org.hl7.fhir.dstu2016may.model.CodeableConcept t : src.getUseContext()) + if (isJurisdiction(t)) + tgt.addJurisdiction(convertCodeableConcept(t)); + else + tgt.addUseContext(convertCodeableConceptToUsageContext(t)); + if (src.hasTitle()) + tgt.setTitle(src.getTitle()); + for (org.hl7.fhir.dstu2016may.model.Coding t : src.getConcept()) + tgt.addCode(convertCoding(t)); + for (org.hl7.fhir.dstu2016may.model.CodeType t : src.getSubjectType()) + tgt.addSubjectType(t.getValue()); + for (org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemComponent t : src.getItem()) + tgt.addItem(convertQuestionnaireItemComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Questionnaire convertQuestionnaire(org.hl7.fhir.r5.model.Questionnaire src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Questionnaire tgt = new org.hl7.fhir.dstu2016may.model.Questionnaire(); + copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + tgt.setStatus(convertQuestionnaireStatus(src.getStatus())); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (ContactDetail t : src.getContact()) + for (org.hl7.fhir.r5.model.ContactPoint t1 : t.getTelecom()) + tgt.addTelecom(convertContactPoint(t1)); + for (UsageContext t : src.getUseContext()) + tgt.addUseContext(convertCodeableConcept(t.getValueCodeableConcept())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getJurisdiction()) + tgt.addUseContext(convertCodeableConcept(t)); + if (src.hasTitle()) + tgt.setTitle(src.getTitle()); + for (org.hl7.fhir.r5.model.Coding t : src.getCode()) + tgt.addConcept(convertCoding(t)); + for (org.hl7.fhir.r5.model.CodeType t : src.getSubjectType()) + tgt.addSubjectType(t.getValue()); + for (org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemComponent t : src.getItem()) + tgt.addItem(convertQuestionnaireItemComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.ContactDetail convertQuestionnaireContactComponent(org.hl7.fhir.dstu2016may.model.ContactPoint src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.ContactDetail tgt = new org.hl7.fhir.r5.model.ContactDetail(); + copyElement(src, tgt); + tgt.addTelecom(convertContactPoint(src)); + return tgt; + } + + + private static org.hl7.fhir.r5.model.Enumerations.PublicationStatus convertQuestionnaireStatus(org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case DRAFT: return org.hl7.fhir.r5.model.Enumerations.PublicationStatus.DRAFT; + case PUBLISHED: return org.hl7.fhir.r5.model.Enumerations.PublicationStatus.ACTIVE; + case RETIRED: return org.hl7.fhir.r5.model.Enumerations.PublicationStatus.RETIRED; + default: return org.hl7.fhir.r5.model.Enumerations.PublicationStatus.NULL; + } + } + + private static org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireStatus convertQuestionnaireStatus(org.hl7.fhir.r5.model.Enumerations.PublicationStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case DRAFT: return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireStatus.DRAFT; + case ACTIVE: return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireStatus.PUBLISHED; + case RETIRED: return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireStatus.RETIRED; + default: return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireStatus.NULL; + } + } + + public static org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemComponent convertQuestionnaireItemComponent(org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemComponent tgt = new org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemComponent(); + copyElement(src, tgt); + if (src.hasLinkId()) + tgt.setLinkId(src.getLinkId()); + for (org.hl7.fhir.dstu2016may.model.Coding t : src.getConcept()) + tgt.addCode(convertCoding(t)); + if (src.hasPrefix()) + tgt.setPrefix(src.getPrefix()); + if (src.hasText()) + tgt.setText(src.getText()); + tgt.setType(convertQuestionnaireItemType(src.getType())); + for (org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemEnableWhenComponent t : src.getEnableWhen()) + tgt.addEnableWhen(convertQuestionnaireItemEnableWhenComponent(t)); + if (src.hasRequired()) + tgt.setRequired(src.getRequired()); + if (src.hasRepeats()) + tgt.setRepeats(src.getRepeats()); + if (src.hasReadOnly()) + tgt.setReadOnly(src.getReadOnly()); + if (src.hasMaxLength()) + tgt.setMaxLength(src.getMaxLength()); + tgt.setAnswerValueSetElement(convertReferenceToCanonical(src.getOptions())); + for (org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemOptionComponent t : src.getOption()) + tgt.addAnswerOption(convertQuestionnaireItemOptionComponent(t)); + tgt.addInitial().setValue(convertType(src.getInitial())); + for (org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemComponent t : src.getItem()) + tgt.addItem(convertQuestionnaireItemComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemComponent convertQuestionnaireItemComponent(org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemComponent tgt = new org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemComponent(); + copyElement(src, tgt); + if (src.hasLinkId()) + tgt.setLinkId(src.getLinkId()); + for (org.hl7.fhir.r5.model.Coding t : src.getCode()) + tgt.addConcept(convertCoding(t)); + if (src.hasPrefix()) + tgt.setPrefix(src.getPrefix()); + if (src.hasText()) + tgt.setText(src.getText()); + tgt.setType(convertQuestionnaireItemType(src.getType())); + for (org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemEnableWhenComponent t : src.getEnableWhen()) + tgt.addEnableWhen(convertQuestionnaireItemEnableWhenComponent(t)); + if (src.hasRequired()) + tgt.setRequired(src.getRequired()); + if (src.hasRepeats()) + tgt.setRepeats(src.getRepeats()); + if (src.hasReadOnly()) + tgt.setReadOnly(src.getReadOnly()); + if (src.hasMaxLength()) + tgt.setMaxLength(src.getMaxLength()); + tgt.setOptions(convertCanonicalToReference(src.getAnswerValueSetElement())); + for (org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemAnswerOptionComponent t : src.getAnswerOption()) + tgt.addOption(convertQuestionnaireItemOptionComponent(t)); + if (src.hasInitial()) + tgt.setInitial(convertType(src.getInitialFirstRep().getValue())); + for (org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemComponent t : src.getItem()) + tgt.addItem(convertQuestionnaireItemComponent(t)); + return tgt; + } + + private static org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType convertQuestionnaireItemType(org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case GROUP: return org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.GROUP; + case DISPLAY: return org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.DISPLAY; + case QUESTION: return org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.QUESTION; + case BOOLEAN: return org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.BOOLEAN; + case DECIMAL: return org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.DECIMAL; + case INTEGER: return org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.INTEGER; + case DATE: return org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.DATE; + case DATETIME: return org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.DATETIME; + case INSTANT: return org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.DATETIME; + case TIME: return org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.TIME; + case STRING: return org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.STRING; + case TEXT: return org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.TEXT; + case URL: return org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.URL; + case CHOICE: return org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.CHOICE; + case OPENCHOICE: return org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.OPENCHOICE; + case ATTACHMENT: return org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.ATTACHMENT; + case REFERENCE: return org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.REFERENCE; + case QUANTITY: return org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.QUANTITY; + default: return org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.NULL; + } + } + + private static org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType convertQuestionnaireItemType(org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case GROUP: return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType.GROUP; + case DISPLAY: return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType.DISPLAY; + case QUESTION: return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType.QUESTION; + case BOOLEAN: return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType.BOOLEAN; + case DECIMAL: return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType.DECIMAL; + case INTEGER: return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType.INTEGER; + case DATE: return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType.DATE; + case DATETIME: return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType.DATETIME; + case TIME: return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType.TIME; + case STRING: return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType.STRING; + case TEXT: return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType.TEXT; + case URL: return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType.URL; + case CHOICE: return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType.CHOICE; + case OPENCHOICE: return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType.OPENCHOICE; + case ATTACHMENT: return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType.ATTACHMENT; + case REFERENCE: return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType.REFERENCE; + case QUANTITY: return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType.QUANTITY; + default: return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType.NULL; + } + } + + public static org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemEnableWhenComponent convertQuestionnaireItemEnableWhenComponent(org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemEnableWhenComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemEnableWhenComponent tgt = new org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemEnableWhenComponent(); + copyElement(src, tgt); + tgt.setQuestion(src.getQuestion()); + if (src.hasAnswered()) { + tgt.setOperator(QuestionnaireItemOperator.EXISTS); + tgt.setAnswer(convertType(src.getAnsweredElement())); + } + tgt.setAnswer(convertType(src.getAnswer())); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemEnableWhenComponent convertQuestionnaireItemEnableWhenComponent(org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemEnableWhenComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemEnableWhenComponent tgt = new org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemEnableWhenComponent(); + copyElement(src, tgt); + tgt.setQuestion(src.getQuestion()); + if (src.hasOperator() && src.getOperator() == QuestionnaireItemOperator.EXISTS) + tgt.setAnswered(src.getAnswerBooleanType().getValue()); + else + tgt.setAnswer(convertType(src.getAnswer())); + return tgt; + } + + public static org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemAnswerOptionComponent convertQuestionnaireItemOptionComponent(org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemOptionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemAnswerOptionComponent tgt = new org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemAnswerOptionComponent(); + copyElement(src, tgt); + tgt.setValue(convertType(src.getValue())); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemOptionComponent convertQuestionnaireItemOptionComponent(org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemAnswerOptionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemOptionComponent tgt = new org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemOptionComponent(); + copyElement(src, tgt); + tgt.setValue(convertType(src.getValue())); + return tgt; + } + + public static org.hl7.fhir.r5.model.QuestionnaireResponse convertQuestionnaireResponse(org.hl7.fhir.dstu2016may.model.QuestionnaireResponse src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.QuestionnaireResponse tgt = new org.hl7.fhir.r5.model.QuestionnaireResponse(); + copyDomainResource(src, tgt); + tgt.setIdentifier(convertIdentifier(src.getIdentifier())); + tgt.setQuestionnaireElement(convertReferenceToCanonical(src.getQuestionnaire())); + tgt.setStatus(convertQuestionnaireResponseStatus(src.getStatus())); + tgt.setSubject(convertReference(src.getSubject())); + tgt.setEncounter(convertReference(src.getEncounter())); + tgt.setAuthor(convertReference(src.getAuthor())); + if (src.hasAuthored()) + tgt.setAuthored(src.getAuthored()); + tgt.setSource(convertReference(src.getSource())); + for (org.hl7.fhir.dstu2016may.model.QuestionnaireResponse.QuestionnaireResponseItemComponent t : src.getItem()) + tgt.addItem(convertQuestionnaireResponseItemComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.QuestionnaireResponse convertQuestionnaireResponse(org.hl7.fhir.r5.model.QuestionnaireResponse src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.QuestionnaireResponse tgt = new org.hl7.fhir.dstu2016may.model.QuestionnaireResponse(); + copyDomainResource(src, tgt); + tgt.setIdentifier(convertIdentifier(src.getIdentifier())); + tgt.setQuestionnaire(convertCanonicalToReference(src.getQuestionnaireElement())); + tgt.setStatus(convertQuestionnaireResponseStatus(src.getStatus())); + tgt.setSubject(convertReference(src.getSubject())); + tgt.setEncounter(convertReference(src.getEncounter())); + tgt.setAuthor(convertReference(src.getAuthor())); + if (src.hasAuthored()) + tgt.setAuthored(src.getAuthored()); + tgt.setSource(convertReference(src.getSource())); + for (org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseItemComponent t : src.getItem()) + tgt.addItem(convertQuestionnaireResponseItemComponent(t)); + return tgt; + } + + private static org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseStatus convertQuestionnaireResponseStatus(org.hl7.fhir.dstu2016may.model.QuestionnaireResponse.QuestionnaireResponseStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case INPROGRESS: return org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseStatus.INPROGRESS; + case COMPLETED: return org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseStatus.COMPLETED; + case AMENDED: return org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseStatus.AMENDED; + default: return org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseStatus.NULL; + } + } + + private static org.hl7.fhir.dstu2016may.model.QuestionnaireResponse.QuestionnaireResponseStatus convertQuestionnaireResponseStatus(org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case INPROGRESS: return org.hl7.fhir.dstu2016may.model.QuestionnaireResponse.QuestionnaireResponseStatus.INPROGRESS; + case COMPLETED: return org.hl7.fhir.dstu2016may.model.QuestionnaireResponse.QuestionnaireResponseStatus.COMPLETED; + case AMENDED: return org.hl7.fhir.dstu2016may.model.QuestionnaireResponse.QuestionnaireResponseStatus.AMENDED; + default: return org.hl7.fhir.dstu2016may.model.QuestionnaireResponse.QuestionnaireResponseStatus.NULL; + } + } + + public static org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseItemComponent convertQuestionnaireResponseItemComponent(org.hl7.fhir.dstu2016may.model.QuestionnaireResponse.QuestionnaireResponseItemComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseItemComponent tgt = new org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseItemComponent(); + copyElement(src, tgt); + if (src.hasLinkId()) + tgt.setLinkId(src.getLinkId()); + if (src.hasText()) + tgt.setText(src.getText()); +// tgt.setSubject(convertReference(src.getSubject())); + for (org.hl7.fhir.dstu2016may.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent t : src.getAnswer()) + tgt.addAnswer(convertQuestionnaireResponseItemAnswerComponent(t)); + for (org.hl7.fhir.dstu2016may.model.QuestionnaireResponse.QuestionnaireResponseItemComponent t : src.getItem()) + tgt.addItem(convertQuestionnaireResponseItemComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.QuestionnaireResponse.QuestionnaireResponseItemComponent convertQuestionnaireResponseItemComponent(org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseItemComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.QuestionnaireResponse.QuestionnaireResponseItemComponent tgt = new org.hl7.fhir.dstu2016may.model.QuestionnaireResponse.QuestionnaireResponseItemComponent(); + copyElement(src, tgt); + if (src.hasLinkId()) + tgt.setLinkId(src.getLinkId()); + if (src.hasText()) + tgt.setText(src.getText()); +// tgt.setSubject(convertReference(src.getSubject())); + for (org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent t : src.getAnswer()) + tgt.addAnswer(convertQuestionnaireResponseItemAnswerComponent(t)); + for (org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseItemComponent t : src.getItem()) + tgt.addItem(convertQuestionnaireResponseItemComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent convertQuestionnaireResponseItemAnswerComponent(org.hl7.fhir.dstu2016may.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent tgt = new org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent(); + copyElement(src, tgt); + tgt.setValue(convertType(src.getValue())); + for (org.hl7.fhir.dstu2016may.model.QuestionnaireResponse.QuestionnaireResponseItemComponent t : src.getItem()) + tgt.addItem(convertQuestionnaireResponseItemComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent convertQuestionnaireResponseItemAnswerComponent(org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent tgt = new org.hl7.fhir.dstu2016may.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent(); + copyElement(src, tgt); + tgt.setValue(convertType(src.getValue())); + for (org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseItemComponent t : src.getItem()) + tgt.addItem(convertQuestionnaireResponseItemComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.SearchParameter convertSearchParameter(org.hl7.fhir.dstu2016may.model.SearchParameter src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.SearchParameter tgt = new org.hl7.fhir.r5.model.SearchParameter(); + copyDomainResource(src, tgt); + tgt.setUrl(src.getUrl()); + tgt.setName(src.getName()); + tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.dstu2016may.model.SearchParameter.SearchParameterContactComponent t : src.getContact()) + tgt.addContact(convertSearchParameterContactComponent(t)); + for (org.hl7.fhir.dstu2016may.model.CodeableConcept t : src.getUseContext()) + if (isJurisdiction(t)) + tgt.addJurisdiction(convertCodeableConcept(t)); + else + tgt.addUseContext(convertCodeableConceptToUsageContext(t)); + if (src.hasRequirements()) + tgt.setPurpose(src.getRequirements()); + tgt.setCode(src.getCode()); + tgt.addBase(src.getBase()); + tgt.setType(convertSearchParamType(src.getType())); + tgt.setDescription(src.getDescription()); + if (src.hasExpression()) + tgt.setExpression(convertToR4Expression(src.getExpression())); + if (src.hasXpath()) + tgt.setXpath(src.getXpath()); + tgt.setXpathUsage(convertXPathUsageType(src.getXpathUsage())); + for (org.hl7.fhir.dstu2016may.model.CodeType t : src.getTarget()) + tgt.addTarget(t.getValue()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.SearchParameter convertSearchParameter(org.hl7.fhir.r5.model.SearchParameter src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.SearchParameter tgt = new org.hl7.fhir.dstu2016may.model.SearchParameter(); + copyDomainResource(src, tgt); + tgt.setUrl(src.getUrl()); + tgt.setName(src.getName()); + tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.r5.model.ContactDetail t : src.getContact()) + tgt.addContact(convertSearchParameterContactComponent(t)); + for (org.hl7.fhir.r5.model.UsageContext t : src.getUseContext()) + if (t.hasValueCodeableConcept()) + tgt.addUseContext(convertCodeableConcept(t.getValueCodeableConcept())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getJurisdiction()) + tgt.addUseContext(convertCodeableConcept(t)); + if (src.hasPurpose()) + tgt.setRequirements(src.getPurpose()); + tgt.setCode(src.getCode()); + for (org.hl7.fhir.r5.model.CodeType t : src.getBase()) + tgt.setBase(t.asStringValue()); + tgt.setType(convertSearchParamType(src.getType())); + tgt.setDescription(src.getDescription()); + if (src.hasExpression()) + tgt.setExpression(convertTo2016MayExpression(src.getExpression())); + if (src.hasXpath()) + tgt.setXpath(src.getXpath()); + tgt.setXpathUsage(convertXPathUsageType(src.getXpathUsage())); + for (org.hl7.fhir.r5.model.CodeType t : src.getTarget()) + tgt.addTarget(t.getValue()); + return tgt; + } + + private static org.hl7.fhir.r5.model.SearchParameter.XPathUsageType convertXPathUsageType(org.hl7.fhir.dstu2016may.model.SearchParameter.XPathUsageType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case NORMAL: return org.hl7.fhir.r5.model.SearchParameter.XPathUsageType.NORMAL; + case PHONETIC: return org.hl7.fhir.r5.model.SearchParameter.XPathUsageType.PHONETIC; + case NEARBY: return org.hl7.fhir.r5.model.SearchParameter.XPathUsageType.NEARBY; + case DISTANCE: return org.hl7.fhir.r5.model.SearchParameter.XPathUsageType.DISTANCE; + case OTHER: return org.hl7.fhir.r5.model.SearchParameter.XPathUsageType.OTHER; + default: return org.hl7.fhir.r5.model.SearchParameter.XPathUsageType.NULL; + } + } + + private static org.hl7.fhir.dstu2016may.model.SearchParameter.XPathUsageType convertXPathUsageType(org.hl7.fhir.r5.model.SearchParameter.XPathUsageType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case NORMAL: return org.hl7.fhir.dstu2016may.model.SearchParameter.XPathUsageType.NORMAL; + case PHONETIC: return org.hl7.fhir.dstu2016may.model.SearchParameter.XPathUsageType.PHONETIC; + case NEARBY: return org.hl7.fhir.dstu2016may.model.SearchParameter.XPathUsageType.NEARBY; + case DISTANCE: return org.hl7.fhir.dstu2016may.model.SearchParameter.XPathUsageType.DISTANCE; + case OTHER: return org.hl7.fhir.dstu2016may.model.SearchParameter.XPathUsageType.OTHER; + default: return org.hl7.fhir.dstu2016may.model.SearchParameter.XPathUsageType.NULL; + } + } + + public static org.hl7.fhir.r5.model.ContactDetail convertSearchParameterContactComponent(org.hl7.fhir.dstu2016may.model.SearchParameter.SearchParameterContactComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.ContactDetail tgt = new org.hl7.fhir.r5.model.ContactDetail(); + copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + for (org.hl7.fhir.dstu2016may.model.ContactPoint t : src.getTelecom()) + tgt.addTelecom(convertContactPoint(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.SearchParameter.SearchParameterContactComponent convertSearchParameterContactComponent(org.hl7.fhir.r5.model.ContactDetail src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.SearchParameter.SearchParameterContactComponent tgt = new org.hl7.fhir.dstu2016may.model.SearchParameter.SearchParameterContactComponent(); + copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + for (org.hl7.fhir.r5.model.ContactPoint t : src.getTelecom()) + tgt.addTelecom(convertContactPoint(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.StructureDefinition convertStructureDefinition(org.hl7.fhir.dstu2016may.model.StructureDefinition src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.StructureDefinition tgt = new org.hl7.fhir.r5.model.StructureDefinition(); + copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + for (org.hl7.fhir.dstu2016may.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + tgt.setName(src.getName()); + if (src.hasDisplay()) + tgt.setTitle(src.getDisplay()); + tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionContactComponent t : src.getContact()) + tgt.addContact(convertStructureDefinitionContactComponent(t)); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu2016may.model.CodeableConcept t : src.getUseContext()) + if (isJurisdiction(t)) + tgt.addJurisdiction(convertCodeableConcept(t)); + else + tgt.addUseContext(convertCodeableConceptToUsageContext(t)); + if (src.hasRequirements()) + tgt.setPurpose(src.getRequirements()); + if (src.hasCopyright()) + tgt.setCopyright(src.getCopyright()); + for (org.hl7.fhir.dstu2016may.model.Coding t : src.getCode()) + tgt.addKeyword(convertCoding(t)); + if (src.hasFhirVersion()) + tgt.setFhirVersion(org.hl7.fhir.r5.model.Enumerations.FHIRVersion.fromCode(src.getFhirVersion())); + for (org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionMappingComponent t : src.getMapping()) + tgt.addMapping(convertStructureDefinitionMappingComponent(t)); + tgt.setKind(convertStructureDefinitionKind(src.getKind(), src.getName())); + tgt.setAbstract(src.getAbstract()); + for (org.hl7.fhir.dstu2016may.model.StringType t : src.getContext()) { + org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionContextComponent ec = tgt.addContext(); + ec.setType(convertExtensionContext(src.getContextType())); + ec.setExpression(convertToR4Expression(t.getValue())); + } + if (src.getDerivation() == org.hl7.fhir.dstu2016may.model.StructureDefinition.TypeDerivationRule.CONSTRAINT) + tgt.setType(src.getBaseType()); + else + tgt.setType(src.getId()); + if (src.hasBaseDefinition()) + tgt.setBaseDefinition(src.getBaseDefinition()); + tgt.setDerivation(convertTypeDerivationRule(src.getDerivation())); + if (src.hasSnapshot()) { + tgt.setSnapshot(convertStructureDefinitionSnapshotComponent(src.getSnapshot())); + tgt.getSnapshot().getElementFirstRep().getType().clear(); + } + if (src.hasDifferential()) { + tgt.setDifferential(convertStructureDefinitionDifferentialComponent(src.getDifferential())); + tgt.getDifferential().getElementFirstRep().getType().clear(); + } + if (tgt.getDerivation() == TypeDerivationRule.SPECIALIZATION) { + for (ElementDefinition ed : tgt.getSnapshot().getElement()) { + if (!ed.hasBase()) { + ed.getBase().setPath(ed.getPath()).setMin(ed.getMin()).setMax(ed.getMax()); + } + } + } + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.StructureDefinition convertStructureDefinition(org.hl7.fhir.r5.model.StructureDefinition src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.StructureDefinition tgt = new org.hl7.fhir.dstu2016may.model.StructureDefinition(); + copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + tgt.setName(src.getName()); + if (src.hasTitle()) + tgt.setDisplay(src.getTitle()); + tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.r5.model.ContactDetail t : src.getContact()) + tgt.addContact(convertStructureDefinitionContactComponent(t)); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.r5.model.UsageContext t : src.getUseContext()) + if (t.hasValueCodeableConcept()) + tgt.addUseContext(convertCodeableConcept(t.getValueCodeableConcept())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getJurisdiction()) + tgt.addUseContext(convertCodeableConcept(t)); + if (src.hasPurpose()) + tgt.setRequirements(src.getPurpose()); + if (src.hasCopyright()) + tgt.setCopyright(src.getCopyright()); + for (org.hl7.fhir.r5.model.Coding t : src.getKeyword()) + tgt.addCode(convertCoding(t)); + if (src.hasFhirVersion()) + tgt.setFhirVersion(src.getFhirVersion().toCode()); + for (org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionMappingComponent t : src.getMapping()) + tgt.addMapping(convertStructureDefinitionMappingComponent(t)); + tgt.setKind(convertStructureDefinitionKind(src.getKind())); + tgt.setAbstract(src.getAbstract()); + for (org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionContextComponent t : src.getContext()) { + if (!tgt.hasContextType()) + tgt.setContextType(convertExtensionContext(t.getType())); + tgt.addContext(convertTo2016MayExpression(t.getExpression())); + } + if (src.hasBaseDefinition()) + tgt.setBaseDefinition(src.getBaseDefinition()); + if (src.hasType() && src.getDerivation() == org.hl7.fhir.r5.model.StructureDefinition.TypeDerivationRule.CONSTRAINT) + tgt.setBaseType(src.getType()); + tgt.setDerivation(convertTypeDerivationRule(src.getDerivation())); + if (src.hasSnapshot()) + tgt.setSnapshot(convertStructureDefinitionSnapshotComponent(src.getSnapshot())); + tgt.setDifferential(convertStructureDefinitionDifferentialComponent(src.getDifferential())); + return tgt; + } + + private static org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionKind convertStructureDefinitionKind(org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionKind src, String name) throws FHIRException { + if (src == null) + return null; + switch (src) { + case DATATYPE: + if (name.substring(0, 1).toLowerCase().equals(name.substring(0,1))) + return org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionKind.PRIMITIVETYPE; + else + return org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionKind.COMPLEXTYPE; + case RESOURCE: return org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionKind.RESOURCE; + case LOGICAL: return org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionKind.LOGICAL; + default: return org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionKind.NULL; + } + } + + private static org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionKind convertStructureDefinitionKind(org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionKind src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PRIMITIVETYPE: return org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionKind.DATATYPE; + case COMPLEXTYPE: return org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionKind.DATATYPE; + case RESOURCE: return org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionKind.RESOURCE; + case LOGICAL: return org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionKind.LOGICAL; + default: return org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionKind.NULL; + } + } + + private static org.hl7.fhir.r5.model.StructureDefinition.ExtensionContextType convertExtensionContext(org.hl7.fhir.dstu2016may.model.StructureDefinition.ExtensionContext src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case RESOURCE: return org.hl7.fhir.r5.model.StructureDefinition.ExtensionContextType.FHIRPATH; + case DATATYPE: return org.hl7.fhir.r5.model.StructureDefinition.ExtensionContextType.ELEMENT; + case EXTENSION: return org.hl7.fhir.r5.model.StructureDefinition.ExtensionContextType.EXTENSION; + default: return org.hl7.fhir.r5.model.StructureDefinition.ExtensionContextType.NULL; + } + } + + private static org.hl7.fhir.dstu2016may.model.StructureDefinition.ExtensionContext convertExtensionContext(org.hl7.fhir.r5.model.StructureDefinition.ExtensionContextType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case FHIRPATH: return org.hl7.fhir.dstu2016may.model.StructureDefinition.ExtensionContext.RESOURCE; + case ELEMENT: return org.hl7.fhir.dstu2016may.model.StructureDefinition.ExtensionContext.DATATYPE; + case EXTENSION: return org.hl7.fhir.dstu2016may.model.StructureDefinition.ExtensionContext.EXTENSION; + default: return org.hl7.fhir.dstu2016may.model.StructureDefinition.ExtensionContext.NULL; + } + } + + private static org.hl7.fhir.r5.model.StructureDefinition.TypeDerivationRule convertTypeDerivationRule(org.hl7.fhir.dstu2016may.model.StructureDefinition.TypeDerivationRule src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case SPECIALIZATION: return org.hl7.fhir.r5.model.StructureDefinition.TypeDerivationRule.SPECIALIZATION; + case CONSTRAINT: return org.hl7.fhir.r5.model.StructureDefinition.TypeDerivationRule.CONSTRAINT; + default: return org.hl7.fhir.r5.model.StructureDefinition.TypeDerivationRule.NULL; + } + } + + private static org.hl7.fhir.dstu2016may.model.StructureDefinition.TypeDerivationRule convertTypeDerivationRule(org.hl7.fhir.r5.model.StructureDefinition.TypeDerivationRule src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case SPECIALIZATION: return org.hl7.fhir.dstu2016may.model.StructureDefinition.TypeDerivationRule.SPECIALIZATION; + case CONSTRAINT: return org.hl7.fhir.dstu2016may.model.StructureDefinition.TypeDerivationRule.CONSTRAINT; + default: return org.hl7.fhir.dstu2016may.model.StructureDefinition.TypeDerivationRule.NULL; + } + } + + public static org.hl7.fhir.r5.model.ContactDetail convertStructureDefinitionContactComponent(org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionContactComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.ContactDetail tgt = new org.hl7.fhir.r5.model.ContactDetail(); + copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + for (org.hl7.fhir.dstu2016may.model.ContactPoint t : src.getTelecom()) + tgt.addTelecom(convertContactPoint(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionContactComponent convertStructureDefinitionContactComponent(org.hl7.fhir.r5.model.ContactDetail src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionContactComponent tgt = new org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionContactComponent(); + copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + for (org.hl7.fhir.r5.model.ContactPoint t : src.getTelecom()) + tgt.addTelecom(convertContactPoint(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionMappingComponent convertStructureDefinitionMappingComponent(org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionMappingComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionMappingComponent tgt = new org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionMappingComponent(); + copyElement(src, tgt); + tgt.setIdentity(src.getIdentity()); + if (src.hasUri()) + tgt.setUri(src.getUri()); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasComments()) + tgt.setComment(src.getComments()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionMappingComponent convertStructureDefinitionMappingComponent(org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionMappingComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionMappingComponent tgt = new org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionMappingComponent(); + copyElement(src, tgt); + tgt.setIdentity(src.getIdentity()); + if (src.hasUri()) + tgt.setUri(src.getUri()); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasComment()) + tgt.setComments(src.getComment()); + return tgt; + } + + public static org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionSnapshotComponent convertStructureDefinitionSnapshotComponent(org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionSnapshotComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionSnapshotComponent tgt = new org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionSnapshotComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.dstu2016may.model.ElementDefinition t : src.getElement()) + tgt.addElement(convertElementDefinition(t, src.getElement(), src.getElement().indexOf(t))); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionSnapshotComponent convertStructureDefinitionSnapshotComponent(org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionSnapshotComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionSnapshotComponent tgt = new org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionSnapshotComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.r5.model.ElementDefinition t : src.getElement()) + tgt.addElement(convertElementDefinition(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionDifferentialComponent convertStructureDefinitionDifferentialComponent(org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionDifferentialComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionDifferentialComponent tgt = new org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionDifferentialComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.dstu2016may.model.ElementDefinition t : src.getElement()) + tgt.addElement(convertElementDefinition(t, src.getElement(), src.getElement().indexOf(t))); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionDifferentialComponent convertStructureDefinitionDifferentialComponent(org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionDifferentialComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionDifferentialComponent tgt = new org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionDifferentialComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.r5.model.ElementDefinition t : src.getElement()) + tgt.addElement(convertElementDefinition(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.StructureMap convertStructureMap(org.hl7.fhir.dstu2016may.model.StructureMap src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.StructureMap tgt = new org.hl7.fhir.r5.model.StructureMap(); + copyDomainResource(src, tgt); + tgt.setUrl(src.getUrl()); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + tgt.setName(src.getName()); + tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); + for (org.hl7.fhir.dstu2016may.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapContactComponent t : src.getContact()) + tgt.addContact(convertStructureMapContactComponent(t)); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu2016may.model.CodeableConcept t : src.getUseContext()) + if (isJurisdiction(t)) + tgt.addJurisdiction(convertCodeableConcept(t)); + else + tgt.addUseContext(convertCodeableConceptToUsageContext(t)); + if (src.hasRequirements()) + tgt.setPurpose(src.getRequirements()); + if (src.hasCopyright()) + tgt.setCopyright(src.getCopyright()); + for (org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapStructureComponent t : src.getStructure()) + tgt.addStructure(convertStructureMapStructureComponent(t)); + for (org.hl7.fhir.dstu2016may.model.UriType t : src.getImport()) + tgt.addImport(t.getValue()); + for (org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupComponent t : src.getGroup()) + tgt.addGroup(convertStructureMapGroupComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.StructureMap convertStructureMap(org.hl7.fhir.r5.model.StructureMap src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.StructureMap tgt = new org.hl7.fhir.dstu2016may.model.StructureMap(); + copyDomainResource(src, tgt); + tgt.setUrl(src.getUrl()); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + tgt.setName(src.getName()); + tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.r5.model.ContactDetail t : src.getContact()) + tgt.addContact(convertStructureMapContactComponent(t)); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.r5.model.UsageContext t : src.getUseContext()) + if (t.hasValueCodeableConcept()) + tgt.addUseContext(convertCodeableConcept(t.getValueCodeableConcept())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getJurisdiction()) + tgt.addUseContext(convertCodeableConcept(t)); + if (src.hasPurpose()) + tgt.setRequirements(src.getPurpose()); + if (src.hasCopyright()) + tgt.setCopyright(src.getCopyright()); + for (org.hl7.fhir.r5.model.StructureMap.StructureMapStructureComponent t : src.getStructure()) + tgt.addStructure(convertStructureMapStructureComponent(t)); + for (org.hl7.fhir.r5.model.UriType t : src.getImport()) + tgt.addImport(t.getValue()); + for (org.hl7.fhir.r5.model.StructureMap.StructureMapGroupComponent t : src.getGroup()) + tgt.addGroup(convertStructureMapGroupComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.ContactDetail convertStructureMapContactComponent(org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapContactComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.ContactDetail tgt = new org.hl7.fhir.r5.model.ContactDetail(); + copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + for (org.hl7.fhir.dstu2016may.model.ContactPoint t : src.getTelecom()) + tgt.addTelecom(convertContactPoint(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapContactComponent convertStructureMapContactComponent(org.hl7.fhir.r5.model.ContactDetail src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapContactComponent tgt = new org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapContactComponent(); + copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + for (org.hl7.fhir.r5.model.ContactPoint t : src.getTelecom()) + tgt.addTelecom(convertContactPoint(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.StructureMap.StructureMapStructureComponent convertStructureMapStructureComponent(org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapStructureComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.StructureMap.StructureMapStructureComponent tgt = new org.hl7.fhir.r5.model.StructureMap.StructureMapStructureComponent(); + copyElement(src, tgt); + tgt.setUrl(src.getUrl()); + tgt.setMode(convertStructureMapStructureMode(src.getMode())); + if (src.hasDocumentation()) + tgt.setDocumentation(src.getDocumentation()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapStructureComponent convertStructureMapStructureComponent(org.hl7.fhir.r5.model.StructureMap.StructureMapStructureComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapStructureComponent tgt = new org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapStructureComponent(); + copyElement(src, tgt); + tgt.setUrl(src.getUrl()); + tgt.setMode(convertStructureMapStructureMode(src.getMode())); + if (src.hasDocumentation()) + tgt.setDocumentation(src.getDocumentation()); + return tgt; + } + + public static org.hl7.fhir.r5.model.StructureMap.StructureMapModelMode convertStructureMapStructureMode(org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapModelMode src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PRODUCED: return org.hl7.fhir.r5.model.StructureMap.StructureMapModelMode.PRODUCED; + case QUERIED: return org.hl7.fhir.r5.model.StructureMap.StructureMapModelMode.QUERIED; + case SOURCE: return org.hl7.fhir.r5.model.StructureMap.StructureMapModelMode.SOURCE; + case TARGET: return org.hl7.fhir.r5.model.StructureMap.StructureMapModelMode.TARGET; + default: return org.hl7.fhir.r5.model.StructureMap.StructureMapModelMode.NULL; + } + } + + public static org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapModelMode convertStructureMapStructureMode(org.hl7.fhir.r5.model.StructureMap.StructureMapModelMode src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PRODUCED: return org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapModelMode.PRODUCED; + case QUERIED: return org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapModelMode.QUERIED; + case SOURCE: return org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapModelMode.SOURCE; + case TARGET: return org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapModelMode.TARGET; + default: return org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapModelMode.NULL; + } + } + + public static org.hl7.fhir.r5.model.StructureMap.StructureMapGroupComponent convertStructureMapGroupComponent(org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.StructureMap.StructureMapGroupComponent tgt = new org.hl7.fhir.r5.model.StructureMap.StructureMapGroupComponent(); + copyElement(src, tgt); + tgt.setName(src.getName()); + if (src.hasExtends()) + tgt.setExtends(src.getExtends()); + tgt.setTypeMode(org.hl7.fhir.r5.model.StructureMap.StructureMapGroupTypeMode.NONE); + if (src.hasDocumentation()) + tgt.setDocumentation(src.getDocumentation()); + for (org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupInputComponent t : src.getInput()) + tgt.addInput(convertStructureMapGroupInputComponent(t)); + for (org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupRuleComponent t : src.getRule()) + tgt.addRule(convertStructureMapGroupRuleComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupComponent convertStructureMapGroupComponent(org.hl7.fhir.r5.model.StructureMap.StructureMapGroupComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupComponent tgt = new org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupComponent(); + copyElement(src, tgt); + tgt.setName(src.getName()); + if (src.hasExtends()) + tgt.setExtends(src.getExtends()); + if (!src.getTypeMode().equals(org.hl7.fhir.r5.model.StructureMap.StructureMapGroupTypeMode.NONE)) + throw new FHIRException("Unable to downgrade structure map with group.typeMode other than 'None': " + src.getTypeMode().getDisplay()); + if (src.hasDocumentation()) + tgt.setDocumentation(src.getDocumentation()); + for (org.hl7.fhir.r5.model.StructureMap.StructureMapGroupInputComponent t : src.getInput()) + tgt.addInput(convertStructureMapGroupInputComponent(t)); + for (org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleComponent t : src.getRule()) + tgt.addRule(convertStructureMapGroupRuleComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.StructureMap.StructureMapGroupInputComponent convertStructureMapGroupInputComponent(org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupInputComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.StructureMap.StructureMapGroupInputComponent tgt = new org.hl7.fhir.r5.model.StructureMap.StructureMapGroupInputComponent(); + copyElement(src, tgt); + tgt.setName(src.getName()); + if (src.hasType()) + tgt.setType(src.getType()); + tgt.setMode(convertStructureMapInputMode(src.getMode())); + if (src.hasDocumentation()) + tgt.setDocumentation(src.getDocumentation()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupInputComponent convertStructureMapGroupInputComponent(org.hl7.fhir.r5.model.StructureMap.StructureMapGroupInputComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupInputComponent tgt = new org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupInputComponent(); + copyElement(src, tgt); + tgt.setName(src.getName()); + if (src.hasType()) + tgt.setType(src.getType()); + tgt.setMode(convertStructureMapInputMode(src.getMode())); + if (src.hasDocumentation()) + tgt.setDocumentation(src.getDocumentation()); + return tgt; + } + + public static org.hl7.fhir.r5.model.StructureMap.StructureMapInputMode convertStructureMapInputMode(org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapInputMode src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case SOURCE: return org.hl7.fhir.r5.model.StructureMap.StructureMapInputMode.SOURCE; + case TARGET: return org.hl7.fhir.r5.model.StructureMap.StructureMapInputMode.TARGET; + default: return org.hl7.fhir.r5.model.StructureMap.StructureMapInputMode.NULL; + } + } + + public static org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapInputMode convertStructureMapInputMode(org.hl7.fhir.r5.model.StructureMap.StructureMapInputMode src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case SOURCE: return org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapInputMode.SOURCE; + case TARGET: return org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapInputMode.TARGET; + default: return org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapInputMode.NULL; + } + } + + public static org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleComponent convertStructureMapGroupRuleComponent(org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupRuleComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleComponent tgt = new org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleComponent(); + copyElement(src, tgt); + tgt.setName(src.getName()); + for (org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupRuleSourceComponent t : src.getSource()) + tgt.addSource(convertStructureMapGroupRuleSourceComponent(t)); + for (org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupRuleTargetComponent t : src.getTarget()) + tgt.addTarget(convertStructureMapGroupRuleTargetComponent(t)); + for (org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupRuleComponent t : src.getRule()) + tgt.addRule(convertStructureMapGroupRuleComponent(t)); + for (org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupRuleDependentComponent t : src.getDependent()) + tgt.addDependent(convertStructureMapGroupRuleDependentComponent(t)); + if (src.hasDocumentation()) + tgt.setDocumentation(src.getDocumentation()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupRuleComponent convertStructureMapGroupRuleComponent(org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupRuleComponent tgt = new org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupRuleComponent(); + copyElement(src, tgt); + tgt.setName(src.getName()); + for (org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleSourceComponent t : src.getSource()) + tgt.addSource(convertStructureMapGroupRuleSourceComponent(t)); + for (org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleTargetComponent t : src.getTarget()) + tgt.addTarget(convertStructureMapGroupRuleTargetComponent(t)); + for (org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleComponent t : src.getRule()) + tgt.addRule(convertStructureMapGroupRuleComponent(t)); + for (org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleDependentComponent t : src.getDependent()) + tgt.addDependent(convertStructureMapGroupRuleDependentComponent(t)); + if (src.hasDocumentation()) + tgt.setDocumentation(src.getDocumentation()); + return tgt; + } + + public static org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleSourceComponent convertStructureMapGroupRuleSourceComponent(org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupRuleSourceComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleSourceComponent tgt = new org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleSourceComponent(); + copyElement(src, tgt); + tgt.setMin(src.getRequired()? 1 : 0); + if (src.getContextType().equals(StructureMap.StructureMapContextType.TYPE)) + tgt.setType(src.getContext()); + if (src.hasElement()) + tgt.setElement(src.getElement()); + if (src.hasListMode()) + tgt.setListMode(convertStructureMapSourceListMode(src.getListMode())); + if (src.hasVariable()) + tgt.setVariable(src.getVariable()); + if (src.hasCondition()) + tgt.setCondition(src.getCondition()); + if (src.hasCheck()) + tgt.setCheck(src.getCheck()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupRuleSourceComponent convertStructureMapGroupRuleSourceComponent(org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleSourceComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupRuleSourceComponent tgt = new org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupRuleSourceComponent(); + copyElement(src, tgt); + tgt.setContextType(StructureMapContextType.TYPE); + tgt.setContext(src.getContext()); + if (src.hasElement()) + tgt.setElement(src.getElement()); + if (src.hasListMode()) + tgt.setListMode(convertStructureMapSourceListMode(src.getListMode())); + if (src.hasVariable()) + tgt.setVariable(src.getVariable()); + if (src.hasCondition()) + tgt.setCondition(src.getCondition()); + if (src.hasCheck()) + tgt.setCheck(src.getCheck()); + return tgt; + } + + public static org.hl7.fhir.r5.model.StructureMap.StructureMapSourceListMode convertStructureMapSourceListMode(StructureMapListMode src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case FIRST: return org.hl7.fhir.r5.model.StructureMap.StructureMapSourceListMode.FIRST; + case LAST: return org.hl7.fhir.r5.model.StructureMap.StructureMapSourceListMode.LAST; + default: return org.hl7.fhir.r5.model.StructureMap.StructureMapSourceListMode.NULL; + } + } + + public static org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapListMode convertStructureMapSourceListMode(org.hl7.fhir.r5.model.StructureMap.StructureMapSourceListMode src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case FIRST: return org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapListMode.FIRST; + case LAST: return org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapListMode.LAST; + default: return org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapListMode.NULL; + } + } + + public static org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleTargetComponent convertStructureMapGroupRuleTargetComponent(org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupRuleTargetComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleTargetComponent tgt = new org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleTargetComponent(); + copyElement(src, tgt); + if (src.hasContext()) + tgt.setContext(src.getContext()); + if (src.hasContextType()) + tgt.setContextType(convertStructureMapContextType(src.getContextType())); + if (src.hasElement()) + tgt.setElement(src.getElement()); + if (src.hasVariable()) + tgt.setVariable(src.getVariable()); + for (org.hl7.fhir.dstu2016may.model.Enumeration t : src.getListMode()) + tgt.addListMode(convertStructureMapTargetListMode(t.getValue())); + if (src.hasListRuleId()) + tgt.setListRuleId(src.getListRuleId()); + if (src.hasTransform()) + tgt.setTransform(convertStructureMapTransform(src.getTransform())); + for (org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupRuleTargetParameterComponent t : src.getParameter()) + tgt.addParameter(convertStructureMapGroupRuleTargetParameterComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupRuleTargetComponent convertStructureMapGroupRuleTargetComponent(org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleTargetComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupRuleTargetComponent tgt = new org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupRuleTargetComponent(); + copyElement(src, tgt); + if (src.hasContext()) + tgt.setContext(src.getContext()); + if (src.hasContextType()) + tgt.setContextType(convertStructureMapContextType(src.getContextType())); + if (src.hasElement()) + tgt.setElement(src.getElement()); + if (src.hasVariable()) + tgt.setVariable(src.getVariable()); + for (Enumeration t : src.getListMode()) + tgt.addListMode(convertStructureMapTargetListMode(t.getValue())); + if (src.hasListRuleId()) + tgt.setListRuleId(src.getListRuleId()); + if (src.hasTransform()) + tgt.setTransform(convertStructureMapTransform(src.getTransform())); + for (org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleTargetParameterComponent t : src.getParameter()) + tgt.addParameter(convertStructureMapGroupRuleTargetParameterComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.StructureMap.StructureMapContextType convertStructureMapContextType(StructureMapContextType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case TYPE: return org.hl7.fhir.r5.model.StructureMap.StructureMapContextType.TYPE; + case VARIABLE: return org.hl7.fhir.r5.model.StructureMap.StructureMapContextType.VARIABLE; + default: return org.hl7.fhir.r5.model.StructureMap.StructureMapContextType.NULL; + } + } + + public static org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapContextType convertStructureMapContextType(org.hl7.fhir.r5.model.StructureMap.StructureMapContextType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case TYPE: return org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapContextType.TYPE; + case VARIABLE: return org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapContextType.VARIABLE; + default: return org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapContextType.NULL; + } + } + + public static org.hl7.fhir.r5.model.StructureMap.StructureMapTargetListMode convertStructureMapTargetListMode(StructureMapListMode src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case FIRST: return org.hl7.fhir.r5.model.StructureMap.StructureMapTargetListMode.FIRST; + case LAST: return org.hl7.fhir.r5.model.StructureMap.StructureMapTargetListMode.LAST; + case SHARE: return org.hl7.fhir.r5.model.StructureMap.StructureMapTargetListMode.SHARE; + default: return org.hl7.fhir.r5.model.StructureMap.StructureMapTargetListMode.NULL; + } + } + + public static org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapListMode convertStructureMapTargetListMode(org.hl7.fhir.r5.model.StructureMap.StructureMapTargetListMode src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case FIRST: return org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapListMode.FIRST; + case LAST: return org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapListMode.LAST; + case SHARE: return org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapListMode.SHARE; + default: return org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapListMode.NULL; + } + } + + public static org.hl7.fhir.r5.model.StructureMap.StructureMapTransform convertStructureMapTransform(StructureMap.StructureMapTransform src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case APPEND: return org.hl7.fhir.r5.model.StructureMap.StructureMapTransform.APPEND; + case CAST: return org.hl7.fhir.r5.model.StructureMap.StructureMapTransform.CAST; + case COPY: return org.hl7.fhir.r5.model.StructureMap.StructureMapTransform.COPY; + case CREATE: return org.hl7.fhir.r5.model.StructureMap.StructureMapTransform.CREATE; + case DATEOP: return org.hl7.fhir.r5.model.StructureMap.StructureMapTransform.DATEOP; + case ESCAPE: return org.hl7.fhir.r5.model.StructureMap.StructureMapTransform.ESCAPE; + case EVALUATE: return org.hl7.fhir.r5.model.StructureMap.StructureMapTransform.EVALUATE; + case POINTER: return org.hl7.fhir.r5.model.StructureMap.StructureMapTransform.POINTER; + case REFERENCE: return org.hl7.fhir.r5.model.StructureMap.StructureMapTransform.REFERENCE; + case TRANSLATE: return org.hl7.fhir.r5.model.StructureMap.StructureMapTransform.TRANSLATE; + case TRUNCATE: return org.hl7.fhir.r5.model.StructureMap.StructureMapTransform.TRUNCATE; + case UUID: return org.hl7.fhir.r5.model.StructureMap.StructureMapTransform.UUID; + default: return org.hl7.fhir.r5.model.StructureMap.StructureMapTransform.NULL; + } + } + + public static org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapTransform convertStructureMapTransform(org.hl7.fhir.r5.model.StructureMap.StructureMapTransform src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case APPEND: return org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapTransform.APPEND; + case CAST: return org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapTransform.CAST; + case COPY: return org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapTransform.COPY; + case CREATE: return org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapTransform.CREATE; + case DATEOP: return org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapTransform.DATEOP; + case ESCAPE: return org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapTransform.ESCAPE; + case EVALUATE: return org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapTransform.EVALUATE; + case POINTER: return org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapTransform.POINTER; + case REFERENCE: return org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapTransform.REFERENCE; + case TRANSLATE: return org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapTransform.TRANSLATE; + case TRUNCATE: return org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapTransform.TRUNCATE; + case UUID: return org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapTransform.UUID; + default: return org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapTransform.NULL; + } + } + + public static org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleTargetParameterComponent convertStructureMapGroupRuleTargetParameterComponent(org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupRuleTargetParameterComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleTargetParameterComponent tgt = new org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleTargetParameterComponent(); + copyElement(src, tgt); + tgt.setValue(convertType(src.getValue())); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupRuleTargetParameterComponent convertStructureMapGroupRuleTargetParameterComponent(org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleTargetParameterComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupRuleTargetParameterComponent tgt = new org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupRuleTargetParameterComponent(); + copyElement(src, tgt); + tgt.setValue(convertType(src.getValue())); + return tgt; + } + + public static org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleDependentComponent convertStructureMapGroupRuleDependentComponent(org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupRuleDependentComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleDependentComponent tgt = new org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleDependentComponent(); + copyElement(src, tgt); + tgt.setName(src.getName()); + for (org.hl7.fhir.dstu2016may.model.StringType t : src.getVariable()) + tgt.addVariable(t.asStringValue()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupRuleDependentComponent convertStructureMapGroupRuleDependentComponent(org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleDependentComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupRuleDependentComponent tgt = new org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupRuleDependentComponent(); + copyElement(src, tgt); + tgt.setName(src.getName()); + for (org.hl7.fhir.r5.model.StringType t : src.getVariable()) + tgt.addVariable(t.asStringValue()); + return tgt; + } + + + + public static org.hl7.fhir.r5.model.ValueSet convertValueSet(org.hl7.fhir.dstu2016may.model.ValueSet src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.ValueSet tgt = new org.hl7.fhir.r5.model.ValueSet(); + copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + if (src.hasIdentifier()) + tgt.addIdentifier(convertIdentifier(src.getIdentifier())); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasName()) + tgt.setName(src.getName()); + tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetContactComponent t : src.getContact()) + tgt.addContact(convertValueSetContactComponent(t)); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu2016may.model.CodeableConcept t : src.getUseContext()) + if (isJurisdiction(t)) + tgt.addJurisdiction(convertCodeableConcept(t)); + else + tgt.addUseContext(convertCodeableConceptToUsageContext(t)); + if (src.hasImmutable()) + tgt.setImmutable(src.getImmutable()); + if (src.hasRequirements()) + tgt.setPurpose(src.getRequirements()); + if (src.hasCopyright()) + tgt.setCopyright(src.getCopyright()); + if (src.hasExtensible()) + tgt.addExtension("http://hl7.org/fhir/StructureDefinition/valueset-extensible", new BooleanType(src.getExtensible())); + tgt.setCompose(convertValueSetComposeComponent(src.getCompose())); + if (src.hasLockedDate()) + tgt.getCompose().setLockedDate(src.getLockedDate()); + tgt.setExpansion(convertValueSetExpansionComponent(src.getExpansion())); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.ValueSet convertValueSet(org.hl7.fhir.r5.model.ValueSet src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.ValueSet tgt = new org.hl7.fhir.dstu2016may.model.ValueSet(); + copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.setIdentifier(convertIdentifier(t)); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasName()) + tgt.setName(src.getName()); + tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.r5.model.ContactDetail t : src.getContact()) + tgt.addContact(convertValueSetContactComponent(t)); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.getCompose().hasLockedDate()) + tgt.setLockedDate(src.getCompose().getLockedDate()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.r5.model.UsageContext t : src.getUseContext()) + if (t.hasValueCodeableConcept()) + tgt.addUseContext(convertCodeableConcept(t.getValueCodeableConcept())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getJurisdiction()) + tgt.addUseContext(convertCodeableConcept(t)); + if (src.hasImmutable()) + tgt.setImmutable(src.getImmutable()); + if (src.hasPurpose()) + tgt.setRequirements(src.getPurpose()); + if (src.hasCopyright()) + tgt.setCopyright(src.getCopyright()); + if (src.hasExtension("http://hl7.org/fhir/StructureDefinition/valueset-extensible")) + tgt.setExtensible(((BooleanType) src.getExtensionByUrl("http://hl7.org/fhir/StructureDefinition/valueset-extensible").getValue()).booleanValue()); + tgt.setCompose(convertValueSetComposeComponent(src.getCompose())); + if (src.hasExpansion()) + tgt.setExpansion(convertValueSetExpansionComponent(src.getExpansion())); + return tgt; + } + + public static org.hl7.fhir.r5.model.ContactDetail convertValueSetContactComponent(org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetContactComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.ContactDetail tgt = new org.hl7.fhir.r5.model.ContactDetail(); + copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + for (org.hl7.fhir.dstu2016may.model.ContactPoint t : src.getTelecom()) + tgt.addTelecom(convertContactPoint(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetContactComponent convertValueSetContactComponent(org.hl7.fhir.r5.model.ContactDetail src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetContactComponent tgt = new org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetContactComponent(); + copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + for (org.hl7.fhir.r5.model.ContactPoint t : src.getTelecom()) + tgt.addTelecom(convertContactPoint(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.ValueSet.ValueSetComposeComponent convertValueSetComposeComponent(org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetComposeComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.ValueSet.ValueSetComposeComponent tgt = new org.hl7.fhir.r5.model.ValueSet.ValueSetComposeComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.dstu2016may.model.UriType t : src.getImport()) + tgt.addInclude().addValueSet(t.getValue()); + for (org.hl7.fhir.dstu2016may.model.ValueSet.ConceptSetComponent t : src.getInclude()) + tgt.addInclude(convertConceptSetComponent(t)); + for (org.hl7.fhir.dstu2016may.model.ValueSet.ConceptSetComponent t : src.getExclude()) + tgt.addExclude(convertConceptSetComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetComposeComponent convertValueSetComposeComponent(org.hl7.fhir.r5.model.ValueSet.ValueSetComposeComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetComposeComponent tgt = new org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetComposeComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.r5.model.ValueSet.ConceptSetComponent t : src.getInclude()) { + for (org.hl7.fhir.r5.model.UriType ti : t.getValueSet()) + tgt.addImport(ti.getValue()); + tgt.addInclude(convertConceptSetComponent(t)); + } + for (org.hl7.fhir.r5.model.ValueSet.ConceptSetComponent t : src.getExclude()) + tgt.addExclude(convertConceptSetComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.ValueSet.ConceptSetComponent convertConceptSetComponent(org.hl7.fhir.dstu2016may.model.ValueSet.ConceptSetComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.ValueSet.ConceptSetComponent tgt = new org.hl7.fhir.r5.model.ValueSet.ConceptSetComponent(); + copyElement(src, tgt); + tgt.setSystem(src.getSystem()); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + for (org.hl7.fhir.dstu2016may.model.ValueSet.ConceptReferenceComponent t : src.getConcept()) + tgt.addConcept(convertConceptReferenceComponent(t)); + for (org.hl7.fhir.dstu2016may.model.ValueSet.ConceptSetFilterComponent t : src.getFilter()) + tgt.addFilter(convertConceptSetFilterComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.ValueSet.ConceptSetComponent convertConceptSetComponent(org.hl7.fhir.r5.model.ValueSet.ConceptSetComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.ValueSet.ConceptSetComponent tgt = new org.hl7.fhir.dstu2016may.model.ValueSet.ConceptSetComponent(); + copyElement(src, tgt); + tgt.setSystem(src.getSystem()); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + for (org.hl7.fhir.r5.model.ValueSet.ConceptReferenceComponent t : src.getConcept()) + tgt.addConcept(convertConceptReferenceComponent(t)); + for (org.hl7.fhir.r5.model.ValueSet.ConceptSetFilterComponent t : src.getFilter()) + tgt.addFilter(convertConceptSetFilterComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.ValueSet.ConceptReferenceComponent convertConceptReferenceComponent(org.hl7.fhir.dstu2016may.model.ValueSet.ConceptReferenceComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.ValueSet.ConceptReferenceComponent tgt = new org.hl7.fhir.r5.model.ValueSet.ConceptReferenceComponent(); + copyElement(src, tgt); + tgt.setCode(src.getCode()); + if (src.hasDisplay()) + tgt.setDisplay(src.getDisplay()); + for (org.hl7.fhir.dstu2016may.model.ValueSet.ConceptReferenceDesignationComponent t : src.getDesignation()) + tgt.addDesignation(convertConceptReferenceDesignationComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.ValueSet.ConceptReferenceComponent convertConceptReferenceComponent(org.hl7.fhir.r5.model.ValueSet.ConceptReferenceComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.ValueSet.ConceptReferenceComponent tgt = new org.hl7.fhir.dstu2016may.model.ValueSet.ConceptReferenceComponent(); + copyElement(src, tgt); + tgt.setCode(src.getCode()); + if (src.hasDisplay()) + tgt.setDisplay(src.getDisplay()); + for (org.hl7.fhir.r5.model.ValueSet.ConceptReferenceDesignationComponent t : src.getDesignation()) + tgt.addDesignation(convertConceptReferenceDesignationComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.ValueSet.ConceptReferenceDesignationComponent convertConceptReferenceDesignationComponent(org.hl7.fhir.dstu2016may.model.ValueSet.ConceptReferenceDesignationComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.ValueSet.ConceptReferenceDesignationComponent tgt = new org.hl7.fhir.r5.model.ValueSet.ConceptReferenceDesignationComponent(); + copyElement(src, tgt); + if (src.hasLanguage()) + tgt.setLanguage(src.getLanguage()); + tgt.setUse(convertCoding(src.getUse())); + tgt.setValue(src.getValue()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.ValueSet.ConceptReferenceDesignationComponent convertConceptReferenceDesignationComponent(org.hl7.fhir.r5.model.ValueSet.ConceptReferenceDesignationComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.ValueSet.ConceptReferenceDesignationComponent tgt = new org.hl7.fhir.dstu2016may.model.ValueSet.ConceptReferenceDesignationComponent(); + copyElement(src, tgt); + if (src.hasLanguage()) + tgt.setLanguage(src.getLanguage()); + tgt.setUse(convertCoding(src.getUse())); + tgt.setValue(src.getValue()); + return tgt; + } + + public static org.hl7.fhir.r5.model.ValueSet.ConceptSetFilterComponent convertConceptSetFilterComponent(org.hl7.fhir.dstu2016may.model.ValueSet.ConceptSetFilterComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.ValueSet.ConceptSetFilterComponent tgt = new org.hl7.fhir.r5.model.ValueSet.ConceptSetFilterComponent(); + copyElement(src, tgt); + tgt.setProperty(src.getProperty()); + tgt.setOp(convertFilterOperator(src.getOp())); + tgt.setValue(src.getValue()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.ValueSet.ConceptSetFilterComponent convertConceptSetFilterComponent(org.hl7.fhir.r5.model.ValueSet.ConceptSetFilterComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.ValueSet.ConceptSetFilterComponent tgt = new org.hl7.fhir.dstu2016may.model.ValueSet.ConceptSetFilterComponent(); + copyElement(src, tgt); + tgt.setProperty(src.getProperty()); + tgt.setOp(convertFilterOperator(src.getOp())); + tgt.setValue(src.getValue()); + return tgt; + } + + private static org.hl7.fhir.r5.model.ValueSet.FilterOperator convertFilterOperator(org.hl7.fhir.dstu2016may.model.ValueSet.FilterOperator src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case EQUAL: return org.hl7.fhir.r5.model.ValueSet.FilterOperator.EQUAL; + case ISA: return org.hl7.fhir.r5.model.ValueSet.FilterOperator.ISA; + case ISNOTA: return org.hl7.fhir.r5.model.ValueSet.FilterOperator.ISNOTA; + case REGEX: return org.hl7.fhir.r5.model.ValueSet.FilterOperator.REGEX; + case IN: return org.hl7.fhir.r5.model.ValueSet.FilterOperator.IN; + case NOTIN: return org.hl7.fhir.r5.model.ValueSet.FilterOperator.NOTIN; + default: return org.hl7.fhir.r5.model.ValueSet.FilterOperator.NULL; + } + } + + private static org.hl7.fhir.dstu2016may.model.ValueSet.FilterOperator convertFilterOperator(org.hl7.fhir.r5.model.ValueSet.FilterOperator src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case EQUAL: return org.hl7.fhir.dstu2016may.model.ValueSet.FilterOperator.EQUAL; + case ISA: return org.hl7.fhir.dstu2016may.model.ValueSet.FilterOperator.ISA; + case ISNOTA: return org.hl7.fhir.dstu2016may.model.ValueSet.FilterOperator.ISNOTA; + case REGEX: return org.hl7.fhir.dstu2016may.model.ValueSet.FilterOperator.REGEX; + case IN: return org.hl7.fhir.dstu2016may.model.ValueSet.FilterOperator.IN; + case NOTIN: return org.hl7.fhir.dstu2016may.model.ValueSet.FilterOperator.NOTIN; + default: return org.hl7.fhir.dstu2016may.model.ValueSet.FilterOperator.NULL; + } + } + + public static org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionComponent convertValueSetExpansionComponent(org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetExpansionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionComponent tgt = new org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionComponent(); + copyElement(src, tgt); + tgt.setIdentifier(src.getIdentifier()); + tgt.setTimestamp(src.getTimestamp()); + if (src.hasTotal()) + tgt.setTotal(src.getTotal()); + if (src.hasOffset()) + tgt.setOffset(src.getOffset()); + for (org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetExpansionParameterComponent t : src.getParameter()) + tgt.addParameter(convertValueSetExpansionParameterComponent(t)); + for (org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetExpansionContainsComponent t : src.getContains()) + tgt.addContains(convertValueSetExpansionContainsComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetExpansionComponent convertValueSetExpansionComponent(org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetExpansionComponent tgt = new org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetExpansionComponent(); + copyElement(src, tgt); + tgt.setIdentifier(src.getIdentifier()); + tgt.setTimestamp(src.getTimestamp()); + if (src.hasTotal()) + tgt.setTotal(src.getTotal()); + if (src.hasOffset()) + tgt.setOffset(src.getOffset()); + for (org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionParameterComponent t : src.getParameter()) + tgt.addParameter(convertValueSetExpansionParameterComponent(t)); + for (org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionContainsComponent t : src.getContains()) + tgt.addContains(convertValueSetExpansionContainsComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionParameterComponent convertValueSetExpansionParameterComponent(org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetExpansionParameterComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionParameterComponent tgt = new org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionParameterComponent(); + copyElement(src, tgt); + tgt.setName(src.getName()); + tgt.setValue(convertType(src.getValue())); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetExpansionParameterComponent convertValueSetExpansionParameterComponent(org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionParameterComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetExpansionParameterComponent tgt = new org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetExpansionParameterComponent(); + copyElement(src, tgt); + tgt.setName(src.getName()); + tgt.setValue(convertType(src.getValue())); + return tgt; + } + + public static org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionContainsComponent convertValueSetExpansionContainsComponent(org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetExpansionContainsComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionContainsComponent tgt = new org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionContainsComponent(); + copyElement(src, tgt); + if (src.hasSystem()) + tgt.setSystem(src.getSystem()); + if (src.hasAbstract()) + tgt.setAbstract(src.getAbstract()); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasCode()) + tgt.setCode(src.getCode()); + if (src.hasDisplay()) + tgt.setDisplay(src.getDisplay()); + for (org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetExpansionContainsComponent t : src.getContains()) + tgt.addContains(convertValueSetExpansionContainsComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetExpansionContainsComponent convertValueSetExpansionContainsComponent(org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionContainsComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetExpansionContainsComponent tgt = new org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetExpansionContainsComponent(); + copyElement(src, tgt); + if (src.hasSystem()) + tgt.setSystem(src.getSystem()); + if (src.hasAbstract()) + tgt.setAbstract(src.getAbstract()); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasCode()) + tgt.setCode(src.getCode()); + if (src.hasDisplay()) + tgt.setDisplay(src.getDisplay()); + for (org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionContainsComponent t : src.getContains()) + tgt.addContains(convertValueSetExpansionContainsComponent(t)); + return tgt; + } + +/* public static org.hl7.fhir.r5.model.VisionPrescription convertVisionPrescription(org.hl7.fhir.dstu2016may.model.VisionPrescription src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.VisionPrescription tgt = new org.hl7.fhir.r5.model.VisionPrescription(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu2016may.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + tgt.setDateWritten(src.getDateWritten()); + tgt.setPatient(convertReference(src.getPatient())); + tgt.setPrescriber(convertReference(src.getPrescriber())); + tgt.setEncounter(convertReference(src.getEncounter())); + tgt.setReason(convertType(src.getReason())); + for (org.hl7.fhir.dstu2016may.model.VisionPrescription.VisionPrescriptionDispenseComponent t : src.getDispense()) + tgt.addDispense(convertVisionPrescriptionDispenseComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.VisionPrescription convertVisionPrescription(org.hl7.fhir.r5.model.VisionPrescription src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.VisionPrescription tgt = new org.hl7.fhir.dstu2016may.model.VisionPrescription(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + tgt.setDateWritten(src.getDateWritten()); + tgt.setPatient(convertReference(src.getPatient())); + tgt.setPrescriber(convertReference(src.getPrescriber())); + tgt.setEncounter(convertReference(src.getEncounter())); + tgt.setReason(convertType(src.getReason())); + for (org.hl7.fhir.r5.model.VisionPrescription.VisionPrescriptionDispenseComponent t : src.getDispense()) + tgt.addDispense(convertVisionPrescriptionDispenseComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.VisionPrescription.VisionPrescriptionDispenseComponent convertVisionPrescriptionDispenseComponent(org.hl7.fhir.dstu2016may.model.VisionPrescription.VisionPrescriptionDispenseComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r5.model.VisionPrescription.VisionPrescriptionDispenseComponent tgt = new org.hl7.fhir.r5.model.VisionPrescription.VisionPrescriptionDispenseComponent(); + copyElement(src, tgt); + tgt.setProduct(convertCoding(src.getProduct())); + tgt.setEye(convertVisionEyes(src.getEye())); + tgt.setSphere(src.getSphere()); + tgt.setCylinder(src.getCylinder()); + tgt.setAxis(src.getAxis()); + tgt.setPrism(src.getPrism()); + tgt.setBase(convertVisionBase(src.getBase())); + tgt.setAdd(src.getAdd()); + tgt.setPower(src.getPower()); + tgt.setBackCurve(src.getBackCurve()); + tgt.setDiameter(src.getDiameter()); + tgt.setDuration(convertSimpleQuantity(src.getDuration())); + tgt.setColor(src.getColor()); + tgt.setBrand(src.getBrand()); + tgt.setNotes(src.getNotes()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.VisionPrescription.VisionPrescriptionDispenseComponent convertVisionPrescriptionDispenseComponent(org.hl7.fhir.r5.model.VisionPrescription.VisionPrescriptionDispenseComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.VisionPrescription.VisionPrescriptionDispenseComponent tgt = new org.hl7.fhir.dstu2016may.model.VisionPrescription.VisionPrescriptionDispenseComponent(); + copyElement(src, tgt); + tgt.setProduct(convertCoding(src.getProduct())); + tgt.setEye(convertVisionEyes(src.getEye())); + tgt.setSphere(src.getSphere()); + tgt.setCylinder(src.getCylinder()); + tgt.setAxis(src.getAxis()); + tgt.setPrism(src.getPrism()); + tgt.setBase(convertVisionBase(src.getBase())); + tgt.setAdd(src.getAdd()); + tgt.setPower(src.getPower()); + tgt.setBackCurve(src.getBackCurve()); + tgt.setDiameter(src.getDiameter()); + tgt.setDuration(convertSimpleQuantity(src.getDuration())); + tgt.setColor(src.getColor()); + tgt.setBrand(src.getBrand()); + tgt.setNotes(src.getNotes()); + return tgt; + } + + private static org.hl7.fhir.r5.model.VisionPrescription.VisionEyes convertVisionEyes(org.hl7.fhir.dstu2016may.model.VisionPrescription.VisionEyes src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case RIGHT: return org.hl7.fhir.r5.model.VisionPrescription.VisionEyes.RIGHT; + case LEFT: return org.hl7.fhir.r5.model.VisionPrescription.VisionEyes.LEFT; + default: return org.hl7.fhir.r5.model.VisionPrescription.VisionEyes.NULL; + } + } + + private static org.hl7.fhir.dstu2016may.model.VisionPrescription.VisionEyes convertVisionEyes(org.hl7.fhir.r5.model.VisionPrescription.VisionEyes src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case RIGHT: return org.hl7.fhir.dstu2016may.model.VisionPrescription.VisionEyes.RIGHT; + case LEFT: return org.hl7.fhir.dstu2016may.model.VisionPrescription.VisionEyes.LEFT; + default: return org.hl7.fhir.dstu2016may.model.VisionPrescription.VisionEyes.NULL; + } + } + + private static org.hl7.fhir.r5.model.VisionPrescription.VisionBase convertVisionBase(org.hl7.fhir.dstu2016may.model.VisionPrescription.VisionBase src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case UP: return org.hl7.fhir.r5.model.VisionPrescription.VisionBase.UP; + case DOWN: return org.hl7.fhir.r5.model.VisionPrescription.VisionBase.DOWN; + case IN: return org.hl7.fhir.r5.model.VisionPrescription.VisionBase.IN; + case OUT: return org.hl7.fhir.r5.model.VisionPrescription.VisionBase.OUT; + default: return org.hl7.fhir.r5.model.VisionPrescription.VisionBase.NULL; + } + } + + private static org.hl7.fhir.dstu2016may.model.VisionPrescription.VisionBase convertVisionBase(org.hl7.fhir.r5.model.VisionPrescription.VisionBase src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case UP: return org.hl7.fhir.dstu2016may.model.VisionPrescription.VisionBase.UP; + case DOWN: return org.hl7.fhir.dstu2016may.model.VisionPrescription.VisionBase.DOWN; + case IN: return org.hl7.fhir.dstu2016may.model.VisionPrescription.VisionBase.IN; + case OUT: return org.hl7.fhir.dstu2016may.model.VisionPrescription.VisionBase.OUT; + default: return org.hl7.fhir.dstu2016may.model.VisionPrescription.VisionBase.NULL; + } + } +*/ + public static org.hl7.fhir.r5.model.Resource convertResource(org.hl7.fhir.dstu2016may.model.Resource src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + if (src instanceof org.hl7.fhir.dstu2016may.model.Parameters) + return convertParameters((org.hl7.fhir.dstu2016may.model.Parameters) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.Bundle) + return convertBundle((org.hl7.fhir.dstu2016may.model.Bundle) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.CodeSystem) + return convertCodeSystem((org.hl7.fhir.dstu2016may.model.CodeSystem) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.CompartmentDefinition) + return convertCompartmentDefinition((org.hl7.fhir.dstu2016may.model.CompartmentDefinition) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.ConceptMap) + return convertConceptMap((org.hl7.fhir.dstu2016may.model.ConceptMap) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.Conformance) + return convertConformance((org.hl7.fhir.dstu2016may.model.Conformance) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.DataElement) + return convertDataElement((org.hl7.fhir.dstu2016may.model.DataElement) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.ImplementationGuide) + return convertImplementationGuide((org.hl7.fhir.dstu2016may.model.ImplementationGuide) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.NamingSystem) + return convertNamingSystem((org.hl7.fhir.dstu2016may.model.NamingSystem) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.OperationDefinition) + return convertOperationDefinition((org.hl7.fhir.dstu2016may.model.OperationDefinition) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.OperationOutcome) + return convertOperationOutcome((org.hl7.fhir.dstu2016may.model.OperationOutcome) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.Questionnaire) + return convertQuestionnaire((org.hl7.fhir.dstu2016may.model.Questionnaire) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.QuestionnaireResponse) + return convertQuestionnaireResponse((org.hl7.fhir.dstu2016may.model.QuestionnaireResponse) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.SearchParameter) + return convertSearchParameter((org.hl7.fhir.dstu2016may.model.SearchParameter) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.StructureDefinition) + return convertStructureDefinition((org.hl7.fhir.dstu2016may.model.StructureDefinition) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.StructureMap) + return convertStructureMap((org.hl7.fhir.dstu2016may.model.StructureMap) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.ValueSet) + return convertValueSet((org.hl7.fhir.dstu2016may.model.ValueSet) src); +/* if (src instanceof org.hl7.fhir.dstu2016may.model.VisionPrescription) + return convertVisionPrescription((org.hl7.fhir.dstu2016may.model.VisionPrescription) src);*/ + throw new FHIRException("Unknown resource "+src.fhirType()); + } + + public static org.hl7.fhir.dstu2016may.model.Resource convertResource(org.hl7.fhir.r5.model.Resource src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + if (src instanceof org.hl7.fhir.r5.model.Parameters) + return convertParameters((org.hl7.fhir.r5.model.Parameters) src); + if (src instanceof org.hl7.fhir.r5.model.Bundle) + return convertBundle((org.hl7.fhir.r5.model.Bundle) src); + if (src instanceof org.hl7.fhir.r5.model.CodeSystem) + return convertCodeSystem((org.hl7.fhir.r5.model.CodeSystem) src); + if (src instanceof org.hl7.fhir.r5.model.CompartmentDefinition) + return convertCompartmentDefinition((org.hl7.fhir.r5.model.CompartmentDefinition) src); + if (src instanceof org.hl7.fhir.r5.model.ConceptMap) + return convertConceptMap((org.hl7.fhir.r5.model.ConceptMap) src); + if (src instanceof org.hl7.fhir.r5.model.CapabilityStatement) + return convertConformance((org.hl7.fhir.r5.model.CapabilityStatement) src); +// if (src instanceof org.hl7.fhir.r5.model.DataElement) +// return convertDataElement((org.hl7.fhir.r5.model.DataElement) src); + if (src instanceof org.hl7.fhir.r5.model.ImplementationGuide) + return convertImplementationGuide((org.hl7.fhir.r5.model.ImplementationGuide) src); + if (src instanceof org.hl7.fhir.r5.model.NamingSystem) + return convertNamingSystem((org.hl7.fhir.r5.model.NamingSystem) src); + if (src instanceof org.hl7.fhir.r5.model.OperationDefinition) + return convertOperationDefinition((org.hl7.fhir.r5.model.OperationDefinition) src); + if (src instanceof org.hl7.fhir.r5.model.OperationOutcome) + return convertOperationOutcome((org.hl7.fhir.r5.model.OperationOutcome) src); + if (src instanceof org.hl7.fhir.r5.model.Questionnaire) + return convertQuestionnaire((org.hl7.fhir.r5.model.Questionnaire) src); + if (src instanceof org.hl7.fhir.r5.model.QuestionnaireResponse) + return convertQuestionnaireResponse((org.hl7.fhir.r5.model.QuestionnaireResponse) src); + if (src instanceof org.hl7.fhir.r5.model.SearchParameter) + return convertSearchParameter((org.hl7.fhir.r5.model.SearchParameter) src); + if (src instanceof org.hl7.fhir.r5.model.StructureDefinition) + return convertStructureDefinition((org.hl7.fhir.r5.model.StructureDefinition) src); + if (src instanceof org.hl7.fhir.r5.model.StructureMap) + return convertStructureMap((org.hl7.fhir.r5.model.StructureMap) src); + if (src instanceof org.hl7.fhir.r5.model.ValueSet) + return convertValueSet((org.hl7.fhir.r5.model.ValueSet) src); +/* if (src instanceof org.hl7.fhir.r5.model.VisionPrescription) + return convertVisionPrescription((org.hl7.fhir.r5.model.VisionPrescription) src);*/ + throw new FHIRException("Unknown resource "+src.fhirType()); + } + + public static boolean convertsResource(String rt) { + return Utilities.existsInList(rt, "Parameters", "Bundle", "CodeSystem", "CompartmentDefinition", "ConceptMap", "CapabilityStatement", "ImplementationGuide", "NamingSystem", "OperationDefinition", "OperationOutcome", "Questionnaire", "QuestionnaireResponse", "SearchParameter", "StructureDefinition", "StructureMap", "ValueSet"); + } + + +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/VersionConvertor_30_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/VersionConvertor_30_50.java new file mode 100644 index 000000000..ef3866270 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/VersionConvertor_30_50.java @@ -0,0 +1,21553 @@ +package org.hl7.fhir.convertors; + +/*- + * #%L + * org.hl7.fhir.convertors + * %% + * Copyright (C) 2014 - 2019 Health Level 7 + * %% + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * #L% + */ + + +import java.util.ArrayList; +import java.util.List; + +import org.hl7.fhir.dstu3.model.ContactDetail; +import org.hl7.fhir.dstu3.model.Contributor.ContributorType; +import org.hl7.fhir.dstu3.model.Enumerations.PublicationStatus; +import org.hl7.fhir.dstu3.model.ExpansionProfile.DesignationIncludeDesignationComponent; +import org.hl7.fhir.dstu3.model.ExpansionProfile.SystemVersionProcessingMode; +import org.hl7.fhir.dstu3.model.Parameters; +import org.hl7.fhir.dstu3.model.Parameters.ParametersParameterComponent; +import org.hl7.fhir.exceptions.FHIRException; +import org.hl7.fhir.r5.model.BooleanType; +import org.hl7.fhir.r5.model.Questionnaire; +import org.hl7.fhir.r5.model.CodeableConcept; +import org.hl7.fhir.r5.model.Enumeration; +import org.hl7.fhir.r5.model.Expression.ExpressionLanguage; +import org.hl7.fhir.r5.model.HealthcareService.HealthcareServiceEligibilityComponent; +import org.hl7.fhir.r5.model.Identifier; +import org.hl7.fhir.r5.model.Reference; +import org.hl7.fhir.r5.model.TerminologyCapabilities; +import org.hl7.fhir.r5.model.Type; +import org.hl7.fhir.r5.model.UriType; +import org.hl7.fhir.utilities.Utilities; + + +/* + Copyright (c) 2011+, HL7, Inc. + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of HL7 nor the names of its contributors may be used to + endorse or promote products derived from this software without specific + prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + +*/ + + +public class VersionConvertor_30_50 { + private static List CANONICAL_URLS = new ArrayList<>(); + static { + CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/11179-permitted-value-conceptmap"); + CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/11179-permitted-value-valueset"); + CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/codesystem-map"); + CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/cqif-library"); + CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/elementdefinition-allowedUnits"); + CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/elementdefinition-inheritedExtensibleValueSet"); + CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/elementdefinition-maxValueSet"); + CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/elementdefinition-minValueSet"); + CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/event-instantiatesCanonical"); + CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/questionnaire-allowedProfile"); + CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/questionnaire-deMap"); + CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/questionnaire-sourceStructureMap"); + CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/questionnaire-targetStructureMap"); + CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/questionnaire-unit-valueSet"); + CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/valueset-map"); + CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/valueset-supplement"); + CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/valueset-system"); + } + + private static void copyElement(org.hl7.fhir.dstu3.model.Element src, org.hl7.fhir.r5.model.Element tgt) throws FHIRException { + if (src.hasId()) + tgt.setId(src.getId()); + for (org.hl7.fhir.dstu3.model.Extension e : src.getExtension()) { + tgt.addExtension(convertExtension(e)); + } + } + + private static void copyElement(org.hl7.fhir.r5.model.Element src, org.hl7.fhir.dstu3.model.Element tgt) throws FHIRException { + if (src.hasId()) + tgt.setId(src.getId()); + for (org.hl7.fhir.r5.model.Extension e : src.getExtension()) { + tgt.addExtension(convertExtension(e)); + } + } + + private static void copyBackboneElement(org.hl7.fhir.dstu3.model.BackboneElement src, org.hl7.fhir.r5.model.BackboneElement tgt) throws FHIRException { + copyElement(src, tgt); + for (org.hl7.fhir.dstu3.model.Extension e : src.getModifierExtension()) { + tgt.addModifierExtension(convertExtension(e)); + } + } + + private static void copyBackboneElement(org.hl7.fhir.r5.model.BackboneElement src, org.hl7.fhir.dstu3.model.BackboneElement tgt) throws FHIRException { + copyElement(src, tgt); + for (org.hl7.fhir.r5.model.Extension e : src.getModifierExtension()) { + tgt.addModifierExtension(convertExtension(e)); + } + } + + public static org.hl7.fhir.r5.model.Base64BinaryType convertBase64Binary(org.hl7.fhir.dstu3.model.Base64BinaryType src) throws FHIRException { + org.hl7.fhir.r5.model.Base64BinaryType tgt = new org.hl7.fhir.r5.model.Base64BinaryType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Base64BinaryType convertBase64Binary(org.hl7.fhir.r5.model.Base64BinaryType src) throws FHIRException { + org.hl7.fhir.dstu3.model.Base64BinaryType tgt = new org.hl7.fhir.dstu3.model.Base64BinaryType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.r5.model.BooleanType convertBoolean(org.hl7.fhir.dstu3.model.BooleanType src) throws FHIRException { + org.hl7.fhir.r5.model.BooleanType tgt = new org.hl7.fhir.r5.model.BooleanType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.BooleanType convertBoolean(org.hl7.fhir.r5.model.BooleanType src) throws FHIRException { + org.hl7.fhir.dstu3.model.BooleanType tgt = new org.hl7.fhir.dstu3.model.BooleanType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.r5.model.CodeType convertCode(org.hl7.fhir.dstu3.model.CodeType src) throws FHIRException { + org.hl7.fhir.r5.model.CodeType tgt = new org.hl7.fhir.r5.model.CodeType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.CodeType convertCode(org.hl7.fhir.r5.model.CodeType src) throws FHIRException { + org.hl7.fhir.dstu3.model.CodeType tgt = new org.hl7.fhir.dstu3.model.CodeType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.r5.model.DateType convertDate(org.hl7.fhir.dstu3.model.DateType src) throws FHIRException { + org.hl7.fhir.r5.model.DateType tgt = new org.hl7.fhir.r5.model.DateType(src.getValueAsString()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.r5.model.DateTimeType convertDateToDateTime(org.hl7.fhir.dstu3.model.DateType src) throws FHIRException { + org.hl7.fhir.r5.model.DateTimeType tgt = new org.hl7.fhir.r5.model.DateTimeType(src.getValueAsString()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.DateType convertDateTimeToDate(org.hl7.fhir.r5.model.DateTimeType src) throws FHIRException { + org.hl7.fhir.dstu3.model.DateType tgt = new org.hl7.fhir.dstu3.model.DateType (src.getValueAsString()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.DateType convertDate(org.hl7.fhir.r5.model.DateType src) throws FHIRException { + org.hl7.fhir.dstu3.model.DateType tgt = new org.hl7.fhir.dstu3.model.DateType(src.getValueAsString()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.r5.model.DateTimeType convertDateTime(org.hl7.fhir.dstu3.model.DateTimeType src) throws FHIRException { + org.hl7.fhir.r5.model.DateTimeType tgt = new org.hl7.fhir.r5.model.DateTimeType(src.getValueAsString()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.DateTimeType convertDateTime(org.hl7.fhir.r5.model.DateTimeType src) throws FHIRException { + org.hl7.fhir.dstu3.model.DateTimeType tgt = new org.hl7.fhir.dstu3.model.DateTimeType(src.getValueAsString()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.r5.model.DecimalType convertDecimal(org.hl7.fhir.dstu3.model.DecimalType src) throws FHIRException { + org.hl7.fhir.r5.model.DecimalType tgt = new org.hl7.fhir.r5.model.DecimalType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.DecimalType convertDecimal(org.hl7.fhir.r5.model.DecimalType src) throws FHIRException { + org.hl7.fhir.dstu3.model.DecimalType tgt = new org.hl7.fhir.dstu3.model.DecimalType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.r5.model.IdType convertId(org.hl7.fhir.dstu3.model.IdType src) throws FHIRException { + org.hl7.fhir.r5.model.IdType tgt = new org.hl7.fhir.r5.model.IdType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.IdType convertId(org.hl7.fhir.r5.model.IdType src) throws FHIRException { + org.hl7.fhir.dstu3.model.IdType tgt = new org.hl7.fhir.dstu3.model.IdType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.r5.model.InstantType convertInstant(org.hl7.fhir.dstu3.model.InstantType src) throws FHIRException { + org.hl7.fhir.r5.model.InstantType tgt = new org.hl7.fhir.r5.model.InstantType(src.getValueAsString()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.InstantType convertInstant(org.hl7.fhir.r5.model.InstantType src) throws FHIRException { + org.hl7.fhir.dstu3.model.InstantType tgt = new org.hl7.fhir.dstu3.model.InstantType(src.getValueAsString()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.r5.model.IntegerType convertInteger(org.hl7.fhir.dstu3.model.IntegerType src) throws FHIRException { + org.hl7.fhir.r5.model.IntegerType tgt = new org.hl7.fhir.r5.model.IntegerType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.IntegerType convertInteger(org.hl7.fhir.r5.model.IntegerType src) throws FHIRException { + org.hl7.fhir.dstu3.model.IntegerType tgt = new org.hl7.fhir.dstu3.model.IntegerType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.r5.model.MarkdownType convertMarkdown(org.hl7.fhir.dstu3.model.MarkdownType src) throws FHIRException { + org.hl7.fhir.r5.model.MarkdownType tgt = new org.hl7.fhir.r5.model.MarkdownType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.MarkdownType convertMarkdown(org.hl7.fhir.r5.model.MarkdownType src) throws FHIRException { + org.hl7.fhir.dstu3.model.MarkdownType tgt = new org.hl7.fhir.dstu3.model.MarkdownType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.r5.model.OidType convertOid(org.hl7.fhir.dstu3.model.OidType src) throws FHIRException { + org.hl7.fhir.r5.model.OidType tgt = new org.hl7.fhir.r5.model.OidType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.OidType convertOid(org.hl7.fhir.r5.model.OidType src) throws FHIRException { + org.hl7.fhir.dstu3.model.OidType tgt = new org.hl7.fhir.dstu3.model.OidType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.r5.model.PositiveIntType convertPositiveInt(org.hl7.fhir.dstu3.model.PositiveIntType src) throws FHIRException { + org.hl7.fhir.r5.model.PositiveIntType tgt = new org.hl7.fhir.r5.model.PositiveIntType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.PositiveIntType convertPositiveInt(org.hl7.fhir.r5.model.PositiveIntType src) throws FHIRException { + org.hl7.fhir.dstu3.model.PositiveIntType tgt = new org.hl7.fhir.dstu3.model.PositiveIntType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.r5.model.StringType convertString(org.hl7.fhir.dstu3.model.StringType src) throws FHIRException { + org.hl7.fhir.r5.model.StringType tgt = new org.hl7.fhir.r5.model.StringType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.StringType convertString(org.hl7.fhir.r5.model.StringType src) throws FHIRException { + org.hl7.fhir.dstu3.model.StringType tgt = new org.hl7.fhir.dstu3.model.StringType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.r5.model.TimeType convertTime(org.hl7.fhir.dstu3.model.TimeType src) throws FHIRException { + org.hl7.fhir.r5.model.TimeType tgt = new org.hl7.fhir.r5.model.TimeType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.TimeType convertTime(org.hl7.fhir.r5.model.TimeType src) throws FHIRException { + org.hl7.fhir.dstu3.model.TimeType tgt = new org.hl7.fhir.dstu3.model.TimeType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.r5.model.UnsignedIntType convertUnsignedInt(org.hl7.fhir.dstu3.model.UnsignedIntType src) throws FHIRException { + org.hl7.fhir.r5.model.UnsignedIntType tgt = new org.hl7.fhir.r5.model.UnsignedIntType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.UnsignedIntType convertUnsignedInt(org.hl7.fhir.r5.model.UnsignedIntType src) throws FHIRException { + org.hl7.fhir.dstu3.model.UnsignedIntType tgt = new org.hl7.fhir.dstu3.model.UnsignedIntType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.r5.model.UriType convertUri(org.hl7.fhir.dstu3.model.UriType src) throws FHIRException { + org.hl7.fhir.r5.model.UriType tgt = new org.hl7.fhir.r5.model.UriType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.r5.model.UrlType convertUriToUrl(org.hl7.fhir.dstu3.model.UriType src) throws FHIRException { + org.hl7.fhir.r5.model.UrlType tgt = new org.hl7.fhir.r5.model.UrlType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.UriType convertUri(org.hl7.fhir.r5.model.UriType src) throws FHIRException { + org.hl7.fhir.dstu3.model.UriType tgt = new org.hl7.fhir.dstu3.model.UriType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.r5.model.UuidType convertUuid(org.hl7.fhir.dstu3.model.UuidType src) throws FHIRException { + org.hl7.fhir.r5.model.UuidType tgt = new org.hl7.fhir.r5.model.UuidType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.UuidType convertUuid(org.hl7.fhir.r5.model.UuidType src) throws FHIRException { + org.hl7.fhir.dstu3.model.UuidType tgt = new org.hl7.fhir.dstu3.model.UuidType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.r5.model.Extension convertExtension(org.hl7.fhir.dstu3.model.Extension src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Extension tgt = new org.hl7.fhir.r5.model.Extension(); + copyElement(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + if (src.hasValue()) + if (CANONICAL_URLS.contains(src.getUrl()) && src.getValue() instanceof org.hl7.fhir.dstu3.model.Reference) + tgt.setValue(convertReferenceToCanonical((org.hl7.fhir.dstu3.model.Reference)src.getValue())); + else + tgt.setValue(convertType(src.getValue())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Extension convertExtension(org.hl7.fhir.r5.model.Extension src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Extension tgt = new org.hl7.fhir.dstu3.model.Extension(); + copyElement(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + if (src.hasValue()) + if (CANONICAL_URLS.contains(src.getUrl()) && src.getValue() instanceof org.hl7.fhir.r5.model.CanonicalType) + tgt.setValue(convertCanonicalToReference((org.hl7.fhir.r5.model.CanonicalType)src.getValue())); + else + tgt.setValue(convertType(src.getValue())); + return tgt; + } + + public static org.hl7.fhir.r5.model.Narrative convertNarrative(org.hl7.fhir.dstu3.model.Narrative src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Narrative tgt = new org.hl7.fhir.r5.model.Narrative(); + copyElement(src, tgt); + if (src.hasStatus()) + tgt.setStatus(convertNarrativeStatus(src.getStatus())); + if (src.hasDiv()) + tgt.setDiv(src.getDiv()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Narrative convertNarrative(org.hl7.fhir.r5.model.Narrative src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Narrative tgt = new org.hl7.fhir.dstu3.model.Narrative(); + copyElement(src, tgt); + if (src.hasStatus()) + tgt.setStatus(convertNarrativeStatus(src.getStatus())); + if (src.hasDiv()) + tgt.setDiv(src.getDiv()); + return tgt; + } + + private static org.hl7.fhir.r5.model.Narrative.NarrativeStatus convertNarrativeStatus(org.hl7.fhir.dstu3.model.Narrative.NarrativeStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case GENERATED: return org.hl7.fhir.r5.model.Narrative.NarrativeStatus.GENERATED; + case EXTENSIONS: return org.hl7.fhir.r5.model.Narrative.NarrativeStatus.EXTENSIONS; + case ADDITIONAL: return org.hl7.fhir.r5.model.Narrative.NarrativeStatus.ADDITIONAL; + case EMPTY: return org.hl7.fhir.r5.model.Narrative.NarrativeStatus.EMPTY; + default: return org.hl7.fhir.r5.model.Narrative.NarrativeStatus.NULL; + } +} + + private static org.hl7.fhir.dstu3.model.Narrative.NarrativeStatus convertNarrativeStatus(org.hl7.fhir.r5.model.Narrative.NarrativeStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case GENERATED: return org.hl7.fhir.dstu3.model.Narrative.NarrativeStatus.GENERATED; + case EXTENSIONS: return org.hl7.fhir.dstu3.model.Narrative.NarrativeStatus.EXTENSIONS; + case ADDITIONAL: return org.hl7.fhir.dstu3.model.Narrative.NarrativeStatus.ADDITIONAL; + case EMPTY: return org.hl7.fhir.dstu3.model.Narrative.NarrativeStatus.EMPTY; + default: return org.hl7.fhir.dstu3.model.Narrative.NarrativeStatus.NULL; + } +} + + public static org.hl7.fhir.r5.model.Age convertAge(org.hl7.fhir.dstu3.model.Age src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Age tgt = new org.hl7.fhir.r5.model.Age(); + copyQuantity(src, tgt); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Age convertAge(org.hl7.fhir.r5.model.Age src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Age tgt = new org.hl7.fhir.dstu3.model.Age(); + copyQuantity(src, tgt); + return tgt; + } + + public static org.hl7.fhir.r5.model.Annotation convertAnnotation(org.hl7.fhir.dstu3.model.Annotation src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Annotation tgt = new org.hl7.fhir.r5.model.Annotation(); + copyElement(src, tgt); + if (src.hasAuthor()) + tgt.setAuthor(convertType(src.getAuthor())); + if (src.hasTime()) + tgt.setTime(src.getTime()); + if (src.hasText()) + tgt.setText(src.getText()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Annotation convertAnnotation(org.hl7.fhir.r5.model.Annotation src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Annotation tgt = new org.hl7.fhir.dstu3.model.Annotation(); + copyElement(src, tgt); + if (src.hasAuthor()) + tgt.setAuthor(convertType(src.getAuthor())); + if (src.hasTime()) + tgt.setTime(src.getTime()); + if (src.hasText()) + tgt.setText(src.getText()); + return tgt; + } + + public static org.hl7.fhir.r5.model.Attachment convertAttachment(org.hl7.fhir.dstu3.model.Attachment src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Attachment tgt = new org.hl7.fhir.r5.model.Attachment(); + copyElement(src, tgt); + if (src.hasContentType()) + tgt.setContentType(src.getContentType()); + if (src.hasLanguage()) + tgt.setLanguage(src.getLanguage()); + if (src.hasData()) + tgt.setData(src.getData()); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + if (src.hasSize()) + tgt.setSize(src.getSize()); + if (src.hasHash()) + tgt.setHash(src.getHash()); + if (src.hasTitle()) + tgt.setTitle(src.getTitle()); + if (src.hasCreation()) + tgt.setCreation(src.getCreation()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Attachment convertAttachment(org.hl7.fhir.r5.model.Attachment src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Attachment tgt = new org.hl7.fhir.dstu3.model.Attachment(); + copyElement(src, tgt); + if (src.hasContentType()) + tgt.setContentType(src.getContentType()); + if (src.hasLanguage()) + tgt.setLanguage(src.getLanguage()); + if (src.hasData()) + tgt.setData(src.getData()); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + if (src.hasSize()) + tgt.setSize(src.getSize()); + if (src.hasHash()) + tgt.setHash(src.getHash()); + if (src.hasTitle()) + tgt.setTitle(src.getTitle()); + if (src.hasCreation()) + tgt.setCreation(src.getCreation()); + return tgt; + } + + public static org.hl7.fhir.r5.model.CodeableConcept convertCodeableConcept(org.hl7.fhir.dstu3.model.CodeableConcept src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.CodeableConcept tgt = new org.hl7.fhir.r5.model.CodeableConcept(); + copyElement(src, tgt); + for (org.hl7.fhir.dstu3.model.Coding t : src.getCoding()) + tgt.addCoding(convertCoding(t)); + if (src.hasText()) + tgt.setText(src.getText()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.CodeableConcept convertCodeableConcept(org.hl7.fhir.r5.model.CodeableConcept src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.CodeableConcept tgt = new org.hl7.fhir.dstu3.model.CodeableConcept(); + copyElement(src, tgt); + for (org.hl7.fhir.r5.model.Coding t : src.getCoding()) + tgt.addCoding(convertCoding(t)); + if (src.hasText()) + tgt.setText(src.getText()); + return tgt; + } + + public static org.hl7.fhir.r5.model.Coding convertCoding(org.hl7.fhir.dstu3.model.Coding src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Coding tgt = new org.hl7.fhir.r5.model.Coding(); + copyElement(src, tgt); + if (src.hasSystem()) + tgt.setSystem(src.getSystem()); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasCode()) + tgt.setCode(src.getCode()); + if (src.hasDisplay()) + tgt.setDisplay(src.getDisplay()); + if (src.hasUserSelected()) + tgt.setUserSelected(src.getUserSelected()); + return tgt; + } + + public static org.hl7.fhir.r5.model.Coding convertCoding(org.hl7.fhir.dstu3.model.CodeType src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Coding tgt = new org.hl7.fhir.r5.model.Coding(); + copyElement(src, tgt); + tgt.setCode(src.getValue()); + return tgt; + } + + public static org.hl7.fhir.r5.model.CodeableConcept convertCodingToCodeableConcept(org.hl7.fhir.dstu3.model.Coding src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.CodeableConcept tgt = new org.hl7.fhir.r5.model.CodeableConcept(); + copyElement(src, tgt); + if (src.hasSystem()) + tgt.getCodingFirstRep().setSystem(src.getSystem()); + if (src.hasVersion()) + tgt.getCodingFirstRep().setVersion(src.getVersion()); + if (src.hasCode()) + tgt.getCodingFirstRep().setCode(src.getCode()); + if (src.hasDisplay()) + tgt.getCodingFirstRep().setDisplay(src.getDisplay()); + if (src.hasUserSelected()) + tgt.getCodingFirstRep().setUserSelected(src.getUserSelected()); + return tgt; + } + + public static org.hl7.fhir.r5.model.Coding convertCoding(org.hl7.fhir.dstu3.model.CodeableConcept src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Coding tgt = new org.hl7.fhir.r5.model.Coding(); + copyElement(src, tgt); + if (src.hasCoding()) { + if (src.getCodingFirstRep().hasSystem()) + tgt.setSystem(src.getCodingFirstRep().getSystem()); + if (src.getCodingFirstRep().hasVersion()) + tgt.setVersion(src.getCodingFirstRep().getVersion()); + if (src.getCodingFirstRep().hasCode()) + tgt.setCode(src.getCodingFirstRep().getCode()); + if (src.getCodingFirstRep().hasDisplay()) + tgt.setDisplay(src.getCodingFirstRep().getDisplay()); + if (src.getCodingFirstRep().hasUserSelected()) + tgt.setUserSelected(src.getCodingFirstRep().getUserSelected()); + } + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Coding convertCoding(org.hl7.fhir.r5.model.CodeableConcept src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Coding tgt = new org.hl7.fhir.dstu3.model.Coding(); + copyElement(src, tgt); + if (src.hasCoding()) { + if (src.getCodingFirstRep().hasSystem()) + tgt.setSystem(src.getCodingFirstRep().getSystem()); + if (src.getCodingFirstRep().hasVersion()) + tgt.setVersion(src.getCodingFirstRep().getVersion()); + if (src.getCodingFirstRep().hasCode()) + tgt.setCode(src.getCodingFirstRep().getCode()); + if (src.getCodingFirstRep().hasDisplay()) + tgt.setDisplay(src.getCodingFirstRep().getDisplay()); + if (src.getCodingFirstRep().hasUserSelected()) + tgt.setUserSelected(src.getCodingFirstRep().getUserSelected()); + } + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Coding convertCoding(org.hl7.fhir.r5.model.Coding src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Coding tgt = new org.hl7.fhir.dstu3.model.Coding(); + copyElement(src, tgt); + if (src.hasSystem()) + tgt.setSystem(src.getSystem()); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasCode()) + tgt.setCode(src.getCode()); + if (src.hasDisplay()) + tgt.setDisplay(src.getDisplay()); + if (src.hasUserSelected()) + tgt.setUserSelected(src.getUserSelected()); + return tgt; + } + + public static org.hl7.fhir.r5.model.Count convertCount(org.hl7.fhir.dstu3.model.Count src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Count tgt = new org.hl7.fhir.r5.model.Count(); + copyQuantity(src, tgt); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Count convertCount(org.hl7.fhir.r5.model.Count src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Count tgt = new org.hl7.fhir.dstu3.model.Count(); + copyQuantity(src, tgt); + return tgt; + } + + public static org.hl7.fhir.r5.model.Distance convertDistance(org.hl7.fhir.dstu3.model.Distance src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Distance tgt = new org.hl7.fhir.r5.model.Distance(); + copyQuantity(src, tgt); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Distance convertDistance(org.hl7.fhir.r5.model.Distance src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Distance tgt = new org.hl7.fhir.dstu3.model.Distance(); + copyQuantity(src, tgt); + return tgt; + } + + public static org.hl7.fhir.r5.model.Duration convertDuration(org.hl7.fhir.dstu3.model.Duration src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Duration tgt = new org.hl7.fhir.r5.model.Duration(); + copyQuantity(src, tgt); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Duration convertDuration(org.hl7.fhir.r5.model.Duration src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Duration tgt = new org.hl7.fhir.dstu3.model.Duration(); + copyQuantity(src, tgt); + return tgt; + } + + public static org.hl7.fhir.r5.model.Identifier convertIdentifier(org.hl7.fhir.dstu3.model.Identifier src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Identifier tgt = new org.hl7.fhir.r5.model.Identifier(); + copyElement(src, tgt); + if (src.hasUse()) + tgt.setUse(convertIdentifierUse(src.getUse())); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + if (src.hasSystem()) + tgt.setSystem(src.getSystem()); + if (src.hasValue()) + tgt.setValue(src.getValue()); + if (src.hasPeriod()) + tgt.setPeriod(convertPeriod(src.getPeriod())); + if (src.hasAssigner()) + tgt.setAssigner(convertReference(src.getAssigner())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Identifier convertIdentifier(org.hl7.fhir.r5.model.Identifier src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Identifier tgt = new org.hl7.fhir.dstu3.model.Identifier(); + copyElement(src, tgt); + if (src.hasUse()) + tgt.setUse(convertIdentifierUse(src.getUse())); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + if (src.hasSystem()) + tgt.setSystem(src.getSystem()); + if (src.hasValue()) + tgt.setValue(src.getValue()); + if (src.hasPeriod()) + tgt.setPeriod(convertPeriod(src.getPeriod())); + if (src.hasAssigner()) + tgt.setAssigner(convertReference(src.getAssigner())); + return tgt; + } + + private static org.hl7.fhir.r5.model.Identifier.IdentifierUse convertIdentifierUse(org.hl7.fhir.dstu3.model.Identifier.IdentifierUse src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case USUAL: return org.hl7.fhir.r5.model.Identifier.IdentifierUse.USUAL; + case OFFICIAL: return org.hl7.fhir.r5.model.Identifier.IdentifierUse.OFFICIAL; + case TEMP: return org.hl7.fhir.r5.model.Identifier.IdentifierUse.TEMP; + case SECONDARY: return org.hl7.fhir.r5.model.Identifier.IdentifierUse.SECONDARY; + default: return org.hl7.fhir.r5.model.Identifier.IdentifierUse.NULL; + } +} + + private static org.hl7.fhir.dstu3.model.Identifier.IdentifierUse convertIdentifierUse(org.hl7.fhir.r5.model.Identifier.IdentifierUse src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case USUAL: return org.hl7.fhir.dstu3.model.Identifier.IdentifierUse.USUAL; + case OFFICIAL: return org.hl7.fhir.dstu3.model.Identifier.IdentifierUse.OFFICIAL; + case TEMP: return org.hl7.fhir.dstu3.model.Identifier.IdentifierUse.TEMP; + case SECONDARY: return org.hl7.fhir.dstu3.model.Identifier.IdentifierUse.SECONDARY; + default: return org.hl7.fhir.dstu3.model.Identifier.IdentifierUse.NULL; + } +} + + public static org.hl7.fhir.r5.model.Money convertMoney(org.hl7.fhir.dstu3.model.Money src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Money tgt = new org.hl7.fhir.r5.model.Money(); + copyElement(src, tgt); + if (src.hasValue()) + tgt.setValue(src.getValue()); + if (src.hasCode()) + tgt.setCurrency(src.getCode()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Money convertMoney(org.hl7.fhir.r5.model.Money src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Money tgt = new org.hl7.fhir.dstu3.model.Money(); + copyElement(src, tgt); + if (src.hasValue()) + tgt.setValue(src.getValue()); + if (src.hasCurrency()) + tgt.setCode(src.getCurrency()); + return tgt; + } + + public static org.hl7.fhir.r5.model.Period convertPeriod(org.hl7.fhir.dstu3.model.Period src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Period tgt = new org.hl7.fhir.r5.model.Period(); + copyElement(src, tgt); + if (src.hasStart()) + tgt.setStart(src.getStart()); + if (src.hasEnd()) + tgt.setEnd(src.getEnd()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Period convertPeriod(org.hl7.fhir.r5.model.Period src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Period tgt = new org.hl7.fhir.dstu3.model.Period(); + copyElement(src, tgt); + if (src.hasStart()) + tgt.setStart(src.getStart()); + if (src.hasEnd()) + tgt.setEnd(src.getEnd()); + return tgt; + } + + public static void copyQuantity(org.hl7.fhir.dstu3.model.Quantity src, org.hl7.fhir.r5.model.Quantity tgt) throws FHIRException { + if (src == null || tgt == null) + return; + copyElement(src, tgt); + if (src.hasValue()) + tgt.setValue(src.getValue()); + if (src.hasComparator()) + tgt.setComparator(convertQuantityComparator(src.getComparator())); + if (src.hasUnit()) + tgt.setUnit(src.getUnit()); + if (src.hasSystem()) + tgt.setSystem(src.getSystem()); + if (src.hasCode()) + tgt.setCode(src.getCode()); + } + + public static void copyQuantity(org.hl7.fhir.r5.model.Quantity src, org.hl7.fhir.dstu3.model.Quantity tgt) throws FHIRException { + if (src == null || tgt == null) + return; + copyElement(src, tgt); + if (src.hasValue()) + tgt.setValue(src.getValue()); + if (src.hasComparator()) + tgt.setComparator(convertQuantityComparator(src.getComparator())); + if (src.hasUnit()) + tgt.setUnit(src.getUnit()); + if (src.hasSystem()) + tgt.setSystem(src.getSystem()); + if (src.hasCode()) + tgt.setCode(src.getCode()); +} + + public static org.hl7.fhir.r5.model.Quantity convertQuantity(org.hl7.fhir.dstu3.model.Quantity src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Quantity tgt = new org.hl7.fhir.r5.model.Quantity(); + copyElement(src, tgt); + if (src.hasValue()) + tgt.setValue(src.getValue()); + if (src.hasComparator()) + tgt.setComparator(convertQuantityComparator(src.getComparator())); + if (src.hasUnit()) + tgt.setUnit(src.getUnit()); + if (src.hasSystem()) + tgt.setSystem(src.getSystem()); + if (src.hasCode()) + tgt.setCode(src.getCode()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Quantity convertQuantity(org.hl7.fhir.r5.model.Quantity src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Quantity tgt = new org.hl7.fhir.dstu3.model.Quantity(); + copyElement(src, tgt); + if (src.hasValue()) + tgt.setValue(src.getValue()); + if (src.hasComparator()) + tgt.setComparator(convertQuantityComparator(src.getComparator())); + if (src.hasUnit()) + tgt.setUnit(src.getUnit()); + if (src.hasSystem()) + tgt.setSystem(src.getSystem()); + if (src.hasCode()) + tgt.setCode(src.getCode()); + return tgt; + } + + private static org.hl7.fhir.r5.model.Quantity.QuantityComparator convertQuantityComparator(org.hl7.fhir.dstu3.model.Quantity.QuantityComparator src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case LESS_THAN: return org.hl7.fhir.r5.model.Quantity.QuantityComparator.LESS_THAN; + case LESS_OR_EQUAL: return org.hl7.fhir.r5.model.Quantity.QuantityComparator.LESS_OR_EQUAL; + case GREATER_OR_EQUAL: return org.hl7.fhir.r5.model.Quantity.QuantityComparator.GREATER_OR_EQUAL; + case GREATER_THAN: return org.hl7.fhir.r5.model.Quantity.QuantityComparator.GREATER_THAN; + default: return org.hl7.fhir.r5.model.Quantity.QuantityComparator.NULL; + } +} + + private static org.hl7.fhir.dstu3.model.Quantity.QuantityComparator convertQuantityComparator(org.hl7.fhir.r5.model.Quantity.QuantityComparator src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case LESS_THAN: return org.hl7.fhir.dstu3.model.Quantity.QuantityComparator.LESS_THAN; + case LESS_OR_EQUAL: return org.hl7.fhir.dstu3.model.Quantity.QuantityComparator.LESS_OR_EQUAL; + case GREATER_OR_EQUAL: return org.hl7.fhir.dstu3.model.Quantity.QuantityComparator.GREATER_OR_EQUAL; + case GREATER_THAN: return org.hl7.fhir.dstu3.model.Quantity.QuantityComparator.GREATER_THAN; + default: return org.hl7.fhir.dstu3.model.Quantity.QuantityComparator.NULL; + } +} + + public static org.hl7.fhir.r5.model.Range convertRange(org.hl7.fhir.dstu3.model.Range src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Range tgt = new org.hl7.fhir.r5.model.Range(); + copyElement(src, tgt); + if (src.hasLow()) + tgt.setLow(convertSimpleQuantity(src.getLow())); + if (src.hasHigh()) + tgt.setHigh(convertSimpleQuantity(src.getHigh())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Range convertRange(org.hl7.fhir.r5.model.Range src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Range tgt = new org.hl7.fhir.dstu3.model.Range(); + copyElement(src, tgt); + if (src.hasLow()) + tgt.setLow(convertSimpleQuantity(src.getLow())); + if (src.hasHigh()) + tgt.setHigh(convertSimpleQuantity(src.getHigh())); + return tgt; + } + + public static org.hl7.fhir.r5.model.Ratio convertRatio(org.hl7.fhir.dstu3.model.Ratio src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Ratio tgt = new org.hl7.fhir.r5.model.Ratio(); + copyElement(src, tgt); + if (src.hasNumerator()) + tgt.setNumerator(convertQuantity(src.getNumerator())); + if (src.hasDenominator()) + tgt.setDenominator(convertQuantity(src.getDenominator())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Ratio convertRatio(org.hl7.fhir.r5.model.Ratio src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Ratio tgt = new org.hl7.fhir.dstu3.model.Ratio(); + copyElement(src, tgt); + if (src.hasNumerator()) + tgt.setNumerator(convertQuantity(src.getNumerator())); + if (src.hasDenominator()) + tgt.setDenominator(convertQuantity(src.getDenominator())); + return tgt; + } + + public static org.hl7.fhir.r5.model.Reference convertReference(org.hl7.fhir.dstu3.model.Reference src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Reference tgt = new org.hl7.fhir.r5.model.Reference(); + copyElement(src, tgt); + if (src.hasReference()) + tgt.setReference(src.getReference()); + if (src.hasIdentifier()) + tgt.setIdentifier(convertIdentifier(src.getIdentifier())); + if (src.hasDisplay()) + tgt.setDisplay(src.getDisplay()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Reference convertReference(org.hl7.fhir.r5.model.Reference src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Reference tgt = new org.hl7.fhir.dstu3.model.Reference(); + copyElement(src, tgt); + if (src.hasReference()) + tgt.setReference(src.getReference()); + if (src.hasIdentifier()) + tgt.setIdentifier(convertIdentifier(src.getIdentifier())); + if (src.hasDisplay()) + tgt.setDisplay(src.getDisplay()); + return tgt; + } + + public static org.hl7.fhir.r5.model.SampledData convertSampledData(org.hl7.fhir.dstu3.model.SampledData src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.SampledData tgt = new org.hl7.fhir.r5.model.SampledData(); + copyElement(src, tgt); + if (src.hasOrigin()) + tgt.setOrigin(convertSimpleQuantity(src.getOrigin())); + if (src.hasPeriod()) + tgt.setPeriod(src.getPeriod()); + if (src.hasFactor()) + tgt.setFactor(src.getFactor()); + if (src.hasLowerLimit()) + tgt.setLowerLimit(src.getLowerLimit()); + if (src.hasUpperLimit()) + tgt.setUpperLimit(src.getUpperLimit()); + if (src.hasDimensions()) + tgt.setDimensions(src.getDimensions()); + if (src.hasData()) + tgt.setData(src.getData()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.SampledData convertSampledData(org.hl7.fhir.r5.model.SampledData src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.SampledData tgt = new org.hl7.fhir.dstu3.model.SampledData(); + copyElement(src, tgt); + if (src.hasOrigin()) + tgt.setOrigin(convertSimpleQuantity(src.getOrigin())); + if (src.hasPeriod()) + tgt.setPeriod(src.getPeriod()); + if (src.hasFactor()) + tgt.setFactor(src.getFactor()); + if (src.hasLowerLimit()) + tgt.setLowerLimit(src.getLowerLimit()); + if (src.hasUpperLimit()) + tgt.setUpperLimit(src.getUpperLimit()); + if (src.hasDimensions()) + tgt.setDimensions(src.getDimensions()); + if (src.hasData()) + tgt.setData(src.getData()); + return tgt; + } + + public static org.hl7.fhir.r5.model.Signature convertSignature(org.hl7.fhir.dstu3.model.Signature src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Signature tgt = new org.hl7.fhir.r5.model.Signature(); + copyElement(src, tgt); + for (org.hl7.fhir.dstu3.model.Coding t : src.getType()) + tgt.addType(convertCoding(t)); + if (src.hasWhen()) + tgt.setWhen(src.getWhen()); + if (src.hasWho()) { + if (src.hasWhoUriType()) + tgt.setWho(new org.hl7.fhir.r5.model.Reference(src.getWhoUriType().getValue())); + else + tgt.setWho(convertReference(src.getWhoReference())); + } + if (src.hasOnBehalfOf()) { + if (src.hasOnBehalfOfUriType()) + tgt.setOnBehalfOf(new Reference(src.getOnBehalfOfUriType().primitiveValue())); + else + tgt.setOnBehalfOf(convertReference(src.getOnBehalfOfReference())); + } + if (src.hasContentType()) + tgt.setSigFormat(src.getContentType()); + if (src.hasBlob()) + tgt.setData(src.getBlob()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Signature convertSignature(org.hl7.fhir.r5.model.Signature src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Signature tgt = new org.hl7.fhir.dstu3.model.Signature(); + copyElement(src, tgt); + for (org.hl7.fhir.r5.model.Coding t : src.getType()) + tgt.addType(convertCoding(t)); + if (src.hasWhen()) + tgt.setWhen(src.getWhen()); + if (src.hasWho()) + tgt.setWho(convertType(src.getWho())); + if (src.hasOnBehalfOf()) + tgt.setOnBehalfOf(convertType(src.getOnBehalfOf())); + if (src.hasSigFormat()) + tgt.setContentType(src.getSigFormat()); + if (src.hasData()) + tgt.setBlob(src.getData()); + return tgt; + } + + public static org.hl7.fhir.r5.model.Address convertAddress(org.hl7.fhir.dstu3.model.Address src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Address tgt = new org.hl7.fhir.r5.model.Address(); + copyElement(src, tgt); + if (src.hasUse()) + tgt.setUse(convertAddressUse(src.getUse())); + if (src.hasType()) + tgt.setType(convertAddressType(src.getType())); + if (src.hasText()) + tgt.setText(src.getText()); + for (org.hl7.fhir.dstu3.model.StringType t : src.getLine()) + tgt.addLine(t.getValue()); + if (src.hasCity()) + tgt.setCity(src.getCity()); + if (src.hasDistrict()) + tgt.setDistrict(src.getDistrict()); + if (src.hasState()) + tgt.setState(src.getState()); + if (src.hasPostalCode()) + tgt.setPostalCode(src.getPostalCode()); + if (src.hasCountry()) + tgt.setCountry(src.getCountry()); + if (src.hasPeriod()) + tgt.setPeriod(convertPeriod(src.getPeriod())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Address convertAddress(org.hl7.fhir.r5.model.Address src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Address tgt = new org.hl7.fhir.dstu3.model.Address(); + copyElement(src, tgt); + if (src.hasUse()) + tgt.setUse(convertAddressUse(src.getUse())); + if (src.hasType()) + tgt.setType(convertAddressType(src.getType())); + if (src.hasText()) + tgt.setText(src.getText()); + for (org.hl7.fhir.r5.model.StringType t : src.getLine()) + tgt.addLine(t.getValue()); + if (src.hasCity()) + tgt.setCity(src.getCity()); + if (src.hasDistrict()) + tgt.setDistrict(src.getDistrict()); + if (src.hasState()) + tgt.setState(src.getState()); + if (src.hasPostalCode()) + tgt.setPostalCode(src.getPostalCode()); + if (src.hasCountry()) + tgt.setCountry(src.getCountry()); + if (src.hasPeriod()) + tgt.setPeriod(convertPeriod(src.getPeriod())); + return tgt; + } + + private static org.hl7.fhir.r5.model.Address.AddressUse convertAddressUse(org.hl7.fhir.dstu3.model.Address.AddressUse src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case HOME: return org.hl7.fhir.r5.model.Address.AddressUse.HOME; + case WORK: return org.hl7.fhir.r5.model.Address.AddressUse.WORK; + case TEMP: return org.hl7.fhir.r5.model.Address.AddressUse.TEMP; + case OLD: return org.hl7.fhir.r5.model.Address.AddressUse.OLD; + default: return org.hl7.fhir.r5.model.Address.AddressUse.NULL; + } +} + + private static org.hl7.fhir.dstu3.model.Address.AddressUse convertAddressUse(org.hl7.fhir.r5.model.Address.AddressUse src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case HOME: return org.hl7.fhir.dstu3.model.Address.AddressUse.HOME; + case WORK: return org.hl7.fhir.dstu3.model.Address.AddressUse.WORK; + case TEMP: return org.hl7.fhir.dstu3.model.Address.AddressUse.TEMP; + case OLD: return org.hl7.fhir.dstu3.model.Address.AddressUse.OLD; + default: return org.hl7.fhir.dstu3.model.Address.AddressUse.NULL; + } +} + + private static org.hl7.fhir.r5.model.Address.AddressType convertAddressType(org.hl7.fhir.dstu3.model.Address.AddressType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case POSTAL: return org.hl7.fhir.r5.model.Address.AddressType.POSTAL; + case PHYSICAL: return org.hl7.fhir.r5.model.Address.AddressType.PHYSICAL; + case BOTH: return org.hl7.fhir.r5.model.Address.AddressType.BOTH; + default: return org.hl7.fhir.r5.model.Address.AddressType.NULL; + } +} + + private static org.hl7.fhir.dstu3.model.Address.AddressType convertAddressType(org.hl7.fhir.r5.model.Address.AddressType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case POSTAL: return org.hl7.fhir.dstu3.model.Address.AddressType.POSTAL; + case PHYSICAL: return org.hl7.fhir.dstu3.model.Address.AddressType.PHYSICAL; + case BOTH: return org.hl7.fhir.dstu3.model.Address.AddressType.BOTH; + default: return org.hl7.fhir.dstu3.model.Address.AddressType.NULL; + } +} + + public static org.hl7.fhir.r5.model.ContactDetail convertContactDetail(org.hl7.fhir.dstu3.model.ContactDetail src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ContactDetail tgt = new org.hl7.fhir.r5.model.ContactDetail(); + copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom()) + tgt.addTelecom(convertContactPoint(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ContactDetail convertContactDetail(org.hl7.fhir.r5.model.ContactDetail src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.ContactDetail tgt = new org.hl7.fhir.dstu3.model.ContactDetail(); + copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + for (org.hl7.fhir.r5.model.ContactPoint t : src.getTelecom()) + tgt.addTelecom(convertContactPoint(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.ContactPoint convertContactPoint(org.hl7.fhir.dstu3.model.ContactPoint src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ContactPoint tgt = new org.hl7.fhir.r5.model.ContactPoint(); + copyElement(src, tgt); + if (src.hasSystem()) + tgt.setSystem(convertContactPointSystem(src.getSystem())); + if (src.hasValue()) + tgt.setValue(src.getValue()); + if (src.hasUse()) + tgt.setUse(convertContactPointUse(src.getUse())); + if (src.hasRank()) + tgt.setRank(src.getRank()); + if (src.hasPeriod()) + tgt.setPeriod(convertPeriod(src.getPeriod())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ContactPoint convertContactPoint(org.hl7.fhir.r5.model.ContactPoint src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.ContactPoint tgt = new org.hl7.fhir.dstu3.model.ContactPoint(); + copyElement(src, tgt); + if (src.hasSystem()) + tgt.setSystem(convertContactPointSystem(src.getSystem())); + if (src.hasValue()) + tgt.setValue(src.getValue()); + if (src.hasUse()) + tgt.setUse(convertContactPointUse(src.getUse())); + if (src.hasRank()) + tgt.setRank(src.getRank()); + if (src.hasPeriod()) + tgt.setPeriod(convertPeriod(src.getPeriod())); + return tgt; + } + + private static org.hl7.fhir.r5.model.ContactPoint.ContactPointSystem convertContactPointSystem(org.hl7.fhir.dstu3.model.ContactPoint.ContactPointSystem src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PHONE: return org.hl7.fhir.r5.model.ContactPoint.ContactPointSystem.PHONE; + case FAX: return org.hl7.fhir.r5.model.ContactPoint.ContactPointSystem.FAX; + case EMAIL: return org.hl7.fhir.r5.model.ContactPoint.ContactPointSystem.EMAIL; + case PAGER: return org.hl7.fhir.r5.model.ContactPoint.ContactPointSystem.PAGER; + case URL: return org.hl7.fhir.r5.model.ContactPoint.ContactPointSystem.URL; + case SMS: return org.hl7.fhir.r5.model.ContactPoint.ContactPointSystem.SMS; + case OTHER: return org.hl7.fhir.r5.model.ContactPoint.ContactPointSystem.OTHER; + default: return org.hl7.fhir.r5.model.ContactPoint.ContactPointSystem.NULL; + } +} + + private static org.hl7.fhir.dstu3.model.ContactPoint.ContactPointSystem convertContactPointSystem(org.hl7.fhir.r5.model.ContactPoint.ContactPointSystem src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PHONE: return org.hl7.fhir.dstu3.model.ContactPoint.ContactPointSystem.PHONE; + case FAX: return org.hl7.fhir.dstu3.model.ContactPoint.ContactPointSystem.FAX; + case EMAIL: return org.hl7.fhir.dstu3.model.ContactPoint.ContactPointSystem.EMAIL; + case PAGER: return org.hl7.fhir.dstu3.model.ContactPoint.ContactPointSystem.PAGER; + case URL: return org.hl7.fhir.dstu3.model.ContactPoint.ContactPointSystem.URL; + case SMS: return org.hl7.fhir.dstu3.model.ContactPoint.ContactPointSystem.SMS; + case OTHER: return org.hl7.fhir.dstu3.model.ContactPoint.ContactPointSystem.OTHER; + default: return org.hl7.fhir.dstu3.model.ContactPoint.ContactPointSystem.NULL; + } +} + + private static org.hl7.fhir.r5.model.ContactPoint.ContactPointUse convertContactPointUse(org.hl7.fhir.dstu3.model.ContactPoint.ContactPointUse src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case HOME: return org.hl7.fhir.r5.model.ContactPoint.ContactPointUse.HOME; + case WORK: return org.hl7.fhir.r5.model.ContactPoint.ContactPointUse.WORK; + case TEMP: return org.hl7.fhir.r5.model.ContactPoint.ContactPointUse.TEMP; + case OLD: return org.hl7.fhir.r5.model.ContactPoint.ContactPointUse.OLD; + case MOBILE: return org.hl7.fhir.r5.model.ContactPoint.ContactPointUse.MOBILE; + default: return org.hl7.fhir.r5.model.ContactPoint.ContactPointUse.NULL; + } +} + + private static org.hl7.fhir.dstu3.model.ContactPoint.ContactPointUse convertContactPointUse(org.hl7.fhir.r5.model.ContactPoint.ContactPointUse src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case HOME: return org.hl7.fhir.dstu3.model.ContactPoint.ContactPointUse.HOME; + case WORK: return org.hl7.fhir.dstu3.model.ContactPoint.ContactPointUse.WORK; + case TEMP: return org.hl7.fhir.dstu3.model.ContactPoint.ContactPointUse.TEMP; + case OLD: return org.hl7.fhir.dstu3.model.ContactPoint.ContactPointUse.OLD; + case MOBILE: return org.hl7.fhir.dstu3.model.ContactPoint.ContactPointUse.MOBILE; + default: return org.hl7.fhir.dstu3.model.ContactPoint.ContactPointUse.NULL; + } +} + + public static org.hl7.fhir.r5.model.Contributor convertContributor(org.hl7.fhir.dstu3.model.Contributor src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Contributor tgt = new org.hl7.fhir.r5.model.Contributor(); + copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertContributorType(src.getType())); + if (src.hasName()) + tgt.setName(src.getName()); + for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) + tgt.addContact(convertContactDetail(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Contributor convertContributor(org.hl7.fhir.r5.model.Contributor src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Contributor tgt = new org.hl7.fhir.dstu3.model.Contributor(); + copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertContributorType(src.getType())); + if (src.hasName()) + tgt.setName(src.getName()); + for (org.hl7.fhir.r5.model.ContactDetail t : src.getContact()) + tgt.addContact(convertContactDetail(t)); + return tgt; + } + + private static org.hl7.fhir.r5.model.Contributor.ContributorType convertContributorType(org.hl7.fhir.dstu3.model.Contributor.ContributorType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case AUTHOR: return org.hl7.fhir.r5.model.Contributor.ContributorType.AUTHOR; + case EDITOR: return org.hl7.fhir.r5.model.Contributor.ContributorType.EDITOR; + case REVIEWER: return org.hl7.fhir.r5.model.Contributor.ContributorType.REVIEWER; + case ENDORSER: return org.hl7.fhir.r5.model.Contributor.ContributorType.ENDORSER; + default: return org.hl7.fhir.r5.model.Contributor.ContributorType.NULL; + } +} + + private static org.hl7.fhir.dstu3.model.Contributor.ContributorType convertContributorType(org.hl7.fhir.r5.model.Contributor.ContributorType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case AUTHOR: return org.hl7.fhir.dstu3.model.Contributor.ContributorType.AUTHOR; + case EDITOR: return org.hl7.fhir.dstu3.model.Contributor.ContributorType.EDITOR; + case REVIEWER: return org.hl7.fhir.dstu3.model.Contributor.ContributorType.REVIEWER; + case ENDORSER: return org.hl7.fhir.dstu3.model.Contributor.ContributorType.ENDORSER; + default: return org.hl7.fhir.dstu3.model.Contributor.ContributorType.NULL; + } +} + + + public static org.hl7.fhir.r5.model.Dosage convertDosage(org.hl7.fhir.dstu3.model.Dosage src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Dosage tgt = new org.hl7.fhir.r5.model.Dosage(); + copyElement(src, tgt); + if (src.hasSequence()) + tgt.setSequence(src.getSequence()); + if (src.hasText()) + tgt.setText(src.getText()); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getAdditionalInstruction()) + tgt.addAdditionalInstruction(convertCodeableConcept(t)); + if (src.hasPatientInstruction()) + tgt.setPatientInstruction(src.getPatientInstruction()); + if (src.hasTiming()) + tgt.setTiming(convertTiming(src.getTiming())); + if (src.hasAsNeeded()) + tgt.setAsNeeded(convertType(src.getAsNeeded())); + if (src.hasSite()) + tgt.setSite(convertCodeableConcept(src.getSite())); + if (src.hasRoute()) + tgt.setRoute(convertCodeableConcept(src.getRoute())); + if (src.hasMethod()) + tgt.setMethod(convertCodeableConcept(src.getMethod())); + if (src.hasDose() || src.hasRate()) { + org.hl7.fhir.r5.model.Dosage.DosageDoseAndRateComponent dr = tgt.addDoseAndRate(); + if (src.hasDose()) + dr.setDose(convertType(src.getDose())); + if (src.hasRate()) + dr.setRate(convertType(src.getRate())); + } + if (src.hasMaxDosePerPeriod()) + tgt.setMaxDosePerPeriod(convertRatio(src.getMaxDosePerPeriod())); + if (src.hasMaxDosePerAdministration()) + tgt.setMaxDosePerAdministration(convertSimpleQuantity(src.getMaxDosePerAdministration())); + if (src.hasMaxDosePerLifetime()) + tgt.setMaxDosePerLifetime(convertSimpleQuantity(src.getMaxDosePerLifetime())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Dosage convertDosage(org.hl7.fhir.r5.model.Dosage src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Dosage tgt = new org.hl7.fhir.dstu3.model.Dosage(); + copyElement(src, tgt); + if (src.hasSequence()) + tgt.setSequence(src.getSequence()); + if (src.hasText()) + tgt.setText(src.getText()); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getAdditionalInstruction()) + tgt.addAdditionalInstruction(convertCodeableConcept(t)); + if (src.hasPatientInstruction()) + tgt.setPatientInstruction(src.getPatientInstruction()); + if (src.hasTiming()) + tgt.setTiming(convertTiming(src.getTiming())); + if (src.hasAsNeeded()) + tgt.setAsNeeded(convertType(src.getAsNeeded())); + if (src.hasSite()) + tgt.setSite(convertCodeableConcept(src.getSite())); + if (src.hasRoute()) + tgt.setRoute(convertCodeableConcept(src.getRoute())); + if (src.hasMethod()) + tgt.setMethod(convertCodeableConcept(src.getMethod())); + if (src.hasDoseAndRate() && src.getDoseAndRate().get(0).hasDose()) + tgt.setDose(convertType(src.getDoseAndRate().get(0).getDose())); + if (src.hasMaxDosePerPeriod()) + tgt.setMaxDosePerPeriod(convertRatio(src.getMaxDosePerPeriod())); + if (src.hasMaxDosePerAdministration()) + tgt.setMaxDosePerAdministration(convertSimpleQuantity(src.getMaxDosePerAdministration())); + if (src.hasMaxDosePerLifetime()) + tgt.setMaxDosePerLifetime(convertSimpleQuantity(src.getMaxDosePerLifetime())); + if (src.hasDoseAndRate() && src.getDoseAndRate().get(0).hasRate()) + tgt.setRate(convertType(src.getDoseAndRate().get(0).getRate())); + return tgt; + } + + public static org.hl7.fhir.r5.model.ElementDefinition convertElementDefinition(org.hl7.fhir.dstu3.model.ElementDefinition src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ElementDefinition tgt = new org.hl7.fhir.r5.model.ElementDefinition(); + copyElement(src, tgt); + if (src.hasPath()) + tgt.setPath(src.getPath()); + for (org.hl7.fhir.dstu3.model.Enumeration t : src.getRepresentation()) + tgt.addRepresentation(convertPropertyRepresentation(t.getValue())); + if (src.hasSliceName()) + tgt.setSliceName(src.getSliceName()); + if (src.hasLabel()) + tgt.setLabel(src.getLabel()); + for (org.hl7.fhir.dstu3.model.Coding t : src.getCode()) + tgt.addCode(convertCoding(t)); + if (src.hasSlicing()) + tgt.setSlicing(convertElementDefinitionSlicingComponent(src.getSlicing())); + if (src.hasShort()) + tgt.setShort(src.getShort()); + if (src.hasDefinition()) + tgt.setDefinition(src.getDefinition()); + if (src.hasComment()) + tgt.setComment(src.getComment()); + if (src.hasRequirements()) + tgt.setRequirements(src.getRequirements()); + for (org.hl7.fhir.dstu3.model.StringType t : src.getAlias()) + tgt.addAlias(t.getValue()); + if (src.hasMin()) + tgt.setMin(src.getMin()); + if (src.hasMax()) + tgt.setMax(src.getMax()); + if (src.hasBase()) + tgt.setBase(convertElementDefinitionBaseComponent(src.getBase())); + if (src.hasContentReference()) + tgt.setContentReference(src.getContentReference()); + for (org.hl7.fhir.dstu3.model.ElementDefinition.TypeRefComponent t : src.getType()) + convertTypeRefComponent(t, tgt.getType()); + if (src.hasDefaultValue()) + tgt.setDefaultValue(convertType(src.getDefaultValue())); + if (src.hasMeaningWhenMissing()) + tgt.setMeaningWhenMissing(src.getMeaningWhenMissing()); + if (src.hasOrderMeaning()) + tgt.setOrderMeaning(src.getOrderMeaning()); + if (src.hasFixed()) + tgt.setFixed(convertType(src.getFixed())); + if (src.hasPattern()) + tgt.setPattern(convertType(src.getPattern())); + for (org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionExampleComponent t : src.getExample()) + tgt.addExample(convertElementDefinitionExampleComponent(t)); + if (src.hasMinValue()) + tgt.setMinValue(convertType(src.getMinValue())); + if (src.hasMaxValue()) + tgt.setMaxValue(convertType(src.getMaxValue())); + if (src.hasMaxLength()) + tgt.setMaxLength(src.getMaxLength()); + for (org.hl7.fhir.dstu3.model.IdType t : src.getCondition()) + tgt.addCondition(t.getValue()); + for (org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionConstraintComponent t : src.getConstraint()) + tgt.addConstraint(convertElementDefinitionConstraintComponent(t)); + if (src.hasMustSupport()) + tgt.setMustSupport(src.getMustSupport()); + if (src.hasIsModifier()) + tgt.setIsModifier(src.getIsModifier()); + if (tgt.getIsModifier()) { + String reason = org.hl7.fhir.dstu3.utils.ToolingExtensions.readStringExtension(src, VersionConvertorConstants.MODIFIER_REASON_EXTENSION); + if (Utilities.noString(reason)) + reason = VersionConvertorConstants.MODIFIER_REASON_LEGACY; + tgt.setIsModifierReason(reason); + } + if (src.hasIsSummary()) + tgt.setIsSummary(src.getIsSummary()); + if (src.hasBinding()) + tgt.setBinding(convertElementDefinitionBindingComponent(src.getBinding())); + for (org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionMappingComponent t : src.getMapping()) + tgt.addMapping(convertElementDefinitionMappingComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ElementDefinition convertElementDefinition(org.hl7.fhir.r5.model.ElementDefinition src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.ElementDefinition tgt = new org.hl7.fhir.dstu3.model.ElementDefinition(); + copyElement(src, tgt); + if (src.hasPath()) + tgt.setPath(src.getPath()); + for (org.hl7.fhir.r5.model.Enumeration t : src.getRepresentation()) + tgt.addRepresentation(convertPropertyRepresentation(t.getValue())); + if (src.hasSliceName()) + tgt.setSliceName(src.getSliceName()); + if (src.hasLabel()) + tgt.setLabel(src.getLabel()); + for (org.hl7.fhir.r5.model.Coding t : src.getCode()) + tgt.addCode(convertCoding(t)); + if (src.hasSlicing()) + tgt.setSlicing(convertElementDefinitionSlicingComponent(src.getSlicing())); + if (src.hasShort()) + tgt.setShort(src.getShort()); + if (src.hasDefinition()) + tgt.setDefinition(src.getDefinition()); + if (src.hasComment()) + tgt.setComment(src.getComment()); + if (src.hasRequirements()) + tgt.setRequirements(src.getRequirements()); + for (org.hl7.fhir.r5.model.StringType t : src.getAlias()) + tgt.addAlias(t.getValue()); + if (src.hasMin()) + tgt.setMin(src.getMin()); + if (src.hasMax()) + tgt.setMax(src.getMax()); + if (src.hasBase()) + tgt.setBase(convertElementDefinitionBaseComponent(src.getBase())); + if (src.hasContentReference()) + tgt.setContentReference(src.getContentReference()); + for (org.hl7.fhir.r5.model.ElementDefinition.TypeRefComponent t : src.getType()) + convertTypeRefComponent(t, tgt.getType()); + if (src.hasDefaultValue()) + tgt.setDefaultValue(convertType(src.getDefaultValue())); + if (src.hasMeaningWhenMissing()) + tgt.setMeaningWhenMissing(src.getMeaningWhenMissing()); + if (src.hasOrderMeaning()) + tgt.setOrderMeaning(src.getOrderMeaning()); + if (src.hasFixed()) + tgt.setFixed(convertType(src.getFixed())); + if (src.hasPattern()) + tgt.setPattern(convertType(src.getPattern())); + for (org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionExampleComponent t : src.getExample()) + tgt.addExample(convertElementDefinitionExampleComponent(t)); + if (src.hasMinValue()) + tgt.setMinValue(convertType(src.getMinValue())); + if (src.hasMaxValue()) + tgt.setMaxValue(convertType(src.getMaxValue())); + if (src.hasMaxLength()) + tgt.setMaxLength(src.getMaxLength()); + for (org.hl7.fhir.r5.model.IdType t : src.getCondition()) + tgt.addCondition(t.getValue()); + for (org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionConstraintComponent t : src.getConstraint()) + tgt.addConstraint(convertElementDefinitionConstraintComponent(t)); + if (src.hasMustSupport()) + tgt.setMustSupport(src.getMustSupport()); + if (src.hasIsModifier()) + tgt.setIsModifier(src.getIsModifier()); + if (src.hasIsModifierReason() && !VersionConvertorConstants.MODIFIER_REASON_LEGACY.equals(src.getIsModifierReason())) + org.hl7.fhir.dstu3.utils.ToolingExtensions.setStringExtension(tgt, VersionConvertorConstants.MODIFIER_REASON_EXTENSION, src.getIsModifierReason()); + if (src.hasIsSummary()) + tgt.setIsSummary(src.getIsSummary()); + if (src.hasBinding()) + tgt.setBinding(convertElementDefinitionBindingComponent(src.getBinding())); + for (org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionMappingComponent t : src.getMapping()) + tgt.addMapping(convertElementDefinitionMappingComponent(t)); + return tgt; + } + + private static org.hl7.fhir.r5.model.ElementDefinition.PropertyRepresentation convertPropertyRepresentation(org.hl7.fhir.dstu3.model.ElementDefinition.PropertyRepresentation src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case XMLATTR: return org.hl7.fhir.r5.model.ElementDefinition.PropertyRepresentation.XMLATTR; + case XMLTEXT: return org.hl7.fhir.r5.model.ElementDefinition.PropertyRepresentation.XMLTEXT; + case TYPEATTR: return org.hl7.fhir.r5.model.ElementDefinition.PropertyRepresentation.TYPEATTR; + case CDATEXT: return org.hl7.fhir.r5.model.ElementDefinition.PropertyRepresentation.CDATEXT; + case XHTML: return org.hl7.fhir.r5.model.ElementDefinition.PropertyRepresentation.XHTML; + default: return org.hl7.fhir.r5.model.ElementDefinition.PropertyRepresentation.NULL; + } +} + + private static org.hl7.fhir.dstu3.model.ElementDefinition.PropertyRepresentation convertPropertyRepresentation(org.hl7.fhir.r5.model.ElementDefinition.PropertyRepresentation src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case XMLATTR: return org.hl7.fhir.dstu3.model.ElementDefinition.PropertyRepresentation.XMLATTR; + case XMLTEXT: return org.hl7.fhir.dstu3.model.ElementDefinition.PropertyRepresentation.XMLTEXT; + case TYPEATTR: return org.hl7.fhir.dstu3.model.ElementDefinition.PropertyRepresentation.TYPEATTR; + case CDATEXT: return org.hl7.fhir.dstu3.model.ElementDefinition.PropertyRepresentation.CDATEXT; + case XHTML: return org.hl7.fhir.dstu3.model.ElementDefinition.PropertyRepresentation.XHTML; + default: return org.hl7.fhir.dstu3.model.ElementDefinition.PropertyRepresentation.NULL; + } +} + + public static org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionSlicingComponent convertElementDefinitionSlicingComponent(org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionSlicingComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionSlicingComponent tgt = new org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionSlicingComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent t : src.getDiscriminator()) + tgt.addDiscriminator(convertElementDefinitionSlicingDiscriminatorComponent(t)); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + if (src.hasOrdered()) + tgt.setOrdered(src.getOrdered()); + if (src.hasRules()) + tgt.setRules(convertSlicingRules(src.getRules())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionSlicingComponent convertElementDefinitionSlicingComponent(org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionSlicingComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionSlicingComponent tgt = new org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionSlicingComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent t : src.getDiscriminator()) + tgt.addDiscriminator(convertElementDefinitionSlicingDiscriminatorComponent(t)); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + if (src.hasOrdered()) + tgt.setOrdered(src.getOrdered()); + if (src.hasRules()) + tgt.setRules(convertSlicingRules(src.getRules())); + return tgt; + } + + private static org.hl7.fhir.r5.model.ElementDefinition.SlicingRules convertSlicingRules(org.hl7.fhir.dstu3.model.ElementDefinition.SlicingRules src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case CLOSED: return org.hl7.fhir.r5.model.ElementDefinition.SlicingRules.CLOSED; + case OPEN: return org.hl7.fhir.r5.model.ElementDefinition.SlicingRules.OPEN; + case OPENATEND: return org.hl7.fhir.r5.model.ElementDefinition.SlicingRules.OPENATEND; + default: return org.hl7.fhir.r5.model.ElementDefinition.SlicingRules.NULL; + } +} + + private static org.hl7.fhir.dstu3.model.ElementDefinition.SlicingRules convertSlicingRules(org.hl7.fhir.r5.model.ElementDefinition.SlicingRules src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case CLOSED: return org.hl7.fhir.dstu3.model.ElementDefinition.SlicingRules.CLOSED; + case OPEN: return org.hl7.fhir.dstu3.model.ElementDefinition.SlicingRules.OPEN; + case OPENATEND: return org.hl7.fhir.dstu3.model.ElementDefinition.SlicingRules.OPENATEND; + default: return org.hl7.fhir.dstu3.model.ElementDefinition.SlicingRules.NULL; + } +} + + public static org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent convertElementDefinitionSlicingDiscriminatorComponent(org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent tgt = new org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent(); + copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertDiscriminatorType(src.getType())); + if (src.hasPath()) + tgt.setPath(src.getPath()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent convertElementDefinitionSlicingDiscriminatorComponent(org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent tgt = new org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent(); + copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertDiscriminatorType(src.getType())); + if (src.hasPath()) + tgt.setPath(src.getPath()); + return tgt; + } + + private static org.hl7.fhir.r5.model.ElementDefinition.DiscriminatorType convertDiscriminatorType(org.hl7.fhir.dstu3.model.ElementDefinition.DiscriminatorType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case VALUE: return org.hl7.fhir.r5.model.ElementDefinition.DiscriminatorType.VALUE; + case EXISTS: return org.hl7.fhir.r5.model.ElementDefinition.DiscriminatorType.EXISTS; + case PATTERN: return org.hl7.fhir.r5.model.ElementDefinition.DiscriminatorType.PATTERN; + case TYPE: return org.hl7.fhir.r5.model.ElementDefinition.DiscriminatorType.TYPE; + case PROFILE: return org.hl7.fhir.r5.model.ElementDefinition.DiscriminatorType.PROFILE; + default: return org.hl7.fhir.r5.model.ElementDefinition.DiscriminatorType.NULL; + } +} + + private static org.hl7.fhir.dstu3.model.ElementDefinition.DiscriminatorType convertDiscriminatorType(org.hl7.fhir.r5.model.ElementDefinition.DiscriminatorType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case VALUE: return org.hl7.fhir.dstu3.model.ElementDefinition.DiscriminatorType.VALUE; + case EXISTS: return org.hl7.fhir.dstu3.model.ElementDefinition.DiscriminatorType.EXISTS; + case PATTERN: return org.hl7.fhir.dstu3.model.ElementDefinition.DiscriminatorType.PATTERN; + case TYPE: return org.hl7.fhir.dstu3.model.ElementDefinition.DiscriminatorType.TYPE; + case PROFILE: return org.hl7.fhir.dstu3.model.ElementDefinition.DiscriminatorType.PROFILE; + default: return org.hl7.fhir.dstu3.model.ElementDefinition.DiscriminatorType.NULL; + } +} + + public static org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionBaseComponent convertElementDefinitionBaseComponent(org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionBaseComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionBaseComponent tgt = new org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionBaseComponent(); + copyElement(src, tgt); + if (src.hasPath()) + tgt.setPath(src.getPath()); + if (src.hasMin()) + tgt.setMin(src.getMin()); + if (src.hasMax()) + tgt.setMax(src.getMax()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionBaseComponent convertElementDefinitionBaseComponent(org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionBaseComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionBaseComponent tgt = new org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionBaseComponent(); + copyElement(src, tgt); + if (src.hasPath()) + tgt.setPath(src.getPath()); + if (src.hasMin()) + tgt.setMin(src.getMin()); + if (src.hasMax()) + tgt.setMax(src.getMax()); + return tgt; + } + + public static void convertTypeRefComponent(org.hl7.fhir.dstu3.model.ElementDefinition.TypeRefComponent src, List list) throws FHIRException { + if (src == null) + return ; + org.hl7.fhir.r5.model.ElementDefinition.TypeRefComponent tgt = null; + for (org.hl7.fhir.r5.model.ElementDefinition.TypeRefComponent t : list) + if (t.getCode().equals(src.getCode())) + tgt = t; + if (tgt == null) { + tgt = new org.hl7.fhir.r5.model.ElementDefinition.TypeRefComponent(); + list.add(tgt); + copyElement(src, tgt); + tgt.setCodeElement(convertUri(src.getCodeElement())); + } + if (src.hasProfile()) + tgt.addProfile(src.getProfile()); + if (src.hasTargetProfile()) + tgt.addTargetProfile(src.getTargetProfile()); + for (org.hl7.fhir.dstu3.model.Enumeration t : src.getAggregation()) { + org.hl7.fhir.r5.model.ElementDefinition.AggregationMode a = convertAggregationMode(t.getValue()); + if (!tgt.hasAggregation(a)) + tgt.addAggregation(a); + } + if (src.hasVersioning()) + tgt.setVersioning(convertReferenceVersionRules(src.getVersioning())); + } + + public static void convertTypeRefComponent(org.hl7.fhir.r5.model.ElementDefinition.TypeRefComponent src, List list) throws FHIRException { + if (src == null) + return; + org.hl7.fhir.dstu3.model.ElementDefinition.TypeRefComponent tgt = new org.hl7.fhir.dstu3.model.ElementDefinition.TypeRefComponent(); + copyElement(src, tgt); + tgt.setCodeElement(convertUri(src.getCodeElement())); + list.add(tgt); + if (src.hasTarget()) { + if (src.hasProfile()) + tgt.setProfile(src.getProfile().get(0).getValue()); + for (org.hl7.fhir.r5.model.UriType u : src.getTargetProfile()) { + if (tgt.hasTargetProfile()) { + tgt = new org.hl7.fhir.dstu3.model.ElementDefinition.TypeRefComponent(); + list.add(tgt); + copyElement(src, tgt); + tgt.setCode(src.getCode()); + if (src.hasProfile()) + tgt.setProfile(src.getProfile().get(0).getValue()); + } + tgt.setTargetProfile(u.getValue()); + } + } else { + for (org.hl7.fhir.r5.model.UriType u : src.getProfile()) { + if (tgt.hasProfile()) { + tgt = new org.hl7.fhir.dstu3.model.ElementDefinition.TypeRefComponent(); + list.add(tgt); + copyElement(src, tgt); + tgt.setCode(src.getCode()); + } + tgt.setProfile(u.getValue()); + } + } + } + + private static org.hl7.fhir.r5.model.ElementDefinition.AggregationMode convertAggregationMode(org.hl7.fhir.dstu3.model.ElementDefinition.AggregationMode src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case CONTAINED: return org.hl7.fhir.r5.model.ElementDefinition.AggregationMode.CONTAINED; + case REFERENCED: return org.hl7.fhir.r5.model.ElementDefinition.AggregationMode.REFERENCED; + case BUNDLED: return org.hl7.fhir.r5.model.ElementDefinition.AggregationMode.BUNDLED; + default: return org.hl7.fhir.r5.model.ElementDefinition.AggregationMode.NULL; + } +} + + private static org.hl7.fhir.dstu3.model.ElementDefinition.AggregationMode convertAggregationMode(org.hl7.fhir.r5.model.ElementDefinition.AggregationMode src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case CONTAINED: return org.hl7.fhir.dstu3.model.ElementDefinition.AggregationMode.CONTAINED; + case REFERENCED: return org.hl7.fhir.dstu3.model.ElementDefinition.AggregationMode.REFERENCED; + case BUNDLED: return org.hl7.fhir.dstu3.model.ElementDefinition.AggregationMode.BUNDLED; + default: return org.hl7.fhir.dstu3.model.ElementDefinition.AggregationMode.NULL; + } +} + + private static org.hl7.fhir.r5.model.ElementDefinition.ReferenceVersionRules convertReferenceVersionRules(org.hl7.fhir.dstu3.model.ElementDefinition.ReferenceVersionRules src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case EITHER: return org.hl7.fhir.r5.model.ElementDefinition.ReferenceVersionRules.EITHER; + case INDEPENDENT: return org.hl7.fhir.r5.model.ElementDefinition.ReferenceVersionRules.INDEPENDENT; + case SPECIFIC: return org.hl7.fhir.r5.model.ElementDefinition.ReferenceVersionRules.SPECIFIC; + default: return org.hl7.fhir.r5.model.ElementDefinition.ReferenceVersionRules.NULL; + } +} + + private static org.hl7.fhir.dstu3.model.ElementDefinition.ReferenceVersionRules convertReferenceVersionRules(org.hl7.fhir.r5.model.ElementDefinition.ReferenceVersionRules src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case EITHER: return org.hl7.fhir.dstu3.model.ElementDefinition.ReferenceVersionRules.EITHER; + case INDEPENDENT: return org.hl7.fhir.dstu3.model.ElementDefinition.ReferenceVersionRules.INDEPENDENT; + case SPECIFIC: return org.hl7.fhir.dstu3.model.ElementDefinition.ReferenceVersionRules.SPECIFIC; + default: return org.hl7.fhir.dstu3.model.ElementDefinition.ReferenceVersionRules.NULL; + } +} + + public static org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionExampleComponent convertElementDefinitionExampleComponent(org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionExampleComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionExampleComponent tgt = new org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionExampleComponent(); + copyElement(src, tgt); + if (src.hasLabel()) + tgt.setLabel(src.getLabel()); + if (src.hasValue()) + tgt.setValue(convertType(src.getValue())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionExampleComponent convertElementDefinitionExampleComponent(org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionExampleComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionExampleComponent tgt = new org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionExampleComponent(); + copyElement(src, tgt); + if (src.hasLabel()) + tgt.setLabel(src.getLabel()); + if (src.hasValue()) + tgt.setValue(convertType(src.getValue())); + return tgt; + } + + public static org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionConstraintComponent convertElementDefinitionConstraintComponent(org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionConstraintComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionConstraintComponent tgt = new org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionConstraintComponent(); + copyElement(src, tgt); + if (src.hasKey()) + tgt.setKey(src.getKey()); + if (src.hasRequirements()) + tgt.setRequirements(src.getRequirements()); + if (src.hasSeverity()) + tgt.setSeverity(convertConstraintSeverity(src.getSeverity())); + if (src.hasHuman()) + tgt.setHuman(src.getHuman()); + if (src.hasExpression()) + tgt.setExpression(src.getExpression()); + if (src.hasXpath()) + tgt.setXpath(src.getXpath()); + if (src.hasSource()) + tgt.setSource(src.getSource()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionConstraintComponent convertElementDefinitionConstraintComponent(org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionConstraintComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionConstraintComponent tgt = new org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionConstraintComponent(); + copyElement(src, tgt); + if (src.hasKey()) + tgt.setKey(src.getKey()); + if (src.hasRequirements()) + tgt.setRequirements(src.getRequirements()); + if (src.hasSeverity()) + tgt.setSeverity(convertConstraintSeverity(src.getSeverity())); + if (src.hasHuman()) + tgt.setHuman(src.getHuman()); + if (src.hasExpression()) + tgt.setExpression(src.getExpression()); + if (src.hasXpath()) + tgt.setXpath(src.getXpath()); + if (src.hasSource()) + tgt.setSource(src.getSource()); + return tgt; + } + + private static org.hl7.fhir.r5.model.ElementDefinition.ConstraintSeverity convertConstraintSeverity(org.hl7.fhir.dstu3.model.ElementDefinition.ConstraintSeverity src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case ERROR: return org.hl7.fhir.r5.model.ElementDefinition.ConstraintSeverity.ERROR; + case WARNING: return org.hl7.fhir.r5.model.ElementDefinition.ConstraintSeverity.WARNING; + default: return org.hl7.fhir.r5.model.ElementDefinition.ConstraintSeverity.NULL; + } +} + + private static org.hl7.fhir.dstu3.model.ElementDefinition.ConstraintSeverity convertConstraintSeverity(org.hl7.fhir.r5.model.ElementDefinition.ConstraintSeverity src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case ERROR: return org.hl7.fhir.dstu3.model.ElementDefinition.ConstraintSeverity.ERROR; + case WARNING: return org.hl7.fhir.dstu3.model.ElementDefinition.ConstraintSeverity.WARNING; + default: return org.hl7.fhir.dstu3.model.ElementDefinition.ConstraintSeverity.NULL; + } +} + + public static org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionBindingComponent convertElementDefinitionBindingComponent(org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionBindingComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionBindingComponent tgt = new org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionBindingComponent(); + copyElement(src, tgt); + if (src.hasStrength()) + tgt.setStrength(convertBindingStrength(src.getStrength())); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + if (src.hasValueSet()) { + Type t = convertType(src.getValueSet()); + if (t instanceof org.hl7.fhir.r5.model.Reference) + tgt.setValueSet(((org.hl7.fhir.r5.model.Reference) t).getReference()); + else + tgt.setValueSet(t.primitiveValue()); + tgt.setValueSet(VersionConvertorConstants.refToVS(tgt.getValueSet())); + } + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionBindingComponent convertElementDefinitionBindingComponent(org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionBindingComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionBindingComponent tgt = new org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionBindingComponent(); + copyElement(src, tgt); + if (src.hasStrength()) + tgt.setStrength(convertBindingStrength(src.getStrength())); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + if (src.hasValueSet()) { + String vsr = VersionConvertorConstants.vsToRef(src.getValueSet()); + if (vsr != null) + tgt.setValueSet(new org.hl7.fhir.dstu3.model.UriType(vsr)); + else + tgt.setValueSet(new org.hl7.fhir.dstu3.model.Reference(src.getValueSet())); + } + return tgt; + } + + private static org.hl7.fhir.r5.model.Enumerations.BindingStrength convertBindingStrength(org.hl7.fhir.dstu3.model.Enumerations.BindingStrength src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case REQUIRED: return org.hl7.fhir.r5.model.Enumerations.BindingStrength.REQUIRED; + case EXTENSIBLE: return org.hl7.fhir.r5.model.Enumerations.BindingStrength.EXTENSIBLE; + case PREFERRED: return org.hl7.fhir.r5.model.Enumerations.BindingStrength.PREFERRED; + case EXAMPLE: return org.hl7.fhir.r5.model.Enumerations.BindingStrength.EXAMPLE; + default: return org.hl7.fhir.r5.model.Enumerations.BindingStrength.NULL; + } +} + + private static org.hl7.fhir.dstu3.model.Enumerations.BindingStrength convertBindingStrength(org.hl7.fhir.r5.model.Enumerations.BindingStrength src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case REQUIRED: return org.hl7.fhir.dstu3.model.Enumerations.BindingStrength.REQUIRED; + case EXTENSIBLE: return org.hl7.fhir.dstu3.model.Enumerations.BindingStrength.EXTENSIBLE; + case PREFERRED: return org.hl7.fhir.dstu3.model.Enumerations.BindingStrength.PREFERRED; + case EXAMPLE: return org.hl7.fhir.dstu3.model.Enumerations.BindingStrength.EXAMPLE; + default: return org.hl7.fhir.dstu3.model.Enumerations.BindingStrength.NULL; + } +} + + public static org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionMappingComponent convertElementDefinitionMappingComponent(org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionMappingComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionMappingComponent tgt = new org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionMappingComponent(); + copyElement(src, tgt); + if (src.hasIdentity()) + tgt.setIdentity(src.getIdentity()); + if (src.hasLanguage()) + tgt.setLanguage(src.getLanguage()); + if (src.hasMap()) + tgt.setMap(src.getMap()); + if (src.hasComment()) + tgt.setComment(src.getComment()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionMappingComponent convertElementDefinitionMappingComponent(org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionMappingComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionMappingComponent tgt = new org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionMappingComponent(); + copyElement(src, tgt); + if (src.hasIdentity()) + tgt.setIdentity(src.getIdentity()); + if (src.hasLanguage()) + tgt.setLanguage(src.getLanguage()); + if (src.hasMap()) + tgt.setMap(src.getMap()); + if (src.hasComment()) + tgt.setComment(src.getComment()); + return tgt; + } + + public static org.hl7.fhir.r5.model.HumanName convertHumanName(org.hl7.fhir.dstu3.model.HumanName src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.HumanName tgt = new org.hl7.fhir.r5.model.HumanName(); + copyElement(src, tgt); + if (src.hasUse()) + tgt.setUse(convertNameUse(src.getUse())); + if (src.hasText()) + tgt.setText(src.getText()); + if (src.hasFamily()) + tgt.setFamily(src.getFamily()); + for (org.hl7.fhir.dstu3.model.StringType t : src.getGiven()) + tgt.addGiven(t.getValue()); + for (org.hl7.fhir.dstu3.model.StringType t : src.getPrefix()) + tgt.addPrefix(t.getValue()); + for (org.hl7.fhir.dstu3.model.StringType t : src.getSuffix()) + tgt.addSuffix(t.getValue()); + if (src.hasPeriod()) + tgt.setPeriod(convertPeriod(src.getPeriod())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.HumanName convertHumanName(org.hl7.fhir.r5.model.HumanName src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.HumanName tgt = new org.hl7.fhir.dstu3.model.HumanName(); + copyElement(src, tgt); + if (src.hasUse()) + tgt.setUse(convertNameUse(src.getUse())); + if (src.hasText()) + tgt.setText(src.getText()); + if (src.hasFamily()) + tgt.setFamily(src.getFamily()); + for (org.hl7.fhir.r5.model.StringType t : src.getGiven()) + tgt.addGiven(t.getValue()); + for (org.hl7.fhir.r5.model.StringType t : src.getPrefix()) + tgt.addPrefix(t.getValue()); + for (org.hl7.fhir.r5.model.StringType t : src.getSuffix()) + tgt.addSuffix(t.getValue()); + if (src.hasPeriod()) + tgt.setPeriod(convertPeriod(src.getPeriod())); + return tgt; + } + + private static org.hl7.fhir.r5.model.HumanName.NameUse convertNameUse(org.hl7.fhir.dstu3.model.HumanName.NameUse src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case USUAL: return org.hl7.fhir.r5.model.HumanName.NameUse.USUAL; + case OFFICIAL: return org.hl7.fhir.r5.model.HumanName.NameUse.OFFICIAL; + case TEMP: return org.hl7.fhir.r5.model.HumanName.NameUse.TEMP; + case NICKNAME: return org.hl7.fhir.r5.model.HumanName.NameUse.NICKNAME; + case ANONYMOUS: return org.hl7.fhir.r5.model.HumanName.NameUse.ANONYMOUS; + case OLD: return org.hl7.fhir.r5.model.HumanName.NameUse.OLD; + case MAIDEN: return org.hl7.fhir.r5.model.HumanName.NameUse.MAIDEN; + default: return org.hl7.fhir.r5.model.HumanName.NameUse.NULL; + } +} + + private static org.hl7.fhir.dstu3.model.HumanName.NameUse convertNameUse(org.hl7.fhir.r5.model.HumanName.NameUse src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case USUAL: return org.hl7.fhir.dstu3.model.HumanName.NameUse.USUAL; + case OFFICIAL: return org.hl7.fhir.dstu3.model.HumanName.NameUse.OFFICIAL; + case TEMP: return org.hl7.fhir.dstu3.model.HumanName.NameUse.TEMP; + case NICKNAME: return org.hl7.fhir.dstu3.model.HumanName.NameUse.NICKNAME; + case ANONYMOUS: return org.hl7.fhir.dstu3.model.HumanName.NameUse.ANONYMOUS; + case OLD: return org.hl7.fhir.dstu3.model.HumanName.NameUse.OLD; + case MAIDEN: return org.hl7.fhir.dstu3.model.HumanName.NameUse.MAIDEN; + default: return org.hl7.fhir.dstu3.model.HumanName.NameUse.NULL; + } +} + + public static org.hl7.fhir.r5.model.Meta convertMeta(org.hl7.fhir.dstu3.model.Meta src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Meta tgt = new org.hl7.fhir.r5.model.Meta(); + copyElement(src, tgt); + if (src.hasVersionId()) + tgt.setVersionId(src.getVersionId()); + if (src.hasLastUpdated()) + tgt.setLastUpdated(src.getLastUpdated()); + for (org.hl7.fhir.dstu3.model.UriType t : src.getProfile()) + tgt.addProfile(t.getValue()); + for (org.hl7.fhir.dstu3.model.Coding t : src.getSecurity()) + tgt.addSecurity(convertCoding(t)); + for (org.hl7.fhir.dstu3.model.Coding t : src.getTag()) + tgt.addTag(convertCoding(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Meta convertMeta(org.hl7.fhir.r5.model.Meta src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Meta tgt = new org.hl7.fhir.dstu3.model.Meta(); + copyElement(src, tgt); + if (src.hasVersionId()) + tgt.setVersionId(src.getVersionId()); + if (src.hasLastUpdated()) + tgt.setLastUpdated(src.getLastUpdated()); + for (org.hl7.fhir.r5.model.UriType t : src.getProfile()) + tgt.addProfile(t.getValue()); + for (org.hl7.fhir.r5.model.Coding t : src.getSecurity()) + tgt.addSecurity(convertCoding(t)); + for (org.hl7.fhir.r5.model.Coding t : src.getTag()) + tgt.addTag(convertCoding(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.ParameterDefinition convertParameterDefinition(org.hl7.fhir.dstu3.model.ParameterDefinition src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ParameterDefinition tgt = new org.hl7.fhir.r5.model.ParameterDefinition(); + copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasUse()) + tgt.setUse(convertParameterUse(src.getUse())); + if (src.hasMin()) + tgt.setMin(src.getMin()); + if (src.hasMax()) + tgt.setMax(src.getMax()); + if (src.hasDocumentation()) + tgt.setDocumentation(src.getDocumentation()); + if (src.hasType()) + tgt.setType(src.getType()); + if (src.hasProfile()) { + tgt.setProfile(convertReference(src.getProfile()).getReference()); + } + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ParameterDefinition convertParameterDefinition(org.hl7.fhir.r5.model.ParameterDefinition src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.ParameterDefinition tgt = new org.hl7.fhir.dstu3.model.ParameterDefinition(); + copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasUse()) + tgt.setUse(convertParameterUse(src.getUse())); + if (src.hasMin()) + tgt.setMin(src.getMin()); + if (src.hasMax()) + tgt.setMax(src.getMax()); + if (src.hasDocumentation()) + tgt.setDocumentation(src.getDocumentation()); + if (src.hasType()) + tgt.setType(src.getType()); + if (src.hasProfile()) + tgt.setProfile(new org.hl7.fhir.dstu3.model.Reference(src.getProfile())); + return tgt; + } + + private static org.hl7.fhir.r5.model.ParameterDefinition.ParameterUse convertParameterUse(org.hl7.fhir.dstu3.model.ParameterDefinition.ParameterUse src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case IN: return org.hl7.fhir.r5.model.ParameterDefinition.ParameterUse.IN; + case OUT: return org.hl7.fhir.r5.model.ParameterDefinition.ParameterUse.OUT; + default: return org.hl7.fhir.r5.model.ParameterDefinition.ParameterUse.NULL; + } +} + + private static org.hl7.fhir.dstu3.model.ParameterDefinition.ParameterUse convertParameterUse(org.hl7.fhir.r5.model.ParameterDefinition.ParameterUse src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case IN: return org.hl7.fhir.dstu3.model.ParameterDefinition.ParameterUse.IN; + case OUT: return org.hl7.fhir.dstu3.model.ParameterDefinition.ParameterUse.OUT; + default: return org.hl7.fhir.dstu3.model.ParameterDefinition.ParameterUse.NULL; + } +} + + public static org.hl7.fhir.r5.model.RelatedArtifact convertRelatedArtifact(org.hl7.fhir.dstu3.model.RelatedArtifact src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.RelatedArtifact tgt = new org.hl7.fhir.r5.model.RelatedArtifact(); + copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertRelatedArtifactType(src.getType())); + if (src.hasDisplay()) + tgt.setDisplay(src.getDisplay()); + if (src.hasCitation()) + tgt.setCitation(src.getCitation()); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + if (src.hasDocument()) + tgt.setDocument(convertAttachment(src.getDocument())); + if (src.hasResource()) + tgt.setResourceElement(convertReferenceToCanonical(src.getResource())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.RelatedArtifact convertRelatedArtifact(org.hl7.fhir.r5.model.RelatedArtifact src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.RelatedArtifact tgt = new org.hl7.fhir.dstu3.model.RelatedArtifact(); + copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertRelatedArtifactType(src.getType())); + if (src.hasDisplay()) + tgt.setDisplay(src.getDisplay()); + if (src.hasCitation()) + tgt.setCitation(src.getCitation()); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + if (src.hasDocument()) + tgt.setDocument(convertAttachment(src.getDocument())); + if (src.hasResource()) + tgt.setResource(convertCanonicalToReference(src.getResourceElement())); + return tgt; + } + + private static org.hl7.fhir.r5.model.RelatedArtifact.RelatedArtifactType convertRelatedArtifactType(org.hl7.fhir.dstu3.model.RelatedArtifact.RelatedArtifactType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case DOCUMENTATION: return org.hl7.fhir.r5.model.RelatedArtifact.RelatedArtifactType.DOCUMENTATION; + case JUSTIFICATION: return org.hl7.fhir.r5.model.RelatedArtifact.RelatedArtifactType.JUSTIFICATION; + case CITATION: return org.hl7.fhir.r5.model.RelatedArtifact.RelatedArtifactType.CITATION; + case PREDECESSOR: return org.hl7.fhir.r5.model.RelatedArtifact.RelatedArtifactType.PREDECESSOR; + case SUCCESSOR: return org.hl7.fhir.r5.model.RelatedArtifact.RelatedArtifactType.SUCCESSOR; + case DERIVEDFROM: return org.hl7.fhir.r5.model.RelatedArtifact.RelatedArtifactType.DERIVEDFROM; + case DEPENDSON: return org.hl7.fhir.r5.model.RelatedArtifact.RelatedArtifactType.DEPENDSON; + case COMPOSEDOF: return org.hl7.fhir.r5.model.RelatedArtifact.RelatedArtifactType.COMPOSEDOF; + default: return org.hl7.fhir.r5.model.RelatedArtifact.RelatedArtifactType.NULL; + } +} + + private static org.hl7.fhir.dstu3.model.RelatedArtifact.RelatedArtifactType convertRelatedArtifactType(org.hl7.fhir.r5.model.RelatedArtifact.RelatedArtifactType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case DOCUMENTATION: return org.hl7.fhir.dstu3.model.RelatedArtifact.RelatedArtifactType.DOCUMENTATION; + case JUSTIFICATION: return org.hl7.fhir.dstu3.model.RelatedArtifact.RelatedArtifactType.JUSTIFICATION; + case CITATION: return org.hl7.fhir.dstu3.model.RelatedArtifact.RelatedArtifactType.CITATION; + case PREDECESSOR: return org.hl7.fhir.dstu3.model.RelatedArtifact.RelatedArtifactType.PREDECESSOR; + case SUCCESSOR: return org.hl7.fhir.dstu3.model.RelatedArtifact.RelatedArtifactType.SUCCESSOR; + case DERIVEDFROM: return org.hl7.fhir.dstu3.model.RelatedArtifact.RelatedArtifactType.DERIVEDFROM; + case DEPENDSON: return org.hl7.fhir.dstu3.model.RelatedArtifact.RelatedArtifactType.DEPENDSON; + case COMPOSEDOF: return org.hl7.fhir.dstu3.model.RelatedArtifact.RelatedArtifactType.COMPOSEDOF; + default: return org.hl7.fhir.dstu3.model.RelatedArtifact.RelatedArtifactType.NULL; + } +} + + public static org.hl7.fhir.r5.model.Timing convertTiming(org.hl7.fhir.dstu3.model.Timing src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Timing tgt = new org.hl7.fhir.r5.model.Timing(); + copyElement(src, tgt); + for (org.hl7.fhir.dstu3.model.DateTimeType t : src.getEvent()) + tgt.addEvent(t.getValue()); + if (src.hasRepeat()) + tgt.setRepeat(convertTimingRepeatComponent(src.getRepeat())); + if (src.hasCode()) + tgt.setCode(convertCodeableConcept(src.getCode())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Timing convertTiming(org.hl7.fhir.r5.model.Timing src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Timing tgt = new org.hl7.fhir.dstu3.model.Timing(); + copyElement(src, tgt); + for (org.hl7.fhir.r5.model.DateTimeType t : src.getEvent()) + tgt.addEvent(t.getValue()); + if (src.hasRepeat()) + tgt.setRepeat(convertTimingRepeatComponent(src.getRepeat())); + if (src.hasCode()) + tgt.setCode(convertCodeableConcept(src.getCode())); + return tgt; + } + + public static org.hl7.fhir.r5.model.Timing.TimingRepeatComponent convertTimingRepeatComponent(org.hl7.fhir.dstu3.model.Timing.TimingRepeatComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Timing.TimingRepeatComponent tgt = new org.hl7.fhir.r5.model.Timing.TimingRepeatComponent(); + copyElement(src, tgt); + if (src.hasBounds()) + tgt.setBounds(convertType(src.getBounds())); + if (src.hasCount()) + tgt.setCount(src.getCount()); + if (src.hasCountMax()) + tgt.setCountMax(src.getCountMax()); + if (src.hasDuration()) + tgt.setDuration(src.getDuration()); + if (src.hasDurationMax()) + tgt.setDurationMax(src.getDurationMax()); + if (src.hasDurationUnit()) + tgt.setDurationUnit(convertUnitsOfTime(src.getDurationUnit())); + if (src.hasFrequency()) + tgt.setFrequency(src.getFrequency()); + if (src.hasFrequencyMax()) + tgt.setFrequencyMax(src.getFrequencyMax()); + if (src.hasPeriod()) + tgt.setPeriod(src.getPeriod()); + if (src.hasPeriodMax()) + tgt.setPeriodMax(src.getPeriodMax()); + if (src.hasPeriodUnit()) + tgt.setPeriodUnit(convertUnitsOfTime(src.getPeriodUnit())); + for (org.hl7.fhir.dstu3.model.Enumeration t : src.getDayOfWeek()) + tgt.addDayOfWeek(convertDayOfWeek(t.getValue())); + for (org.hl7.fhir.dstu3.model.TimeType t : src.getTimeOfDay()) + tgt.addTimeOfDay(t.getValue()); + for (org.hl7.fhir.dstu3.model.Enumeration t : src.getWhen()) + tgt.addWhen(convertEventTiming(t.getValue())); + if (src.hasOffset()) + tgt.setOffset(src.getOffset()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Timing.TimingRepeatComponent convertTimingRepeatComponent(org.hl7.fhir.r5.model.Timing.TimingRepeatComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Timing.TimingRepeatComponent tgt = new org.hl7.fhir.dstu3.model.Timing.TimingRepeatComponent(); + copyElement(src, tgt); + if (src.hasBounds()) + tgt.setBounds(convertType(src.getBounds())); + if (src.hasCount()) + tgt.setCount(src.getCount()); + if (src.hasCountMax()) + tgt.setCountMax(src.getCountMax()); + if (src.hasDuration()) + tgt.setDuration(src.getDuration()); + if (src.hasDurationMax()) + tgt.setDurationMax(src.getDurationMax()); + if (src.hasDurationUnit()) + tgt.setDurationUnit(convertUnitsOfTime(src.getDurationUnit())); + if (src.hasFrequency()) + tgt.setFrequency(src.getFrequency()); + if (src.hasFrequencyMax()) + tgt.setFrequencyMax(src.getFrequencyMax()); + if (src.hasPeriod()) + tgt.setPeriod(src.getPeriod()); + if (src.hasPeriodMax()) + tgt.setPeriodMax(src.getPeriodMax()); + if (src.hasPeriodUnit()) + tgt.setPeriodUnit(convertUnitsOfTime(src.getPeriodUnit())); + for (org.hl7.fhir.r5.model.Enumeration t : src.getDayOfWeek()) + tgt.addDayOfWeek(convertDayOfWeek(t.getValue())); + for (org.hl7.fhir.r5.model.TimeType t : src.getTimeOfDay()) + tgt.addTimeOfDay(t.getValue()); + for (org.hl7.fhir.r5.model.Enumeration t : src.getWhen()) + tgt.addWhen(convertEventTiming(t.getValue())); + if (src.hasOffset()) + tgt.setOffset(src.getOffset()); + return tgt; + } + + private static org.hl7.fhir.r5.model.Timing.UnitsOfTime convertUnitsOfTime(org.hl7.fhir.dstu3.model.Timing.UnitsOfTime src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case S: return org.hl7.fhir.r5.model.Timing.UnitsOfTime.S; + case MIN: return org.hl7.fhir.r5.model.Timing.UnitsOfTime.MIN; + case H: return org.hl7.fhir.r5.model.Timing.UnitsOfTime.H; + case D: return org.hl7.fhir.r5.model.Timing.UnitsOfTime.D; + case WK: return org.hl7.fhir.r5.model.Timing.UnitsOfTime.WK; + case MO: return org.hl7.fhir.r5.model.Timing.UnitsOfTime.MO; + case A: return org.hl7.fhir.r5.model.Timing.UnitsOfTime.A; + default: return org.hl7.fhir.r5.model.Timing.UnitsOfTime.NULL; + } +} + + private static org.hl7.fhir.dstu3.model.Timing.UnitsOfTime convertUnitsOfTime(org.hl7.fhir.r5.model.Timing.UnitsOfTime src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case S: return org.hl7.fhir.dstu3.model.Timing.UnitsOfTime.S; + case MIN: return org.hl7.fhir.dstu3.model.Timing.UnitsOfTime.MIN; + case H: return org.hl7.fhir.dstu3.model.Timing.UnitsOfTime.H; + case D: return org.hl7.fhir.dstu3.model.Timing.UnitsOfTime.D; + case WK: return org.hl7.fhir.dstu3.model.Timing.UnitsOfTime.WK; + case MO: return org.hl7.fhir.dstu3.model.Timing.UnitsOfTime.MO; + case A: return org.hl7.fhir.dstu3.model.Timing.UnitsOfTime.A; + default: return org.hl7.fhir.dstu3.model.Timing.UnitsOfTime.NULL; + } +} + + private static org.hl7.fhir.r5.model.Timing.DayOfWeek convertDayOfWeek(org.hl7.fhir.dstu3.model.Timing.DayOfWeek src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case MON: return org.hl7.fhir.r5.model.Timing.DayOfWeek.MON; + case TUE: return org.hl7.fhir.r5.model.Timing.DayOfWeek.TUE; + case WED: return org.hl7.fhir.r5.model.Timing.DayOfWeek.WED; + case THU: return org.hl7.fhir.r5.model.Timing.DayOfWeek.THU; + case FRI: return org.hl7.fhir.r5.model.Timing.DayOfWeek.FRI; + case SAT: return org.hl7.fhir.r5.model.Timing.DayOfWeek.SAT; + case SUN: return org.hl7.fhir.r5.model.Timing.DayOfWeek.SUN; + default: return org.hl7.fhir.r5.model.Timing.DayOfWeek.NULL; + } +} + + private static org.hl7.fhir.dstu3.model.Timing.DayOfWeek convertDayOfWeek(org.hl7.fhir.r5.model.Timing.DayOfWeek src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case MON: return org.hl7.fhir.dstu3.model.Timing.DayOfWeek.MON; + case TUE: return org.hl7.fhir.dstu3.model.Timing.DayOfWeek.TUE; + case WED: return org.hl7.fhir.dstu3.model.Timing.DayOfWeek.WED; + case THU: return org.hl7.fhir.dstu3.model.Timing.DayOfWeek.THU; + case FRI: return org.hl7.fhir.dstu3.model.Timing.DayOfWeek.FRI; + case SAT: return org.hl7.fhir.dstu3.model.Timing.DayOfWeek.SAT; + case SUN: return org.hl7.fhir.dstu3.model.Timing.DayOfWeek.SUN; + default: return org.hl7.fhir.dstu3.model.Timing.DayOfWeek.NULL; + } +} + + private static org.hl7.fhir.r5.model.Timing.EventTiming convertEventTiming(org.hl7.fhir.dstu3.model.Timing.EventTiming src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case MORN: return org.hl7.fhir.r5.model.Timing.EventTiming.MORN; + case AFT: return org.hl7.fhir.r5.model.Timing.EventTiming.AFT; + case EVE: return org.hl7.fhir.r5.model.Timing.EventTiming.EVE; + case NIGHT: return org.hl7.fhir.r5.model.Timing.EventTiming.NIGHT; + case PHS: return org.hl7.fhir.r5.model.Timing.EventTiming.PHS; + case HS: return org.hl7.fhir.r5.model.Timing.EventTiming.HS; + case WAKE: return org.hl7.fhir.r5.model.Timing.EventTiming.WAKE; + case C: return org.hl7.fhir.r5.model.Timing.EventTiming.C; + case CM: return org.hl7.fhir.r5.model.Timing.EventTiming.CM; + case CD: return org.hl7.fhir.r5.model.Timing.EventTiming.CD; + case CV: return org.hl7.fhir.r5.model.Timing.EventTiming.CV; + case AC: return org.hl7.fhir.r5.model.Timing.EventTiming.AC; + case ACM: return org.hl7.fhir.r5.model.Timing.EventTiming.ACM; + case ACD: return org.hl7.fhir.r5.model.Timing.EventTiming.ACD; + case ACV: return org.hl7.fhir.r5.model.Timing.EventTiming.ACV; + case PC: return org.hl7.fhir.r5.model.Timing.EventTiming.PC; + case PCM: return org.hl7.fhir.r5.model.Timing.EventTiming.PCM; + case PCD: return org.hl7.fhir.r5.model.Timing.EventTiming.PCD; + case PCV: return org.hl7.fhir.r5.model.Timing.EventTiming.PCV; + default: return org.hl7.fhir.r5.model.Timing.EventTiming.NULL; + } +} + + private static org.hl7.fhir.dstu3.model.Timing.EventTiming convertEventTiming(org.hl7.fhir.r5.model.Timing.EventTiming src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case MORN: return org.hl7.fhir.dstu3.model.Timing.EventTiming.MORN; + case AFT: return org.hl7.fhir.dstu3.model.Timing.EventTiming.AFT; + case EVE: return org.hl7.fhir.dstu3.model.Timing.EventTiming.EVE; + case NIGHT: return org.hl7.fhir.dstu3.model.Timing.EventTiming.NIGHT; + case PHS: return org.hl7.fhir.dstu3.model.Timing.EventTiming.PHS; + case HS: return org.hl7.fhir.dstu3.model.Timing.EventTiming.HS; + case WAKE: return org.hl7.fhir.dstu3.model.Timing.EventTiming.WAKE; + case C: return org.hl7.fhir.dstu3.model.Timing.EventTiming.C; + case CM: return org.hl7.fhir.dstu3.model.Timing.EventTiming.CM; + case CD: return org.hl7.fhir.dstu3.model.Timing.EventTiming.CD; + case CV: return org.hl7.fhir.dstu3.model.Timing.EventTiming.CV; + case AC: return org.hl7.fhir.dstu3.model.Timing.EventTiming.AC; + case ACM: return org.hl7.fhir.dstu3.model.Timing.EventTiming.ACM; + case ACD: return org.hl7.fhir.dstu3.model.Timing.EventTiming.ACD; + case ACV: return org.hl7.fhir.dstu3.model.Timing.EventTiming.ACV; + case PC: return org.hl7.fhir.dstu3.model.Timing.EventTiming.PC; + case PCM: return org.hl7.fhir.dstu3.model.Timing.EventTiming.PCM; + case PCD: return org.hl7.fhir.dstu3.model.Timing.EventTiming.PCD; + case PCV: return org.hl7.fhir.dstu3.model.Timing.EventTiming.PCV; + default: return org.hl7.fhir.dstu3.model.Timing.EventTiming.NULL; + } +} + + public static org.hl7.fhir.r5.model.UsageContext convertUsageContext(org.hl7.fhir.dstu3.model.UsageContext src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.UsageContext tgt = new org.hl7.fhir.r5.model.UsageContext(); + copyElement(src, tgt); + if (src.hasCode()) + tgt.setCode(convertCoding(src.getCode())); + if (src.hasValue()) + tgt.setValue(convertType(src.getValue())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.UsageContext convertUsageContext(org.hl7.fhir.r5.model.UsageContext src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.UsageContext tgt = new org.hl7.fhir.dstu3.model.UsageContext(); + copyElement(src, tgt); + if (src.hasCode()) + tgt.setCode(convertCoding(src.getCode())); + if (src.hasValue()) + tgt.setValue(convertType(src.getValue())); + return tgt; + } + + public static org.hl7.fhir.r5.model.Quantity convertSimpleQuantity(org.hl7.fhir.dstu3.model.SimpleQuantity src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.SimpleQuantity tgt = new org.hl7.fhir.r5.model.SimpleQuantity(); + copyElement(src, tgt); + if (src.hasValue()) + tgt.setValue(src.getValue()); + if (src.hasComparator()) + tgt.setComparator(convertQuantityComparator(src.getComparator())); + if (src.hasUnit()) + tgt.setUnit(src.getUnit()); + if (src.hasSystem()) + tgt.setSystem(src.getSystem()); + if (src.hasCode()) + tgt.setCode(src.getCode()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.SimpleQuantity convertSimpleQuantity(org.hl7.fhir.r5.model.Quantity src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.SimpleQuantity tgt = new org.hl7.fhir.dstu3.model.SimpleQuantity(); + copyElement(src, tgt); + if (src.hasValue()) + tgt.setValue(src.getValue()); + if (src.hasComparator()) + tgt.setComparator(convertQuantityComparator(src.getComparator())); + if (src.hasUnit()) + tgt.setUnit(src.getUnit()); + if (src.hasSystem()) + tgt.setSystem(src.getSystem()); + if (src.hasCode()) + tgt.setCode(src.getCode()); + return tgt; + } + + public static org.hl7.fhir.r5.model.TriggerDefinition convertTriggerDefinition(org.hl7.fhir.dstu3.model.TriggerDefinition src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.TriggerDefinition tgt = new org.hl7.fhir.r5.model.TriggerDefinition(); + copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertTriggerType(src.getType())); + if (src.hasEventName()) + tgt.setName(src.getEventName()); + if (src.hasEventTiming()) + tgt.setTiming(convertType(src.getEventTiming())); + if (src.hasEventData()) + tgt.addData(convertDataRequirement(src.getEventData())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.TriggerDefinition convertTriggerDefinition(org.hl7.fhir.r5.model.TriggerDefinition src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.TriggerDefinition tgt = new org.hl7.fhir.dstu3.model.TriggerDefinition(); + copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertTriggerType(src.getType())); + if (src.hasName()) + tgt.setEventName(src.getName()); + if (src.hasTiming()) + tgt.setEventTiming(convertType(src.getTiming())); + if (src.hasData()) + tgt.setEventData(convertDataRequirement(src.getDataFirstRep())); + return tgt; + } + + public static org.hl7.fhir.r5.model.DataRequirement convertDataRequirement(org.hl7.fhir.dstu3.model.DataRequirement src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.DataRequirement tgt = new org.hl7.fhir.r5.model.DataRequirement(); + copyElement(src, tgt); + if (src.hasType()) + tgt.setType(src.getType()); + for (org.hl7.fhir.dstu3.model.UriType t : src.getProfile()) + tgt.addProfile(t.getValue()); + for (org.hl7.fhir.dstu3.model.StringType t : src.getMustSupport()) + tgt.addMustSupport(t.getValue()); + for (org.hl7.fhir.dstu3.model.DataRequirement.DataRequirementCodeFilterComponent t : src.getCodeFilter()) + tgt.addCodeFilter(convertDataRequirementCodeFilterComponent(t)); + for (org.hl7.fhir.dstu3.model.DataRequirement.DataRequirementDateFilterComponent t : src.getDateFilter()) + tgt.addDateFilter(convertDataRequirementDateFilterComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.DataRequirement convertDataRequirement(org.hl7.fhir.r5.model.DataRequirement src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.DataRequirement tgt = new org.hl7.fhir.dstu3.model.DataRequirement(); + copyElement(src, tgt); + if (src.hasType()) + tgt.setType(src.getType()); + for (org.hl7.fhir.r5.model.UriType t : src.getProfile()) + tgt.addProfile(t.getValue()); + for (org.hl7.fhir.r5.model.StringType t : src.getMustSupport()) + tgt.addMustSupport(t.getValue()); + for (org.hl7.fhir.r5.model.DataRequirement.DataRequirementCodeFilterComponent t : src.getCodeFilter()) + tgt.addCodeFilter(convertDataRequirementCodeFilterComponent(t)); + for (org.hl7.fhir.r5.model.DataRequirement.DataRequirementDateFilterComponent t : src.getDateFilter()) + tgt.addDateFilter(convertDataRequirementDateFilterComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.DataRequirement.DataRequirementCodeFilterComponent convertDataRequirementCodeFilterComponent(org.hl7.fhir.dstu3.model.DataRequirement.DataRequirementCodeFilterComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.DataRequirement.DataRequirementCodeFilterComponent tgt = new org.hl7.fhir.r5.model.DataRequirement.DataRequirementCodeFilterComponent(); + copyElement(src, tgt); + if (src.hasPath()) + tgt.setPath(src.getPath()); + if (src.hasValueSet()) { + Type t = convertType(src.getValueSet()); + if (t instanceof org.hl7.fhir.r5.model.Reference) + tgt.setValueSet(((org.hl7.fhir.r5.model.Reference) t).getReference()); + else + tgt.setValueSet(t.primitiveValue()); + tgt.setValueSet(VersionConvertorConstants.refToVS(tgt.getValueSet())); + } + for (org.hl7.fhir.dstu3.model.CodeType t : src.getValueCode()) + tgt.addCode(convertCoding(t)); + for (org.hl7.fhir.dstu3.model.Coding t : src.getValueCoding()) + tgt.addCode(convertCoding(t)); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getValueCodeableConcept()) + tgt.addCode(convertCoding(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.DataRequirement.DataRequirementCodeFilterComponent convertDataRequirementCodeFilterComponent(org.hl7.fhir.r5.model.DataRequirement.DataRequirementCodeFilterComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.DataRequirement.DataRequirementCodeFilterComponent tgt = new org.hl7.fhir.dstu3.model.DataRequirement.DataRequirementCodeFilterComponent(); + copyElement(src, tgt); + if (src.hasPath()) + tgt.setPath(src.getPath()); + if (src.hasValueSet()) { + String vsr = VersionConvertorConstants.vsToRef(src.getValueSet()); + if (vsr != null) + tgt.setValueSet(new org.hl7.fhir.dstu3.model.UriType(vsr)); + else + tgt.setValueSet(new org.hl7.fhir.dstu3.model.Reference(src.getValueSet())); + } + for (org.hl7.fhir.r5.model.Coding t : src.getCode()) { + tgt.addValueCoding(convertCoding(t)); + } + return tgt; + } + + public static org.hl7.fhir.r5.model.DataRequirement.DataRequirementDateFilterComponent convertDataRequirementDateFilterComponent(org.hl7.fhir.dstu3.model.DataRequirement.DataRequirementDateFilterComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.DataRequirement.DataRequirementDateFilterComponent tgt = new org.hl7.fhir.r5.model.DataRequirement.DataRequirementDateFilterComponent(); + copyElement(src, tgt); + if (src.hasPath()) + tgt.setPath(src.getPath()); + if (src.hasValue()) + tgt.setValue(convertType(src.getValue())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.DataRequirement.DataRequirementDateFilterComponent convertDataRequirementDateFilterComponent(org.hl7.fhir.r5.model.DataRequirement.DataRequirementDateFilterComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.DataRequirement.DataRequirementDateFilterComponent tgt = new org.hl7.fhir.dstu3.model.DataRequirement.DataRequirementDateFilterComponent(); + copyElement(src, tgt); + if (src.hasPath()) + tgt.setPath(src.getPath()); + if (src.hasValue()) + tgt.setValue(convertType(src.getValue())); + return tgt; + } + + + private static org.hl7.fhir.r5.model.TriggerDefinition.TriggerType convertTriggerType(org.hl7.fhir.dstu3.model.TriggerDefinition.TriggerType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case NAMEDEVENT: return org.hl7.fhir.r5.model.TriggerDefinition.TriggerType.NAMEDEVENT; + case PERIODIC: return org.hl7.fhir.r5.model.TriggerDefinition.TriggerType.PERIODIC; + case DATAADDED: return org.hl7.fhir.r5.model.TriggerDefinition.TriggerType.DATAADDED; + case DATAMODIFIED: return org.hl7.fhir.r5.model.TriggerDefinition.TriggerType.DATAMODIFIED; + case DATAREMOVED: return org.hl7.fhir.r5.model.TriggerDefinition.TriggerType.DATAREMOVED; + case DATAACCESSED: return org.hl7.fhir.r5.model.TriggerDefinition.TriggerType.DATAACCESSED; + case DATAACCESSENDED: return org.hl7.fhir.r5.model.TriggerDefinition.TriggerType.DATAACCESSENDED; + default: return org.hl7.fhir.r5.model.TriggerDefinition.TriggerType.NULL; + } +} + + private static org.hl7.fhir.dstu3.model.TriggerDefinition.TriggerType convertTriggerType(org.hl7.fhir.r5.model.TriggerDefinition.TriggerType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case NAMEDEVENT: return org.hl7.fhir.dstu3.model.TriggerDefinition.TriggerType.NAMEDEVENT; + case PERIODIC: return org.hl7.fhir.dstu3.model.TriggerDefinition.TriggerType.PERIODIC; + case DATAADDED: return org.hl7.fhir.dstu3.model.TriggerDefinition.TriggerType.DATAADDED; + case DATAMODIFIED: return org.hl7.fhir.dstu3.model.TriggerDefinition.TriggerType.DATAMODIFIED; + case DATAREMOVED: return org.hl7.fhir.dstu3.model.TriggerDefinition.TriggerType.DATAREMOVED; + case DATAACCESSED: return org.hl7.fhir.dstu3.model.TriggerDefinition.TriggerType.DATAACCESSED; + case DATAACCESSENDED: return org.hl7.fhir.dstu3.model.TriggerDefinition.TriggerType.DATAACCESSENDED; + default: return org.hl7.fhir.dstu3.model.TriggerDefinition.TriggerType.NULL; + } +} + + + public static org.hl7.fhir.r5.model.Type convertType(org.hl7.fhir.dstu3.model.Type src) throws FHIRException { + if (src == null) + return null; + if (src instanceof org.hl7.fhir.dstu3.model.Base64BinaryType) + return convertBase64Binary((org.hl7.fhir.dstu3.model.Base64BinaryType) src); + if (src instanceof org.hl7.fhir.dstu3.model.BooleanType) + return convertBoolean((org.hl7.fhir.dstu3.model.BooleanType) src); + if (src instanceof org.hl7.fhir.dstu3.model.CodeType) + return convertCode((org.hl7.fhir.dstu3.model.CodeType) src); + if (src instanceof org.hl7.fhir.dstu3.model.DateType) + return convertDate((org.hl7.fhir.dstu3.model.DateType) src); + if (src instanceof org.hl7.fhir.dstu3.model.DateTimeType) + return convertDateTime((org.hl7.fhir.dstu3.model.DateTimeType) src); + if (src instanceof org.hl7.fhir.dstu3.model.DecimalType) + return convertDecimal((org.hl7.fhir.dstu3.model.DecimalType) src); + if (src instanceof org.hl7.fhir.dstu3.model.IdType) + return convertId((org.hl7.fhir.dstu3.model.IdType) src); + if (src instanceof org.hl7.fhir.dstu3.model.InstantType) + return convertInstant((org.hl7.fhir.dstu3.model.InstantType) src); + if (src instanceof org.hl7.fhir.dstu3.model.IntegerType) + return convertInteger((org.hl7.fhir.dstu3.model.IntegerType) src); + if (src instanceof org.hl7.fhir.dstu3.model.MarkdownType) + return convertMarkdown((org.hl7.fhir.dstu3.model.MarkdownType) src); + if (src instanceof org.hl7.fhir.dstu3.model.OidType) + return convertOid((org.hl7.fhir.dstu3.model.OidType) src); + if (src instanceof org.hl7.fhir.dstu3.model.PositiveIntType) + return convertPositiveInt((org.hl7.fhir.dstu3.model.PositiveIntType) src); + if (src instanceof org.hl7.fhir.dstu3.model.StringType) + return convertString((org.hl7.fhir.dstu3.model.StringType) src); + if (src instanceof org.hl7.fhir.dstu3.model.TimeType) + return convertTime((org.hl7.fhir.dstu3.model.TimeType) src); + if (src instanceof org.hl7.fhir.dstu3.model.UnsignedIntType) + return convertUnsignedInt((org.hl7.fhir.dstu3.model.UnsignedIntType) src); + if (src instanceof org.hl7.fhir.dstu3.model.UriType) + return convertUri((org.hl7.fhir.dstu3.model.UriType) src); + if (src instanceof org.hl7.fhir.dstu3.model.UuidType) + return convertUuid((org.hl7.fhir.dstu3.model.UuidType) src); + if (src instanceof org.hl7.fhir.dstu3.model.Extension) + return convertExtension((org.hl7.fhir.dstu3.model.Extension) src); + if (src instanceof org.hl7.fhir.dstu3.model.Narrative) + return convertNarrative((org.hl7.fhir.dstu3.model.Narrative) src); + if (src instanceof org.hl7.fhir.dstu3.model.Age) + return convertAge((org.hl7.fhir.dstu3.model.Age) src); + if (src instanceof org.hl7.fhir.dstu3.model.Annotation) + return convertAnnotation((org.hl7.fhir.dstu3.model.Annotation) src); + if (src instanceof org.hl7.fhir.dstu3.model.Attachment) + return convertAttachment((org.hl7.fhir.dstu3.model.Attachment) src); + if (src instanceof org.hl7.fhir.dstu3.model.CodeableConcept) + return convertCodeableConcept((org.hl7.fhir.dstu3.model.CodeableConcept) src); + if (src instanceof org.hl7.fhir.dstu3.model.Coding) + return convertCoding((org.hl7.fhir.dstu3.model.Coding) src); + if (src instanceof org.hl7.fhir.dstu3.model.Count) + return convertCount((org.hl7.fhir.dstu3.model.Count) src); + if (src instanceof org.hl7.fhir.dstu3.model.Distance) + return convertDistance((org.hl7.fhir.dstu3.model.Distance) src); + if (src instanceof org.hl7.fhir.dstu3.model.Duration) + return convertDuration((org.hl7.fhir.dstu3.model.Duration) src); + if (src instanceof org.hl7.fhir.dstu3.model.Identifier) + return convertIdentifier((org.hl7.fhir.dstu3.model.Identifier) src); + if (src instanceof org.hl7.fhir.dstu3.model.Money) + return convertMoney((org.hl7.fhir.dstu3.model.Money) src); + if (src instanceof org.hl7.fhir.dstu3.model.Period) + return convertPeriod((org.hl7.fhir.dstu3.model.Period) src); + if (src instanceof org.hl7.fhir.dstu3.model.Quantity) + return convertQuantity((org.hl7.fhir.dstu3.model.Quantity) src); + if (src instanceof org.hl7.fhir.dstu3.model.Range) + return convertRange((org.hl7.fhir.dstu3.model.Range) src); + if (src instanceof org.hl7.fhir.dstu3.model.Ratio) + return convertRatio((org.hl7.fhir.dstu3.model.Ratio) src); + if (src instanceof org.hl7.fhir.dstu3.model.Reference) + return convertReference((org.hl7.fhir.dstu3.model.Reference) src); + if (src instanceof org.hl7.fhir.dstu3.model.SampledData) + return convertSampledData((org.hl7.fhir.dstu3.model.SampledData) src); + if (src instanceof org.hl7.fhir.dstu3.model.Signature) + return convertSignature((org.hl7.fhir.dstu3.model.Signature) src); + if (src instanceof org.hl7.fhir.dstu3.model.Address) + return convertAddress((org.hl7.fhir.dstu3.model.Address) src); + if (src instanceof org.hl7.fhir.dstu3.model.ContactDetail) + return convertContactDetail((org.hl7.fhir.dstu3.model.ContactDetail) src); + if (src instanceof org.hl7.fhir.dstu3.model.ContactPoint) + return convertContactPoint((org.hl7.fhir.dstu3.model.ContactPoint) src); + if (src instanceof org.hl7.fhir.dstu3.model.Contributor) + return convertContributor((org.hl7.fhir.dstu3.model.Contributor) src); + if (src instanceof org.hl7.fhir.dstu3.model.Dosage) + return convertDosage((org.hl7.fhir.dstu3.model.Dosage) src); + if (src instanceof org.hl7.fhir.dstu3.model.HumanName) + return convertHumanName((org.hl7.fhir.dstu3.model.HumanName) src); + if (src instanceof org.hl7.fhir.dstu3.model.Meta) + return convertMeta((org.hl7.fhir.dstu3.model.Meta) src); + if (src instanceof org.hl7.fhir.dstu3.model.ParameterDefinition) + return convertParameterDefinition((org.hl7.fhir.dstu3.model.ParameterDefinition) src); + if (src instanceof org.hl7.fhir.dstu3.model.RelatedArtifact) + return convertRelatedArtifact((org.hl7.fhir.dstu3.model.RelatedArtifact) src); + if (src instanceof org.hl7.fhir.dstu3.model.Timing) + return convertTiming((org.hl7.fhir.dstu3.model.Timing) src); + if (src instanceof org.hl7.fhir.dstu3.model.UsageContext) + return convertUsageContext((org.hl7.fhir.dstu3.model.UsageContext) src); + if (src instanceof org.hl7.fhir.dstu3.model.ElementDefinition) + return convertElementDefinition((org.hl7.fhir.dstu3.model.ElementDefinition) src); + if (src instanceof org.hl7.fhir.dstu3.model.DataRequirement) + return convertDataRequirement((org.hl7.fhir.dstu3.model.DataRequirement) src); + if (src instanceof org.hl7.fhir.dstu3.model.TriggerDefinition) + return convertTriggerDefinition((org.hl7.fhir.dstu3.model.TriggerDefinition) src); + throw new FHIRException("Unknown type "+src.fhirType()); + } + + public static org.hl7.fhir.dstu3.model.Type convertType(org.hl7.fhir.r5.model.Type src) throws FHIRException { + if (src == null) + return null; + if (src instanceof org.hl7.fhir.r5.model.Base64BinaryType) + return convertBase64Binary((org.hl7.fhir.r5.model.Base64BinaryType) src); + if (src instanceof org.hl7.fhir.r5.model.BooleanType) + return convertBoolean((org.hl7.fhir.r5.model.BooleanType) src); + if (src instanceof org.hl7.fhir.r5.model.CodeType) + return convertCode((org.hl7.fhir.r5.model.CodeType) src); + if (src instanceof org.hl7.fhir.r5.model.DateType) + return convertDate((org.hl7.fhir.r5.model.DateType) src); + if (src instanceof org.hl7.fhir.r5.model.DateTimeType) + return convertDateTime((org.hl7.fhir.r5.model.DateTimeType) src); + if (src instanceof org.hl7.fhir.r5.model.DecimalType) + return convertDecimal((org.hl7.fhir.r5.model.DecimalType) src); + if (src instanceof org.hl7.fhir.r5.model.IdType) + return convertId((org.hl7.fhir.r5.model.IdType) src); + if (src instanceof org.hl7.fhir.r5.model.InstantType) + return convertInstant((org.hl7.fhir.r5.model.InstantType) src); + if (src instanceof org.hl7.fhir.r5.model.IntegerType) + return convertInteger((org.hl7.fhir.r5.model.IntegerType) src); + if (src instanceof org.hl7.fhir.r5.model.MarkdownType) + return convertMarkdown((org.hl7.fhir.r5.model.MarkdownType) src); + if (src instanceof org.hl7.fhir.r5.model.OidType) + return convertOid((org.hl7.fhir.r5.model.OidType) src); + if (src instanceof org.hl7.fhir.r5.model.PositiveIntType) + return convertPositiveInt((org.hl7.fhir.r5.model.PositiveIntType) src); + if (src instanceof org.hl7.fhir.r5.model.StringType) + return convertString((org.hl7.fhir.r5.model.StringType) src); + if (src instanceof org.hl7.fhir.r5.model.TimeType) + return convertTime((org.hl7.fhir.r5.model.TimeType) src); + if (src instanceof org.hl7.fhir.r5.model.UnsignedIntType) + return convertUnsignedInt((org.hl7.fhir.r5.model.UnsignedIntType) src); + if (src instanceof org.hl7.fhir.r5.model.UriType) + return convertUri((org.hl7.fhir.r5.model.UriType) src); + if (src instanceof org.hl7.fhir.r5.model.UuidType) + return convertUuid((org.hl7.fhir.r5.model.UuidType) src); + if (src instanceof org.hl7.fhir.r5.model.Extension) + return convertExtension((org.hl7.fhir.r5.model.Extension) src); + if (src instanceof org.hl7.fhir.r5.model.Narrative) + return convertNarrative((org.hl7.fhir.r5.model.Narrative) src); + if (src instanceof org.hl7.fhir.r5.model.Age) + return convertAge((org.hl7.fhir.r5.model.Age) src); + if (src instanceof org.hl7.fhir.r5.model.Annotation) + return convertAnnotation((org.hl7.fhir.r5.model.Annotation) src); + if (src instanceof org.hl7.fhir.r5.model.Attachment) + return convertAttachment((org.hl7.fhir.r5.model.Attachment) src); + if (src instanceof org.hl7.fhir.r5.model.CodeableConcept) + return convertCodeableConcept((org.hl7.fhir.r5.model.CodeableConcept) src); + if (src instanceof org.hl7.fhir.r5.model.Coding) + return convertCoding((org.hl7.fhir.r5.model.Coding) src); + if (src instanceof org.hl7.fhir.r5.model.Count) + return convertCount((org.hl7.fhir.r5.model.Count) src); + if (src instanceof org.hl7.fhir.r5.model.Distance) + return convertDistance((org.hl7.fhir.r5.model.Distance) src); + if (src instanceof org.hl7.fhir.r5.model.Duration) + return convertDuration((org.hl7.fhir.r5.model.Duration) src); + if (src instanceof org.hl7.fhir.r5.model.Identifier) + return convertIdentifier((org.hl7.fhir.r5.model.Identifier) src); + if (src instanceof org.hl7.fhir.r5.model.Money) + return convertMoney((org.hl7.fhir.r5.model.Money) src); + if (src instanceof org.hl7.fhir.r5.model.Period) + return convertPeriod((org.hl7.fhir.r5.model.Period) src); + if (src instanceof org.hl7.fhir.r5.model.Quantity) + return convertQuantity((org.hl7.fhir.r5.model.Quantity) src); + if (src instanceof org.hl7.fhir.r5.model.Range) + return convertRange((org.hl7.fhir.r5.model.Range) src); + if (src instanceof org.hl7.fhir.r5.model.Ratio) + return convertRatio((org.hl7.fhir.r5.model.Ratio) src); + if (src instanceof org.hl7.fhir.r5.model.Reference) + return convertReference((org.hl7.fhir.r5.model.Reference) src); + if (src instanceof org.hl7.fhir.r5.model.SampledData) + return convertSampledData((org.hl7.fhir.r5.model.SampledData) src); + if (src instanceof org.hl7.fhir.r5.model.Signature) + return convertSignature((org.hl7.fhir.r5.model.Signature) src); + if (src instanceof org.hl7.fhir.r5.model.Address) + return convertAddress((org.hl7.fhir.r5.model.Address) src); + if (src instanceof org.hl7.fhir.r5.model.ContactDetail) + return convertContactDetail((org.hl7.fhir.r5.model.ContactDetail) src); + if (src instanceof org.hl7.fhir.r5.model.ContactPoint) + return convertContactPoint((org.hl7.fhir.r5.model.ContactPoint) src); + if (src instanceof org.hl7.fhir.r5.model.Contributor) + return convertContributor((org.hl7.fhir.r5.model.Contributor) src); + if (src instanceof org.hl7.fhir.r5.model.Dosage) + return convertDosage((org.hl7.fhir.r5.model.Dosage) src); + if (src instanceof org.hl7.fhir.r5.model.HumanName) + return convertHumanName((org.hl7.fhir.r5.model.HumanName) src); + if (src instanceof org.hl7.fhir.r5.model.Meta) + return convertMeta((org.hl7.fhir.r5.model.Meta) src); + if (src instanceof org.hl7.fhir.r5.model.ParameterDefinition) + return convertParameterDefinition((org.hl7.fhir.r5.model.ParameterDefinition) src); + if (src instanceof org.hl7.fhir.r5.model.RelatedArtifact) + return convertRelatedArtifact((org.hl7.fhir.r5.model.RelatedArtifact) src); + if (src instanceof org.hl7.fhir.r5.model.Timing) + return convertTiming((org.hl7.fhir.r5.model.Timing) src); + if (src instanceof org.hl7.fhir.r5.model.UsageContext) + return convertUsageContext((org.hl7.fhir.r5.model.UsageContext) src); + if (src instanceof org.hl7.fhir.r5.model.ElementDefinition) + return convertElementDefinition((org.hl7.fhir.r5.model.ElementDefinition) src); + if (src instanceof org.hl7.fhir.r5.model.DataRequirement) + return convertDataRequirement((org.hl7.fhir.r5.model.DataRequirement) src); + if (src instanceof org.hl7.fhir.r5.model.TriggerDefinition) + return convertTriggerDefinition((org.hl7.fhir.r5.model.TriggerDefinition) src); + throw new FHIRException("Unknown type "+src.fhirType()); + } + + private static void copyDomainResource(org.hl7.fhir.dstu3.model.DomainResource src, org.hl7.fhir.r5.model.DomainResource tgt) throws FHIRException { + copyResource(src, tgt); + if (src.hasText()) + tgt.setText(convertNarrative(src.getText())); + for (org.hl7.fhir.dstu3.model.Resource t1 : src.getContained()) + tgt.addContained(convertResource(t1, false)); + for (org.hl7.fhir.dstu3.model.Extension t2 : src.getExtension()) + tgt.addExtension(convertExtension(t2)); + for (org.hl7.fhir.dstu3.model.Extension t3 : src.getModifierExtension()) + tgt.addModifierExtension(convertExtension(t3)); + } + private static void copyDomainResource(org.hl7.fhir.r5.model.DomainResource src, org.hl7.fhir.dstu3.model.DomainResource tgt) throws FHIRException { + copyResource(src, tgt); + if (src.hasText()) + tgt.setText(convertNarrative(src.getText())); + for (org.hl7.fhir.r5.model.Resource t1 : src.getContained()) + tgt.addContained(convertResource(t1, false)); + for (org.hl7.fhir.r5.model.Extension t2 : src.getExtension()) + tgt.addExtension(convertExtension(t2)); + for (org.hl7.fhir.r5.model.Extension t3 : src.getModifierExtension()) + tgt.addModifierExtension(convertExtension(t3)); + } + public static org.hl7.fhir.r5.model.Parameters convertParameters(org.hl7.fhir.dstu3.model.Parameters src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Parameters tgt = new org.hl7.fhir.r5.model.Parameters(); + copyResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Parameters.ParametersParameterComponent t : src.getParameter()) + tgt.addParameter(convertParametersParameterComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Parameters convertParameters(org.hl7.fhir.r5.model.Parameters src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Parameters tgt = new org.hl7.fhir.dstu3.model.Parameters(); + copyResource(src, tgt); + for (org.hl7.fhir.r5.model.Parameters.ParametersParameterComponent t : src.getParameter()) + tgt.addParameter(convertParametersParameterComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.Parameters.ParametersParameterComponent convertParametersParameterComponent(org.hl7.fhir.dstu3.model.Parameters.ParametersParameterComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Parameters.ParametersParameterComponent tgt = new org.hl7.fhir.r5.model.Parameters.ParametersParameterComponent(); + copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasValue()) + tgt.setValue(convertType(src.getValue())); + if (src.hasResource()) + tgt.setResource(convertResource(src.getResource(), false)); + for (org.hl7.fhir.dstu3.model.Parameters.ParametersParameterComponent t : src.getPart()) + tgt.addPart(convertParametersParameterComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Parameters.ParametersParameterComponent convertParametersParameterComponent(org.hl7.fhir.r5.model.Parameters.ParametersParameterComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Parameters.ParametersParameterComponent tgt = new org.hl7.fhir.dstu3.model.Parameters.ParametersParameterComponent(); + copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasValue()) + tgt.setValue(convertType(src.getValue())); + if (src.hasResource()) + tgt.setResource(convertResource(src.getResource(), false)); + for (org.hl7.fhir.r5.model.Parameters.ParametersParameterComponent t : src.getPart()) + tgt.addPart(convertParametersParameterComponent(t)); + return tgt; + } + + private static void copyResource(org.hl7.fhir.dstu3.model.Resource src, org.hl7.fhir.r5.model.Resource tgt) throws FHIRException { + if (src.hasId()) + tgt.setId(src.getId()); + if (src.hasMeta()) + tgt.setMeta(convertMeta(src.getMeta())); + if (src.hasImplicitRules()) + tgt.setImplicitRules(src.getImplicitRules()); + if (src.hasLanguage()) + tgt.setLanguage(src.getLanguage()); + } + private static void copyResource(org.hl7.fhir.r5.model.Resource src, org.hl7.fhir.dstu3.model.Resource tgt) throws FHIRException { + if (src.hasId()) + tgt.setId(src.getId()); + if (src.hasMeta()) + tgt.setMeta(convertMeta(src.getMeta())); + if (src.hasImplicitRules()) + tgt.setImplicitRules(src.getImplicitRules()); + if (src.hasLanguage()) + tgt.setLanguage(src.getLanguage()); + } + + + public static org.hl7.fhir.r5.model.ActivityDefinition convertActivityDefinition(org.hl7.fhir.dstu3.model.ActivityDefinition src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ActivityDefinition tgt = new org.hl7.fhir.r5.model.ActivityDefinition(); + copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasTitle()) + tgt.setTitle(src.getTitle()); + if (src.hasStatus()) + tgt.setStatus(convertPublicationStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + if (src.hasPurpose()) + tgt.setPurpose(src.getPurpose()); + if (src.hasUsage()) + tgt.setUsage(src.getUsage()); + if (src.hasApprovalDate()) + tgt.setApprovalDate(src.getApprovalDate()); + if (src.hasLastReviewDate()) + tgt.setLastReviewDate(src.getLastReviewDate()); + if (src.hasEffectivePeriod()) + tgt.setEffectivePeriod(convertPeriod(src.getEffectivePeriod())); + for (org.hl7.fhir.dstu3.model.UsageContext t : src.getUseContext()) + tgt.addUseContext(convertUsageContext(t)); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction()) + tgt.addJurisdiction(convertCodeableConcept(t)); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getTopic()) + tgt.addTopic(convertCodeableConcept(t)); + for (org.hl7.fhir.dstu3.model.Contributor t : src.getContributor()) { + if (t.getType() == ContributorType.AUTHOR) + for (ContactDetail c : t.getContact()) + tgt.addAuthor(convertContactDetail(c)); + if (t.getType() == ContributorType.EDITOR) + for (ContactDetail c : t.getContact()) + tgt.addEditor(convertContactDetail(c)); + if (t.getType() == ContributorType.REVIEWER) + for (ContactDetail c : t.getContact()) + tgt.addReviewer(convertContactDetail(c)); + if (t.getType() == ContributorType.ENDORSER) + for (ContactDetail c : t.getContact()) + tgt.addEndorser(convertContactDetail(c)); + } + for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) + tgt.addContact(convertContactDetail(t)); + if (src.hasCopyright()) + tgt.setCopyright(src.getCopyright()); + for (org.hl7.fhir.dstu3.model.RelatedArtifact t : src.getRelatedArtifact()) + tgt.addRelatedArtifact(convertRelatedArtifact(t)); + for (org.hl7.fhir.dstu3.model.Reference t : src.getLibrary()) + tgt.getLibrary().add(convertReferenceToCanonical(t)); + if (src.hasKind()) + tgt.setKind(convertActivityDefinitionKind(src.getKind())); + if (src.hasCode()) + tgt.setCode(convertCodeableConcept(src.getCode())); + if (src.hasTiming()) + tgt.setTiming(convertType(src.getTiming())); + if (src.hasLocation()) + tgt.setLocation(convertReference(src.getLocation())); + for (org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityDefinitionParticipantComponent t : src.getParticipant()) + tgt.addParticipant(convertActivityDefinitionParticipantComponent(t)); + if (src.hasProduct()) + tgt.setProduct(convertType(src.getProduct())); + if (src.hasQuantity()) + tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); + for (org.hl7.fhir.dstu3.model.Dosage t : src.getDosage()) + tgt.addDosage(convertDosage(t)); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getBodySite()) + tgt.addBodySite(convertCodeableConcept(t)); + if (src.hasTransform()) + tgt.setTransformElement(convertReferenceToCanonical(src.getTransform())); + for (org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityDefinitionDynamicValueComponent t : src.getDynamicValue()) + tgt.addDynamicValue(convertActivityDefinitionDynamicValueComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ActivityDefinition convertActivityDefinition(org.hl7.fhir.r5.model.ActivityDefinition src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.ActivityDefinition tgt = new org.hl7.fhir.dstu3.model.ActivityDefinition(); + copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasTitle()) + tgt.setTitle(src.getTitle()); + if (src.hasStatus()) + tgt.setStatus(convertPublicationStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + if (src.hasPurpose()) + tgt.setPurpose(src.getPurpose()); + if (src.hasUsage()) + tgt.setUsage(src.getUsage()); + if (src.hasApprovalDate()) + tgt.setApprovalDate(src.getApprovalDate()); + if (src.hasLastReviewDate()) + tgt.setLastReviewDate(src.getLastReviewDate()); + if (src.hasEffectivePeriod()) + tgt.setEffectivePeriod(convertPeriod(src.getEffectivePeriod())); + for (org.hl7.fhir.r5.model.UsageContext t : src.getUseContext()) + tgt.addUseContext(convertUsageContext(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getJurisdiction()) + tgt.addJurisdiction(convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getTopic()) + tgt.addTopic(convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.ContactDetail t : src.getAuthor()) { + org.hl7.fhir.dstu3.model.Contributor c = new org.hl7.fhir.dstu3.model.Contributor(); + c.setType(ContributorType.AUTHOR); + c.addContact(convertContactDetail(t)); + tgt.addContributor(c); + } + for (org.hl7.fhir.r5.model.ContactDetail t : src.getEditor()) { + org.hl7.fhir.dstu3.model.Contributor c = new org.hl7.fhir.dstu3.model.Contributor(); + c.setType(ContributorType.EDITOR); + c.addContact(convertContactDetail(t)); + tgt.addContributor(c); + } + for (org.hl7.fhir.r5.model.ContactDetail t : src.getReviewer()) { + org.hl7.fhir.dstu3.model.Contributor c = new org.hl7.fhir.dstu3.model.Contributor(); + c.setType(ContributorType.REVIEWER); + c.addContact(convertContactDetail(t)); + tgt.addContributor(c); + } + for (org.hl7.fhir.r5.model.ContactDetail t : src.getEndorser()) { + org.hl7.fhir.dstu3.model.Contributor c = new org.hl7.fhir.dstu3.model.Contributor(); + c.setType(ContributorType.ENDORSER); + c.addContact(convertContactDetail(t)); + tgt.addContributor(c); + } + for (org.hl7.fhir.r5.model.ContactDetail t : src.getContact()) + tgt.addContact(convertContactDetail(t)); + if (src.hasCopyright()) + tgt.setCopyright(src.getCopyright()); + for (org.hl7.fhir.r5.model.RelatedArtifact t : src.getRelatedArtifact()) + tgt.addRelatedArtifact(convertRelatedArtifact(t)); + for (org.hl7.fhir.r5.model.CanonicalType t : src.getLibrary()) + tgt.addLibrary(convertCanonicalToReference(t)); + if (src.hasKind()) + tgt.setKind(convertActivityDefinitionKind(src.getKind())); + if (src.hasCode()) + tgt.setCode(convertCodeableConcept(src.getCode())); + if (src.hasTiming()) + tgt.setTiming(convertType(src.getTiming())); + if (src.hasLocation()) + tgt.setLocation(convertReference(src.getLocation())); + for (org.hl7.fhir.r5.model.ActivityDefinition.ActivityDefinitionParticipantComponent t : src.getParticipant()) + tgt.addParticipant(convertActivityDefinitionParticipantComponent(t)); + if (src.hasProduct()) + tgt.setProduct(convertType(src.getProduct())); + if (src.hasQuantity()) + tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); + for (org.hl7.fhir.r5.model.Dosage t : src.getDosage()) + tgt.addDosage(convertDosage(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getBodySite()) + tgt.addBodySite(convertCodeableConcept(t)); + if (src.hasTransform()) + tgt.setTransform(convertCanonicalToReference(src.getTransformElement())); + for (org.hl7.fhir.r5.model.ActivityDefinition.ActivityDefinitionDynamicValueComponent t : src.getDynamicValue()) + tgt.addDynamicValue(convertActivityDefinitionDynamicValueComponent(t)); + return tgt; + } + + private static org.hl7.fhir.r5.model.Enumerations.PublicationStatus convertPublicationStatus(org.hl7.fhir.dstu3.model.Enumerations.PublicationStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case DRAFT: return org.hl7.fhir.r5.model.Enumerations.PublicationStatus.DRAFT; + case ACTIVE: return org.hl7.fhir.r5.model.Enumerations.PublicationStatus.ACTIVE; + case RETIRED: return org.hl7.fhir.r5.model.Enumerations.PublicationStatus.RETIRED; + case UNKNOWN: return org.hl7.fhir.r5.model.Enumerations.PublicationStatus.UNKNOWN; + default: return org.hl7.fhir.r5.model.Enumerations.PublicationStatus.NULL; + } +} + + private static org.hl7.fhir.dstu3.model.Enumerations.PublicationStatus convertPublicationStatus(org.hl7.fhir.r5.model.Enumerations.PublicationStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case DRAFT: return org.hl7.fhir.dstu3.model.Enumerations.PublicationStatus.DRAFT; + case ACTIVE: return org.hl7.fhir.dstu3.model.Enumerations.PublicationStatus.ACTIVE; + case RETIRED: return org.hl7.fhir.dstu3.model.Enumerations.PublicationStatus.RETIRED; + case UNKNOWN: return org.hl7.fhir.dstu3.model.Enumerations.PublicationStatus.UNKNOWN; + default: return org.hl7.fhir.dstu3.model.Enumerations.PublicationStatus.NULL; + } +} + + private static org.hl7.fhir.r5.model.ActivityDefinition.ActivityDefinitionKind convertActivityDefinitionKind(org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityDefinitionKind src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case APPOINTMENT: return org.hl7.fhir.r5.model.ActivityDefinition.ActivityDefinitionKind.APPOINTMENT; + case APPOINTMENTRESPONSE: return org.hl7.fhir.r5.model.ActivityDefinition.ActivityDefinitionKind.APPOINTMENTRESPONSE; + case CAREPLAN: return org.hl7.fhir.r5.model.ActivityDefinition.ActivityDefinitionKind.CAREPLAN; + case CLAIM: return org.hl7.fhir.r5.model.ActivityDefinition.ActivityDefinitionKind.CLAIM; + case COMMUNICATIONREQUEST: return org.hl7.fhir.r5.model.ActivityDefinition.ActivityDefinitionKind.COMMUNICATIONREQUEST; + case CONTRACT: return org.hl7.fhir.r5.model.ActivityDefinition.ActivityDefinitionKind.CONTRACT; + case DEVICEREQUEST: return org.hl7.fhir.r5.model.ActivityDefinition.ActivityDefinitionKind.DEVICEREQUEST; + case ENROLLMENTREQUEST: return org.hl7.fhir.r5.model.ActivityDefinition.ActivityDefinitionKind.ENROLLMENTREQUEST; + case IMMUNIZATIONRECOMMENDATION: return org.hl7.fhir.r5.model.ActivityDefinition.ActivityDefinitionKind.IMMUNIZATIONRECOMMENDATION; + case MEDICATIONREQUEST: return org.hl7.fhir.r5.model.ActivityDefinition.ActivityDefinitionKind.MEDICATIONREQUEST; + case NUTRITIONORDER: return org.hl7.fhir.r5.model.ActivityDefinition.ActivityDefinitionKind.NUTRITIONORDER; + case PROCEDUREREQUEST: return org.hl7.fhir.r5.model.ActivityDefinition.ActivityDefinitionKind.SERVICEREQUEST; + case REFERRALREQUEST: return org.hl7.fhir.r5.model.ActivityDefinition.ActivityDefinitionKind.SERVICEREQUEST; + case SUPPLYREQUEST: return org.hl7.fhir.r5.model.ActivityDefinition.ActivityDefinitionKind.SUPPLYREQUEST; + case TASK: return org.hl7.fhir.r5.model.ActivityDefinition.ActivityDefinitionKind.TASK; + case VISIONPRESCRIPTION: return org.hl7.fhir.r5.model.ActivityDefinition.ActivityDefinitionKind.VISIONPRESCRIPTION; + default: return org.hl7.fhir.r5.model.ActivityDefinition.ActivityDefinitionKind.NULL; + } +} + + private static org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityDefinitionKind convertActivityDefinitionKind(org.hl7.fhir.r5.model.ActivityDefinition.ActivityDefinitionKind src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case APPOINTMENT: return org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityDefinitionKind.APPOINTMENT; + case APPOINTMENTRESPONSE: return org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityDefinitionKind.APPOINTMENTRESPONSE; + case CAREPLAN: return org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityDefinitionKind.CAREPLAN; + case CLAIM: return org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityDefinitionKind.CLAIM; + case COMMUNICATIONREQUEST: return org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityDefinitionKind.COMMUNICATIONREQUEST; + case CONTRACT: return org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityDefinitionKind.CONTRACT; + case DEVICEREQUEST: return org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityDefinitionKind.DEVICEREQUEST; + case ENROLLMENTREQUEST: return org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityDefinitionKind.ENROLLMENTREQUEST; + case IMMUNIZATIONRECOMMENDATION: return org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityDefinitionKind.IMMUNIZATIONRECOMMENDATION; + case MEDICATIONREQUEST: return org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityDefinitionKind.MEDICATIONREQUEST; + case NUTRITIONORDER: return org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityDefinitionKind.NUTRITIONORDER; + case SERVICEREQUEST: return org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityDefinitionKind.PROCEDUREREQUEST; + case SUPPLYREQUEST: return org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityDefinitionKind.SUPPLYREQUEST; + case TASK: return org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityDefinitionKind.TASK; + case VISIONPRESCRIPTION: return org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityDefinitionKind.VISIONPRESCRIPTION; + default: return org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityDefinitionKind.NULL; + } +} + + public static org.hl7.fhir.r5.model.ActivityDefinition.ActivityDefinitionParticipantComponent convertActivityDefinitionParticipantComponent(org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityDefinitionParticipantComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ActivityDefinition.ActivityDefinitionParticipantComponent tgt = new org.hl7.fhir.r5.model.ActivityDefinition.ActivityDefinitionParticipantComponent(); + copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertActivityParticipantType(src.getType())); + if (src.hasRole()) + tgt.setRole(convertCodeableConcept(src.getRole())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityDefinitionParticipantComponent convertActivityDefinitionParticipantComponent(org.hl7.fhir.r5.model.ActivityDefinition.ActivityDefinitionParticipantComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityDefinitionParticipantComponent tgt = new org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityDefinitionParticipantComponent(); + copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertActivityParticipantType(src.getType())); + if (src.hasRole()) + tgt.setRole(convertCodeableConcept(src.getRole())); + return tgt; + } + + private static org.hl7.fhir.r5.model.ActivityDefinition.ActivityParticipantType convertActivityParticipantType(org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityParticipantType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PATIENT: return org.hl7.fhir.r5.model.ActivityDefinition.ActivityParticipantType.PATIENT; + case PRACTITIONER: return org.hl7.fhir.r5.model.ActivityDefinition.ActivityParticipantType.PRACTITIONER; + case RELATEDPERSON: return org.hl7.fhir.r5.model.ActivityDefinition.ActivityParticipantType.RELATEDPERSON; + default: return org.hl7.fhir.r5.model.ActivityDefinition.ActivityParticipantType.NULL; + } +} + + private static org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityParticipantType convertActivityParticipantType(org.hl7.fhir.r5.model.ActivityDefinition.ActivityParticipantType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PATIENT: return org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityParticipantType.PATIENT; + case PRACTITIONER: return org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityParticipantType.PRACTITIONER; + case RELATEDPERSON: return org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityParticipantType.RELATEDPERSON; + default: return org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityParticipantType.NULL; + } +} + + public static org.hl7.fhir.r5.model.ActivityDefinition.ActivityDefinitionDynamicValueComponent convertActivityDefinitionDynamicValueComponent(org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityDefinitionDynamicValueComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ActivityDefinition.ActivityDefinitionDynamicValueComponent tgt = new org.hl7.fhir.r5.model.ActivityDefinition.ActivityDefinitionDynamicValueComponent(); + copyElement(src, tgt); + if (src.hasDescription()) + tgt.getExpression().setDescription(src.getDescription()); + if (src.hasPath()) + tgt.setPath(src.getPath()); + if (src.hasLanguage()) + tgt.getExpression().setLanguage(ExpressionLanguage.fromCode(src.getLanguage())); + if (src.hasExpression()) + tgt.getExpression().setExpression(src.getExpression()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityDefinitionDynamicValueComponent convertActivityDefinitionDynamicValueComponent(org.hl7.fhir.r5.model.ActivityDefinition.ActivityDefinitionDynamicValueComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityDefinitionDynamicValueComponent tgt = new org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityDefinitionDynamicValueComponent(); + copyElement(src, tgt); + if (src.hasPath()) + tgt.setPath(src.getPath()); + if (src.getExpression().hasDescription()) + tgt.setDescription(src.getExpression().getDescription()); + if (src.getExpression().hasLanguage()) + tgt.setLanguage(src.getExpression().getLanguage().toCode()); + if (src.getExpression().hasExpression()) + tgt.setExpression(src.getExpression().getExpression()); + return tgt; + } + + public static org.hl7.fhir.r5.model.AllergyIntolerance convertAllergyIntolerance(org.hl7.fhir.dstu3.model.AllergyIntolerance src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.AllergyIntolerance tgt = new org.hl7.fhir.r5.model.AllergyIntolerance(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasClinicalStatus()) + tgt.setClinicalStatus(convertAllergyIntoleranceClinicalStatus(src.getClinicalStatus())); + if (src.hasVerificationStatus()) + tgt.setVerificationStatus(convertAllergyIntoleranceVerificationStatus(src.getVerificationStatus())); + if (src.hasType()) + tgt.setType(convertAllergyIntoleranceType(src.getType())); + for (org.hl7.fhir.dstu3.model.Enumeration t : src.getCategory()) + tgt.addCategory(convertAllergyIntoleranceCategory(t.getValue())); + if (src.hasCriticality()) + tgt.setCriticality(convertAllergyIntoleranceCriticality(src.getCriticality())); + if (src.hasCode()) + tgt.setCode(convertCodeableConcept(src.getCode())); + if (src.hasPatient()) + tgt.setPatient(convertReference(src.getPatient())); + if (src.hasOnset()) + tgt.setOnset(convertType(src.getOnset())); + if (src.hasAssertedDate()) + tgt.setRecordedDate(src.getAssertedDate()); + if (src.hasRecorder()) + tgt.setRecorder(convertReference(src.getRecorder())); + if (src.hasAsserter()) + tgt.setAsserter(convertReference(src.getAsserter())); + if (src.hasLastOccurrence()) + tgt.setLastOccurrence(src.getLastOccurrence()); + for (org.hl7.fhir.dstu3.model.Annotation t : src.getNote()) + tgt.addNote(convertAnnotation(t)); + for (org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceReactionComponent t : src.getReaction()) + tgt.addReaction(convertAllergyIntoleranceReactionComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.AllergyIntolerance convertAllergyIntolerance(org.hl7.fhir.r5.model.AllergyIntolerance src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.AllergyIntolerance tgt = new org.hl7.fhir.dstu3.model.AllergyIntolerance(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasClinicalStatus()) + tgt.setClinicalStatus(convertAllergyIntoleranceClinicalStatus(src.getClinicalStatus())); + if (src.hasVerificationStatus()) + tgt.setVerificationStatus(convertAllergyIntoleranceVerificationStatus(src.getVerificationStatus())); + if (src.hasType()) + tgt.setType(convertAllergyIntoleranceType(src.getType())); + for (org.hl7.fhir.r5.model.Enumeration t : src.getCategory()) + tgt.addCategory(convertAllergyIntoleranceCategory(t.getValue())); + if (src.hasCriticality()) + tgt.setCriticality(convertAllergyIntoleranceCriticality(src.getCriticality())); + if (src.hasCode()) + tgt.setCode(convertCodeableConcept(src.getCode())); + if (src.hasPatient()) + tgt.setPatient(convertReference(src.getPatient())); + if (src.hasOnset()) + tgt.setOnset(convertType(src.getOnset())); + if (src.hasRecordedDate()) + tgt.setAssertedDate(src.getRecordedDate()); + if (src.hasRecorder()) + tgt.setRecorder(convertReference(src.getRecorder())); + if (src.hasAsserter()) + tgt.setAsserter(convertReference(src.getAsserter())); + if (src.hasLastOccurrence()) + tgt.setLastOccurrence(src.getLastOccurrence()); + for (org.hl7.fhir.r5.model.Annotation t : src.getNote()) + tgt.addNote(convertAnnotation(t)); + for (org.hl7.fhir.r5.model.AllergyIntolerance.AllergyIntoleranceReactionComponent t : src.getReaction()) + tgt.addReaction(convertAllergyIntoleranceReactionComponent(t)); + return tgt; + } + + private static org.hl7.fhir.r5.model.CodeableConcept convertAllergyIntoleranceClinicalStatus(org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceClinicalStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case ACTIVE: return new org.hl7.fhir.r5.model.CodeableConcept(new org.hl7.fhir.r5.model.Coding().setSystem("http://terminology.hl7.org/CodeSystem/allergyintolerance-clinical").setCode("active")); + case INACTIVE: return new org.hl7.fhir.r5.model.CodeableConcept(new org.hl7.fhir.r5.model.Coding().setSystem("http://terminology.hl7.org/CodeSystem/allergyintolerance-clinical").setCode("inactive")); + case RESOLVED: new org.hl7.fhir.r5.model.CodeableConcept(new org.hl7.fhir.r5.model.Coding().setSystem("http://terminology.hl7.org/CodeSystem/allergyintolerance-clinical").setCode("resolved")); + default: return null; + } +} + + private static org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceClinicalStatus convertAllergyIntoleranceClinicalStatus(org.hl7.fhir.r5.model.CodeableConcept src) throws FHIRException { + if (src == null) + return null; + if (src.hasCoding("http://terminology.hl7.org/CodeSystem/allergyintolerance-clinical", "active")) + return org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceClinicalStatus.ACTIVE; + if (src.hasCoding("http://terminology.hl7.org/CodeSystem/allergyintolerance-clinical", "inactive")) + return org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceClinicalStatus.INACTIVE; + if (src.hasCoding("http://terminology.hl7.org/CodeSystem/allergyintolerance-clinical", "resolved")) + return org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceClinicalStatus.RESOLVED; + return org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceClinicalStatus.NULL; + } + + private static org.hl7.fhir.r5.model.CodeableConcept convertAllergyIntoleranceVerificationStatus(org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceVerificationStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case UNCONFIRMED: return new org.hl7.fhir.r5.model.CodeableConcept(new org.hl7.fhir.r5.model.Coding().setSystem("http://terminology.hl7.org/CodeSystem/allergyintolerance-verification").setCode("unconfirmed")); + case CONFIRMED: return new org.hl7.fhir.r5.model.CodeableConcept(new org.hl7.fhir.r5.model.Coding().setSystem("http://terminology.hl7.org/CodeSystem/allergyintolerance-verification").setCode("confirmed")); + case REFUTED: return new org.hl7.fhir.r5.model.CodeableConcept(new org.hl7.fhir.r5.model.Coding().setSystem("http://terminology.hl7.org/CodeSystem/allergyintolerance-verification").setCode("refuted")); + case ENTEREDINERROR: return new org.hl7.fhir.r5.model.CodeableConcept(new org.hl7.fhir.r5.model.Coding().setSystem("http://terminology.hl7.org/CodeSystem/allergyintolerance-verification").setCode("entered-in-error")); + default: return null; + } +} + + private static org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceVerificationStatus convertAllergyIntoleranceVerificationStatus(org.hl7.fhir.r5.model.CodeableConcept src) throws FHIRException { + if (src == null) + return null; + if (src.hasCoding("http://terminology.hl7.org/CodeSystem/allergyintolerance-verification", "unconfirmed")) + return org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceVerificationStatus.UNCONFIRMED; + if (src.hasCoding("http://terminology.hl7.org/CodeSystem/allergyintolerance-verification", "confirmed")) + return org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceVerificationStatus.CONFIRMED; + if (src.hasCoding("http://terminology.hl7.org/CodeSystem/allergyintolerance-verification", "refuted")) + return org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceVerificationStatus.REFUTED; + if (src.hasCoding("http://terminology.hl7.org/CodeSystem/allergyintolerance-verification", "entered-in-error")) + return org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceVerificationStatus.ENTEREDINERROR; + return org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceVerificationStatus.NULL; + } + + private static org.hl7.fhir.r5.model.AllergyIntolerance.AllergyIntoleranceType convertAllergyIntoleranceType(org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case ALLERGY: return org.hl7.fhir.r5.model.AllergyIntolerance.AllergyIntoleranceType.ALLERGY; + case INTOLERANCE: return org.hl7.fhir.r5.model.AllergyIntolerance.AllergyIntoleranceType.INTOLERANCE; + default: return org.hl7.fhir.r5.model.AllergyIntolerance.AllergyIntoleranceType.NULL; + } +} + + private static org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceType convertAllergyIntoleranceType(org.hl7.fhir.r5.model.AllergyIntolerance.AllergyIntoleranceType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case ALLERGY: return org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceType.ALLERGY; + case INTOLERANCE: return org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceType.INTOLERANCE; + default: return org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceType.NULL; + } +} + + private static org.hl7.fhir.r5.model.AllergyIntolerance.AllergyIntoleranceCategory convertAllergyIntoleranceCategory(org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceCategory src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case FOOD: return org.hl7.fhir.r5.model.AllergyIntolerance.AllergyIntoleranceCategory.FOOD; + case MEDICATION: return org.hl7.fhir.r5.model.AllergyIntolerance.AllergyIntoleranceCategory.MEDICATION; + case ENVIRONMENT: return org.hl7.fhir.r5.model.AllergyIntolerance.AllergyIntoleranceCategory.ENVIRONMENT; + case BIOLOGIC: return org.hl7.fhir.r5.model.AllergyIntolerance.AllergyIntoleranceCategory.BIOLOGIC; + default: return org.hl7.fhir.r5.model.AllergyIntolerance.AllergyIntoleranceCategory.NULL; + } +} + + private static org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceCategory convertAllergyIntoleranceCategory(org.hl7.fhir.r5.model.AllergyIntolerance.AllergyIntoleranceCategory src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case FOOD: return org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceCategory.FOOD; + case MEDICATION: return org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceCategory.MEDICATION; + case ENVIRONMENT: return org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceCategory.ENVIRONMENT; + case BIOLOGIC: return org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceCategory.BIOLOGIC; + default: return org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceCategory.NULL; + } +} + + private static org.hl7.fhir.r5.model.AllergyIntolerance.AllergyIntoleranceCriticality convertAllergyIntoleranceCriticality(org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceCriticality src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case LOW: return org.hl7.fhir.r5.model.AllergyIntolerance.AllergyIntoleranceCriticality.LOW; + case HIGH: return org.hl7.fhir.r5.model.AllergyIntolerance.AllergyIntoleranceCriticality.HIGH; + case UNABLETOASSESS: return org.hl7.fhir.r5.model.AllergyIntolerance.AllergyIntoleranceCriticality.UNABLETOASSESS; + default: return org.hl7.fhir.r5.model.AllergyIntolerance.AllergyIntoleranceCriticality.NULL; + } +} + + private static org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceCriticality convertAllergyIntoleranceCriticality(org.hl7.fhir.r5.model.AllergyIntolerance.AllergyIntoleranceCriticality src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case LOW: return org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceCriticality.LOW; + case HIGH: return org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceCriticality.HIGH; + case UNABLETOASSESS: return org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceCriticality.UNABLETOASSESS; + default: return org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceCriticality.NULL; + } +} + + public static org.hl7.fhir.r5.model.AllergyIntolerance.AllergyIntoleranceReactionComponent convertAllergyIntoleranceReactionComponent(org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceReactionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.AllergyIntolerance.AllergyIntoleranceReactionComponent tgt = new org.hl7.fhir.r5.model.AllergyIntolerance.AllergyIntoleranceReactionComponent(); + copyElement(src, tgt); + if (src.hasSubstance()) + tgt.setSubstance(convertCodeableConcept(src.getSubstance())); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getManifestation()) + tgt.addManifestation(convertCodeableConcept(t)); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + if (src.hasOnset()) + tgt.setOnset(src.getOnset()); + if (src.hasSeverity()) + tgt.setSeverity(convertAllergyIntoleranceSeverity(src.getSeverity())); + if (src.hasExposureRoute()) + tgt.setExposureRoute(convertCodeableConcept(src.getExposureRoute())); + for (org.hl7.fhir.dstu3.model.Annotation t : src.getNote()) + tgt.addNote(convertAnnotation(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceReactionComponent convertAllergyIntoleranceReactionComponent(org.hl7.fhir.r5.model.AllergyIntolerance.AllergyIntoleranceReactionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceReactionComponent tgt = new org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceReactionComponent(); + copyElement(src, tgt); + if (src.hasSubstance()) + tgt.setSubstance(convertCodeableConcept(src.getSubstance())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getManifestation()) + tgt.addManifestation(convertCodeableConcept(t)); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + if (src.hasOnset()) + tgt.setOnset(src.getOnset()); + if (src.hasSeverity()) + tgt.setSeverity(convertAllergyIntoleranceSeverity(src.getSeverity())); + if (src.hasExposureRoute()) + tgt.setExposureRoute(convertCodeableConcept(src.getExposureRoute())); + for (org.hl7.fhir.r5.model.Annotation t : src.getNote()) + tgt.addNote(convertAnnotation(t)); + return tgt; + } + + private static org.hl7.fhir.r5.model.AllergyIntolerance.AllergyIntoleranceSeverity convertAllergyIntoleranceSeverity(org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceSeverity src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case MILD: return org.hl7.fhir.r5.model.AllergyIntolerance.AllergyIntoleranceSeverity.MILD; + case MODERATE: return org.hl7.fhir.r5.model.AllergyIntolerance.AllergyIntoleranceSeverity.MODERATE; + case SEVERE: return org.hl7.fhir.r5.model.AllergyIntolerance.AllergyIntoleranceSeverity.SEVERE; + default: return org.hl7.fhir.r5.model.AllergyIntolerance.AllergyIntoleranceSeverity.NULL; + } +} + + private static org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceSeverity convertAllergyIntoleranceSeverity(org.hl7.fhir.r5.model.AllergyIntolerance.AllergyIntoleranceSeverity src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case MILD: return org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceSeverity.MILD; + case MODERATE: return org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceSeverity.MODERATE; + case SEVERE: return org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceSeverity.SEVERE; + default: return org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceSeverity.NULL; + } +} + + public static org.hl7.fhir.r5.model.Appointment convertAppointment(org.hl7.fhir.dstu3.model.Appointment src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Appointment tgt = new org.hl7.fhir.r5.model.Appointment(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasStatus()) + tgt.setStatus(convertAppointmentStatus(src.getStatus())); + if (src.hasServiceCategory()) + tgt.addServiceCategory(convertCodeableConcept(src.getServiceCategory())); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getServiceType()) + tgt.addServiceType(convertCodeableConcept(t)); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getSpecialty()) + tgt.addSpecialty(convertCodeableConcept(t)); + if (src.hasAppointmentType()) + tgt.setAppointmentType(convertCodeableConcept(src.getAppointmentType())); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getReason()) + tgt.addReasonCode(convertCodeableConcept(t)); + for (org.hl7.fhir.dstu3.model.Reference t : src.getIndication()) + tgt.addReasonReference(convertReference(t)); + if (src.hasPriority()) + tgt.setPriority(src.getPriority()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu3.model.Reference t : src.getSupportingInformation()) + tgt.addSupportingInformation(convertReference(t)); + if (src.hasStart()) + tgt.setStart(src.getStart()); + if (src.hasEnd()) + tgt.setEnd(src.getEnd()); + if (src.hasMinutesDuration()) + tgt.setMinutesDuration(src.getMinutesDuration()); + for (org.hl7.fhir.dstu3.model.Reference t : src.getSlot()) + tgt.addSlot(convertReference(t)); + if (src.hasCreated()) + tgt.setCreated(src.getCreated()); + if (src.hasComment()) + tgt.setComment(src.getComment()); + for (org.hl7.fhir.dstu3.model.Reference t : src.getIncomingReferral()) + tgt.addBasedOn(convertReference(t)); + for (org.hl7.fhir.dstu3.model.Appointment.AppointmentParticipantComponent t : src.getParticipant()) + tgt.addParticipant(convertAppointmentParticipantComponent(t)); + for (org.hl7.fhir.dstu3.model.Period t : src.getRequestedPeriod()) + tgt.addRequestedPeriod(convertPeriod(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Appointment convertAppointment(org.hl7.fhir.r5.model.Appointment src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Appointment tgt = new org.hl7.fhir.dstu3.model.Appointment(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasStatus()) + tgt.setStatus(convertAppointmentStatus(src.getStatus())); + if (src.hasServiceCategory()) + tgt.setServiceCategory(convertCodeableConcept(src.getServiceCategoryFirstRep())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getServiceType()) + tgt.addServiceType(convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getSpecialty()) + tgt.addSpecialty(convertCodeableConcept(t)); + if (src.hasAppointmentType()) + tgt.setAppointmentType(convertCodeableConcept(src.getAppointmentType())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getReasonCode()) + tgt.addReason(convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getReasonReference()) + tgt.addIndication(convertReference(t)); + if (src.hasPriority()) + tgt.setPriority(src.getPriority()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.r5.model.Reference t : src.getSupportingInformation()) + tgt.addSupportingInformation(convertReference(t)); + if (src.hasStart()) + tgt.setStart(src.getStart()); + if (src.hasEnd()) + tgt.setEnd(src.getEnd()); + if (src.hasMinutesDuration()) + tgt.setMinutesDuration(src.getMinutesDuration()); + for (org.hl7.fhir.r5.model.Reference t : src.getSlot()) + tgt.addSlot(convertReference(t)); + if (src.hasCreated()) + tgt.setCreated(src.getCreated()); + if (src.hasComment()) + tgt.setComment(src.getComment()); + for (org.hl7.fhir.r5.model.Reference t : src.getBasedOn()) + tgt.addIncomingReferral(convertReference(t)); + for (org.hl7.fhir.r5.model.Appointment.AppointmentParticipantComponent t : src.getParticipant()) + tgt.addParticipant(convertAppointmentParticipantComponent(t)); + for (org.hl7.fhir.r5.model.Period t : src.getRequestedPeriod()) + tgt.addRequestedPeriod(convertPeriod(t)); + return tgt; + } + + private static org.hl7.fhir.r5.model.Appointment.AppointmentStatus convertAppointmentStatus(org.hl7.fhir.dstu3.model.Appointment.AppointmentStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PROPOSED: return org.hl7.fhir.r5.model.Appointment.AppointmentStatus.PROPOSED; + case PENDING: return org.hl7.fhir.r5.model.Appointment.AppointmentStatus.PENDING; + case BOOKED: return org.hl7.fhir.r5.model.Appointment.AppointmentStatus.BOOKED; + case ARRIVED: return org.hl7.fhir.r5.model.Appointment.AppointmentStatus.ARRIVED; + case FULFILLED: return org.hl7.fhir.r5.model.Appointment.AppointmentStatus.FULFILLED; + case CANCELLED: return org.hl7.fhir.r5.model.Appointment.AppointmentStatus.CANCELLED; + case NOSHOW: return org.hl7.fhir.r5.model.Appointment.AppointmentStatus.NOSHOW; + case ENTEREDINERROR: return org.hl7.fhir.r5.model.Appointment.AppointmentStatus.ENTEREDINERROR; + default: return org.hl7.fhir.r5.model.Appointment.AppointmentStatus.NULL; + } +} + + private static org.hl7.fhir.dstu3.model.Appointment.AppointmentStatus convertAppointmentStatus(org.hl7.fhir.r5.model.Appointment.AppointmentStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PROPOSED: return org.hl7.fhir.dstu3.model.Appointment.AppointmentStatus.PROPOSED; + case PENDING: return org.hl7.fhir.dstu3.model.Appointment.AppointmentStatus.PENDING; + case BOOKED: return org.hl7.fhir.dstu3.model.Appointment.AppointmentStatus.BOOKED; + case ARRIVED: return org.hl7.fhir.dstu3.model.Appointment.AppointmentStatus.ARRIVED; + case FULFILLED: return org.hl7.fhir.dstu3.model.Appointment.AppointmentStatus.FULFILLED; + case CANCELLED: return org.hl7.fhir.dstu3.model.Appointment.AppointmentStatus.CANCELLED; + case NOSHOW: return org.hl7.fhir.dstu3.model.Appointment.AppointmentStatus.NOSHOW; + case ENTEREDINERROR: return org.hl7.fhir.dstu3.model.Appointment.AppointmentStatus.ENTEREDINERROR; + default: return org.hl7.fhir.dstu3.model.Appointment.AppointmentStatus.NULL; + } +} + + public static org.hl7.fhir.r5.model.Appointment.AppointmentParticipantComponent convertAppointmentParticipantComponent(org.hl7.fhir.dstu3.model.Appointment.AppointmentParticipantComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Appointment.AppointmentParticipantComponent tgt = new org.hl7.fhir.r5.model.Appointment.AppointmentParticipantComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getType()) + tgt.addType(convertCodeableConcept(t)); + if (src.hasActor()) + tgt.setActor(convertReference(src.getActor())); + if (src.hasRequired()) + tgt.setRequired(convertParticipantRequired(src.getRequired())); + if (src.hasStatus()) + tgt.setStatus(convertParticipationStatus(src.getStatus())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Appointment.AppointmentParticipantComponent convertAppointmentParticipantComponent(org.hl7.fhir.r5.model.Appointment.AppointmentParticipantComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Appointment.AppointmentParticipantComponent tgt = new org.hl7.fhir.dstu3.model.Appointment.AppointmentParticipantComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getType()) + tgt.addType(convertCodeableConcept(t)); + if (src.hasActor()) + tgt.setActor(convertReference(src.getActor())); + if (src.hasRequired()) + tgt.setRequired(convertParticipantRequired(src.getRequired())); + if (src.hasStatus()) + tgt.setStatus(convertParticipationStatus(src.getStatus())); + return tgt; + } + + private static org.hl7.fhir.r5.model.Appointment.ParticipantRequired convertParticipantRequired(org.hl7.fhir.dstu3.model.Appointment.ParticipantRequired src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case REQUIRED: return org.hl7.fhir.r5.model.Appointment.ParticipantRequired.REQUIRED; + case OPTIONAL: return org.hl7.fhir.r5.model.Appointment.ParticipantRequired.OPTIONAL; + case INFORMATIONONLY: return org.hl7.fhir.r5.model.Appointment.ParticipantRequired.INFORMATIONONLY; + default: return org.hl7.fhir.r5.model.Appointment.ParticipantRequired.NULL; + } +} + + private static org.hl7.fhir.dstu3.model.Appointment.ParticipantRequired convertParticipantRequired(org.hl7.fhir.r5.model.Appointment.ParticipantRequired src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case REQUIRED: return org.hl7.fhir.dstu3.model.Appointment.ParticipantRequired.REQUIRED; + case OPTIONAL: return org.hl7.fhir.dstu3.model.Appointment.ParticipantRequired.OPTIONAL; + case INFORMATIONONLY: return org.hl7.fhir.dstu3.model.Appointment.ParticipantRequired.INFORMATIONONLY; + default: return org.hl7.fhir.dstu3.model.Appointment.ParticipantRequired.NULL; + } +} + + private static org.hl7.fhir.r5.model.Appointment.ParticipationStatus convertParticipationStatus(org.hl7.fhir.dstu3.model.Appointment.ParticipationStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case ACCEPTED: return org.hl7.fhir.r5.model.Appointment.ParticipationStatus.ACCEPTED; + case DECLINED: return org.hl7.fhir.r5.model.Appointment.ParticipationStatus.DECLINED; + case TENTATIVE: return org.hl7.fhir.r5.model.Appointment.ParticipationStatus.TENTATIVE; + case NEEDSACTION: return org.hl7.fhir.r5.model.Appointment.ParticipationStatus.NEEDSACTION; + default: return org.hl7.fhir.r5.model.Appointment.ParticipationStatus.NULL; + } +} + + private static org.hl7.fhir.dstu3.model.Appointment.ParticipationStatus convertParticipationStatus(org.hl7.fhir.r5.model.Appointment.ParticipationStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case ACCEPTED: return org.hl7.fhir.dstu3.model.Appointment.ParticipationStatus.ACCEPTED; + case DECLINED: return org.hl7.fhir.dstu3.model.Appointment.ParticipationStatus.DECLINED; + case TENTATIVE: return org.hl7.fhir.dstu3.model.Appointment.ParticipationStatus.TENTATIVE; + case NEEDSACTION: return org.hl7.fhir.dstu3.model.Appointment.ParticipationStatus.NEEDSACTION; + default: return org.hl7.fhir.dstu3.model.Appointment.ParticipationStatus.NULL; + } +} + + public static org.hl7.fhir.r5.model.AppointmentResponse convertAppointmentResponse(org.hl7.fhir.dstu3.model.AppointmentResponse src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.AppointmentResponse tgt = new org.hl7.fhir.r5.model.AppointmentResponse(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasAppointment()) + tgt.setAppointment(convertReference(src.getAppointment())); + if (src.hasStart()) + tgt.setStart(src.getStart()); + if (src.hasEnd()) + tgt.setEnd(src.getEnd()); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getParticipantType()) + tgt.addParticipantType(convertCodeableConcept(t)); + if (src.hasActor()) + tgt.setActor(convertReference(src.getActor())); + if (src.hasParticipantStatus()) + tgt.setParticipantStatus(convertParticipantStatus(src.getParticipantStatus())); + if (src.hasComment()) + tgt.setComment(src.getComment()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.AppointmentResponse convertAppointmentResponse(org.hl7.fhir.r5.model.AppointmentResponse src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.AppointmentResponse tgt = new org.hl7.fhir.dstu3.model.AppointmentResponse(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasAppointment()) + tgt.setAppointment(convertReference(src.getAppointment())); + if (src.hasStart()) + tgt.setStart(src.getStart()); + if (src.hasEnd()) + tgt.setEnd(src.getEnd()); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getParticipantType()) + tgt.addParticipantType(convertCodeableConcept(t)); + if (src.hasActor()) + tgt.setActor(convertReference(src.getActor())); + if (src.hasParticipantStatus()) + tgt.setParticipantStatus(convertParticipantStatus(src.getParticipantStatus())); + if (src.hasComment()) + tgt.setComment(src.getComment()); + return tgt; + } + + private static org.hl7.fhir.r5.model.AppointmentResponse.ParticipantStatus convertParticipantStatus(org.hl7.fhir.dstu3.model.AppointmentResponse.ParticipantStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case ACCEPTED: return org.hl7.fhir.r5.model.AppointmentResponse.ParticipantStatus.ACCEPTED; + case DECLINED: return org.hl7.fhir.r5.model.AppointmentResponse.ParticipantStatus.DECLINED; + case TENTATIVE: return org.hl7.fhir.r5.model.AppointmentResponse.ParticipantStatus.TENTATIVE; + case NEEDSACTION: return org.hl7.fhir.r5.model.AppointmentResponse.ParticipantStatus.NEEDSACTION; + default: return org.hl7.fhir.r5.model.AppointmentResponse.ParticipantStatus.NULL; + } +} + + private static org.hl7.fhir.dstu3.model.AppointmentResponse.ParticipantStatus convertParticipantStatus(org.hl7.fhir.r5.model.AppointmentResponse.ParticipantStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case ACCEPTED: return org.hl7.fhir.dstu3.model.AppointmentResponse.ParticipantStatus.ACCEPTED; + case DECLINED: return org.hl7.fhir.dstu3.model.AppointmentResponse.ParticipantStatus.DECLINED; + case TENTATIVE: return org.hl7.fhir.dstu3.model.AppointmentResponse.ParticipantStatus.TENTATIVE; + case NEEDSACTION: return org.hl7.fhir.dstu3.model.AppointmentResponse.ParticipantStatus.NEEDSACTION; + default: return org.hl7.fhir.dstu3.model.AppointmentResponse.ParticipantStatus.NULL; + } +} + + public static org.hl7.fhir.r5.model.AuditEvent convertAuditEvent(org.hl7.fhir.dstu3.model.AuditEvent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.AuditEvent tgt = new org.hl7.fhir.r5.model.AuditEvent(); + copyDomainResource(src, tgt); + if (src.hasType()) + tgt.setType(convertCoding(src.getType())); + for (org.hl7.fhir.dstu3.model.Coding t : src.getSubtype()) + tgt.addSubtype(convertCoding(t)); + if (src.hasAction()) + tgt.setAction(convertAuditEventAction(src.getAction())); + if (src.hasRecorded()) + tgt.setRecorded(src.getRecorded()); + if (src.hasOutcome()) + tgt.setOutcome(convertAuditEventOutcome(src.getOutcome())); + if (src.hasOutcomeDesc()) + tgt.setOutcomeDesc(src.getOutcomeDesc()); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getPurposeOfEvent()) + tgt.addPurposeOfEvent(convertCodeableConcept(t)); + for (org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAgentComponent t : src.getAgent()) + tgt.addAgent(convertAuditEventAgentComponent(t)); + if (src.hasSource()) + tgt.setSource(convertAuditEventSourceComponent(src.getSource())); + for (org.hl7.fhir.dstu3.model.AuditEvent.AuditEventEntityComponent t : src.getEntity()) + tgt.addEntity(convertAuditEventEntityComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.AuditEvent convertAuditEvent(org.hl7.fhir.r5.model.AuditEvent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.AuditEvent tgt = new org.hl7.fhir.dstu3.model.AuditEvent(); + copyDomainResource(src, tgt); + if (src.hasType()) + tgt.setType(convertCoding(src.getType())); + for (org.hl7.fhir.r5.model.Coding t : src.getSubtype()) + tgt.addSubtype(convertCoding(t)); + if (src.hasAction()) + tgt.setAction(convertAuditEventAction(src.getAction())); + if (src.hasRecorded()) + tgt.setRecorded(src.getRecorded()); + if (src.hasOutcome()) + tgt.setOutcome(convertAuditEventOutcome(src.getOutcome())); + if (src.hasOutcomeDesc()) + tgt.setOutcomeDesc(src.getOutcomeDesc()); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getPurposeOfEvent()) + tgt.addPurposeOfEvent(convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.AuditEvent.AuditEventAgentComponent t : src.getAgent()) + tgt.addAgent(convertAuditEventAgentComponent(t)); + if (src.hasSource()) + tgt.setSource(convertAuditEventSourceComponent(src.getSource())); + for (org.hl7.fhir.r5.model.AuditEvent.AuditEventEntityComponent t : src.getEntity()) + tgt.addEntity(convertAuditEventEntityComponent(t)); + return tgt; + } + + private static org.hl7.fhir.r5.model.AuditEvent.AuditEventAction convertAuditEventAction(org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAction src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case C: return org.hl7.fhir.r5.model.AuditEvent.AuditEventAction.C; + case R: return org.hl7.fhir.r5.model.AuditEvent.AuditEventAction.R; + case U: return org.hl7.fhir.r5.model.AuditEvent.AuditEventAction.U; + case D: return org.hl7.fhir.r5.model.AuditEvent.AuditEventAction.D; + case E: return org.hl7.fhir.r5.model.AuditEvent.AuditEventAction.E; + default: return org.hl7.fhir.r5.model.AuditEvent.AuditEventAction.NULL; + } +} + + private static org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAction convertAuditEventAction(org.hl7.fhir.r5.model.AuditEvent.AuditEventAction src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case C: return org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAction.C; + case R: return org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAction.R; + case U: return org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAction.U; + case D: return org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAction.D; + case E: return org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAction.E; + default: return org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAction.NULL; + } +} + + private static org.hl7.fhir.r5.model.AuditEvent.AuditEventOutcome convertAuditEventOutcome(org.hl7.fhir.dstu3.model.AuditEvent.AuditEventOutcome src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case _0: return org.hl7.fhir.r5.model.AuditEvent.AuditEventOutcome._0; + case _4: return org.hl7.fhir.r5.model.AuditEvent.AuditEventOutcome._4; + case _8: return org.hl7.fhir.r5.model.AuditEvent.AuditEventOutcome._8; + case _12: return org.hl7.fhir.r5.model.AuditEvent.AuditEventOutcome._12; + default: return org.hl7.fhir.r5.model.AuditEvent.AuditEventOutcome.NULL; + } +} + + private static org.hl7.fhir.dstu3.model.AuditEvent.AuditEventOutcome convertAuditEventOutcome(org.hl7.fhir.r5.model.AuditEvent.AuditEventOutcome src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case _0: return org.hl7.fhir.dstu3.model.AuditEvent.AuditEventOutcome._0; + case _4: return org.hl7.fhir.dstu3.model.AuditEvent.AuditEventOutcome._4; + case _8: return org.hl7.fhir.dstu3.model.AuditEvent.AuditEventOutcome._8; + case _12: return org.hl7.fhir.dstu3.model.AuditEvent.AuditEventOutcome._12; + default: return org.hl7.fhir.dstu3.model.AuditEvent.AuditEventOutcome.NULL; + } +} + + public static org.hl7.fhir.r5.model.AuditEvent.AuditEventAgentComponent convertAuditEventAgentComponent(org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAgentComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.AuditEvent.AuditEventAgentComponent tgt = new org.hl7.fhir.r5.model.AuditEvent.AuditEventAgentComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getRole()) + tgt.addRole(convertCodeableConcept(t)); + if (src.hasReference()) + tgt.setWho(convertReference(src.getReference())); + if (src.hasUserId()) + tgt.getWho().setIdentifier(convertIdentifier(src.getUserId())); + if (src.hasAltId()) + tgt.setAltId(src.getAltId()); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasRequestor()) + tgt.setRequestor(src.getRequestor()); + if (src.hasLocation()) + tgt.setLocation(convertReference(src.getLocation())); + for (org.hl7.fhir.dstu3.model.UriType t : src.getPolicy()) + tgt.addPolicy(t.getValue()); + if (src.hasMedia()) + tgt.setMedia(convertCoding(src.getMedia())); + if (src.hasNetwork()) + tgt.setNetwork(convertAuditEventAgentNetworkComponent(src.getNetwork())); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getPurposeOfUse()) + tgt.addPurposeOfUse(convertCodeableConcept(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAgentComponent convertAuditEventAgentComponent(org.hl7.fhir.r5.model.AuditEvent.AuditEventAgentComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAgentComponent tgt = new org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAgentComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getRole()) + tgt.addRole(convertCodeableConcept(t)); + if (src.hasWho()) { + if (src.getWho().hasIdentifier()) + tgt.setUserId(convertIdentifier(src.getWho().getIdentifier())); + if (src.getWho().hasReference() || src.getWho().hasDisplay() || src.getWho().hasExtension() || src.getWho().hasId()) + tgt.setReference(convertReference(src.getWho())); + } + if (src.hasAltId()) + tgt.setAltId(src.getAltId()); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasRequestor()) + tgt.setRequestor(src.getRequestor()); + if (src.hasLocation()) + tgt.setLocation(convertReference(src.getLocation())); + for (org.hl7.fhir.r5.model.UriType t : src.getPolicy()) + tgt.addPolicy(t.getValue()); + if (src.hasMedia()) + tgt.setMedia(convertCoding(src.getMedia())); + if (src.hasNetwork()) + tgt.setNetwork(convertAuditEventAgentNetworkComponent(src.getNetwork())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getPurposeOfUse()) + tgt.addPurposeOfUse(convertCodeableConcept(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.AuditEvent.AuditEventAgentNetworkComponent convertAuditEventAgentNetworkComponent(org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAgentNetworkComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.AuditEvent.AuditEventAgentNetworkComponent tgt = new org.hl7.fhir.r5.model.AuditEvent.AuditEventAgentNetworkComponent(); + copyElement(src, tgt); + if (src.hasAddress()) + tgt.setAddress(src.getAddress()); + if (src.hasType()) + tgt.setType(convertAuditEventAgentNetworkType(src.getType())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAgentNetworkComponent convertAuditEventAgentNetworkComponent(org.hl7.fhir.r5.model.AuditEvent.AuditEventAgentNetworkComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAgentNetworkComponent tgt = new org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAgentNetworkComponent(); + copyElement(src, tgt); + if (src.hasAddress()) + tgt.setAddress(src.getAddress()); + if (src.hasType()) + tgt.setType(convertAuditEventAgentNetworkType(src.getType())); + return tgt; + } + + private static org.hl7.fhir.r5.model.AuditEvent.AuditEventAgentNetworkType convertAuditEventAgentNetworkType(org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAgentNetworkType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case _1: return org.hl7.fhir.r5.model.AuditEvent.AuditEventAgentNetworkType._1; + case _2: return org.hl7.fhir.r5.model.AuditEvent.AuditEventAgentNetworkType._2; + case _3: return org.hl7.fhir.r5.model.AuditEvent.AuditEventAgentNetworkType._3; + case _4: return org.hl7.fhir.r5.model.AuditEvent.AuditEventAgentNetworkType._4; + case _5: return org.hl7.fhir.r5.model.AuditEvent.AuditEventAgentNetworkType._5; + default: return org.hl7.fhir.r5.model.AuditEvent.AuditEventAgentNetworkType.NULL; + } +} + + private static org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAgentNetworkType convertAuditEventAgentNetworkType(org.hl7.fhir.r5.model.AuditEvent.AuditEventAgentNetworkType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case _1: return org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAgentNetworkType._1; + case _2: return org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAgentNetworkType._2; + case _3: return org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAgentNetworkType._3; + case _4: return org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAgentNetworkType._4; + case _5: return org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAgentNetworkType._5; + default: return org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAgentNetworkType.NULL; + } +} + + public static org.hl7.fhir.r5.model.AuditEvent.AuditEventSourceComponent convertAuditEventSourceComponent(org.hl7.fhir.dstu3.model.AuditEvent.AuditEventSourceComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.AuditEvent.AuditEventSourceComponent tgt = new org.hl7.fhir.r5.model.AuditEvent.AuditEventSourceComponent(); + copyElement(src, tgt); + if (src.hasSite()) + tgt.setSite(src.getSite()); + if (src.hasIdentifier()) + tgt.getObserver().setIdentifier(convertIdentifier(src.getIdentifier())); + for (org.hl7.fhir.dstu3.model.Coding t : src.getType()) + tgt.addType(convertCoding(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.AuditEvent.AuditEventSourceComponent convertAuditEventSourceComponent(org.hl7.fhir.r5.model.AuditEvent.AuditEventSourceComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.AuditEvent.AuditEventSourceComponent tgt = new org.hl7.fhir.dstu3.model.AuditEvent.AuditEventSourceComponent(); + copyElement(src, tgt); + if (src.hasSite()) + tgt.setSite(src.getSite()); + if (src.hasObserver()) + tgt.setIdentifier(convertIdentifier(src.getObserver().getIdentifier())); + for (org.hl7.fhir.r5.model.Coding t : src.getType()) + tgt.addType(convertCoding(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.AuditEvent.AuditEventEntityComponent convertAuditEventEntityComponent(org.hl7.fhir.dstu3.model.AuditEvent.AuditEventEntityComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.AuditEvent.AuditEventEntityComponent tgt = new org.hl7.fhir.r5.model.AuditEvent.AuditEventEntityComponent(); + copyElement(src, tgt); + if (src.hasIdentifier()) + tgt.getWhat().setIdentifier(convertIdentifier(src.getIdentifier())); + if (src.hasReference()) + tgt.setWhat(convertReference(src.getReference())); + if (src.hasType()) + tgt.setType(convertCoding(src.getType())); + if (src.hasRole()) + tgt.setRole(convertCoding(src.getRole())); + if (src.hasLifecycle()) + tgt.setLifecycle(convertCoding(src.getLifecycle())); + for (org.hl7.fhir.dstu3.model.Coding t : src.getSecurityLabel()) + tgt.addSecurityLabel(convertCoding(t)); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + if (src.hasQuery()) + tgt.setQuery(src.getQuery()); + for (org.hl7.fhir.dstu3.model.AuditEvent.AuditEventEntityDetailComponent t : src.getDetail()) + tgt.addDetail(convertAuditEventEntityDetailComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.AuditEvent.AuditEventEntityComponent convertAuditEventEntityComponent(org.hl7.fhir.r5.model.AuditEvent.AuditEventEntityComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.AuditEvent.AuditEventEntityComponent tgt = new org.hl7.fhir.dstu3.model.AuditEvent.AuditEventEntityComponent(); + copyElement(src, tgt); + if (src.hasWhat()) { + if (src.getWhat().hasIdentifier()) + tgt.setIdentifier(convertIdentifier(src.getWhat().getIdentifier())); + if (src.getWhat().hasReference() || src.getWhat().hasDisplay() || src.getWhat().hasExtension() || src.getWhat().hasId()) + tgt.setReference(convertReference(src.getWhat())); + } + if (src.hasType()) + tgt.setType(convertCoding(src.getType())); + if (src.hasRole()) + tgt.setRole(convertCoding(src.getRole())); + if (src.hasLifecycle()) + tgt.setLifecycle(convertCoding(src.getLifecycle())); + for (org.hl7.fhir.r5.model.Coding t : src.getSecurityLabel()) + tgt.addSecurityLabel(convertCoding(t)); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + if (src.hasQuery()) + tgt.setQuery(src.getQuery()); + for (org.hl7.fhir.r5.model.AuditEvent.AuditEventEntityDetailComponent t : src.getDetail()) + tgt.addDetail(convertAuditEventEntityDetailComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.AuditEvent.AuditEventEntityDetailComponent convertAuditEventEntityDetailComponent(org.hl7.fhir.dstu3.model.AuditEvent.AuditEventEntityDetailComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.AuditEvent.AuditEventEntityDetailComponent tgt = new org.hl7.fhir.r5.model.AuditEvent.AuditEventEntityDetailComponent(); + copyElement(src, tgt); + if (src.hasType()) + tgt.setType(src.getType()); + if (src.hasValue()) + tgt.setValue(new org.hl7.fhir.r5.model.Base64BinaryType(src.getValue())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.AuditEvent.AuditEventEntityDetailComponent convertAuditEventEntityDetailComponent(org.hl7.fhir.r5.model.AuditEvent.AuditEventEntityDetailComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.AuditEvent.AuditEventEntityDetailComponent tgt = new org.hl7.fhir.dstu3.model.AuditEvent.AuditEventEntityDetailComponent(); + copyElement(src, tgt); + if (src.hasType()) + tgt.setType(src.getType()); + if (src.hasValueStringType()) + tgt.setValue(src.getValueStringType().getValue().getBytes()); + else if (src.hasValueBase64BinaryType()) + tgt.setValue(src.getValueBase64BinaryType().getValue()); + return tgt; + } + + public static org.hl7.fhir.r5.model.Basic convertBasic(org.hl7.fhir.dstu3.model.Basic src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Basic tgt = new org.hl7.fhir.r5.model.Basic(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasCode()) + tgt.setCode(convertCodeableConcept(src.getCode())); + if (src.hasSubject()) + tgt.setSubject(convertReference(src.getSubject())); + if (src.hasCreated()) + tgt.setCreated(src.getCreated()); + if (src.hasAuthor()) + tgt.setAuthor(convertReference(src.getAuthor())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Basic convertBasic(org.hl7.fhir.r5.model.Basic src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Basic tgt = new org.hl7.fhir.dstu3.model.Basic(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasCode()) + tgt.setCode(convertCodeableConcept(src.getCode())); + if (src.hasSubject()) + tgt.setSubject(convertReference(src.getSubject())); + if (src.hasCreated()) + tgt.setCreated(src.getCreated()); + if (src.hasAuthor()) + tgt.setAuthor(convertReference(src.getAuthor())); + return tgt; + } + + public static org.hl7.fhir.r5.model.Binary convertBinary(org.hl7.fhir.dstu3.model.Binary src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Binary tgt = new org.hl7.fhir.r5.model.Binary(); + copyResource(src, tgt); + if (src.hasContentType()) + tgt.setContentType(src.getContentType()); + if (src.hasSecurityContext()) + tgt.setSecurityContext(convertReference(src.getSecurityContext())); + if (src.hasContent()) + tgt.setData(src.getContent()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Binary convertBinary(org.hl7.fhir.r5.model.Binary src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Binary tgt = new org.hl7.fhir.dstu3.model.Binary(); + copyResource(src, tgt); + if (src.hasContentType()) + tgt.setContentType(src.getContentType()); + if (src.hasSecurityContext()) + tgt.setSecurityContext(convertReference(src.getSecurityContext())); + if (src.hasData()) + tgt.setContent(src.getData()); + return tgt; + } + + public static org.hl7.fhir.r5.model.BodyStructure convertBodySite(org.hl7.fhir.dstu3.model.BodySite src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.BodyStructure tgt = new org.hl7.fhir.r5.model.BodyStructure(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasActive()) + tgt.setActive(src.getActive()); +// if (src.hasCode()) +// tgt.setCode(convertCodeableConcept(src.getCode())); +// for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getQualifier()) +// tgt.addQualifier(convertCodeableConcept(t)); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu3.model.Attachment t : src.getImage()) + tgt.addImage(convertAttachment(t)); + if (src.hasPatient()) + tgt.setPatient(convertReference(src.getPatient())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.BodySite convertBodySite(org.hl7.fhir.r5.model.BodyStructure src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.BodySite tgt = new org.hl7.fhir.dstu3.model.BodySite(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasActive()) + tgt.setActive(src.getActive()); +// if (src.hasCode()) +// tgt.setCode(convertCodeableConcept(src.getCode())); +// for (org.hl7.fhir.r5.model.CodeableConcept t : src.getQualifier()) +// tgt.addQualifier(convertCodeableConcept(t)); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.r5.model.Attachment t : src.getImage()) + tgt.addImage(convertAttachment(t)); + if (src.hasPatient()) + tgt.setPatient(convertReference(src.getPatient())); + return tgt; + } + + public static org.hl7.fhir.r5.model.Bundle convertBundle(org.hl7.fhir.dstu3.model.Bundle src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Bundle tgt = new org.hl7.fhir.r5.model.Bundle(); + copyResource(src, tgt); + if (src.hasIdentifier()) + tgt.setIdentifier(convertIdentifier(src.getIdentifier())); + if (src.hasType()) + tgt.setType(convertBundleType(src.getType())); + if (src.hasTotal()) + tgt.setTotal(src.getTotal()); + for (org.hl7.fhir.dstu3.model.Bundle.BundleLinkComponent t : src.getLink()) + tgt.addLink(convertBundleLinkComponent(t)); + for (org.hl7.fhir.dstu3.model.Bundle.BundleEntryComponent t : src.getEntry()) + tgt.addEntry(convertBundleEntryComponent(t)); + if (src.hasSignature()) + tgt.setSignature(convertSignature(src.getSignature())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Bundle convertBundle(org.hl7.fhir.r5.model.Bundle src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Bundle tgt = new org.hl7.fhir.dstu3.model.Bundle(); + copyResource(src, tgt); + if (src.hasIdentifier()) + tgt.setIdentifier(convertIdentifier(src.getIdentifier())); + if (src.hasType()) + tgt.setType(convertBundleType(src.getType())); + if (src.hasTotal()) + tgt.setTotal(src.getTotal()); + for (org.hl7.fhir.r5.model.Bundle.BundleLinkComponent t : src.getLink()) + tgt.addLink(convertBundleLinkComponent(t)); + for (org.hl7.fhir.r5.model.Bundle.BundleEntryComponent t : src.getEntry()) + tgt.addEntry(convertBundleEntryComponent(t)); + if (src.hasSignature()) + tgt.setSignature(convertSignature(src.getSignature())); + return tgt; + } + + private static org.hl7.fhir.r5.model.Bundle.BundleType convertBundleType(org.hl7.fhir.dstu3.model.Bundle.BundleType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case DOCUMENT: return org.hl7.fhir.r5.model.Bundle.BundleType.DOCUMENT; + case MESSAGE: return org.hl7.fhir.r5.model.Bundle.BundleType.MESSAGE; + case TRANSACTION: return org.hl7.fhir.r5.model.Bundle.BundleType.TRANSACTION; + case TRANSACTIONRESPONSE: return org.hl7.fhir.r5.model.Bundle.BundleType.TRANSACTIONRESPONSE; + case BATCH: return org.hl7.fhir.r5.model.Bundle.BundleType.BATCH; + case BATCHRESPONSE: return org.hl7.fhir.r5.model.Bundle.BundleType.BATCHRESPONSE; + case HISTORY: return org.hl7.fhir.r5.model.Bundle.BundleType.HISTORY; + case SEARCHSET: return org.hl7.fhir.r5.model.Bundle.BundleType.SEARCHSET; + case COLLECTION: return org.hl7.fhir.r5.model.Bundle.BundleType.COLLECTION; + default: return org.hl7.fhir.r5.model.Bundle.BundleType.NULL; + } +} + + private static org.hl7.fhir.dstu3.model.Bundle.BundleType convertBundleType(org.hl7.fhir.r5.model.Bundle.BundleType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case DOCUMENT: return org.hl7.fhir.dstu3.model.Bundle.BundleType.DOCUMENT; + case MESSAGE: return org.hl7.fhir.dstu3.model.Bundle.BundleType.MESSAGE; + case TRANSACTION: return org.hl7.fhir.dstu3.model.Bundle.BundleType.TRANSACTION; + case TRANSACTIONRESPONSE: return org.hl7.fhir.dstu3.model.Bundle.BundleType.TRANSACTIONRESPONSE; + case BATCH: return org.hl7.fhir.dstu3.model.Bundle.BundleType.BATCH; + case BATCHRESPONSE: return org.hl7.fhir.dstu3.model.Bundle.BundleType.BATCHRESPONSE; + case HISTORY: return org.hl7.fhir.dstu3.model.Bundle.BundleType.HISTORY; + case SEARCHSET: return org.hl7.fhir.dstu3.model.Bundle.BundleType.SEARCHSET; + case COLLECTION: return org.hl7.fhir.dstu3.model.Bundle.BundleType.COLLECTION; + default: return org.hl7.fhir.dstu3.model.Bundle.BundleType.NULL; + } +} + + public static org.hl7.fhir.r5.model.Bundle.BundleLinkComponent convertBundleLinkComponent(org.hl7.fhir.dstu3.model.Bundle.BundleLinkComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Bundle.BundleLinkComponent tgt = new org.hl7.fhir.r5.model.Bundle.BundleLinkComponent(); + copyElement(src, tgt); + if (src.hasRelation()) + tgt.setRelation(src.getRelation()); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Bundle.BundleLinkComponent convertBundleLinkComponent(org.hl7.fhir.r5.model.Bundle.BundleLinkComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Bundle.BundleLinkComponent tgt = new org.hl7.fhir.dstu3.model.Bundle.BundleLinkComponent(); + copyElement(src, tgt); + if (src.hasRelation()) + tgt.setRelation(src.getRelation()); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + return tgt; + } + + public static org.hl7.fhir.r5.model.Bundle.BundleEntryComponent convertBundleEntryComponent(org.hl7.fhir.dstu3.model.Bundle.BundleEntryComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Bundle.BundleEntryComponent tgt = new org.hl7.fhir.r5.model.Bundle.BundleEntryComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.dstu3.model.Bundle.BundleLinkComponent t : src.getLink()) + tgt.addLink(convertBundleLinkComponent(t)); + if (src.hasFullUrl()) + tgt.setFullUrl(src.getFullUrl()); + if (src.hasResource()) + tgt.setResource(convertResource(src.getResource(), false)); + if (src.hasSearch()) + tgt.setSearch(convertBundleEntrySearchComponent(src.getSearch())); + if (src.hasRequest()) + tgt.setRequest(convertBundleEntryRequestComponent(src.getRequest())); + if (src.hasResponse()) + tgt.setResponse(convertBundleEntryResponseComponent(src.getResponse())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Bundle.BundleEntryComponent convertBundleEntryComponent(org.hl7.fhir.r5.model.Bundle.BundleEntryComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Bundle.BundleEntryComponent tgt = new org.hl7.fhir.dstu3.model.Bundle.BundleEntryComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.r5.model.Bundle.BundleLinkComponent t : src.getLink()) + tgt.addLink(convertBundleLinkComponent(t)); + if (src.hasFullUrl()) + tgt.setFullUrl(src.getFullUrl()); + if (src.hasResource()) + tgt.setResource(convertResource(src.getResource(), false)); + if (src.hasSearch()) + tgt.setSearch(convertBundleEntrySearchComponent(src.getSearch())); + if (src.hasRequest()) + tgt.setRequest(convertBundleEntryRequestComponent(src.getRequest())); + if (src.hasResponse()) + tgt.setResponse(convertBundleEntryResponseComponent(src.getResponse())); + return tgt; + } + + public static org.hl7.fhir.r5.model.Bundle.BundleEntrySearchComponent convertBundleEntrySearchComponent(org.hl7.fhir.dstu3.model.Bundle.BundleEntrySearchComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Bundle.BundleEntrySearchComponent tgt = new org.hl7.fhir.r5.model.Bundle.BundleEntrySearchComponent(); + copyElement(src, tgt); + if (src.hasMode()) + tgt.setMode(convertSearchEntryMode(src.getMode())); + if (src.hasScore()) + tgt.setScore(src.getScore()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Bundle.BundleEntrySearchComponent convertBundleEntrySearchComponent(org.hl7.fhir.r5.model.Bundle.BundleEntrySearchComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Bundle.BundleEntrySearchComponent tgt = new org.hl7.fhir.dstu3.model.Bundle.BundleEntrySearchComponent(); + copyElement(src, tgt); + if (src.hasMode()) + tgt.setMode(convertSearchEntryMode(src.getMode())); + if (src.hasScore()) + tgt.setScore(src.getScore()); + return tgt; + } + + private static org.hl7.fhir.r5.model.Bundle.SearchEntryMode convertSearchEntryMode(org.hl7.fhir.dstu3.model.Bundle.SearchEntryMode src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case MATCH: return org.hl7.fhir.r5.model.Bundle.SearchEntryMode.MATCH; + case INCLUDE: return org.hl7.fhir.r5.model.Bundle.SearchEntryMode.INCLUDE; + case OUTCOME: return org.hl7.fhir.r5.model.Bundle.SearchEntryMode.OUTCOME; + default: return org.hl7.fhir.r5.model.Bundle.SearchEntryMode.NULL; + } +} + + private static org.hl7.fhir.dstu3.model.Bundle.SearchEntryMode convertSearchEntryMode(org.hl7.fhir.r5.model.Bundle.SearchEntryMode src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case MATCH: return org.hl7.fhir.dstu3.model.Bundle.SearchEntryMode.MATCH; + case INCLUDE: return org.hl7.fhir.dstu3.model.Bundle.SearchEntryMode.INCLUDE; + case OUTCOME: return org.hl7.fhir.dstu3.model.Bundle.SearchEntryMode.OUTCOME; + default: return org.hl7.fhir.dstu3.model.Bundle.SearchEntryMode.NULL; + } +} + + public static org.hl7.fhir.r5.model.Bundle.BundleEntryRequestComponent convertBundleEntryRequestComponent(org.hl7.fhir.dstu3.model.Bundle.BundleEntryRequestComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Bundle.BundleEntryRequestComponent tgt = new org.hl7.fhir.r5.model.Bundle.BundleEntryRequestComponent(); + copyElement(src, tgt); + if (src.hasMethod()) + tgt.setMethod(convertHTTPVerb(src.getMethod())); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + if (src.hasIfNoneMatch()) + tgt.setIfNoneMatch(src.getIfNoneMatch()); + if (src.hasIfModifiedSince()) + tgt.setIfModifiedSince(src.getIfModifiedSince()); + if (src.hasIfMatch()) + tgt.setIfMatch(src.getIfMatch()); + if (src.hasIfNoneExist()) + tgt.setIfNoneExist(src.getIfNoneExist()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Bundle.BundleEntryRequestComponent convertBundleEntryRequestComponent(org.hl7.fhir.r5.model.Bundle.BundleEntryRequestComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Bundle.BundleEntryRequestComponent tgt = new org.hl7.fhir.dstu3.model.Bundle.BundleEntryRequestComponent(); + copyElement(src, tgt); + if (src.hasMethod()) + tgt.setMethod(convertHTTPVerb(src.getMethod())); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + if (src.hasIfNoneMatch()) + tgt.setIfNoneMatch(src.getIfNoneMatch()); + if (src.hasIfModifiedSince()) + tgt.setIfModifiedSince(src.getIfModifiedSince()); + if (src.hasIfMatch()) + tgt.setIfMatch(src.getIfMatch()); + if (src.hasIfNoneExist()) + tgt.setIfNoneExist(src.getIfNoneExist()); + return tgt; + } + + private static org.hl7.fhir.r5.model.Bundle.HTTPVerb convertHTTPVerb(org.hl7.fhir.dstu3.model.Bundle.HTTPVerb src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case GET: return org.hl7.fhir.r5.model.Bundle.HTTPVerb.GET; + case POST: return org.hl7.fhir.r5.model.Bundle.HTTPVerb.POST; + case PUT: return org.hl7.fhir.r5.model.Bundle.HTTPVerb.PUT; + case DELETE: return org.hl7.fhir.r5.model.Bundle.HTTPVerb.DELETE; + default: return org.hl7.fhir.r5.model.Bundle.HTTPVerb.NULL; + } +} + + private static org.hl7.fhir.dstu3.model.Bundle.HTTPVerb convertHTTPVerb(org.hl7.fhir.r5.model.Bundle.HTTPVerb src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case GET: return org.hl7.fhir.dstu3.model.Bundle.HTTPVerb.GET; + case POST: return org.hl7.fhir.dstu3.model.Bundle.HTTPVerb.POST; + case PUT: return org.hl7.fhir.dstu3.model.Bundle.HTTPVerb.PUT; + case DELETE: return org.hl7.fhir.dstu3.model.Bundle.HTTPVerb.DELETE; + default: return org.hl7.fhir.dstu3.model.Bundle.HTTPVerb.NULL; + } +} + + public static org.hl7.fhir.r5.model.Bundle.BundleEntryResponseComponent convertBundleEntryResponseComponent(org.hl7.fhir.dstu3.model.Bundle.BundleEntryResponseComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Bundle.BundleEntryResponseComponent tgt = new org.hl7.fhir.r5.model.Bundle.BundleEntryResponseComponent(); + copyElement(src, tgt); + if (src.hasStatus()) + tgt.setStatus(src.getStatus()); + if (src.hasLocation()) + tgt.setLocation(src.getLocation()); + if (src.hasEtag()) + tgt.setEtag(src.getEtag()); + if (src.hasLastModified()) + tgt.setLastModified(src.getLastModified()); + if (src.hasOutcome()) + tgt.setOutcome(convertResource(src.getOutcome(), false)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Bundle.BundleEntryResponseComponent convertBundleEntryResponseComponent(org.hl7.fhir.r5.model.Bundle.BundleEntryResponseComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Bundle.BundleEntryResponseComponent tgt = new org.hl7.fhir.dstu3.model.Bundle.BundleEntryResponseComponent(); + copyElement(src, tgt); + if (src.hasStatus()) + tgt.setStatus(src.getStatus()); + if (src.hasLocation()) + tgt.setLocation(src.getLocation()); + if (src.hasEtag()) + tgt.setEtag(src.getEtag()); + if (src.hasLastModified()) + tgt.setLastModified(src.getLastModified()); + if (src.hasOutcome()) + tgt.setOutcome(convertResource(src.getOutcome(), false)); + return tgt; + } + + public static org.hl7.fhir.r5.model.CapabilityStatement convertCapabilityStatement(org.hl7.fhir.dstu3.model.CapabilityStatement src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.CapabilityStatement tgt = new org.hl7.fhir.r5.model.CapabilityStatement(); + copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasTitle()) + tgt.setTitle(src.getTitle()); + if (src.hasStatus()) + tgt.setStatus(convertPublicationStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) + tgt.addContact(convertContactDetail(t)); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu3.model.UsageContext t : src.getUseContext()) + tgt.addUseContext(convertUsageContext(t)); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction()) + tgt.addJurisdiction(convertCodeableConcept(t)); + if (src.hasPurpose()) + tgt.setPurpose(src.getPurpose()); + if (src.hasCopyright()) + tgt.setCopyright(src.getCopyright()); + if (src.hasKind()) + tgt.setKind(convertCapabilityStatementKind(src.getKind())); + for (org.hl7.fhir.dstu3.model.UriType t : src.getInstantiates()) + tgt.addInstantiates(t.getValue()); + if (src.hasSoftware()) + tgt.setSoftware(convertCapabilityStatementSoftwareComponent(src.getSoftware())); + if (src.hasImplementation()) + tgt.setImplementation(convertCapabilityStatementImplementationComponent(src.getImplementation())); + if (src.hasFhirVersion()) + tgt.setFhirVersion(org.hl7.fhir.r5.model.Enumerations.FHIRVersion.fromCode(src.getFhirVersion())); +// if (src.hasAcceptUnknown()) +// tgt.setAcceptUnknown(convertUnknownContentCode(src.getAcceptUnknown())); + for (org.hl7.fhir.dstu3.model.CodeType t : src.getFormat()) + tgt.addFormat(t.getValue()); + for (org.hl7.fhir.dstu3.model.CodeType t : src.getPatchFormat()) + tgt.addPatchFormat(t.getValue()); + for (org.hl7.fhir.dstu3.model.UriType t : src.getImplementationGuide()) + tgt.addImplementationGuide(t.getValue()); +// for (org.hl7.fhir.dstu3.model.Reference t : src.getProfile()) +// +// tgt.addProfile(convertReference(t)); + for (org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestComponent t : src.getRest()) + tgt.addRest(convertCapabilityStatementRestComponent(t)); + for (org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingComponent t : src.getMessaging()) + tgt.addMessaging(convertCapabilityStatementMessagingComponent(t)); + for (org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementDocumentComponent t : src.getDocument()) + tgt.addDocument(convertCapabilityStatementDocumentComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.CapabilityStatement convertCapabilityStatement(org.hl7.fhir.r5.model.CapabilityStatement src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.CapabilityStatement tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement(); + copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasTitle()) + tgt.setTitle(src.getTitle()); + if (src.hasStatus()) + tgt.setStatus(convertPublicationStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.r5.model.ContactDetail t : src.getContact()) + tgt.addContact(convertContactDetail(t)); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.r5.model.UsageContext t : src.getUseContext()) + tgt.addUseContext(convertUsageContext(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getJurisdiction()) + tgt.addJurisdiction(convertCodeableConcept(t)); + if (src.hasPurpose()) + tgt.setPurpose(src.getPurpose()); + if (src.hasCopyright()) + tgt.setCopyright(src.getCopyright()); + if (src.hasKind()) + tgt.setKind(convertCapabilityStatementKind(src.getKind())); + for (org.hl7.fhir.r5.model.UriType t : src.getInstantiates()) + tgt.addInstantiates(t.getValue()); + if (src.hasSoftware()) + tgt.setSoftware(convertCapabilityStatementSoftwareComponent(src.getSoftware())); + if (src.hasImplementation()) + tgt.setImplementation(convertCapabilityStatementImplementationComponent(src.getImplementation())); + if (src.hasFhirVersion()) + tgt.setFhirVersion(src.getFhirVersion().toCode()); +// if (src.hasAcceptUnknown()) +// tgt.setAcceptUnknown(convertUnknownContentCode(src.getAcceptUnknown())); + for (org.hl7.fhir.r5.model.CodeType t : src.getFormat()) + tgt.addFormat(t.getValue()); + for (org.hl7.fhir.r5.model.CodeType t : src.getPatchFormat()) + tgt.addPatchFormat(t.getValue()); + for (org.hl7.fhir.r5.model.UriType t : src.getImplementationGuide()) + tgt.addImplementationGuide(t.getValue()); + for (org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestComponent r : src.getRest()) + for (org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceComponent rr : r.getResource()) + for (org.hl7.fhir.r5.model.CanonicalType t : rr.getSupportedProfile()) + tgt.addProfile(convertCanonicalToReference(t)); + for (org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestComponent t : src.getRest()) + tgt.addRest(convertCapabilityStatementRestComponent(t)); + for (org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementMessagingComponent t : src.getMessaging()) + tgt.addMessaging(convertCapabilityStatementMessagingComponent(t)); + for (org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementDocumentComponent t : src.getDocument()) + tgt.addDocument(convertCapabilityStatementDocumentComponent(t)); + return tgt; + } + + private static org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementKind convertCapabilityStatementKind(org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementKind src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case INSTANCE: return org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementKind.INSTANCE; + case CAPABILITY: return org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementKind.CAPABILITY; + case REQUIREMENTS: return org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementKind.REQUIREMENTS; + default: return org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementKind.NULL; + } +} + + private static org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementKind convertCapabilityStatementKind(org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementKind src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case INSTANCE: return org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementKind.INSTANCE; + case CAPABILITY: return org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementKind.CAPABILITY; + case REQUIREMENTS: return org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementKind.REQUIREMENTS; + default: return org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementKind.NULL; + } +} + +// private static org.hl7.fhir.r5.model.CapabilityStatement.UnknownContentCode convertUnknownContentCode(org.hl7.fhir.dstu3.model.CapabilityStatement.UnknownContentCode src) throws FHIRException { +// if (src == null) +// return null; +// switch (src) { +// case NO: return org.hl7.fhir.r5.model.CapabilityStatement.UnknownContentCode.NO; +// case EXTENSIONS: return org.hl7.fhir.r5.model.CapabilityStatement.UnknownContentCode.EXTENSIONS; +// case ELEMENTS: return org.hl7.fhir.r5.model.CapabilityStatement.UnknownContentCode.ELEMENTS; +// case BOTH: return org.hl7.fhir.r5.model.CapabilityStatement.UnknownContentCode.BOTH; +// default: return org.hl7.fhir.r5.model.CapabilityStatement.UnknownContentCode.NULL; +// } +//} +// +// private static org.hl7.fhir.dstu3.model.CapabilityStatement.UnknownContentCode convertUnknownContentCode(org.hl7.fhir.r5.model.CapabilityStatement.UnknownContentCode src) throws FHIRException { +// if (src == null) +// return null; +// switch (src) { +// case NO: return org.hl7.fhir.dstu3.model.CapabilityStatement.UnknownContentCode.NO; +// case EXTENSIONS: return org.hl7.fhir.dstu3.model.CapabilityStatement.UnknownContentCode.EXTENSIONS; +// case ELEMENTS: return org.hl7.fhir.dstu3.model.CapabilityStatement.UnknownContentCode.ELEMENTS; +// case BOTH: return org.hl7.fhir.dstu3.model.CapabilityStatement.UnknownContentCode.BOTH; +// default: return org.hl7.fhir.dstu3.model.CapabilityStatement.UnknownContentCode.NULL; +// } +//} + + public static org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementSoftwareComponent convertCapabilityStatementSoftwareComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementSoftwareComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementSoftwareComponent tgt = new org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementSoftwareComponent(); + copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasReleaseDate()) + tgt.setReleaseDate(src.getReleaseDate()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementSoftwareComponent convertCapabilityStatementSoftwareComponent(org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementSoftwareComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementSoftwareComponent tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementSoftwareComponent(); + copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasReleaseDate()) + tgt.setReleaseDate(src.getReleaseDate()); + return tgt; + } + + public static org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementImplementationComponent convertCapabilityStatementImplementationComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementImplementationComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementImplementationComponent tgt = new org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementImplementationComponent(); + copyElement(src, tgt); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementImplementationComponent convertCapabilityStatementImplementationComponent(org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementImplementationComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementImplementationComponent tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementImplementationComponent(); + copyElement(src, tgt); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + return tgt; + } + + public static org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestComponent convertCapabilityStatementRestComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestComponent tgt = new org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestComponent(); + copyElement(src, tgt); + if (src.hasMode()) + tgt.setMode(convertRestfulCapabilityMode(src.getMode())); + if (src.hasDocumentation()) + tgt.setDocumentation(src.getDocumentation()); + if (src.hasSecurity()) + tgt.setSecurity(convertCapabilityStatementRestSecurityComponent(src.getSecurity())); + for (org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestResourceComponent t : src.getResource()) + tgt.addResource(convertCapabilityStatementRestResourceComponent(t)); + for (org.hl7.fhir.dstu3.model.CapabilityStatement.SystemInteractionComponent t : src.getInteraction()) + tgt.addInteraction(convertSystemInteractionComponent(t)); + for (org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent t : src.getSearchParam()) + tgt.addSearchParam(convertCapabilityStatementRestResourceSearchParamComponent(t)); + for (org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestOperationComponent t : src.getOperation()) + tgt.addOperation(convertCapabilityStatementRestOperationComponent(t)); + for (org.hl7.fhir.dstu3.model.UriType t : src.getCompartment()) + tgt.addCompartment(t.getValue()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestComponent convertCapabilityStatementRestComponent(org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestComponent tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestComponent(); + copyElement(src, tgt); + if (src.hasMode()) + tgt.setMode(convertRestfulCapabilityMode(src.getMode())); + if (src.hasDocumentation()) + tgt.setDocumentation(src.getDocumentation()); + if (src.hasSecurity()) + tgt.setSecurity(convertCapabilityStatementRestSecurityComponent(src.getSecurity())); + for (org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceComponent t : src.getResource()) + tgt.addResource(convertCapabilityStatementRestResourceComponent(t)); + for (org.hl7.fhir.r5.model.CapabilityStatement.SystemInteractionComponent t : src.getInteraction()) + tgt.addInteraction(convertSystemInteractionComponent(t)); + for (org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent t : src.getSearchParam()) + tgt.addSearchParam(convertCapabilityStatementRestResourceSearchParamComponent(t)); + for (org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceOperationComponent t : src.getOperation()) + tgt.addOperation(convertCapabilityStatementRestOperationComponent(t)); + for (org.hl7.fhir.r5.model.UriType t : src.getCompartment()) + tgt.addCompartment(t.getValue()); + return tgt; + } + + private static org.hl7.fhir.r5.model.CapabilityStatement.RestfulCapabilityMode convertRestfulCapabilityMode(org.hl7.fhir.dstu3.model.CapabilityStatement.RestfulCapabilityMode src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case CLIENT: return org.hl7.fhir.r5.model.CapabilityStatement.RestfulCapabilityMode.CLIENT; + case SERVER: return org.hl7.fhir.r5.model.CapabilityStatement.RestfulCapabilityMode.SERVER; + default: return org.hl7.fhir.r5.model.CapabilityStatement.RestfulCapabilityMode.NULL; + } +} + + private static org.hl7.fhir.dstu3.model.CapabilityStatement.RestfulCapabilityMode convertRestfulCapabilityMode(org.hl7.fhir.r5.model.CapabilityStatement.RestfulCapabilityMode src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case CLIENT: return org.hl7.fhir.dstu3.model.CapabilityStatement.RestfulCapabilityMode.CLIENT; + case SERVER: return org.hl7.fhir.dstu3.model.CapabilityStatement.RestfulCapabilityMode.SERVER; + default: return org.hl7.fhir.dstu3.model.CapabilityStatement.RestfulCapabilityMode.NULL; + } +} + + public static org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestSecurityComponent convertCapabilityStatementRestSecurityComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestSecurityComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestSecurityComponent tgt = new org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestSecurityComponent(); + copyElement(src, tgt); + if (src.hasCors()) + tgt.setCors(src.getCors()); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getService()) + tgt.addService(convertCodeableConcept(t)); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestSecurityComponent convertCapabilityStatementRestSecurityComponent(org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestSecurityComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestSecurityComponent tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestSecurityComponent(); + copyElement(src, tgt); + if (src.hasCors()) + tgt.setCors(src.getCors()); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getService()) + tgt.addService(convertCodeableConcept(t)); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + return tgt; + } + + public static org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceComponent convertCapabilityStatementRestResourceComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestResourceComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceComponent tgt = new org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceComponent(); + copyElement(src, tgt); + if (src.hasType()) + tgt.setType(src.getType()); + if (src.hasProfile()) + tgt.setProfileElement(convertReferenceToCanonical(src.getProfile())); + if (src.hasDocumentation()) + tgt.setDocumentation(src.getDocumentation()); + for (org.hl7.fhir.dstu3.model.CapabilityStatement.ResourceInteractionComponent t : src.getInteraction()) + tgt.addInteraction(convertResourceInteractionComponent(t)); + if (src.hasVersioning()) + tgt.setVersioning(convertResourceVersionPolicy(src.getVersioning())); + if (src.hasReadHistory()) + tgt.setReadHistory(src.getReadHistory()); + if (src.hasUpdateCreate()) + tgt.setUpdateCreate(src.getUpdateCreate()); + if (src.hasConditionalCreate()) + tgt.setConditionalCreate(src.getConditionalCreate()); + if (src.hasConditionalRead()) + tgt.setConditionalRead(convertConditionalReadStatus(src.getConditionalRead())); + if (src.hasConditionalUpdate()) + tgt.setConditionalUpdate(src.getConditionalUpdate()); + if (src.hasConditionalDelete()) + tgt.setConditionalDelete(convertConditionalDeleteStatus(src.getConditionalDelete())); + for (org.hl7.fhir.dstu3.model.Enumeration t : src.getReferencePolicy()) + tgt.addReferencePolicy(convertReferenceHandlingPolicy(t.getValue())); + for (org.hl7.fhir.dstu3.model.StringType t : src.getSearchInclude()) + tgt.addSearchInclude(t.getValue()); + for (org.hl7.fhir.dstu3.model.StringType t : src.getSearchRevInclude()) + tgt.addSearchRevInclude(t.getValue()); + for (org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent t : src.getSearchParam()) + tgt.addSearchParam(convertCapabilityStatementRestResourceSearchParamComponent(t)); + return tgt; + } + + private static org.hl7.fhir.r5.model.CanonicalType convertReferenceToCanonical(org.hl7.fhir.dstu3.model.Reference src) throws FHIRException { + org.hl7.fhir.r5.model.CanonicalType dst = new org.hl7.fhir.r5.model.CanonicalType(src.getReference()); + copyElement(src, dst); + return dst; + } + + private static org.hl7.fhir.dstu3.model.Reference convertCanonicalToReference(org.hl7.fhir.r5.model.CanonicalType src) throws FHIRException { + org.hl7.fhir.dstu3.model.Reference dst = new org.hl7.fhir.dstu3.model.Reference(src.getValue()); + copyElement(src, dst); + return dst; + } + + public static org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestResourceComponent convertCapabilityStatementRestResourceComponent(org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestResourceComponent tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestResourceComponent(); + copyElement(src, tgt); + if (src.hasType()) + tgt.setType(src.getType()); + if (src.hasProfile()) + tgt.setProfile(convertCanonicalToReference(src.getProfileElement())); + if (src.hasDocumentation()) + tgt.setDocumentation(src.getDocumentation()); + for (org.hl7.fhir.r5.model.CapabilityStatement.ResourceInteractionComponent t : src.getInteraction()) + tgt.addInteraction(convertResourceInteractionComponent(t)); + if (src.hasVersioning()) + tgt.setVersioning(convertResourceVersionPolicy(src.getVersioning())); + if (src.hasReadHistory()) + tgt.setReadHistory(src.getReadHistory()); + if (src.hasUpdateCreate()) + tgt.setUpdateCreate(src.getUpdateCreate()); + if (src.hasConditionalCreate()) + tgt.setConditionalCreate(src.getConditionalCreate()); + if (src.hasConditionalRead()) + tgt.setConditionalRead(convertConditionalReadStatus(src.getConditionalRead())); + if (src.hasConditionalUpdate()) + tgt.setConditionalUpdate(src.getConditionalUpdate()); + if (src.hasConditionalDelete()) + tgt.setConditionalDelete(convertConditionalDeleteStatus(src.getConditionalDelete())); + for (org.hl7.fhir.r5.model.Enumeration t : src.getReferencePolicy()) + tgt.addReferencePolicy(convertReferenceHandlingPolicy(t.getValue())); + for (org.hl7.fhir.r5.model.StringType t : src.getSearchInclude()) + tgt.addSearchInclude(t.getValue()); + for (org.hl7.fhir.r5.model.StringType t : src.getSearchRevInclude()) + tgt.addSearchRevInclude(t.getValue()); + for (org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent t : src.getSearchParam()) + tgt.addSearchParam(convertCapabilityStatementRestResourceSearchParamComponent(t)); + return tgt; + } + + private static org.hl7.fhir.r5.model.CapabilityStatement.ResourceVersionPolicy convertResourceVersionPolicy(org.hl7.fhir.dstu3.model.CapabilityStatement.ResourceVersionPolicy src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case NOVERSION: return org.hl7.fhir.r5.model.CapabilityStatement.ResourceVersionPolicy.NOVERSION; + case VERSIONED: return org.hl7.fhir.r5.model.CapabilityStatement.ResourceVersionPolicy.VERSIONED; + case VERSIONEDUPDATE: return org.hl7.fhir.r5.model.CapabilityStatement.ResourceVersionPolicy.VERSIONEDUPDATE; + default: return org.hl7.fhir.r5.model.CapabilityStatement.ResourceVersionPolicy.NULL; + } +} + + private static org.hl7.fhir.dstu3.model.CapabilityStatement.ResourceVersionPolicy convertResourceVersionPolicy(org.hl7.fhir.r5.model.CapabilityStatement.ResourceVersionPolicy src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case NOVERSION: return org.hl7.fhir.dstu3.model.CapabilityStatement.ResourceVersionPolicy.NOVERSION; + case VERSIONED: return org.hl7.fhir.dstu3.model.CapabilityStatement.ResourceVersionPolicy.VERSIONED; + case VERSIONEDUPDATE: return org.hl7.fhir.dstu3.model.CapabilityStatement.ResourceVersionPolicy.VERSIONEDUPDATE; + default: return org.hl7.fhir.dstu3.model.CapabilityStatement.ResourceVersionPolicy.NULL; + } +} + + private static org.hl7.fhir.r5.model.CapabilityStatement.ConditionalReadStatus convertConditionalReadStatus(org.hl7.fhir.dstu3.model.CapabilityStatement.ConditionalReadStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case NOTSUPPORTED: return org.hl7.fhir.r5.model.CapabilityStatement.ConditionalReadStatus.NOTSUPPORTED; + case MODIFIEDSINCE: return org.hl7.fhir.r5.model.CapabilityStatement.ConditionalReadStatus.MODIFIEDSINCE; + case NOTMATCH: return org.hl7.fhir.r5.model.CapabilityStatement.ConditionalReadStatus.NOTMATCH; + case FULLSUPPORT: return org.hl7.fhir.r5.model.CapabilityStatement.ConditionalReadStatus.FULLSUPPORT; + default: return org.hl7.fhir.r5.model.CapabilityStatement.ConditionalReadStatus.NULL; + } +} + + private static org.hl7.fhir.dstu3.model.CapabilityStatement.ConditionalReadStatus convertConditionalReadStatus(org.hl7.fhir.r5.model.CapabilityStatement.ConditionalReadStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case NOTSUPPORTED: return org.hl7.fhir.dstu3.model.CapabilityStatement.ConditionalReadStatus.NOTSUPPORTED; + case MODIFIEDSINCE: return org.hl7.fhir.dstu3.model.CapabilityStatement.ConditionalReadStatus.MODIFIEDSINCE; + case NOTMATCH: return org.hl7.fhir.dstu3.model.CapabilityStatement.ConditionalReadStatus.NOTMATCH; + case FULLSUPPORT: return org.hl7.fhir.dstu3.model.CapabilityStatement.ConditionalReadStatus.FULLSUPPORT; + default: return org.hl7.fhir.dstu3.model.CapabilityStatement.ConditionalReadStatus.NULL; + } +} + + private static org.hl7.fhir.r5.model.CapabilityStatement.ConditionalDeleteStatus convertConditionalDeleteStatus(org.hl7.fhir.dstu3.model.CapabilityStatement.ConditionalDeleteStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case NOTSUPPORTED: return org.hl7.fhir.r5.model.CapabilityStatement.ConditionalDeleteStatus.NOTSUPPORTED; + case SINGLE: return org.hl7.fhir.r5.model.CapabilityStatement.ConditionalDeleteStatus.SINGLE; + case MULTIPLE: return org.hl7.fhir.r5.model.CapabilityStatement.ConditionalDeleteStatus.MULTIPLE; + default: return org.hl7.fhir.r5.model.CapabilityStatement.ConditionalDeleteStatus.NULL; + } +} + + private static org.hl7.fhir.dstu3.model.CapabilityStatement.ConditionalDeleteStatus convertConditionalDeleteStatus(org.hl7.fhir.r5.model.CapabilityStatement.ConditionalDeleteStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case NOTSUPPORTED: return org.hl7.fhir.dstu3.model.CapabilityStatement.ConditionalDeleteStatus.NOTSUPPORTED; + case SINGLE: return org.hl7.fhir.dstu3.model.CapabilityStatement.ConditionalDeleteStatus.SINGLE; + case MULTIPLE: return org.hl7.fhir.dstu3.model.CapabilityStatement.ConditionalDeleteStatus.MULTIPLE; + default: return org.hl7.fhir.dstu3.model.CapabilityStatement.ConditionalDeleteStatus.NULL; + } +} + + private static org.hl7.fhir.r5.model.CapabilityStatement.ReferenceHandlingPolicy convertReferenceHandlingPolicy(org.hl7.fhir.dstu3.model.CapabilityStatement.ReferenceHandlingPolicy src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case LITERAL: return org.hl7.fhir.r5.model.CapabilityStatement.ReferenceHandlingPolicy.LITERAL; + case LOGICAL: return org.hl7.fhir.r5.model.CapabilityStatement.ReferenceHandlingPolicy.LOGICAL; + case RESOLVES: return org.hl7.fhir.r5.model.CapabilityStatement.ReferenceHandlingPolicy.RESOLVES; + case ENFORCED: return org.hl7.fhir.r5.model.CapabilityStatement.ReferenceHandlingPolicy.ENFORCED; + case LOCAL: return org.hl7.fhir.r5.model.CapabilityStatement.ReferenceHandlingPolicy.LOCAL; + default: return org.hl7.fhir.r5.model.CapabilityStatement.ReferenceHandlingPolicy.NULL; + } +} + + private static org.hl7.fhir.dstu3.model.CapabilityStatement.ReferenceHandlingPolicy convertReferenceHandlingPolicy(org.hl7.fhir.r5.model.CapabilityStatement.ReferenceHandlingPolicy src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case LITERAL: return org.hl7.fhir.dstu3.model.CapabilityStatement.ReferenceHandlingPolicy.LITERAL; + case LOGICAL: return org.hl7.fhir.dstu3.model.CapabilityStatement.ReferenceHandlingPolicy.LOGICAL; + case RESOLVES: return org.hl7.fhir.dstu3.model.CapabilityStatement.ReferenceHandlingPolicy.RESOLVES; + case ENFORCED: return org.hl7.fhir.dstu3.model.CapabilityStatement.ReferenceHandlingPolicy.ENFORCED; + case LOCAL: return org.hl7.fhir.dstu3.model.CapabilityStatement.ReferenceHandlingPolicy.LOCAL; + default: return org.hl7.fhir.dstu3.model.CapabilityStatement.ReferenceHandlingPolicy.NULL; + } +} + + public static org.hl7.fhir.r5.model.CapabilityStatement.ResourceInteractionComponent convertResourceInteractionComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.ResourceInteractionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.CapabilityStatement.ResourceInteractionComponent tgt = new org.hl7.fhir.r5.model.CapabilityStatement.ResourceInteractionComponent(); + copyElement(src, tgt); + if (src.hasCode()) + tgt.setCode(convertTypeRestfulInteraction(src.getCode())); + if (src.hasDocumentation()) + tgt.setDocumentation(src.getDocumentation()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.CapabilityStatement.ResourceInteractionComponent convertResourceInteractionComponent(org.hl7.fhir.r5.model.CapabilityStatement.ResourceInteractionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.CapabilityStatement.ResourceInteractionComponent tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement.ResourceInteractionComponent(); + copyElement(src, tgt); + if (src.hasCode()) + tgt.setCode(convertTypeRestfulInteraction(src.getCode())); + if (src.hasDocumentation()) + tgt.setDocumentation(src.getDocumentation()); + return tgt; + } + + private static org.hl7.fhir.r5.model.CapabilityStatement.TypeRestfulInteraction convertTypeRestfulInteraction(org.hl7.fhir.dstu3.model.CapabilityStatement.TypeRestfulInteraction src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case READ: return org.hl7.fhir.r5.model.CapabilityStatement.TypeRestfulInteraction.READ; + case VREAD: return org.hl7.fhir.r5.model.CapabilityStatement.TypeRestfulInteraction.VREAD; + case UPDATE: return org.hl7.fhir.r5.model.CapabilityStatement.TypeRestfulInteraction.UPDATE; + case PATCH: return org.hl7.fhir.r5.model.CapabilityStatement.TypeRestfulInteraction.PATCH; + case DELETE: return org.hl7.fhir.r5.model.CapabilityStatement.TypeRestfulInteraction.DELETE; + case HISTORYINSTANCE: return org.hl7.fhir.r5.model.CapabilityStatement.TypeRestfulInteraction.HISTORYINSTANCE; + case HISTORYTYPE: return org.hl7.fhir.r5.model.CapabilityStatement.TypeRestfulInteraction.HISTORYTYPE; + case CREATE: return org.hl7.fhir.r5.model.CapabilityStatement.TypeRestfulInteraction.CREATE; + case SEARCHTYPE: return org.hl7.fhir.r5.model.CapabilityStatement.TypeRestfulInteraction.SEARCHTYPE; + default: return org.hl7.fhir.r5.model.CapabilityStatement.TypeRestfulInteraction.NULL; + } +} + + private static org.hl7.fhir.dstu3.model.CapabilityStatement.TypeRestfulInteraction convertTypeRestfulInteraction(org.hl7.fhir.r5.model.CapabilityStatement.TypeRestfulInteraction src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case READ: return org.hl7.fhir.dstu3.model.CapabilityStatement.TypeRestfulInteraction.READ; + case VREAD: return org.hl7.fhir.dstu3.model.CapabilityStatement.TypeRestfulInteraction.VREAD; + case UPDATE: return org.hl7.fhir.dstu3.model.CapabilityStatement.TypeRestfulInteraction.UPDATE; + case PATCH: return org.hl7.fhir.dstu3.model.CapabilityStatement.TypeRestfulInteraction.PATCH; + case DELETE: return org.hl7.fhir.dstu3.model.CapabilityStatement.TypeRestfulInteraction.DELETE; + case HISTORYINSTANCE: return org.hl7.fhir.dstu3.model.CapabilityStatement.TypeRestfulInteraction.HISTORYINSTANCE; + case HISTORYTYPE: return org.hl7.fhir.dstu3.model.CapabilityStatement.TypeRestfulInteraction.HISTORYTYPE; + case CREATE: return org.hl7.fhir.dstu3.model.CapabilityStatement.TypeRestfulInteraction.CREATE; + case SEARCHTYPE: return org.hl7.fhir.dstu3.model.CapabilityStatement.TypeRestfulInteraction.SEARCHTYPE; + default: return org.hl7.fhir.dstu3.model.CapabilityStatement.TypeRestfulInteraction.NULL; + } +} + + public static org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent convertCapabilityStatementRestResourceSearchParamComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent tgt = new org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent(); + copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasDefinition()) + tgt.setDefinition(src.getDefinition()); + if (src.hasType()) + tgt.setType(convertSearchParamType(src.getType())); + if (src.hasDocumentation()) + tgt.setDocumentation(src.getDocumentation()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent convertCapabilityStatementRestResourceSearchParamComponent(org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent(); + copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasDefinition()) + tgt.setDefinition(src.getDefinition()); + if (src.hasType()) + tgt.setType(convertSearchParamType(src.getType())); + if (src.hasDocumentation()) + tgt.setDocumentation(src.getDocumentation()); + return tgt; + } + + private static org.hl7.fhir.r5.model.Enumerations.SearchParamType convertSearchParamType(org.hl7.fhir.dstu3.model.Enumerations.SearchParamType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case NUMBER: return org.hl7.fhir.r5.model.Enumerations.SearchParamType.NUMBER; + case DATE: return org.hl7.fhir.r5.model.Enumerations.SearchParamType.DATE; + case STRING: return org.hl7.fhir.r5.model.Enumerations.SearchParamType.STRING; + case TOKEN: return org.hl7.fhir.r5.model.Enumerations.SearchParamType.TOKEN; + case REFERENCE: return org.hl7.fhir.r5.model.Enumerations.SearchParamType.REFERENCE; + case COMPOSITE: return org.hl7.fhir.r5.model.Enumerations.SearchParamType.COMPOSITE; + case QUANTITY: return org.hl7.fhir.r5.model.Enumerations.SearchParamType.QUANTITY; + case URI: return org.hl7.fhir.r5.model.Enumerations.SearchParamType.URI; + default: return org.hl7.fhir.r5.model.Enumerations.SearchParamType.NULL; + } +} + + private static org.hl7.fhir.dstu3.model.Enumerations.SearchParamType convertSearchParamType(org.hl7.fhir.r5.model.Enumerations.SearchParamType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case NUMBER: return org.hl7.fhir.dstu3.model.Enumerations.SearchParamType.NUMBER; + case DATE: return org.hl7.fhir.dstu3.model.Enumerations.SearchParamType.DATE; + case STRING: return org.hl7.fhir.dstu3.model.Enumerations.SearchParamType.STRING; + case TOKEN: return org.hl7.fhir.dstu3.model.Enumerations.SearchParamType.TOKEN; + case REFERENCE: return org.hl7.fhir.dstu3.model.Enumerations.SearchParamType.REFERENCE; + case COMPOSITE: return org.hl7.fhir.dstu3.model.Enumerations.SearchParamType.COMPOSITE; + case QUANTITY: return org.hl7.fhir.dstu3.model.Enumerations.SearchParamType.QUANTITY; + case URI: return org.hl7.fhir.dstu3.model.Enumerations.SearchParamType.URI; + default: return org.hl7.fhir.dstu3.model.Enumerations.SearchParamType.NULL; + } +} + + public static org.hl7.fhir.r5.model.CapabilityStatement.SystemInteractionComponent convertSystemInteractionComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.SystemInteractionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.CapabilityStatement.SystemInteractionComponent tgt = new org.hl7.fhir.r5.model.CapabilityStatement.SystemInteractionComponent(); + copyElement(src, tgt); + if (src.hasCode()) + tgt.setCode(convertSystemRestfulInteraction(src.getCode())); + if (src.hasDocumentation()) + tgt.setDocumentation(src.getDocumentation()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.CapabilityStatement.SystemInteractionComponent convertSystemInteractionComponent(org.hl7.fhir.r5.model.CapabilityStatement.SystemInteractionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.CapabilityStatement.SystemInteractionComponent tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement.SystemInteractionComponent(); + copyElement(src, tgt); + if (src.hasCode()) + tgt.setCode(convertSystemRestfulInteraction(src.getCode())); + if (src.hasDocumentation()) + tgt.setDocumentation(src.getDocumentation()); + return tgt; + } + + private static org.hl7.fhir.r5.model.CapabilityStatement.SystemRestfulInteraction convertSystemRestfulInteraction(org.hl7.fhir.dstu3.model.CapabilityStatement.SystemRestfulInteraction src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case TRANSACTION: return org.hl7.fhir.r5.model.CapabilityStatement.SystemRestfulInteraction.TRANSACTION; + case BATCH: return org.hl7.fhir.r5.model.CapabilityStatement.SystemRestfulInteraction.BATCH; + case SEARCHSYSTEM: return org.hl7.fhir.r5.model.CapabilityStatement.SystemRestfulInteraction.SEARCHSYSTEM; + case HISTORYSYSTEM: return org.hl7.fhir.r5.model.CapabilityStatement.SystemRestfulInteraction.HISTORYSYSTEM; + default: return org.hl7.fhir.r5.model.CapabilityStatement.SystemRestfulInteraction.NULL; + } +} + + private static org.hl7.fhir.dstu3.model.CapabilityStatement.SystemRestfulInteraction convertSystemRestfulInteraction(org.hl7.fhir.r5.model.CapabilityStatement.SystemRestfulInteraction src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case TRANSACTION: return org.hl7.fhir.dstu3.model.CapabilityStatement.SystemRestfulInteraction.TRANSACTION; + case BATCH: return org.hl7.fhir.dstu3.model.CapabilityStatement.SystemRestfulInteraction.BATCH; + case SEARCHSYSTEM: return org.hl7.fhir.dstu3.model.CapabilityStatement.SystemRestfulInteraction.SEARCHSYSTEM; + case HISTORYSYSTEM: return org.hl7.fhir.dstu3.model.CapabilityStatement.SystemRestfulInteraction.HISTORYSYSTEM; + default: return org.hl7.fhir.dstu3.model.CapabilityStatement.SystemRestfulInteraction.NULL; + } +} + + public static org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceOperationComponent convertCapabilityStatementRestOperationComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestOperationComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceOperationComponent tgt = new org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceOperationComponent(); + copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasDefinition()) + tgt.setDefinitionElement(convertReferenceToCanonical(src.getDefinition())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestOperationComponent convertCapabilityStatementRestOperationComponent(org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceOperationComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestOperationComponent tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestOperationComponent(); + copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasDefinition()) + tgt.setDefinition(convertCanonicalToReference(src.getDefinitionElement())); + return tgt; + } + + public static org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementMessagingComponent convertCapabilityStatementMessagingComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementMessagingComponent tgt = new org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementMessagingComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingEndpointComponent t : src.getEndpoint()) + tgt.addEndpoint(convertCapabilityStatementMessagingEndpointComponent(t)); + if (src.hasReliableCache()) + tgt.setReliableCache(src.getReliableCache()); + if (src.hasDocumentation()) + tgt.setDocumentation(src.getDocumentation()); + for (org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent t : src.getSupportedMessage()) + tgt.addSupportedMessage(convertCapabilityStatementMessagingSupportedMessageComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingComponent convertCapabilityStatementMessagingComponent(org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementMessagingComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingComponent tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementMessagingEndpointComponent t : src.getEndpoint()) + tgt.addEndpoint(convertCapabilityStatementMessagingEndpointComponent(t)); + if (src.hasReliableCache()) + tgt.setReliableCache(src.getReliableCache()); + if (src.hasDocumentation()) + tgt.setDocumentation(src.getDocumentation()); + for (org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent t : src.getSupportedMessage()) + tgt.addSupportedMessage(convertCapabilityStatementMessagingSupportedMessageComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementMessagingEndpointComponent convertCapabilityStatementMessagingEndpointComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingEndpointComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementMessagingEndpointComponent tgt = new org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementMessagingEndpointComponent(); + copyElement(src, tgt); + if (src.hasProtocol()) + tgt.setProtocol(convertCoding(src.getProtocol())); + if (src.hasAddress()) + tgt.setAddress(src.getAddress()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingEndpointComponent convertCapabilityStatementMessagingEndpointComponent(org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementMessagingEndpointComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingEndpointComponent tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingEndpointComponent(); + copyElement(src, tgt); + if (src.hasProtocol()) + tgt.setProtocol(convertCoding(src.getProtocol())); + if (src.hasAddress()) + tgt.setAddress(src.getAddress()); + return tgt; + } + + public static org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent convertCapabilityStatementMessagingSupportedMessageComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent tgt = new org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent(); + copyElement(src, tgt); + if (src.hasMode()) + tgt.setMode(convertEventCapabilityMode(src.getMode())); + if (src.hasDefinition()) + tgt.setDefinitionElement(convertReferenceToCanonical(src.getDefinition())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent convertCapabilityStatementMessagingSupportedMessageComponent(org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent(); + copyElement(src, tgt); + if (src.hasMode()) + tgt.setMode(convertEventCapabilityMode(src.getMode())); + if (src.hasDefinition()) + tgt.setDefinition(convertCanonicalToReference(src.getDefinitionElement())); + return tgt; + } + + private static org.hl7.fhir.r5.model.CapabilityStatement.EventCapabilityMode convertEventCapabilityMode(org.hl7.fhir.dstu3.model.CapabilityStatement.EventCapabilityMode src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case SENDER: return org.hl7.fhir.r5.model.CapabilityStatement.EventCapabilityMode.SENDER; + case RECEIVER: return org.hl7.fhir.r5.model.CapabilityStatement.EventCapabilityMode.RECEIVER; + default: return org.hl7.fhir.r5.model.CapabilityStatement.EventCapabilityMode.NULL; + } +} + + private static org.hl7.fhir.dstu3.model.CapabilityStatement.EventCapabilityMode convertEventCapabilityMode(org.hl7.fhir.r5.model.CapabilityStatement.EventCapabilityMode src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case SENDER: return org.hl7.fhir.dstu3.model.CapabilityStatement.EventCapabilityMode.SENDER; + case RECEIVER: return org.hl7.fhir.dstu3.model.CapabilityStatement.EventCapabilityMode.RECEIVER; + default: return org.hl7.fhir.dstu3.model.CapabilityStatement.EventCapabilityMode.NULL; + } +} + + + public static org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementDocumentComponent convertCapabilityStatementDocumentComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementDocumentComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementDocumentComponent tgt = new org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementDocumentComponent(); + copyElement(src, tgt); + if (src.hasMode()) + tgt.setMode(convertDocumentMode(src.getMode())); + if (src.hasDocumentation()) + tgt.setDocumentation(src.getDocumentation()); + if (src.hasProfile()) + tgt.setProfileElement(convertReferenceToCanonical(src.getProfile())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementDocumentComponent convertCapabilityStatementDocumentComponent(org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementDocumentComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementDocumentComponent tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementDocumentComponent(); + copyElement(src, tgt); + if (src.hasMode()) + tgt.setMode(convertDocumentMode(src.getMode())); + if (src.hasDocumentation()) + tgt.setDocumentation(src.getDocumentation()); + if (src.hasProfile()) + tgt.setProfile(convertCanonicalToReference(src.getProfileElement())); + return tgt; + } + + private static org.hl7.fhir.r5.model.CapabilityStatement.DocumentMode convertDocumentMode(org.hl7.fhir.dstu3.model.CapabilityStatement.DocumentMode src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PRODUCER: return org.hl7.fhir.r5.model.CapabilityStatement.DocumentMode.PRODUCER; + case CONSUMER: return org.hl7.fhir.r5.model.CapabilityStatement.DocumentMode.CONSUMER; + default: return org.hl7.fhir.r5.model.CapabilityStatement.DocumentMode.NULL; + } +} + + private static org.hl7.fhir.dstu3.model.CapabilityStatement.DocumentMode convertDocumentMode(org.hl7.fhir.r5.model.CapabilityStatement.DocumentMode src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PRODUCER: return org.hl7.fhir.dstu3.model.CapabilityStatement.DocumentMode.PRODUCER; + case CONSUMER: return org.hl7.fhir.dstu3.model.CapabilityStatement.DocumentMode.CONSUMER; + default: return org.hl7.fhir.dstu3.model.CapabilityStatement.DocumentMode.NULL; + } +} + + + public static org.hl7.fhir.r5.model.CareTeam convertCareTeam(org.hl7.fhir.dstu3.model.CareTeam src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.CareTeam tgt = new org.hl7.fhir.r5.model.CareTeam(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasStatus()) + tgt.setStatus(convertCareTeamStatus(src.getStatus())); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getCategory()) + tgt.addCategory(convertCodeableConcept(t)); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasSubject()) + tgt.setSubject(convertReference(src.getSubject())); + if (src.hasContext()) + tgt.setEncounter(convertReference(src.getContext())); + if (src.hasPeriod()) + tgt.setPeriod(convertPeriod(src.getPeriod())); + for (org.hl7.fhir.dstu3.model.CareTeam.CareTeamParticipantComponent t : src.getParticipant()) + tgt.addParticipant(convertCareTeamParticipantComponent(t)); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getReasonCode()) + tgt.addReasonCode(convertCodeableConcept(t)); + for (org.hl7.fhir.dstu3.model.Reference t : src.getReasonReference()) + tgt.addReasonReference(convertReference(t)); + for (org.hl7.fhir.dstu3.model.Reference t : src.getManagingOrganization()) + tgt.addManagingOrganization(convertReference(t)); + for (org.hl7.fhir.dstu3.model.Annotation t : src.getNote()) + tgt.addNote(convertAnnotation(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.CareTeam convertCareTeam(org.hl7.fhir.r5.model.CareTeam src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.CareTeam tgt = new org.hl7.fhir.dstu3.model.CareTeam(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasStatus()) + tgt.setStatus(convertCareTeamStatus(src.getStatus())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getCategory()) + tgt.addCategory(convertCodeableConcept(t)); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasSubject()) + tgt.setSubject(convertReference(src.getSubject())); + if (src.hasEncounter()) + tgt.setContext(convertReference(src.getEncounter())); + if (src.hasPeriod()) + tgt.setPeriod(convertPeriod(src.getPeriod())); + for (org.hl7.fhir.r5.model.CareTeam.CareTeamParticipantComponent t : src.getParticipant()) + tgt.addParticipant(convertCareTeamParticipantComponent(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getReasonCode()) + tgt.addReasonCode(convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getReasonReference()) + tgt.addReasonReference(convertReference(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getManagingOrganization()) + tgt.addManagingOrganization(convertReference(t)); + for (org.hl7.fhir.r5.model.Annotation t : src.getNote()) + tgt.addNote(convertAnnotation(t)); + return tgt; + } + + private static org.hl7.fhir.r5.model.CareTeam.CareTeamStatus convertCareTeamStatus(org.hl7.fhir.dstu3.model.CareTeam.CareTeamStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PROPOSED: return org.hl7.fhir.r5.model.CareTeam.CareTeamStatus.PROPOSED; + case ACTIVE: return org.hl7.fhir.r5.model.CareTeam.CareTeamStatus.ACTIVE; + case SUSPENDED: return org.hl7.fhir.r5.model.CareTeam.CareTeamStatus.SUSPENDED; + case INACTIVE: return org.hl7.fhir.r5.model.CareTeam.CareTeamStatus.INACTIVE; + case ENTEREDINERROR: return org.hl7.fhir.r5.model.CareTeam.CareTeamStatus.ENTEREDINERROR; + default: return org.hl7.fhir.r5.model.CareTeam.CareTeamStatus.NULL; + } +} + + private static org.hl7.fhir.dstu3.model.CareTeam.CareTeamStatus convertCareTeamStatus(org.hl7.fhir.r5.model.CareTeam.CareTeamStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PROPOSED: return org.hl7.fhir.dstu3.model.CareTeam.CareTeamStatus.PROPOSED; + case ACTIVE: return org.hl7.fhir.dstu3.model.CareTeam.CareTeamStatus.ACTIVE; + case SUSPENDED: return org.hl7.fhir.dstu3.model.CareTeam.CareTeamStatus.SUSPENDED; + case INACTIVE: return org.hl7.fhir.dstu3.model.CareTeam.CareTeamStatus.INACTIVE; + case ENTEREDINERROR: return org.hl7.fhir.dstu3.model.CareTeam.CareTeamStatus.ENTEREDINERROR; + default: return org.hl7.fhir.dstu3.model.CareTeam.CareTeamStatus.NULL; + } +} + + public static org.hl7.fhir.r5.model.CareTeam.CareTeamParticipantComponent convertCareTeamParticipantComponent(org.hl7.fhir.dstu3.model.CareTeam.CareTeamParticipantComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.CareTeam.CareTeamParticipantComponent tgt = new org.hl7.fhir.r5.model.CareTeam.CareTeamParticipantComponent(); + copyElement(src, tgt); + if (src.hasRole()) + tgt.addRole(convertCodeableConcept(src.getRole())); + if (src.hasMember()) + tgt.setMember(convertReference(src.getMember())); + if (src.hasOnBehalfOf()) + tgt.setOnBehalfOf(convertReference(src.getOnBehalfOf())); + if (src.hasPeriod()) + tgt.setPeriod(convertPeriod(src.getPeriod())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.CareTeam.CareTeamParticipantComponent convertCareTeamParticipantComponent(org.hl7.fhir.r5.model.CareTeam.CareTeamParticipantComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.CareTeam.CareTeamParticipantComponent tgt = new org.hl7.fhir.dstu3.model.CareTeam.CareTeamParticipantComponent(); + copyElement(src, tgt); + if (src.hasRole()) + tgt.setRole(convertCodeableConcept(src.getRoleFirstRep())); + if (src.hasMember()) + tgt.setMember(convertReference(src.getMember())); + if (src.hasOnBehalfOf()) + tgt.setOnBehalfOf(convertReference(src.getOnBehalfOf())); + if (src.hasPeriod()) + tgt.setPeriod(convertPeriod(src.getPeriod())); + return tgt; + } + +// public static org.hl7.fhir.r5.model.Claim convertClaim(org.hl7.fhir.dstu3.model.Claim src) throws FHIRException { +// if (src == null) +// return null; +// org.hl7.fhir.r5.model.Claim tgt = new org.hl7.fhir.r5.model.Claim(); +// copyDomainResource(src, tgt); +// for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) +// tgt.addIdentifier(convertIdentifier(t)); +// if (src.hasStatus()) +// tgt.setStatus(convertClaimStatus(src.getStatus())); +// if (src.hasType()) +// tgt.setType(convertCodeableConcept(src.getType())); +// for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getSubType()) +// tgt.addSubType(convertCodeableConcept(t)); +// if (src.hasUse()) +// tgt.setUse(convertUse(src.getUse())); +// if (src.hasPatient()) +// tgt.setPatient(convertReference(src.getPatient())); +// if (src.hasBillablePeriod()) +// tgt.setBillablePeriod(convertPeriod(src.getBillablePeriod())); +// if (src.hasCreated()) +// tgt.setCreated(src.getCreated()); +// if (src.hasEnterer()) +// tgt.setEnterer(convertReference(src.getEnterer())); +// if (src.hasInsurer()) +// tgt.setInsurer(convertReference(src.getInsurer())); +// if (src.hasProvider()) +// tgt.setProvider(convertReference(src.getProvider())); +//// if (src.hasOrganization()) +//// tgt.addOrganization(convertReference(src.getOrganization())); +// if (src.hasPriority()) +// tgt.setPriority(convertCodeableConcept(src.getPriority())); +// if (src.hasFundsReserve()) +// tgt.setFundsReserve(convertCodeableConcept(src.getFundsReserve())); +// for (org.hl7.fhir.dstu3.model.Claim.RelatedClaimComponent t : src.getRelated()) +// tgt.addRelated(convertRelatedClaimComponent(t)); +// if (src.hasPrescription()) +// tgt.setPrescription(convertReference(src.getPrescription())); +// if (src.hasOriginalPrescription()) +// tgt.setOriginalPrescription(convertReference(src.getOriginalPrescription())); +// if (src.hasPayee()) +// tgt.setPayee(convertPayeeComponent(src.getPayee())); +// if (src.hasReferral()) +// tgt.setReferral(convertReference(src.getReferral())); +// if (src.hasFacility()) +// tgt.setFacility(convertReference(src.getFacility())); +// for (org.hl7.fhir.dstu3.model.Claim.CareTeamComponent t : src.getCareTeam()) +// tgt.addCareTeam(convertCareTeamComponent(t)); +// for (org.hl7.fhir.dstu3.model.Claim.SpecialConditionComponent t : src.getInformation()) +// tgt.addInformation(convertSpecialConditionComponent(t)); +// for (org.hl7.fhir.dstu3.model.Claim.DiagnosisComponent t : src.getDiagnosis()) +// tgt.addDiagnosis(convertDiagnosisComponent(t)); +// for (org.hl7.fhir.dstu3.model.Claim.ProcedureComponent t : src.getProcedure()) +// tgt.addProcedure(convertProcedureComponent(t)); +// for (org.hl7.fhir.dstu3.model.Claim.InsuranceComponent t : src.getInsurance()) +// tgt.addInsurance(convertInsuranceComponent(t)); +// if (src.hasAccident()) +// tgt.setAccident(convertAccidentComponent(src.getAccident())); +//// if (src.hasEmploymentImpacted()) +//// tgt.setEmploymentImpacted(convertPeriod(src.getEmploymentImpacted())); +//// if (src.hasHospitalization()) +//// tgt.setHospitalization(convertPeriod(src.getHospitalization())); +// for (org.hl7.fhir.dstu3.model.Claim.ItemComponent t : src.getItem()) +// tgt.addItem(convertItemComponent(t)); +// if (src.hasTotal()) +// tgt.setTotal(convertMoney(src.getTotal())); +// return tgt; +// } +// +// public static org.hl7.fhir.dstu3.model.Claim convertClaim(org.hl7.fhir.r5.model.Claim src) throws FHIRException { +// if (src == null) +// return null; +// org.hl7.fhir.dstu3.model.Claim tgt = new org.hl7.fhir.dstu3.model.Claim(); +// copyDomainResource(src, tgt); +// for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) +// tgt.addIdentifier(convertIdentifier(t)); +// if (src.hasStatus()) +// tgt.setStatus(convertClaimStatus(src.getStatus())); +// if (src.hasType()) +// tgt.setType(convertCodeableConcept(src.getType())); +// for (org.hl7.fhir.r5.model.CodeableConcept t : src.getSubType()) +// tgt.addSubType(convertCodeableConcept(t)); +// if (src.hasUse()) +// tgt.setUse(convertUse(src.getUse())); +// if (src.hasPatient()) +// tgt.setPatient(convertReference(src.getPatient())); +// if (src.hasBillablePeriod()) +// tgt.setBillablePeriod(convertPeriod(src.getBillablePeriod())); +// if (src.hasCreated()) +// tgt.setCreated(src.getCreated()); +// if (src.hasEnterer()) +// tgt.setEnterer(convertReference(src.getEnterer())); +// if (src.hasInsurer()) +// tgt.setInsurer(convertReference(src.getInsurer())); +// if (src.hasProvider()) +// tgt.setProvider(convertReference(src.getProvider())); +//// if (src.hasOrganization()) +//// tgt.setOrganization(convertReference(src.getOrganization())); +// if (src.hasPriority()) +// tgt.setPriority(convertCodeableConcept(src.getPriority())); +// if (src.hasFundsReserve()) +// tgt.setFundsReserve(convertCodeableConcept(src.getFundsReserve())); +// for (org.hl7.fhir.r5.model.Claim.RelatedClaimComponent t : src.getRelated()) +// tgt.addRelated(convertRelatedClaimComponent(t)); +// if (src.hasPrescription()) +// tgt.setPrescription(convertReference(src.getPrescription())); +// if (src.hasOriginalPrescription()) +// tgt.setOriginalPrescription(convertReference(src.getOriginalPrescription())); +// if (src.hasPayee()) +// tgt.setPayee(convertPayeeComponent(src.getPayee())); +// if (src.hasReferral()) +// tgt.setReferral(convertReference(src.getReferral())); +// if (src.hasFacility()) +// tgt.setFacility(convertReference(src.getFacility())); +// for (org.hl7.fhir.r5.model.Claim.CareTeamComponent t : src.getCareTeam()) +// tgt.addCareTeam(convertCareTeamComponent(t)); +// for (org.hl7.fhir.r5.model.Claim.SpecialConditionComponent t : src.getInformation()) +// tgt.addInformation(convertSpecialConditionComponent(t)); +// for (org.hl7.fhir.r5.model.Claim.DiagnosisComponent t : src.getDiagnosis()) +// tgt.addDiagnosis(convertDiagnosisComponent(t)); +// for (org.hl7.fhir.r5.model.Claim.ProcedureComponent t : src.getProcedure()) +// tgt.addProcedure(convertProcedureComponent(t)); +// for (org.hl7.fhir.r5.model.Claim.InsuranceComponent t : src.getInsurance()) +// tgt.addInsurance(convertInsuranceComponent(t)); +// if (src.hasAccident()) +// tgt.setAccident(convertAccidentComponent(src.getAccident())); +//// if (src.hasEmploymentImpacted()) +//// tgt.setEmploymentImpacted(convertPeriod(src.getEmploymentImpacted())); +//// if (src.hasHospitalization()) +//// tgt.setHospitalization(convertPeriod(src.getHospitalization())); +// for (org.hl7.fhir.r5.model.Claim.ItemComponent t : src.getItem()) +// tgt.addItem(convertItemComponent(t)); +// if (src.hasTotal()) +// tgt.setTotal(convertMoney(src.getTotal())); +// return tgt; +// } +// +// private static org.hl7.fhir.r5.model.Claim.ClaimStatus convertClaimStatus(org.hl7.fhir.dstu3.model.Claim.ClaimStatus src) throws FHIRException { +// if (src == null) +// return null; +// switch (src) { +// case ACTIVE: return org.hl7.fhir.r5.model.Claim.ClaimStatus.ACTIVE; +// case CANCELLED: return org.hl7.fhir.r5.model.Claim.ClaimStatus.CANCELLED; +// case DRAFT: return org.hl7.fhir.r5.model.Claim.ClaimStatus.DRAFT; +// case ENTEREDINERROR: return org.hl7.fhir.r5.model.Claim.ClaimStatus.ENTEREDINERROR; +// default: return org.hl7.fhir.r5.model.Claim.ClaimStatus.NULL; +// } +//} +// +// private static org.hl7.fhir.dstu3.model.Claim.ClaimStatus convertClaimStatus(org.hl7.fhir.r5.model.Claim.ClaimStatus src) throws FHIRException { +// if (src == null) +// return null; +// switch (src) { +// case ACTIVE: return org.hl7.fhir.dstu3.model.Claim.ClaimStatus.ACTIVE; +// case CANCELLED: return org.hl7.fhir.dstu3.model.Claim.ClaimStatus.CANCELLED; +// case DRAFT: return org.hl7.fhir.dstu3.model.Claim.ClaimStatus.DRAFT; +// case ENTEREDINERROR: return org.hl7.fhir.dstu3.model.Claim.ClaimStatus.ENTEREDINERROR; +// default: return org.hl7.fhir.dstu3.model.Claim.ClaimStatus.NULL; +// } +//} +// +// private static org.hl7.fhir.r5.model.Claim.Use convertUse(org.hl7.fhir.dstu3.model.Claim.Use src) throws FHIRException { +// if (src == null) +// return null; +// switch (src) { +// case COMPLETE: return org.hl7.fhir.r5.model.Claim.Use.CLAIM; +// case PROPOSED: return org.hl7.fhir.r5.model.Claim.Use.PREAUTHORIZATION; +// case EXPLORATORY: return org.hl7.fhir.r5.model.Claim.Use.PREDETERMINATION; +// default: return org.hl7.fhir.r5.model.Claim.Use.NULL; +// } +//} +// +// private static org.hl7.fhir.dstu3.model.Claim.Use convertUse(org.hl7.fhir.r5.model.Claim.Use src) throws FHIRException { +// if (src == null) +// return null; +// switch (src) { +// case CLAIM: return org.hl7.fhir.dstu3.model.Claim.Use.COMPLETE; +// case PREAUTHORIZATION: return org.hl7.fhir.dstu3.model.Claim.Use.PROPOSED; +// case PREDETERMINATION: return org.hl7.fhir.dstu3.model.Claim.Use.EXPLORATORY; +// default: return org.hl7.fhir.dstu3.model.Claim.Use.NULL; +// } +//} +// +// public static org.hl7.fhir.r5.model.Claim.RelatedClaimComponent convertRelatedClaimComponent(org.hl7.fhir.dstu3.model.Claim.RelatedClaimComponent src) throws FHIRException { +// if (src == null) +// return null; +// org.hl7.fhir.r5.model.Claim.RelatedClaimComponent tgt = new org.hl7.fhir.r5.model.Claim.RelatedClaimComponent(); +// copyElement(src, tgt); +// if (src.hasClaim()) +// tgt.setClaim(convertReference(src.getClaim())); +// if (src.hasRelationship()) +// tgt.setRelationship(convertCodeableConcept(src.getRelationship())); +// if (src.hasReference()) +// tgt.setReference(convertIdentifier(src.getReference())); +// return tgt; +// } +// +// public static org.hl7.fhir.dstu3.model.Claim.RelatedClaimComponent convertRelatedClaimComponent(org.hl7.fhir.r5.model.Claim.RelatedClaimComponent src) throws FHIRException { +// if (src == null) +// return null; +// org.hl7.fhir.dstu3.model.Claim.RelatedClaimComponent tgt = new org.hl7.fhir.dstu3.model.Claim.RelatedClaimComponent(); +// copyElement(src, tgt); +// if (src.hasClaim()) +// tgt.setClaim(convertReference(src.getClaim())); +// if (src.hasRelationship()) +// tgt.setRelationship(convertCodeableConcept(src.getRelationship())); +// if (src.hasReference()) +// tgt.setReference(convertIdentifier(src.getReference())); +// return tgt; +// } +// +// public static org.hl7.fhir.r5.model.Claim.PayeeComponent convertPayeeComponent(org.hl7.fhir.dstu3.model.Claim.PayeeComponent src) throws FHIRException { +// if (src == null) +// return null; +// org.hl7.fhir.r5.model.Claim.PayeeComponent tgt = new org.hl7.fhir.r5.model.Claim.PayeeComponent(); +// copyElement(src, tgt); +// if (src.hasType()) +// tgt.setType(convertCodeableConcept(src.getType())); +// if (src.hasResourceType()) +// tgt.setResource(convertCoding(src.getResourceType())); +// if (src.hasParty()) +// tgt.setParty(convertReference(src.getParty())); +// return tgt; +// } +// +// public static org.hl7.fhir.dstu3.model.Claim.PayeeComponent convertPayeeComponent(org.hl7.fhir.r5.model.Claim.PayeeComponent src) throws FHIRException { +// if (src == null) +// return null; +// org.hl7.fhir.dstu3.model.Claim.PayeeComponent tgt = new org.hl7.fhir.dstu3.model.Claim.PayeeComponent(); +// copyElement(src, tgt); +// if (src.hasType()) +// tgt.setType(convertCodeableConcept(src.getType())); +// if (src.hasResource()) +// tgt.setResourceType(convertCoding(src.getResource())); +// if (src.hasParty()) +// tgt.setParty(convertReference(src.getParty())); +// return tgt; +// } +// +// public static org.hl7.fhir.r5.model.Claim.CareTeamComponent convertCareTeamComponent(org.hl7.fhir.dstu3.model.Claim.CareTeamComponent src) throws FHIRException { +// if (src == null) +// return null; +// org.hl7.fhir.r5.model.Claim.CareTeamComponent tgt = new org.hl7.fhir.r5.model.Claim.CareTeamComponent(); +// copyElement(src, tgt); +// if (src.hasSequence()) +// tgt.setSequence(src.getSequence()); +// if (src.hasProvider()) +// tgt.setProvider(convertReference(src.getProvider())); +// if (src.hasResponsible()) +// tgt.setResponsible(src.getResponsible()); +// if (src.hasRole()) +// tgt.setRole(convertCodeableConcept(src.getRole())); +// if (src.hasQualification()) +// tgt.setQualification(convertCodeableConcept(src.getQualification())); +// return tgt; +// } +// +// public static org.hl7.fhir.dstu3.model.Claim.CareTeamComponent convertCareTeamComponent(org.hl7.fhir.r5.model.Claim.CareTeamComponent src) throws FHIRException { +// if (src == null) +// return null; +// org.hl7.fhir.dstu3.model.Claim.CareTeamComponent tgt = new org.hl7.fhir.dstu3.model.Claim.CareTeamComponent(); +// copyElement(src, tgt); +// if (src.hasSequence()) +// tgt.setSequence(src.getSequence()); +// if (src.hasProvider()) +// tgt.setProvider(convertReference(src.getProvider())); +// if (src.hasResponsible()) +// tgt.setResponsible(src.getResponsible()); +// if (src.hasRole()) +// tgt.setRole(convertCodeableConcept(src.getRole())); +// if (src.hasQualification()) +// tgt.setQualification(convertCodeableConcept(src.getQualification())); +// return tgt; +// } +// +// public static org.hl7.fhir.r5.model.Claim.SpecialConditionComponent convertSpecialConditionComponent(org.hl7.fhir.dstu3.model.Claim.SpecialConditionComponent src) throws FHIRException { +// if (src == null) +// return null; +// org.hl7.fhir.r5.model.Claim.SpecialConditionComponent tgt = new org.hl7.fhir.r5.model.Claim.SpecialConditionComponent(); +// copyElement(src, tgt); +// if (src.hasSequence()) +// tgt.setSequence(src.getSequence()); +// if (src.hasCategory()) +// tgt.setCategory(convertCodeableConcept(src.getCategory())); +// if (src.hasCode()) +// tgt.setCode(convertCodeableConcept(src.getCode())); +// if (src.hasTiming()) +// tgt.setTiming(convertType(src.getTiming())); +// if (src.hasValue()) +// tgt.setValue(convertType(src.getValue())); +// if (src.hasReason()) +// tgt.setReason(convertCodeableConcept(src.getReason())); +// return tgt; +// } +// +// public static org.hl7.fhir.dstu3.model.Claim.SpecialConditionComponent convertSpecialConditionComponent(org.hl7.fhir.r5.model.Claim.SpecialConditionComponent src) throws FHIRException { +// if (src == null) +// return null; +// org.hl7.fhir.dstu3.model.Claim.SpecialConditionComponent tgt = new org.hl7.fhir.dstu3.model.Claim.SpecialConditionComponent(); +// copyElement(src, tgt); +// if (src.hasSequence()) +// tgt.setSequence(src.getSequence()); +// if (src.hasCategory()) +// tgt.setCategory(convertCodeableConcept(src.getCategory())); +// if (src.hasCode()) +// tgt.setCode(convertCodeableConcept(src.getCode())); +// if (src.hasTiming()) +// tgt.setTiming(convertType(src.getTiming())); +// if (src.hasValue()) +// tgt.setValue(convertType(src.getValue())); +// if (src.hasReason()) +// tgt.setReason(convertCodeableConcept(src.getReason())); +// return tgt; +// } +// +// public static org.hl7.fhir.r5.model.Claim.DiagnosisComponent convertDiagnosisComponent(org.hl7.fhir.dstu3.model.Claim.DiagnosisComponent src) throws FHIRException { +// if (src == null) +// return null; +// org.hl7.fhir.r5.model.Claim.DiagnosisComponent tgt = new org.hl7.fhir.r5.model.Claim.DiagnosisComponent(); +// copyElement(src, tgt); +// if (src.hasSequence()) +// tgt.setSequence(src.getSequence()); +// if (src.hasDiagnosis()) +// tgt.setDiagnosis(convertType(src.getDiagnosis())); +// for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getType()) +// tgt.addType(convertCodeableConcept(t)); +// if (src.hasPackageCode()) +// tgt.setPackageCode(convertCodeableConcept(src.getPackageCode())); +// return tgt; +// } +// +// public static org.hl7.fhir.dstu3.model.Claim.DiagnosisComponent convertDiagnosisComponent(org.hl7.fhir.r5.model.Claim.DiagnosisComponent src) throws FHIRException { +// if (src == null) +// return null; +// org.hl7.fhir.dstu3.model.Claim.DiagnosisComponent tgt = new org.hl7.fhir.dstu3.model.Claim.DiagnosisComponent(); +// copyElement(src, tgt); +// if (src.hasSequence()) +// tgt.setSequence(src.getSequence()); +// if (src.hasDiagnosis()) +// tgt.setDiagnosis(convertType(src.getDiagnosis())); +// for (org.hl7.fhir.r5.model.CodeableConcept t : src.getType()) +// tgt.addType(convertCodeableConcept(t)); +// if (src.hasPackageCode()) +// tgt.setPackageCode(convertCodeableConcept(src.getPackageCode())); +// return tgt; +// } +// +// public static org.hl7.fhir.r5.model.Claim.ProcedureComponent convertProcedureComponent(org.hl7.fhir.dstu3.model.Claim.ProcedureComponent src) throws FHIRException { +// if (src == null) +// return null; +// org.hl7.fhir.r5.model.Claim.ProcedureComponent tgt = new org.hl7.fhir.r5.model.Claim.ProcedureComponent(); +// copyElement(src, tgt); +// if (src.hasSequence()) +// tgt.setSequence(src.getSequence()); +// if (src.hasDate()) +// tgt.setDate(src.getDate()); +// if (src.hasProcedure()) +// tgt.setProcedure(convertType(src.getProcedure())); +// return tgt; +// } +// +// public static org.hl7.fhir.dstu3.model.Claim.ProcedureComponent convertProcedureComponent(org.hl7.fhir.r5.model.Claim.ProcedureComponent src) throws FHIRException { +// if (src == null) +// return null; +// org.hl7.fhir.dstu3.model.Claim.ProcedureComponent tgt = new org.hl7.fhir.dstu3.model.Claim.ProcedureComponent(); +// copyElement(src, tgt); +// if (src.hasSequence()) +// tgt.setSequence(src.getSequence()); +// if (src.hasDate()) +// tgt.setDate(src.getDate()); +// if (src.hasProcedure()) +// tgt.setProcedure(convertType(src.getProcedure())); +// return tgt; +// } +// +// public static org.hl7.fhir.r5.model.Claim.InsuranceComponent convertInsuranceComponent(org.hl7.fhir.dstu3.model.Claim.InsuranceComponent src) throws FHIRException { +// if (src == null) +// return null; +// org.hl7.fhir.r5.model.Claim.InsuranceComponent tgt = new org.hl7.fhir.r5.model.Claim.InsuranceComponent(); +// copyElement(src, tgt); +// if (src.hasSequence()) +// tgt.setSequence(src.getSequence()); +// if (src.hasFocal()) +// tgt.setFocal(src.getFocal()); +// if (src.hasCoverage()) +// tgt.setCoverage(convertReference(src.getCoverage())); +// if (src.hasBusinessArrangement()) +// tgt.setBusinessArrangement(src.getBusinessArrangement()); +// for (org.hl7.fhir.dstu3.model.StringType t : src.getPreAuthRef()) +// tgt.addPreAuthRef(t.getValue()); +// if (src.hasClaimResponse()) +// tgt.setClaimResponse(convertReference(src.getClaimResponse())); +// return tgt; +// } +// +// public static org.hl7.fhir.dstu3.model.Claim.InsuranceComponent convertInsuranceComponent(org.hl7.fhir.r5.model.Claim.InsuranceComponent src) throws FHIRException { +// if (src == null) +// return null; +// org.hl7.fhir.dstu3.model.Claim.InsuranceComponent tgt = new org.hl7.fhir.dstu3.model.Claim.InsuranceComponent(); +// copyElement(src, tgt); +// if (src.hasSequence()) +// tgt.setSequence(src.getSequence()); +// if (src.hasFocal()) +// tgt.setFocal(src.getFocal()); +// if (src.hasCoverage()) +// tgt.setCoverage(convertReference(src.getCoverage())); +// if (src.hasBusinessArrangement()) +// tgt.setBusinessArrangement(src.getBusinessArrangement()); +// for (org.hl7.fhir.r5.model.StringType t : src.getPreAuthRef()) +// tgt.addPreAuthRef(t.getValue()); +// if (src.hasClaimResponse()) +// tgt.setClaimResponse(convertReference(src.getClaimResponse())); +// return tgt; +// } +// +// public static org.hl7.fhir.r5.model.Claim.AccidentComponent convertAccidentComponent(org.hl7.fhir.dstu3.model.Claim.AccidentComponent src) throws FHIRException { +// if (src == null) +// return null; +// org.hl7.fhir.r5.model.Claim.AccidentComponent tgt = new org.hl7.fhir.r5.model.Claim.AccidentComponent(); +// copyElement(src, tgt); +// if (src.hasDate()) +// tgt.setDate(src.getDate()); +// if (src.hasType()) +// tgt.setType(convertCodeableConcept(src.getType())); +// if (src.hasLocation()) +// tgt.setLocation(convertType(src.getLocation())); +// return tgt; +// } +// +// public static org.hl7.fhir.dstu3.model.Claim.AccidentComponent convertAccidentComponent(org.hl7.fhir.r5.model.Claim.AccidentComponent src) throws FHIRException { +// if (src == null) +// return null; +// org.hl7.fhir.dstu3.model.Claim.AccidentComponent tgt = new org.hl7.fhir.dstu3.model.Claim.AccidentComponent(); +// copyElement(src, tgt); +// if (src.hasDate()) +// tgt.setDate(src.getDate()); +// if (src.hasType()) +// tgt.setType(convertCodeableConcept(src.getType())); +// if (src.hasLocation()) +// tgt.setLocation(convertType(src.getLocation())); +// return tgt; +// } +// +// public static org.hl7.fhir.r5.model.Claim.ItemComponent convertItemComponent(org.hl7.fhir.dstu3.model.Claim.ItemComponent src) throws FHIRException { +// if (src == null) +// return null; +// org.hl7.fhir.r5.model.Claim.ItemComponent tgt = new org.hl7.fhir.r5.model.Claim.ItemComponent(); +// copyElement(src, tgt); +// if (src.hasSequence()) +// tgt.setSequence(src.getSequence()); +// for (org.hl7.fhir.dstu3.model.PositiveIntType t : src.getCareTeamLinkId()) +// tgt.addCareTeamSequence(t.getValue()); +// for (org.hl7.fhir.dstu3.model.PositiveIntType t : src.getDiagnosisLinkId()) +// tgt.addDiagnosisSequence(t.getValue()); +// for (org.hl7.fhir.dstu3.model.PositiveIntType t : src.getProcedureLinkId()) +// tgt.addProcedureSequence(t.getValue()); +// for (org.hl7.fhir.dstu3.model.PositiveIntType t : src.getInformationLinkId()) +// tgt.addInformationSequence(t.getValue()); +// if (src.hasRevenue()) +// tgt.setRevenue(convertCodeableConcept(src.getRevenue())); +// if (src.hasCategory()) +// tgt.setCategory(convertCodeableConcept(src.getCategory())); +// if (src.hasService()) +// tgt.setService(convertCodeableConcept(src.getService())); +// for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getModifier()) +// tgt.addModifier(convertCodeableConcept(t)); +// for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getProgramCode()) +// tgt.addProgramCode(convertCodeableConcept(t)); +// if (src.hasServiced()) +// tgt.setServiced(convertType(src.getServiced())); +// if (src.hasLocation()) +// tgt.setLocation(convertType(src.getLocation())); +// if (src.hasQuantity()) +// tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); +// if (src.hasUnitPrice()) +// tgt.setUnitPrice(convertMoney(src.getUnitPrice())); +// if (src.hasFactor()) +// tgt.setFactor(src.getFactor()); +// if (src.hasNet()) +// tgt.setNet(convertMoney(src.getNet())); +// for (org.hl7.fhir.dstu3.model.Reference t : src.getUdi()) +// tgt.addUdi(convertReference(t)); +// if (src.hasBodySite()) +// tgt.setBodySite(convertCodeableConcept(src.getBodySite())); +// for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getSubSite()) +// tgt.addSubSite(convertCodeableConcept(t)); +// for (org.hl7.fhir.dstu3.model.Reference t : src.getEncounter()) +// tgt.addEncounter(convertReference(t)); +// for (org.hl7.fhir.dstu3.model.Claim.DetailComponent t : src.getDetail()) +// tgt.addDetail(convertDetailComponent(t)); +// return tgt; +// } +// +// public static org.hl7.fhir.dstu3.model.Claim.ItemComponent convertItemComponent(org.hl7.fhir.r5.model.Claim.ItemComponent src) throws FHIRException { +// if (src == null) +// return null; +// org.hl7.fhir.dstu3.model.Claim.ItemComponent tgt = new org.hl7.fhir.dstu3.model.Claim.ItemComponent(); +// copyElement(src, tgt); +// if (src.hasSequence()) +// tgt.setSequence(src.getSequence()); +// for (org.hl7.fhir.r5.model.PositiveIntType t : src.getCareTeamSequence()) +// tgt.addCareTeamLinkId(t.getValue()); +// for (org.hl7.fhir.r5.model.PositiveIntType t : src.getDiagnosisSequence()) +// tgt.addDiagnosisLinkId(t.getValue()); +// for (org.hl7.fhir.r5.model.PositiveIntType t : src.getProcedureSequence()) +// tgt.addProcedureLinkId(t.getValue()); +// for (org.hl7.fhir.r5.model.PositiveIntType t : src.getInformationSequence()) +// tgt.addInformationLinkId(t.getValue()); +// if (src.hasRevenue()) +// tgt.setRevenue(convertCodeableConcept(src.getRevenue())); +// if (src.hasCategory()) +// tgt.setCategory(convertCodeableConcept(src.getCategory())); +// if (src.hasService()) +// tgt.setService(convertCodeableConcept(src.getService())); +// for (org.hl7.fhir.r5.model.CodeableConcept t : src.getModifier()) +// tgt.addModifier(convertCodeableConcept(t)); +// for (org.hl7.fhir.r5.model.CodeableConcept t : src.getProgramCode()) +// tgt.addProgramCode(convertCodeableConcept(t)); +// if (src.hasServiced()) +// tgt.setServiced(convertType(src.getServiced())); +// if (src.hasLocation()) +// tgt.setLocation(convertType(src.getLocation())); +// if (src.hasQuantity()) +// tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); +// if (src.hasUnitPrice()) +// tgt.setUnitPrice(convertMoney(src.getUnitPrice())); +// if (src.hasFactor()) +// tgt.setFactor(src.getFactor()); +// if (src.hasNet()) +// tgt.setNet(convertMoney(src.getNet())); +// for (org.hl7.fhir.r5.model.Reference t : src.getUdi()) +// tgt.addUdi(convertReference(t)); +// if (src.hasBodySite()) +// tgt.setBodySite(convertCodeableConcept(src.getBodySite())); +// for (org.hl7.fhir.r5.model.CodeableConcept t : src.getSubSite()) +// tgt.addSubSite(convertCodeableConcept(t)); +// for (org.hl7.fhir.r5.model.Reference t : src.getEncounter()) +// tgt.addEncounter(convertReference(t)); +// for (org.hl7.fhir.r5.model.Claim.DetailComponent t : src.getDetail()) +// tgt.addDetail(convertDetailComponent(t)); +// return tgt; +// } +// +// public static org.hl7.fhir.r5.model.Claim.DetailComponent convertDetailComponent(org.hl7.fhir.dstu3.model.Claim.DetailComponent src) throws FHIRException { +// if (src == null) +// return null; +// org.hl7.fhir.r5.model.Claim.DetailComponent tgt = new org.hl7.fhir.r5.model.Claim.DetailComponent(); +// copyElement(src, tgt); +// if (src.hasSequence()) +// tgt.setSequence(src.getSequence()); +// if (src.hasRevenue()) +// tgt.setRevenue(convertCodeableConcept(src.getRevenue())); +// if (src.hasCategory()) +// tgt.setCategory(convertCodeableConcept(src.getCategory())); +// if (src.hasService()) +// tgt.setService(convertCodeableConcept(src.getService())); +// for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getModifier()) +// tgt.addModifier(convertCodeableConcept(t)); +// for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getProgramCode()) +// tgt.addProgramCode(convertCodeableConcept(t)); +// if (src.hasQuantity()) +// tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); +// if (src.hasUnitPrice()) +// tgt.setUnitPrice(convertMoney(src.getUnitPrice())); +// if (src.hasFactor()) +// tgt.setFactor(src.getFactor()); +// if (src.hasNet()) +// tgt.setNet(convertMoney(src.getNet())); +// for (org.hl7.fhir.dstu3.model.Reference t : src.getUdi()) +// tgt.addUdi(convertReference(t)); +// for (org.hl7.fhir.dstu3.model.Claim.SubDetailComponent t : src.getSubDetail()) +// tgt.addSubDetail(convertSubDetailComponent(t)); +// return tgt; +// } +// +// public static org.hl7.fhir.dstu3.model.Claim.DetailComponent convertDetailComponent(org.hl7.fhir.r5.model.Claim.DetailComponent src) throws FHIRException { +// if (src == null) +// return null; +// org.hl7.fhir.dstu3.model.Claim.DetailComponent tgt = new org.hl7.fhir.dstu3.model.Claim.DetailComponent(); +// copyElement(src, tgt); +// if (src.hasSequence()) +// tgt.setSequence(src.getSequence()); +// if (src.hasRevenue()) +// tgt.setRevenue(convertCodeableConcept(src.getRevenue())); +// if (src.hasCategory()) +// tgt.setCategory(convertCodeableConcept(src.getCategory())); +// if (src.hasService()) +// tgt.setService(convertCodeableConcept(src.getService())); +// for (org.hl7.fhir.r5.model.CodeableConcept t : src.getModifier()) +// tgt.addModifier(convertCodeableConcept(t)); +// for (org.hl7.fhir.r5.model.CodeableConcept t : src.getProgramCode()) +// tgt.addProgramCode(convertCodeableConcept(t)); +// if (src.hasQuantity()) +// tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); +// if (src.hasUnitPrice()) +// tgt.setUnitPrice(convertMoney(src.getUnitPrice())); +// if (src.hasFactor()) +// tgt.setFactor(src.getFactor()); +// if (src.hasNet()) +// tgt.setNet(convertMoney(src.getNet())); +// for (org.hl7.fhir.r5.model.Reference t : src.getUdi()) +// tgt.addUdi(convertReference(t)); +// for (org.hl7.fhir.r5.model.Claim.SubDetailComponent t : src.getSubDetail()) +// tgt.addSubDetail(convertSubDetailComponent(t)); +// return tgt; +// } +// +// public static org.hl7.fhir.r5.model.Claim.SubDetailComponent convertSubDetailComponent(org.hl7.fhir.dstu3.model.Claim.SubDetailComponent src) throws FHIRException { +// if (src == null) +// return null; +// org.hl7.fhir.r5.model.Claim.SubDetailComponent tgt = new org.hl7.fhir.r5.model.Claim.SubDetailComponent(); +// copyElement(src, tgt); +// if (src.hasSequence()) +// tgt.setSequence(src.getSequence()); +// if (src.hasRevenue()) +// tgt.setRevenue(convertCodeableConcept(src.getRevenue())); +// if (src.hasCategory()) +// tgt.setCategory(convertCodeableConcept(src.getCategory())); +// if (src.hasService()) +// tgt.setService(convertCodeableConcept(src.getService())); +// for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getModifier()) +// tgt.addModifier(convertCodeableConcept(t)); +// for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getProgramCode()) +// tgt.addProgramCode(convertCodeableConcept(t)); +// if (src.hasQuantity()) +// tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); +// if (src.hasUnitPrice()) +// tgt.setUnitPrice(convertMoney(src.getUnitPrice())); +// if (src.hasFactor()) +// tgt.setFactor(src.getFactor()); +// if (src.hasNet()) +// tgt.setNet(convertMoney(src.getNet())); +// for (org.hl7.fhir.dstu3.model.Reference t : src.getUdi()) +// tgt.addUdi(convertReference(t)); +// return tgt; +// } +// +// public static org.hl7.fhir.dstu3.model.Claim.SubDetailComponent convertSubDetailComponent(org.hl7.fhir.r5.model.Claim.SubDetailComponent src) throws FHIRException { +// if (src == null) +// return null; +// org.hl7.fhir.dstu3.model.Claim.SubDetailComponent tgt = new org.hl7.fhir.dstu3.model.Claim.SubDetailComponent(); +// copyElement(src, tgt); +// if (src.hasSequence()) +// tgt.setSequence(src.getSequence()); +// if (src.hasRevenue()) +// tgt.setRevenue(convertCodeableConcept(src.getRevenue())); +// if (src.hasCategory()) +// tgt.setCategory(convertCodeableConcept(src.getCategory())); +// if (src.hasService()) +// tgt.setService(convertCodeableConcept(src.getService())); +// for (org.hl7.fhir.r5.model.CodeableConcept t : src.getModifier()) +// tgt.addModifier(convertCodeableConcept(t)); +// for (org.hl7.fhir.r5.model.CodeableConcept t : src.getProgramCode()) +// tgt.addProgramCode(convertCodeableConcept(t)); +// if (src.hasQuantity()) +// tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); +// if (src.hasUnitPrice()) +// tgt.setUnitPrice(convertMoney(src.getUnitPrice())); +// if (src.hasFactor()) +// tgt.setFactor(src.getFactor()); +// if (src.hasNet()) +// tgt.setNet(convertMoney(src.getNet())); +// for (org.hl7.fhir.r5.model.Reference t : src.getUdi()) +// tgt.addUdi(convertReference(t)); +// return tgt; +// } +// + public static org.hl7.fhir.r5.model.ClinicalImpression convertClinicalImpression(org.hl7.fhir.dstu3.model.ClinicalImpression src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ClinicalImpression tgt = new org.hl7.fhir.r5.model.ClinicalImpression(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasStatus()) + tgt.setStatus(convertClinicalImpressionStatus(src.getStatus())); + if (src.hasCode()) + tgt.setCode(convertCodeableConcept(src.getCode())); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + if (src.hasSubject()) + tgt.setSubject(convertReference(src.getSubject())); + if (src.hasContext()) + tgt.setEncounter(convertReference(src.getContext())); + if (src.hasEffective()) + tgt.setEffective(convertType(src.getEffective())); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasAssessor()) + tgt.setAssessor(convertReference(src.getAssessor())); + if (src.hasPrevious()) + tgt.setPrevious(convertReference(src.getPrevious())); + for (org.hl7.fhir.dstu3.model.Reference t : src.getProblem()) + tgt.addProblem(convertReference(t)); + for (org.hl7.fhir.dstu3.model.ClinicalImpression.ClinicalImpressionInvestigationComponent t : src.getInvestigation()) + tgt.addInvestigation(convertClinicalImpressionInvestigationComponent(t)); + for (org.hl7.fhir.dstu3.model.UriType t : src.getProtocol()) + tgt.addProtocol(t.getValue()); + if (src.hasSummary()) + tgt.setSummary(src.getSummary()); + for (org.hl7.fhir.dstu3.model.ClinicalImpression.ClinicalImpressionFindingComponent t : src.getFinding()) + tgt.addFinding(convertClinicalImpressionFindingComponent(t)); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getPrognosisCodeableConcept()) + tgt.addPrognosisCodeableConcept(convertCodeableConcept(t)); + for (org.hl7.fhir.dstu3.model.Reference t : src.getPrognosisReference()) + tgt.addPrognosisReference(convertReference(t)); +// for (org.hl7.fhir.dstu3.model.Reference t : src.getAction()) +// tgt.addAction(convertReference(t)); + for (org.hl7.fhir.dstu3.model.Annotation t : src.getNote()) + tgt.addNote(convertAnnotation(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ClinicalImpression convertClinicalImpression(org.hl7.fhir.r5.model.ClinicalImpression src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.ClinicalImpression tgt = new org.hl7.fhir.dstu3.model.ClinicalImpression(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasStatus()) + tgt.setStatus(convertClinicalImpressionStatus(src.getStatus())); + if (src.hasCode()) + tgt.setCode(convertCodeableConcept(src.getCode())); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + if (src.hasSubject()) + tgt.setSubject(convertReference(src.getSubject())); + if (src.hasEncounter()) + tgt.setContext(convertReference(src.getEncounter())); + if (src.hasEffective()) + tgt.setEffective(convertType(src.getEffective())); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasAssessor()) + tgt.setAssessor(convertReference(src.getAssessor())); + if (src.hasPrevious()) + tgt.setPrevious(convertReference(src.getPrevious())); + for (org.hl7.fhir.r5.model.Reference t : src.getProblem()) + tgt.addProblem(convertReference(t)); + for (org.hl7.fhir.r5.model.ClinicalImpression.ClinicalImpressionInvestigationComponent t : src.getInvestigation()) + tgt.addInvestigation(convertClinicalImpressionInvestigationComponent(t)); + for (org.hl7.fhir.r5.model.UriType t : src.getProtocol()) + tgt.addProtocol(t.getValue()); + if (src.hasSummary()) + tgt.setSummary(src.getSummary()); + for (org.hl7.fhir.r5.model.ClinicalImpression.ClinicalImpressionFindingComponent t : src.getFinding()) + tgt.addFinding(convertClinicalImpressionFindingComponent(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getPrognosisCodeableConcept()) + tgt.addPrognosisCodeableConcept(convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getPrognosisReference()) + tgt.addPrognosisReference(convertReference(t)); +// for (org.hl7.fhir.r5.model.Reference t : src.getAction()) +// tgt.addAction(convertReference(t)); + for (org.hl7.fhir.r5.model.Annotation t : src.getNote()) + tgt.addNote(convertAnnotation(t)); + return tgt; + } + + private static org.hl7.fhir.r5.model.ClinicalImpression.ClinicalImpressionStatus convertClinicalImpressionStatus(org.hl7.fhir.dstu3.model.ClinicalImpression.ClinicalImpressionStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case DRAFT: return org.hl7.fhir.r5.model.ClinicalImpression.ClinicalImpressionStatus.INPROGRESS; + case COMPLETED: return org.hl7.fhir.r5.model.ClinicalImpression.ClinicalImpressionStatus.COMPLETED; + case ENTEREDINERROR: return org.hl7.fhir.r5.model.ClinicalImpression.ClinicalImpressionStatus.ENTEREDINERROR; + default: return org.hl7.fhir.r5.model.ClinicalImpression.ClinicalImpressionStatus.NULL; + } +} + + private static org.hl7.fhir.dstu3.model.ClinicalImpression.ClinicalImpressionStatus convertClinicalImpressionStatus(org.hl7.fhir.r5.model.ClinicalImpression.ClinicalImpressionStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case INPROGRESS: return org.hl7.fhir.dstu3.model.ClinicalImpression.ClinicalImpressionStatus.DRAFT; + case COMPLETED: return org.hl7.fhir.dstu3.model.ClinicalImpression.ClinicalImpressionStatus.COMPLETED; + case ENTEREDINERROR: return org.hl7.fhir.dstu3.model.ClinicalImpression.ClinicalImpressionStatus.ENTEREDINERROR; + default: return org.hl7.fhir.dstu3.model.ClinicalImpression.ClinicalImpressionStatus.NULL; + } +} + + public static org.hl7.fhir.r5.model.ClinicalImpression.ClinicalImpressionInvestigationComponent convertClinicalImpressionInvestigationComponent(org.hl7.fhir.dstu3.model.ClinicalImpression.ClinicalImpressionInvestigationComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ClinicalImpression.ClinicalImpressionInvestigationComponent tgt = new org.hl7.fhir.r5.model.ClinicalImpression.ClinicalImpressionInvestigationComponent(); + copyElement(src, tgt); + if (src.hasCode()) + tgt.setCode(convertCodeableConcept(src.getCode())); + for (org.hl7.fhir.dstu3.model.Reference t : src.getItem()) + tgt.addItem(convertReference(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ClinicalImpression.ClinicalImpressionInvestigationComponent convertClinicalImpressionInvestigationComponent(org.hl7.fhir.r5.model.ClinicalImpression.ClinicalImpressionInvestigationComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.ClinicalImpression.ClinicalImpressionInvestigationComponent tgt = new org.hl7.fhir.dstu3.model.ClinicalImpression.ClinicalImpressionInvestigationComponent(); + copyElement(src, tgt); + if (src.hasCode()) + tgt.setCode(convertCodeableConcept(src.getCode())); + for (org.hl7.fhir.r5.model.Reference t : src.getItem()) + tgt.addItem(convertReference(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.ClinicalImpression.ClinicalImpressionFindingComponent convertClinicalImpressionFindingComponent(org.hl7.fhir.dstu3.model.ClinicalImpression.ClinicalImpressionFindingComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ClinicalImpression.ClinicalImpressionFindingComponent tgt = new org.hl7.fhir.r5.model.ClinicalImpression.ClinicalImpressionFindingComponent(); + copyElement(src, tgt); + if (src.hasItemCodeableConcept()) + tgt.setItemCodeableConcept(convertCodeableConcept(src.getItemCodeableConcept())); + if (src.hasItemReference()) + tgt.setItemReference(convertReference(src.getItemReference())); + if (src.hasBasis()) + tgt.setBasis(src.getBasis()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ClinicalImpression.ClinicalImpressionFindingComponent convertClinicalImpressionFindingComponent(org.hl7.fhir.r5.model.ClinicalImpression.ClinicalImpressionFindingComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.ClinicalImpression.ClinicalImpressionFindingComponent tgt = new org.hl7.fhir.dstu3.model.ClinicalImpression.ClinicalImpressionFindingComponent(); + copyElement(src, tgt); + if (src.hasItemCodeableConcept()) + tgt.setItem(convertType(src.getItemCodeableConcept())); + else if (src.hasItemReference()) + tgt.setItem(convertType(src.getItemReference())); + if (src.hasBasis()) + tgt.setBasis(src.getBasis()); + return tgt; + } + + public static org.hl7.fhir.r5.model.CodeSystem convertCodeSystem(org.hl7.fhir.dstu3.model.CodeSystem src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.CodeSystem tgt = new org.hl7.fhir.r5.model.CodeSystem(); + copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + if (src.hasIdentifier()) + tgt.addIdentifier(convertIdentifier(src.getIdentifier())); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasTitle()) + tgt.setTitle(src.getTitle()); + if (src.hasStatus()) + tgt.setStatus(convertPublicationStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) + tgt.addContact(convertContactDetail(t)); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu3.model.UsageContext t : src.getUseContext()) + tgt.addUseContext(convertUsageContext(t)); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction()) + tgt.addJurisdiction(convertCodeableConcept(t)); + if (src.hasPurpose()) + tgt.setPurpose(src.getPurpose()); + if (src.hasCopyright()) + tgt.setCopyright(src.getCopyright()); + if (src.hasCaseSensitive()) + tgt.setCaseSensitive(src.getCaseSensitive()); + if (src.hasValueSet()) + tgt.setValueSet(src.getValueSet()); + if (src.hasHierarchyMeaning()) + tgt.setHierarchyMeaning(convertCodeSystemHierarchyMeaning(src.getHierarchyMeaning())); + if (src.hasCompositional()) + tgt.setCompositional(src.getCompositional()); + if (src.hasVersionNeeded()) + tgt.setVersionNeeded(src.getVersionNeeded()); + if (src.hasContent()) + tgt.setContent(convertCodeSystemContentMode(src.getContent())); + if (src.hasCount()) + tgt.setCount(src.getCount()); + for (org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemFilterComponent t : src.getFilter()) + tgt.addFilter(convertCodeSystemFilterComponent(t)); + for (org.hl7.fhir.dstu3.model.CodeSystem.PropertyComponent t : src.getProperty()) + tgt.addProperty(convertPropertyComponent(t)); + for (org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionComponent t : src.getConcept()) + tgt.addConcept(convertConceptDefinitionComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.CodeSystem convertCodeSystem(org.hl7.fhir.r5.model.CodeSystem src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.CodeSystem tgt = new org.hl7.fhir.dstu3.model.CodeSystem(); + copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + if (src.hasIdentifier()) + tgt.setIdentifier(convertIdentifier(src.getIdentifierFirstRep())); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasTitle()) + tgt.setTitle(src.getTitle()); + if (src.hasStatus()) + tgt.setStatus(convertPublicationStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.r5.model.ContactDetail t : src.getContact()) + tgt.addContact(convertContactDetail(t)); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.r5.model.UsageContext t : src.getUseContext()) + tgt.addUseContext(convertUsageContext(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getJurisdiction()) + tgt.addJurisdiction(convertCodeableConcept(t)); + if (src.hasPurpose()) + tgt.setPurpose(src.getPurpose()); + if (src.hasCopyright()) + tgt.setCopyright(src.getCopyright()); + if (src.hasCaseSensitive()) + tgt.setCaseSensitive(src.getCaseSensitive()); + if (src.hasValueSet()) + tgt.setValueSet(src.getValueSet()); + if (src.hasHierarchyMeaning()) + tgt.setHierarchyMeaning(convertCodeSystemHierarchyMeaning(src.getHierarchyMeaning())); + if (src.hasCompositional()) + tgt.setCompositional(src.getCompositional()); + if (src.hasVersionNeeded()) + tgt.setVersionNeeded(src.getVersionNeeded()); + if (src.hasContent()) + tgt.setContent(convertCodeSystemContentMode(src.getContent())); + if (src.hasCount()) + tgt.setCount(src.getCount()); + for (org.hl7.fhir.r5.model.CodeSystem.CodeSystemFilterComponent t : src.getFilter()) + tgt.addFilter(convertCodeSystemFilterComponent(t)); + for (org.hl7.fhir.r5.model.CodeSystem.PropertyComponent t : src.getProperty()) + tgt.addProperty(convertPropertyComponent(t)); + for (org.hl7.fhir.r5.model.CodeSystem.ConceptDefinitionComponent t : src.getConcept()) + tgt.addConcept(convertConceptDefinitionComponent(t)); + return tgt; + } + + private static org.hl7.fhir.r5.model.CodeSystem.CodeSystemHierarchyMeaning convertCodeSystemHierarchyMeaning(org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemHierarchyMeaning src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case GROUPEDBY: return org.hl7.fhir.r5.model.CodeSystem.CodeSystemHierarchyMeaning.GROUPEDBY; + case ISA: return org.hl7.fhir.r5.model.CodeSystem.CodeSystemHierarchyMeaning.ISA; + case PARTOF: return org.hl7.fhir.r5.model.CodeSystem.CodeSystemHierarchyMeaning.PARTOF; + case CLASSIFIEDWITH: return org.hl7.fhir.r5.model.CodeSystem.CodeSystemHierarchyMeaning.CLASSIFIEDWITH; + default: return org.hl7.fhir.r5.model.CodeSystem.CodeSystemHierarchyMeaning.NULL; + } +} + + private static org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemHierarchyMeaning convertCodeSystemHierarchyMeaning(org.hl7.fhir.r5.model.CodeSystem.CodeSystemHierarchyMeaning src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case GROUPEDBY: return org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemHierarchyMeaning.GROUPEDBY; + case ISA: return org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemHierarchyMeaning.ISA; + case PARTOF: return org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemHierarchyMeaning.PARTOF; + case CLASSIFIEDWITH: return org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemHierarchyMeaning.CLASSIFIEDWITH; + default: return org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemHierarchyMeaning.NULL; + } +} + + private static org.hl7.fhir.r5.model.CodeSystem.CodeSystemContentMode convertCodeSystemContentMode(org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemContentMode src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case NOTPRESENT: return org.hl7.fhir.r5.model.CodeSystem.CodeSystemContentMode.NOTPRESENT; + case EXAMPLE: return org.hl7.fhir.r5.model.CodeSystem.CodeSystemContentMode.EXAMPLE; + case FRAGMENT: return org.hl7.fhir.r5.model.CodeSystem.CodeSystemContentMode.FRAGMENT; + case COMPLETE: return org.hl7.fhir.r5.model.CodeSystem.CodeSystemContentMode.COMPLETE; + default: return org.hl7.fhir.r5.model.CodeSystem.CodeSystemContentMode.NULL; + } +} + + private static org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemContentMode convertCodeSystemContentMode(org.hl7.fhir.r5.model.CodeSystem.CodeSystemContentMode src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case NOTPRESENT: return org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemContentMode.NOTPRESENT; + case EXAMPLE: return org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemContentMode.EXAMPLE; + case FRAGMENT: return org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemContentMode.FRAGMENT; + case COMPLETE: return org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemContentMode.COMPLETE; + default: return org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemContentMode.NULL; + } +} + + public static org.hl7.fhir.r5.model.CodeSystem.CodeSystemFilterComponent convertCodeSystemFilterComponent(org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemFilterComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.CodeSystem.CodeSystemFilterComponent tgt = new org.hl7.fhir.r5.model.CodeSystem.CodeSystemFilterComponent(); + copyElement(src, tgt); + if (src.hasCode()) + tgt.setCode(src.getCode()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu3.model.Enumeration t : src.getOperator()) + tgt.addOperator(convertFilterOperator(t.getValue())); + if (src.hasValue()) + tgt.setValue(src.getValue()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemFilterComponent convertCodeSystemFilterComponent(org.hl7.fhir.r5.model.CodeSystem.CodeSystemFilterComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemFilterComponent tgt = new org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemFilterComponent(); + copyElement(src, tgt); + if (src.hasCode()) + tgt.setCode(src.getCode()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.r5.model.Enumeration t : src.getOperator()) + tgt.addOperator(convertFilterOperator(t.getValue())); + if (src.hasValue()) + tgt.setValue(src.getValue()); + return tgt; + } + + private static org.hl7.fhir.r5.model.CodeSystem.FilterOperator convertFilterOperator(org.hl7.fhir.dstu3.model.CodeSystem.FilterOperator src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case EQUAL: return org.hl7.fhir.r5.model.CodeSystem.FilterOperator.EQUAL; + case ISA: return org.hl7.fhir.r5.model.CodeSystem.FilterOperator.ISA; + case DESCENDENTOF: return org.hl7.fhir.r5.model.CodeSystem.FilterOperator.DESCENDENTOF; + case ISNOTA: return org.hl7.fhir.r5.model.CodeSystem.FilterOperator.ISNOTA; + case REGEX: return org.hl7.fhir.r5.model.CodeSystem.FilterOperator.REGEX; + case IN: return org.hl7.fhir.r5.model.CodeSystem.FilterOperator.IN; + case NOTIN: return org.hl7.fhir.r5.model.CodeSystem.FilterOperator.NOTIN; + case GENERALIZES: return org.hl7.fhir.r5.model.CodeSystem.FilterOperator.GENERALIZES; + case EXISTS: return org.hl7.fhir.r5.model.CodeSystem.FilterOperator.EXISTS; + default: return org.hl7.fhir.r5.model.CodeSystem.FilterOperator.NULL; + } +} + + private static org.hl7.fhir.dstu3.model.CodeSystem.FilterOperator convertFilterOperator(org.hl7.fhir.r5.model.CodeSystem.FilterOperator src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case EQUAL: return org.hl7.fhir.dstu3.model.CodeSystem.FilterOperator.EQUAL; + case ISA: return org.hl7.fhir.dstu3.model.CodeSystem.FilterOperator.ISA; + case DESCENDENTOF: return org.hl7.fhir.dstu3.model.CodeSystem.FilterOperator.DESCENDENTOF; + case ISNOTA: return org.hl7.fhir.dstu3.model.CodeSystem.FilterOperator.ISNOTA; + case REGEX: return org.hl7.fhir.dstu3.model.CodeSystem.FilterOperator.REGEX; + case IN: return org.hl7.fhir.dstu3.model.CodeSystem.FilterOperator.IN; + case NOTIN: return org.hl7.fhir.dstu3.model.CodeSystem.FilterOperator.NOTIN; + case GENERALIZES: return org.hl7.fhir.dstu3.model.CodeSystem.FilterOperator.GENERALIZES; + case EXISTS: return org.hl7.fhir.dstu3.model.CodeSystem.FilterOperator.EXISTS; + default: return org.hl7.fhir.dstu3.model.CodeSystem.FilterOperator.NULL; + } +} + + public static org.hl7.fhir.r5.model.CodeSystem.PropertyComponent convertPropertyComponent(org.hl7.fhir.dstu3.model.CodeSystem.PropertyComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.CodeSystem.PropertyComponent tgt = new org.hl7.fhir.r5.model.CodeSystem.PropertyComponent(); + copyElement(src, tgt); + if (src.hasCode()) + tgt.setCode(src.getCode()); + if (src.hasUri()) + tgt.setUri(src.getUri()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + if (src.hasType()) + tgt.setType(convertPropertyType(src.getType())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.CodeSystem.PropertyComponent convertPropertyComponent(org.hl7.fhir.r5.model.CodeSystem.PropertyComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.CodeSystem.PropertyComponent tgt = new org.hl7.fhir.dstu3.model.CodeSystem.PropertyComponent(); + copyElement(src, tgt); + if (src.hasCode()) + tgt.setCode(src.getCode()); + if (src.hasUri()) + tgt.setUri(src.getUri()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + if (src.hasType()) + tgt.setType(convertPropertyType(src.getType())); + return tgt; + } + + private static org.hl7.fhir.r5.model.CodeSystem.PropertyType convertPropertyType(org.hl7.fhir.dstu3.model.CodeSystem.PropertyType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case CODE: return org.hl7.fhir.r5.model.CodeSystem.PropertyType.CODE; + case CODING: return org.hl7.fhir.r5.model.CodeSystem.PropertyType.CODING; + case STRING: return org.hl7.fhir.r5.model.CodeSystem.PropertyType.STRING; + case INTEGER: return org.hl7.fhir.r5.model.CodeSystem.PropertyType.INTEGER; + case BOOLEAN: return org.hl7.fhir.r5.model.CodeSystem.PropertyType.BOOLEAN; + case DATETIME: return org.hl7.fhir.r5.model.CodeSystem.PropertyType.DATETIME; + default: return org.hl7.fhir.r5.model.CodeSystem.PropertyType.NULL; + } +} + + private static org.hl7.fhir.dstu3.model.CodeSystem.PropertyType convertPropertyType(org.hl7.fhir.r5.model.CodeSystem.PropertyType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case CODE: return org.hl7.fhir.dstu3.model.CodeSystem.PropertyType.CODE; + case CODING: return org.hl7.fhir.dstu3.model.CodeSystem.PropertyType.CODING; + case STRING: return org.hl7.fhir.dstu3.model.CodeSystem.PropertyType.STRING; + case INTEGER: return org.hl7.fhir.dstu3.model.CodeSystem.PropertyType.INTEGER; + case BOOLEAN: return org.hl7.fhir.dstu3.model.CodeSystem.PropertyType.BOOLEAN; + case DATETIME: return org.hl7.fhir.dstu3.model.CodeSystem.PropertyType.DATETIME; + default: return org.hl7.fhir.dstu3.model.CodeSystem.PropertyType.NULL; + } +} + + public static org.hl7.fhir.r5.model.CodeSystem.ConceptDefinitionComponent convertConceptDefinitionComponent(org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.CodeSystem.ConceptDefinitionComponent tgt = new org.hl7.fhir.r5.model.CodeSystem.ConceptDefinitionComponent(); + copyElement(src, tgt); + if (src.hasCode()) + tgt.setCode(src.getCode()); + if (src.hasDisplay()) + tgt.setDisplay(src.getDisplay()); + if (src.hasDefinition()) + tgt.setDefinition(src.getDefinition()); + for (org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionDesignationComponent t : src.getDesignation()) + tgt.addDesignation(convertConceptDefinitionDesignationComponent(t)); + for (org.hl7.fhir.dstu3.model.CodeSystem.ConceptPropertyComponent t : src.getProperty()) + tgt.addProperty(convertConceptPropertyComponent(t)); + for (org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionComponent t : src.getConcept()) + tgt.addConcept(convertConceptDefinitionComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionComponent convertConceptDefinitionComponent(org.hl7.fhir.r5.model.CodeSystem.ConceptDefinitionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionComponent tgt = new org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionComponent(); + copyElement(src, tgt); + if (src.hasCode()) + tgt.setCode(src.getCode()); + if (src.hasDisplay()) + tgt.setDisplay(src.getDisplay()); + if (src.hasDefinition()) + tgt.setDefinition(src.getDefinition()); + for (org.hl7.fhir.r5.model.CodeSystem.ConceptDefinitionDesignationComponent t : src.getDesignation()) + tgt.addDesignation(convertConceptDefinitionDesignationComponent(t)); + for (org.hl7.fhir.r5.model.CodeSystem.ConceptPropertyComponent t : src.getProperty()) + tgt.addProperty(convertConceptPropertyComponent(t)); + for (org.hl7.fhir.r5.model.CodeSystem.ConceptDefinitionComponent t : src.getConcept()) + tgt.addConcept(convertConceptDefinitionComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.CodeSystem.ConceptDefinitionDesignationComponent convertConceptDefinitionDesignationComponent(org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionDesignationComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.CodeSystem.ConceptDefinitionDesignationComponent tgt = new org.hl7.fhir.r5.model.CodeSystem.ConceptDefinitionDesignationComponent(); + copyElement(src, tgt); + if (src.hasLanguage()) + tgt.setLanguage(src.getLanguage()); + if (src.hasUse()) + tgt.setUse(convertCoding(src.getUse())); + if (src.hasValue()) + tgt.setValue(src.getValue()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionDesignationComponent convertConceptDefinitionDesignationComponent(org.hl7.fhir.r5.model.CodeSystem.ConceptDefinitionDesignationComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionDesignationComponent tgt = new org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionDesignationComponent(); + copyElement(src, tgt); + if (src.hasLanguage()) + tgt.setLanguage(src.getLanguage()); + if (src.hasUse()) + tgt.setUse(convertCoding(src.getUse())); + if (src.hasValue()) + tgt.setValue(src.getValue()); + return tgt; + } + + public static org.hl7.fhir.r5.model.CodeSystem.ConceptPropertyComponent convertConceptPropertyComponent(org.hl7.fhir.dstu3.model.CodeSystem.ConceptPropertyComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.CodeSystem.ConceptPropertyComponent tgt = new org.hl7.fhir.r5.model.CodeSystem.ConceptPropertyComponent(); + copyElement(src, tgt); + if (src.hasCode()) + tgt.setCode(src.getCode()); + if (src.hasValue()) + tgt.setValue(convertType(src.getValue())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.CodeSystem.ConceptPropertyComponent convertConceptPropertyComponent(org.hl7.fhir.r5.model.CodeSystem.ConceptPropertyComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.CodeSystem.ConceptPropertyComponent tgt = new org.hl7.fhir.dstu3.model.CodeSystem.ConceptPropertyComponent(); + copyElement(src, tgt); + if (src.hasCode()) + tgt.setCode(src.getCode()); + if (src.hasValue()) + tgt.setValue(convertType(src.getValue())); + return tgt; + } + + public static org.hl7.fhir.r5.model.Communication convertCommunication(org.hl7.fhir.dstu3.model.Communication src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Communication tgt = new org.hl7.fhir.r5.model.Communication(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + for (org.hl7.fhir.dstu3.model.Reference t : src.getDefinition()) + tgt.addInstantiatesCanonical(t.getReference()); + for (org.hl7.fhir.dstu3.model.Reference t : src.getBasedOn()) + tgt.addBasedOn(convertReference(t)); + for (org.hl7.fhir.dstu3.model.Reference t : src.getPartOf()) + tgt.addPartOf(convertReference(t)); + if (src.hasNotDone()) + tgt.setStatus(org.hl7.fhir.r5.model.Communication.CommunicationStatus.NOTDONE); + else if (src.hasStatus()) + tgt.setStatus(convertCommunicationStatus(src.getStatus())); + if (src.hasNotDoneReason()) + tgt.setStatusReason(convertCodeableConcept(src.getNotDoneReason())); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getCategory()) + tgt.addCategory(convertCodeableConcept(t)); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getMedium()) + tgt.addMedium(convertCodeableConcept(t)); + if (src.hasSubject()) + tgt.setSubject(convertReference(src.getSubject())); + for (org.hl7.fhir.dstu3.model.Reference t : src.getRecipient()) + tgt.addRecipient(convertReference(t)); + if (src.hasContext()) + tgt.setEncounter(convertReference(src.getContext())); + if (src.hasSent()) + tgt.setSent(src.getSent()); + if (src.hasReceived()) + tgt.setReceived(src.getReceived()); + if (src.hasSender()) + tgt.setSender(convertReference(src.getSender())); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getReasonCode()) + tgt.addReasonCode(convertCodeableConcept(t)); + for (org.hl7.fhir.dstu3.model.Reference t : src.getReasonReference()) + tgt.addReasonReference(convertReference(t)); + for (org.hl7.fhir.dstu3.model.Communication.CommunicationPayloadComponent t : src.getPayload()) + tgt.addPayload(convertCommunicationPayloadComponent(t)); + for (org.hl7.fhir.dstu3.model.Annotation t : src.getNote()) + tgt.addNote(convertAnnotation(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Communication convertCommunication(org.hl7.fhir.r5.model.Communication src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Communication tgt = new org.hl7.fhir.dstu3.model.Communication(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + for (org.hl7.fhir.r5.model.UriType t : src.getInstantiatesCanonical()) + tgt.addDefinition(new org.hl7.fhir.dstu3.model.Reference(t.getValue())); + for (org.hl7.fhir.r5.model.Reference t : src.getBasedOn()) + tgt.addBasedOn(convertReference(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getPartOf()) + tgt.addPartOf(convertReference(t)); + if (src.hasStatus()) + if (src.getStatus() == org.hl7.fhir.r5.model.Communication.CommunicationStatus.NOTDONE) + tgt.setNotDone(true); + else + tgt.setStatus(convertCommunicationStatus(src.getStatus())); + if (src.hasStatusReason()) + tgt.setNotDoneReason(convertCodeableConcept(src.getStatusReason())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getCategory()) + tgt.addCategory(convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getMedium()) + tgt.addMedium(convertCodeableConcept(t)); + if (src.hasSubject()) + tgt.setSubject(convertReference(src.getSubject())); + for (org.hl7.fhir.r5.model.Reference t : src.getRecipient()) + tgt.addRecipient(convertReference(t)); + if (src.hasEncounter()) + tgt.setContext(convertReference(src.getEncounter())); + if (src.hasSent()) + tgt.setSent(src.getSent()); + if (src.hasReceived()) + tgt.setReceived(src.getReceived()); + if (src.hasSender()) + tgt.setSender(convertReference(src.getSender())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getReasonCode()) + tgt.addReasonCode(convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getReasonReference()) + tgt.addReasonReference(convertReference(t)); + for (org.hl7.fhir.r5.model.Communication.CommunicationPayloadComponent t : src.getPayload()) + tgt.addPayload(convertCommunicationPayloadComponent(t)); + for (org.hl7.fhir.r5.model.Annotation t : src.getNote()) + tgt.addNote(convertAnnotation(t)); + return tgt; + } + + private static org.hl7.fhir.r5.model.Communication.CommunicationStatus convertCommunicationStatus(org.hl7.fhir.dstu3.model.Communication.CommunicationStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PREPARATION: return org.hl7.fhir.r5.model.Communication.CommunicationStatus.PREPARATION; + case INPROGRESS: return org.hl7.fhir.r5.model.Communication.CommunicationStatus.INPROGRESS; + case SUSPENDED: return org.hl7.fhir.r5.model.Communication.CommunicationStatus.ONHOLD; + case ABORTED: return org.hl7.fhir.r5.model.Communication.CommunicationStatus.STOPPED; + case COMPLETED: return org.hl7.fhir.r5.model.Communication.CommunicationStatus.COMPLETED; + case ENTEREDINERROR: return org.hl7.fhir.r5.model.Communication.CommunicationStatus.ENTEREDINERROR; + case UNKNOWN: return org.hl7.fhir.r5.model.Communication.CommunicationStatus.UNKNOWN; + default: return org.hl7.fhir.r5.model.Communication.CommunicationStatus.NULL; + } +} + + private static org.hl7.fhir.dstu3.model.Communication.CommunicationStatus convertCommunicationStatus(org.hl7.fhir.r5.model.Communication.CommunicationStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PREPARATION: return org.hl7.fhir.dstu3.model.Communication.CommunicationStatus.PREPARATION; + case INPROGRESS: return org.hl7.fhir.dstu3.model.Communication.CommunicationStatus.INPROGRESS; + case ONHOLD: return org.hl7.fhir.dstu3.model.Communication.CommunicationStatus.SUSPENDED; + case STOPPED: return org.hl7.fhir.dstu3.model.Communication.CommunicationStatus.ABORTED; + case COMPLETED: return org.hl7.fhir.dstu3.model.Communication.CommunicationStatus.COMPLETED; + case ENTEREDINERROR: return org.hl7.fhir.dstu3.model.Communication.CommunicationStatus.ENTEREDINERROR; + case UNKNOWN: return org.hl7.fhir.dstu3.model.Communication.CommunicationStatus.UNKNOWN; + default: return org.hl7.fhir.dstu3.model.Communication.CommunicationStatus.NULL; + } +} + + public static org.hl7.fhir.r5.model.Communication.CommunicationPayloadComponent convertCommunicationPayloadComponent(org.hl7.fhir.dstu3.model.Communication.CommunicationPayloadComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Communication.CommunicationPayloadComponent tgt = new org.hl7.fhir.r5.model.Communication.CommunicationPayloadComponent(); + copyElement(src, tgt); + if (src.hasContent()) + tgt.setContent(convertType(src.getContent())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Communication.CommunicationPayloadComponent convertCommunicationPayloadComponent(org.hl7.fhir.r5.model.Communication.CommunicationPayloadComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Communication.CommunicationPayloadComponent tgt = new org.hl7.fhir.dstu3.model.Communication.CommunicationPayloadComponent(); + copyElement(src, tgt); + if (src.hasContent()) + tgt.setContent(convertType(src.getContent())); + return tgt; + } + + public static org.hl7.fhir.r5.model.CompartmentDefinition convertCompartmentDefinition(org.hl7.fhir.dstu3.model.CompartmentDefinition src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.CompartmentDefinition tgt = new org.hl7.fhir.r5.model.CompartmentDefinition(); + copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasTitle()) + tgt.setTitle(src.getTitle()); + if (src.hasStatus()) + tgt.setStatus(convertPublicationStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) + tgt.addContact(convertContactDetail(t)); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + if (src.hasPurpose()) + tgt.setPurpose(src.getPurpose()); + for (org.hl7.fhir.dstu3.model.UsageContext t : src.getUseContext()) + tgt.addUseContext(convertUsageContext(t)); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction()) + tgt.addJurisdiction(convertCodeableConcept(t)); + if (src.hasCode()) + tgt.setCode(convertCompartmentType(src.getCode())); + if (src.hasSearch()) + tgt.setSearch(src.getSearch()); + for (org.hl7.fhir.dstu3.model.CompartmentDefinition.CompartmentDefinitionResourceComponent t : src.getResource()) + tgt.addResource(convertCompartmentDefinitionResourceComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.CompartmentDefinition convertCompartmentDefinition(org.hl7.fhir.r5.model.CompartmentDefinition src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.CompartmentDefinition tgt = new org.hl7.fhir.dstu3.model.CompartmentDefinition(); + copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasTitle()) + tgt.setTitle(src.getTitle()); + if (src.hasStatus()) + tgt.setStatus(convertPublicationStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.r5.model.ContactDetail t : src.getContact()) + tgt.addContact(convertContactDetail(t)); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + if (src.hasPurpose()) + tgt.setPurpose(src.getPurpose()); + for (org.hl7.fhir.r5.model.UsageContext t : src.getUseContext()) + tgt.addUseContext(convertUsageContext(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getJurisdiction()) + tgt.addJurisdiction(convertCodeableConcept(t)); + if (src.hasCode()) + tgt.setCode(convertCompartmentType(src.getCode())); + if (src.hasSearch()) + tgt.setSearch(src.getSearch()); + for (org.hl7.fhir.r5.model.CompartmentDefinition.CompartmentDefinitionResourceComponent t : src.getResource()) + tgt.addResource(convertCompartmentDefinitionResourceComponent(t)); + return tgt; + } + + private static org.hl7.fhir.r5.model.CompartmentDefinition.CompartmentType convertCompartmentType(org.hl7.fhir.dstu3.model.CompartmentDefinition.CompartmentType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PATIENT: return org.hl7.fhir.r5.model.CompartmentDefinition.CompartmentType.PATIENT; + case ENCOUNTER: return org.hl7.fhir.r5.model.CompartmentDefinition.CompartmentType.ENCOUNTER; + case RELATEDPERSON: return org.hl7.fhir.r5.model.CompartmentDefinition.CompartmentType.RELATEDPERSON; + case PRACTITIONER: return org.hl7.fhir.r5.model.CompartmentDefinition.CompartmentType.PRACTITIONER; + case DEVICE: return org.hl7.fhir.r5.model.CompartmentDefinition.CompartmentType.DEVICE; + default: return org.hl7.fhir.r5.model.CompartmentDefinition.CompartmentType.NULL; + } +} + + private static org.hl7.fhir.dstu3.model.CompartmentDefinition.CompartmentType convertCompartmentType(org.hl7.fhir.r5.model.CompartmentDefinition.CompartmentType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PATIENT: return org.hl7.fhir.dstu3.model.CompartmentDefinition.CompartmentType.PATIENT; + case ENCOUNTER: return org.hl7.fhir.dstu3.model.CompartmentDefinition.CompartmentType.ENCOUNTER; + case RELATEDPERSON: return org.hl7.fhir.dstu3.model.CompartmentDefinition.CompartmentType.RELATEDPERSON; + case PRACTITIONER: return org.hl7.fhir.dstu3.model.CompartmentDefinition.CompartmentType.PRACTITIONER; + case DEVICE: return org.hl7.fhir.dstu3.model.CompartmentDefinition.CompartmentType.DEVICE; + default: return org.hl7.fhir.dstu3.model.CompartmentDefinition.CompartmentType.NULL; + } +} + + public static org.hl7.fhir.r5.model.CompartmentDefinition.CompartmentDefinitionResourceComponent convertCompartmentDefinitionResourceComponent(org.hl7.fhir.dstu3.model.CompartmentDefinition.CompartmentDefinitionResourceComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.CompartmentDefinition.CompartmentDefinitionResourceComponent tgt = new org.hl7.fhir.r5.model.CompartmentDefinition.CompartmentDefinitionResourceComponent(); + copyElement(src, tgt); + if (src.hasCode()) + tgt.setCode(src.getCode()); + for (org.hl7.fhir.dstu3.model.StringType t : src.getParam()) + tgt.addParam(t.getValue()); + if (src.hasDocumentation()) + tgt.setDocumentation(src.getDocumentation()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.CompartmentDefinition.CompartmentDefinitionResourceComponent convertCompartmentDefinitionResourceComponent(org.hl7.fhir.r5.model.CompartmentDefinition.CompartmentDefinitionResourceComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.CompartmentDefinition.CompartmentDefinitionResourceComponent tgt = new org.hl7.fhir.dstu3.model.CompartmentDefinition.CompartmentDefinitionResourceComponent(); + copyElement(src, tgt); + if (src.hasCode()) + tgt.setCode(src.getCode()); + for (org.hl7.fhir.r5.model.StringType t : src.getParam()) + tgt.addParam(t.getValue()); + if (src.hasDocumentation()) + tgt.setDocumentation(src.getDocumentation()); + return tgt; + } + + public static org.hl7.fhir.r5.model.Composition convertComposition(org.hl7.fhir.dstu3.model.Composition src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Composition tgt = new org.hl7.fhir.r5.model.Composition(); + copyDomainResource(src, tgt); + if (src.hasIdentifier()) + tgt.setIdentifier(convertIdentifier(src.getIdentifier())); + if (src.hasStatus()) + tgt.setStatus(convertCompositionStatus(src.getStatus())); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + if (src.hasClass_()) + tgt.addCategory(convertCodeableConcept(src.getClass_())); + if (src.hasSubject()) + tgt.setSubject(convertReference(src.getSubject())); + if (src.hasEncounter()) + tgt.setEncounter(convertReference(src.getEncounter())); + if (src.hasDate()) + tgt.setDate(src.getDate()); + for (org.hl7.fhir.dstu3.model.Reference t : src.getAuthor()) + tgt.addAuthor(convertReference(t)); + if (src.hasTitle()) + tgt.setTitle(src.getTitle()); + if (src.hasConfidentiality()) + tgt.setConfidentiality(convertDocumentConfidentiality(src.getConfidentiality())); + for (org.hl7.fhir.dstu3.model.Composition.CompositionAttesterComponent t : src.getAttester()) + tgt.addAttester(convertCompositionAttesterComponent(t)); + if (src.hasCustodian()) + tgt.setCustodian(convertReference(src.getCustodian())); + for (org.hl7.fhir.dstu3.model.Composition.CompositionRelatesToComponent t : src.getRelatesTo()) + tgt.addRelatesTo(convertCompositionRelatesToComponent(t)); + for (org.hl7.fhir.dstu3.model.Composition.CompositionEventComponent t : src.getEvent()) + tgt.addEvent(convertCompositionEventComponent(t)); + for (org.hl7.fhir.dstu3.model.Composition.SectionComponent t : src.getSection()) + tgt.addSection(convertSectionComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Composition convertComposition(org.hl7.fhir.r5.model.Composition src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Composition tgt = new org.hl7.fhir.dstu3.model.Composition(); + copyDomainResource(src, tgt); + if (src.hasIdentifier()) + tgt.setIdentifier(convertIdentifier(src.getIdentifier())); + if (src.hasStatus()) + tgt.setStatus(convertCompositionStatus(src.getStatus())); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + if (src.hasCategory()) + tgt.setClass_(convertCodeableConcept(src.getCategoryFirstRep())); + if (src.hasSubject()) + tgt.setSubject(convertReference(src.getSubject())); + if (src.hasEncounter()) + tgt.setEncounter(convertReference(src.getEncounter())); + if (src.hasDate()) + tgt.setDate(src.getDate()); + for (org.hl7.fhir.r5.model.Reference t : src.getAuthor()) + tgt.addAuthor(convertReference(t)); + if (src.hasTitle()) + tgt.setTitle(src.getTitle()); + if (src.hasConfidentiality()) + tgt.setConfidentiality(convertDocumentConfidentiality(src.getConfidentiality())); + for (org.hl7.fhir.r5.model.Composition.CompositionAttesterComponent t : src.getAttester()) + tgt.addAttester(convertCompositionAttesterComponent(t)); + if (src.hasCustodian()) + tgt.setCustodian(convertReference(src.getCustodian())); + for (org.hl7.fhir.r5.model.Composition.CompositionRelatesToComponent t : src.getRelatesTo()) + tgt.addRelatesTo(convertCompositionRelatesToComponent(t)); + for (org.hl7.fhir.r5.model.Composition.CompositionEventComponent t : src.getEvent()) + tgt.addEvent(convertCompositionEventComponent(t)); + for (org.hl7.fhir.r5.model.Composition.SectionComponent t : src.getSection()) + tgt.addSection(convertSectionComponent(t)); + return tgt; + } + + private static org.hl7.fhir.r5.model.Composition.CompositionStatus convertCompositionStatus(org.hl7.fhir.dstu3.model.Composition.CompositionStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PRELIMINARY: return org.hl7.fhir.r5.model.Composition.CompositionStatus.PRELIMINARY; + case FINAL: return org.hl7.fhir.r5.model.Composition.CompositionStatus.FINAL; + case AMENDED: return org.hl7.fhir.r5.model.Composition.CompositionStatus.AMENDED; + case ENTEREDINERROR: return org.hl7.fhir.r5.model.Composition.CompositionStatus.ENTEREDINERROR; + default: return org.hl7.fhir.r5.model.Composition.CompositionStatus.NULL; + } +} + + private static org.hl7.fhir.dstu3.model.Composition.CompositionStatus convertCompositionStatus(org.hl7.fhir.r5.model.Composition.CompositionStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PRELIMINARY: return org.hl7.fhir.dstu3.model.Composition.CompositionStatus.PRELIMINARY; + case FINAL: return org.hl7.fhir.dstu3.model.Composition.CompositionStatus.FINAL; + case AMENDED: return org.hl7.fhir.dstu3.model.Composition.CompositionStatus.AMENDED; + case ENTEREDINERROR: return org.hl7.fhir.dstu3.model.Composition.CompositionStatus.ENTEREDINERROR; + default: return org.hl7.fhir.dstu3.model.Composition.CompositionStatus.NULL; + } +} + + private static org.hl7.fhir.r5.model.Composition.DocumentConfidentiality convertDocumentConfidentiality(org.hl7.fhir.dstu3.model.Composition.DocumentConfidentiality src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case U: return org.hl7.fhir.r5.model.Composition.DocumentConfidentiality.U; + case L: return org.hl7.fhir.r5.model.Composition.DocumentConfidentiality.L; + case M: return org.hl7.fhir.r5.model.Composition.DocumentConfidentiality.M; + case N: return org.hl7.fhir.r5.model.Composition.DocumentConfidentiality.N; + case R: return org.hl7.fhir.r5.model.Composition.DocumentConfidentiality.R; + case V: return org.hl7.fhir.r5.model.Composition.DocumentConfidentiality.V; + default: return org.hl7.fhir.r5.model.Composition.DocumentConfidentiality.NULL; + } +} + + private static org.hl7.fhir.dstu3.model.Composition.DocumentConfidentiality convertDocumentConfidentiality(org.hl7.fhir.r5.model.Composition.DocumentConfidentiality src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case U: return org.hl7.fhir.dstu3.model.Composition.DocumentConfidentiality.U; + case L: return org.hl7.fhir.dstu3.model.Composition.DocumentConfidentiality.L; + case M: return org.hl7.fhir.dstu3.model.Composition.DocumentConfidentiality.M; + case N: return org.hl7.fhir.dstu3.model.Composition.DocumentConfidentiality.N; + case R: return org.hl7.fhir.dstu3.model.Composition.DocumentConfidentiality.R; + case V: return org.hl7.fhir.dstu3.model.Composition.DocumentConfidentiality.V; + default: return org.hl7.fhir.dstu3.model.Composition.DocumentConfidentiality.NULL; + } +} + + public static org.hl7.fhir.r5.model.Composition.CompositionAttesterComponent convertCompositionAttesterComponent(org.hl7.fhir.dstu3.model.Composition.CompositionAttesterComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Composition.CompositionAttesterComponent tgt = new org.hl7.fhir.r5.model.Composition.CompositionAttesterComponent(); + copyElement(src, tgt); + if (src.hasMode()) + tgt.setMode(convertCompositionAttestationMode(src.getMode().get(0).getValue())); + if (src.hasTime()) + tgt.setTime(src.getTime()); + if (src.hasParty()) + tgt.setParty(convertReference(src.getParty())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Composition.CompositionAttesterComponent convertCompositionAttesterComponent(org.hl7.fhir.r5.model.Composition.CompositionAttesterComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Composition.CompositionAttesterComponent tgt = new org.hl7.fhir.dstu3.model.Composition.CompositionAttesterComponent(); + copyElement(src, tgt); + if (src.hasMode()) + tgt.addMode(convertCompositionAttestationMode(src.getMode())); + if (src.hasTime()) + tgt.setTime(src.getTime()); + if (src.hasParty()) + tgt.setParty(convertReference(src.getParty())); + return tgt; + } + + private static org.hl7.fhir.r5.model.Composition.CompositionAttestationMode convertCompositionAttestationMode(org.hl7.fhir.dstu3.model.Composition.CompositionAttestationMode src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PERSONAL: return org.hl7.fhir.r5.model.Composition.CompositionAttestationMode.PERSONAL; + case PROFESSIONAL: return org.hl7.fhir.r5.model.Composition.CompositionAttestationMode.PROFESSIONAL; + case LEGAL: return org.hl7.fhir.r5.model.Composition.CompositionAttestationMode.LEGAL; + case OFFICIAL: return org.hl7.fhir.r5.model.Composition.CompositionAttestationMode.OFFICIAL; + default: return org.hl7.fhir.r5.model.Composition.CompositionAttestationMode.NULL; + } +} + + private static org.hl7.fhir.dstu3.model.Composition.CompositionAttestationMode convertCompositionAttestationMode(org.hl7.fhir.r5.model.Composition.CompositionAttestationMode src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PERSONAL: return org.hl7.fhir.dstu3.model.Composition.CompositionAttestationMode.PERSONAL; + case PROFESSIONAL: return org.hl7.fhir.dstu3.model.Composition.CompositionAttestationMode.PROFESSIONAL; + case LEGAL: return org.hl7.fhir.dstu3.model.Composition.CompositionAttestationMode.LEGAL; + case OFFICIAL: return org.hl7.fhir.dstu3.model.Composition.CompositionAttestationMode.OFFICIAL; + default: return org.hl7.fhir.dstu3.model.Composition.CompositionAttestationMode.NULL; + } +} + + public static org.hl7.fhir.r5.model.Composition.CompositionRelatesToComponent convertCompositionRelatesToComponent(org.hl7.fhir.dstu3.model.Composition.CompositionRelatesToComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Composition.CompositionRelatesToComponent tgt = new org.hl7.fhir.r5.model.Composition.CompositionRelatesToComponent(); + copyElement(src, tgt); + if (src.hasCode()) + tgt.setCode(convertDocumentRelationshipType(src.getCode())); + if (src.hasTarget()) + tgt.setTarget(convertType(src.getTarget())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Composition.CompositionRelatesToComponent convertCompositionRelatesToComponent(org.hl7.fhir.r5.model.Composition.CompositionRelatesToComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Composition.CompositionRelatesToComponent tgt = new org.hl7.fhir.dstu3.model.Composition.CompositionRelatesToComponent(); + copyElement(src, tgt); + if (src.hasCode()) + tgt.setCode(convertDocumentRelationshipType(src.getCode())); + if (src.hasTarget()) + tgt.setTarget(convertType(src.getTarget())); + return tgt; + } + + private static org.hl7.fhir.r5.model.Composition.DocumentRelationshipType convertDocumentRelationshipType(org.hl7.fhir.dstu3.model.Composition.DocumentRelationshipType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case REPLACES: return org.hl7.fhir.r5.model.Composition.DocumentRelationshipType.REPLACES; + case TRANSFORMS: return org.hl7.fhir.r5.model.Composition.DocumentRelationshipType.TRANSFORMS; + case SIGNS: return org.hl7.fhir.r5.model.Composition.DocumentRelationshipType.SIGNS; + case APPENDS: return org.hl7.fhir.r5.model.Composition.DocumentRelationshipType.APPENDS; + default: return org.hl7.fhir.r5.model.Composition.DocumentRelationshipType.NULL; + } +} + + private static org.hl7.fhir.dstu3.model.Composition.DocumentRelationshipType convertDocumentRelationshipType(org.hl7.fhir.r5.model.Composition.DocumentRelationshipType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case REPLACES: return org.hl7.fhir.dstu3.model.Composition.DocumentRelationshipType.REPLACES; + case TRANSFORMS: return org.hl7.fhir.dstu3.model.Composition.DocumentRelationshipType.TRANSFORMS; + case SIGNS: return org.hl7.fhir.dstu3.model.Composition.DocumentRelationshipType.SIGNS; + case APPENDS: return org.hl7.fhir.dstu3.model.Composition.DocumentRelationshipType.APPENDS; + default: return org.hl7.fhir.dstu3.model.Composition.DocumentRelationshipType.NULL; + } +} + + public static org.hl7.fhir.r5.model.Composition.CompositionEventComponent convertCompositionEventComponent(org.hl7.fhir.dstu3.model.Composition.CompositionEventComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Composition.CompositionEventComponent tgt = new org.hl7.fhir.r5.model.Composition.CompositionEventComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getCode()) + tgt.addCode(convertCodeableConcept(t)); + if (src.hasPeriod()) + tgt.setPeriod(convertPeriod(src.getPeriod())); + for (org.hl7.fhir.dstu3.model.Reference t : src.getDetail()) + tgt.addDetail(convertReference(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Composition.CompositionEventComponent convertCompositionEventComponent(org.hl7.fhir.r5.model.Composition.CompositionEventComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Composition.CompositionEventComponent tgt = new org.hl7.fhir.dstu3.model.Composition.CompositionEventComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getCode()) + tgt.addCode(convertCodeableConcept(t)); + if (src.hasPeriod()) + tgt.setPeriod(convertPeriod(src.getPeriod())); + for (org.hl7.fhir.r5.model.Reference t : src.getDetail()) + tgt.addDetail(convertReference(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.Composition.SectionComponent convertSectionComponent(org.hl7.fhir.dstu3.model.Composition.SectionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Composition.SectionComponent tgt = new org.hl7.fhir.r5.model.Composition.SectionComponent(); + copyElement(src, tgt); + if (src.hasTitle()) + tgt.setTitle(src.getTitle()); + if (src.hasCode()) + tgt.setCode(convertCodeableConcept(src.getCode())); + if (src.hasText()) + tgt.setText(convertNarrative(src.getText())); + if (src.hasMode()) + tgt.setMode(convertSectionMode(src.getMode())); + if (src.hasOrderedBy()) + tgt.setOrderedBy(convertCodeableConcept(src.getOrderedBy())); + for (org.hl7.fhir.dstu3.model.Reference t : src.getEntry()) + tgt.addEntry(convertReference(t)); + if (src.hasEmptyReason()) + tgt.setEmptyReason(convertCodeableConcept(src.getEmptyReason())); + for (org.hl7.fhir.dstu3.model.Composition.SectionComponent t : src.getSection()) + tgt.addSection(convertSectionComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Composition.SectionComponent convertSectionComponent(org.hl7.fhir.r5.model.Composition.SectionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Composition.SectionComponent tgt = new org.hl7.fhir.dstu3.model.Composition.SectionComponent(); + copyElement(src, tgt); + if (src.hasTitle()) + tgt.setTitle(src.getTitle()); + if (src.hasCode()) + tgt.setCode(convertCodeableConcept(src.getCode())); + if (src.hasText()) + tgt.setText(convertNarrative(src.getText())); + if (src.hasMode()) + tgt.setMode(convertSectionMode(src.getMode())); + if (src.hasOrderedBy()) + tgt.setOrderedBy(convertCodeableConcept(src.getOrderedBy())); + for (org.hl7.fhir.r5.model.Reference t : src.getEntry()) + tgt.addEntry(convertReference(t)); + if (src.hasEmptyReason()) + tgt.setEmptyReason(convertCodeableConcept(src.getEmptyReason())); + for (org.hl7.fhir.r5.model.Composition.SectionComponent t : src.getSection()) + tgt.addSection(convertSectionComponent(t)); + return tgt; + } + + private static org.hl7.fhir.r5.model.Composition.SectionMode convertSectionMode(org.hl7.fhir.dstu3.model.Composition.SectionMode src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case WORKING: return org.hl7.fhir.r5.model.Composition.SectionMode.WORKING; + case SNAPSHOT: return org.hl7.fhir.r5.model.Composition.SectionMode.SNAPSHOT; + case CHANGES: return org.hl7.fhir.r5.model.Composition.SectionMode.CHANGES; + default: return org.hl7.fhir.r5.model.Composition.SectionMode.NULL; + } +} + + private static org.hl7.fhir.dstu3.model.Composition.SectionMode convertSectionMode(org.hl7.fhir.r5.model.Composition.SectionMode src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case WORKING: return org.hl7.fhir.dstu3.model.Composition.SectionMode.WORKING; + case SNAPSHOT: return org.hl7.fhir.dstu3.model.Composition.SectionMode.SNAPSHOT; + case CHANGES: return org.hl7.fhir.dstu3.model.Composition.SectionMode.CHANGES; + default: return org.hl7.fhir.dstu3.model.Composition.SectionMode.NULL; + } +} + + public static org.hl7.fhir.r5.model.ConceptMap convertConceptMap(org.hl7.fhir.dstu3.model.ConceptMap src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ConceptMap tgt = new org.hl7.fhir.r5.model.ConceptMap(); + copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + if (src.hasIdentifier()) + tgt.setIdentifier(convertIdentifier(src.getIdentifier())); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasTitle()) + tgt.setTitle(src.getTitle()); + if (src.hasStatus()) + tgt.setStatus(convertPublicationStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) + tgt.addContact(convertContactDetail(t)); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu3.model.UsageContext t : src.getUseContext()) + tgt.addUseContext(convertUsageContext(t)); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction()) + tgt.addJurisdiction(convertCodeableConcept(t)); + if (src.hasPurpose()) + tgt.setPurpose(src.getPurpose()); + if (src.hasCopyright()) + tgt.setCopyright(src.getCopyright()); + if (src.hasSource()) { + org.hl7.fhir.r5.model.Type t = convertType(src.getSource()); + tgt.setSource(t instanceof org.hl7.fhir.r5.model.Reference ? new org.hl7.fhir.r5.model.CanonicalType(((org.hl7.fhir.r5.model.Reference) t).getReference()) : t); + } + if (src.hasTarget()) { + org.hl7.fhir.r5.model.Type t = convertType(src.getTarget()); + tgt.setTarget(t instanceof org.hl7.fhir.r5.model.Reference ? new org.hl7.fhir.r5.model.CanonicalType(((org.hl7.fhir.r5.model.Reference) t).getReference()) : t); + } + for (org.hl7.fhir.dstu3.model.ConceptMap.ConceptMapGroupComponent t : src.getGroup()) + tgt.addGroup(convertConceptMapGroupComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ConceptMap convertConceptMap(org.hl7.fhir.r5.model.ConceptMap src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.ConceptMap tgt = new org.hl7.fhir.dstu3.model.ConceptMap(); + copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + if (src.hasIdentifier()) + tgt.setIdentifier(convertIdentifier(src.getIdentifier())); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasTitle()) + tgt.setTitle(src.getTitle()); + if (src.hasStatus()) + tgt.setStatus(convertPublicationStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.r5.model.ContactDetail t : src.getContact()) + tgt.addContact(convertContactDetail(t)); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.r5.model.UsageContext t : src.getUseContext()) + tgt.addUseContext(convertUsageContext(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getJurisdiction()) + tgt.addJurisdiction(convertCodeableConcept(t)); + if (src.hasPurpose()) + tgt.setPurpose(src.getPurpose()); + if (src.hasCopyright()) + tgt.setCopyright(src.getCopyright()); + if (src.hasSource()) + tgt.setSource(convertType(src.getSource())); + if (src.hasTarget()) + tgt.setTarget(convertType(src.getTarget())); + for (org.hl7.fhir.r5.model.ConceptMap.ConceptMapGroupComponent t : src.getGroup()) + tgt.addGroup(convertConceptMapGroupComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.ConceptMap.ConceptMapGroupComponent convertConceptMapGroupComponent(org.hl7.fhir.dstu3.model.ConceptMap.ConceptMapGroupComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ConceptMap.ConceptMapGroupComponent tgt = new org.hl7.fhir.r5.model.ConceptMap.ConceptMapGroupComponent(); + copyElement(src, tgt); + if (src.hasSource()) + tgt.setSource(src.getSource()); + if (src.hasSourceVersion()) + tgt.setSourceVersion(src.getSourceVersion()); + if (src.hasTarget()) + tgt.setTarget(src.getTarget()); + if (src.hasTargetVersion()) + tgt.setTargetVersion(src.getTargetVersion()); + for (org.hl7.fhir.dstu3.model.ConceptMap.SourceElementComponent t : src.getElement()) + tgt.addElement(convertSourceElementComponent(t)); + if (src.hasUnmapped()) + tgt.setUnmapped(convertConceptMapGroupUnmappedComponent(src.getUnmapped())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ConceptMap.ConceptMapGroupComponent convertConceptMapGroupComponent(org.hl7.fhir.r5.model.ConceptMap.ConceptMapGroupComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.ConceptMap.ConceptMapGroupComponent tgt = new org.hl7.fhir.dstu3.model.ConceptMap.ConceptMapGroupComponent(); + copyElement(src, tgt); + if (src.hasSource()) + tgt.setSource(src.getSource()); + if (src.hasSourceVersion()) + tgt.setSourceVersion(src.getSourceVersion()); + if (src.hasTarget()) + tgt.setTarget(src.getTarget()); + if (src.hasTargetVersion()) + tgt.setTargetVersion(src.getTargetVersion()); + for (org.hl7.fhir.r5.model.ConceptMap.SourceElementComponent t : src.getElement()) + tgt.addElement(convertSourceElementComponent(t)); + if (src.hasUnmapped()) + tgt.setUnmapped(convertConceptMapGroupUnmappedComponent(src.getUnmapped())); + return tgt; + } + + public static org.hl7.fhir.r5.model.ConceptMap.SourceElementComponent convertSourceElementComponent(org.hl7.fhir.dstu3.model.ConceptMap.SourceElementComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ConceptMap.SourceElementComponent tgt = new org.hl7.fhir.r5.model.ConceptMap.SourceElementComponent(); + copyElement(src, tgt); + if (src.hasCode()) + tgt.setCode(src.getCode()); + if (src.hasDisplay()) + tgt.setDisplay(src.getDisplay()); + for (org.hl7.fhir.dstu3.model.ConceptMap.TargetElementComponent t : src.getTarget()) + tgt.addTarget(convertTargetElementComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ConceptMap.SourceElementComponent convertSourceElementComponent(org.hl7.fhir.r5.model.ConceptMap.SourceElementComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.ConceptMap.SourceElementComponent tgt = new org.hl7.fhir.dstu3.model.ConceptMap.SourceElementComponent(); + copyElement(src, tgt); + if (src.hasCode()) + tgt.setCode(src.getCode()); + if (src.hasDisplay()) + tgt.setDisplay(src.getDisplay()); + for (org.hl7.fhir.r5.model.ConceptMap.TargetElementComponent t : src.getTarget()) + tgt.addTarget(convertTargetElementComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.ConceptMap.TargetElementComponent convertTargetElementComponent(org.hl7.fhir.dstu3.model.ConceptMap.TargetElementComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ConceptMap.TargetElementComponent tgt = new org.hl7.fhir.r5.model.ConceptMap.TargetElementComponent(); + copyElement(src, tgt); + if (src.hasCode()) + tgt.setCode(src.getCode()); + if (src.hasDisplay()) + tgt.setDisplay(src.getDisplay()); + if (src.hasEquivalence()) + tgt.setEquivalence(convertConceptMapEquivalence(src.getEquivalence())); + if (src.hasComment()) + tgt.setComment(src.getComment()); + for (org.hl7.fhir.dstu3.model.ConceptMap.OtherElementComponent t : src.getDependsOn()) + tgt.addDependsOn(convertOtherElementComponent(t)); + for (org.hl7.fhir.dstu3.model.ConceptMap.OtherElementComponent t : src.getProduct()) + tgt.addProduct(convertOtherElementComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ConceptMap.TargetElementComponent convertTargetElementComponent(org.hl7.fhir.r5.model.ConceptMap.TargetElementComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.ConceptMap.TargetElementComponent tgt = new org.hl7.fhir.dstu3.model.ConceptMap.TargetElementComponent(); + copyElement(src, tgt); + if (src.hasCode()) + tgt.setCode(src.getCode()); + if (src.hasDisplay()) + tgt.setDisplay(src.getDisplay()); + if (src.hasEquivalence()) + tgt.setEquivalence(convertConceptMapEquivalence(src.getEquivalence())); + if (src.hasComment()) + tgt.setComment(src.getComment()); + for (org.hl7.fhir.r5.model.ConceptMap.OtherElementComponent t : src.getDependsOn()) + tgt.addDependsOn(convertOtherElementComponent(t)); + for (org.hl7.fhir.r5.model.ConceptMap.OtherElementComponent t : src.getProduct()) + tgt.addProduct(convertOtherElementComponent(t)); + return tgt; + } + + private static org.hl7.fhir.r5.model.Enumerations.ConceptMapEquivalence convertConceptMapEquivalence(org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalence src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case RELATEDTO: return org.hl7.fhir.r5.model.Enumerations.ConceptMapEquivalence.RELATEDTO; + case EQUIVALENT: return org.hl7.fhir.r5.model.Enumerations.ConceptMapEquivalence.EQUIVALENT; + case EQUAL: return org.hl7.fhir.r5.model.Enumerations.ConceptMapEquivalence.EQUAL; + case WIDER: return org.hl7.fhir.r5.model.Enumerations.ConceptMapEquivalence.WIDER; + case SUBSUMES: return org.hl7.fhir.r5.model.Enumerations.ConceptMapEquivalence.SUBSUMES; + case NARROWER: return org.hl7.fhir.r5.model.Enumerations.ConceptMapEquivalence.NARROWER; + case SPECIALIZES: return org.hl7.fhir.r5.model.Enumerations.ConceptMapEquivalence.SPECIALIZES; + case INEXACT: return org.hl7.fhir.r5.model.Enumerations.ConceptMapEquivalence.INEXACT; + case UNMATCHED: return org.hl7.fhir.r5.model.Enumerations.ConceptMapEquivalence.UNMATCHED; + case DISJOINT: return org.hl7.fhir.r5.model.Enumerations.ConceptMapEquivalence.DISJOINT; + default: return org.hl7.fhir.r5.model.Enumerations.ConceptMapEquivalence.NULL; + } +} + + private static org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalence convertConceptMapEquivalence(org.hl7.fhir.r5.model.Enumerations.ConceptMapEquivalence src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case RELATEDTO: return org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalence.RELATEDTO; + case EQUIVALENT: return org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalence.EQUIVALENT; + case EQUAL: return org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalence.EQUAL; + case WIDER: return org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalence.WIDER; + case SUBSUMES: return org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalence.SUBSUMES; + case NARROWER: return org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalence.NARROWER; + case SPECIALIZES: return org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalence.SPECIALIZES; + case INEXACT: return org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalence.INEXACT; + case UNMATCHED: return org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalence.UNMATCHED; + case DISJOINT: return org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalence.DISJOINT; + default: return org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalence.NULL; + } +} + + public static org.hl7.fhir.r5.model.ConceptMap.OtherElementComponent convertOtherElementComponent(org.hl7.fhir.dstu3.model.ConceptMap.OtherElementComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ConceptMap.OtherElementComponent tgt = new org.hl7.fhir.r5.model.ConceptMap.OtherElementComponent(); + copyElement(src, tgt); + if (src.hasProperty()) + tgt.setProperty(src.getProperty()); + if (src.hasSystem()) + tgt.setSystem(src.getSystem()); + if (src.hasCode()) + tgt.setValue(src.getCode()); + if (src.hasDisplay()) + tgt.setDisplay(src.getDisplay()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ConceptMap.OtherElementComponent convertOtherElementComponent(org.hl7.fhir.r5.model.ConceptMap.OtherElementComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.ConceptMap.OtherElementComponent tgt = new org.hl7.fhir.dstu3.model.ConceptMap.OtherElementComponent(); + copyElement(src, tgt); + if (src.hasProperty()) + tgt.setProperty(src.getProperty()); + if (src.hasSystem()) + tgt.setSystem(src.getSystem()); + if (src.hasValue()) + tgt.setCode(src.getValue()); + if (src.hasDisplay()) + tgt.setDisplay(src.getDisplay()); + return tgt; + } + + public static org.hl7.fhir.r5.model.ConceptMap.ConceptMapGroupUnmappedComponent convertConceptMapGroupUnmappedComponent(org.hl7.fhir.dstu3.model.ConceptMap.ConceptMapGroupUnmappedComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ConceptMap.ConceptMapGroupUnmappedComponent tgt = new org.hl7.fhir.r5.model.ConceptMap.ConceptMapGroupUnmappedComponent(); + copyElement(src, tgt); + if (src.hasMode()) + tgt.setMode(convertConceptMapGroupUnmappedMode(src.getMode())); + if (src.hasCode()) + tgt.setCode(src.getCode()); + if (src.hasDisplay()) + tgt.setDisplay(src.getDisplay()); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ConceptMap.ConceptMapGroupUnmappedComponent convertConceptMapGroupUnmappedComponent(org.hl7.fhir.r5.model.ConceptMap.ConceptMapGroupUnmappedComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.ConceptMap.ConceptMapGroupUnmappedComponent tgt = new org.hl7.fhir.dstu3.model.ConceptMap.ConceptMapGroupUnmappedComponent(); + copyElement(src, tgt); + if (src.hasMode()) + tgt.setMode(convertConceptMapGroupUnmappedMode(src.getMode())); + if (src.hasCode()) + tgt.setCode(src.getCode()); + if (src.hasDisplay()) + tgt.setDisplay(src.getDisplay()); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + return tgt; + } + + private static org.hl7.fhir.r5.model.ConceptMap.ConceptMapGroupUnmappedMode convertConceptMapGroupUnmappedMode(org.hl7.fhir.dstu3.model.ConceptMap.ConceptMapGroupUnmappedMode src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PROVIDED: return org.hl7.fhir.r5.model.ConceptMap.ConceptMapGroupUnmappedMode.PROVIDED; + case FIXED: return org.hl7.fhir.r5.model.ConceptMap.ConceptMapGroupUnmappedMode.FIXED; + case OTHERMAP: return org.hl7.fhir.r5.model.ConceptMap.ConceptMapGroupUnmappedMode.OTHERMAP; + default: return org.hl7.fhir.r5.model.ConceptMap.ConceptMapGroupUnmappedMode.NULL; + } +} + + private static org.hl7.fhir.dstu3.model.ConceptMap.ConceptMapGroupUnmappedMode convertConceptMapGroupUnmappedMode(org.hl7.fhir.r5.model.ConceptMap.ConceptMapGroupUnmappedMode src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PROVIDED: return org.hl7.fhir.dstu3.model.ConceptMap.ConceptMapGroupUnmappedMode.PROVIDED; + case FIXED: return org.hl7.fhir.dstu3.model.ConceptMap.ConceptMapGroupUnmappedMode.FIXED; + case OTHERMAP: return org.hl7.fhir.dstu3.model.ConceptMap.ConceptMapGroupUnmappedMode.OTHERMAP; + default: return org.hl7.fhir.dstu3.model.ConceptMap.ConceptMapGroupUnmappedMode.NULL; + } +} + + public static org.hl7.fhir.r5.model.Condition convertCondition(org.hl7.fhir.dstu3.model.Condition src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Condition tgt = new org.hl7.fhir.r5.model.Condition(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasClinicalStatus()) + tgt.setClinicalStatus(convertConditionClinicalStatus(src.getClinicalStatus())); + if (src.hasVerificationStatus()) + tgt.setVerificationStatus(convertConditionVerificationStatus(src.getVerificationStatus())); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getCategory()) + tgt.addCategory(convertCodeableConcept(t)); + if (src.hasSeverity()) + tgt.setSeverity(convertCodeableConcept(src.getSeverity())); + if (src.hasCode()) + tgt.setCode(convertCodeableConcept(src.getCode())); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getBodySite()) + tgt.addBodySite(convertCodeableConcept(t)); + if (src.hasSubject()) + tgt.setSubject(convertReference(src.getSubject())); + if (src.hasContext()) + tgt.setEncounter(convertReference(src.getContext())); + if (src.hasOnset()) + tgt.setOnset(convertType(src.getOnset())); + if (src.hasAbatement()) + tgt.setAbatement(convertType(src.getAbatement())); + if (src.hasAssertedDate()) + tgt.setRecordedDate(src.getAssertedDate()); + if (src.hasAsserter()) + tgt.setAsserter(convertReference(src.getAsserter())); + if (src.hasStage()) + tgt.addStage(convertConditionStageComponent(src.getStage())); + for (org.hl7.fhir.dstu3.model.Condition.ConditionEvidenceComponent t : src.getEvidence()) + tgt.addEvidence(convertConditionEvidenceComponent(t)); + for (org.hl7.fhir.dstu3.model.Annotation t : src.getNote()) + tgt.addNote(convertAnnotation(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Condition convertCondition(org.hl7.fhir.r5.model.Condition src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Condition tgt = new org.hl7.fhir.dstu3.model.Condition(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasClinicalStatus()) + tgt.setClinicalStatus(convertConditionClinicalStatus(src.getClinicalStatus())); + if (src.hasVerificationStatus()) + tgt.setVerificationStatus(convertConditionVerificationStatus(src.getVerificationStatus())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getCategory()) + tgt.addCategory(convertCodeableConcept(t)); + if (src.hasSeverity()) + tgt.setSeverity(convertCodeableConcept(src.getSeverity())); + if (src.hasCode()) + tgt.setCode(convertCodeableConcept(src.getCode())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getBodySite()) + tgt.addBodySite(convertCodeableConcept(t)); + if (src.hasSubject()) + tgt.setSubject(convertReference(src.getSubject())); + if (src.hasEncounter()) + tgt.setContext(convertReference(src.getEncounter())); + if (src.hasOnset()) + tgt.setOnset(convertType(src.getOnset())); + if (src.hasAbatement()) + tgt.setAbatement(convertType(src.getAbatement())); + if (src.hasRecordedDate()) + tgt.setAssertedDate(src.getRecordedDate()); + if (src.hasAsserter()) + tgt.setAsserter(convertReference(src.getAsserter())); + if (src.hasStage()) + tgt.setStage(convertConditionStageComponent(src.getStageFirstRep())); + for (org.hl7.fhir.r5.model.Condition.ConditionEvidenceComponent t : src.getEvidence()) + tgt.addEvidence(convertConditionEvidenceComponent(t)); + for (org.hl7.fhir.r5.model.Annotation t : src.getNote()) + tgt.addNote(convertAnnotation(t)); + return tgt; + } + + private static org.hl7.fhir.r5.model.CodeableConcept convertConditionClinicalStatus(org.hl7.fhir.dstu3.model.Condition.ConditionClinicalStatus src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.CodeableConcept cc = new org.hl7.fhir.r5.model.CodeableConcept(); + switch (src) { + case ACTIVE: + cc.addCoding().setSystem("http://hl7.org/fhir/condition-clinical").setCode("active"); + return cc; + case RECURRENCE: + cc.addCoding().setSystem("http://hl7.org/fhir/condition-clinical").setCode("recurrence"); + return cc; + case INACTIVE: + cc.addCoding().setSystem("http://hl7.org/fhir/condition-clinical").setCode("inactive"); + return cc; + case REMISSION: + cc.addCoding().setSystem("http://hl7.org/fhir/condition-clinical").setCode("remission"); + return cc; + case RESOLVED: + cc.addCoding().setSystem("http://hl7.org/fhir/condition-clinical").setCode("resolved"); + return cc; + default: return null; + } + } + + private static org.hl7.fhir.dstu3.model.Condition.ConditionClinicalStatus convertConditionClinicalStatus(org.hl7.fhir.r5.model.CodeableConcept src) throws FHIRException { + if (src == null) + return null; + if (src.hasCoding("http://hl7.org/fhir/condition-clinical", "active")) return org.hl7.fhir.dstu3.model.Condition.ConditionClinicalStatus.ACTIVE; + if (src.hasCoding("http://hl7.org/fhir/condition-clinical", "recurrence")) return org.hl7.fhir.dstu3.model.Condition.ConditionClinicalStatus.RECURRENCE; + if (src.hasCoding("http://hl7.org/fhir/condition-clinical", "inactive")) return org.hl7.fhir.dstu3.model.Condition.ConditionClinicalStatus.INACTIVE; + if (src.hasCoding("http://hl7.org/fhir/condition-clinical", "remission")) return org.hl7.fhir.dstu3.model.Condition.ConditionClinicalStatus.REMISSION; + if (src.hasCoding("http://hl7.org/fhir/condition-clinical", "resolved")) return org.hl7.fhir.dstu3.model.Condition.ConditionClinicalStatus.RESOLVED; + return org.hl7.fhir.dstu3.model.Condition.ConditionClinicalStatus.NULL; + } + + private static org.hl7.fhir.r5.model.CodeableConcept convertConditionVerificationStatus(org.hl7.fhir.dstu3.model.Condition.ConditionVerificationStatus src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.CodeableConcept cc = new org.hl7.fhir.r5.model.CodeableConcept(); + switch (src) { + case PROVISIONAL: + cc.addCoding().setSystem("http://hl7.org/fhir/condition-ver-status").setCode("provisional"); + return cc; + case DIFFERENTIAL: + cc.addCoding().setSystem("http://hl7.org/fhir/condition-ver-status").setCode("differential"); + return cc; + case CONFIRMED: + cc.addCoding().setSystem("http://hl7.org/fhir/condition-ver-status").setCode("confirmed"); + return cc; + case REFUTED: + cc.addCoding().setSystem("http://hl7.org/fhir/condition-ver-status").setCode("refuted"); + return cc; + case ENTEREDINERROR: + cc.addCoding().setSystem("http://hl7.org/fhir/condition-ver-status").setCode("entered-in-error"); + return cc; + default: return null; + } + } + + private static org.hl7.fhir.dstu3.model.Condition.ConditionVerificationStatus convertConditionVerificationStatus(org.hl7.fhir.r5.model.CodeableConcept src) throws FHIRException { + if (src == null) + return null; + if (src.hasCoding("http://hl7.org/fhir/condition-clinical", "provisional")) return org.hl7.fhir.dstu3.model.Condition.ConditionVerificationStatus.PROVISIONAL; + if (src.hasCoding("http://hl7.org/fhir/condition-clinical", "differential")) return org.hl7.fhir.dstu3.model.Condition.ConditionVerificationStatus.DIFFERENTIAL; + if (src.hasCoding("http://hl7.org/fhir/condition-clinical", "confirmed")) return org.hl7.fhir.dstu3.model.Condition.ConditionVerificationStatus.CONFIRMED; + if (src.hasCoding("http://hl7.org/fhir/condition-clinical", "refuted")) return org.hl7.fhir.dstu3.model.Condition.ConditionVerificationStatus.REFUTED; + if (src.hasCoding("http://hl7.org/fhir/condition-clinical", "entered-in-error")) return org.hl7.fhir.dstu3.model.Condition.ConditionVerificationStatus.ENTEREDINERROR; + return org.hl7.fhir.dstu3.model.Condition.ConditionVerificationStatus.NULL; + } + + + public static org.hl7.fhir.r5.model.Condition.ConditionStageComponent convertConditionStageComponent(org.hl7.fhir.dstu3.model.Condition.ConditionStageComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Condition.ConditionStageComponent tgt = new org.hl7.fhir.r5.model.Condition.ConditionStageComponent(); + copyElement(src, tgt); + if (src.hasSummary()) + tgt.setSummary(convertCodeableConcept(src.getSummary())); + for (org.hl7.fhir.dstu3.model.Reference t : src.getAssessment()) + tgt.addAssessment(convertReference(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Condition.ConditionStageComponent convertConditionStageComponent(org.hl7.fhir.r5.model.Condition.ConditionStageComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Condition.ConditionStageComponent tgt = new org.hl7.fhir.dstu3.model.Condition.ConditionStageComponent(); + copyElement(src, tgt); + if (src.hasSummary()) + tgt.setSummary(convertCodeableConcept(src.getSummary())); + for (org.hl7.fhir.r5.model.Reference t : src.getAssessment()) + tgt.addAssessment(convertReference(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.Condition.ConditionEvidenceComponent convertConditionEvidenceComponent(org.hl7.fhir.dstu3.model.Condition.ConditionEvidenceComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Condition.ConditionEvidenceComponent tgt = new org.hl7.fhir.r5.model.Condition.ConditionEvidenceComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getCode()) + tgt.addCode(convertCodeableConcept(t)); + for (org.hl7.fhir.dstu3.model.Reference t : src.getDetail()) + tgt.addDetail(convertReference(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Condition.ConditionEvidenceComponent convertConditionEvidenceComponent(org.hl7.fhir.r5.model.Condition.ConditionEvidenceComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Condition.ConditionEvidenceComponent tgt = new org.hl7.fhir.dstu3.model.Condition.ConditionEvidenceComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getCode()) + tgt.addCode(convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getDetail()) + tgt.addDetail(convertReference(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.Consent convertConsent(org.hl7.fhir.dstu3.model.Consent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Consent tgt = new org.hl7.fhir.r5.model.Consent(); +// copyDomainResource(src, tgt); +// if (src.hasIdentifier()) +// tgt.setIdentifier(convertIdentifier(src.getIdentifier())); +// if (src.hasStatus()) +// tgt.setStatus(convertConsentState(src.getStatus())); +// for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getCategory()) +// tgt.addCategory(convertCodeableConcept(t)); +// if (src.hasPatient()) +// tgt.setPatient(convertReference(src.getPatient())); +// if (src.hasPeriod()) +// tgt.setPeriod(convertPeriod(src.getPeriod())); +// if (src.hasDateTime()) +// tgt.setDateTime(src.getDateTime()); +// for (org.hl7.fhir.dstu3.model.Reference t : src.getConsentingParty()) +// tgt.addConsentingParty(convertReference(t)); +// for (org.hl7.fhir.dstu3.model.Consent.ConsentActorComponent t : src.getActor()) +// tgt.addActor(convertConsentActorComponent(t)); +// for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getAction()) +// tgt.addAction(convertCodeableConcept(t)); +// for (org.hl7.fhir.dstu3.model.Reference t : src.getOrganization()) +// tgt.addOrganization(convertReference(t)); +// if (src.hasSource()) +// tgt.setSource(convertType(src.getSource())); +// for (org.hl7.fhir.dstu3.model.Consent.ConsentPolicyComponent t : src.getPolicy()) +// tgt.addPolicy(convertConsentPolicyComponent(t)); +// if (src.hasPolicyRule()) +// tgt.setPolicyRule(src.getPolicyRule()); +// for (org.hl7.fhir.dstu3.model.Coding t : src.getSecurityLabel()) +// tgt.addSecurityLabel(convertCoding(t)); +// for (org.hl7.fhir.dstu3.model.Coding t : src.getPurpose()) +// tgt.addPurpose(convertCoding(t)); +// if (src.hasDataPeriod()) +// tgt.setDataPeriod(convertPeriod(src.getDataPeriod())); +// for (org.hl7.fhir.dstu3.model.Consent.ConsentDataComponent t : src.getData()) +// tgt.addData(convertConsentDataComponent(t)); +// for (org.hl7.fhir.dstu3.model.Consent.ExceptComponent t : src.getExcept()) +// tgt.addExcept(convertExceptComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Consent convertConsent(org.hl7.fhir.r5.model.Consent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Consent tgt = new org.hl7.fhir.dstu3.model.Consent(); +// copyDomainResource(src, tgt); +// if (src.hasIdentifier()) +// tgt.setIdentifier(convertIdentifier(src.getIdentifier())); +// if (src.hasStatus()) +// tgt.setStatus(convertConsentState(src.getStatus())); +// for (org.hl7.fhir.r5.model.CodeableConcept t : src.getCategory()) +// tgt.addCategory(convertCodeableConcept(t)); +// if (src.hasPatient()) +// tgt.setPatient(convertReference(src.getPatient())); +// if (src.hasPeriod()) +// tgt.setPeriod(convertPeriod(src.getPeriod())); +// if (src.hasDateTime()) +// tgt.setDateTime(src.getDateTime()); +// for (org.hl7.fhir.r5.model.Reference t : src.getConsentingParty()) +// tgt.addConsentingParty(convertReference(t)); +// for (org.hl7.fhir.r5.model.Consent.ConsentActorComponent t : src.getActor()) +// tgt.addActor(convertConsentActorComponent(t)); +// for (org.hl7.fhir.r5.model.CodeableConcept t : src.getAction()) +// tgt.addAction(convertCodeableConcept(t)); +// for (org.hl7.fhir.r5.model.Reference t : src.getOrganization()) +// tgt.addOrganization(convertReference(t)); +// if (src.hasSource()) +// tgt.setSource(convertType(src.getSource())); +// for (org.hl7.fhir.r5.model.Consent.ConsentPolicyComponent t : src.getPolicy()) +// tgt.addPolicy(convertConsentPolicyComponent(t)); +// if (src.hasPolicyRule()) +// tgt.setPolicyRule(src.getPolicyRule()); +// for (org.hl7.fhir.r5.model.Coding t : src.getSecurityLabel()) +// tgt.addSecurityLabel(convertCoding(t)); +// for (org.hl7.fhir.r5.model.Coding t : src.getPurpose()) +// tgt.addPurpose(convertCoding(t)); +// if (src.hasDataPeriod()) +// tgt.setDataPeriod(convertPeriod(src.getDataPeriod())); +// for (org.hl7.fhir.r5.model.Consent.ConsentDataComponent t : src.getData()) +// tgt.addData(convertConsentDataComponent(t)); +// for (org.hl7.fhir.r5.model.Consent.ExceptComponent t : src.getExcept()) +// tgt.addExcept(convertExceptComponent(t)); + return tgt; + } +// +// private static org.hl7.fhir.r5.model.Consent.ConsentState convertConsentState(org.hl7.fhir.dstu3.model.Consent.ConsentState src) throws FHIRException { +// if (src == null) +// return null; +// switch (src) { +// case DRAFT: return org.hl7.fhir.r5.model.Consent.ConsentState.DRAFT; +// case PROPOSED: return org.hl7.fhir.r5.model.Consent.ConsentState.PROPOSED; +// case ACTIVE: return org.hl7.fhir.r5.model.Consent.ConsentState.ACTIVE; +// case REJECTED: return org.hl7.fhir.r5.model.Consent.ConsentState.REJECTED; +// case INACTIVE: return org.hl7.fhir.r5.model.Consent.ConsentState.INACTIVE; +// case ENTEREDINERROR: return org.hl7.fhir.r5.model.Consent.ConsentState.ENTEREDINERROR; +// default: return org.hl7.fhir.r5.model.Consent.ConsentState.NULL; +// } +//} +// +// private static org.hl7.fhir.dstu3.model.Consent.ConsentState convertConsentState(org.hl7.fhir.r5.model.Consent.ConsentState src) throws FHIRException { +// if (src == null) +// return null; +// switch (src) { +// case DRAFT: return org.hl7.fhir.dstu3.model.Consent.ConsentState.DRAFT; +// case PROPOSED: return org.hl7.fhir.dstu3.model.Consent.ConsentState.PROPOSED; +// case ACTIVE: return org.hl7.fhir.dstu3.model.Consent.ConsentState.ACTIVE; +// case REJECTED: return org.hl7.fhir.dstu3.model.Consent.ConsentState.REJECTED; +// case INACTIVE: return org.hl7.fhir.dstu3.model.Consent.ConsentState.INACTIVE; +// case ENTEREDINERROR: return org.hl7.fhir.dstu3.model.Consent.ConsentState.ENTEREDINERROR; +// default: return org.hl7.fhir.dstu3.model.Consent.ConsentState.NULL; +// } +//} +// +// public static org.hl7.fhir.r5.model.Consent.ConsentActorComponent convertConsentActorComponent(org.hl7.fhir.dstu3.model.Consent.ConsentActorComponent src) throws FHIRException { +// if (src == null) +// return null; +// org.hl7.fhir.r5.model.Consent.ConsentActorComponent tgt = new org.hl7.fhir.r5.model.Consent.ConsentActorComponent(); +// copyElement(src, tgt); +// if (src.hasRole()) +// tgt.setRole(convertCodeableConcept(src.getRole())); +// if (src.hasReference()) +// tgt.setReference(convertReference(src.getReference())); +// return tgt; +// } +// +// public static org.hl7.fhir.dstu3.model.Consent.ConsentActorComponent convertConsentActorComponent(org.hl7.fhir.r5.model.Consent.ConsentActorComponent src) throws FHIRException { +// if (src == null) +// return null; +// org.hl7.fhir.dstu3.model.Consent.ConsentActorComponent tgt = new org.hl7.fhir.dstu3.model.Consent.ConsentActorComponent(); +// copyElement(src, tgt); +// if (src.hasRole()) +// tgt.setRole(convertCodeableConcept(src.getRole())); +// if (src.hasReference()) +// tgt.setReference(convertReference(src.getReference())); +// return tgt; +// } + + public static org.hl7.fhir.r5.model.Consent.ConsentPolicyComponent convertConsentPolicyComponent(org.hl7.fhir.dstu3.model.Consent.ConsentPolicyComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Consent.ConsentPolicyComponent tgt = new org.hl7.fhir.r5.model.Consent.ConsentPolicyComponent(); + copyElement(src, tgt); + if (src.hasAuthority()) + tgt.setAuthority(src.getAuthority()); + if (src.hasUri()) + tgt.setUri(src.getUri()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Consent.ConsentPolicyComponent convertConsentPolicyComponent(org.hl7.fhir.r5.model.Consent.ConsentPolicyComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Consent.ConsentPolicyComponent tgt = new org.hl7.fhir.dstu3.model.Consent.ConsentPolicyComponent(); + copyElement(src, tgt); + if (src.hasAuthority()) + tgt.setAuthority(src.getAuthority()); + if (src.hasUri()) + tgt.setUri(src.getUri()); + return tgt; + } +// +// public static org.hl7.fhir.r5.model.Consent.ConsentDataComponent convertConsentDataComponent(org.hl7.fhir.dstu3.model.Consent.ConsentDataComponent src) throws FHIRException { +// if (src == null) +// return null; +// org.hl7.fhir.r5.model.Consent.ConsentDataComponent tgt = new org.hl7.fhir.r5.model.Consent.ConsentDataComponent(); +// copyElement(src, tgt); +// if (src.hasMeaning()) +// tgt.setMeaning(convertConsentDataMeaning(src.getMeaning())); +// if (src.hasReference()) +// tgt.setReference(convertReference(src.getReference())); +// return tgt; +// } +// +// public static org.hl7.fhir.dstu3.model.Consent.ConsentDataComponent convertConsentDataComponent(org.hl7.fhir.r5.model.Consent.ConsentDataComponent src) throws FHIRException { +// if (src == null) +// return null; +// org.hl7.fhir.dstu3.model.Consent.ConsentDataComponent tgt = new org.hl7.fhir.dstu3.model.Consent.ConsentDataComponent(); +// copyElement(src, tgt); +// if (src.hasMeaning()) +// tgt.setMeaning(convertConsentDataMeaning(src.getMeaning())); +// if (src.hasReference()) +// tgt.setReference(convertReference(src.getReference())); +// return tgt; +// } + + private static org.hl7.fhir.r5.model.Consent.ConsentDataMeaning convertConsentDataMeaning(org.hl7.fhir.dstu3.model.Consent.ConsentDataMeaning src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case INSTANCE: return org.hl7.fhir.r5.model.Consent.ConsentDataMeaning.INSTANCE; + case RELATED: return org.hl7.fhir.r5.model.Consent.ConsentDataMeaning.RELATED; + case DEPENDENTS: return org.hl7.fhir.r5.model.Consent.ConsentDataMeaning.DEPENDENTS; + case AUTHOREDBY: return org.hl7.fhir.r5.model.Consent.ConsentDataMeaning.AUTHOREDBY; + default: return org.hl7.fhir.r5.model.Consent.ConsentDataMeaning.NULL; + } +} + + private static org.hl7.fhir.dstu3.model.Consent.ConsentDataMeaning convertConsentDataMeaning(org.hl7.fhir.r5.model.Consent.ConsentDataMeaning src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case INSTANCE: return org.hl7.fhir.dstu3.model.Consent.ConsentDataMeaning.INSTANCE; + case RELATED: return org.hl7.fhir.dstu3.model.Consent.ConsentDataMeaning.RELATED; + case DEPENDENTS: return org.hl7.fhir.dstu3.model.Consent.ConsentDataMeaning.DEPENDENTS; + case AUTHOREDBY: return org.hl7.fhir.dstu3.model.Consent.ConsentDataMeaning.AUTHOREDBY; + default: return org.hl7.fhir.dstu3.model.Consent.ConsentDataMeaning.NULL; + } +} + +// public static org.hl7.fhir.r5.model.Consent.ExceptComponent convertExceptComponent(org.hl7.fhir.dstu3.model.Consent.ExceptComponent src) throws FHIRException { +// if (src == null) +// return null; +// org.hl7.fhir.r5.model.Consent.ExceptComponent tgt = new org.hl7.fhir.r5.model.Consent.ExceptComponent(); +// copyElement(src, tgt); +// if (src.hasType()) +// tgt.setType(convertConsentExceptType(src.getType())); +// if (src.hasPeriod()) +// tgt.setPeriod(convertPeriod(src.getPeriod())); +// for (org.hl7.fhir.dstu3.model.Consent.ExceptActorComponent t : src.getActor()) +// tgt.addActor(convertExceptActorComponent(t)); +// for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getAction()) +// tgt.addAction(convertCodeableConcept(t)); +// for (org.hl7.fhir.dstu3.model.Coding t : src.getSecurityLabel()) +// tgt.addSecurityLabel(convertCoding(t)); +// for (org.hl7.fhir.dstu3.model.Coding t : src.getPurpose()) +// tgt.addPurpose(convertCoding(t)); +// for (org.hl7.fhir.dstu3.model.Coding t : src.getClass_()) +// tgt.addClass_(convertCoding(t)); +// for (org.hl7.fhir.dstu3.model.Coding t : src.getCode()) +// tgt.addCode(convertCoding(t)); +// if (src.hasDataPeriod()) +// tgt.setDataPeriod(convertPeriod(src.getDataPeriod())); +// for (org.hl7.fhir.dstu3.model.Consent.ExceptDataComponent t : src.getData()) +// tgt.addData(convertExceptDataComponent(t)); +// return tgt; +// } +// +// public static org.hl7.fhir.dstu3.model.Consent.ExceptComponent convertExceptComponent(org.hl7.fhir.r5.model.Consent.ExceptComponent src) throws FHIRException { +// if (src == null) +// return null; +// org.hl7.fhir.dstu3.model.Consent.ExceptComponent tgt = new org.hl7.fhir.dstu3.model.Consent.ExceptComponent(); +// copyElement(src, tgt); +// if (src.hasType()) +// tgt.setType(convertConsentExceptType(src.getType())); +// if (src.hasPeriod()) +// tgt.setPeriod(convertPeriod(src.getPeriod())); +// for (org.hl7.fhir.r5.model.Consent.ExceptActorComponent t : src.getActor()) +// tgt.addActor(convertExceptActorComponent(t)); +// for (org.hl7.fhir.r5.model.CodeableConcept t : src.getAction()) +// tgt.addAction(convertCodeableConcept(t)); +// for (org.hl7.fhir.r5.model.Coding t : src.getSecurityLabel()) +// tgt.addSecurityLabel(convertCoding(t)); +// for (org.hl7.fhir.r5.model.Coding t : src.getPurpose()) +// tgt.addPurpose(convertCoding(t)); +// for (org.hl7.fhir.r5.model.Coding t : src.getClass_()) +// tgt.addClass_(convertCoding(t)); +// for (org.hl7.fhir.r5.model.Coding t : src.getCode()) +// tgt.addCode(convertCoding(t)); +// if (src.hasDataPeriod()) +// tgt.setDataPeriod(convertPeriod(src.getDataPeriod())); +// for (org.hl7.fhir.r5.model.Consent.ExceptDataComponent t : src.getData()) +// tgt.addData(convertExceptDataComponent(t)); +// return tgt; +// } +// +// private static org.hl7.fhir.r5.model.Consent.ConsentExceptType convertConsentExceptType(org.hl7.fhir.dstu3.model.Consent.ConsentExceptType src) throws FHIRException { +// if (src == null) +// return null; +// switch (src) { +// case DENY: return org.hl7.fhir.r5.model.Consent.ConsentExceptType.DENY; +// case PERMIT: return org.hl7.fhir.r5.model.Consent.ConsentExceptType.PERMIT; +// default: return org.hl7.fhir.r5.model.Consent.ConsentExceptType.NULL; +// } +//} +// +// private static org.hl7.fhir.dstu3.model.Consent.ConsentExceptType convertConsentExceptType(org.hl7.fhir.r5.model.Consent.ConsentExceptType src) throws FHIRException { +// if (src == null) +// return null; +// switch (src) { +// case DENY: return org.hl7.fhir.dstu3.model.Consent.ConsentExceptType.DENY; +// case PERMIT: return org.hl7.fhir.dstu3.model.Consent.ConsentExceptType.PERMIT; +// default: return org.hl7.fhir.dstu3.model.Consent.ConsentExceptType.NULL; +// } +//} +// +// public static org.hl7.fhir.r5.model.Consent.ExceptActorComponent convertExceptActorComponent(org.hl7.fhir.dstu3.model.Consent.ExceptActorComponent src) throws FHIRException { +// if (src == null) +// return null; +// org.hl7.fhir.r5.model.Consent.ExceptActorComponent tgt = new org.hl7.fhir.r5.model.Consent.ExceptActorComponent(); +// copyElement(src, tgt); +// if (src.hasRole()) +// tgt.setRole(convertCodeableConcept(src.getRole())); +// if (src.hasReference()) +// tgt.setReference(convertReference(src.getReference())); +// return tgt; +// } +// +// public static org.hl7.fhir.dstu3.model.Consent.ExceptActorComponent convertExceptActorComponent(org.hl7.fhir.r5.model.Consent.ExceptActorComponent src) throws FHIRException { +// if (src == null) +// return null; +// org.hl7.fhir.dstu3.model.Consent.ExceptActorComponent tgt = new org.hl7.fhir.dstu3.model.Consent.ExceptActorComponent(); +// copyElement(src, tgt); +// if (src.hasRole()) +// tgt.setRole(convertCodeableConcept(src.getRole())); +// if (src.hasReference()) +// tgt.setReference(convertReference(src.getReference())); +// return tgt; +// } +// +// public static org.hl7.fhir.r5.model.Consent.ExceptDataComponent convertExceptDataComponent(org.hl7.fhir.dstu3.model.Consent.ExceptDataComponent src) throws FHIRException { +// if (src == null) +// return null; +// org.hl7.fhir.r5.model.Consent.ExceptDataComponent tgt = new org.hl7.fhir.r5.model.Consent.ExceptDataComponent(); +// copyElement(src, tgt); +// if (src.hasMeaning()) +// tgt.setMeaning(convertConsentDataMeaning(src.getMeaning())); +// if (src.hasReference()) +// tgt.setReference(convertReference(src.getReference())); +// return tgt; +// } +// +// public static org.hl7.fhir.dstu3.model.Consent.ExceptDataComponent convertExceptDataComponent(org.hl7.fhir.r5.model.Consent.ExceptDataComponent src) throws FHIRException { +// if (src == null) +// return null; +// org.hl7.fhir.dstu3.model.Consent.ExceptDataComponent tgt = new org.hl7.fhir.dstu3.model.Consent.ExceptDataComponent(); +// copyElement(src, tgt); +// if (src.hasMeaning()) +// tgt.setMeaning(convertConsentDataMeaning(src.getMeaning())); +// if (src.hasReference()) +// tgt.setReference(convertReference(src.getReference())); +// return tgt; +// } +// +// public static org.hl7.fhir.r5.model.Contract convertContract(org.hl7.fhir.dstu3.model.Contract src) throws FHIRException { +// if (src == null) +// return null; +// org.hl7.fhir.r5.model.Contract tgt = new org.hl7.fhir.r5.model.Contract(); +// copyDomainResource(src, tgt); +// if (src.hasIdentifier()) +// tgt.setIdentifier(convertIdentifier(src.getIdentifier())); +// if (src.hasStatus()) +// tgt.setStatus(convertContractStatus(src.getStatus())); +// if (src.hasIssued()) +// tgt.setIssued(src.getIssued()); +// if (src.hasApplies()) +// tgt.setApplies(convertPeriod(src.getApplies())); +// for (org.hl7.fhir.dstu3.model.Reference t : src.getSubject()) +// tgt.addSubject(convertReference(t)); +// for (org.hl7.fhir.dstu3.model.Reference t : src.getAuthority()) +// tgt.addAuthority(convertReference(t)); +// for (org.hl7.fhir.dstu3.model.Reference t : src.getDomain()) +// tgt.addDomain(convertReference(t)); +// if (src.hasType()) +// tgt.setType(convertCodeableConcept(src.getType())); +// for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getSubType()) +// tgt.addSubType(convertCodeableConcept(t)); +// if (src.hasContentDerivative()) +// tgt.setContentDerivative(convertCodeableConcept(src.getContentDerivative())); +// for (org.hl7.fhir.dstu3.model.Contract.SignatoryComponent t : src.getSigner()) +// tgt.addSigner(convertSignatoryComponent(t)); +// for (org.hl7.fhir.dstu3.model.Contract.TermComponent t : src.getTerm()) +// tgt.addTerm(convertTermComponent(t)); +// for (org.hl7.fhir.dstu3.model.Contract.FriendlyLanguageComponent t : src.getFriendly()) +// tgt.addFriendly(convertFriendlyLanguageComponent(t)); +// for (org.hl7.fhir.dstu3.model.Contract.LegalLanguageComponent t : src.getLegal()) +// tgt.addLegal(convertLegalLanguageComponent(t)); +// for (org.hl7.fhir.dstu3.model.Contract.ComputableLanguageComponent t : src.getRule()) +// tgt.setRule(convertComputableLanguageComponent(t)); +// return tgt; +// } +// +// public static org.hl7.fhir.dstu3.model.Contract convertContract(org.hl7.fhir.r5.model.Contract src) throws FHIRException { +// if (src == null) +// return null; +// org.hl7.fhir.dstu3.model.Contract tgt = new org.hl7.fhir.dstu3.model.Contract(); +// copyDomainResource(src, tgt); +// if (src.hasIdentifier()) +// tgt.setIdentifier(convertIdentifier(src.getIdentifier())); +// if (src.hasStatus()) +// tgt.setStatus(convertContractStatus(src.getStatus())); +// if (src.hasIssued()) +// tgt.setIssued(src.getIssued()); +// if (src.hasApplies()) +// tgt.setApplies(convertPeriod(src.getApplies())); +// for (org.hl7.fhir.r5.model.Reference t : src.getSubject()) +// tgt.addSubject(convertReference(t)); +// for (org.hl7.fhir.r5.model.Reference t : src.getAuthority()) +// tgt.addAuthority(convertReference(t)); +// for (org.hl7.fhir.r5.model.Reference t : src.getDomain()) +// tgt.addDomain(convertReference(t)); +// if (src.hasType()) +// tgt.setType(convertCodeableConcept(src.getType())); +// for (org.hl7.fhir.r5.model.CodeableConcept t : src.getSubType()) +// tgt.addSubType(convertCodeableConcept(t)); +// if (src.hasContentDerivative()) +// tgt.setContentDerivative(convertCodeableConcept(src.getContentDerivative())); +// for (org.hl7.fhir.r5.model.Contract.SignatoryComponent t : src.getSigner()) +// tgt.addSigner(convertSignatoryComponent(t)); +// for (org.hl7.fhir.r5.model.Contract.TermComponent t : src.getTerm()) +// tgt.addTerm(convertTermComponent(t)); +// for (org.hl7.fhir.r5.model.Contract.FriendlyLanguageComponent t : src.getFriendly()) +// tgt.addFriendly(convertFriendlyLanguageComponent(t)); +// for (org.hl7.fhir.r5.model.Contract.LegalLanguageComponent t : src.getLegal()) +// tgt.addLegal(convertLegalLanguageComponent(t)); +// if (src.hasRule()) +// tgt.addRule(convertComputableLanguageComponent(src.getRule())); +// return tgt; +// } +// +// private static org.hl7.fhir.r5.model.Contract.ContractStatus convertContractStatus(org.hl7.fhir.dstu3.model.Contract.ContractStatus src) throws FHIRException { +// if (src == null) +// return null; +// switch (src) { +// case AMENDED: return org.hl7.fhir.r5.model.Contract.ContractStatus.AMENDED; +// case APPENDED: return org.hl7.fhir.r5.model.Contract.ContractStatus.APPENDED; +// case CANCELLED: return org.hl7.fhir.r5.model.Contract.ContractStatus.CANCELLED; +// case DISPUTED: return org.hl7.fhir.r5.model.Contract.ContractStatus.DISPUTED; +// case ENTEREDINERROR: return org.hl7.fhir.r5.model.Contract.ContractStatus.ENTEREDINERROR; +// case EXECUTABLE: return org.hl7.fhir.r5.model.Contract.ContractStatus.EXECUTABLE; +// case EXECUTED: return org.hl7.fhir.r5.model.Contract.ContractStatus.EXECUTED; +// case NEGOTIABLE: return org.hl7.fhir.r5.model.Contract.ContractStatus.NEGOTIABLE; +// case OFFERED: return org.hl7.fhir.r5.model.Contract.ContractStatus.OFFERED; +// case POLICY: return org.hl7.fhir.r5.model.Contract.ContractStatus.POLICY; +// case REJECTED: return org.hl7.fhir.r5.model.Contract.ContractStatus.REJECTED; +// case RENEWED: return org.hl7.fhir.r5.model.Contract.ContractStatus.RENEWED; +// case REVOKED: return org.hl7.fhir.r5.model.Contract.ContractStatus.REVOKED; +// case RESOLVED: return org.hl7.fhir.r5.model.Contract.ContractStatus.RESOLVED; +// case TERMINATED: return org.hl7.fhir.r5.model.Contract.ContractStatus.TERMINATED; +// default: return org.hl7.fhir.r5.model.Contract.ContractStatus.NULL; +// } +//} +// +// private static org.hl7.fhir.dstu3.model.Contract.ContractStatus convertContractStatus(org.hl7.fhir.r5.model.Contract.ContractStatus src) throws FHIRException { +// if (src == null) +// return null; +// switch (src) { +// case AMENDED: return org.hl7.fhir.dstu3.model.Contract.ContractStatus.AMENDED; +// case APPENDED: return org.hl7.fhir.dstu3.model.Contract.ContractStatus.APPENDED; +// case CANCELLED: return org.hl7.fhir.dstu3.model.Contract.ContractStatus.CANCELLED; +// case DISPUTED: return org.hl7.fhir.dstu3.model.Contract.ContractStatus.DISPUTED; +// case ENTEREDINERROR: return org.hl7.fhir.dstu3.model.Contract.ContractStatus.ENTEREDINERROR; +// case EXECUTABLE: return org.hl7.fhir.dstu3.model.Contract.ContractStatus.EXECUTABLE; +// case EXECUTED: return org.hl7.fhir.dstu3.model.Contract.ContractStatus.EXECUTED; +// case NEGOTIABLE: return org.hl7.fhir.dstu3.model.Contract.ContractStatus.NEGOTIABLE; +// case OFFERED: return org.hl7.fhir.dstu3.model.Contract.ContractStatus.OFFERED; +// case POLICY: return org.hl7.fhir.dstu3.model.Contract.ContractStatus.POLICY; +// case REJECTED: return org.hl7.fhir.dstu3.model.Contract.ContractStatus.REJECTED; +// case RENEWED: return org.hl7.fhir.dstu3.model.Contract.ContractStatus.RENEWED; +// case REVOKED: return org.hl7.fhir.dstu3.model.Contract.ContractStatus.REVOKED; +// case RESOLVED: return org.hl7.fhir.dstu3.model.Contract.ContractStatus.RESOLVED; +// case TERMINATED: return org.hl7.fhir.dstu3.model.Contract.ContractStatus.TERMINATED; +// default: return org.hl7.fhir.dstu3.model.Contract.ContractStatus.NULL; +// } +//} +// +// public static org.hl7.fhir.r5.model.Contract.AgentComponent convertAgentComponent(org.hl7.fhir.dstu3.model.Contract.AgentComponent src) throws FHIRException { +// if (src == null) +// return null; +// org.hl7.fhir.r5.model.Contract.AgentComponent tgt = new org.hl7.fhir.r5.model.Contract.AgentComponent(); +// copyElement(src, tgt); +// if (src.hasActor()) +// tgt.setActor(convertReference(src.getActor())); +// for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getRole()) +// tgt.addRole(convertCodeableConcept(t)); +// return tgt; +// } +// +// public static org.hl7.fhir.dstu3.model.Contract.AgentComponent convertAgentComponent(org.hl7.fhir.r5.model.Contract.AgentComponent src) throws FHIRException { +// if (src == null) +// return null; +// org.hl7.fhir.dstu3.model.Contract.AgentComponent tgt = new org.hl7.fhir.dstu3.model.Contract.AgentComponent(); +// copyElement(src, tgt); +// if (src.hasActor()) +// tgt.setActor(convertReference(src.getActor())); +// for (org.hl7.fhir.r5.model.CodeableConcept t : src.getRole()) +// tgt.addRole(convertCodeableConcept(t)); +// return tgt; +// } +// +// public static org.hl7.fhir.r5.model.Contract.SignatoryComponent convertSignatoryComponent(org.hl7.fhir.dstu3.model.Contract.SignatoryComponent src) throws FHIRException { +// if (src == null) +// return null; +// org.hl7.fhir.r5.model.Contract.SignatoryComponent tgt = new org.hl7.fhir.r5.model.Contract.SignatoryComponent(); +// copyElement(src, tgt); +// if (src.hasType()) +// tgt.setType(convertCoding(src.getType())); +// if (src.hasParty()) +// tgt.setParty(convertReference(src.getParty())); +// for (org.hl7.fhir.dstu3.model.Signature t : src.getSignature()) +// tgt.addSignature(convertSignature(t)); +// return tgt; +// } +// +// public static org.hl7.fhir.dstu3.model.Contract.SignatoryComponent convertSignatoryComponent(org.hl7.fhir.r5.model.Contract.SignatoryComponent src) throws FHIRException { +// if (src == null) +// return null; +// org.hl7.fhir.dstu3.model.Contract.SignatoryComponent tgt = new org.hl7.fhir.dstu3.model.Contract.SignatoryComponent(); +// copyElement(src, tgt); +// if (src.hasType()) +// tgt.setType(convertCoding(src.getType())); +// if (src.hasParty()) +// tgt.setParty(convertReference(src.getParty())); +// for (org.hl7.fhir.r5.model.Signature t : src.getSignature()) +// tgt.addSignature(convertSignature(t)); +// return tgt; +// } +// +// public static org.hl7.fhir.r5.model.Contract.ValuedItemComponent convertValuedItemComponent(org.hl7.fhir.dstu3.model.Contract.ValuedItemComponent src) throws FHIRException { +// if (src == null) +// return null; +// org.hl7.fhir.r5.model.Contract.ValuedItemComponent tgt = new org.hl7.fhir.r5.model.Contract.ValuedItemComponent(); +// copyElement(src, tgt); +// if (src.hasEntity()) +// tgt.setEntity(convertType(src.getEntity())); +// if (src.hasIdentifier()) +// tgt.setIdentifier(convertIdentifier(src.getIdentifier())); +// if (src.hasEffectiveTime()) +// tgt.setEffectiveTime(src.getEffectiveTime()); +// if (src.hasQuantity()) +// tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); +// if (src.hasUnitPrice()) +// tgt.setUnitPrice(convertMoney(src.getUnitPrice())); +// if (src.hasFactor()) +// tgt.setFactor(src.getFactor()); +// if (src.hasPoints()) +// tgt.setPoints(src.getPoints()); +// if (src.hasNet()) +// tgt.setNet(convertMoney(src.getNet())); +// return tgt; +// } +// +// public static org.hl7.fhir.dstu3.model.Contract.ValuedItemComponent convertValuedItemComponent(org.hl7.fhir.r5.model.Contract.ValuedItemComponent src) throws FHIRException { +// if (src == null) +// return null; +// org.hl7.fhir.dstu3.model.Contract.ValuedItemComponent tgt = new org.hl7.fhir.dstu3.model.Contract.ValuedItemComponent(); +// copyElement(src, tgt); +// if (src.hasEntity()) +// tgt.setEntity(convertType(src.getEntity())); +// if (src.hasIdentifier()) +// tgt.setIdentifier(convertIdentifier(src.getIdentifier())); +// if (src.hasEffectiveTime()) +// tgt.setEffectiveTime(src.getEffectiveTime()); +// if (src.hasQuantity()) +// tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); +// if (src.hasUnitPrice()) +// tgt.setUnitPrice(convertMoney(src.getUnitPrice())); +// if (src.hasFactor()) +// tgt.setFactor(src.getFactor()); +// if (src.hasPoints()) +// tgt.setPoints(src.getPoints()); +// if (src.hasNet()) +// tgt.setNet(convertMoney(src.getNet())); +// return tgt; +// } +// +// public static org.hl7.fhir.r5.model.Contract.TermComponent convertTermComponent(org.hl7.fhir.dstu3.model.Contract.TermComponent src) throws FHIRException { +// if (src == null) +// return null; +// org.hl7.fhir.r5.model.Contract.TermComponent tgt = new org.hl7.fhir.r5.model.Contract.TermComponent(); +// copyElement(src, tgt); +// if (src.hasIdentifier()) +// tgt.setIdentifier(convertIdentifier(src.getIdentifier())); +// if (src.hasIssued()) +// tgt.setIssued(src.getIssued()); +// if (src.hasApplies()) +// tgt.setApplies(convertPeriod(src.getApplies())); +// if (src.hasType()) +// tgt.setType(convertCodeableConcept(src.getType())); +// if (src.hasSubType()) +// tgt.setSubType(convertCodeableConcept(src.getSubType())); +// for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getAction()) +// tgt.addAction(convertCodeableConcept(t)); +// for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getActionReason()) +// tgt.addActionReason(convertCodeableConcept(t)); +// for (org.hl7.fhir.dstu3.model.Contract.TermAgentComponent t : src.getAgent()) +// tgt.addAgent(convertTermAgentComponent(t)); +// for (org.hl7.fhir.dstu3.model.Contract.TermComponent t : src.getGroup()) +// tgt.addGroup(convertTermComponent(t)); +// return tgt; +// } +// +// public static org.hl7.fhir.dstu3.model.Contract.TermComponent convertTermComponent(org.hl7.fhir.r5.model.Contract.TermComponent src) throws FHIRException { +// if (src == null) +// return null; +// org.hl7.fhir.dstu3.model.Contract.TermComponent tgt = new org.hl7.fhir.dstu3.model.Contract.TermComponent(); +// copyElement(src, tgt); +// if (src.hasIdentifier()) +// tgt.setIdentifier(convertIdentifier(src.getIdentifier())); +// if (src.hasIssued()) +// tgt.setIssued(src.getIssued()); +// if (src.hasApplies()) +// tgt.setApplies(convertPeriod(src.getApplies())); +// if (src.hasType()) +// tgt.setType(convertCodeableConcept(src.getType())); +// if (src.hasSubType()) +// tgt.setSubType(convertCodeableConcept(src.getSubType())); +// for (org.hl7.fhir.r5.model.CodeableConcept t : src.getAction()) +// tgt.addAction(convertCodeableConcept(t)); +// for (org.hl7.fhir.r5.model.CodeableConcept t : src.getActionReason()) +// tgt.addActionReason(convertCodeableConcept(t)); +// for (org.hl7.fhir.r5.model.Contract.AgentComponent t : src.getAgent()) +// tgt.addAgent(convertTermAgentComponent(t)); +// for (org.hl7.fhir.r5.model.Contract.TermComponent t : src.getGroup()) +// tgt.addGroup(convertTermComponent(t)); +// return tgt; +// } +// +// public static org.hl7.fhir.r5.model.Contract.AgentComponent convertTermAgentComponent(org.hl7.fhir.dstu3.model.Contract.TermAgentComponent src) throws FHIRException { +// if (src == null) +// return null; +// org.hl7.fhir.r5.model.Contract.AgentComponent tgt = new org.hl7.fhir.r5.model.Contract.AgentComponent(); +// copyElement(src, tgt); +// if (src.hasActor()) +// tgt.setActor(convertReference(src.getActor())); +// for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getRole()) +// tgt.addRole(convertCodeableConcept(t)); +// return tgt; +// } +// +// public static org.hl7.fhir.dstu3.model.Contract.TermAgentComponent convertTermAgentComponent(org.hl7.fhir.r5.model.Contract.AgentComponent src) throws FHIRException { +// if (src == null) +// return null; +// org.hl7.fhir.dstu3.model.Contract.TermAgentComponent tgt = new org.hl7.fhir.dstu3.model.Contract.TermAgentComponent(); +// copyElement(src, tgt); +// if (src.hasActor()) +// tgt.setActor(convertReference(src.getActor())); +// for (org.hl7.fhir.r5.model.CodeableConcept t : src.getRole()) +// tgt.addRole(convertCodeableConcept(t)); +// return tgt; +// } +// +// public static org.hl7.fhir.r5.model.Contract.ValuedItemComponent convertTermValuedItemComponent(org.hl7.fhir.dstu3.model.Contract.TermValuedItemComponent src) throws FHIRException { +// if (src == null) +// return null; +// org.hl7.fhir.r5.model.Contract.ValuedItemComponent tgt = new org.hl7.fhir.r5.model.Contract.ValuedItemComponent(); +// copyElement(src, tgt); +// if (src.hasEntity()) +// tgt.setEntity(convertType(src.getEntity())); +// if (src.hasIdentifier()) +// tgt.setIdentifier(convertIdentifier(src.getIdentifier())); +// if (src.hasEffectiveTime()) +// tgt.setEffectiveTime(src.getEffectiveTime()); +// if (src.hasQuantity()) +// tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); +// if (src.hasUnitPrice()) +// tgt.setUnitPrice(convertMoney(src.getUnitPrice())); +// if (src.hasFactor()) +// tgt.setFactor(src.getFactor()); +// if (src.hasPoints()) +// tgt.setPoints(src.getPoints()); +// if (src.hasNet()) +// tgt.setNet(convertMoney(src.getNet())); +// return tgt; +// } +// +// public static org.hl7.fhir.dstu3.model.Contract.TermValuedItemComponent convertTermValuedItemComponent(org.hl7.fhir.r5.model.Contract.ValuedItemComponent src) throws FHIRException { +// if (src == null) +// return null; +// org.hl7.fhir.dstu3.model.Contract.TermValuedItemComponent tgt = new org.hl7.fhir.dstu3.model.Contract.TermValuedItemComponent(); +// copyElement(src, tgt); +// if (src.hasEntity()) +// tgt.setEntity(convertType(src.getEntity())); +// if (src.hasIdentifier()) +// tgt.setIdentifier(convertIdentifier(src.getIdentifier())); +// if (src.hasEffectiveTime()) +// tgt.setEffectiveTime(src.getEffectiveTime()); +// if (src.hasQuantity()) +// tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); +// if (src.hasUnitPrice()) +// tgt.setUnitPrice(convertMoney(src.getUnitPrice())); +// if (src.hasFactor()) +// tgt.setFactor(src.getFactor()); +// if (src.hasPoints()) +// tgt.setPoints(src.getPoints()); +// if (src.hasNet()) +// tgt.setNet(convertMoney(src.getNet())); +// return tgt; +// } +// +// public static org.hl7.fhir.r5.model.Contract.FriendlyLanguageComponent convertFriendlyLanguageComponent(org.hl7.fhir.dstu3.model.Contract.FriendlyLanguageComponent src) throws FHIRException { +// if (src == null) +// return null; +// org.hl7.fhir.r5.model.Contract.FriendlyLanguageComponent tgt = new org.hl7.fhir.r5.model.Contract.FriendlyLanguageComponent(); +// copyElement(src, tgt); +// if (src.hasContent()) +// tgt.setContent(convertType(src.getContent())); +// return tgt; +// } +// +// public static org.hl7.fhir.dstu3.model.Contract.FriendlyLanguageComponent convertFriendlyLanguageComponent(org.hl7.fhir.r5.model.Contract.FriendlyLanguageComponent src) throws FHIRException { +// if (src == null) +// return null; +// org.hl7.fhir.dstu3.model.Contract.FriendlyLanguageComponent tgt = new org.hl7.fhir.dstu3.model.Contract.FriendlyLanguageComponent(); +// copyElement(src, tgt); +// if (src.hasContent()) +// tgt.setContent(convertType(src.getContent())); +// return tgt; +// } +// +// public static org.hl7.fhir.r5.model.Contract.LegalLanguageComponent convertLegalLanguageComponent(org.hl7.fhir.dstu3.model.Contract.LegalLanguageComponent src) throws FHIRException { +// if (src == null) +// return null; +// org.hl7.fhir.r5.model.Contract.LegalLanguageComponent tgt = new org.hl7.fhir.r5.model.Contract.LegalLanguageComponent(); +// copyElement(src, tgt); +// if (src.hasContent()) +// tgt.setContent(convertType(src.getContent())); +// return tgt; +// } +// +// public static org.hl7.fhir.dstu3.model.Contract.LegalLanguageComponent convertLegalLanguageComponent(org.hl7.fhir.r5.model.Contract.LegalLanguageComponent src) throws FHIRException { +// if (src == null) +// return null; +// org.hl7.fhir.dstu3.model.Contract.LegalLanguageComponent tgt = new org.hl7.fhir.dstu3.model.Contract.LegalLanguageComponent(); +// copyElement(src, tgt); +// if (src.hasContent()) +// tgt.setContent(convertType(src.getContent())); +// return tgt; +// } +// +// public static org.hl7.fhir.r5.model.Contract.ComputableLanguageComponent convertComputableLanguageComponent(org.hl7.fhir.dstu3.model.Contract.ComputableLanguageComponent src) throws FHIRException { +// if (src == null) +// return null; +// org.hl7.fhir.r5.model.Contract.ComputableLanguageComponent tgt = new org.hl7.fhir.r5.model.Contract.ComputableLanguageComponent(); +// copyElement(src, tgt); +// if (src.hasContent()) +// tgt.setContent(convertType(src.getContent())); +// return tgt; +// } +// +// public static org.hl7.fhir.dstu3.model.Contract.ComputableLanguageComponent convertComputableLanguageComponent(org.hl7.fhir.r5.model.Contract.ComputableLanguageComponent src) throws FHIRException { +// if (src == null) +// return null; +// org.hl7.fhir.dstu3.model.Contract.ComputableLanguageComponent tgt = new org.hl7.fhir.dstu3.model.Contract.ComputableLanguageComponent(); +// copyElement(src, tgt); +// if (src.hasContent()) +// tgt.setContent(convertType(src.getContent())); +// return tgt; +// } +// +// public static org.hl7.fhir.r5.model.Coverage convertCoverage(org.hl7.fhir.dstu3.model.Coverage src) throws FHIRException { +// if (src == null) +// return null; +// org.hl7.fhir.r5.model.Coverage tgt = new org.hl7.fhir.r5.model.Coverage(); +// copyDomainResource(src, tgt); +// for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) +// tgt.addIdentifier(convertIdentifier(t)); +// if (src.hasStatus()) +// tgt.setStatus(convertCoverageStatus(src.getStatus())); +// if (src.hasType()) +// tgt.setType(convertCodeableConcept(src.getType())); +// if (src.hasPolicyHolder()) +// tgt.setPolicyHolder(convertReference(src.getPolicyHolder())); +// if (src.hasSubscriber()) +// tgt.setSubscriber(convertReference(src.getSubscriber())); +// if (src.hasSubscriberId()) +// tgt.setSubscriberId(src.getSubscriberId()); +// if (src.hasBeneficiary()) +// tgt.setBeneficiary(convertReference(src.getBeneficiary())); +// if (src.hasRelationship()) +// tgt.setRelationship(convertCodeableConcept(src.getRelationship())); +// if (src.hasPeriod()) +// tgt.setPeriod(convertPeriod(src.getPeriod())); +// for (org.hl7.fhir.dstu3.model.Reference t : src.getPayor()) +// tgt.addPayor(convertReference(t)); +// if (src.hasGrouping()) +// tgt.setGrouping(convertGroupComponent(src.getGrouping())); +// if (src.hasDependent()) +// tgt.setDependent(src.getDependent()); +// if (src.hasSequence()) +// tgt.setSequence(src.getSequence()); +// if (src.hasOrder()) +// tgt.setOrder(src.getOrder()); +// if (src.hasNetwork()) +// tgt.setNetwork(src.getNetwork()); +// for (org.hl7.fhir.dstu3.model.Reference t : src.getContract()) +// tgt.addContract(convertReference(t)); +// return tgt; +// } +// +// public static org.hl7.fhir.dstu3.model.Coverage convertCoverage(org.hl7.fhir.r5.model.Coverage src) throws FHIRException { +// if (src == null) +// return null; +// org.hl7.fhir.dstu3.model.Coverage tgt = new org.hl7.fhir.dstu3.model.Coverage(); +// copyDomainResource(src, tgt); +// for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) +// tgt.addIdentifier(convertIdentifier(t)); +// if (src.hasStatus()) +// tgt.setStatus(convertCoverageStatus(src.getStatus())); +// if (src.hasType()) +// tgt.setType(convertCodeableConcept(src.getType())); +// if (src.hasPolicyHolder()) +// tgt.setPolicyHolder(convertReference(src.getPolicyHolder())); +// if (src.hasSubscriber()) +// tgt.setSubscriber(convertReference(src.getSubscriber())); +// if (src.hasSubscriberId()) +// tgt.setSubscriberId(src.getSubscriberId()); +// if (src.hasBeneficiary()) +// tgt.setBeneficiary(convertReference(src.getBeneficiary())); +// if (src.hasRelationship()) +// tgt.setRelationship(convertCodeableConcept(src.getRelationship())); +// if (src.hasPeriod()) +// tgt.setPeriod(convertPeriod(src.getPeriod())); +// for (org.hl7.fhir.r5.model.Reference t : src.getPayor()) +// tgt.addPayor(convertReference(t)); +// if (src.hasGrouping()) +// tgt.setGrouping(convertGroupComponent(src.getGrouping())); +// if (src.hasDependent()) +// tgt.setDependent(src.getDependent()); +// if (src.hasSequence()) +// tgt.setSequence(src.getSequence()); +// if (src.hasOrder()) +// tgt.setOrder(src.getOrder()); +// if (src.hasNetwork()) +// tgt.setNetwork(src.getNetwork()); +// for (org.hl7.fhir.r5.model.Reference t : src.getContract()) +// tgt.addContract(convertReference(t)); +// return tgt; +// } +// +// private static org.hl7.fhir.r5.model.Coverage.CoverageStatus convertCoverageStatus(org.hl7.fhir.dstu3.model.Coverage.CoverageStatus src) throws FHIRException { +// if (src == null) +// return null; +// switch (src) { +// case ACTIVE: return org.hl7.fhir.r5.model.Coverage.CoverageStatus.ACTIVE; +// case CANCELLED: return org.hl7.fhir.r5.model.Coverage.CoverageStatus.CANCELLED; +// case DRAFT: return org.hl7.fhir.r5.model.Coverage.CoverageStatus.DRAFT; +// case ENTEREDINERROR: return org.hl7.fhir.r5.model.Coverage.CoverageStatus.ENTEREDINERROR; +// default: return org.hl7.fhir.r5.model.Coverage.CoverageStatus.NULL; +// } +//} +// +// private static org.hl7.fhir.dstu3.model.Coverage.CoverageStatus convertCoverageStatus(org.hl7.fhir.r5.model.Coverage.CoverageStatus src) throws FHIRException { +// if (src == null) +// return null; +// switch (src) { +// case ACTIVE: return org.hl7.fhir.dstu3.model.Coverage.CoverageStatus.ACTIVE; +// case CANCELLED: return org.hl7.fhir.dstu3.model.Coverage.CoverageStatus.CANCELLED; +// case DRAFT: return org.hl7.fhir.dstu3.model.Coverage.CoverageStatus.DRAFT; +// case ENTEREDINERROR: return org.hl7.fhir.dstu3.model.Coverage.CoverageStatus.ENTEREDINERROR; +// default: return org.hl7.fhir.dstu3.model.Coverage.CoverageStatus.NULL; +// } +//} +// +// public static org.hl7.fhir.r5.model.Coverage.GroupComponent convertGroupComponent(org.hl7.fhir.dstu3.model.Coverage.GroupComponent src) throws FHIRException { +// if (src == null) +// return null; +// org.hl7.fhir.r5.model.Coverage.GroupComponent tgt = new org.hl7.fhir.r5.model.Coverage.GroupComponent(); +// copyElement(src, tgt); +// if (src.hasGroup()) +// tgt.setGroup(src.getGroup()); +// if (src.hasGroupDisplay()) +// tgt.setGroupDisplay(src.getGroupDisplay()); +// if (src.hasSubGroup()) +// tgt.setSubGroup(src.getSubGroup()); +// if (src.hasSubGroupDisplay()) +// tgt.setSubGroupDisplay(src.getSubGroupDisplay()); +// if (src.hasPlan()) +// tgt.setPlan(src.getPlan()); +// if (src.hasPlanDisplay()) +// tgt.setPlanDisplay(src.getPlanDisplay()); +// if (src.hasSubPlan()) +// tgt.setSubPlan(src.getSubPlan()); +// if (src.hasSubPlanDisplay()) +// tgt.setSubPlanDisplay(src.getSubPlanDisplay()); +// if (src.hasClass_()) +// tgt.setClass_(src.getClass_()); +// if (src.hasClassDisplay()) +// tgt.setClassDisplay(src.getClassDisplay()); +// if (src.hasSubClass()) +// tgt.setSubClass(src.getSubClass()); +// if (src.hasSubClassDisplay()) +// tgt.setSubClassDisplay(src.getSubClassDisplay()); +// return tgt; +// } +// +// public static org.hl7.fhir.dstu3.model.Coverage.GroupComponent convertGroupComponent(org.hl7.fhir.r5.model.Coverage.GroupComponent src) throws FHIRException { +// if (src == null) +// return null; +// org.hl7.fhir.dstu3.model.Coverage.GroupComponent tgt = new org.hl7.fhir.dstu3.model.Coverage.GroupComponent(); +// copyElement(src, tgt); +// if (src.hasGroup()) +// tgt.setGroup(src.getGroup()); +// if (src.hasGroupDisplay()) +// tgt.setGroupDisplay(src.getGroupDisplay()); +// if (src.hasSubGroup()) +// tgt.setSubGroup(src.getSubGroup()); +// if (src.hasSubGroupDisplay()) +// tgt.setSubGroupDisplay(src.getSubGroupDisplay()); +// if (src.hasPlan()) +// tgt.setPlan(src.getPlan()); +// if (src.hasPlanDisplay()) +// tgt.setPlanDisplay(src.getPlanDisplay()); +// if (src.hasSubPlan()) +// tgt.setSubPlan(src.getSubPlan()); +// if (src.hasSubPlanDisplay()) +// tgt.setSubPlanDisplay(src.getSubPlanDisplay()); +// if (src.hasClass_()) +// tgt.setClass_(src.getClass_()); +// if (src.hasClassDisplay()) +// tgt.setClassDisplay(src.getClassDisplay()); +// if (src.hasSubClass()) +// tgt.setSubClass(src.getSubClass()); +// if (src.hasSubClassDisplay()) +// tgt.setSubClassDisplay(src.getSubClassDisplay()); +// return tgt; +// } +// + public static org.hl7.fhir.r5.model.StructureDefinition convertDataElement(org.hl7.fhir.dstu3.model.DataElement src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.StructureDefinition tgt = new org.hl7.fhir.r5.model.StructureDefinition(); + copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl().replace("/DataElement/", "/StructureDefinition/de-")); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasStatus()) + tgt.setStatus(convertPublicationStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasTitle()) + tgt.setTitle(src.getTitle()); + for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) + tgt.addContact(convertContactDetail(t)); + for (org.hl7.fhir.dstu3.model.UsageContext t : src.getUseContext()) + tgt.addUseContext(convertUsageContext(t)); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction()) + tgt.addJurisdiction(convertCodeableConcept(t)); + if (src.hasCopyright()) + tgt.setCopyright(src.getCopyright()); +// if (src.hasStringency()) +// tgt.setStringency(convertDataElementStringency(src.getStringency())); + for (org.hl7.fhir.dstu3.model.DataElement.DataElementMappingComponent t : src.getMapping()) + tgt.addMapping(convertDataElementMappingComponent(t)); + for (org.hl7.fhir.dstu3.model.ElementDefinition t : src.getElement()) + tgt.getSnapshot().addElement(convertElementDefinition(t)); + tgt.setKind(org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionKind.COMPLEXTYPE); + tgt.setAbstract(false); + tgt.setType(tgt.getName()); + tgt.setBaseDefinition("http://hl7.org/fhir/StructureDefinition/Element"); + tgt.setDerivation(org.hl7.fhir.r5.model.StructureDefinition.TypeDerivationRule.SPECIALIZATION); + return tgt; + } + +// public static org.hl7.fhir.dstu3.model.DataElement convertDataElement(org.hl7.fhir.r5.model.DataElement src) throws FHIRException { +// if (src == null) +// return null; +// org.hl7.fhir.dstu3.model.DataElement tgt = new org.hl7.fhir.dstu3.model.DataElement(); +// copyDomainResource(src, tgt); +// if (src.hasUrl()) +// tgt.setUrl(src.getUrl()); +// for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) +// tgt.addIdentifier(convertIdentifier(t)); +// if (src.hasVersion()) +// tgt.setVersion(src.getVersion()); +// if (src.hasStatus()) +// tgt.setStatus(convertPublicationStatus(src.getStatus())); +// if (src.hasExperimental()) +// tgt.setExperimental(src.getExperimental()); +// if (src.hasDate()) +// tgt.setDate(src.getDate()); +// if (src.hasPublisher()) +// tgt.setPublisher(src.getPublisher()); +// if (src.hasName()) +// tgt.setName(src.getName()); +// if (src.hasTitle()) +// tgt.setTitle(src.getTitle()); +// for (org.hl7.fhir.r5.model.ContactDetail t : src.getContact()) +// tgt.addContact(convertContactDetail(t)); +// for (org.hl7.fhir.r5.model.UsageContext t : src.getUseContext()) +// tgt.addUseContext(convertUsageContext(t)); +// for (org.hl7.fhir.r5.model.CodeableConcept t : src.getJurisdiction()) +// tgt.addJurisdiction(convertCodeableConcept(t)); +// if (src.hasCopyright()) +// tgt.setCopyright(src.getCopyright()); +// if (src.hasStringency()) +// tgt.setStringency(convertDataElementStringency(src.getStringency())); +// for (org.hl7.fhir.r5.model.DataElement.DataElementMappingComponent t : src.getMapping()) +// tgt.addMapping(convertDataElementMappingComponent(t)); +// for (org.hl7.fhir.r5.model.ElementDefinition t : src.getElement()) +// tgt.addElement(convertElementDefinition(t)); +// return tgt; +// } + +// private static org.hl7.fhir.r5.model.DataElement.DataElementStringency convertDataElementStringency(org.hl7.fhir.dstu3.model.DataElement.DataElementStringency src) throws FHIRException { +// if (src == null) +// return null; +// switch (src) { +// case COMPARABLE: return org.hl7.fhir.r5.model.DataElement.DataElementStringency.COMPARABLE; +// case FULLYSPECIFIED: return org.hl7.fhir.r5.model.DataElement.DataElementStringency.FULLYSPECIFIED; +// case EQUIVALENT: return org.hl7.fhir.r5.model.DataElement.DataElementStringency.EQUIVALENT; +// case CONVERTABLE: return org.hl7.fhir.r5.model.DataElement.DataElementStringency.CONVERTABLE; +// case SCALEABLE: return org.hl7.fhir.r5.model.DataElement.DataElementStringency.SCALEABLE; +// case FLEXIBLE: return org.hl7.fhir.r5.model.DataElement.DataElementStringency.FLEXIBLE; +// default: return org.hl7.fhir.r5.model.DataElement.DataElementStringency.NULL; +// } +//} +// +// private static org.hl7.fhir.dstu3.model.DataElement.DataElementStringency convertDataElementStringency(org.hl7.fhir.r5.model.DataElement.DataElementStringency src) throws FHIRException { +// if (src == null) +// return null; +// switch (src) { +// case COMPARABLE: return org.hl7.fhir.dstu3.model.DataElement.DataElementStringency.COMPARABLE; +// case FULLYSPECIFIED: return org.hl7.fhir.dstu3.model.DataElement.DataElementStringency.FULLYSPECIFIED; +// case EQUIVALENT: return org.hl7.fhir.dstu3.model.DataElement.DataElementStringency.EQUIVALENT; +// case CONVERTABLE: return org.hl7.fhir.dstu3.model.DataElement.DataElementStringency.CONVERTABLE; +// case SCALEABLE: return org.hl7.fhir.dstu3.model.DataElement.DataElementStringency.SCALEABLE; +// case FLEXIBLE: return org.hl7.fhir.dstu3.model.DataElement.DataElementStringency.FLEXIBLE; +// default: return org.hl7.fhir.dstu3.model.DataElement.DataElementStringency.NULL; +// } +//} + + public static org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionMappingComponent convertDataElementMappingComponent(org.hl7.fhir.dstu3.model.DataElement.DataElementMappingComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionMappingComponent tgt = new org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionMappingComponent(); + copyElement(src, tgt); + if (src.hasIdentity()) + tgt.setIdentity(src.getIdentity()); + if (src.hasUri()) + tgt.setUri(src.getUri()); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasComment()) + tgt.setComment(src.getComment()); + return tgt; + } + +// public static org.hl7.fhir.dstu3.model.DataElement.DataElementMappingComponent convertDataElementMappingComponent(org.hl7.fhir.r5.model.DataElement.DataElementMappingComponent src) throws FHIRException { +// if (src == null) +// return null; +// org.hl7.fhir.dstu3.model.DataElement.DataElementMappingComponent tgt = new org.hl7.fhir.dstu3.model.DataElement.DataElementMappingComponent(); +// copyElement(src, tgt); +// if (src.hasIdentity()) +// tgt.setIdentity(src.getIdentity()); +// if (src.hasUri()) +// tgt.setUri(src.getUri()); +// if (src.hasName()) +// tgt.setName(src.getName()); +// if (src.hasComment()) +// tgt.setComment(src.getComment()); +// return tgt; +// } + + public static org.hl7.fhir.r5.model.DetectedIssue convertDetectedIssue(org.hl7.fhir.dstu3.model.DetectedIssue src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.DetectedIssue tgt = new org.hl7.fhir.r5.model.DetectedIssue(); + copyDomainResource(src, tgt); + if (src.hasIdentifier()) + tgt.addIdentifier(convertIdentifier(src.getIdentifier())); + if (src.hasStatus()) + tgt.setStatus(convertDetectedIssueStatus(src.getStatus())); + if (src.hasCategory()) + tgt.setCode(convertCodeableConcept(src.getCategory())); + if (src.hasSeverity()) + tgt.setSeverity(convertDetectedIssueSeverity(src.getSeverity())); + if (src.hasPatient()) + tgt.setPatient(convertReference(src.getPatient())); + if (src.hasDate()) + tgt.setIdentified(convertDateTime(src.getDateElement())); + if (src.hasAuthor()) + tgt.setAuthor(convertReference(src.getAuthor())); + for (org.hl7.fhir.dstu3.model.Reference t : src.getImplicated()) + tgt.addImplicated(convertReference(t)); + if (src.hasDetail()) + tgt.setDetail(src.getDetail()); + if (src.hasReference()) + tgt.setReference(src.getReference()); + for (org.hl7.fhir.dstu3.model.DetectedIssue.DetectedIssueMitigationComponent t : src.getMitigation()) + tgt.addMitigation(convertDetectedIssueMitigationComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.DetectedIssue convertDetectedIssue(org.hl7.fhir.r5.model.DetectedIssue src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.DetectedIssue tgt = new org.hl7.fhir.dstu3.model.DetectedIssue(); + copyDomainResource(src, tgt); + if (src.hasIdentifier()) + tgt.setIdentifier(convertIdentifier(src.getIdentifierFirstRep())); + if (src.hasStatus()) + tgt.setStatus(convertDetectedIssueStatus(src.getStatus())); + if (src.hasCode()) + tgt.setCategory(convertCodeableConcept(src.getCode())); + if (src.hasSeverity()) + tgt.setSeverity(convertDetectedIssueSeverity(src.getSeverity())); + if (src.hasPatient()) + tgt.setPatient(convertReference(src.getPatient())); + if (src.hasIdentifiedDateTimeType()) + tgt.setDateElement(convertDateTime(src.getIdentifiedDateTimeType())); + if (src.hasAuthor()) + tgt.setAuthor(convertReference(src.getAuthor())); + for (org.hl7.fhir.r5.model.Reference t : src.getImplicated()) + tgt.addImplicated(convertReference(t)); + if (src.hasDetail()) + tgt.setDetail(src.getDetail()); + if (src.hasReference()) + tgt.setReference(src.getReference()); + for (org.hl7.fhir.r5.model.DetectedIssue.DetectedIssueMitigationComponent t : src.getMitigation()) + tgt.addMitigation(convertDetectedIssueMitigationComponent(t)); + return tgt; + } + + private static org.hl7.fhir.r5.model.DetectedIssue.DetectedIssueStatus convertDetectedIssueStatus(org.hl7.fhir.dstu3.model.DetectedIssue.DetectedIssueStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case REGISTERED: return org.hl7.fhir.r5.model.DetectedIssue.DetectedIssueStatus.REGISTERED; + case PRELIMINARY: return org.hl7.fhir.r5.model.DetectedIssue.DetectedIssueStatus.PRELIMINARY; + case FINAL: return org.hl7.fhir.r5.model.DetectedIssue.DetectedIssueStatus.FINAL; + case AMENDED: return org.hl7.fhir.r5.model.DetectedIssue.DetectedIssueStatus.AMENDED; + case CORRECTED: return org.hl7.fhir.r5.model.DetectedIssue.DetectedIssueStatus.CORRECTED; + case CANCELLED: return org.hl7.fhir.r5.model.DetectedIssue.DetectedIssueStatus.CANCELLED; + case ENTEREDINERROR: return org.hl7.fhir.r5.model.DetectedIssue.DetectedIssueStatus.ENTEREDINERROR; + case UNKNOWN: return org.hl7.fhir.r5.model.DetectedIssue.DetectedIssueStatus.UNKNOWN; + default: return org.hl7.fhir.r5.model.DetectedIssue.DetectedIssueStatus.NULL; + } +} + + private static org.hl7.fhir.dstu3.model.DetectedIssue.DetectedIssueStatus convertDetectedIssueStatus(org.hl7.fhir.r5.model.DetectedIssue.DetectedIssueStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case REGISTERED: return org.hl7.fhir.dstu3.model.DetectedIssue.DetectedIssueStatus.REGISTERED; + case PRELIMINARY: return org.hl7.fhir.dstu3.model.DetectedIssue.DetectedIssueStatus.PRELIMINARY; + case FINAL: return org.hl7.fhir.dstu3.model.DetectedIssue.DetectedIssueStatus.FINAL; + case AMENDED: return org.hl7.fhir.dstu3.model.DetectedIssue.DetectedIssueStatus.AMENDED; + case CORRECTED: return org.hl7.fhir.dstu3.model.DetectedIssue.DetectedIssueStatus.CORRECTED; + case CANCELLED: return org.hl7.fhir.dstu3.model.DetectedIssue.DetectedIssueStatus.CANCELLED; + case ENTEREDINERROR: return org.hl7.fhir.dstu3.model.DetectedIssue.DetectedIssueStatus.ENTEREDINERROR; + case UNKNOWN: return org.hl7.fhir.dstu3.model.DetectedIssue.DetectedIssueStatus.UNKNOWN; + default: return org.hl7.fhir.dstu3.model.DetectedIssue.DetectedIssueStatus.NULL; + } +} + + private static org.hl7.fhir.r5.model.DetectedIssue.DetectedIssueSeverity convertDetectedIssueSeverity(org.hl7.fhir.dstu3.model.DetectedIssue.DetectedIssueSeverity src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case HIGH: return org.hl7.fhir.r5.model.DetectedIssue.DetectedIssueSeverity.HIGH; + case MODERATE: return org.hl7.fhir.r5.model.DetectedIssue.DetectedIssueSeverity.MODERATE; + case LOW: return org.hl7.fhir.r5.model.DetectedIssue.DetectedIssueSeverity.LOW; + default: return org.hl7.fhir.r5.model.DetectedIssue.DetectedIssueSeverity.NULL; + } +} + + private static org.hl7.fhir.dstu3.model.DetectedIssue.DetectedIssueSeverity convertDetectedIssueSeverity(org.hl7.fhir.r5.model.DetectedIssue.DetectedIssueSeverity src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case HIGH: return org.hl7.fhir.dstu3.model.DetectedIssue.DetectedIssueSeverity.HIGH; + case MODERATE: return org.hl7.fhir.dstu3.model.DetectedIssue.DetectedIssueSeverity.MODERATE; + case LOW: return org.hl7.fhir.dstu3.model.DetectedIssue.DetectedIssueSeverity.LOW; + default: return org.hl7.fhir.dstu3.model.DetectedIssue.DetectedIssueSeverity.NULL; + } +} + + public static org.hl7.fhir.r5.model.DetectedIssue.DetectedIssueMitigationComponent convertDetectedIssueMitigationComponent(org.hl7.fhir.dstu3.model.DetectedIssue.DetectedIssueMitigationComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.DetectedIssue.DetectedIssueMitigationComponent tgt = new org.hl7.fhir.r5.model.DetectedIssue.DetectedIssueMitigationComponent(); + copyElement(src, tgt); + if (src.hasAction()) + tgt.setAction(convertCodeableConcept(src.getAction())); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasAuthor()) + tgt.setAuthor(convertReference(src.getAuthor())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.DetectedIssue.DetectedIssueMitigationComponent convertDetectedIssueMitigationComponent(org.hl7.fhir.r5.model.DetectedIssue.DetectedIssueMitigationComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.DetectedIssue.DetectedIssueMitigationComponent tgt = new org.hl7.fhir.dstu3.model.DetectedIssue.DetectedIssueMitigationComponent(); + copyElement(src, tgt); + if (src.hasAction()) + tgt.setAction(convertCodeableConcept(src.getAction())); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasAuthor()) + tgt.setAuthor(convertReference(src.getAuthor())); + return tgt; + } + +// public static org.hl7.fhir.r5.model.Device convertDevice(org.hl7.fhir.dstu3.model.Device src) throws FHIRException { +// if (src == null) +// return null; +// org.hl7.fhir.r5.model.Device tgt = new org.hl7.fhir.r5.model.Device(); +// copyDomainResource(src, tgt); +// for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) +// tgt.addIdentifier(convertIdentifier(t)); +// if (src.hasUdi()) +// tgt.setUdi(convertDeviceUdiComponent(src.getUdi())); +// if (src.hasStatus()) +// tgt.setStatus(convertFHIRDeviceStatus(src.getStatus())); +// if (src.hasType()) +// tgt.setType(convertCodeableConcept(src.getType())); +// if (src.hasLotNumber()) +// tgt.setLotNumber(src.getLotNumber()); +// if (src.hasManufacturer()) +// tgt.setManufacturer(src.getManufacturer()); +// if (src.hasManufactureDate()) +// tgt.setManufactureDate(src.getManufactureDate()); +// if (src.hasExpirationDate()) +// tgt.setExpirationDate(src.getExpirationDate()); +// if (src.hasModel()) +// tgt.setModel(src.getModel()); +// if (src.hasVersion()) +// tgt.setVersion(src.getVersion()); +// if (src.hasPatient()) +// tgt.setPatient(convertReference(src.getPatient())); +// if (src.hasOwner()) +// tgt.setOwner(convertReference(src.getOwner())); +// for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getContact()) +// tgt.addContact(convertContactPoint(t)); +// if (src.hasLocation()) +// tgt.setLocation(convertReference(src.getLocation())); +// if (src.hasUrl()) +// tgt.setUrl(src.getUrl()); +// for (org.hl7.fhir.dstu3.model.Annotation t : src.getNote()) +// tgt.addNote(convertAnnotation(t)); +// for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getSafety()) +// tgt.addSafety(convertCodeableConcept(t)); +// return tgt; +// } +// +// public static org.hl7.fhir.dstu3.model.Device convertDevice(org.hl7.fhir.r5.model.Device src) throws FHIRException { +// if (src == null) +// return null; +// org.hl7.fhir.dstu3.model.Device tgt = new org.hl7.fhir.dstu3.model.Device(); +// copyDomainResource(src, tgt); +// for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) +// tgt.addIdentifier(convertIdentifier(t)); +// if (src.hasUdi()) +// tgt.setUdi(convertDeviceUdiComponent(src.getUdi())); +// if (src.hasStatus()) +// tgt.setStatus(convertFHIRDeviceStatus(src.getStatus())); +// if (src.hasType()) +// tgt.setType(convertCodeableConcept(src.getType())); +// if (src.hasLotNumber()) +// tgt.setLotNumber(src.getLotNumber()); +// if (src.hasManufacturer()) +// tgt.setManufacturer(src.getManufacturer()); +// if (src.hasManufactureDate()) +// tgt.setManufactureDate(src.getManufactureDate()); +// if (src.hasExpirationDate()) +// tgt.setExpirationDate(src.getExpirationDate()); +// if (src.hasModel()) +// tgt.setModel(src.getModel()); +// if (src.hasVersion()) +// tgt.setVersion(src.getVersion()); +// if (src.hasPatient()) +// tgt.setPatient(convertReference(src.getPatient())); +// if (src.hasOwner()) +// tgt.setOwner(convertReference(src.getOwner())); +// for (org.hl7.fhir.r5.model.ContactPoint t : src.getContact()) +// tgt.addContact(convertContactPoint(t)); +// if (src.hasLocation()) +// tgt.setLocation(convertReference(src.getLocation())); +// if (src.hasUrl()) +// tgt.setUrl(src.getUrl()); +// for (org.hl7.fhir.r5.model.Annotation t : src.getNote()) +// tgt.addNote(convertAnnotation(t)); +// for (org.hl7.fhir.r5.model.CodeableConcept t : src.getSafety()) +// tgt.addSafety(convertCodeableConcept(t)); +// return tgt; +// } +// +// private static org.hl7.fhir.r5.model.Device.FHIRDeviceStatus convertFHIRDeviceStatus(org.hl7.fhir.dstu3.model.Device.FHIRDeviceStatus src) throws FHIRException { +// if (src == null) +// return null; +// switch (src) { +// case ACTIVE: return org.hl7.fhir.r5.model.Device.FHIRDeviceStatus.ACTIVE; +// case INACTIVE: return org.hl7.fhir.r5.model.Device.FHIRDeviceStatus.INACTIVE; +// case ENTEREDINERROR: return org.hl7.fhir.r5.model.Device.FHIRDeviceStatus.ENTEREDINERROR; +// case UNKNOWN: return org.hl7.fhir.r5.model.Device.FHIRDeviceStatus.UNKNOWN; +// default: return org.hl7.fhir.r5.model.Device.FHIRDeviceStatus.NULL; +// } +//} +// +// private static org.hl7.fhir.dstu3.model.Device.FHIRDeviceStatus convertFHIRDeviceStatus(org.hl7.fhir.r5.model.Device.FHIRDeviceStatus src) throws FHIRException { +// if (src == null) +// return null; +// switch (src) { +// case ACTIVE: return org.hl7.fhir.dstu3.model.Device.FHIRDeviceStatus.ACTIVE; +// case INACTIVE: return org.hl7.fhir.dstu3.model.Device.FHIRDeviceStatus.INACTIVE; +// case ENTEREDINERROR: return org.hl7.fhir.dstu3.model.Device.FHIRDeviceStatus.ENTEREDINERROR; +// case UNKNOWN: return org.hl7.fhir.dstu3.model.Device.FHIRDeviceStatus.UNKNOWN; +// default: return org.hl7.fhir.dstu3.model.Device.FHIRDeviceStatus.NULL; +// } +//} +// +// public static org.hl7.fhir.r5.model.Device.DeviceUdiComponent convertDeviceUdiComponent(org.hl7.fhir.dstu3.model.Device.DeviceUdiComponent src) throws FHIRException { +// if (src == null) +// return null; +// org.hl7.fhir.r5.model.Device.DeviceUdiComponent tgt = new org.hl7.fhir.r5.model.Device.DeviceUdiComponent(); +// copyElement(src, tgt); +// if (src.hasDeviceIdentifier()) +// tgt.setDeviceIdentifier(src.getDeviceIdentifier()); +// if (src.hasName()) +// tgt.setName(src.getName()); +// if (src.hasJurisdiction()) +// tgt.setJurisdiction(src.getJurisdiction()); +// if (src.hasCarrierHRF()) +// tgt.setCarrierHRF(src.getCarrierHRF()); +// if (src.hasCarrierAIDC()) +// tgt.setCarrierAIDC(src.getCarrierAIDC()); +// if (src.hasIssuer()) +// tgt.setIssuer(src.getIssuer()); +// if (src.hasEntryType()) +// tgt.setEntryType(convertUDIEntryType(src.getEntryType())); +// return tgt; +// } +// +// public static org.hl7.fhir.dstu3.model.Device.DeviceUdiComponent convertDeviceUdiComponent(org.hl7.fhir.r5.model.Device.DeviceUdiComponent src) throws FHIRException { +// if (src == null) +// return null; +// org.hl7.fhir.dstu3.model.Device.DeviceUdiComponent tgt = new org.hl7.fhir.dstu3.model.Device.DeviceUdiComponent(); +// copyElement(src, tgt); +// if (src.hasDeviceIdentifier()) +// tgt.setDeviceIdentifier(src.getDeviceIdentifier()); +// if (src.hasName()) +// tgt.setName(src.getName()); +// if (src.hasJurisdiction()) +// tgt.setJurisdiction(src.getJurisdiction()); +// if (src.hasCarrierHRF()) +// tgt.setCarrierHRF(src.getCarrierHRF()); +// if (src.hasCarrierAIDC()) +// tgt.setCarrierAIDC(src.getCarrierAIDC()); +// if (src.hasIssuer()) +// tgt.setIssuer(src.getIssuer()); +// if (src.hasEntryType()) +// tgt.setEntryType(convertUDIEntryType(src.getEntryType())); +// return tgt; +// } +// +// private static org.hl7.fhir.r5.model.Device.UDIEntryType convertUDIEntryType(org.hl7.fhir.dstu3.model.Device.UDIEntryType src) throws FHIRException { +// if (src == null) +// return null; +// switch (src) { +// case BARCODE: return org.hl7.fhir.r5.model.Device.UDIEntryType.BARCODE; +// case RFID: return org.hl7.fhir.r5.model.Device.UDIEntryType.RFID; +// case MANUAL: return org.hl7.fhir.r5.model.Device.UDIEntryType.MANUAL; +// case CARD: return org.hl7.fhir.r5.model.Device.UDIEntryType.CARD; +// case SELFREPORTED: return org.hl7.fhir.r5.model.Device.UDIEntryType.SELFREPORTED; +// case UNKNOWN: return org.hl7.fhir.r5.model.Device.UDIEntryType.UNKNOWN; +// default: return org.hl7.fhir.r5.model.Device.UDIEntryType.NULL; +// } +//} +// +// private static org.hl7.fhir.dstu3.model.Device.UDIEntryType convertUDIEntryType(org.hl7.fhir.r5.model.Device.UDIEntryType src) throws FHIRException { +// if (src == null) +// return null; +// switch (src) { +// case BARCODE: return org.hl7.fhir.dstu3.model.Device.UDIEntryType.BARCODE; +// case RFID: return org.hl7.fhir.dstu3.model.Device.UDIEntryType.RFID; +// case MANUAL: return org.hl7.fhir.dstu3.model.Device.UDIEntryType.MANUAL; +// case CARD: return org.hl7.fhir.dstu3.model.Device.UDIEntryType.CARD; +// case SELFREPORTED: return org.hl7.fhir.dstu3.model.Device.UDIEntryType.SELFREPORTED; +// case UNKNOWN: return org.hl7.fhir.dstu3.model.Device.UDIEntryType.UNKNOWN; +// default: return org.hl7.fhir.dstu3.model.Device.UDIEntryType.NULL; +// } +//} +// +// public static org.hl7.fhir.r5.model.DeviceComponent convertDeviceComponent(org.hl7.fhir.dstu3.model.DeviceComponent src) throws FHIRException { +// if (src == null) +// return null; +// org.hl7.fhir.r5.model.DeviceComponent tgt = new org.hl7.fhir.r5.model.DeviceComponent(); +// copyDomainResource(src, tgt); +// if (src.hasIdentifier()) +// tgt.addIdentifier(convertIdentifier(src.getIdentifier())); +// if (src.hasType()) +// tgt.setType(convertCodeableConcept(src.getType())); +// if (src.hasLastSystemChange()) +// tgt.setLastSystemChange(src.getLastSystemChange()); +// if (src.hasSource()) +// tgt.setSource(convertReference(src.getSource())); +// if (src.hasParent()) +// tgt.setParent(convertReference(src.getParent())); +// for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getOperationalStatus()) +// tgt.addOperationalStatus(convertCodeableConcept(t)); +// if (src.hasParameterGroup()) +// tgt.setParameterGroup(convertCodeableConcept(src.getParameterGroup())); +// if (src.hasMeasurementPrinciple()) +// tgt.setMeasurementPrinciple(convertMeasmntPrinciple(src.getMeasurementPrinciple())); +// for (org.hl7.fhir.dstu3.model.DeviceComponent.DeviceComponentProductionSpecificationComponent t : src.getProductionSpecification()) +// tgt.addProductionSpecification(convertDeviceComponentProductionSpecificationComponent(t)); +// if (src.hasLanguageCode()) +// tgt.setLanguageCode(convertCodeableConcept(src.getLanguageCode())); +// return tgt; +// } +// +// public static org.hl7.fhir.dstu3.model.DeviceComponent convertDeviceComponent(org.hl7.fhir.r5.model.DeviceComponent src) throws FHIRException { +// if (src == null) +// return null; +// org.hl7.fhir.dstu3.model.DeviceComponent tgt = new org.hl7.fhir.dstu3.model.DeviceComponent(); +// copyDomainResource(src, tgt); +// if (src.hasIdentifier()) +// tgt.setIdentifier(convertIdentifier(src.getIdentifierFirstRep())); +// if (src.hasType()) +// tgt.setType(convertCodeableConcept(src.getType())); +// if (src.hasLastSystemChange()) +// tgt.setLastSystemChange(src.getLastSystemChange()); +// if (src.hasSource()) +// tgt.setSource(convertReference(src.getSource())); +// if (src.hasParent()) +// tgt.setParent(convertReference(src.getParent())); +// for (org.hl7.fhir.r5.model.CodeableConcept t : src.getOperationalStatus()) +// tgt.addOperationalStatus(convertCodeableConcept(t)); +// if (src.hasParameterGroup()) +// tgt.setParameterGroup(convertCodeableConcept(src.getParameterGroup())); +// if (src.hasMeasurementPrinciple()) +// tgt.setMeasurementPrinciple(convertMeasmntPrinciple(src.getMeasurementPrinciple())); +// for (org.hl7.fhir.r5.model.DeviceComponent.DeviceComponentProductionSpecificationComponent t : src.getProductionSpecification()) +// tgt.addProductionSpecification(convertDeviceComponentProductionSpecificationComponent(t)); +// if (src.hasLanguageCode()) +// tgt.setLanguageCode(convertCodeableConcept(src.getLanguageCode())); +// return tgt; +// } +// +// private static org.hl7.fhir.r5.model.DeviceComponent.MeasmntPrinciple convertMeasmntPrinciple(org.hl7.fhir.dstu3.model.DeviceComponent.MeasmntPrinciple src) throws FHIRException { +// if (src == null) +// return null; +// switch (src) { +// case OTHER: return org.hl7.fhir.r5.model.DeviceComponent.MeasmntPrinciple.OTHER; +// case CHEMICAL: return org.hl7.fhir.r5.model.DeviceComponent.MeasmntPrinciple.CHEMICAL; +// case ELECTRICAL: return org.hl7.fhir.r5.model.DeviceComponent.MeasmntPrinciple.ELECTRICAL; +// case IMPEDANCE: return org.hl7.fhir.r5.model.DeviceComponent.MeasmntPrinciple.IMPEDANCE; +// case NUCLEAR: return org.hl7.fhir.r5.model.DeviceComponent.MeasmntPrinciple.NUCLEAR; +// case OPTICAL: return org.hl7.fhir.r5.model.DeviceComponent.MeasmntPrinciple.OPTICAL; +// case THERMAL: return org.hl7.fhir.r5.model.DeviceComponent.MeasmntPrinciple.THERMAL; +// case BIOLOGICAL: return org.hl7.fhir.r5.model.DeviceComponent.MeasmntPrinciple.BIOLOGICAL; +// case MECHANICAL: return org.hl7.fhir.r5.model.DeviceComponent.MeasmntPrinciple.MECHANICAL; +// case ACOUSTICAL: return org.hl7.fhir.r5.model.DeviceComponent.MeasmntPrinciple.ACOUSTICAL; +// case MANUAL: return org.hl7.fhir.r5.model.DeviceComponent.MeasmntPrinciple.MANUAL; +// default: return org.hl7.fhir.r5.model.DeviceComponent.MeasmntPrinciple.NULL; +// } +//} +// +// private static org.hl7.fhir.dstu3.model.DeviceComponent.MeasmntPrinciple convertMeasmntPrinciple(org.hl7.fhir.r5.model.DeviceComponent.MeasmntPrinciple src) throws FHIRException { +// if (src == null) +// return null; +// switch (src) { +// case OTHER: return org.hl7.fhir.dstu3.model.DeviceComponent.MeasmntPrinciple.OTHER; +// case CHEMICAL: return org.hl7.fhir.dstu3.model.DeviceComponent.MeasmntPrinciple.CHEMICAL; +// case ELECTRICAL: return org.hl7.fhir.dstu3.model.DeviceComponent.MeasmntPrinciple.ELECTRICAL; +// case IMPEDANCE: return org.hl7.fhir.dstu3.model.DeviceComponent.MeasmntPrinciple.IMPEDANCE; +// case NUCLEAR: return org.hl7.fhir.dstu3.model.DeviceComponent.MeasmntPrinciple.NUCLEAR; +// case OPTICAL: return org.hl7.fhir.dstu3.model.DeviceComponent.MeasmntPrinciple.OPTICAL; +// case THERMAL: return org.hl7.fhir.dstu3.model.DeviceComponent.MeasmntPrinciple.THERMAL; +// case BIOLOGICAL: return org.hl7.fhir.dstu3.model.DeviceComponent.MeasmntPrinciple.BIOLOGICAL; +// case MECHANICAL: return org.hl7.fhir.dstu3.model.DeviceComponent.MeasmntPrinciple.MECHANICAL; +// case ACOUSTICAL: return org.hl7.fhir.dstu3.model.DeviceComponent.MeasmntPrinciple.ACOUSTICAL; +// case MANUAL: return org.hl7.fhir.dstu3.model.DeviceComponent.MeasmntPrinciple.MANUAL; +// default: return org.hl7.fhir.dstu3.model.DeviceComponent.MeasmntPrinciple.NULL; +// } +//} +// +// public static org.hl7.fhir.r5.model.DeviceComponent.DeviceComponentProductionSpecificationComponent convertDeviceComponentProductionSpecificationComponent(org.hl7.fhir.dstu3.model.DeviceComponent.DeviceComponentProductionSpecificationComponent src) throws FHIRException { +// if (src == null) +// return null; +// org.hl7.fhir.r5.model.DeviceComponent.DeviceComponentProductionSpecificationComponent tgt = new org.hl7.fhir.r5.model.DeviceComponent.DeviceComponentProductionSpecificationComponent(); +// copyElement(src, tgt); +// if (src.hasSpecType()) +// tgt.setSpecType(convertCodeableConcept(src.getSpecType())); +// if (src.hasComponentId()) +// tgt.setComponentId(convertIdentifier(src.getComponentId())); +// if (src.hasProductionSpec()) +// tgt.setProductionSpec(src.getProductionSpec()); +// return tgt; +// } +// +// public static org.hl7.fhir.dstu3.model.DeviceComponent.DeviceComponentProductionSpecificationComponent convertDeviceComponentProductionSpecificationComponent(org.hl7.fhir.r5.model.DeviceComponent.DeviceComponentProductionSpecificationComponent src) throws FHIRException { +// if (src == null) +// return null; +// org.hl7.fhir.dstu3.model.DeviceComponent.DeviceComponentProductionSpecificationComponent tgt = new org.hl7.fhir.dstu3.model.DeviceComponent.DeviceComponentProductionSpecificationComponent(); +// copyElement(src, tgt); +// if (src.hasSpecType()) +// tgt.setSpecType(convertCodeableConcept(src.getSpecType())); +// if (src.hasComponentId()) +// tgt.setComponentId(convertIdentifier(src.getComponentId())); +// if (src.hasProductionSpec()) +// tgt.setProductionSpec(src.getProductionSpec()); +// return tgt; +// } +// +// public static org.hl7.fhir.r5.model.DeviceMetric convertDeviceMetric(org.hl7.fhir.dstu3.model.DeviceMetric src) throws FHIRException { +// if (src == null) +// return null; +// org.hl7.fhir.r5.model.DeviceMetric tgt = new org.hl7.fhir.r5.model.DeviceMetric(); +// copyDomainResource(src, tgt); +// if (src.hasIdentifier()) +// tgt.addIdentifier(convertIdentifier(src.getIdentifier())); +// if (src.hasType()) +// tgt.setType(convertCodeableConcept(src.getType())); +// if (src.hasUnit()) +// tgt.setUnit(convertCodeableConcept(src.getUnit())); +// if (src.hasSource()) +// tgt.setSource(convertReference(src.getSource())); +// if (src.hasParent()) +// tgt.setParent(convertReference(src.getParent())); +// if (src.hasOperationalStatus()) +// tgt.setOperationalStatus(convertDeviceMetricOperationalStatus(src.getOperationalStatus())); +// if (src.hasColor()) +// tgt.setColor(convertDeviceMetricColor(src.getColor())); +// if (src.hasCategory()) +// tgt.setCategory(convertDeviceMetricCategory(src.getCategory())); +// if (src.hasMeasurementPeriod()) +// tgt.setMeasurementPeriod(convertTiming(src.getMeasurementPeriod())); +// for (org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCalibrationComponent t : src.getCalibration()) +// tgt.addCalibration(convertDeviceMetricCalibrationComponent(t)); +// return tgt; +// } +// +// public static org.hl7.fhir.dstu3.model.DeviceMetric convertDeviceMetric(org.hl7.fhir.r5.model.DeviceMetric src) throws FHIRException { +// if (src == null) +// return null; +// org.hl7.fhir.dstu3.model.DeviceMetric tgt = new org.hl7.fhir.dstu3.model.DeviceMetric(); +// copyDomainResource(src, tgt); +// if (src.hasIdentifier()) +// tgt.setIdentifier(convertIdentifier(src.getIdentifierFirstRep())); +// if (src.hasType()) +// tgt.setType(convertCodeableConcept(src.getType())); +// if (src.hasUnit()) +// tgt.setUnit(convertCodeableConcept(src.getUnit())); +// if (src.hasSource()) +// tgt.setSource(convertReference(src.getSource())); +// if (src.hasParent()) +// tgt.setParent(convertReference(src.getParent())); +// if (src.hasOperationalStatus()) +// tgt.setOperationalStatus(convertDeviceMetricOperationalStatus(src.getOperationalStatus())); +// if (src.hasColor()) +// tgt.setColor(convertDeviceMetricColor(src.getColor())); +// if (src.hasCategory()) +// tgt.setCategory(convertDeviceMetricCategory(src.getCategory())); +// if (src.hasMeasurementPeriod()) +// tgt.setMeasurementPeriod(convertTiming(src.getMeasurementPeriod())); +// for (org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricCalibrationComponent t : src.getCalibration()) +// tgt.addCalibration(convertDeviceMetricCalibrationComponent(t)); +// return tgt; +// } +// +// private static org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricOperationalStatus convertDeviceMetricOperationalStatus(org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricOperationalStatus src) throws FHIRException { +// if (src == null) +// return null; +// switch (src) { +// case ON: return org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricOperationalStatus.ON; +// case OFF: return org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricOperationalStatus.OFF; +// case STANDBY: return org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricOperationalStatus.STANDBY; +// case ENTEREDINERROR: return org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricOperationalStatus.ENTEREDINERROR; +// default: return org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricOperationalStatus.NULL; +// } +//} +// +// private static org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricOperationalStatus convertDeviceMetricOperationalStatus(org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricOperationalStatus src) throws FHIRException { +// if (src == null) +// return null; +// switch (src) { +// case ON: return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricOperationalStatus.ON; +// case OFF: return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricOperationalStatus.OFF; +// case STANDBY: return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricOperationalStatus.STANDBY; +// case ENTEREDINERROR: return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricOperationalStatus.ENTEREDINERROR; +// default: return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricOperationalStatus.NULL; +// } +//} +// +// private static org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricColor convertDeviceMetricColor(org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricColor src) throws FHIRException { +// if (src == null) +// return null; +// switch (src) { +// case BLACK: return org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricColor.BLACK; +// case RED: return org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricColor.RED; +// case GREEN: return org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricColor.GREEN; +// case YELLOW: return org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricColor.YELLOW; +// case BLUE: return org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricColor.BLUE; +// case MAGENTA: return org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricColor.MAGENTA; +// case CYAN: return org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricColor.CYAN; +// case WHITE: return org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricColor.WHITE; +// default: return org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricColor.NULL; +// } +//} +// +// private static org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricColor convertDeviceMetricColor(org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricColor src) throws FHIRException { +// if (src == null) +// return null; +// switch (src) { +// case BLACK: return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricColor.BLACK; +// case RED: return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricColor.RED; +// case GREEN: return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricColor.GREEN; +// case YELLOW: return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricColor.YELLOW; +// case BLUE: return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricColor.BLUE; +// case MAGENTA: return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricColor.MAGENTA; +// case CYAN: return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricColor.CYAN; +// case WHITE: return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricColor.WHITE; +// default: return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricColor.NULL; +// } +//} +// +// private static org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricCategory convertDeviceMetricCategory(org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCategory src) throws FHIRException { +// if (src == null) +// return null; +// switch (src) { +// case MEASUREMENT: return org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricCategory.MEASUREMENT; +// case SETTING: return org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricCategory.SETTING; +// case CALCULATION: return org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricCategory.CALCULATION; +// case UNSPECIFIED: return org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricCategory.UNSPECIFIED; +// default: return org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricCategory.NULL; +// } +//} +// +// private static org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCategory convertDeviceMetricCategory(org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricCategory src) throws FHIRException { +// if (src == null) +// return null; +// switch (src) { +// case MEASUREMENT: return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCategory.MEASUREMENT; +// case SETTING: return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCategory.SETTING; +// case CALCULATION: return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCategory.CALCULATION; +// case UNSPECIFIED: return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCategory.UNSPECIFIED; +// default: return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCategory.NULL; +// } +//} +// +// public static org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricCalibrationComponent convertDeviceMetricCalibrationComponent(org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCalibrationComponent src) throws FHIRException { +// if (src == null) +// return null; +// org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricCalibrationComponent tgt = new org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricCalibrationComponent(); +// copyElement(src, tgt); +// if (src.hasType()) +// tgt.setType(convertDeviceMetricCalibrationType(src.getType())); +// if (src.hasState()) +// tgt.setState(convertDeviceMetricCalibrationState(src.getState())); +// if (src.hasTime()) +// tgt.setTime(src.getTime()); +// return tgt; +// } +// +// public static org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCalibrationComponent convertDeviceMetricCalibrationComponent(org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricCalibrationComponent src) throws FHIRException { +// if (src == null) +// return null; +// org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCalibrationComponent tgt = new org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCalibrationComponent(); +// copyElement(src, tgt); +// if (src.hasType()) +// tgt.setType(convertDeviceMetricCalibrationType(src.getType())); +// if (src.hasState()) +// tgt.setState(convertDeviceMetricCalibrationState(src.getState())); +// if (src.hasTime()) +// tgt.setTime(src.getTime()); +// return tgt; +// } +// +// private static org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricCalibrationType convertDeviceMetricCalibrationType(org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCalibrationType src) throws FHIRException { +// if (src == null) +// return null; +// switch (src) { +// case UNSPECIFIED: return org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricCalibrationType.UNSPECIFIED; +// case OFFSET: return org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricCalibrationType.OFFSET; +// case GAIN: return org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricCalibrationType.GAIN; +// case TWOPOINT: return org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricCalibrationType.TWOPOINT; +// default: return org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricCalibrationType.NULL; +// } +//} +// +// private static org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCalibrationType convertDeviceMetricCalibrationType(org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricCalibrationType src) throws FHIRException { +// if (src == null) +// return null; +// switch (src) { +// case UNSPECIFIED: return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCalibrationType.UNSPECIFIED; +// case OFFSET: return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCalibrationType.OFFSET; +// case GAIN: return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCalibrationType.GAIN; +// case TWOPOINT: return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCalibrationType.TWOPOINT; +// default: return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCalibrationType.NULL; +// } +//} +// +// private static org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricCalibrationState convertDeviceMetricCalibrationState(org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCalibrationState src) throws FHIRException { +// if (src == null) +// return null; +// switch (src) { +// case NOTCALIBRATED: return org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricCalibrationState.NOTCALIBRATED; +// case CALIBRATIONREQUIRED: return org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricCalibrationState.CALIBRATIONREQUIRED; +// case CALIBRATED: return org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricCalibrationState.CALIBRATED; +// case UNSPECIFIED: return org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricCalibrationState.UNSPECIFIED; +// default: return org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricCalibrationState.NULL; +// } +//} +// +// private static org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCalibrationState convertDeviceMetricCalibrationState(org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricCalibrationState src) throws FHIRException { +// if (src == null) +// return null; +// switch (src) { +// case NOTCALIBRATED: return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCalibrationState.NOTCALIBRATED; +// case CALIBRATIONREQUIRED: return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCalibrationState.CALIBRATIONREQUIRED; +// case CALIBRATED: return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCalibrationState.CALIBRATED; +// case UNSPECIFIED: return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCalibrationState.UNSPECIFIED; +// default: return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCalibrationState.NULL; +// } +//} +// + + public static org.hl7.fhir.r5.model.DeviceUseStatement convertDeviceUseStatement(org.hl7.fhir.dstu3.model.DeviceUseStatement src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.DeviceUseStatement tgt = new org.hl7.fhir.r5.model.DeviceUseStatement(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasStatus()) + tgt.setStatus(convertDeviceUseStatementStatus(src.getStatus())); + if (src.hasSubject()) + tgt.setSubject(convertReference(src.getSubject())); + if (src.hasTiming()) + tgt.setTiming(convertType(src.getTiming())); + if (src.hasRecordedOn()) + tgt.setRecordedOn(src.getRecordedOn()); + if (src.hasSource()) + tgt.setSource(convertReference(src.getSource())); + if (src.hasDevice()) + tgt.setDevice(convertReference(src.getDevice())); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getIndication()) + tgt.addReasonCode(convertCodeableConcept(t)); + if (src.hasBodySite()) + tgt.setBodySite(convertCodeableConcept(src.getBodySite())); + for (org.hl7.fhir.dstu3.model.Annotation t : src.getNote()) + tgt.addNote(convertAnnotation(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.DeviceUseStatement convertDeviceUseStatement(org.hl7.fhir.r5.model.DeviceUseStatement src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.DeviceUseStatement tgt = new org.hl7.fhir.dstu3.model.DeviceUseStatement(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasStatus()) + tgt.setStatus(convertDeviceUseStatementStatus(src.getStatus())); + if (src.hasSubject()) + tgt.setSubject(convertReference(src.getSubject())); + if (src.hasTiming()) + tgt.setTiming(convertType(src.getTiming())); + if (src.hasRecordedOn()) + tgt.setRecordedOn(src.getRecordedOn()); + if (src.hasSource()) + tgt.setSource(convertReference(src.getSource())); + if (src.hasDevice()) + tgt.setDevice(convertReference(src.getDevice())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getReasonCode()) + tgt.addIndication(convertCodeableConcept(t)); + if (src.hasBodySite()) + tgt.setBodySite(convertCodeableConcept(src.getBodySite())); + for (org.hl7.fhir.r5.model.Annotation t : src.getNote()) + tgt.addNote(convertAnnotation(t)); + return tgt; + } + + private static org.hl7.fhir.r5.model.DeviceUseStatement.DeviceUseStatementStatus convertDeviceUseStatementStatus(org.hl7.fhir.dstu3.model.DeviceUseStatement.DeviceUseStatementStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case ACTIVE: return org.hl7.fhir.r5.model.DeviceUseStatement.DeviceUseStatementStatus.ACTIVE; + case COMPLETED: return org.hl7.fhir.r5.model.DeviceUseStatement.DeviceUseStatementStatus.COMPLETED; + case ENTEREDINERROR: return org.hl7.fhir.r5.model.DeviceUseStatement.DeviceUseStatementStatus.ENTEREDINERROR; + case INTENDED: return org.hl7.fhir.r5.model.DeviceUseStatement.DeviceUseStatementStatus.INTENDED; + case STOPPED: return org.hl7.fhir.r5.model.DeviceUseStatement.DeviceUseStatementStatus.STOPPED; + case ONHOLD: return org.hl7.fhir.r5.model.DeviceUseStatement.DeviceUseStatementStatus.ONHOLD; + default: return org.hl7.fhir.r5.model.DeviceUseStatement.DeviceUseStatementStatus.NULL; + } +} + + private static org.hl7.fhir.dstu3.model.DeviceUseStatement.DeviceUseStatementStatus convertDeviceUseStatementStatus(org.hl7.fhir.r5.model.DeviceUseStatement.DeviceUseStatementStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case ACTIVE: return org.hl7.fhir.dstu3.model.DeviceUseStatement.DeviceUseStatementStatus.ACTIVE; + case COMPLETED: return org.hl7.fhir.dstu3.model.DeviceUseStatement.DeviceUseStatementStatus.COMPLETED; + case ENTEREDINERROR: return org.hl7.fhir.dstu3.model.DeviceUseStatement.DeviceUseStatementStatus.ENTEREDINERROR; + case INTENDED: return org.hl7.fhir.dstu3.model.DeviceUseStatement.DeviceUseStatementStatus.INTENDED; + case STOPPED: return org.hl7.fhir.dstu3.model.DeviceUseStatement.DeviceUseStatementStatus.STOPPED; + case ONHOLD: return org.hl7.fhir.dstu3.model.DeviceUseStatement.DeviceUseStatementStatus.ONHOLD; + default: return org.hl7.fhir.dstu3.model.DeviceUseStatement.DeviceUseStatementStatus.NULL; + } +} + + public static org.hl7.fhir.r5.model.DiagnosticReport convertDiagnosticReport(org.hl7.fhir.dstu3.model.DiagnosticReport src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.DiagnosticReport tgt = new org.hl7.fhir.r5.model.DiagnosticReport(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + for (org.hl7.fhir.dstu3.model.Reference t : src.getBasedOn()) + tgt.addBasedOn(convertReference(t)); + if (src.hasStatus()) + tgt.setStatus(convertDiagnosticReportStatus(src.getStatus())); + if (src.hasCategory()) + tgt.addCategory(convertCodeableConcept(src.getCategory())); + if (src.hasCode()) + tgt.setCode(convertCodeableConcept(src.getCode())); + if (src.hasSubject()) + tgt.setSubject(convertReference(src.getSubject())); + if (src.hasContext()) + tgt.setEncounter(convertReference(src.getContext())); + if (src.hasEffective()) + tgt.setEffective(convertType(src.getEffective())); + if (src.hasIssued()) + tgt.setIssued(src.getIssued()); +// for (org.hl7.fhir.dstu3.model.DiagnosticReport.DiagnosticReportPerformerComponent t : src.getPerformer()) +// tgt.addPerformer(convertDiagnosticReportPerformerComponent(t)); + for (org.hl7.fhir.dstu3.model.Reference t : src.getSpecimen()) + tgt.addSpecimen(convertReference(t)); + for (org.hl7.fhir.dstu3.model.Reference t : src.getResult()) + tgt.addResult(convertReference(t)); + for (org.hl7.fhir.dstu3.model.Reference t : src.getImagingStudy()) + tgt.addImagingStudy(convertReference(t)); + for (org.hl7.fhir.dstu3.model.DiagnosticReport.DiagnosticReportImageComponent t : src.getImage()) + tgt.addMedia(convertDiagnosticReportImageComponent(t)); + if (src.hasConclusion()) + tgt.setConclusion(src.getConclusion()); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getCodedDiagnosis()) + tgt.addConclusionCode(convertCodeableConcept(t)); + for (org.hl7.fhir.dstu3.model.Attachment t : src.getPresentedForm()) + tgt.addPresentedForm(convertAttachment(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.DiagnosticReport convertDiagnosticReport(org.hl7.fhir.r5.model.DiagnosticReport src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.DiagnosticReport tgt = new org.hl7.fhir.dstu3.model.DiagnosticReport(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getBasedOn()) + tgt.addBasedOn(convertReference(t)); + if (src.hasStatus()) + tgt.setStatus(convertDiagnosticReportStatus(src.getStatus())); + if (src.hasCategory()) + tgt.setCategory(convertCodeableConcept(src.getCategoryFirstRep())); + if (src.hasCode()) + tgt.setCode(convertCodeableConcept(src.getCode())); + if (src.hasSubject()) + tgt.setSubject(convertReference(src.getSubject())); + if (src.hasEncounter()) + tgt.setContext(convertReference(src.getEncounter())); + if (src.hasEffective()) + tgt.setEffective(convertType(src.getEffective())); + if (src.hasIssued()) + tgt.setIssued(src.getIssued()); +// for (org.hl7.fhir.r5.model.DiagnosticReport.DiagnosticReportPerformerComponent t : src.getPerformer()) +// tgt.addPerformer(convertDiagnosticReportPerformerComponent(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getSpecimen()) + tgt.addSpecimen(convertReference(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getResult()) + tgt.addResult(convertReference(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getImagingStudy()) + tgt.addImagingStudy(convertReference(t)); + for (org.hl7.fhir.r5.model.DiagnosticReport.DiagnosticReportMediaComponent t : src.getMedia()) + tgt.addImage(convertDiagnosticReportImageComponent(t)); + if (src.hasConclusion()) + tgt.setConclusion(src.getConclusion()); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getConclusionCode()) + tgt.addCodedDiagnosis(convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.Attachment t : src.getPresentedForm()) + tgt.addPresentedForm(convertAttachment(t)); + return tgt; + } + + private static org.hl7.fhir.r5.model.DiagnosticReport.DiagnosticReportStatus convertDiagnosticReportStatus(org.hl7.fhir.dstu3.model.DiagnosticReport.DiagnosticReportStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case REGISTERED: return org.hl7.fhir.r5.model.DiagnosticReport.DiagnosticReportStatus.REGISTERED; + case PARTIAL: return org.hl7.fhir.r5.model.DiagnosticReport.DiagnosticReportStatus.PARTIAL; + case PRELIMINARY: return org.hl7.fhir.r5.model.DiagnosticReport.DiagnosticReportStatus.PRELIMINARY; + case FINAL: return org.hl7.fhir.r5.model.DiagnosticReport.DiagnosticReportStatus.FINAL; + case AMENDED: return org.hl7.fhir.r5.model.DiagnosticReport.DiagnosticReportStatus.AMENDED; + case CORRECTED: return org.hl7.fhir.r5.model.DiagnosticReport.DiagnosticReportStatus.CORRECTED; + case APPENDED: return org.hl7.fhir.r5.model.DiagnosticReport.DiagnosticReportStatus.APPENDED; + case CANCELLED: return org.hl7.fhir.r5.model.DiagnosticReport.DiagnosticReportStatus.CANCELLED; + case ENTEREDINERROR: return org.hl7.fhir.r5.model.DiagnosticReport.DiagnosticReportStatus.ENTEREDINERROR; + case UNKNOWN: return org.hl7.fhir.r5.model.DiagnosticReport.DiagnosticReportStatus.UNKNOWN; + default: return org.hl7.fhir.r5.model.DiagnosticReport.DiagnosticReportStatus.NULL; + } +} + + private static org.hl7.fhir.dstu3.model.DiagnosticReport.DiagnosticReportStatus convertDiagnosticReportStatus(org.hl7.fhir.r5.model.DiagnosticReport.DiagnosticReportStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case REGISTERED: return org.hl7.fhir.dstu3.model.DiagnosticReport.DiagnosticReportStatus.REGISTERED; + case PARTIAL: return org.hl7.fhir.dstu3.model.DiagnosticReport.DiagnosticReportStatus.PARTIAL; + case PRELIMINARY: return org.hl7.fhir.dstu3.model.DiagnosticReport.DiagnosticReportStatus.PRELIMINARY; + case FINAL: return org.hl7.fhir.dstu3.model.DiagnosticReport.DiagnosticReportStatus.FINAL; + case AMENDED: return org.hl7.fhir.dstu3.model.DiagnosticReport.DiagnosticReportStatus.AMENDED; + case CORRECTED: return org.hl7.fhir.dstu3.model.DiagnosticReport.DiagnosticReportStatus.CORRECTED; + case APPENDED: return org.hl7.fhir.dstu3.model.DiagnosticReport.DiagnosticReportStatus.APPENDED; + case CANCELLED: return org.hl7.fhir.dstu3.model.DiagnosticReport.DiagnosticReportStatus.CANCELLED; + case ENTEREDINERROR: return org.hl7.fhir.dstu3.model.DiagnosticReport.DiagnosticReportStatus.ENTEREDINERROR; + case UNKNOWN: return org.hl7.fhir.dstu3.model.DiagnosticReport.DiagnosticReportStatus.UNKNOWN; + default: return org.hl7.fhir.dstu3.model.DiagnosticReport.DiagnosticReportStatus.NULL; + } +} + +// public static org.hl7.fhir.r5.model.DiagnosticReport.DiagnosticReportPerformerComponent convertDiagnosticReportPerformerComponent(org.hl7.fhir.dstu3.model.DiagnosticReport.DiagnosticReportPerformerComponent src) throws FHIRException { +// if (src == null) +// return null; +// org.hl7.fhir.r5.model.DiagnosticReport.DiagnosticReportPerformerComponent tgt = new org.hl7.fhir.r5.model.DiagnosticReport.DiagnosticReportPerformerComponent(); +// copyElement(src, tgt); +// if (src.hasRole()) +// tgt.setRole(convertCodeableConcept(src.getRole())); +// if (src.hasActor()) +// tgt.setActor(convertReference(src.getActor())); +// return tgt; +// } +// +// public static org.hl7.fhir.dstu3.model.DiagnosticReport.DiagnosticReportPerformerComponent convertDiagnosticReportPerformerComponent(org.hl7.fhir.r5.model.DiagnosticReport.DiagnosticReportPerformerComponent src) throws FHIRException { +// if (src == null) +// return null; +// org.hl7.fhir.dstu3.model.DiagnosticReport.DiagnosticReportPerformerComponent tgt = new org.hl7.fhir.dstu3.model.DiagnosticReport.DiagnosticReportPerformerComponent(); +// copyElement(src, tgt); +// if (src.hasRole()) +// tgt.setRole(convertCodeableConcept(src.getRole())); +// if (src.hasActor()) +// tgt.setActor(convertReference(src.getActor())); +// return tgt; +// } +// + public static org.hl7.fhir.r5.model.DiagnosticReport.DiagnosticReportMediaComponent convertDiagnosticReportImageComponent(org.hl7.fhir.dstu3.model.DiagnosticReport.DiagnosticReportImageComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.DiagnosticReport.DiagnosticReportMediaComponent tgt = new org.hl7.fhir.r5.model.DiagnosticReport.DiagnosticReportMediaComponent(); + copyElement(src, tgt); + if (src.hasComment()) + tgt.setComment(src.getComment()); + if (src.hasLink()) + tgt.setLink(convertReference(src.getLink())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.DiagnosticReport.DiagnosticReportImageComponent convertDiagnosticReportImageComponent(org.hl7.fhir.r5.model.DiagnosticReport.DiagnosticReportMediaComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.DiagnosticReport.DiagnosticReportImageComponent tgt = new org.hl7.fhir.dstu3.model.DiagnosticReport.DiagnosticReportImageComponent(); + copyElement(src, tgt); + if (src.hasComment()) + tgt.setComment(src.getComment()); + if (src.hasLink()) + tgt.setLink(convertReference(src.getLink())); + return tgt; + } + +// public static org.hl7.fhir.r5.model.DocumentManifest convertDocumentManifest(org.hl7.fhir.dstu3.model.DocumentManifest src) throws FHIRException { +// if (src == null) +// return null; +// org.hl7.fhir.r5.model.DocumentManifest tgt = new org.hl7.fhir.r5.model.DocumentManifest(); +// copyDomainResource(src, tgt); +// if (src.hasMasterIdentifier()) +// tgt.setMasterIdentifier(convertIdentifier(src.getMasterIdentifier())); +// for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) +// tgt.addIdentifier(convertIdentifier(t)); +// if (src.hasStatus()) +// tgt.setStatus(convertDocumentReferenceStatus(src.getStatus())); +// if (src.hasType()) +// tgt.setType(convertCodeableConcept(src.getType())); +// if (src.hasSubject()) +// tgt.setSubject(convertReference(src.getSubject())); +// if (src.hasCreated()) +// tgt.setCreated(src.getCreated()); +// for (org.hl7.fhir.dstu3.model.Reference t : src.getAuthor()) +// tgt.addAgent().setWho(convertReference(t)); +// for (org.hl7.fhir.dstu3.model.Reference t : src.getRecipient()) +// tgt.addRecipient(convertReference(t)); +// if (src.hasSource()) +// tgt.setSource(src.getSource()); +// if (src.hasDescription()) +// tgt.setDescription(src.getDescription()); +// for (org.hl7.fhir.dstu3.model.DocumentManifest.DocumentManifestContentComponent t : src.getContent()) +// tgt.addContent(convertDocumentManifestContentComponent(t)); +// for (org.hl7.fhir.dstu3.model.DocumentManifest.DocumentManifestRelatedComponent t : src.getRelated()) +// tgt.addRelated(convertDocumentManifestRelatedComponent(t)); +// return tgt; +// } +// +// public static org.hl7.fhir.dstu3.model.DocumentManifest convertDocumentManifest(org.hl7.fhir.r5.model.DocumentManifest src) throws FHIRException { +// if (src == null) +// return null; +// org.hl7.fhir.dstu3.model.DocumentManifest tgt = new org.hl7.fhir.dstu3.model.DocumentManifest(); +// copyDomainResource(src, tgt); +// if (src.hasMasterIdentifier()) +// tgt.setMasterIdentifier(convertIdentifier(src.getMasterIdentifier())); +// for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) +// tgt.addIdentifier(convertIdentifier(t)); +// if (src.hasStatus()) +// tgt.setStatus(convertDocumentReferenceStatus(src.getStatus())); +// if (src.hasType()) +// tgt.setType(convertCodeableConcept(src.getType())); +// if (src.hasSubject()) +// tgt.setSubject(convertReference(src.getSubject())); +// if (src.hasCreated()) +// tgt.setCreated(src.getCreated()); +// for (org.hl7.fhir.r5.model.Reference t : src.getAuthor()) +// tgt.addAuthor(convertReference(t)); +// for (org.hl7.fhir.r5.model.Reference t : src.getRecipient()) +// tgt.addRecipient(convertReference(t)); +// if (src.hasSource()) +// tgt.setSource(src.getSource()); +// if (src.hasDescription()) +// tgt.setDescription(src.getDescription()); +// for (org.hl7.fhir.r5.model.DocumentManifest.DocumentManifestContentComponent t : src.getContent()) +// tgt.addContent(convertDocumentManifestContentComponent(t)); +// for (org.hl7.fhir.r5.model.DocumentManifest.DocumentManifestRelatedComponent t : src.getRelated()) +// tgt.addRelated(convertDocumentManifestRelatedComponent(t)); +// return tgt; +// } + + private static org.hl7.fhir.r5.model.Enumerations.DocumentReferenceStatus convertDocumentReferenceStatus(org.hl7.fhir.dstu3.model.Enumerations.DocumentReferenceStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case CURRENT: return org.hl7.fhir.r5.model.Enumerations.DocumentReferenceStatus.CURRENT; + case SUPERSEDED: return org.hl7.fhir.r5.model.Enumerations.DocumentReferenceStatus.SUPERSEDED; + case ENTEREDINERROR: return org.hl7.fhir.r5.model.Enumerations.DocumentReferenceStatus.ENTEREDINERROR; + default: return org.hl7.fhir.r5.model.Enumerations.DocumentReferenceStatus.NULL; + } +} + + private static org.hl7.fhir.dstu3.model.Enumerations.DocumentReferenceStatus convertDocumentReferenceStatus(org.hl7.fhir.r5.model.Enumerations.DocumentReferenceStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case CURRENT: return org.hl7.fhir.dstu3.model.Enumerations.DocumentReferenceStatus.CURRENT; + case SUPERSEDED: return org.hl7.fhir.dstu3.model.Enumerations.DocumentReferenceStatus.SUPERSEDED; + case ENTEREDINERROR: return org.hl7.fhir.dstu3.model.Enumerations.DocumentReferenceStatus.ENTEREDINERROR; + default: return org.hl7.fhir.dstu3.model.Enumerations.DocumentReferenceStatus.NULL; + } +} +// +// public static org.hl7.fhir.r5.model.DocumentManifest.DocumentManifestContentComponent convertDocumentManifestContentComponent(org.hl7.fhir.dstu3.model.DocumentManifest.DocumentManifestContentComponent src) throws FHIRException { +// if (src == null) +// return null; +// org.hl7.fhir.r5.model.DocumentManifest.DocumentManifestContentComponent tgt = new org.hl7.fhir.r5.model.DocumentManifest.DocumentManifestContentComponent(); +// copyElement(src, tgt); +// if (src.hasP()) +// tgt.setP(convertType(src.getP())); +// return tgt; +// } +// +// public static org.hl7.fhir.dstu3.model.DocumentManifest.DocumentManifestContentComponent convertDocumentManifestContentComponent(org.hl7.fhir.r5.model.DocumentManifest.DocumentManifestContentComponent src) throws FHIRException { +// if (src == null) +// return null; +// org.hl7.fhir.dstu3.model.DocumentManifest.DocumentManifestContentComponent tgt = new org.hl7.fhir.dstu3.model.DocumentManifest.DocumentManifestContentComponent(); +// copyElement(src, tgt); +// if (src.hasP()) +// tgt.setP(convertType(src.getP())); +// return tgt; +// } + + public static org.hl7.fhir.r5.model.DocumentManifest.DocumentManifestRelatedComponent convertDocumentManifestRelatedComponent(org.hl7.fhir.dstu3.model.DocumentManifest.DocumentManifestRelatedComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.DocumentManifest.DocumentManifestRelatedComponent tgt = new org.hl7.fhir.r5.model.DocumentManifest.DocumentManifestRelatedComponent(); + copyElement(src, tgt); + if (src.hasIdentifier()) + tgt.setIdentifier(convertIdentifier(src.getIdentifier())); + if (src.hasRef()) + tgt.setRef(convertReference(src.getRef())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.DocumentManifest.DocumentManifestRelatedComponent convertDocumentManifestRelatedComponent(org.hl7.fhir.r5.model.DocumentManifest.DocumentManifestRelatedComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.DocumentManifest.DocumentManifestRelatedComponent tgt = new org.hl7.fhir.dstu3.model.DocumentManifest.DocumentManifestRelatedComponent(); + copyElement(src, tgt); + if (src.hasIdentifier()) + tgt.setIdentifier(convertIdentifier(src.getIdentifier())); + if (src.hasRef()) + tgt.setRef(convertReference(src.getRef())); + return tgt; + } + + public static org.hl7.fhir.r5.model.DocumentReference convertDocumentReference(org.hl7.fhir.dstu3.model.DocumentReference src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.DocumentReference tgt = new org.hl7.fhir.r5.model.DocumentReference(); + copyDomainResource(src, tgt); + if (src.hasMasterIdentifier()) + tgt.setMasterIdentifier(convertIdentifier(src.getMasterIdentifier())); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasStatus()) + tgt.setStatus(convertDocumentReferenceStatus(src.getStatus())); + if (src.hasDocStatus()) + tgt.setDocStatus(convertReferredDocumentStatus(src.getDocStatus())); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + if (src.hasClass_()) + tgt.addCategory(convertCodeableConcept(src.getClass_())); + if (src.hasSubject()) + tgt.setSubject(convertReference(src.getSubject())); + if (src.hasCreated()) + tgt.setDate(src.getCreated()); +// for (org.hl7.fhir.dstu3.model.Reference t : src.getAuthor()) +// tgt.addAuthor(convertReference(t)); + if (src.hasAuthenticator()) + tgt.setAuthenticator(convertReference(src.getAuthenticator())); + if (src.hasCustodian()) + tgt.setCustodian(convertReference(src.getCustodian())); + for (org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceRelatesToComponent t : src.getRelatesTo()) + tgt.addRelatesTo(convertDocumentReferenceRelatesToComponent(t)); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getSecurityLabel()) + tgt.addSecurityLabel(convertCodeableConcept(t)); + for (org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceContentComponent t : src.getContent()) + tgt.addContent(convertDocumentReferenceContentComponent(t)); + if (src.hasContext()) + tgt.setContext(convertDocumentReferenceContextComponent(src.getContext())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.DocumentReference convertDocumentReference(org.hl7.fhir.r5.model.DocumentReference src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.DocumentReference tgt = new org.hl7.fhir.dstu3.model.DocumentReference(); + copyDomainResource(src, tgt); + if (src.hasMasterIdentifier()) + tgt.setMasterIdentifier(convertIdentifier(src.getMasterIdentifier())); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasStatus()) + tgt.setStatus(convertDocumentReferenceStatus(src.getStatus())); + if (src.hasDocStatus()) + tgt.setDocStatus(convertReferredDocumentStatus(src.getDocStatus())); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + if (src.hasCategory()) + tgt.setClass_(convertCodeableConcept(src.getCategoryFirstRep())); + if (src.hasSubject()) + tgt.setSubject(convertReference(src.getSubject())); + if (src.hasDate()) + tgt.setCreated(src.getDate()); +// for (org.hl7.fhir.r5.model.Reference t : src.getAuthor()) +// tgt.addAuthor(convertReference(t)); + if (src.hasAuthenticator()) + tgt.setAuthenticator(convertReference(src.getAuthenticator())); + if (src.hasCustodian()) + tgt.setCustodian(convertReference(src.getCustodian())); + for (org.hl7.fhir.r5.model.DocumentReference.DocumentReferenceRelatesToComponent t : src.getRelatesTo()) + tgt.addRelatesTo(convertDocumentReferenceRelatesToComponent(t)); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getSecurityLabel()) + tgt.addSecurityLabel(convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.DocumentReference.DocumentReferenceContentComponent t : src.getContent()) + tgt.addContent(convertDocumentReferenceContentComponent(t)); + if (src.hasContext()) + tgt.setContext(convertDocumentReferenceContextComponent(src.getContext())); + return tgt; + } + + private static org.hl7.fhir.r5.model.DocumentReference.ReferredDocumentStatus convertReferredDocumentStatus(org.hl7.fhir.dstu3.model.DocumentReference.ReferredDocumentStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PRELIMINARY: return org.hl7.fhir.r5.model.DocumentReference.ReferredDocumentStatus.PRELIMINARY; + case FINAL: return org.hl7.fhir.r5.model.DocumentReference.ReferredDocumentStatus.FINAL; + case AMENDED: return org.hl7.fhir.r5.model.DocumentReference.ReferredDocumentStatus.AMENDED; + case ENTEREDINERROR: return org.hl7.fhir.r5.model.DocumentReference.ReferredDocumentStatus.ENTEREDINERROR; + default: return org.hl7.fhir.r5.model.DocumentReference.ReferredDocumentStatus.NULL; + } +} + + private static org.hl7.fhir.dstu3.model.DocumentReference.ReferredDocumentStatus convertReferredDocumentStatus(org.hl7.fhir.r5.model.DocumentReference.ReferredDocumentStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PRELIMINARY: return org.hl7.fhir.dstu3.model.DocumentReference.ReferredDocumentStatus.PRELIMINARY; + case FINAL: return org.hl7.fhir.dstu3.model.DocumentReference.ReferredDocumentStatus.FINAL; + case AMENDED: return org.hl7.fhir.dstu3.model.DocumentReference.ReferredDocumentStatus.AMENDED; + case ENTEREDINERROR: return org.hl7.fhir.dstu3.model.DocumentReference.ReferredDocumentStatus.ENTEREDINERROR; + default: return org.hl7.fhir.dstu3.model.DocumentReference.ReferredDocumentStatus.NULL; + } +} + + public static org.hl7.fhir.r5.model.DocumentReference.DocumentReferenceRelatesToComponent convertDocumentReferenceRelatesToComponent(org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceRelatesToComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.DocumentReference.DocumentReferenceRelatesToComponent tgt = new org.hl7.fhir.r5.model.DocumentReference.DocumentReferenceRelatesToComponent(); + copyElement(src, tgt); + if (src.hasCode()) + tgt.setCode(convertDocumentRelationshipType(src.getCode())); + if (src.hasTarget()) + tgt.setTarget(convertReference(src.getTarget())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceRelatesToComponent convertDocumentReferenceRelatesToComponent(org.hl7.fhir.r5.model.DocumentReference.DocumentReferenceRelatesToComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceRelatesToComponent tgt = new org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceRelatesToComponent(); + copyElement(src, tgt); + if (src.hasCode()) + tgt.setCode(convertDocumentRelationshipType(src.getCode())); + if (src.hasTarget()) + tgt.setTarget(convertReference(src.getTarget())); + return tgt; + } + + private static org.hl7.fhir.r5.model.DocumentReference.DocumentRelationshipType convertDocumentRelationshipType(org.hl7.fhir.dstu3.model.DocumentReference.DocumentRelationshipType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case REPLACES: return org.hl7.fhir.r5.model.DocumentReference.DocumentRelationshipType.REPLACES; + case TRANSFORMS: return org.hl7.fhir.r5.model.DocumentReference.DocumentRelationshipType.TRANSFORMS; + case SIGNS: return org.hl7.fhir.r5.model.DocumentReference.DocumentRelationshipType.SIGNS; + case APPENDS: return org.hl7.fhir.r5.model.DocumentReference.DocumentRelationshipType.APPENDS; + default: return org.hl7.fhir.r5.model.DocumentReference.DocumentRelationshipType.NULL; + } +} + + private static org.hl7.fhir.dstu3.model.DocumentReference.DocumentRelationshipType convertDocumentRelationshipType(org.hl7.fhir.r5.model.DocumentReference.DocumentRelationshipType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case REPLACES: return org.hl7.fhir.dstu3.model.DocumentReference.DocumentRelationshipType.REPLACES; + case TRANSFORMS: return org.hl7.fhir.dstu3.model.DocumentReference.DocumentRelationshipType.TRANSFORMS; + case SIGNS: return org.hl7.fhir.dstu3.model.DocumentReference.DocumentRelationshipType.SIGNS; + case APPENDS: return org.hl7.fhir.dstu3.model.DocumentReference.DocumentRelationshipType.APPENDS; + default: return org.hl7.fhir.dstu3.model.DocumentReference.DocumentRelationshipType.NULL; + } +} + + + public static org.hl7.fhir.r5.model.DocumentReference.DocumentReferenceContentComponent convertDocumentReferenceContentComponent(org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceContentComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.DocumentReference.DocumentReferenceContentComponent tgt = new org.hl7.fhir.r5.model.DocumentReference.DocumentReferenceContentComponent(); + copyElement(src, tgt); + if (src.hasAttachment()) + tgt.setAttachment(convertAttachment(src.getAttachment())); + if (src.hasFormat()) + tgt.setFormat(convertCoding(src.getFormat())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceContentComponent convertDocumentReferenceContentComponent(org.hl7.fhir.r5.model.DocumentReference.DocumentReferenceContentComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceContentComponent tgt = new org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceContentComponent(); + copyElement(src, tgt); + if (src.hasAttachment()) + tgt.setAttachment(convertAttachment(src.getAttachment())); + if (src.hasFormat()) + tgt.setFormat(convertCoding(src.getFormat())); + return tgt; + } + + public static org.hl7.fhir.r5.model.DocumentReference.DocumentReferenceContextComponent convertDocumentReferenceContextComponent(org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceContextComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.DocumentReference.DocumentReferenceContextComponent tgt = new org.hl7.fhir.r5.model.DocumentReference.DocumentReferenceContextComponent(); + copyElement(src, tgt); + if (src.hasEncounter()) + tgt.addEncounter(convertReference(src.getEncounter())); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getEvent()) + tgt.addEvent(convertCodeableConcept(t)); + if (src.hasPeriod()) + tgt.setPeriod(convertPeriod(src.getPeriod())); + if (src.hasFacilityType()) + tgt.setFacilityType(convertCodeableConcept(src.getFacilityType())); + if (src.hasPracticeSetting()) + tgt.setPracticeSetting(convertCodeableConcept(src.getPracticeSetting())); + if (src.hasSourcePatientInfo()) + tgt.setSourcePatientInfo(convertReference(src.getSourcePatientInfo())); + for (org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceContextRelatedComponent t : src.getRelated()) + tgt.addRelated(convertDocumentReferenceContextRelatedComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceContextComponent convertDocumentReferenceContextComponent(org.hl7.fhir.r5.model.DocumentReference.DocumentReferenceContextComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceContextComponent tgt = new org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceContextComponent(); + copyElement(src, tgt); + if (src.hasEncounter()) + tgt.setEncounter(convertReference(src.getEncounterFirstRep())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getEvent()) + tgt.addEvent(convertCodeableConcept(t)); + if (src.hasPeriod()) + tgt.setPeriod(convertPeriod(src.getPeriod())); + if (src.hasFacilityType()) + tgt.setFacilityType(convertCodeableConcept(src.getFacilityType())); + if (src.hasPracticeSetting()) + tgt.setPracticeSetting(convertCodeableConcept(src.getPracticeSetting())); + if (src.hasSourcePatientInfo()) + tgt.setSourcePatientInfo(convertReference(src.getSourcePatientInfo())); + for (org.hl7.fhir.r5.model.Reference t : src.getRelated()) + tgt.addRelated(convertDocumentReferenceContextRelatedComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.Reference convertDocumentReferenceContextRelatedComponent(org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceContextRelatedComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Reference tgt = convertReference(src.getRef()); + copyElement(src, tgt); + if (src.hasIdentifier()) + tgt.setIdentifier(convertIdentifier(src.getIdentifier())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceContextRelatedComponent convertDocumentReferenceContextRelatedComponent(org.hl7.fhir.r5.model.Reference src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceContextRelatedComponent tgt = new org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceContextRelatedComponent(); + copyElement(src, tgt); + if (src.hasIdentifier()) + tgt.setIdentifier(convertIdentifier(src.getIdentifier())); + tgt.setRef(convertReference(src)); + return tgt; + } + + public static org.hl7.fhir.r5.model.Encounter convertEncounter(org.hl7.fhir.dstu3.model.Encounter src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Encounter tgt = new org.hl7.fhir.r5.model.Encounter(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasStatus()) + tgt.setStatus(convertEncounterStatus(src.getStatus())); + for (org.hl7.fhir.dstu3.model.Encounter.StatusHistoryComponent t : src.getStatusHistory()) + tgt.addStatusHistory(convertStatusHistoryComponent(t)); + if (src.hasClass_()) + tgt.setClass_(convertCoding(src.getClass_())); + for (org.hl7.fhir.dstu3.model.Encounter.ClassHistoryComponent t : src.getClassHistory()) + tgt.addClassHistory(convertClassHistoryComponent(t)); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getType()) + tgt.addType(convertCodeableConcept(t)); + if (src.hasPriority()) + tgt.setPriority(convertCodeableConcept(src.getPriority())); + if (src.hasSubject()) + tgt.setSubject(convertReference(src.getSubject())); + for (org.hl7.fhir.dstu3.model.Reference t : src.getEpisodeOfCare()) + tgt.addEpisodeOfCare(convertReference(t)); + for (org.hl7.fhir.dstu3.model.Reference t : src.getIncomingReferral()) + tgt.addBasedOn(convertReference(t)); + for (org.hl7.fhir.dstu3.model.Encounter.EncounterParticipantComponent t : src.getParticipant()) + tgt.addParticipant(convertEncounterParticipantComponent(t)); + if (src.hasAppointment()) + tgt.addAppointment(convertReference(src.getAppointment())); + if (src.hasPeriod()) + tgt.setPeriod(convertPeriod(src.getPeriod())); + if (src.hasLength()) + tgt.setLength(convertDuration(src.getLength())); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getReason()) + tgt.addReasonCode(convertCodeableConcept(t)); + for (org.hl7.fhir.dstu3.model.Encounter.DiagnosisComponent t : src.getDiagnosis()) + tgt.addDiagnosis(convertDiagnosisComponent(t)); + for (org.hl7.fhir.dstu3.model.Reference t : src.getAccount()) + tgt.addAccount(convertReference(t)); + if (src.hasHospitalization()) + tgt.setHospitalization(convertEncounterHospitalizationComponent(src.getHospitalization())); + for (org.hl7.fhir.dstu3.model.Encounter.EncounterLocationComponent t : src.getLocation()) + tgt.addLocation(convertEncounterLocationComponent(t)); + if (src.hasServiceProvider()) + tgt.setServiceProvider(convertReference(src.getServiceProvider())); + if (src.hasPartOf()) + tgt.setPartOf(convertReference(src.getPartOf())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Encounter convertEncounter(org.hl7.fhir.r5.model.Encounter src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Encounter tgt = new org.hl7.fhir.dstu3.model.Encounter(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasStatus()) + tgt.setStatus(convertEncounterStatus(src.getStatus())); + for (org.hl7.fhir.r5.model.Encounter.StatusHistoryComponent t : src.getStatusHistory()) + tgt.addStatusHistory(convertStatusHistoryComponent(t)); + if (src.hasClass_()) + tgt.setClass_(convertCoding(src.getClass_())); + for (org.hl7.fhir.r5.model.Encounter.ClassHistoryComponent t : src.getClassHistory()) + tgt.addClassHistory(convertClassHistoryComponent(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getType()) + tgt.addType(convertCodeableConcept(t)); + if (src.hasPriority()) + tgt.setPriority(convertCodeableConcept(src.getPriority())); + if (src.hasSubject()) + tgt.setSubject(convertReference(src.getSubject())); + for (org.hl7.fhir.r5.model.Reference t : src.getEpisodeOfCare()) + tgt.addEpisodeOfCare(convertReference(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getBasedOn()) + tgt.addIncomingReferral(convertReference(t)); + for (org.hl7.fhir.r5.model.Encounter.EncounterParticipantComponent t : src.getParticipant()) + tgt.addParticipant(convertEncounterParticipantComponent(t)); + if (src.hasAppointment()) + tgt.setAppointment(convertReference(src.getAppointmentFirstRep())); + if (src.hasPeriod()) + tgt.setPeriod(convertPeriod(src.getPeriod())); + if (src.hasLength()) + tgt.setLength(convertDuration(src.getLength())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getReasonCode()) + tgt.addReason(convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.Encounter.DiagnosisComponent t : src.getDiagnosis()) + tgt.addDiagnosis(convertDiagnosisComponent(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getAccount()) + tgt.addAccount(convertReference(t)); + if (src.hasHospitalization()) + tgt.setHospitalization(convertEncounterHospitalizationComponent(src.getHospitalization())); + for (org.hl7.fhir.r5.model.Encounter.EncounterLocationComponent t : src.getLocation()) + tgt.addLocation(convertEncounterLocationComponent(t)); + if (src.hasServiceProvider()) + tgt.setServiceProvider(convertReference(src.getServiceProvider())); + if (src.hasPartOf()) + tgt.setPartOf(convertReference(src.getPartOf())); + return tgt; + } + + private static org.hl7.fhir.r5.model.Encounter.EncounterStatus convertEncounterStatus(org.hl7.fhir.dstu3.model.Encounter.EncounterStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PLANNED: return org.hl7.fhir.r5.model.Encounter.EncounterStatus.PLANNED; + case ARRIVED: return org.hl7.fhir.r5.model.Encounter.EncounterStatus.ARRIVED; + case TRIAGED: return org.hl7.fhir.r5.model.Encounter.EncounterStatus.TRIAGED; + case INPROGRESS: return org.hl7.fhir.r5.model.Encounter.EncounterStatus.INPROGRESS; + case ONLEAVE: return org.hl7.fhir.r5.model.Encounter.EncounterStatus.ONLEAVE; + case FINISHED: return org.hl7.fhir.r5.model.Encounter.EncounterStatus.FINISHED; + case CANCELLED: return org.hl7.fhir.r5.model.Encounter.EncounterStatus.CANCELLED; + case ENTEREDINERROR: return org.hl7.fhir.r5.model.Encounter.EncounterStatus.ENTEREDINERROR; + case UNKNOWN: return org.hl7.fhir.r5.model.Encounter.EncounterStatus.UNKNOWN; + default: return org.hl7.fhir.r5.model.Encounter.EncounterStatus.NULL; + } +} + + private static org.hl7.fhir.dstu3.model.Encounter.EncounterStatus convertEncounterStatus(org.hl7.fhir.r5.model.Encounter.EncounterStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PLANNED: return org.hl7.fhir.dstu3.model.Encounter.EncounterStatus.PLANNED; + case ARRIVED: return org.hl7.fhir.dstu3.model.Encounter.EncounterStatus.ARRIVED; + case TRIAGED: return org.hl7.fhir.dstu3.model.Encounter.EncounterStatus.TRIAGED; + case INPROGRESS: return org.hl7.fhir.dstu3.model.Encounter.EncounterStatus.INPROGRESS; + case ONLEAVE: return org.hl7.fhir.dstu3.model.Encounter.EncounterStatus.ONLEAVE; + case FINISHED: return org.hl7.fhir.dstu3.model.Encounter.EncounterStatus.FINISHED; + case CANCELLED: return org.hl7.fhir.dstu3.model.Encounter.EncounterStatus.CANCELLED; + case ENTEREDINERROR: return org.hl7.fhir.dstu3.model.Encounter.EncounterStatus.ENTEREDINERROR; + case UNKNOWN: return org.hl7.fhir.dstu3.model.Encounter.EncounterStatus.UNKNOWN; + default: return org.hl7.fhir.dstu3.model.Encounter.EncounterStatus.NULL; + } +} + + public static org.hl7.fhir.r5.model.Encounter.StatusHistoryComponent convertStatusHistoryComponent(org.hl7.fhir.dstu3.model.Encounter.StatusHistoryComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Encounter.StatusHistoryComponent tgt = new org.hl7.fhir.r5.model.Encounter.StatusHistoryComponent(); + copyElement(src, tgt); + if (src.hasStatus()) + tgt.setStatus(convertEncounterStatus(src.getStatus())); + if (src.hasPeriod()) + tgt.setPeriod(convertPeriod(src.getPeriod())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Encounter.StatusHistoryComponent convertStatusHistoryComponent(org.hl7.fhir.r5.model.Encounter.StatusHistoryComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Encounter.StatusHistoryComponent tgt = new org.hl7.fhir.dstu3.model.Encounter.StatusHistoryComponent(); + copyElement(src, tgt); + if (src.hasStatus()) + tgt.setStatus(convertEncounterStatus(src.getStatus())); + if (src.hasPeriod()) + tgt.setPeriod(convertPeriod(src.getPeriod())); + return tgt; + } + + public static org.hl7.fhir.r5.model.Encounter.ClassHistoryComponent convertClassHistoryComponent(org.hl7.fhir.dstu3.model.Encounter.ClassHistoryComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Encounter.ClassHistoryComponent tgt = new org.hl7.fhir.r5.model.Encounter.ClassHistoryComponent(); + copyElement(src, tgt); + if (src.hasClass_()) + tgt.setClass_(convertCoding(src.getClass_())); + if (src.hasPeriod()) + tgt.setPeriod(convertPeriod(src.getPeriod())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Encounter.ClassHistoryComponent convertClassHistoryComponent(org.hl7.fhir.r5.model.Encounter.ClassHistoryComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Encounter.ClassHistoryComponent tgt = new org.hl7.fhir.dstu3.model.Encounter.ClassHistoryComponent(); + copyElement(src, tgt); + if (src.hasClass_()) + tgt.setClass_(convertCoding(src.getClass_())); + if (src.hasPeriod()) + tgt.setPeriod(convertPeriod(src.getPeriod())); + return tgt; + } + + public static org.hl7.fhir.r5.model.Encounter.EncounterParticipantComponent convertEncounterParticipantComponent(org.hl7.fhir.dstu3.model.Encounter.EncounterParticipantComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Encounter.EncounterParticipantComponent tgt = new org.hl7.fhir.r5.model.Encounter.EncounterParticipantComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getType()) + tgt.addType(convertCodeableConcept(t)); + if (src.hasPeriod()) + tgt.setPeriod(convertPeriod(src.getPeriod())); + if (src.hasIndividual()) + tgt.setIndividual(convertReference(src.getIndividual())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Encounter.EncounterParticipantComponent convertEncounterParticipantComponent(org.hl7.fhir.r5.model.Encounter.EncounterParticipantComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Encounter.EncounterParticipantComponent tgt = new org.hl7.fhir.dstu3.model.Encounter.EncounterParticipantComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getType()) + tgt.addType(convertCodeableConcept(t)); + if (src.hasPeriod()) + tgt.setPeriod(convertPeriod(src.getPeriod())); + if (src.hasIndividual()) + tgt.setIndividual(convertReference(src.getIndividual())); + return tgt; + } + + public static org.hl7.fhir.r5.model.Encounter.DiagnosisComponent convertDiagnosisComponent(org.hl7.fhir.dstu3.model.Encounter.DiagnosisComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Encounter.DiagnosisComponent tgt = new org.hl7.fhir.r5.model.Encounter.DiagnosisComponent(); + copyElement(src, tgt); + if (src.hasCondition()) + tgt.setCondition(convertReference(src.getCondition())); + if (src.hasRole()) + tgt.setUse(convertCodeableConcept(src.getRole())); + if (src.hasRank()) + tgt.setRank(src.getRank()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Encounter.DiagnosisComponent convertDiagnosisComponent(org.hl7.fhir.r5.model.Encounter.DiagnosisComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Encounter.DiagnosisComponent tgt = new org.hl7.fhir.dstu3.model.Encounter.DiagnosisComponent(); + copyElement(src, tgt); + if (src.hasCondition()) + tgt.setCondition(convertReference(src.getCondition())); + if (src.hasUse()) + tgt.setRole(convertCodeableConcept(src.getUse())); + if (src.hasRank()) + tgt.setRank(src.getRank()); + return tgt; + } + + public static org.hl7.fhir.r5.model.Encounter.EncounterHospitalizationComponent convertEncounterHospitalizationComponent(org.hl7.fhir.dstu3.model.Encounter.EncounterHospitalizationComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Encounter.EncounterHospitalizationComponent tgt = new org.hl7.fhir.r5.model.Encounter.EncounterHospitalizationComponent(); + copyElement(src, tgt); + if (src.hasPreAdmissionIdentifier()) + tgt.setPreAdmissionIdentifier(convertIdentifier(src.getPreAdmissionIdentifier())); + if (src.hasOrigin()) + tgt.setOrigin(convertReference(src.getOrigin())); + if (src.hasAdmitSource()) + tgt.setAdmitSource(convertCodeableConcept(src.getAdmitSource())); + if (src.hasReAdmission()) + tgt.setReAdmission(convertCodeableConcept(src.getReAdmission())); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getDietPreference()) + tgt.addDietPreference(convertCodeableConcept(t)); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getSpecialCourtesy()) + tgt.addSpecialCourtesy(convertCodeableConcept(t)); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getSpecialArrangement()) + tgt.addSpecialArrangement(convertCodeableConcept(t)); + if (src.hasDestination()) + tgt.setDestination(convertReference(src.getDestination())); + if (src.hasDischargeDisposition()) + tgt.setDischargeDisposition(convertCodeableConcept(src.getDischargeDisposition())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Encounter.EncounterHospitalizationComponent convertEncounterHospitalizationComponent(org.hl7.fhir.r5.model.Encounter.EncounterHospitalizationComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Encounter.EncounterHospitalizationComponent tgt = new org.hl7.fhir.dstu3.model.Encounter.EncounterHospitalizationComponent(); + copyElement(src, tgt); + if (src.hasPreAdmissionIdentifier()) + tgt.setPreAdmissionIdentifier(convertIdentifier(src.getPreAdmissionIdentifier())); + if (src.hasOrigin()) + tgt.setOrigin(convertReference(src.getOrigin())); + if (src.hasAdmitSource()) + tgt.setAdmitSource(convertCodeableConcept(src.getAdmitSource())); + if (src.hasReAdmission()) + tgt.setReAdmission(convertCodeableConcept(src.getReAdmission())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getDietPreference()) + tgt.addDietPreference(convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getSpecialCourtesy()) + tgt.addSpecialCourtesy(convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getSpecialArrangement()) + tgt.addSpecialArrangement(convertCodeableConcept(t)); + if (src.hasDestination()) + tgt.setDestination(convertReference(src.getDestination())); + if (src.hasDischargeDisposition()) + tgt.setDischargeDisposition(convertCodeableConcept(src.getDischargeDisposition())); + return tgt; + } + + public static org.hl7.fhir.r5.model.Encounter.EncounterLocationComponent convertEncounterLocationComponent(org.hl7.fhir.dstu3.model.Encounter.EncounterLocationComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Encounter.EncounterLocationComponent tgt = new org.hl7.fhir.r5.model.Encounter.EncounterLocationComponent(); + copyElement(src, tgt); + if (src.hasLocation()) + tgt.setLocation(convertReference(src.getLocation())); + if (src.hasStatus()) + tgt.setStatus(convertEncounterLocationStatus(src.getStatus())); + if (src.hasPeriod()) + tgt.setPeriod(convertPeriod(src.getPeriod())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Encounter.EncounterLocationComponent convertEncounterLocationComponent(org.hl7.fhir.r5.model.Encounter.EncounterLocationComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Encounter.EncounterLocationComponent tgt = new org.hl7.fhir.dstu3.model.Encounter.EncounterLocationComponent(); + copyElement(src, tgt); + if (src.hasLocation()) + tgt.setLocation(convertReference(src.getLocation())); + if (src.hasStatus()) + tgt.setStatus(convertEncounterLocationStatus(src.getStatus())); + if (src.hasPeriod()) + tgt.setPeriod(convertPeriod(src.getPeriod())); + return tgt; + } + + private static org.hl7.fhir.r5.model.Encounter.EncounterLocationStatus convertEncounterLocationStatus(org.hl7.fhir.dstu3.model.Encounter.EncounterLocationStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PLANNED: return org.hl7.fhir.r5.model.Encounter.EncounterLocationStatus.PLANNED; + case ACTIVE: return org.hl7.fhir.r5.model.Encounter.EncounterLocationStatus.ACTIVE; + case RESERVED: return org.hl7.fhir.r5.model.Encounter.EncounterLocationStatus.RESERVED; + case COMPLETED: return org.hl7.fhir.r5.model.Encounter.EncounterLocationStatus.COMPLETED; + default: return org.hl7.fhir.r5.model.Encounter.EncounterLocationStatus.NULL; + } +} + + private static org.hl7.fhir.dstu3.model.Encounter.EncounterLocationStatus convertEncounterLocationStatus(org.hl7.fhir.r5.model.Encounter.EncounterLocationStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PLANNED: return org.hl7.fhir.dstu3.model.Encounter.EncounterLocationStatus.PLANNED; + case ACTIVE: return org.hl7.fhir.dstu3.model.Encounter.EncounterLocationStatus.ACTIVE; + case RESERVED: return org.hl7.fhir.dstu3.model.Encounter.EncounterLocationStatus.RESERVED; + case COMPLETED: return org.hl7.fhir.dstu3.model.Encounter.EncounterLocationStatus.COMPLETED; + default: return org.hl7.fhir.dstu3.model.Encounter.EncounterLocationStatus.NULL; + } +} + + public static org.hl7.fhir.r5.model.Endpoint convertEndpoint(org.hl7.fhir.dstu3.model.Endpoint src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Endpoint tgt = new org.hl7.fhir.r5.model.Endpoint(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasStatus()) + tgt.setStatus(convertEndpointStatus(src.getStatus())); + if (src.hasConnectionType()) + tgt.setConnectionType(convertCoding(src.getConnectionType())); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasManagingOrganization()) + tgt.setManagingOrganization(convertReference(src.getManagingOrganization())); + for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getContact()) + tgt.addContact(convertContactPoint(t)); + if (src.hasPeriod()) + tgt.setPeriod(convertPeriod(src.getPeriod())); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getPayloadType()) + tgt.addPayloadType(convertCodeableConcept(t)); + for (org.hl7.fhir.dstu3.model.CodeType t : src.getPayloadMimeType()) + tgt.addPayloadMimeType(t.getValue()); + if (src.hasAddress()) + tgt.setAddress(src.getAddress()); + for (org.hl7.fhir.dstu3.model.StringType t : src.getHeader()) + tgt.addHeader(t.getValue()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Endpoint convertEndpoint(org.hl7.fhir.r5.model.Endpoint src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Endpoint tgt = new org.hl7.fhir.dstu3.model.Endpoint(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasStatus()) + tgt.setStatus(convertEndpointStatus(src.getStatus())); + if (src.hasConnectionType()) + tgt.setConnectionType(convertCoding(src.getConnectionType())); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasManagingOrganization()) + tgt.setManagingOrganization(convertReference(src.getManagingOrganization())); + for (org.hl7.fhir.r5.model.ContactPoint t : src.getContact()) + tgt.addContact(convertContactPoint(t)); + if (src.hasPeriod()) + tgt.setPeriod(convertPeriod(src.getPeriod())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getPayloadType()) + tgt.addPayloadType(convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.CodeType t : src.getPayloadMimeType()) + tgt.addPayloadMimeType(t.getValue()); + if (src.hasAddress()) + tgt.setAddress(src.getAddress()); + for (org.hl7.fhir.r5.model.StringType t : src.getHeader()) + tgt.addHeader(t.getValue()); + return tgt; + } + + private static org.hl7.fhir.r5.model.Endpoint.EndpointStatus convertEndpointStatus(org.hl7.fhir.dstu3.model.Endpoint.EndpointStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case ACTIVE: return org.hl7.fhir.r5.model.Endpoint.EndpointStatus.ACTIVE; + case SUSPENDED: return org.hl7.fhir.r5.model.Endpoint.EndpointStatus.SUSPENDED; + case ERROR: return org.hl7.fhir.r5.model.Endpoint.EndpointStatus.ERROR; + case OFF: return org.hl7.fhir.r5.model.Endpoint.EndpointStatus.OFF; + case ENTEREDINERROR: return org.hl7.fhir.r5.model.Endpoint.EndpointStatus.ENTEREDINERROR; + case TEST: return org.hl7.fhir.r5.model.Endpoint.EndpointStatus.TEST; + default: return org.hl7.fhir.r5.model.Endpoint.EndpointStatus.NULL; + } +} + + private static org.hl7.fhir.dstu3.model.Endpoint.EndpointStatus convertEndpointStatus(org.hl7.fhir.r5.model.Endpoint.EndpointStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case ACTIVE: return org.hl7.fhir.dstu3.model.Endpoint.EndpointStatus.ACTIVE; + case SUSPENDED: return org.hl7.fhir.dstu3.model.Endpoint.EndpointStatus.SUSPENDED; + case ERROR: return org.hl7.fhir.dstu3.model.Endpoint.EndpointStatus.ERROR; + case OFF: return org.hl7.fhir.dstu3.model.Endpoint.EndpointStatus.OFF; + case ENTEREDINERROR: return org.hl7.fhir.dstu3.model.Endpoint.EndpointStatus.ENTEREDINERROR; + case TEST: return org.hl7.fhir.dstu3.model.Endpoint.EndpointStatus.TEST; + default: return org.hl7.fhir.dstu3.model.Endpoint.EndpointStatus.NULL; + } +} + + public static org.hl7.fhir.r5.model.EpisodeOfCare convertEpisodeOfCare(org.hl7.fhir.dstu3.model.EpisodeOfCare src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.EpisodeOfCare tgt = new org.hl7.fhir.r5.model.EpisodeOfCare(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasStatus()) + tgt.setStatus(convertEpisodeOfCareStatus(src.getStatus())); + for (org.hl7.fhir.dstu3.model.EpisodeOfCare.EpisodeOfCareStatusHistoryComponent t : src.getStatusHistory()) + tgt.addStatusHistory(convertEpisodeOfCareStatusHistoryComponent(t)); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getType()) + tgt.addType(convertCodeableConcept(t)); + for (org.hl7.fhir.dstu3.model.EpisodeOfCare.DiagnosisComponent t : src.getDiagnosis()) + tgt.addDiagnosis(convertDiagnosisComponent(t)); + if (src.hasPatient()) + tgt.setPatient(convertReference(src.getPatient())); + if (src.hasManagingOrganization()) + tgt.setManagingOrganization(convertReference(src.getManagingOrganization())); + if (src.hasPeriod()) + tgt.setPeriod(convertPeriod(src.getPeriod())); + for (org.hl7.fhir.dstu3.model.Reference t : src.getReferralRequest()) + tgt.addReferralRequest(convertReference(t)); + if (src.hasCareManager()) + tgt.setCareManager(convertReference(src.getCareManager())); + for (org.hl7.fhir.dstu3.model.Reference t : src.getTeam()) + tgt.addTeam(convertReference(t)); + for (org.hl7.fhir.dstu3.model.Reference t : src.getAccount()) + tgt.addAccount(convertReference(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.EpisodeOfCare convertEpisodeOfCare(org.hl7.fhir.r5.model.EpisodeOfCare src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.EpisodeOfCare tgt = new org.hl7.fhir.dstu3.model.EpisodeOfCare(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasStatus()) + tgt.setStatus(convertEpisodeOfCareStatus(src.getStatus())); + for (org.hl7.fhir.r5.model.EpisodeOfCare.EpisodeOfCareStatusHistoryComponent t : src.getStatusHistory()) + tgt.addStatusHistory(convertEpisodeOfCareStatusHistoryComponent(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getType()) + tgt.addType(convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.EpisodeOfCare.DiagnosisComponent t : src.getDiagnosis()) + tgt.addDiagnosis(convertDiagnosisComponent(t)); + if (src.hasPatient()) + tgt.setPatient(convertReference(src.getPatient())); + if (src.hasManagingOrganization()) + tgt.setManagingOrganization(convertReference(src.getManagingOrganization())); + if (src.hasPeriod()) + tgt.setPeriod(convertPeriod(src.getPeriod())); + for (org.hl7.fhir.r5.model.Reference t : src.getReferralRequest()) + tgt.addReferralRequest(convertReference(t)); + if (src.hasCareManager()) + tgt.setCareManager(convertReference(src.getCareManager())); + for (org.hl7.fhir.r5.model.Reference t : src.getTeam()) + tgt.addTeam(convertReference(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getAccount()) + tgt.addAccount(convertReference(t)); + return tgt; + } + + private static org.hl7.fhir.r5.model.EpisodeOfCare.EpisodeOfCareStatus convertEpisodeOfCareStatus(org.hl7.fhir.dstu3.model.EpisodeOfCare.EpisodeOfCareStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PLANNED: return org.hl7.fhir.r5.model.EpisodeOfCare.EpisodeOfCareStatus.PLANNED; + case WAITLIST: return org.hl7.fhir.r5.model.EpisodeOfCare.EpisodeOfCareStatus.WAITLIST; + case ACTIVE: return org.hl7.fhir.r5.model.EpisodeOfCare.EpisodeOfCareStatus.ACTIVE; + case ONHOLD: return org.hl7.fhir.r5.model.EpisodeOfCare.EpisodeOfCareStatus.ONHOLD; + case FINISHED: return org.hl7.fhir.r5.model.EpisodeOfCare.EpisodeOfCareStatus.FINISHED; + case CANCELLED: return org.hl7.fhir.r5.model.EpisodeOfCare.EpisodeOfCareStatus.CANCELLED; + case ENTEREDINERROR: return org.hl7.fhir.r5.model.EpisodeOfCare.EpisodeOfCareStatus.ENTEREDINERROR; + default: return org.hl7.fhir.r5.model.EpisodeOfCare.EpisodeOfCareStatus.NULL; + } +} + + private static org.hl7.fhir.dstu3.model.EpisodeOfCare.EpisodeOfCareStatus convertEpisodeOfCareStatus(org.hl7.fhir.r5.model.EpisodeOfCare.EpisodeOfCareStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PLANNED: return org.hl7.fhir.dstu3.model.EpisodeOfCare.EpisodeOfCareStatus.PLANNED; + case WAITLIST: return org.hl7.fhir.dstu3.model.EpisodeOfCare.EpisodeOfCareStatus.WAITLIST; + case ACTIVE: return org.hl7.fhir.dstu3.model.EpisodeOfCare.EpisodeOfCareStatus.ACTIVE; + case ONHOLD: return org.hl7.fhir.dstu3.model.EpisodeOfCare.EpisodeOfCareStatus.ONHOLD; + case FINISHED: return org.hl7.fhir.dstu3.model.EpisodeOfCare.EpisodeOfCareStatus.FINISHED; + case CANCELLED: return org.hl7.fhir.dstu3.model.EpisodeOfCare.EpisodeOfCareStatus.CANCELLED; + case ENTEREDINERROR: return org.hl7.fhir.dstu3.model.EpisodeOfCare.EpisodeOfCareStatus.ENTEREDINERROR; + default: return org.hl7.fhir.dstu3.model.EpisodeOfCare.EpisodeOfCareStatus.NULL; + } +} + + public static org.hl7.fhir.r5.model.EpisodeOfCare.EpisodeOfCareStatusHistoryComponent convertEpisodeOfCareStatusHistoryComponent(org.hl7.fhir.dstu3.model.EpisodeOfCare.EpisodeOfCareStatusHistoryComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.EpisodeOfCare.EpisodeOfCareStatusHistoryComponent tgt = new org.hl7.fhir.r5.model.EpisodeOfCare.EpisodeOfCareStatusHistoryComponent(); + copyElement(src, tgt); + if (src.hasStatus()) + tgt.setStatus(convertEpisodeOfCareStatus(src.getStatus())); + if (src.hasPeriod()) + tgt.setPeriod(convertPeriod(src.getPeriod())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.EpisodeOfCare.EpisodeOfCareStatusHistoryComponent convertEpisodeOfCareStatusHistoryComponent(org.hl7.fhir.r5.model.EpisodeOfCare.EpisodeOfCareStatusHistoryComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.EpisodeOfCare.EpisodeOfCareStatusHistoryComponent tgt = new org.hl7.fhir.dstu3.model.EpisodeOfCare.EpisodeOfCareStatusHistoryComponent(); + copyElement(src, tgt); + if (src.hasStatus()) + tgt.setStatus(convertEpisodeOfCareStatus(src.getStatus())); + if (src.hasPeriod()) + tgt.setPeriod(convertPeriod(src.getPeriod())); + return tgt; + } + + public static org.hl7.fhir.r5.model.EpisodeOfCare.DiagnosisComponent convertDiagnosisComponent(org.hl7.fhir.dstu3.model.EpisodeOfCare.DiagnosisComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.EpisodeOfCare.DiagnosisComponent tgt = new org.hl7.fhir.r5.model.EpisodeOfCare.DiagnosisComponent(); + copyElement(src, tgt); + if (src.hasCondition()) + tgt.setCondition(convertReference(src.getCondition())); + if (src.hasRole()) + tgt.setRole(convertCodeableConcept(src.getRole())); + if (src.hasRank()) + tgt.setRank(src.getRank()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.EpisodeOfCare.DiagnosisComponent convertDiagnosisComponent(org.hl7.fhir.r5.model.EpisodeOfCare.DiagnosisComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.EpisodeOfCare.DiagnosisComponent tgt = new org.hl7.fhir.dstu3.model.EpisodeOfCare.DiagnosisComponent(); + copyElement(src, tgt); + if (src.hasCondition()) + tgt.setCondition(convertReference(src.getCondition())); + if (src.hasRole()) + tgt.setRole(convertCodeableConcept(src.getRole())); + if (src.hasRank()) + tgt.setRank(src.getRank()); + return tgt; + } + + public static org.hl7.fhir.r5.model.Parameters convertExpansionProfile(org.hl7.fhir.dstu3.model.ExpansionProfile src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Parameters tgt = new org.hl7.fhir.r5.model.Parameters(); + if (src.hasUrl()) + tgt.addParameter("profile-url", src.getUrl()); + if (src.hasVersion()) + tgt.addParameter("profile-version", src.getVersion()); + if (src.hasName()) + tgt.addParameter("profile-name", src.getName()); + if (src.hasStatus()) + tgt.addParameter("profile-status", src.getStatus().toCode()); + + for (org.hl7.fhir.dstu3.model.ExpansionProfile.ExpansionProfileFixedVersionComponent t : src.getFixedVersion()) { + if (t.getMode() == SystemVersionProcessingMode.DEFAULT) + tgt.addParameter("system-version", t.getSystem()+"|"+t.getVersion()); + else if (t.getMode() == SystemVersionProcessingMode.CHECK) + tgt.addParameter("check-system-version", t.getSystem()+"|"+t.getVersion()); + else if (t.getMode() == SystemVersionProcessingMode.OVERRIDE) + tgt.addParameter("force-system-version", t.getSystem()+"|"+t.getVersion()); + } + + if (src.hasExcludedSystem()) { + tgt.addParameter("exclude-system", src.getExcludedSystem().getSystem()+"|"+src.getExcludedSystem().getVersion()); + } + if (src.hasIncludeDesignations()) + tgt.addParameter("includeDesignations", src.getIncludeDesignations()); + + for (DesignationIncludeDesignationComponent t : src.getDesignation().getInclude().getDesignation()) { + if (t.hasLanguage()) + tgt.addParameter("designation", "urn:ietf:bcp:47|"+t.getLanguage()); + if (t.hasUse()) + tgt.addParameter("designation", t.getUse().getSystem()+"|"+t.getUse().getCode()); + } + if (src.hasIncludeDefinition()) + tgt.addParameter("includeDefinition", src.getIncludeDefinition()); + if (src.hasActiveOnly()) + tgt.addParameter("activeOnly", src.getActiveOnly()); + if (src.hasExcludeNested()) + tgt.addParameter("excludeNested", src.getExcludeNested()); + if (src.hasExcludeNotForUI()) + tgt.addParameter("excludeNotForUI", src.getExcludeNotForUI()); + if (src.hasExcludePostCoordinated()) + tgt.addParameter("excludePostCoordinated", src.getExcludePostCoordinated()); + if (src.hasDisplayLanguage()) + tgt.addParameter("excludePostCoordinated", src.getDisplayLanguage()); + if (src.hasLimitedExpansion()) + tgt.addParameter("limitedExpansion", src.getLimitedExpansion()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ExpansionProfile convertExpansionProfile(org.hl7.fhir.r5.model.Parameters src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.ExpansionProfile tgt = new org.hl7.fhir.dstu3.model.ExpansionProfile(); + if (src.hasParameter("profile-url")) + tgt.setUrl(src.getParameter("profile-url").primitiveValue()); + if (src.hasParameter("profile-version")) + tgt.setVersion(src.getParameter("profile-version").primitiveValue()); + if (src.hasParameter("profile-name")) + tgt.setName(src.getParameter("profile-name").primitiveValue()); + if (src.hasParameter("profile-status")) + tgt.setStatus(PublicationStatus.fromCode(src.getParameter("profile-status").primitiveValue())); + + for (Type t : src.getParameters("system-version")) { + String[] v = t.primitiveValue().split("\\|"); + tgt.addFixedVersion().setSystem(v[0]).setVersion(v[1]).setMode(SystemVersionProcessingMode.DEFAULT); + } + for (Type t : src.getParameters("force-system-version")) { + String[] v = t.primitiveValue().split("\\|"); + tgt.addFixedVersion().setSystem(v[0]).setVersion(v[1]).setMode(SystemVersionProcessingMode.OVERRIDE); + } + for (Type t : src.getParameters("check-system-version")) { + String[] v = t.primitiveValue().split("\\|"); + tgt.addFixedVersion().setSystem(v[0]).setVersion(v[1]).setMode(SystemVersionProcessingMode.CHECK); + } + for (Type t : src.getParameters("exclude-system")) { + String[] v = t.primitiveValue().split("\\|"); + tgt.getExcludedSystem().setSystem(v[0]).setVersion(v[1]); + } + if (src.hasParameter("includeDesignations")) + tgt.setIncludeDesignations(src.getParameterBool("")); + for (Type t : src.getParameters("designation")) { + String[] v = t.primitiveValue().split("\\|"); + if ("urn:ietf:bcp:47".equals(v[0])) + tgt.getDesignation().getInclude().addDesignation().setLanguage(v[1]); + else + tgt.getDesignation().getInclude().addDesignation().getUse().setSystem(v[0]).setCode(v[1]); + } + if (src.hasParameter("includeDefinition")) + tgt.setIncludeDefinition(src.getParameterBool("includeDefinition")); + if (src.hasParameter("activeOnly")) + tgt.setActiveOnly(src.getParameterBool("activeOnly")); + if (src.hasParameter("excludeNested")) + tgt.setExcludeNested(src.getParameterBool("excludeNested")); + if (src.hasParameter("excludeNotForUI")) + tgt.setExcludeNotForUI(src.getParameterBool("excludeNotForUI")); + if (src.hasParameter("excludeNotForUI")) + tgt.setExcludePostCoordinated(src.getParameterBool("excludeNotForUI")); + if (src.hasParameter("displayLanguage")) + tgt.setDisplayLanguage(src.getParameter("displayLanguage").primitiveValue()); + if (src.hasParameter("limitedExpansion")) + tgt.setLimitedExpansion(src.getParameterBool("getParameterBool")); + return tgt; + } + + public static org.hl7.fhir.r5.model.FamilyMemberHistory convertFamilyMemberHistory(org.hl7.fhir.dstu3.model.FamilyMemberHistory src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.FamilyMemberHistory tgt = new org.hl7.fhir.r5.model.FamilyMemberHistory(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + for (org.hl7.fhir.dstu3.model.Reference t : src.getDefinition()) + tgt.addInstantiatesCanonical(t.getReference()); + if (src.hasStatus()) + tgt.setStatus(convertFamilyHistoryStatus(src.getStatus())); + if (src.hasNotDoneReason()) + tgt.setDataAbsentReason(convertCodeableConcept(src.getNotDoneReason())); + if (src.hasPatient()) + tgt.setPatient(convertReference(src.getPatient())); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasRelationship()) + tgt.setRelationship(convertCodeableConcept(src.getRelationship())); +// if (src.hasGender()) +// tgt.setGender(convertAdministrativeGender(src.getGender())); + if (src.hasBorn()) + tgt.setBorn(convertType(src.getBorn())); + if (src.hasAge()) + tgt.setAge(convertType(src.getAge())); + if (src.hasEstimatedAge()) + tgt.setEstimatedAge(src.getEstimatedAge()); + if (src.hasDeceased()) + tgt.setDeceased(convertType(src.getDeceased())); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getReasonCode()) + tgt.addReasonCode(convertCodeableConcept(t)); + for (org.hl7.fhir.dstu3.model.Reference t : src.getReasonReference()) + tgt.addReasonReference(convertReference(t)); + for (org.hl7.fhir.dstu3.model.Annotation t : src.getNote()) + tgt.addNote(convertAnnotation(t)); + for (org.hl7.fhir.dstu3.model.FamilyMemberHistory.FamilyMemberHistoryConditionComponent t : src.getCondition()) + tgt.addCondition(convertFamilyMemberHistoryConditionComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.FamilyMemberHistory convertFamilyMemberHistory(org.hl7.fhir.r5.model.FamilyMemberHistory src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.FamilyMemberHistory tgt = new org.hl7.fhir.dstu3.model.FamilyMemberHistory(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + for (org.hl7.fhir.r5.model.UriType t : src.getInstantiatesCanonical()) + tgt.addDefinition(new org.hl7.fhir.dstu3.model.Reference(t.getValue())); + if (src.hasStatus()) + tgt.setStatus(convertFamilyHistoryStatus(src.getStatus())); + if (src.hasDataAbsentReason()) + tgt.setNotDoneReason(convertCodeableConcept(src.getDataAbsentReason())); + if (src.hasPatient()) + tgt.setPatient(convertReference(src.getPatient())); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasRelationship()) + tgt.setRelationship(convertCodeableConcept(src.getRelationship())); +// if (src.hasGender()) +// tgt.setGender(convertAdministrativeGender(src.getGender())); + if (src.hasBorn()) + tgt.setBorn(convertType(src.getBorn())); + if (src.hasAge()) + tgt.setAge(convertType(src.getAge())); + if (src.hasEstimatedAge()) + tgt.setEstimatedAge(src.getEstimatedAge()); + if (src.hasDeceased()) + tgt.setDeceased(convertType(src.getDeceased())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getReasonCode()) + tgt.addReasonCode(convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getReasonReference()) + tgt.addReasonReference(convertReference(t)); + for (org.hl7.fhir.r5.model.Annotation t : src.getNote()) + tgt.addNote(convertAnnotation(t)); + for (org.hl7.fhir.r5.model.FamilyMemberHistory.FamilyMemberHistoryConditionComponent t : src.getCondition()) + tgt.addCondition(convertFamilyMemberHistoryConditionComponent(t)); + return tgt; + } + + private static org.hl7.fhir.r5.model.FamilyMemberHistory.FamilyHistoryStatus convertFamilyHistoryStatus(org.hl7.fhir.dstu3.model.FamilyMemberHistory.FamilyHistoryStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PARTIAL: return org.hl7.fhir.r5.model.FamilyMemberHistory.FamilyHistoryStatus.PARTIAL; + case COMPLETED: return org.hl7.fhir.r5.model.FamilyMemberHistory.FamilyHistoryStatus.COMPLETED; + case ENTEREDINERROR: return org.hl7.fhir.r5.model.FamilyMemberHistory.FamilyHistoryStatus.ENTEREDINERROR; + case HEALTHUNKNOWN: return org.hl7.fhir.r5.model.FamilyMemberHistory.FamilyHistoryStatus.HEALTHUNKNOWN; + default: return org.hl7.fhir.r5.model.FamilyMemberHistory.FamilyHistoryStatus.NULL; + } +} + + private static org.hl7.fhir.dstu3.model.FamilyMemberHistory.FamilyHistoryStatus convertFamilyHistoryStatus(org.hl7.fhir.r5.model.FamilyMemberHistory.FamilyHistoryStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PARTIAL: return org.hl7.fhir.dstu3.model.FamilyMemberHistory.FamilyHistoryStatus.PARTIAL; + case COMPLETED: return org.hl7.fhir.dstu3.model.FamilyMemberHistory.FamilyHistoryStatus.COMPLETED; + case ENTEREDINERROR: return org.hl7.fhir.dstu3.model.FamilyMemberHistory.FamilyHistoryStatus.ENTEREDINERROR; + case HEALTHUNKNOWN: return org.hl7.fhir.dstu3.model.FamilyMemberHistory.FamilyHistoryStatus.HEALTHUNKNOWN; + default: return org.hl7.fhir.dstu3.model.FamilyMemberHistory.FamilyHistoryStatus.NULL; + } +} + + private static org.hl7.fhir.r5.model.Enumerations.AdministrativeGender convertAdministrativeGender(org.hl7.fhir.dstu3.model.Enumerations.AdministrativeGender src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case MALE: return org.hl7.fhir.r5.model.Enumerations.AdministrativeGender.MALE; + case FEMALE: return org.hl7.fhir.r5.model.Enumerations.AdministrativeGender.FEMALE; + case OTHER: return org.hl7.fhir.r5.model.Enumerations.AdministrativeGender.OTHER; + case UNKNOWN: return org.hl7.fhir.r5.model.Enumerations.AdministrativeGender.UNKNOWN; + default: return org.hl7.fhir.r5.model.Enumerations.AdministrativeGender.NULL; + } +} + + private static org.hl7.fhir.dstu3.model.Enumerations.AdministrativeGender convertAdministrativeGender(org.hl7.fhir.r5.model.Enumerations.AdministrativeGender src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case MALE: return org.hl7.fhir.dstu3.model.Enumerations.AdministrativeGender.MALE; + case FEMALE: return org.hl7.fhir.dstu3.model.Enumerations.AdministrativeGender.FEMALE; + case OTHER: return org.hl7.fhir.dstu3.model.Enumerations.AdministrativeGender.OTHER; + case UNKNOWN: return org.hl7.fhir.dstu3.model.Enumerations.AdministrativeGender.UNKNOWN; + default: return org.hl7.fhir.dstu3.model.Enumerations.AdministrativeGender.NULL; + } +} + + public static org.hl7.fhir.r5.model.FamilyMemberHistory.FamilyMemberHistoryConditionComponent convertFamilyMemberHistoryConditionComponent(org.hl7.fhir.dstu3.model.FamilyMemberHistory.FamilyMemberHistoryConditionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.FamilyMemberHistory.FamilyMemberHistoryConditionComponent tgt = new org.hl7.fhir.r5.model.FamilyMemberHistory.FamilyMemberHistoryConditionComponent(); + copyElement(src, tgt); + if (src.hasCode()) + tgt.setCode(convertCodeableConcept(src.getCode())); + if (src.hasOutcome()) + tgt.setOutcome(convertCodeableConcept(src.getOutcome())); + if (src.hasOnset()) + tgt.setOnset(convertType(src.getOnset())); + for (org.hl7.fhir.dstu3.model.Annotation t : src.getNote()) + tgt.addNote(convertAnnotation(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.FamilyMemberHistory.FamilyMemberHistoryConditionComponent convertFamilyMemberHistoryConditionComponent(org.hl7.fhir.r5.model.FamilyMemberHistory.FamilyMemberHistoryConditionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.FamilyMemberHistory.FamilyMemberHistoryConditionComponent tgt = new org.hl7.fhir.dstu3.model.FamilyMemberHistory.FamilyMemberHistoryConditionComponent(); + copyElement(src, tgt); + if (src.hasCode()) + tgt.setCode(convertCodeableConcept(src.getCode())); + if (src.hasOutcome()) + tgt.setOutcome(convertCodeableConcept(src.getOutcome())); + if (src.hasOnset()) + tgt.setOnset(convertType(src.getOnset())); + for (org.hl7.fhir.r5.model.Annotation t : src.getNote()) + tgt.addNote(convertAnnotation(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.Flag convertFlag(org.hl7.fhir.dstu3.model.Flag src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Flag tgt = new org.hl7.fhir.r5.model.Flag(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasStatus()) + tgt.setStatus(convertFlagStatus(src.getStatus())); + if (src.hasCategory()) + tgt.addCategory(convertCodeableConcept(src.getCategory())); + if (src.hasCode()) + tgt.setCode(convertCodeableConcept(src.getCode())); + if (src.hasSubject()) + tgt.setSubject(convertReference(src.getSubject())); + if (src.hasPeriod()) + tgt.setPeriod(convertPeriod(src.getPeriod())); + if (src.hasEncounter()) + tgt.setEncounter(convertReference(src.getEncounter())); + if (src.hasAuthor()) + tgt.setAuthor(convertReference(src.getAuthor())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Flag convertFlag(org.hl7.fhir.r5.model.Flag src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Flag tgt = new org.hl7.fhir.dstu3.model.Flag(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasStatus()) + tgt.setStatus(convertFlagStatus(src.getStatus())); + if (src.hasCategory()) + tgt.setCategory(convertCodeableConcept(src.getCategoryFirstRep())); + if (src.hasCode()) + tgt.setCode(convertCodeableConcept(src.getCode())); + if (src.hasSubject()) + tgt.setSubject(convertReference(src.getSubject())); + if (src.hasPeriod()) + tgt.setPeriod(convertPeriod(src.getPeriod())); + if (src.hasEncounter()) + tgt.setEncounter(convertReference(src.getEncounter())); + if (src.hasAuthor()) + tgt.setAuthor(convertReference(src.getAuthor())); + return tgt; + } + + private static org.hl7.fhir.r5.model.Flag.FlagStatus convertFlagStatus(org.hl7.fhir.dstu3.model.Flag.FlagStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case ACTIVE: return org.hl7.fhir.r5.model.Flag.FlagStatus.ACTIVE; + case INACTIVE: return org.hl7.fhir.r5.model.Flag.FlagStatus.INACTIVE; + case ENTEREDINERROR: return org.hl7.fhir.r5.model.Flag.FlagStatus.ENTEREDINERROR; + default: return org.hl7.fhir.r5.model.Flag.FlagStatus.NULL; + } +} + + private static org.hl7.fhir.dstu3.model.Flag.FlagStatus convertFlagStatus(org.hl7.fhir.r5.model.Flag.FlagStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case ACTIVE: return org.hl7.fhir.dstu3.model.Flag.FlagStatus.ACTIVE; + case INACTIVE: return org.hl7.fhir.dstu3.model.Flag.FlagStatus.INACTIVE; + case ENTEREDINERROR: return org.hl7.fhir.dstu3.model.Flag.FlagStatus.ENTEREDINERROR; + default: return org.hl7.fhir.dstu3.model.Flag.FlagStatus.NULL; + } +} + + public static org.hl7.fhir.r5.model.Goal convertGoal(org.hl7.fhir.dstu3.model.Goal src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Goal tgt = new org.hl7.fhir.r5.model.Goal(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasStatus()) + tgt.setLifecycleStatus(convertGoalStatus(src.getStatus())); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getCategory()) + tgt.addCategory(convertCodeableConcept(t)); + if (src.hasPriority()) + tgt.setPriority(convertCodeableConcept(src.getPriority())); + if (src.hasDescription()) + tgt.setDescription(convertCodeableConcept(src.getDescription())); + if (src.hasSubject()) + tgt.setSubject(convertReference(src.getSubject())); + if (src.hasStart()) + tgt.setStart(convertType(src.getStart())); + if (src.hasTarget()) + tgt.addTarget(convertGoalTargetComponent(src.getTarget())); + if (src.hasStatusDate()) + tgt.setStatusDate(src.getStatusDate()); + if (src.hasStatusReason()) + tgt.setStatusReason(src.getStatusReason()); + if (src.hasExpressedBy()) + tgt.setExpressedBy(convertReference(src.getExpressedBy())); + for (org.hl7.fhir.dstu3.model.Reference t : src.getAddresses()) + tgt.addAddresses(convertReference(t)); + for (org.hl7.fhir.dstu3.model.Annotation t : src.getNote()) + tgt.addNote(convertAnnotation(t)); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getOutcomeCode()) + tgt.addOutcomeCode(convertCodeableConcept(t)); + for (org.hl7.fhir.dstu3.model.Reference t : src.getOutcomeReference()) + tgt.addOutcomeReference(convertReference(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Goal convertGoal(org.hl7.fhir.r5.model.Goal src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Goal tgt = new org.hl7.fhir.dstu3.model.Goal(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasLifecycleStatus()) + tgt.setStatus(convertGoalStatus(src.getLifecycleStatus())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getCategory()) + tgt.addCategory(convertCodeableConcept(t)); + if (src.hasPriority()) + tgt.setPriority(convertCodeableConcept(src.getPriority())); + if (src.hasDescription()) + tgt.setDescription(convertCodeableConcept(src.getDescription())); + if (src.hasSubject()) + tgt.setSubject(convertReference(src.getSubject())); + if (src.hasStart()) + tgt.setStart(convertType(src.getStart())); + if (src.hasTarget()) + tgt.setTarget(convertGoalTargetComponent(src.getTargetFirstRep())); + if (src.hasStatusDate()) + tgt.setStatusDate(src.getStatusDate()); + if (src.hasStatusReason()) + tgt.setStatusReason(src.getStatusReason()); + if (src.hasExpressedBy()) + tgt.setExpressedBy(convertReference(src.getExpressedBy())); + for (org.hl7.fhir.r5.model.Reference t : src.getAddresses()) + tgt.addAddresses(convertReference(t)); + for (org.hl7.fhir.r5.model.Annotation t : src.getNote()) + tgt.addNote(convertAnnotation(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getOutcomeCode()) + tgt.addOutcomeCode(convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getOutcomeReference()) + tgt.addOutcomeReference(convertReference(t)); + return tgt; + } + + private static org.hl7.fhir.r5.model.Goal.GoalLifecycleStatus convertGoalStatus(org.hl7.fhir.dstu3.model.Goal.GoalStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PROPOSED: return org.hl7.fhir.r5.model.Goal.GoalLifecycleStatus.PROPOSED; + case ACCEPTED: return org.hl7.fhir.r5.model.Goal.GoalLifecycleStatus.ACCEPTED; + case PLANNED: return org.hl7.fhir.r5.model.Goal.GoalLifecycleStatus.PLANNED; + case INPROGRESS: return org.hl7.fhir.r5.model.Goal.GoalLifecycleStatus.ACTIVE; + case ONTARGET: return org.hl7.fhir.r5.model.Goal.GoalLifecycleStatus.ACTIVE; + case AHEADOFTARGET: return org.hl7.fhir.r5.model.Goal.GoalLifecycleStatus.ACTIVE; + case BEHINDTARGET: return org.hl7.fhir.r5.model.Goal.GoalLifecycleStatus.ACTIVE; + case SUSTAINING: return org.hl7.fhir.r5.model.Goal.GoalLifecycleStatus.ACTIVE; + case ACHIEVED: return org.hl7.fhir.r5.model.Goal.GoalLifecycleStatus.COMPLETED; + case ONHOLD: return org.hl7.fhir.r5.model.Goal.GoalLifecycleStatus.ONHOLD; + case CANCELLED: return org.hl7.fhir.r5.model.Goal.GoalLifecycleStatus.CANCELLED; + case ENTEREDINERROR: return org.hl7.fhir.r5.model.Goal.GoalLifecycleStatus.ENTEREDINERROR; + case REJECTED: return org.hl7.fhir.r5.model.Goal.GoalLifecycleStatus.REJECTED; + default: return org.hl7.fhir.r5.model.Goal.GoalLifecycleStatus.NULL; + } +} + + private static org.hl7.fhir.dstu3.model.Goal.GoalStatus convertGoalStatus(org.hl7.fhir.r5.model.Goal.GoalLifecycleStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PROPOSED: return org.hl7.fhir.dstu3.model.Goal.GoalStatus.PROPOSED; + case ACCEPTED: return org.hl7.fhir.dstu3.model.Goal.GoalStatus.ACCEPTED; + case PLANNED: return org.hl7.fhir.dstu3.model.Goal.GoalStatus.PLANNED; + case ACTIVE: return org.hl7.fhir.dstu3.model.Goal.GoalStatus.INPROGRESS; + case COMPLETED: return org.hl7.fhir.dstu3.model.Goal.GoalStatus.ACHIEVED; + case ONHOLD: return org.hl7.fhir.dstu3.model.Goal.GoalStatus.ONHOLD; + case CANCELLED: return org.hl7.fhir.dstu3.model.Goal.GoalStatus.CANCELLED; + case ENTEREDINERROR: return org.hl7.fhir.dstu3.model.Goal.GoalStatus.ENTEREDINERROR; + case REJECTED: return org.hl7.fhir.dstu3.model.Goal.GoalStatus.REJECTED; + default: return org.hl7.fhir.dstu3.model.Goal.GoalStatus.NULL; + } +} + + public static org.hl7.fhir.r5.model.Goal.GoalTargetComponent convertGoalTargetComponent(org.hl7.fhir.dstu3.model.Goal.GoalTargetComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Goal.GoalTargetComponent tgt = new org.hl7.fhir.r5.model.Goal.GoalTargetComponent(); + copyElement(src, tgt); + if (src.hasMeasure()) + tgt.setMeasure(convertCodeableConcept(src.getMeasure())); + if (src.hasDetail()) + tgt.setDetail(convertType(src.getDetail())); + if (src.hasDue()) + tgt.setDue(convertType(src.getDue())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Goal.GoalTargetComponent convertGoalTargetComponent(org.hl7.fhir.r5.model.Goal.GoalTargetComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Goal.GoalTargetComponent tgt = new org.hl7.fhir.dstu3.model.Goal.GoalTargetComponent(); + copyElement(src, tgt); + if (src.hasMeasure()) + tgt.setMeasure(convertCodeableConcept(src.getMeasure())); + if (src.hasDetail()) + tgt.setDetail(convertType(src.getDetail())); + if (src.hasDue()) + tgt.setDue(convertType(src.getDue())); + return tgt; + } + + public static org.hl7.fhir.r5.model.GraphDefinition convertGraphDefinition(org.hl7.fhir.dstu3.model.GraphDefinition src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.GraphDefinition tgt = new org.hl7.fhir.r5.model.GraphDefinition(); + copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasStatus()) + tgt.setStatus(convertPublicationStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) + tgt.addContact(convertContactDetail(t)); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu3.model.UsageContext t : src.getUseContext()) + tgt.addUseContext(convertUsageContext(t)); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction()) + tgt.addJurisdiction(convertCodeableConcept(t)); + if (src.hasPurpose()) + tgt.setPurpose(src.getPurpose()); + if (src.hasStart()) + tgt.setStart(src.getStart()); + if (src.hasProfile()) + tgt.setProfile(src.getProfile()); + for (org.hl7.fhir.dstu3.model.GraphDefinition.GraphDefinitionLinkComponent t : src.getLink()) + tgt.addLink(convertGraphDefinitionLinkComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.GraphDefinition convertGraphDefinition(org.hl7.fhir.r5.model.GraphDefinition src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.GraphDefinition tgt = new org.hl7.fhir.dstu3.model.GraphDefinition(); + copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasStatus()) + tgt.setStatus(convertPublicationStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.r5.model.ContactDetail t : src.getContact()) + tgt.addContact(convertContactDetail(t)); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.r5.model.UsageContext t : src.getUseContext()) + tgt.addUseContext(convertUsageContext(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getJurisdiction()) + tgt.addJurisdiction(convertCodeableConcept(t)); + if (src.hasPurpose()) + tgt.setPurpose(src.getPurpose()); + if (src.hasStart()) + tgt.setStart(src.getStart()); + if (src.hasProfile()) + tgt.setProfile(src.getProfile()); + for (org.hl7.fhir.r5.model.GraphDefinition.GraphDefinitionLinkComponent t : src.getLink()) + tgt.addLink(convertGraphDefinitionLinkComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.GraphDefinition.GraphDefinitionLinkComponent convertGraphDefinitionLinkComponent(org.hl7.fhir.dstu3.model.GraphDefinition.GraphDefinitionLinkComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.GraphDefinition.GraphDefinitionLinkComponent tgt = new org.hl7.fhir.r5.model.GraphDefinition.GraphDefinitionLinkComponent(); + copyElement(src, tgt); + if (src.hasPath()) + tgt.setPath(src.getPath()); + if (src.hasSliceName()) + tgt.setSliceName(src.getSliceName()); + if (src.hasMin()) + tgt.setMin(src.getMin()); + if (src.hasMax()) + tgt.setMax(src.getMax()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu3.model.GraphDefinition.GraphDefinitionLinkTargetComponent t : src.getTarget()) + tgt.addTarget(convertGraphDefinitionLinkTargetComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.GraphDefinition.GraphDefinitionLinkComponent convertGraphDefinitionLinkComponent(org.hl7.fhir.r5.model.GraphDefinition.GraphDefinitionLinkComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.GraphDefinition.GraphDefinitionLinkComponent tgt = new org.hl7.fhir.dstu3.model.GraphDefinition.GraphDefinitionLinkComponent(); + copyElement(src, tgt); + if (src.hasPath()) + tgt.setPath(src.getPath()); + if (src.hasSliceName()) + tgt.setSliceName(src.getSliceName()); + if (src.hasMin()) + tgt.setMin(src.getMin()); + if (src.hasMax()) + tgt.setMax(src.getMax()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.r5.model.GraphDefinition.GraphDefinitionLinkTargetComponent t : src.getTarget()) + tgt.addTarget(convertGraphDefinitionLinkTargetComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.GraphDefinition.GraphDefinitionLinkTargetComponent convertGraphDefinitionLinkTargetComponent(org.hl7.fhir.dstu3.model.GraphDefinition.GraphDefinitionLinkTargetComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.GraphDefinition.GraphDefinitionLinkTargetComponent tgt = new org.hl7.fhir.r5.model.GraphDefinition.GraphDefinitionLinkTargetComponent(); + copyElement(src, tgt); + if (src.hasType()) + tgt.setType(src.getType()); + if (src.hasProfile()) + tgt.setProfile(src.getProfile()); + for (org.hl7.fhir.dstu3.model.GraphDefinition.GraphDefinitionLinkTargetCompartmentComponent t : src.getCompartment()) + tgt.addCompartment(convertGraphDefinitionLinkTargetCompartmentComponent(t)); + for (org.hl7.fhir.dstu3.model.GraphDefinition.GraphDefinitionLinkComponent t : src.getLink()) + tgt.addLink(convertGraphDefinitionLinkComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.GraphDefinition.GraphDefinitionLinkTargetComponent convertGraphDefinitionLinkTargetComponent(org.hl7.fhir.r5.model.GraphDefinition.GraphDefinitionLinkTargetComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.GraphDefinition.GraphDefinitionLinkTargetComponent tgt = new org.hl7.fhir.dstu3.model.GraphDefinition.GraphDefinitionLinkTargetComponent(); + copyElement(src, tgt); + if (src.hasType()) + tgt.setType(src.getType()); + if (src.hasProfile()) + tgt.setProfile(src.getProfile()); + for (org.hl7.fhir.r5.model.GraphDefinition.GraphDefinitionLinkTargetCompartmentComponent t : src.getCompartment()) + tgt.addCompartment(convertGraphDefinitionLinkTargetCompartmentComponent(t)); + for (org.hl7.fhir.r5.model.GraphDefinition.GraphDefinitionLinkComponent t : src.getLink()) + tgt.addLink(convertGraphDefinitionLinkComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.GraphDefinition.GraphDefinitionLinkTargetCompartmentComponent convertGraphDefinitionLinkTargetCompartmentComponent(org.hl7.fhir.dstu3.model.GraphDefinition.GraphDefinitionLinkTargetCompartmentComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.GraphDefinition.GraphDefinitionLinkTargetCompartmentComponent tgt = new org.hl7.fhir.r5.model.GraphDefinition.GraphDefinitionLinkTargetCompartmentComponent(); + copyElement(src, tgt); + if (src.hasCode()) + tgt.setCode(convertCompartmentCode(src.getCode())); + if (src.hasRule()) + tgt.setRule(convertGraphCompartmentRule(src.getRule())); + if (src.hasExpression()) + tgt.setExpression(src.getExpression()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.GraphDefinition.GraphDefinitionLinkTargetCompartmentComponent convertGraphDefinitionLinkTargetCompartmentComponent(org.hl7.fhir.r5.model.GraphDefinition.GraphDefinitionLinkTargetCompartmentComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.GraphDefinition.GraphDefinitionLinkTargetCompartmentComponent tgt = new org.hl7.fhir.dstu3.model.GraphDefinition.GraphDefinitionLinkTargetCompartmentComponent(); + copyElement(src, tgt); + if (src.hasCode()) + tgt.setCode(convertCompartmentCode(src.getCode())); + if (src.hasRule()) + tgt.setRule(convertGraphCompartmentRule(src.getRule())); + if (src.hasExpression()) + tgt.setExpression(src.getExpression()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + return tgt; + } + + private static org.hl7.fhir.r5.model.GraphDefinition.CompartmentCode convertCompartmentCode(org.hl7.fhir.dstu3.model.GraphDefinition.CompartmentCode src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PATIENT: return org.hl7.fhir.r5.model.GraphDefinition.CompartmentCode.PATIENT; + case ENCOUNTER: return org.hl7.fhir.r5.model.GraphDefinition.CompartmentCode.ENCOUNTER; + case RELATEDPERSON: return org.hl7.fhir.r5.model.GraphDefinition.CompartmentCode.RELATEDPERSON; + case PRACTITIONER: return org.hl7.fhir.r5.model.GraphDefinition.CompartmentCode.PRACTITIONER; + case DEVICE: return org.hl7.fhir.r5.model.GraphDefinition.CompartmentCode.DEVICE; + default: return org.hl7.fhir.r5.model.GraphDefinition.CompartmentCode.NULL; + } +} + + private static org.hl7.fhir.dstu3.model.GraphDefinition.CompartmentCode convertCompartmentCode(org.hl7.fhir.r5.model.GraphDefinition.CompartmentCode src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PATIENT: return org.hl7.fhir.dstu3.model.GraphDefinition.CompartmentCode.PATIENT; + case ENCOUNTER: return org.hl7.fhir.dstu3.model.GraphDefinition.CompartmentCode.ENCOUNTER; + case RELATEDPERSON: return org.hl7.fhir.dstu3.model.GraphDefinition.CompartmentCode.RELATEDPERSON; + case PRACTITIONER: return org.hl7.fhir.dstu3.model.GraphDefinition.CompartmentCode.PRACTITIONER; + case DEVICE: return org.hl7.fhir.dstu3.model.GraphDefinition.CompartmentCode.DEVICE; + default: return org.hl7.fhir.dstu3.model.GraphDefinition.CompartmentCode.NULL; + } +} + + private static org.hl7.fhir.r5.model.GraphDefinition.GraphCompartmentRule convertGraphCompartmentRule(org.hl7.fhir.dstu3.model.GraphDefinition.GraphCompartmentRule src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case IDENTICAL: return org.hl7.fhir.r5.model.GraphDefinition.GraphCompartmentRule.IDENTICAL; + case MATCHING: return org.hl7.fhir.r5.model.GraphDefinition.GraphCompartmentRule.MATCHING; + case DIFFERENT: return org.hl7.fhir.r5.model.GraphDefinition.GraphCompartmentRule.DIFFERENT; + case CUSTOM: return org.hl7.fhir.r5.model.GraphDefinition.GraphCompartmentRule.CUSTOM; + default: return org.hl7.fhir.r5.model.GraphDefinition.GraphCompartmentRule.NULL; + } +} + + private static org.hl7.fhir.dstu3.model.GraphDefinition.GraphCompartmentRule convertGraphCompartmentRule(org.hl7.fhir.r5.model.GraphDefinition.GraphCompartmentRule src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case IDENTICAL: return org.hl7.fhir.dstu3.model.GraphDefinition.GraphCompartmentRule.IDENTICAL; + case MATCHING: return org.hl7.fhir.dstu3.model.GraphDefinition.GraphCompartmentRule.MATCHING; + case DIFFERENT: return org.hl7.fhir.dstu3.model.GraphDefinition.GraphCompartmentRule.DIFFERENT; + case CUSTOM: return org.hl7.fhir.dstu3.model.GraphDefinition.GraphCompartmentRule.CUSTOM; + default: return org.hl7.fhir.dstu3.model.GraphDefinition.GraphCompartmentRule.NULL; + } +} + + public static org.hl7.fhir.r5.model.Group convertGroup(org.hl7.fhir.dstu3.model.Group src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Group tgt = new org.hl7.fhir.r5.model.Group(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasActive()) + tgt.setActive(src.getActive()); + if (src.hasType()) + tgt.setType(convertGroupType(src.getType())); + if (src.hasActual()) + tgt.setActual(src.getActual()); + if (src.hasCode()) + tgt.setCode(convertCodeableConcept(src.getCode())); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasQuantity()) + tgt.setQuantity(src.getQuantity()); + for (org.hl7.fhir.dstu3.model.Group.GroupCharacteristicComponent t : src.getCharacteristic()) + tgt.addCharacteristic(convertGroupCharacteristicComponent(t)); + for (org.hl7.fhir.dstu3.model.Group.GroupMemberComponent t : src.getMember()) + tgt.addMember(convertGroupMemberComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Group convertGroup(org.hl7.fhir.r5.model.Group src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Group tgt = new org.hl7.fhir.dstu3.model.Group(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasActive()) + tgt.setActive(src.getActive()); + if (src.hasType()) + tgt.setType(convertGroupType(src.getType())); + if (src.hasActual()) + tgt.setActual(src.getActual()); + if (src.hasCode()) + tgt.setCode(convertCodeableConcept(src.getCode())); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasQuantity()) + tgt.setQuantity(src.getQuantity()); + for (org.hl7.fhir.r5.model.Group.GroupCharacteristicComponent t : src.getCharacteristic()) + tgt.addCharacteristic(convertGroupCharacteristicComponent(t)); + for (org.hl7.fhir.r5.model.Group.GroupMemberComponent t : src.getMember()) + tgt.addMember(convertGroupMemberComponent(t)); + return tgt; + } + + private static org.hl7.fhir.r5.model.Group.GroupType convertGroupType(org.hl7.fhir.dstu3.model.Group.GroupType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PERSON: return org.hl7.fhir.r5.model.Group.GroupType.PERSON; + case ANIMAL: return org.hl7.fhir.r5.model.Group.GroupType.ANIMAL; + case PRACTITIONER: return org.hl7.fhir.r5.model.Group.GroupType.PRACTITIONER; + case DEVICE: return org.hl7.fhir.r5.model.Group.GroupType.DEVICE; + case MEDICATION: return org.hl7.fhir.r5.model.Group.GroupType.MEDICATION; + case SUBSTANCE: return org.hl7.fhir.r5.model.Group.GroupType.SUBSTANCE; + default: return org.hl7.fhir.r5.model.Group.GroupType.NULL; + } +} + + private static org.hl7.fhir.dstu3.model.Group.GroupType convertGroupType(org.hl7.fhir.r5.model.Group.GroupType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PERSON: return org.hl7.fhir.dstu3.model.Group.GroupType.PERSON; + case ANIMAL: return org.hl7.fhir.dstu3.model.Group.GroupType.ANIMAL; + case PRACTITIONER: return org.hl7.fhir.dstu3.model.Group.GroupType.PRACTITIONER; + case DEVICE: return org.hl7.fhir.dstu3.model.Group.GroupType.DEVICE; + case MEDICATION: return org.hl7.fhir.dstu3.model.Group.GroupType.MEDICATION; + case SUBSTANCE: return org.hl7.fhir.dstu3.model.Group.GroupType.SUBSTANCE; + default: return org.hl7.fhir.dstu3.model.Group.GroupType.NULL; + } +} + + public static org.hl7.fhir.r5.model.Group.GroupCharacteristicComponent convertGroupCharacteristicComponent(org.hl7.fhir.dstu3.model.Group.GroupCharacteristicComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Group.GroupCharacteristicComponent tgt = new org.hl7.fhir.r5.model.Group.GroupCharacteristicComponent(); + copyElement(src, tgt); + if (src.hasCode()) + tgt.setCode(convertCodeableConcept(src.getCode())); + if (src.hasValue()) + tgt.setValue(convertType(src.getValue())); + if (src.hasExclude()) + tgt.setExclude(src.getExclude()); + if (src.hasPeriod()) + tgt.setPeriod(convertPeriod(src.getPeriod())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Group.GroupCharacteristicComponent convertGroupCharacteristicComponent(org.hl7.fhir.r5.model.Group.GroupCharacteristicComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Group.GroupCharacteristicComponent tgt = new org.hl7.fhir.dstu3.model.Group.GroupCharacteristicComponent(); + copyElement(src, tgt); + if (src.hasCode()) + tgt.setCode(convertCodeableConcept(src.getCode())); + if (src.hasValue()) + tgt.setValue(convertType(src.getValue())); + if (src.hasExclude()) + tgt.setExclude(src.getExclude()); + if (src.hasPeriod()) + tgt.setPeriod(convertPeriod(src.getPeriod())); + return tgt; + } + + public static org.hl7.fhir.r5.model.Group.GroupMemberComponent convertGroupMemberComponent(org.hl7.fhir.dstu3.model.Group.GroupMemberComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Group.GroupMemberComponent tgt = new org.hl7.fhir.r5.model.Group.GroupMemberComponent(); + copyElement(src, tgt); + if (src.hasEntity()) + tgt.setEntity(convertReference(src.getEntity())); + if (src.hasPeriod()) + tgt.setPeriod(convertPeriod(src.getPeriod())); + if (src.hasInactive()) + tgt.setInactive(src.getInactive()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Group.GroupMemberComponent convertGroupMemberComponent(org.hl7.fhir.r5.model.Group.GroupMemberComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Group.GroupMemberComponent tgt = new org.hl7.fhir.dstu3.model.Group.GroupMemberComponent(); + copyElement(src, tgt); + if (src.hasEntity()) + tgt.setEntity(convertReference(src.getEntity())); + if (src.hasPeriod()) + tgt.setPeriod(convertPeriod(src.getPeriod())); + if (src.hasInactive()) + tgt.setInactive(src.getInactive()); + return tgt; + } + + + public static org.hl7.fhir.r5.model.HealthcareService convertHealthcareService(org.hl7.fhir.dstu3.model.HealthcareService src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.HealthcareService tgt = new org.hl7.fhir.r5.model.HealthcareService(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasActive()) + tgt.setActive(src.getActive()); + if (src.hasProvidedBy()) + tgt.setProvidedBy(convertReference(src.getProvidedBy())); + if (src.hasCategory()) + tgt.addCategory(convertCodeableConcept(src.getCategory())); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getType()) + tgt.addType(convertCodeableConcept(t)); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getSpecialty()) + tgt.addSpecialty(convertCodeableConcept(t)); + for (org.hl7.fhir.dstu3.model.Reference t : src.getLocation()) + tgt.addLocation(convertReference(t)); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasComment()) + tgt.setComment(src.getComment()); + if (src.hasExtraDetails()) + tgt.setExtraDetails(src.getExtraDetails()); + if (src.hasPhoto()) + tgt.setPhoto(convertAttachment(src.getPhoto())); + for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom()) + tgt.addTelecom(convertContactPoint(t)); + for (org.hl7.fhir.dstu3.model.Reference t : src.getCoverageArea()) + tgt.addCoverageArea(convertReference(t)); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getServiceProvisionCode()) + tgt.addServiceProvisionCode(convertCodeableConcept(t)); + if (src.hasEligibility() || src.hasEligibilityNote()) { + HealthcareServiceEligibilityComponent t = tgt.addEligibility(); + t.setCode(convertCodeableConcept(src.getEligibility())); + if (src.hasEligibilityNote()) + t.setComment(src.getEligibilityNote()); + } + for (org.hl7.fhir.dstu3.model.StringType t : src.getProgramName()) + tgt.addProgram().setText(t.getValue()); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getCharacteristic()) + tgt.addCharacteristic(convertCodeableConcept(t)); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getReferralMethod()) + tgt.addReferralMethod(convertCodeableConcept(t)); + if (src.hasAppointmentRequired()) + tgt.setAppointmentRequired(src.getAppointmentRequired()); + for (org.hl7.fhir.dstu3.model.HealthcareService.HealthcareServiceAvailableTimeComponent t : src.getAvailableTime()) + tgt.addAvailableTime(convertHealthcareServiceAvailableTimeComponent(t)); + for (org.hl7.fhir.dstu3.model.HealthcareService.HealthcareServiceNotAvailableComponent t : src.getNotAvailable()) + tgt.addNotAvailable(convertHealthcareServiceNotAvailableComponent(t)); + if (src.hasAvailabilityExceptions()) + tgt.setAvailabilityExceptions(src.getAvailabilityExceptions()); + for (org.hl7.fhir.dstu3.model.Reference t : src.getEndpoint()) + tgt.addEndpoint(convertReference(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.HealthcareService convertHealthcareService(org.hl7.fhir.r5.model.HealthcareService src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.HealthcareService tgt = new org.hl7.fhir.dstu3.model.HealthcareService(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasActive()) + tgt.setActive(src.getActive()); + if (src.hasProvidedBy()) + tgt.setProvidedBy(convertReference(src.getProvidedBy())); + if (src.hasCategory()) + tgt.setCategory(convertCodeableConcept(src.getCategoryFirstRep())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getType()) + tgt.addType(convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getSpecialty()) + tgt.addSpecialty(convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getLocation()) + tgt.addLocation(convertReference(t)); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasComment()) + tgt.setComment(src.getComment()); + if (src.hasExtraDetails()) + tgt.setExtraDetails(src.getExtraDetails()); + if (src.hasPhoto()) + tgt.setPhoto(convertAttachment(src.getPhoto())); + for (org.hl7.fhir.r5.model.ContactPoint t : src.getTelecom()) + tgt.addTelecom(convertContactPoint(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getCoverageArea()) + tgt.addCoverageArea(convertReference(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getServiceProvisionCode()) + tgt.addServiceProvisionCode(convertCodeableConcept(t)); + if (src.hasEligibility()) { + tgt.setEligibility(convertCodeableConcept(src.getEligibilityFirstRep().getCode())); + if (src.getEligibilityFirstRep().hasComment()) + tgt.setEligibilityNote(src.getEligibilityFirstRep().getComment()); + } + for (CodeableConcept t : src.getProgram()) + tgt.addProgramName(t.getText()); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getCharacteristic()) + tgt.addCharacteristic(convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getReferralMethod()) + tgt.addReferralMethod(convertCodeableConcept(t)); + if (src.hasAppointmentRequired()) + tgt.setAppointmentRequired(src.getAppointmentRequired()); + for (org.hl7.fhir.r5.model.HealthcareService.HealthcareServiceAvailableTimeComponent t : src.getAvailableTime()) + tgt.addAvailableTime(convertHealthcareServiceAvailableTimeComponent(t)); + for (org.hl7.fhir.r5.model.HealthcareService.HealthcareServiceNotAvailableComponent t : src.getNotAvailable()) + tgt.addNotAvailable(convertHealthcareServiceNotAvailableComponent(t)); + if (src.hasAvailabilityExceptions()) + tgt.setAvailabilityExceptions(src.getAvailabilityExceptions()); + for (org.hl7.fhir.r5.model.Reference t : src.getEndpoint()) + tgt.addEndpoint(convertReference(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.HealthcareService.HealthcareServiceAvailableTimeComponent convertHealthcareServiceAvailableTimeComponent(org.hl7.fhir.dstu3.model.HealthcareService.HealthcareServiceAvailableTimeComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.HealthcareService.HealthcareServiceAvailableTimeComponent tgt = new org.hl7.fhir.r5.model.HealthcareService.HealthcareServiceAvailableTimeComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.dstu3.model.Enumeration t : src.getDaysOfWeek()) + tgt.addDaysOfWeek(convertDaysOfWeek(t.getValue())); + if (src.hasAllDay()) + tgt.setAllDay(src.getAllDay()); + if (src.hasAvailableStartTime()) + tgt.setAvailableStartTime(src.getAvailableStartTime()); + if (src.hasAvailableEndTime()) + tgt.setAvailableEndTime(src.getAvailableEndTime()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.HealthcareService.HealthcareServiceAvailableTimeComponent convertHealthcareServiceAvailableTimeComponent(org.hl7.fhir.r5.model.HealthcareService.HealthcareServiceAvailableTimeComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.HealthcareService.HealthcareServiceAvailableTimeComponent tgt = new org.hl7.fhir.dstu3.model.HealthcareService.HealthcareServiceAvailableTimeComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.r5.model.Enumeration t : src.getDaysOfWeek()) + tgt.addDaysOfWeek(convertDaysOfWeek(t.getValue())); + if (src.hasAllDay()) + tgt.setAllDay(src.getAllDay()); + if (src.hasAvailableStartTime()) + tgt.setAvailableStartTime(src.getAvailableStartTime()); + if (src.hasAvailableEndTime()) + tgt.setAvailableEndTime(src.getAvailableEndTime()); + return tgt; + } + + private static org.hl7.fhir.r5.model.HealthcareService.DaysOfWeek convertDaysOfWeek(org.hl7.fhir.dstu3.model.HealthcareService.DaysOfWeek src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case MON: return org.hl7.fhir.r5.model.HealthcareService.DaysOfWeek.MON; + case TUE: return org.hl7.fhir.r5.model.HealthcareService.DaysOfWeek.TUE; + case WED: return org.hl7.fhir.r5.model.HealthcareService.DaysOfWeek.WED; + case THU: return org.hl7.fhir.r5.model.HealthcareService.DaysOfWeek.THU; + case FRI: return org.hl7.fhir.r5.model.HealthcareService.DaysOfWeek.FRI; + case SAT: return org.hl7.fhir.r5.model.HealthcareService.DaysOfWeek.SAT; + case SUN: return org.hl7.fhir.r5.model.HealthcareService.DaysOfWeek.SUN; + default: return org.hl7.fhir.r5.model.HealthcareService.DaysOfWeek.NULL; + } +} + + private static org.hl7.fhir.dstu3.model.HealthcareService.DaysOfWeek convertDaysOfWeek(org.hl7.fhir.r5.model.HealthcareService.DaysOfWeek src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case MON: return org.hl7.fhir.dstu3.model.HealthcareService.DaysOfWeek.MON; + case TUE: return org.hl7.fhir.dstu3.model.HealthcareService.DaysOfWeek.TUE; + case WED: return org.hl7.fhir.dstu3.model.HealthcareService.DaysOfWeek.WED; + case THU: return org.hl7.fhir.dstu3.model.HealthcareService.DaysOfWeek.THU; + case FRI: return org.hl7.fhir.dstu3.model.HealthcareService.DaysOfWeek.FRI; + case SAT: return org.hl7.fhir.dstu3.model.HealthcareService.DaysOfWeek.SAT; + case SUN: return org.hl7.fhir.dstu3.model.HealthcareService.DaysOfWeek.SUN; + default: return org.hl7.fhir.dstu3.model.HealthcareService.DaysOfWeek.NULL; + } +} + + public static org.hl7.fhir.r5.model.HealthcareService.HealthcareServiceNotAvailableComponent convertHealthcareServiceNotAvailableComponent(org.hl7.fhir.dstu3.model.HealthcareService.HealthcareServiceNotAvailableComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.HealthcareService.HealthcareServiceNotAvailableComponent tgt = new org.hl7.fhir.r5.model.HealthcareService.HealthcareServiceNotAvailableComponent(); + copyElement(src, tgt); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + if (src.hasDuring()) + tgt.setDuring(convertPeriod(src.getDuring())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.HealthcareService.HealthcareServiceNotAvailableComponent convertHealthcareServiceNotAvailableComponent(org.hl7.fhir.r5.model.HealthcareService.HealthcareServiceNotAvailableComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.HealthcareService.HealthcareServiceNotAvailableComponent tgt = new org.hl7.fhir.dstu3.model.HealthcareService.HealthcareServiceNotAvailableComponent(); + copyElement(src, tgt); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + if (src.hasDuring()) + tgt.setDuring(convertPeriod(src.getDuring())); + return tgt; + } + + public static org.hl7.fhir.r5.model.Immunization convertImmunization(org.hl7.fhir.dstu3.model.Immunization src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Immunization tgt = new org.hl7.fhir.r5.model.Immunization(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasStatus()) + tgt.setStatus(convertImmunizationStatus(src.getStatus())); + if (src.hasVaccineCode()) + tgt.setVaccineCode(convertCodeableConcept(src.getVaccineCode())); + if (src.hasPatient()) + tgt.setPatient(convertReference(src.getPatient())); + if (src.hasEncounter()) + tgt.setEncounter(convertReference(src.getEncounter())); + if (src.hasDate()) + tgt.setOccurrence(convertDateTime(src.getDateElement())); + if (src.hasPrimarySource()) + tgt.setPrimarySource(src.getPrimarySource()); + if (src.hasReportOrigin()) + tgt.setReportOrigin(convertCodeableConcept(src.getReportOrigin())); + if (src.hasLocation()) + tgt.setLocation(convertReference(src.getLocation())); + if (src.hasManufacturer()) + tgt.setManufacturer(convertReference(src.getManufacturer())); + if (src.hasLotNumber()) + tgt.setLotNumber(src.getLotNumber()); + if (src.hasExpirationDate()) + tgt.setExpirationDate(src.getExpirationDate()); + if (src.hasSite()) + tgt.setSite(convertCodeableConcept(src.getSite())); + if (src.hasRoute()) + tgt.setRoute(convertCodeableConcept(src.getRoute())); + if (src.hasDoseQuantity()) + tgt.setDoseQuantity(convertSimpleQuantity(src.getDoseQuantity())); + for (org.hl7.fhir.dstu3.model.Immunization.ImmunizationPractitionerComponent t : src.getPractitioner()) + tgt.addPerformer(convertImmunizationPractitionerComponent(t)); + for (org.hl7.fhir.dstu3.model.Annotation t : src.getNote()) + tgt.addNote(convertAnnotation(t)); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getExplanation().getReason()) + tgt.addReasonCode(convertCodeableConcept(t)); +// for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getExplanation().getReasonNotGiven()) +// tgt.addReason(convertCodeableConcept(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Immunization convertImmunization(org.hl7.fhir.r5.model.Immunization src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Immunization tgt = new org.hl7.fhir.dstu3.model.Immunization(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasStatus()) + tgt.setStatus(convertImmunizationStatus(src.getStatus())); + if (src.hasVaccineCode()) + tgt.setVaccineCode(convertCodeableConcept(src.getVaccineCode())); + if (src.hasPatient()) + tgt.setPatient(convertReference(src.getPatient())); + if (src.hasEncounter()) + tgt.setEncounter(convertReference(src.getEncounter())); + if (src.hasOccurrenceDateTimeType()) + tgt.setDateElement(convertDateTime(src.getOccurrenceDateTimeType())); + if (src.hasPrimarySource()) + tgt.setPrimarySource(src.getPrimarySource()); + if (src.hasReportOrigin()) + tgt.setReportOrigin(convertCodeableConcept(src.getReportOrigin())); + if (src.hasLocation()) + tgt.setLocation(convertReference(src.getLocation())); + if (src.hasManufacturer()) + tgt.setManufacturer(convertReference(src.getManufacturer())); + if (src.hasLotNumber()) + tgt.setLotNumber(src.getLotNumber()); + if (src.hasExpirationDate()) + tgt.setExpirationDate(src.getExpirationDate()); + if (src.hasSite()) + tgt.setSite(convertCodeableConcept(src.getSite())); + if (src.hasRoute()) + tgt.setRoute(convertCodeableConcept(src.getRoute())); + if (src.hasDoseQuantity()) + tgt.setDoseQuantity(convertSimpleQuantity(src.getDoseQuantity())); + for (org.hl7.fhir.r5.model.Immunization.ImmunizationPerformerComponent t : src.getPerformer()) + tgt.addPractitioner(convertImmunizationPractitionerComponent(t)); + for (org.hl7.fhir.r5.model.Annotation t : src.getNote()) + tgt.addNote(convertAnnotation(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getReasonCode()) + tgt.getExplanation().addReason(convertCodeableConcept(t)); + return tgt; + } + + private static org.hl7.fhir.r5.model.Immunization.ImmunizationStatus convertImmunizationStatus(org.hl7.fhir.dstu3.model.Immunization.ImmunizationStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case COMPLETED: return org.hl7.fhir.r5.model.Immunization.ImmunizationStatus.COMPLETED; + case ENTEREDINERROR: return org.hl7.fhir.r5.model.Immunization.ImmunizationStatus.ENTEREDINERROR; + default: return org.hl7.fhir.r5.model.Immunization.ImmunizationStatus.NULL; + } +} + + private static org.hl7.fhir.dstu3.model.Immunization.ImmunizationStatus convertImmunizationStatus(org.hl7.fhir.r5.model.Immunization.ImmunizationStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case COMPLETED: return org.hl7.fhir.dstu3.model.Immunization.ImmunizationStatus.COMPLETED; + case ENTEREDINERROR: return org.hl7.fhir.dstu3.model.Immunization.ImmunizationStatus.ENTEREDINERROR; + default: return org.hl7.fhir.dstu3.model.Immunization.ImmunizationStatus.NULL; + } +} + + public static org.hl7.fhir.r5.model.Immunization.ImmunizationPerformerComponent convertImmunizationPractitionerComponent(org.hl7.fhir.dstu3.model.Immunization.ImmunizationPractitionerComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Immunization.ImmunizationPerformerComponent tgt = new org.hl7.fhir.r5.model.Immunization.ImmunizationPerformerComponent(); + copyElement(src, tgt); + if (src.hasRole()) + tgt.setFunction(convertCodeableConcept(src.getRole())); + if (src.hasActor()) + tgt.setActor(convertReference(src.getActor())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Immunization.ImmunizationPractitionerComponent convertImmunizationPractitionerComponent(org.hl7.fhir.r5.model.Immunization.ImmunizationPerformerComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Immunization.ImmunizationPractitionerComponent tgt = new org.hl7.fhir.dstu3.model.Immunization.ImmunizationPractitionerComponent(); + copyElement(src, tgt); + if (src.hasFunction()) + tgt.setRole(convertCodeableConcept(src.getFunction())); + if (src.hasActor()) + tgt.setActor(convertReference(src.getActor())); + return tgt; + } + + + + public static org.hl7.fhir.r5.model.ImplementationGuide convertImplementationGuide(org.hl7.fhir.dstu3.model.ImplementationGuide src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ImplementationGuide tgt = new org.hl7.fhir.r5.model.ImplementationGuide(); + copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasStatus()) + tgt.setStatus(convertPublicationStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) + tgt.addContact(convertContactDetail(t)); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu3.model.UsageContext t : src.getUseContext()) + tgt.addUseContext(convertUsageContext(t)); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction()) + tgt.addJurisdiction(convertCodeableConcept(t)); + if (src.hasCopyright()) + tgt.setCopyright(src.getCopyright()); + if (src.hasFhirVersion()) + tgt.addFhirVersion(org.hl7.fhir.r5.model.Enumerations.FHIRVersion.fromCode(src.getFhirVersion())); + for (org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuideDependencyComponent t : src.getDependency()) + tgt.addDependsOn(convertImplementationGuideDependencyComponent(t)); + for (org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePackageComponent t : src.getPackage()) + tgt.getDefinition().addGrouping(convertImplementationGuidePackageComponent(tgt.getDefinition(), t)); + for (org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuideGlobalComponent t : src.getGlobal()) + tgt.addGlobal(convertImplementationGuideGlobalComponent(t)); +// for (org.hl7.fhir.dstu3.model.UriType t : src.getBinary()) +// tgt.addBinary(t.getValue()); + if (src.hasPage()) + tgt.getDefinition().setPage(convertImplementationGuidePageComponent(src.getPage())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ImplementationGuide convertImplementationGuide(org.hl7.fhir.r5.model.ImplementationGuide src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.ImplementationGuide tgt = new org.hl7.fhir.dstu3.model.ImplementationGuide(); + copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasStatus()) + tgt.setStatus(convertPublicationStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.r5.model.ContactDetail t : src.getContact()) + tgt.addContact(convertContactDetail(t)); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.r5.model.UsageContext t : src.getUseContext()) + tgt.addUseContext(convertUsageContext(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getJurisdiction()) + tgt.addJurisdiction(convertCodeableConcept(t)); + if (src.hasCopyright()) + tgt.setCopyright(src.getCopyright()); + if (src.hasFhirVersion()) + for (Enumeration v : src.getFhirVersion()) { + tgt.setFhirVersion(v.asStringValue()); + break; + } + for (org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDependsOnComponent t : src.getDependsOn()) + tgt.addDependency(convertImplementationGuideDependencyComponent(t)); + for (org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionGroupingComponent t : src.getDefinition().getGrouping()) + tgt.addPackage(convertImplementationGuidePackageComponent(t)); + for (org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionResourceComponent t : src.getDefinition().getResource()) { + findPackage(tgt.getPackage(), t.getGroupingId()).addResource(convertImplementationGuidePackageResourceComponent(t)); + } + for (org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideGlobalComponent t : src.getGlobal()) + tgt.addGlobal(convertImplementationGuideGlobalComponent(t)); +// for (org.hl7.fhir.r5.model.UriType t : src.getBinary()) +// tgt.addBinary(t.getValue()); + if (src.getDefinition().hasPage()) + tgt.setPage(convertImplementationGuidePageComponent(src.getDefinition().getPage())); + return tgt; + } + + private static org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePackageComponent findPackage(List definition, String id) { + for (org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePackageComponent t : definition) + if (t.getId().equals(id)) + return t; + org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePackageComponent t1 = new org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePackageComponent(); + t1.setName("Default Package"); + t1.setId(id); + return t1; + } + + public static org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDependsOnComponent convertImplementationGuideDependencyComponent(org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuideDependencyComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDependsOnComponent tgt = new org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDependsOnComponent(); + copyElement(src, tgt); + if (src.hasUri()) + tgt.setUri(src.getUri()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuideDependencyComponent convertImplementationGuideDependencyComponent(org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDependsOnComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuideDependencyComponent tgt = new org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuideDependencyComponent(); + copyElement(src, tgt); + tgt.setType(org.hl7.fhir.dstu3.model.ImplementationGuide.GuideDependencyType.REFERENCE); + if (src.hasUri()) + tgt.setUri(src.getUri()); + return tgt; + } + + + public static org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionGroupingComponent convertImplementationGuidePackageComponent(org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionComponent context, org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePackageComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionGroupingComponent tgt = new org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionGroupingComponent(); + tgt.setId("p"+(context.getGrouping().size()+1)); + copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePackageResourceComponent t : src.getResource()) { + org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionResourceComponent tn = convertImplementationGuidePackageResourceComponent(t); + tn.setGroupingId(tgt.getId()); + context.addResource(tn); + } + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePackageComponent convertImplementationGuidePackageComponent(org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionGroupingComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePackageComponent tgt = new org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePackageComponent(); + copyElement(src, tgt); + tgt.setId(src.getId()); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + return tgt; + } + + public static org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionResourceComponent convertImplementationGuidePackageResourceComponent(org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePackageResourceComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionResourceComponent tgt = new org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionResourceComponent(); + copyElement(src, tgt); + if (src.hasExampleFor()) { + org.hl7.fhir.r5.model.Type t = convertType(src.getExampleFor()); + tgt.setExample(t instanceof org.hl7.fhir.r5.model.Reference ? new org.hl7.fhir.r5.model.CanonicalType(((org.hl7.fhir.r5.model.Reference) t).getReference()) : t); + } else if (src.hasExample()) + tgt.setExample(new org.hl7.fhir.r5.model.BooleanType(src.getExample())); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + if (src.hasSourceReference()) + tgt.setReference(convertReference(src.getSourceReference())); + else if (src.hasSourceUriType()) + tgt.setReference(new org.hl7.fhir.r5.model.Reference(src.getSourceUriType().getValue())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePackageResourceComponent convertImplementationGuidePackageResourceComponent(org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionResourceComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePackageResourceComponent tgt = new org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePackageResourceComponent(); + copyElement(src, tgt); + if (src.hasExampleCanonicalType()) { + tgt.setExampleFor(convertCanonicalToReference(src.getExampleCanonicalType())); + tgt.setExample(true); + } else if (src.hasExampleBooleanType()) + tgt.setExample(src.getExampleBooleanType().getValue()); + else + tgt.setExample(false); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + if (src.hasReference()) + tgt.setSource(convertReference(src.getReference())); + return tgt; + } + + public static org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideGlobalComponent convertImplementationGuideGlobalComponent(org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuideGlobalComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideGlobalComponent tgt = new org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideGlobalComponent(); + copyElement(src, tgt); + if (src.hasType()) + tgt.setType(src.getType()); + if (src.hasProfile()) + tgt.setProfileElement(convertReferenceToCanonical(src.getProfile())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuideGlobalComponent convertImplementationGuideGlobalComponent(org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideGlobalComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuideGlobalComponent tgt = new org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuideGlobalComponent(); + copyElement(src, tgt); + if (src.hasType()) + tgt.setType(src.getType()); + if (src.hasProfile()) + tgt.setProfile(convertCanonicalToReference(src.getProfileElement())); + return tgt; + } + + public static org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionPageComponent convertImplementationGuidePageComponent(org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePageComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionPageComponent tgt = new org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionPageComponent(); + copyElement(src, tgt); + if (src.hasSource()) + tgt.setName(convertUriToUrl(src.getSourceElement())); + if (src.hasTitle()) + tgt.setTitle(src.getTitle()); + if (src.hasKind()) + tgt.setGeneration(convertPageGeneration(src.getKind())); + for (org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePageComponent t : src.getPage()) + tgt.addPage(convertImplementationGuidePageComponent(t)); + return tgt; + } + + private static org.hl7.fhir.r5.model.ImplementationGuide.GuidePageGeneration convertPageGeneration(org.hl7.fhir.dstu3.model.ImplementationGuide.GuidePageKind kind) { + switch (kind) { + case PAGE: return org.hl7.fhir.r5.model.ImplementationGuide.GuidePageGeneration.HTML; + default: return org.hl7.fhir.r5.model.ImplementationGuide.GuidePageGeneration.GENERATED; + } + } + + + private static org.hl7.fhir.dstu3.model.ImplementationGuide.GuidePageKind convertPageGeneration(org.hl7.fhir.r5.model.ImplementationGuide.GuidePageGeneration generation) { + switch (generation) { + case HTML: return org.hl7.fhir.dstu3.model.ImplementationGuide.GuidePageKind.PAGE; + default: return org.hl7.fhir.dstu3.model.ImplementationGuide.GuidePageKind.RESOURCE; + } + } + + + public static org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePageComponent convertImplementationGuidePageComponent(org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionPageComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePageComponent tgt = new org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePageComponent(); + copyElement(src, tgt); + if (src.hasNameUrlType()) + tgt.setSource(src.getNameUrlType().getValue()); + if (src.hasTitle()) + tgt.setTitle(src.getTitle()); + if (src.hasGeneration()) + tgt.setKind(convertPageGeneration(src.getGeneration())); + for (org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionPageComponent t : src.getPage()) + tgt.addPage(convertImplementationGuidePageComponent(t)); + return tgt; + } + + + public static org.hl7.fhir.r5.model.Linkage convertLinkage(org.hl7.fhir.dstu3.model.Linkage src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Linkage tgt = new org.hl7.fhir.r5.model.Linkage(); + copyDomainResource(src, tgt); + if (src.hasActive()) + tgt.setActive(src.getActive()); + if (src.hasAuthor()) + tgt.setAuthor(convertReference(src.getAuthor())); + for (org.hl7.fhir.dstu3.model.Linkage.LinkageItemComponent t : src.getItem()) + tgt.addItem(convertLinkageItemComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Linkage convertLinkage(org.hl7.fhir.r5.model.Linkage src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Linkage tgt = new org.hl7.fhir.dstu3.model.Linkage(); + copyDomainResource(src, tgt); + if (src.hasActive()) + tgt.setActive(src.getActive()); + if (src.hasAuthor()) + tgt.setAuthor(convertReference(src.getAuthor())); + for (org.hl7.fhir.r5.model.Linkage.LinkageItemComponent t : src.getItem()) + tgt.addItem(convertLinkageItemComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.Linkage.LinkageItemComponent convertLinkageItemComponent(org.hl7.fhir.dstu3.model.Linkage.LinkageItemComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Linkage.LinkageItemComponent tgt = new org.hl7.fhir.r5.model.Linkage.LinkageItemComponent(); + copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertLinkageType(src.getType())); + if (src.hasResource()) + tgt.setResource(convertReference(src.getResource())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Linkage.LinkageItemComponent convertLinkageItemComponent(org.hl7.fhir.r5.model.Linkage.LinkageItemComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Linkage.LinkageItemComponent tgt = new org.hl7.fhir.dstu3.model.Linkage.LinkageItemComponent(); + copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertLinkageType(src.getType())); + if (src.hasResource()) + tgt.setResource(convertReference(src.getResource())); + return tgt; + } + + private static org.hl7.fhir.r5.model.Linkage.LinkageType convertLinkageType(org.hl7.fhir.dstu3.model.Linkage.LinkageType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case SOURCE: return org.hl7.fhir.r5.model.Linkage.LinkageType.SOURCE; + case ALTERNATE: return org.hl7.fhir.r5.model.Linkage.LinkageType.ALTERNATE; + case HISTORICAL: return org.hl7.fhir.r5.model.Linkage.LinkageType.HISTORICAL; + default: return org.hl7.fhir.r5.model.Linkage.LinkageType.NULL; + } +} + + private static org.hl7.fhir.dstu3.model.Linkage.LinkageType convertLinkageType(org.hl7.fhir.r5.model.Linkage.LinkageType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case SOURCE: return org.hl7.fhir.dstu3.model.Linkage.LinkageType.SOURCE; + case ALTERNATE: return org.hl7.fhir.dstu3.model.Linkage.LinkageType.ALTERNATE; + case HISTORICAL: return org.hl7.fhir.dstu3.model.Linkage.LinkageType.HISTORICAL; + default: return org.hl7.fhir.dstu3.model.Linkage.LinkageType.NULL; + } +} + + public static org.hl7.fhir.r5.model.ListResource convertList(org.hl7.fhir.dstu3.model.ListResource src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ListResource tgt = new org.hl7.fhir.r5.model.ListResource(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasStatus()) + tgt.setStatus(convertListStatus(src.getStatus())); + if (src.hasMode()) + tgt.setMode(convertListMode(src.getMode())); + if (src.hasTitle()) + tgt.setTitle(src.getTitle()); + if (src.hasCode()) + tgt.setCode(convertCodeableConcept(src.getCode())); + if (src.hasSubject()) + tgt.setSubject(convertReference(src.getSubject())); + if (src.hasEncounter()) + tgt.setEncounter(convertReference(src.getEncounter())); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasSource()) + tgt.setSource(convertReference(src.getSource())); + if (src.hasOrderedBy()) + tgt.setOrderedBy(convertCodeableConcept(src.getOrderedBy())); + for (org.hl7.fhir.dstu3.model.Annotation t : src.getNote()) + tgt.addNote(convertAnnotation(t)); + for (org.hl7.fhir.dstu3.model.ListResource.ListEntryComponent t : src.getEntry()) + tgt.addEntry(convertListEntryComponent(t)); + if (src.hasEmptyReason()) + tgt.setEmptyReason(convertCodeableConcept(src.getEmptyReason())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ListResource convertList(org.hl7.fhir.r5.model.ListResource src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.ListResource tgt = new org.hl7.fhir.dstu3.model.ListResource(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasStatus()) + tgt.setStatus(convertListStatus(src.getStatus())); + if (src.hasMode()) + tgt.setMode(convertListMode(src.getMode())); + if (src.hasTitle()) + tgt.setTitle(src.getTitle()); + if (src.hasCode()) + tgt.setCode(convertCodeableConcept(src.getCode())); + if (src.hasSubject()) + tgt.setSubject(convertReference(src.getSubject())); + if (src.hasEncounter()) + tgt.setEncounter(convertReference(src.getEncounter())); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasSource()) + tgt.setSource(convertReference(src.getSource())); + if (src.hasOrderedBy()) + tgt.setOrderedBy(convertCodeableConcept(src.getOrderedBy())); + for (org.hl7.fhir.r5.model.Annotation t : src.getNote()) + tgt.addNote(convertAnnotation(t)); + for (org.hl7.fhir.r5.model.ListResource.ListEntryComponent t : src.getEntry()) + tgt.addEntry(convertListEntryComponent(t)); + if (src.hasEmptyReason()) + tgt.setEmptyReason(convertCodeableConcept(src.getEmptyReason())); + return tgt; + } + + private static org.hl7.fhir.r5.model.ListResource.ListStatus convertListStatus(org.hl7.fhir.dstu3.model.ListResource.ListStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case CURRENT: return org.hl7.fhir.r5.model.ListResource.ListStatus.CURRENT; + case RETIRED: return org.hl7.fhir.r5.model.ListResource.ListStatus.RETIRED; + case ENTEREDINERROR: return org.hl7.fhir.r5.model.ListResource.ListStatus.ENTEREDINERROR; + default: return org.hl7.fhir.r5.model.ListResource.ListStatus.NULL; + } +} + + private static org.hl7.fhir.dstu3.model.ListResource.ListStatus convertListStatus(org.hl7.fhir.r5.model.ListResource.ListStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case CURRENT: return org.hl7.fhir.dstu3.model.ListResource.ListStatus.CURRENT; + case RETIRED: return org.hl7.fhir.dstu3.model.ListResource.ListStatus.RETIRED; + case ENTEREDINERROR: return org.hl7.fhir.dstu3.model.ListResource.ListStatus.ENTEREDINERROR; + default: return org.hl7.fhir.dstu3.model.ListResource.ListStatus.NULL; + } +} + + private static org.hl7.fhir.r5.model.ListResource.ListMode convertListMode(org.hl7.fhir.dstu3.model.ListResource.ListMode src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case WORKING: return org.hl7.fhir.r5.model.ListResource.ListMode.WORKING; + case SNAPSHOT: return org.hl7.fhir.r5.model.ListResource.ListMode.SNAPSHOT; + case CHANGES: return org.hl7.fhir.r5.model.ListResource.ListMode.CHANGES; + default: return org.hl7.fhir.r5.model.ListResource.ListMode.NULL; + } +} + + private static org.hl7.fhir.dstu3.model.ListResource.ListMode convertListMode(org.hl7.fhir.r5.model.ListResource.ListMode src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case WORKING: return org.hl7.fhir.dstu3.model.ListResource.ListMode.WORKING; + case SNAPSHOT: return org.hl7.fhir.dstu3.model.ListResource.ListMode.SNAPSHOT; + case CHANGES: return org.hl7.fhir.dstu3.model.ListResource.ListMode.CHANGES; + default: return org.hl7.fhir.dstu3.model.ListResource.ListMode.NULL; + } +} + + public static org.hl7.fhir.r5.model.ListResource.ListEntryComponent convertListEntryComponent(org.hl7.fhir.dstu3.model.ListResource.ListEntryComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ListResource.ListEntryComponent tgt = new org.hl7.fhir.r5.model.ListResource.ListEntryComponent(); + copyElement(src, tgt); + if (src.hasFlag()) + tgt.setFlag(convertCodeableConcept(src.getFlag())); + if (src.hasDeleted()) + tgt.setDeleted(src.getDeleted()); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasItem()) + tgt.setItem(convertReference(src.getItem())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ListResource.ListEntryComponent convertListEntryComponent(org.hl7.fhir.r5.model.ListResource.ListEntryComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.ListResource.ListEntryComponent tgt = new org.hl7.fhir.dstu3.model.ListResource.ListEntryComponent(); + copyElement(src, tgt); + if (src.hasFlag()) + tgt.setFlag(convertCodeableConcept(src.getFlag())); + if (src.hasDeleted()) + tgt.setDeleted(src.getDeleted()); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasItem()) + tgt.setItem(convertReference(src.getItem())); + return tgt; + } + + public static org.hl7.fhir.r5.model.Location convertLocation(org.hl7.fhir.dstu3.model.Location src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Location tgt = new org.hl7.fhir.r5.model.Location(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasStatus()) + tgt.setStatus(convertLocationStatus(src.getStatus())); + if (src.hasOperationalStatus()) + tgt.setOperationalStatus(convertCoding(src.getOperationalStatus())); + if (src.hasName()) + tgt.setName(src.getName()); + for (org.hl7.fhir.dstu3.model.StringType t : src.getAlias()) + tgt.addAlias(t.getValue()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + if (src.hasMode()) + tgt.setMode(convertLocationMode(src.getMode())); + if (src.hasType()) + tgt.addType(convertCodeableConcept(src.getType())); + for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom()) + tgt.addTelecom(convertContactPoint(t)); + if (src.hasAddress()) + tgt.setAddress(convertAddress(src.getAddress())); + if (src.hasPhysicalType()) + tgt.setPhysicalType(convertCodeableConcept(src.getPhysicalType())); + if (src.hasPosition()) + tgt.setPosition(convertLocationPositionComponent(src.getPosition())); + if (src.hasManagingOrganization()) + tgt.setManagingOrganization(convertReference(src.getManagingOrganization())); + if (src.hasPartOf()) + tgt.setPartOf(convertReference(src.getPartOf())); + for (org.hl7.fhir.dstu3.model.Reference t : src.getEndpoint()) + tgt.addEndpoint(convertReference(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Location convertLocation(org.hl7.fhir.r5.model.Location src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Location tgt = new org.hl7.fhir.dstu3.model.Location(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasStatus()) + tgt.setStatus(convertLocationStatus(src.getStatus())); + if (src.hasOperationalStatus()) + tgt.setOperationalStatus(convertCoding(src.getOperationalStatus())); + if (src.hasName()) + tgt.setName(src.getName()); + for (org.hl7.fhir.r5.model.StringType t : src.getAlias()) + tgt.addAlias(t.getValue()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + if (src.hasMode()) + tgt.setMode(convertLocationMode(src.getMode())); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getTypeFirstRep())); + for (org.hl7.fhir.r5.model.ContactPoint t : src.getTelecom()) + tgt.addTelecom(convertContactPoint(t)); + if (src.hasAddress()) + tgt.setAddress(convertAddress(src.getAddress())); + if (src.hasPhysicalType()) + tgt.setPhysicalType(convertCodeableConcept(src.getPhysicalType())); + if (src.hasPosition()) + tgt.setPosition(convertLocationPositionComponent(src.getPosition())); + if (src.hasManagingOrganization()) + tgt.setManagingOrganization(convertReference(src.getManagingOrganization())); + if (src.hasPartOf()) + tgt.setPartOf(convertReference(src.getPartOf())); + for (org.hl7.fhir.r5.model.Reference t : src.getEndpoint()) + tgt.addEndpoint(convertReference(t)); + return tgt; + } + + private static org.hl7.fhir.r5.model.Location.LocationStatus convertLocationStatus(org.hl7.fhir.dstu3.model.Location.LocationStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case ACTIVE: return org.hl7.fhir.r5.model.Location.LocationStatus.ACTIVE; + case SUSPENDED: return org.hl7.fhir.r5.model.Location.LocationStatus.SUSPENDED; + case INACTIVE: return org.hl7.fhir.r5.model.Location.LocationStatus.INACTIVE; + default: return org.hl7.fhir.r5.model.Location.LocationStatus.NULL; + } +} + + private static org.hl7.fhir.dstu3.model.Location.LocationStatus convertLocationStatus(org.hl7.fhir.r5.model.Location.LocationStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case ACTIVE: return org.hl7.fhir.dstu3.model.Location.LocationStatus.ACTIVE; + case SUSPENDED: return org.hl7.fhir.dstu3.model.Location.LocationStatus.SUSPENDED; + case INACTIVE: return org.hl7.fhir.dstu3.model.Location.LocationStatus.INACTIVE; + default: return org.hl7.fhir.dstu3.model.Location.LocationStatus.NULL; + } +} + + private static org.hl7.fhir.r5.model.Location.LocationMode convertLocationMode(org.hl7.fhir.dstu3.model.Location.LocationMode src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case INSTANCE: return org.hl7.fhir.r5.model.Location.LocationMode.INSTANCE; + case KIND: return org.hl7.fhir.r5.model.Location.LocationMode.KIND; + default: return org.hl7.fhir.r5.model.Location.LocationMode.NULL; + } +} + + private static org.hl7.fhir.dstu3.model.Location.LocationMode convertLocationMode(org.hl7.fhir.r5.model.Location.LocationMode src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case INSTANCE: return org.hl7.fhir.dstu3.model.Location.LocationMode.INSTANCE; + case KIND: return org.hl7.fhir.dstu3.model.Location.LocationMode.KIND; + default: return org.hl7.fhir.dstu3.model.Location.LocationMode.NULL; + } +} + + public static org.hl7.fhir.r5.model.Location.LocationPositionComponent convertLocationPositionComponent(org.hl7.fhir.dstu3.model.Location.LocationPositionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Location.LocationPositionComponent tgt = new org.hl7.fhir.r5.model.Location.LocationPositionComponent(); + copyElement(src, tgt); + if (src.hasLongitude()) + tgt.setLongitude(src.getLongitude()); + if (src.hasLatitude()) + tgt.setLatitude(src.getLatitude()); + if (src.hasAltitude()) + tgt.setAltitude(src.getAltitude()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Location.LocationPositionComponent convertLocationPositionComponent(org.hl7.fhir.r5.model.Location.LocationPositionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Location.LocationPositionComponent tgt = new org.hl7.fhir.dstu3.model.Location.LocationPositionComponent(); + copyElement(src, tgt); + if (src.hasLongitude()) + tgt.setLongitude(src.getLongitude()); + if (src.hasLatitude()) + tgt.setLatitude(src.getLatitude()); + if (src.hasAltitude()) + tgt.setAltitude(src.getAltitude()); + return tgt; + } + + + + public static org.hl7.fhir.r5.model.Medication convertMedication(org.hl7.fhir.dstu3.model.Medication src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Medication tgt = new org.hl7.fhir.r5.model.Medication(); + copyDomainResource(src, tgt); + if (src.hasCode()) + tgt.setCode(convertCodeableConcept(src.getCode())); + if (src.hasStatus()) + tgt.setStatus(convertMedicationStatus(src.getStatus())); + if (src.hasManufacturer()) + tgt.setManufacturer(convertReference(src.getManufacturer())); + if (src.hasForm()) + tgt.setForm(convertCodeableConcept(src.getForm())); + for (org.hl7.fhir.dstu3.model.Medication.MedicationIngredientComponent t : src.getIngredient()) + tgt.addIngredient(convertMedicationIngredientComponent(t)); + if (src.hasPackage()) + tgt.setBatch(convertMedicationPackageBatchComponent(src.getPackage().getBatchFirstRep())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Medication convertMedication(org.hl7.fhir.r5.model.Medication src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Medication tgt = new org.hl7.fhir.dstu3.model.Medication(); + copyDomainResource(src, tgt); + if (src.hasCode()) + tgt.setCode(convertCodeableConcept(src.getCode())); + if (src.hasStatus()) + tgt.setStatus(convertMedicationStatus(src.getStatus())); + if (src.hasManufacturer()) + tgt.setManufacturer(convertReference(src.getManufacturer())); + if (src.hasForm()) + tgt.setForm(convertCodeableConcept(src.getForm())); + for (org.hl7.fhir.r5.model.Medication.MedicationIngredientComponent t : src.getIngredient()) + tgt.addIngredient(convertMedicationIngredientComponent(t)); + if (src.hasBatch()) + tgt.getPackage().addBatch(convertMedicationPackageBatchComponent(src.getBatch())); + return tgt; + } + + private static org.hl7.fhir.r5.model.Medication.MedicationStatus convertMedicationStatus(org.hl7.fhir.dstu3.model.Medication.MedicationStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case ACTIVE: return org.hl7.fhir.r5.model.Medication.MedicationStatus.ACTIVE; + case INACTIVE: return org.hl7.fhir.r5.model.Medication.MedicationStatus.INACTIVE; + case ENTEREDINERROR: return org.hl7.fhir.r5.model.Medication.MedicationStatus.ENTEREDINERROR; + default: return org.hl7.fhir.r5.model.Medication.MedicationStatus.NULL; + } +} + + private static org.hl7.fhir.dstu3.model.Medication.MedicationStatus convertMedicationStatus(org.hl7.fhir.r5.model.Medication.MedicationStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case ACTIVE: return org.hl7.fhir.dstu3.model.Medication.MedicationStatus.ACTIVE; + case INACTIVE: return org.hl7.fhir.dstu3.model.Medication.MedicationStatus.INACTIVE; + case ENTEREDINERROR: return org.hl7.fhir.dstu3.model.Medication.MedicationStatus.ENTEREDINERROR; + default: return org.hl7.fhir.dstu3.model.Medication.MedicationStatus.NULL; + } +} + + public static org.hl7.fhir.r5.model.Medication.MedicationIngredientComponent convertMedicationIngredientComponent(org.hl7.fhir.dstu3.model.Medication.MedicationIngredientComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Medication.MedicationIngredientComponent tgt = new org.hl7.fhir.r5.model.Medication.MedicationIngredientComponent(); + copyElement(src, tgt); + if (src.hasItem()) + tgt.setItem(convertType(src.getItem())); + if (src.hasIsActive()) + tgt.setIsActive(src.getIsActive()); + if (src.hasAmount()) + tgt.setStrength(convertRatio(src.getAmount())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Medication.MedicationIngredientComponent convertMedicationIngredientComponent(org.hl7.fhir.r5.model.Medication.MedicationIngredientComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Medication.MedicationIngredientComponent tgt = new org.hl7.fhir.dstu3.model.Medication.MedicationIngredientComponent(); + copyElement(src, tgt); + if (src.hasItem()) + tgt.setItem(convertType(src.getItem())); + if (src.hasIsActive()) + tgt.setIsActive(src.getIsActive()); + if (src.hasStrength()) + tgt.setAmount(convertRatio(src.getStrength())); + return tgt; + } + + + public static org.hl7.fhir.r5.model.Medication.MedicationBatchComponent convertMedicationPackageBatchComponent(org.hl7.fhir.dstu3.model.Medication.MedicationPackageBatchComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Medication.MedicationBatchComponent tgt = new org.hl7.fhir.r5.model.Medication.MedicationBatchComponent(); + copyElement(src, tgt); + if (src.hasLotNumber()) + tgt.setLotNumber(src.getLotNumber()); + if (src.hasExpirationDate()) + tgt.setExpirationDate(src.getExpirationDate()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Medication.MedicationPackageBatchComponent convertMedicationPackageBatchComponent(org.hl7.fhir.r5.model.Medication.MedicationBatchComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Medication.MedicationPackageBatchComponent tgt = new org.hl7.fhir.dstu3.model.Medication.MedicationPackageBatchComponent(); + copyElement(src, tgt); + if (src.hasLotNumber()) + tgt.setLotNumber(src.getLotNumber()); + if (src.hasExpirationDate()) + tgt.setExpirationDate(src.getExpirationDate()); + return tgt; + } + + public static org.hl7.fhir.r5.model.MedicationAdministration convertMedicationAdministration(org.hl7.fhir.dstu3.model.MedicationAdministration src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.MedicationAdministration tgt = new org.hl7.fhir.r5.model.MedicationAdministration(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + for (org.hl7.fhir.dstu3.model.Reference t : src.getDefinition()) + tgt.addInstantiates(t.getReference()); + for (org.hl7.fhir.dstu3.model.Reference t : src.getPartOf()) + tgt.addPartOf(convertReference(t)); + if (src.hasStatus()) + tgt.setStatus(convertMedicationAdministrationStatus(src.getStatus())); + if (src.hasCategory()) + tgt.setCategory(convertCodeableConcept(src.getCategory())); + if (src.hasMedication()) + tgt.setMedication(convertType(src.getMedication())); + if (src.hasSubject()) + tgt.setSubject(convertReference(src.getSubject())); + if (src.hasContext()) + tgt.setContext(convertReference(src.getContext())); + for (org.hl7.fhir.dstu3.model.Reference t : src.getSupportingInformation()) + tgt.addSupportingInformation(convertReference(t)); + if (src.hasEffective()) + tgt.setEffective(convertType(src.getEffective())); + for (org.hl7.fhir.dstu3.model.MedicationAdministration.MedicationAdministrationPerformerComponent t : src.getPerformer()) + tgt.addPerformer(convertMedicationAdministrationPerformerComponent(t)); +// if (src.hasNotGiven()) +// tgt.setNotGiven(src.getNotGiven()); +// for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getReasonNotGiven()) +// tgt.addReasonNotGiven(convertCodeableConcept(t)); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getReasonCode()) + tgt.addReasonCode(convertCodeableConcept(t)); + for (org.hl7.fhir.dstu3.model.Reference t : src.getReasonReference()) + tgt.addReasonReference(convertReference(t)); + if (src.hasPrescription()) + tgt.setRequest(convertReference(src.getPrescription())); + for (org.hl7.fhir.dstu3.model.Reference t : src.getDevice()) + tgt.addDevice(convertReference(t)); + for (org.hl7.fhir.dstu3.model.Annotation t : src.getNote()) + tgt.addNote(convertAnnotation(t)); + if (src.hasDosage()) + tgt.setDosage(convertMedicationAdministrationDosageComponent(src.getDosage())); + for (org.hl7.fhir.dstu3.model.Reference t : src.getEventHistory()) + tgt.addEventHistory(convertReference(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.MedicationAdministration convertMedicationAdministration(org.hl7.fhir.r5.model.MedicationAdministration src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.MedicationAdministration tgt = new org.hl7.fhir.dstu3.model.MedicationAdministration(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + for (org.hl7.fhir.r5.model.UriType t : src.getInstantiates()) + tgt.addDefinition().setReference(t.getValue()); + for (org.hl7.fhir.r5.model.Reference t : src.getPartOf()) + tgt.addPartOf(convertReference(t)); + if (src.hasStatus()) + tgt.setStatus(convertMedicationAdministrationStatus(src.getStatus())); + if (src.hasCategory()) + tgt.setCategory(convertCodeableConcept(src.getCategory())); + if (src.hasMedication()) + tgt.setMedication(convertType(src.getMedication())); + if (src.hasSubject()) + tgt.setSubject(convertReference(src.getSubject())); + if (src.hasContext()) + tgt.setContext(convertReference(src.getContext())); + for (org.hl7.fhir.r5.model.Reference t : src.getSupportingInformation()) + tgt.addSupportingInformation(convertReference(t)); + if (src.hasEffective()) + tgt.setEffective(convertType(src.getEffective())); + for (org.hl7.fhir.r5.model.MedicationAdministration.MedicationAdministrationPerformerComponent t : src.getPerformer()) + tgt.addPerformer(convertMedicationAdministrationPerformerComponent(t)); +// if (src.hasNotGiven()) +// tgt.setNotGiven(src.getNotGiven()); +// for (org.hl7.fhir.r5.model.CodeableConcept t : src.getReasonNotGiven()) +// tgt.addReasonNotGiven(convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getReasonCode()) + tgt.addReasonCode(convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getReasonReference()) + tgt.addReasonReference(convertReference(t)); + if (src.hasRequest()) + tgt.setPrescription(convertReference(src.getRequest())); + for (org.hl7.fhir.r5.model.Reference t : src.getDevice()) + tgt.addDevice(convertReference(t)); + for (org.hl7.fhir.r5.model.Annotation t : src.getNote()) + tgt.addNote(convertAnnotation(t)); + if (src.hasDosage()) + tgt.setDosage(convertMedicationAdministrationDosageComponent(src.getDosage())); + for (org.hl7.fhir.r5.model.Reference t : src.getEventHistory()) + tgt.addEventHistory(convertReference(t)); + return tgt; + } + + private static String convertMedicationAdministrationStatus(org.hl7.fhir.dstu3.model.MedicationAdministration.MedicationAdministrationStatus src) throws FHIRException { + if (src == null) + return null; + return src.toCode(); + } + + private static org.hl7.fhir.dstu3.model.MedicationAdministration.MedicationAdministrationStatus convertMedicationAdministrationStatus(String src) throws FHIRException { + if (src == null) + return null; + return org.hl7.fhir.dstu3.model.MedicationAdministration.MedicationAdministrationStatus.fromCode(src); + } + + public static org.hl7.fhir.r5.model.MedicationAdministration.MedicationAdministrationPerformerComponent convertMedicationAdministrationPerformerComponent(org.hl7.fhir.dstu3.model.MedicationAdministration.MedicationAdministrationPerformerComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.MedicationAdministration.MedicationAdministrationPerformerComponent tgt = new org.hl7.fhir.r5.model.MedicationAdministration.MedicationAdministrationPerformerComponent(); + copyElement(src, tgt); + if (src.hasActor()) + tgt.setActor(convertReference(src.getActor())); +// if (src.hasOnBehalfOf()) +// tgt.setOnBehalfOf(convertReference(src.getOnBehalfOf())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.MedicationAdministration.MedicationAdministrationPerformerComponent convertMedicationAdministrationPerformerComponent(org.hl7.fhir.r5.model.MedicationAdministration.MedicationAdministrationPerformerComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.MedicationAdministration.MedicationAdministrationPerformerComponent tgt = new org.hl7.fhir.dstu3.model.MedicationAdministration.MedicationAdministrationPerformerComponent(); + copyElement(src, tgt); + if (src.hasActor()) + tgt.setActor(convertReference(src.getActor())); +// if (src.hasOnBehalfOf()) +// tgt.setOnBehalfOf(convertReference(src.getOnBehalfOf())); + return tgt; + } + + public static org.hl7.fhir.r5.model.MedicationAdministration.MedicationAdministrationDosageComponent convertMedicationAdministrationDosageComponent(org.hl7.fhir.dstu3.model.MedicationAdministration.MedicationAdministrationDosageComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.MedicationAdministration.MedicationAdministrationDosageComponent tgt = new org.hl7.fhir.r5.model.MedicationAdministration.MedicationAdministrationDosageComponent(); + copyElement(src, tgt); + if (src.hasText()) + tgt.setText(src.getText()); + if (src.hasSite()) + tgt.setSite(convertCodeableConcept(src.getSite())); + if (src.hasRoute()) + tgt.setRoute(convertCodeableConcept(src.getRoute())); + if (src.hasMethod()) + tgt.setMethod(convertCodeableConcept(src.getMethod())); + if (src.hasDose()) + tgt.setDose(convertSimpleQuantity(src.getDose())); + if (src.hasRate()) + tgt.setRate(convertType(src.getRate())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.MedicationAdministration.MedicationAdministrationDosageComponent convertMedicationAdministrationDosageComponent(org.hl7.fhir.r5.model.MedicationAdministration.MedicationAdministrationDosageComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.MedicationAdministration.MedicationAdministrationDosageComponent tgt = new org.hl7.fhir.dstu3.model.MedicationAdministration.MedicationAdministrationDosageComponent(); + copyElement(src, tgt); + if (src.hasText()) + tgt.setText(src.getText()); + if (src.hasSite()) + tgt.setSite(convertCodeableConcept(src.getSite())); + if (src.hasRoute()) + tgt.setRoute(convertCodeableConcept(src.getRoute())); + if (src.hasMethod()) + tgt.setMethod(convertCodeableConcept(src.getMethod())); + if (src.hasDose()) + tgt.setDose(convertSimpleQuantity(src.getDose())); + if (src.hasRate()) + tgt.setRate(convertType(src.getRate())); + return tgt; + } + + public static org.hl7.fhir.r5.model.MedicationDispense convertMedicationDispense(org.hl7.fhir.dstu3.model.MedicationDispense src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.MedicationDispense tgt = new org.hl7.fhir.r5.model.MedicationDispense(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + for (org.hl7.fhir.dstu3.model.Reference t : src.getPartOf()) + tgt.addPartOf(convertReference(t)); + if (src.hasStatus()) + tgt.setStatus(convertMedicationDispenseStatus(src.getStatus())); + if (src.hasCategory()) + tgt.setCategory(convertCodeableConcept(src.getCategory())); + if (src.hasMedication()) + tgt.setMedication(convertType(src.getMedication())); + if (src.hasSubject()) + tgt.setSubject(convertReference(src.getSubject())); + if (src.hasContext()) + tgt.setContext(convertReference(src.getContext())); + for (org.hl7.fhir.dstu3.model.Reference t : src.getSupportingInformation()) + tgt.addSupportingInformation(convertReference(t)); + for (org.hl7.fhir.dstu3.model.MedicationDispense.MedicationDispensePerformerComponent t : src.getPerformer()) + tgt.addPerformer(convertMedicationDispensePerformerComponent(t)); + for (org.hl7.fhir.dstu3.model.Reference t : src.getAuthorizingPrescription()) + tgt.addAuthorizingPrescription(convertReference(t)); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + if (src.hasQuantity()) + tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); + if (src.hasDaysSupply()) + tgt.setDaysSupply(convertSimpleQuantity(src.getDaysSupply())); + if (src.hasWhenPrepared()) + tgt.setWhenPrepared(src.getWhenPrepared()); + if (src.hasWhenHandedOver()) + tgt.setWhenHandedOver(src.getWhenHandedOver()); + if (src.hasDestination()) + tgt.setDestination(convertReference(src.getDestination())); + for (org.hl7.fhir.dstu3.model.Reference t : src.getReceiver()) + tgt.addReceiver(convertReference(t)); + for (org.hl7.fhir.dstu3.model.Annotation t : src.getNote()) + tgt.addNote(convertAnnotation(t)); + for (org.hl7.fhir.dstu3.model.Dosage t : src.getDosageInstruction()) + tgt.addDosageInstruction(convertDosage(t)); + if (src.hasSubstitution()) + tgt.setSubstitution(convertMedicationDispenseSubstitutionComponent(src.getSubstitution())); + for (org.hl7.fhir.dstu3.model.Reference t : src.getDetectedIssue()) + tgt.addDetectedIssue(convertReference(t)); +// if (src.hasNotDone()) +// tgt.setNotDone(src.getNotDone()); +// if (src.hasNotDoneReason()) +// tgt.setNotDoneReason(convertType(src.getNotDoneReason())); + for (org.hl7.fhir.dstu3.model.Reference t : src.getEventHistory()) + tgt.addEventHistory(convertReference(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.MedicationDispense convertMedicationDispense(org.hl7.fhir.r5.model.MedicationDispense src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.MedicationDispense tgt = new org.hl7.fhir.dstu3.model.MedicationDispense(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getPartOf()) + tgt.addPartOf(convertReference(t)); + if (src.hasStatus()) + tgt.setStatus(convertMedicationDispenseStatus(src.getStatus())); + if (src.hasCategory()) + tgt.setCategory(convertCodeableConcept(src.getCategory())); + if (src.hasMedication()) + tgt.setMedication(convertType(src.getMedication())); + if (src.hasSubject()) + tgt.setSubject(convertReference(src.getSubject())); + if (src.hasContext()) + tgt.setContext(convertReference(src.getContext())); + for (org.hl7.fhir.r5.model.Reference t : src.getSupportingInformation()) + tgt.addSupportingInformation(convertReference(t)); + for (org.hl7.fhir.r5.model.MedicationDispense.MedicationDispensePerformerComponent t : src.getPerformer()) + tgt.addPerformer(convertMedicationDispensePerformerComponent(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getAuthorizingPrescription()) + tgt.addAuthorizingPrescription(convertReference(t)); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + if (src.hasQuantity()) + tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); + if (src.hasDaysSupply()) + tgt.setDaysSupply(convertSimpleQuantity(src.getDaysSupply())); + if (src.hasWhenPrepared()) + tgt.setWhenPrepared(src.getWhenPrepared()); + if (src.hasWhenHandedOver()) + tgt.setWhenHandedOver(src.getWhenHandedOver()); + if (src.hasDestination()) + tgt.setDestination(convertReference(src.getDestination())); + for (org.hl7.fhir.r5.model.Reference t : src.getReceiver()) + tgt.addReceiver(convertReference(t)); + for (org.hl7.fhir.r5.model.Annotation t : src.getNote()) + tgt.addNote(convertAnnotation(t)); + for (org.hl7.fhir.r5.model.Dosage t : src.getDosageInstruction()) + tgt.addDosageInstruction(convertDosage(t)); + if (src.hasSubstitution()) + tgt.setSubstitution(convertMedicationDispenseSubstitutionComponent(src.getSubstitution())); + for (org.hl7.fhir.r5.model.Reference t : src.getDetectedIssue()) + tgt.addDetectedIssue(convertReference(t)); +// if (src.hasNotDone()) +// tgt.setNotDone(src.getNotDone()); +// if (src.hasNotDoneReason()) +// tgt.setNotDoneReason(convertType(src.getNotDoneReason())); + for (org.hl7.fhir.r5.model.Reference t : src.getEventHistory()) + tgt.addEventHistory(convertReference(t)); + return tgt; + } + + private static String convertMedicationDispenseStatus(org.hl7.fhir.dstu3.model.MedicationDispense.MedicationDispenseStatus src) throws FHIRException { + if (src == null) + return null; + return src.toCode(); +} + + private static org.hl7.fhir.dstu3.model.MedicationDispense.MedicationDispenseStatus convertMedicationDispenseStatus(String src) throws FHIRException { + if (src == null) + return null; + return org.hl7.fhir.dstu3.model.MedicationDispense.MedicationDispenseStatus.fromCode(src); + } + + public static org.hl7.fhir.r5.model.MedicationDispense.MedicationDispensePerformerComponent convertMedicationDispensePerformerComponent(org.hl7.fhir.dstu3.model.MedicationDispense.MedicationDispensePerformerComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.MedicationDispense.MedicationDispensePerformerComponent tgt = new org.hl7.fhir.r5.model.MedicationDispense.MedicationDispensePerformerComponent(); + copyElement(src, tgt); + if (src.hasActor()) + tgt.setActor(convertReference(src.getActor())); +// if (src.hasOnBehalfOf()) +// tgt.setOnBehalfOf(convertReference(src.getOnBehalfOf())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.MedicationDispense.MedicationDispensePerformerComponent convertMedicationDispensePerformerComponent(org.hl7.fhir.r5.model.MedicationDispense.MedicationDispensePerformerComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.MedicationDispense.MedicationDispensePerformerComponent tgt = new org.hl7.fhir.dstu3.model.MedicationDispense.MedicationDispensePerformerComponent(); + copyElement(src, tgt); + if (src.hasActor()) + tgt.setActor(convertReference(src.getActor())); +// if (src.hasOnBehalfOf()) +// tgt.setOnBehalfOf(convertReference(src.getOnBehalfOf())); + return tgt; + } + + public static org.hl7.fhir.r5.model.MedicationDispense.MedicationDispenseSubstitutionComponent convertMedicationDispenseSubstitutionComponent(org.hl7.fhir.dstu3.model.MedicationDispense.MedicationDispenseSubstitutionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.MedicationDispense.MedicationDispenseSubstitutionComponent tgt = new org.hl7.fhir.r5.model.MedicationDispense.MedicationDispenseSubstitutionComponent(); + copyElement(src, tgt); + if (src.hasWasSubstituted()) + tgt.setWasSubstituted(src.getWasSubstituted()); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getReason()) + tgt.addReason(convertCodeableConcept(t)); + for (org.hl7.fhir.dstu3.model.Reference t : src.getResponsibleParty()) + tgt.addResponsibleParty(convertReference(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.MedicationDispense.MedicationDispenseSubstitutionComponent convertMedicationDispenseSubstitutionComponent(org.hl7.fhir.r5.model.MedicationDispense.MedicationDispenseSubstitutionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.MedicationDispense.MedicationDispenseSubstitutionComponent tgt = new org.hl7.fhir.dstu3.model.MedicationDispense.MedicationDispenseSubstitutionComponent(); + copyElement(src, tgt); + if (src.hasWasSubstituted()) + tgt.setWasSubstituted(src.getWasSubstituted()); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getReason()) + tgt.addReason(convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getResponsibleParty()) + tgt.addResponsibleParty(convertReference(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.MedicationRequest convertMedicationRequest(org.hl7.fhir.dstu3.model.MedicationRequest src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.MedicationRequest tgt = new org.hl7.fhir.r5.model.MedicationRequest(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); +// for (org.hl7.fhir.dstu3.model.Reference t : src.getDefinition()) +// tgt.addDefinition(convertReference(t)); + for (org.hl7.fhir.dstu3.model.Reference t : src.getBasedOn()) + tgt.addBasedOn(convertReference(t)); + if (src.hasGroupIdentifier()) + tgt.setGroupIdentifier(convertIdentifier(src.getGroupIdentifier())); + if (src.hasStatus()) + tgt.setStatus(convertMedicationRequestStatus(src.getStatus())); + if (src.hasIntent()) + tgt.setIntent(convertMedicationRequestIntent(src.getIntent())); +// if (src.hasCategory()) +// tgt.setCategory(convertCodeableConcept(src.getCategory())); + if (src.hasPriority()) + tgt.setPriority(convertMedicationRequestPriority(src.getPriority())); + if (src.hasMedication()) + tgt.setMedication(convertType(src.getMedication())); + if (src.hasSubject()) + tgt.setSubject(convertReference(src.getSubject())); + if (src.hasContext()) + tgt.setEncounter(convertReference(src.getContext())); + for (org.hl7.fhir.dstu3.model.Reference t : src.getSupportingInformation()) + tgt.addSupportingInformation(convertReference(t)); + if (src.hasAuthoredOn()) + tgt.setAuthoredOn(src.getAuthoredOn()); + if (src.hasRecorder()) + tgt.setRecorder(convertReference(src.getRecorder())); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getReasonCode()) + tgt.addReasonCode(convertCodeableConcept(t)); + for (org.hl7.fhir.dstu3.model.Reference t : src.getReasonReference()) + tgt.addReasonReference(convertReference(t)); + for (org.hl7.fhir.dstu3.model.Annotation t : src.getNote()) + tgt.addNote(convertAnnotation(t)); + for (org.hl7.fhir.dstu3.model.Dosage t : src.getDosageInstruction()) + tgt.addDosageInstruction(convertDosage(t)); + if (src.hasDispenseRequest()) + tgt.setDispenseRequest(convertMedicationRequestDispenseRequestComponent(src.getDispenseRequest())); + if (src.hasSubstitution()) + tgt.setSubstitution(convertMedicationRequestSubstitutionComponent(src.getSubstitution())); + if (src.hasPriorPrescription()) + tgt.setPriorPrescription(convertReference(src.getPriorPrescription())); + for (org.hl7.fhir.dstu3.model.Reference t : src.getDetectedIssue()) + tgt.addDetectedIssue(convertReference(t)); + for (org.hl7.fhir.dstu3.model.Reference t : src.getEventHistory()) + tgt.addEventHistory(convertReference(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.MedicationRequest convertMedicationRequest(org.hl7.fhir.r5.model.MedicationRequest src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.MedicationRequest tgt = new org.hl7.fhir.dstu3.model.MedicationRequest(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); +// for (org.hl7.fhir.r5.model.Reference t : src.getDefinition()) +// tgt.addDefinition(convertReference(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getBasedOn()) + tgt.addBasedOn(convertReference(t)); + if (src.hasGroupIdentifier()) + tgt.setGroupIdentifier(convertIdentifier(src.getGroupIdentifier())); + if (src.hasStatus()) + tgt.setStatus(convertMedicationRequestStatus(src.getStatus())); + if (src.hasIntent()) + tgt.setIntent(convertMedicationRequestIntent(src.getIntent())); +// if (src.hasCategory()) +// tgt.setCategory(convertCodeableConcept(src.getCategory())); + if (src.hasPriority()) + tgt.setPriority(convertMedicationRequestPriority(src.getPriority())); + if (src.hasMedication()) + tgt.setMedication(convertType(src.getMedication())); + if (src.hasSubject()) + tgt.setSubject(convertReference(src.getSubject())); + if (src.hasEncounter()) + tgt.setContext(convertReference(src.getEncounter())); + for (org.hl7.fhir.r5.model.Reference t : src.getSupportingInformation()) + tgt.addSupportingInformation(convertReference(t)); + if (src.hasAuthoredOn()) + tgt.setAuthoredOn(src.getAuthoredOn()); + if (src.hasRecorder()) + tgt.setRecorder(convertReference(src.getRecorder())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getReasonCode()) + tgt.addReasonCode(convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getReasonReference()) + tgt.addReasonReference(convertReference(t)); + for (org.hl7.fhir.r5.model.Annotation t : src.getNote()) + tgt.addNote(convertAnnotation(t)); + for (org.hl7.fhir.r5.model.Dosage t : src.getDosageInstruction()) + tgt.addDosageInstruction(convertDosage(t)); + if (src.hasDispenseRequest()) + tgt.setDispenseRequest(convertMedicationRequestDispenseRequestComponent(src.getDispenseRequest())); + if (src.hasSubstitution()) + tgt.setSubstitution(convertMedicationRequestSubstitutionComponent(src.getSubstitution())); + if (src.hasPriorPrescription()) + tgt.setPriorPrescription(convertReference(src.getPriorPrescription())); + for (org.hl7.fhir.r5.model.Reference t : src.getDetectedIssue()) + tgt.addDetectedIssue(convertReference(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getEventHistory()) + tgt.addEventHistory(convertReference(t)); + return tgt; + } + + private static org.hl7.fhir.r5.model.MedicationRequest.MedicationRequestStatus convertMedicationRequestStatus(org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case ACTIVE: return org.hl7.fhir.r5.model.MedicationRequest.MedicationRequestStatus.ACTIVE; + case ONHOLD: return org.hl7.fhir.r5.model.MedicationRequest.MedicationRequestStatus.ONHOLD; + case CANCELLED: return org.hl7.fhir.r5.model.MedicationRequest.MedicationRequestStatus.CANCELLED; + case COMPLETED: return org.hl7.fhir.r5.model.MedicationRequest.MedicationRequestStatus.COMPLETED; + case ENTEREDINERROR: return org.hl7.fhir.r5.model.MedicationRequest.MedicationRequestStatus.ENTEREDINERROR; + case STOPPED: return org.hl7.fhir.r5.model.MedicationRequest.MedicationRequestStatus.STOPPED; + case DRAFT: return org.hl7.fhir.r5.model.MedicationRequest.MedicationRequestStatus.DRAFT; + case UNKNOWN: return org.hl7.fhir.r5.model.MedicationRequest.MedicationRequestStatus.UNKNOWN; + default: return org.hl7.fhir.r5.model.MedicationRequest.MedicationRequestStatus.NULL; + } +} + + private static org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestStatus convertMedicationRequestStatus(org.hl7.fhir.r5.model.MedicationRequest.MedicationRequestStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case ACTIVE: return org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestStatus.ACTIVE; + case ONHOLD: return org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestStatus.ONHOLD; + case CANCELLED: return org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestStatus.CANCELLED; + case COMPLETED: return org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestStatus.COMPLETED; + case ENTEREDINERROR: return org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestStatus.ENTEREDINERROR; + case STOPPED: return org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestStatus.STOPPED; + case DRAFT: return org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestStatus.DRAFT; + case UNKNOWN: return org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestStatus.UNKNOWN; + default: return org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestStatus.NULL; + } +} + + private static org.hl7.fhir.r5.model.MedicationRequest.MedicationRequestIntent convertMedicationRequestIntent(org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestIntent src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PROPOSAL: return org.hl7.fhir.r5.model.MedicationRequest.MedicationRequestIntent.PROPOSAL; + case PLAN: return org.hl7.fhir.r5.model.MedicationRequest.MedicationRequestIntent.PLAN; + case ORDER: return org.hl7.fhir.r5.model.MedicationRequest.MedicationRequestIntent.ORDER; + case INSTANCEORDER: return org.hl7.fhir.r5.model.MedicationRequest.MedicationRequestIntent.INSTANCEORDER; + default: return org.hl7.fhir.r5.model.MedicationRequest.MedicationRequestIntent.NULL; + } +} + + private static org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestIntent convertMedicationRequestIntent(org.hl7.fhir.r5.model.MedicationRequest.MedicationRequestIntent src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PROPOSAL: return org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestIntent.PROPOSAL; + case PLAN: return org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestIntent.PLAN; + case ORDER: return org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestIntent.ORDER; + case INSTANCEORDER: return org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestIntent.INSTANCEORDER; + default: return org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestIntent.NULL; + } +} + + private static org.hl7.fhir.r5.model.MedicationRequest.MedicationRequestPriority convertMedicationRequestPriority(org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestPriority src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case ROUTINE: return org.hl7.fhir.r5.model.MedicationRequest.MedicationRequestPriority.ROUTINE; + case URGENT: return org.hl7.fhir.r5.model.MedicationRequest.MedicationRequestPriority.URGENT; + case STAT: return org.hl7.fhir.r5.model.MedicationRequest.MedicationRequestPriority.STAT; + case ASAP: return org.hl7.fhir.r5.model.MedicationRequest.MedicationRequestPriority.ASAP; + default: return org.hl7.fhir.r5.model.MedicationRequest.MedicationRequestPriority.NULL; + } +} + + private static org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestPriority convertMedicationRequestPriority(org.hl7.fhir.r5.model.MedicationRequest.MedicationRequestPriority src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case ROUTINE: return org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestPriority.ROUTINE; + case URGENT: return org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestPriority.URGENT; + case STAT: return org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestPriority.STAT; + case ASAP: return org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestPriority.ASAP; + default: return org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestPriority.NULL; + } +} +// +// public static org.hl7.fhir.r5.model.MedicationRequest.MedicationRequestRequesterComponent convertMedicationRequestRequesterComponent(org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestRequesterComponent src) throws FHIRException { +// if (src == null) +// return null; +// org.hl7.fhir.r5.model.MedicationRequest.MedicationRequestRequesterComponent tgt = new org.hl7.fhir.r5.model.MedicationRequest.MedicationRequestRequesterComponent(); +// copyElement(src, tgt); +// if (src.hasAgent()) +// tgt.setAgent(convertReference(src.getAgent())); +// if (src.hasOnBehalfOf()) +// tgt.setOnBehalfOf(convertReference(src.getOnBehalfOf())); +// return tgt; +// } +// +// public static org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestRequesterComponent convertMedicationRequestRequesterComponent(org.hl7.fhir.r5.model.MedicationRequest.MedicationRequestRequesterComponent src) throws FHIRException { +// if (src == null) +// return null; +// org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestRequesterComponent tgt = new org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestRequesterComponent(); +// copyElement(src, tgt); +// if (src.hasAgent()) +// tgt.setAgent(convertReference(src.getAgent())); +// if (src.hasOnBehalfOf()) +// tgt.setOnBehalfOf(convertReference(src.getOnBehalfOf())); +// return tgt; +// } + + public static org.hl7.fhir.r5.model.MedicationRequest.MedicationRequestDispenseRequestComponent convertMedicationRequestDispenseRequestComponent(org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestDispenseRequestComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.MedicationRequest.MedicationRequestDispenseRequestComponent tgt = new org.hl7.fhir.r5.model.MedicationRequest.MedicationRequestDispenseRequestComponent(); + copyElement(src, tgt); + if (src.hasValidityPeriod()) + tgt.setValidityPeriod(convertPeriod(src.getValidityPeriod())); + if (src.hasNumberOfRepeatsAllowed()) + tgt.setNumberOfRepeatsAllowed(src.getNumberOfRepeatsAllowed()); + if (src.hasQuantity()) + tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); + if (src.hasExpectedSupplyDuration()) + tgt.setExpectedSupplyDuration(convertDuration(src.getExpectedSupplyDuration())); + if (src.hasPerformer()) + tgt.setPerformer(convertReference(src.getPerformer())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestDispenseRequestComponent convertMedicationRequestDispenseRequestComponent(org.hl7.fhir.r5.model.MedicationRequest.MedicationRequestDispenseRequestComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestDispenseRequestComponent tgt = new org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestDispenseRequestComponent(); + copyElement(src, tgt); + if (src.hasValidityPeriod()) + tgt.setValidityPeriod(convertPeriod(src.getValidityPeriod())); + if (src.hasNumberOfRepeatsAllowed()) + tgt.setNumberOfRepeatsAllowed(src.getNumberOfRepeatsAllowed()); + if (src.hasQuantity()) + tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); + if (src.hasExpectedSupplyDuration()) + tgt.setExpectedSupplyDuration(convertDuration(src.getExpectedSupplyDuration())); + if (src.hasPerformer()) + tgt.setPerformer(convertReference(src.getPerformer())); + return tgt; + } + + public static org.hl7.fhir.r5.model.MedicationRequest.MedicationRequestSubstitutionComponent convertMedicationRequestSubstitutionComponent(org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestSubstitutionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.MedicationRequest.MedicationRequestSubstitutionComponent tgt = new org.hl7.fhir.r5.model.MedicationRequest.MedicationRequestSubstitutionComponent(); + copyElement(src, tgt); + if (src.hasAllowed()) + tgt.setAllowed(convertBoolean(src.getAllowedElement())); + if (src.hasReason()) + tgt.setReason(convertCodeableConcept(src.getReason())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestSubstitutionComponent convertMedicationRequestSubstitutionComponent(org.hl7.fhir.r5.model.MedicationRequest.MedicationRequestSubstitutionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestSubstitutionComponent tgt = new org.hl7.fhir.dstu3.model.MedicationRequest.MedicationRequestSubstitutionComponent(); + copyElement(src, tgt); + if (src.hasAllowedBooleanType()) + tgt.setAllowedElement(convertBoolean(src.getAllowedBooleanType())); + if (src.hasReason()) + tgt.setReason(convertCodeableConcept(src.getReason())); + return tgt; + } + + public static org.hl7.fhir.r5.model.MedicationStatement convertMedicationStatement(org.hl7.fhir.dstu3.model.MedicationStatement src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.MedicationStatement tgt = new org.hl7.fhir.r5.model.MedicationStatement(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + for (org.hl7.fhir.dstu3.model.Reference t : src.getBasedOn()) + tgt.addBasedOn(convertReference(t)); + for (org.hl7.fhir.dstu3.model.Reference t : src.getPartOf()) + tgt.addPartOf(convertReference(t)); + if (src.hasContext()) + tgt.setContext(convertReference(src.getContext())); + if (src.hasStatus()) + tgt.setStatus(convertMedicationStatementStatus(src.getStatus())); + if (src.hasCategory()) + tgt.setCategory(convertCodeableConcept(src.getCategory())); + if (src.hasMedication()) + tgt.setMedication(convertType(src.getMedication())); + if (src.hasEffective()) + tgt.setEffective(convertType(src.getEffective())); + if (src.hasDateAsserted()) + tgt.setDateAsserted(src.getDateAsserted()); + if (src.hasInformationSource()) + tgt.setInformationSource(convertReference(src.getInformationSource())); + if (src.hasSubject()) + tgt.setSubject(convertReference(src.getSubject())); + for (org.hl7.fhir.dstu3.model.Reference t : src.getDerivedFrom()) + tgt.addDerivedFrom(convertReference(t)); +// if (src.hasTaken()) +// tgt.addExtension(convertMedicationStatementTaken(src.getTaken())); +// for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getReasonNotTaken()) +// tgt.addReasonNotTaken(convertCodeableConcept(t)); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getReasonCode()) + tgt.addReasonCode(convertCodeableConcept(t)); + for (org.hl7.fhir.dstu3.model.Reference t : src.getReasonReference()) + tgt.addReasonReference(convertReference(t)); + for (org.hl7.fhir.dstu3.model.Annotation t : src.getNote()) + tgt.addNote(convertAnnotation(t)); + for (org.hl7.fhir.dstu3.model.Dosage t : src.getDosage()) + tgt.addDosage(convertDosage(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.MedicationStatement convertMedicationStatement(org.hl7.fhir.r5.model.MedicationStatement src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.MedicationStatement tgt = new org.hl7.fhir.dstu3.model.MedicationStatement(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getBasedOn()) + tgt.addBasedOn(convertReference(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getPartOf()) + tgt.addPartOf(convertReference(t)); + if (src.hasContext()) + tgt.setContext(convertReference(src.getContext())); + if (src.hasStatus()) + tgt.setStatus(convertMedicationStatementStatus(src.getStatus())); + if (src.hasCategory()) + tgt.setCategory(convertCodeableConcept(src.getCategory())); + if (src.hasMedication()) + tgt.setMedication(convertType(src.getMedication())); + if (src.hasEffective()) + tgt.setEffective(convertType(src.getEffective())); + if (src.hasDateAsserted()) + tgt.setDateAsserted(src.getDateAsserted()); + if (src.hasInformationSource()) + tgt.setInformationSource(convertReference(src.getInformationSource())); + if (src.hasSubject()) + tgt.setSubject(convertReference(src.getSubject())); + for (org.hl7.fhir.r5.model.Reference t : src.getDerivedFrom()) + tgt.addDerivedFrom(convertReference(t)); +// if (src.hasExtension(VersionConvertorConstants.MODIFIER_TAKEN)) +// tgt.setTaken(convertMedicationStatementTaken(src.getExtensionByUrl(VersionConvertorConstants.MODIFIER_TAKEN))); +// for (org.hl7.fhir.r5.model.CodeableConcept t : src.getReasonNotTaken()) +// tgt.addReasonNotTaken(convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getReasonCode()) + tgt.addReasonCode(convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getReasonReference()) + tgt.addReasonReference(convertReference(t)); + for (org.hl7.fhir.r5.model.Annotation t : src.getNote()) + tgt.addNote(convertAnnotation(t)); + for (org.hl7.fhir.r5.model.Dosage t : src.getDosage()) + tgt.addDosage(convertDosage(t)); + return tgt; + } + + private static org.hl7.fhir.r5.model.MedicationStatement.MedicationStatementStatus convertMedicationStatementStatus(org.hl7.fhir.dstu3.model.MedicationStatement.MedicationStatementStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case ACTIVE: return org.hl7.fhir.r5.model.MedicationStatement.MedicationStatementStatus.ACTIVE; + case COMPLETED: return org.hl7.fhir.r5.model.MedicationStatement.MedicationStatementStatus.COMPLETED; + case ENTEREDINERROR: return org.hl7.fhir.r5.model.MedicationStatement.MedicationStatementStatus.ENTEREDINERROR; + case INTENDED: return org.hl7.fhir.r5.model.MedicationStatement.MedicationStatementStatus.INTENDED; + case STOPPED: return org.hl7.fhir.r5.model.MedicationStatement.MedicationStatementStatus.STOPPED; + case ONHOLD: return org.hl7.fhir.r5.model.MedicationStatement.MedicationStatementStatus.ONHOLD; + default: return org.hl7.fhir.r5.model.MedicationStatement.MedicationStatementStatus.NULL; + } +} + + private static org.hl7.fhir.dstu3.model.MedicationStatement.MedicationStatementStatus convertMedicationStatementStatus(org.hl7.fhir.r5.model.MedicationStatement.MedicationStatementStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case ACTIVE: return org.hl7.fhir.dstu3.model.MedicationStatement.MedicationStatementStatus.ACTIVE; + case COMPLETED: return org.hl7.fhir.dstu3.model.MedicationStatement.MedicationStatementStatus.COMPLETED; + case ENTEREDINERROR: return org.hl7.fhir.dstu3.model.MedicationStatement.MedicationStatementStatus.ENTEREDINERROR; + case INTENDED: return org.hl7.fhir.dstu3.model.MedicationStatement.MedicationStatementStatus.INTENDED; + case STOPPED: return org.hl7.fhir.dstu3.model.MedicationStatement.MedicationStatementStatus.STOPPED; + case ONHOLD: return org.hl7.fhir.dstu3.model.MedicationStatement.MedicationStatementStatus.ONHOLD; + default: return org.hl7.fhir.dstu3.model.MedicationStatement.MedicationStatementStatus.NULL; + } +} +// +// private static org.hl7.fhir.r5.model.MedicationStatement.MedicationStatementTaken convertMedicationStatementTaken(org.hl7.fhir.dstu3.model.MedicationStatement.MedicationStatementTaken src) throws FHIRException { +// if (src == null) +// return null; +// switch (src) { +// case Y: return org.hl7.fhir.r5.model.MedicationStatement.MedicationStatementTaken.Y; +// case N: return org.hl7.fhir.r5.model.MedicationStatement.MedicationStatementTaken.N; +// case UNK: return org.hl7.fhir.r5.model.MedicationStatement.MedicationStatementTaken.UNK; +// case NA: return org.hl7.fhir.r5.model.MedicationStatement.MedicationStatementTaken.NA; +// default: return org.hl7.fhir.r5.model.MedicationStatement.MedicationStatementTaken.NULL; +// } +//} +// +// private static org.hl7.fhir.dstu3.model.MedicationStatement.MedicationStatementTaken convertMedicationStatementTaken(org.hl7.fhir.r5.model.MedicationStatement.MedicationStatementTaken src) throws FHIRException { +// if (src == null) +// return null; +// switch (src) { +// case Y: return org.hl7.fhir.dstu3.model.MedicationStatement.MedicationStatementTaken.Y; +// case N: return org.hl7.fhir.dstu3.model.MedicationStatement.MedicationStatementTaken.N; +// case UNK: return org.hl7.fhir.dstu3.model.MedicationStatement.MedicationStatementTaken.UNK; +// case NA: return org.hl7.fhir.dstu3.model.MedicationStatement.MedicationStatementTaken.NA; +// default: return org.hl7.fhir.dstu3.model.MedicationStatement.MedicationStatementTaken.NULL; +// } +//} + + public static org.hl7.fhir.r5.model.MessageDefinition convertMessageDefinition(org.hl7.fhir.dstu3.model.MessageDefinition src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.MessageDefinition tgt = new org.hl7.fhir.r5.model.MessageDefinition(); + copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + if (src.hasIdentifier()) + tgt.addIdentifier(convertIdentifier(src.getIdentifier())); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasTitle()) + tgt.setTitle(src.getTitle()); + if (src.hasStatus()) + tgt.setStatus(convertPublicationStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) + tgt.addContact(convertContactDetail(t)); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu3.model.UsageContext t : src.getUseContext()) + tgt.addUseContext(convertUsageContext(t)); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction()) + tgt.addJurisdiction(convertCodeableConcept(t)); + if (src.hasPurpose()) + tgt.setPurpose(src.getPurpose()); + if (src.hasCopyright()) + tgt.setCopyright(src.getCopyright()); + if (src.hasBase()) + tgt.setBaseElement(convertReferenceToCanonical(src.getBase())); + for (org.hl7.fhir.dstu3.model.Reference t : src.getParent()) + tgt.getParent().add(convertReferenceToCanonical(t)); + for (org.hl7.fhir.dstu3.model.Reference t : src.getReplaces()) + tgt.getReplaces().add(convertReferenceToCanonical(t)); + if (src.hasEvent()) + tgt.setEvent(convertCoding(src.getEvent())); + if (src.hasCategory()) + tgt.setCategory(convertMessageSignificanceCategory(src.getCategory())); + for (org.hl7.fhir.dstu3.model.MessageDefinition.MessageDefinitionFocusComponent t : src.getFocus()) + tgt.addFocus(convertMessageDefinitionFocusComponent(t)); + if (src.hasResponseRequired()) + tgt.setResponseRequired(src.getResponseRequired() ? org.hl7.fhir.r5.model.MessageDefinition.MessageheaderResponseRequest.ALWAYS : org.hl7.fhir.r5.model.MessageDefinition.MessageheaderResponseRequest.NEVER); + for (org.hl7.fhir.dstu3.model.MessageDefinition.MessageDefinitionAllowedResponseComponent t : src.getAllowedResponse()) + tgt.addAllowedResponse(convertMessageDefinitionAllowedResponseComponent(t)); + return tgt; + } + + public static String convertCoding2Uri(org.hl7.fhir.dstu3.model.Coding code) { + return code.getSystem()+"/"+code.getCode(); + } + + public static org.hl7.fhir.dstu3.model.MessageDefinition convertMessageDefinition(org.hl7.fhir.r5.model.MessageDefinition src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.MessageDefinition tgt = new org.hl7.fhir.dstu3.model.MessageDefinition(); + copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + if (src.hasIdentifier()) + tgt.setIdentifier(convertIdentifier(src.getIdentifierFirstRep())); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasTitle()) + tgt.setTitle(src.getTitle()); + if (src.hasStatus()) + tgt.setStatus(convertPublicationStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.r5.model.ContactDetail t : src.getContact()) + tgt.addContact(convertContactDetail(t)); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.r5.model.UsageContext t : src.getUseContext()) + tgt.addUseContext(convertUsageContext(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getJurisdiction()) + tgt.addJurisdiction(convertCodeableConcept(t)); + if (src.hasPurpose()) + tgt.setPurpose(src.getPurpose()); + if (src.hasCopyright()) + tgt.setCopyright(src.getCopyright()); + if (src.hasBase()) + tgt.setBase(convertCanonicalToReference(src.getBaseElement())); + for (org.hl7.fhir.r5.model.CanonicalType t : src.getParent()) + tgt.addParent(convertCanonicalToReference(t)); + for (org.hl7.fhir.r5.model.CanonicalType t : src.getReplaces()) + tgt.addReplaces(convertCanonicalToReference(t)); + if (src.hasEventCoding()) + tgt.setEvent(convertCoding(src.getEventCoding())); + if (src.hasCategory()) + tgt.setCategory(convertMessageSignificanceCategory(src.getCategory())); + for (org.hl7.fhir.r5.model.MessageDefinition.MessageDefinitionFocusComponent t : src.getFocus()) + tgt.addFocus(convertMessageDefinitionFocusComponent(t)); + if (src.hasResponseRequired()) + tgt.setResponseRequired(src.getResponseRequired() != org.hl7.fhir.r5.model.MessageDefinition.MessageheaderResponseRequest.NEVER); + for (org.hl7.fhir.r5.model.MessageDefinition.MessageDefinitionAllowedResponseComponent t : src.getAllowedResponse()) + tgt.addAllowedResponse(convertMessageDefinitionAllowedResponseComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Coding convertUri2Coding(String uri) { + int i = uri.lastIndexOf("/"); + return new org.hl7.fhir.dstu3.model.Coding().setSystem(uri.substring(0, i)).setCode(uri.substring(i+1)); + } + + private static org.hl7.fhir.r5.model.MessageDefinition.MessageSignificanceCategory convertMessageSignificanceCategory(org.hl7.fhir.dstu3.model.MessageDefinition.MessageSignificanceCategory src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case CONSEQUENCE: return org.hl7.fhir.r5.model.MessageDefinition.MessageSignificanceCategory.CONSEQUENCE; + case CURRENCY: return org.hl7.fhir.r5.model.MessageDefinition.MessageSignificanceCategory.CURRENCY; + case NOTIFICATION: return org.hl7.fhir.r5.model.MessageDefinition.MessageSignificanceCategory.NOTIFICATION; + default: return org.hl7.fhir.r5.model.MessageDefinition.MessageSignificanceCategory.NULL; + } +} + + private static org.hl7.fhir.dstu3.model.MessageDefinition.MessageSignificanceCategory convertMessageSignificanceCategory(org.hl7.fhir.r5.model.MessageDefinition.MessageSignificanceCategory src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case CONSEQUENCE: return org.hl7.fhir.dstu3.model.MessageDefinition.MessageSignificanceCategory.CONSEQUENCE; + case CURRENCY: return org.hl7.fhir.dstu3.model.MessageDefinition.MessageSignificanceCategory.CURRENCY; + case NOTIFICATION: return org.hl7.fhir.dstu3.model.MessageDefinition.MessageSignificanceCategory.NOTIFICATION; + default: return org.hl7.fhir.dstu3.model.MessageDefinition.MessageSignificanceCategory.NULL; + } +} + + public static org.hl7.fhir.r5.model.MessageDefinition.MessageDefinitionFocusComponent convertMessageDefinitionFocusComponent(org.hl7.fhir.dstu3.model.MessageDefinition.MessageDefinitionFocusComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.MessageDefinition.MessageDefinitionFocusComponent tgt = new org.hl7.fhir.r5.model.MessageDefinition.MessageDefinitionFocusComponent(); + copyElement(src, tgt); + if (src.hasCode()) + tgt.setCode(src.getCode()); + if (src.hasProfile()) + tgt.setProfileElement(convertReferenceToCanonical(src.getProfile())); + if (src.hasMin()) + tgt.setMin(src.getMin()); + if (src.hasMax()) + tgt.setMax(src.getMax()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.MessageDefinition.MessageDefinitionFocusComponent convertMessageDefinitionFocusComponent(org.hl7.fhir.r5.model.MessageDefinition.MessageDefinitionFocusComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.MessageDefinition.MessageDefinitionFocusComponent tgt = new org.hl7.fhir.dstu3.model.MessageDefinition.MessageDefinitionFocusComponent(); + copyElement(src, tgt); + if (src.hasCode()) + tgt.setCode(src.getCode()); + if (src.hasProfile()) + tgt.setProfile(convertCanonicalToReference(src.getProfileElement())); + if (src.hasMin()) + tgt.setMin(src.getMin()); + if (src.hasMax()) + tgt.setMax(src.getMax()); + return tgt; + } + + public static org.hl7.fhir.r5.model.MessageDefinition.MessageDefinitionAllowedResponseComponent convertMessageDefinitionAllowedResponseComponent(org.hl7.fhir.dstu3.model.MessageDefinition.MessageDefinitionAllowedResponseComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.MessageDefinition.MessageDefinitionAllowedResponseComponent tgt = new org.hl7.fhir.r5.model.MessageDefinition.MessageDefinitionAllowedResponseComponent(); + copyElement(src, tgt); + if (src.hasMessage()) + tgt.setMessageElement(convertReferenceToCanonical(src.getMessage())); + if (src.hasSituation()) + tgt.setSituation(src.getSituation()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.MessageDefinition.MessageDefinitionAllowedResponseComponent convertMessageDefinitionAllowedResponseComponent(org.hl7.fhir.r5.model.MessageDefinition.MessageDefinitionAllowedResponseComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.MessageDefinition.MessageDefinitionAllowedResponseComponent tgt = new org.hl7.fhir.dstu3.model.MessageDefinition.MessageDefinitionAllowedResponseComponent(); + copyElement(src, tgt); + if (src.hasMessage()) + tgt.setMessage(convertCanonicalToReference(src.getMessageElement())); + if (src.hasSituation()) + tgt.setSituation(src.getSituation()); + return tgt; + } + + public static org.hl7.fhir.r5.model.MessageHeader convertMessageHeader(org.hl7.fhir.dstu3.model.MessageHeader src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.MessageHeader tgt = new org.hl7.fhir.r5.model.MessageHeader(); + copyDomainResource(src, tgt); + if (src.hasEvent()) + tgt.setEvent(convertCoding(src.getEvent())); + for (org.hl7.fhir.dstu3.model.MessageHeader.MessageDestinationComponent t : src.getDestination()) + tgt.addDestination(convertMessageDestinationComponent(t)); + if (src.hasSender()) + tgt.setSender(convertReference(src.getSender())); +// if (src.hasTimestamp()) +// tgt.setTimestamp(src.getTimestamp()); + if (src.hasEnterer()) + tgt.setEnterer(convertReference(src.getEnterer())); + if (src.hasAuthor()) + tgt.setAuthor(convertReference(src.getAuthor())); + if (src.hasSource()) + tgt.setSource(convertMessageSourceComponent(src.getSource())); + if (src.hasResponsible()) + tgt.setResponsible(convertReference(src.getResponsible())); + if (src.hasReason()) + tgt.setReason(convertCodeableConcept(src.getReason())); + if (src.hasResponse()) + tgt.setResponse(convertMessageHeaderResponseComponent(src.getResponse())); + for (org.hl7.fhir.dstu3.model.Reference t : src.getFocus()) + tgt.addFocus(convertReference(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.MessageHeader convertMessageHeader(org.hl7.fhir.r5.model.MessageHeader src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.MessageHeader tgt = new org.hl7.fhir.dstu3.model.MessageHeader(); + copyDomainResource(src, tgt); + if (src.hasEventCoding()) + tgt.setEvent(convertCoding(src.getEventCoding())); + for (org.hl7.fhir.r5.model.MessageHeader.MessageDestinationComponent t : src.getDestination()) + tgt.addDestination(convertMessageDestinationComponent(t)); + if (src.hasSender()) + tgt.setSender(convertReference(src.getSender())); +// if (src.hasTimestamp()) +// tgt.setTimestamp(src.getTimestamp()); + if (src.hasEnterer()) + tgt.setEnterer(convertReference(src.getEnterer())); + if (src.hasAuthor()) + tgt.setAuthor(convertReference(src.getAuthor())); + if (src.hasSource()) + tgt.setSource(convertMessageSourceComponent(src.getSource())); + if (src.hasResponsible()) + tgt.setResponsible(convertReference(src.getResponsible())); + if (src.hasReason()) + tgt.setReason(convertCodeableConcept(src.getReason())); + if (src.hasResponse()) + tgt.setResponse(convertMessageHeaderResponseComponent(src.getResponse())); + for (org.hl7.fhir.r5.model.Reference t : src.getFocus()) + tgt.addFocus(convertReference(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.MessageHeader.MessageDestinationComponent convertMessageDestinationComponent(org.hl7.fhir.dstu3.model.MessageHeader.MessageDestinationComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.MessageHeader.MessageDestinationComponent tgt = new org.hl7.fhir.r5.model.MessageHeader.MessageDestinationComponent(); + copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasTarget()) + tgt.setTarget(convertReference(src.getTarget())); + if (src.hasEndpoint()) + tgt.setEndpoint(src.getEndpoint()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.MessageHeader.MessageDestinationComponent convertMessageDestinationComponent(org.hl7.fhir.r5.model.MessageHeader.MessageDestinationComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.MessageHeader.MessageDestinationComponent tgt = new org.hl7.fhir.dstu3.model.MessageHeader.MessageDestinationComponent(); + copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasTarget()) + tgt.setTarget(convertReference(src.getTarget())); + if (src.hasEndpoint()) + tgt.setEndpoint(src.getEndpoint()); + return tgt; + } + + public static org.hl7.fhir.r5.model.MessageHeader.MessageSourceComponent convertMessageSourceComponent(org.hl7.fhir.dstu3.model.MessageHeader.MessageSourceComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.MessageHeader.MessageSourceComponent tgt = new org.hl7.fhir.r5.model.MessageHeader.MessageSourceComponent(); + copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasSoftware()) + tgt.setSoftware(src.getSoftware()); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasContact()) + tgt.setContact(convertContactPoint(src.getContact())); + if (src.hasEndpoint()) + tgt.setEndpoint(src.getEndpoint()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.MessageHeader.MessageSourceComponent convertMessageSourceComponent(org.hl7.fhir.r5.model.MessageHeader.MessageSourceComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.MessageHeader.MessageSourceComponent tgt = new org.hl7.fhir.dstu3.model.MessageHeader.MessageSourceComponent(); + copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasSoftware()) + tgt.setSoftware(src.getSoftware()); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasContact()) + tgt.setContact(convertContactPoint(src.getContact())); + if (src.hasEndpoint()) + tgt.setEndpoint(src.getEndpoint()); + return tgt; + } + + public static org.hl7.fhir.r5.model.MessageHeader.MessageHeaderResponseComponent convertMessageHeaderResponseComponent(org.hl7.fhir.dstu3.model.MessageHeader.MessageHeaderResponseComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.MessageHeader.MessageHeaderResponseComponent tgt = new org.hl7.fhir.r5.model.MessageHeader.MessageHeaderResponseComponent(); + copyElement(src, tgt); + if (src.hasIdentifier()) + tgt.setIdentifier(src.getIdentifier()); + if (src.hasCode()) + tgt.setCode(convertResponseType(src.getCode())); + if (src.hasDetails()) + tgt.setDetails(convertReference(src.getDetails())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.MessageHeader.MessageHeaderResponseComponent convertMessageHeaderResponseComponent(org.hl7.fhir.r5.model.MessageHeader.MessageHeaderResponseComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.MessageHeader.MessageHeaderResponseComponent tgt = new org.hl7.fhir.dstu3.model.MessageHeader.MessageHeaderResponseComponent(); + copyElement(src, tgt); + if (src.hasIdentifier()) + tgt.setIdentifier(src.getIdentifier()); + if (src.hasCode()) + tgt.setCode(convertResponseType(src.getCode())); + if (src.hasDetails()) + tgt.setDetails(convertReference(src.getDetails())); + return tgt; + } + + private static org.hl7.fhir.r5.model.MessageHeader.ResponseType convertResponseType(org.hl7.fhir.dstu3.model.MessageHeader.ResponseType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case OK: return org.hl7.fhir.r5.model.MessageHeader.ResponseType.OK; + case TRANSIENTERROR: return org.hl7.fhir.r5.model.MessageHeader.ResponseType.TRANSIENTERROR; + case FATALERROR: return org.hl7.fhir.r5.model.MessageHeader.ResponseType.FATALERROR; + default: return org.hl7.fhir.r5.model.MessageHeader.ResponseType.NULL; + } +} + + private static org.hl7.fhir.dstu3.model.MessageHeader.ResponseType convertResponseType(org.hl7.fhir.r5.model.MessageHeader.ResponseType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case OK: return org.hl7.fhir.dstu3.model.MessageHeader.ResponseType.OK; + case TRANSIENTERROR: return org.hl7.fhir.dstu3.model.MessageHeader.ResponseType.TRANSIENTERROR; + case FATALERROR: return org.hl7.fhir.dstu3.model.MessageHeader.ResponseType.FATALERROR; + default: return org.hl7.fhir.dstu3.model.MessageHeader.ResponseType.NULL; + } +} + + public static org.hl7.fhir.r5.model.NamingSystem convertNamingSystem(org.hl7.fhir.dstu3.model.NamingSystem src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.NamingSystem tgt = new org.hl7.fhir.r5.model.NamingSystem(); + copyDomainResource(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasStatus()) + tgt.setStatus(convertPublicationStatus(src.getStatus())); + if (src.hasKind()) + tgt.setKind(convertNamingSystemType(src.getKind())); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) + tgt.addContact(convertContactDetail(t)); + if (src.hasResponsible()) + tgt.setResponsible(src.getResponsible()); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu3.model.UsageContext t : src.getUseContext()) + tgt.addUseContext(convertUsageContext(t)); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction()) + tgt.addJurisdiction(convertCodeableConcept(t)); + if (src.hasUsage()) + tgt.setUsage(src.getUsage()); + for (org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemUniqueIdComponent t : src.getUniqueId()) + tgt.addUniqueId(convertNamingSystemUniqueIdComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.NamingSystem convertNamingSystem(org.hl7.fhir.r5.model.NamingSystem src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.NamingSystem tgt = new org.hl7.fhir.dstu3.model.NamingSystem(); + copyDomainResource(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasStatus()) + tgt.setStatus(convertPublicationStatus(src.getStatus())); + if (src.hasKind()) + tgt.setKind(convertNamingSystemType(src.getKind())); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.r5.model.ContactDetail t : src.getContact()) + tgt.addContact(convertContactDetail(t)); + if (src.hasResponsible()) + tgt.setResponsible(src.getResponsible()); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.r5.model.UsageContext t : src.getUseContext()) + tgt.addUseContext(convertUsageContext(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getJurisdiction()) + tgt.addJurisdiction(convertCodeableConcept(t)); + if (src.hasUsage()) + tgt.setUsage(src.getUsage()); + for (org.hl7.fhir.r5.model.NamingSystem.NamingSystemUniqueIdComponent t : src.getUniqueId()) + tgt.addUniqueId(convertNamingSystemUniqueIdComponent(t)); + return tgt; + } + + private static org.hl7.fhir.r5.model.NamingSystem.NamingSystemType convertNamingSystemType(org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case CODESYSTEM: return org.hl7.fhir.r5.model.NamingSystem.NamingSystemType.CODESYSTEM; + case IDENTIFIER: return org.hl7.fhir.r5.model.NamingSystem.NamingSystemType.IDENTIFIER; + case ROOT: return org.hl7.fhir.r5.model.NamingSystem.NamingSystemType.ROOT; + default: return org.hl7.fhir.r5.model.NamingSystem.NamingSystemType.NULL; + } +} + + private static org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemType convertNamingSystemType(org.hl7.fhir.r5.model.NamingSystem.NamingSystemType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case CODESYSTEM: return org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemType.CODESYSTEM; + case IDENTIFIER: return org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemType.IDENTIFIER; + case ROOT: return org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemType.ROOT; + default: return org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemType.NULL; + } +} + + public static org.hl7.fhir.r5.model.NamingSystem.NamingSystemUniqueIdComponent convertNamingSystemUniqueIdComponent(org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemUniqueIdComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.NamingSystem.NamingSystemUniqueIdComponent tgt = new org.hl7.fhir.r5.model.NamingSystem.NamingSystemUniqueIdComponent(); + copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertNamingSystemIdentifierType(src.getType())); + if (src.hasValue()) + tgt.setValue(src.getValue()); + if (src.hasPreferred()) + tgt.setPreferred(src.getPreferred()); + if (src.hasComment()) + tgt.setComment(src.getComment()); + if (src.hasPeriod()) + tgt.setPeriod(convertPeriod(src.getPeriod())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemUniqueIdComponent convertNamingSystemUniqueIdComponent(org.hl7.fhir.r5.model.NamingSystem.NamingSystemUniqueIdComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemUniqueIdComponent tgt = new org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemUniqueIdComponent(); + copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertNamingSystemIdentifierType(src.getType())); + if (src.hasValue()) + tgt.setValue(src.getValue()); + if (src.hasPreferred()) + tgt.setPreferred(src.getPreferred()); + if (src.hasComment()) + tgt.setComment(src.getComment()); + if (src.hasPeriod()) + tgt.setPeriod(convertPeriod(src.getPeriod())); + return tgt; + } + + private static org.hl7.fhir.r5.model.NamingSystem.NamingSystemIdentifierType convertNamingSystemIdentifierType(org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemIdentifierType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case OID: return org.hl7.fhir.r5.model.NamingSystem.NamingSystemIdentifierType.OID; + case UUID: return org.hl7.fhir.r5.model.NamingSystem.NamingSystemIdentifierType.UUID; + case URI: return org.hl7.fhir.r5.model.NamingSystem.NamingSystemIdentifierType.URI; + case OTHER: return org.hl7.fhir.r5.model.NamingSystem.NamingSystemIdentifierType.OTHER; + default: return org.hl7.fhir.r5.model.NamingSystem.NamingSystemIdentifierType.NULL; + } +} + + private static org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemIdentifierType convertNamingSystemIdentifierType(org.hl7.fhir.r5.model.NamingSystem.NamingSystemIdentifierType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case OID: return org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemIdentifierType.OID; + case UUID: return org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemIdentifierType.UUID; + case URI: return org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemIdentifierType.URI; + case OTHER: return org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemIdentifierType.OTHER; + default: return org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemIdentifierType.NULL; + } +} + +// public static org.hl7.fhir.r5.model.NutritionOrder convertNutritionOrder(org.hl7.fhir.dstu3.model.NutritionOrder src) throws FHIRException { +// if (src == null) +// return null; +// org.hl7.fhir.r5.model.NutritionOrder tgt = new org.hl7.fhir.r5.model.NutritionOrder(); +// copyDomainResource(src, tgt); +// for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) +// tgt.addIdentifier(convertIdentifier(t)); +// if (src.hasStatus()) +// tgt.setStatus(convertNutritionOrderStatus(src.getStatus())); +// if (src.hasPatient()) +// tgt.setPatient(convertReference(src.getPatient())); +// if (src.hasEncounter()) +// tgt.setEncounter(convertReference(src.getEncounter())); +// if (src.hasDateTime()) +// tgt.setDateTime(src.getDateTime()); +// if (src.hasOrderer()) +// tgt.setOrderer(convertReference(src.getOrderer())); +// for (org.hl7.fhir.dstu3.model.Reference t : src.getAllergyIntolerance()) +// tgt.addAllergyIntolerance(convertReference(t)); +// for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getFoodPreferenceModifier()) +// tgt.addFoodPreferenceModifier(convertCodeableConcept(t)); +// for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getExcludeFoodModifier()) +// tgt.addExcludeFoodModifier(convertCodeableConcept(t)); +// if (src.hasOralDiet()) +// tgt.setOralDiet(convertNutritionOrderOralDietComponent(src.getOralDiet())); +// for (org.hl7.fhir.dstu3.model.NutritionOrder.NutritionOrderSupplementComponent t : src.getSupplement()) +// tgt.addSupplement(convertNutritionOrderSupplementComponent(t)); +// if (src.hasEnteralFormula()) +// tgt.setEnteralFormula(convertNutritionOrderEnteralFormulaComponent(src.getEnteralFormula())); +// return tgt; +// } +// +// public static org.hl7.fhir.dstu3.model.NutritionOrder convertNutritionOrder(org.hl7.fhir.r5.model.NutritionOrder src) throws FHIRException { +// if (src == null) +// return null; +// org.hl7.fhir.dstu3.model.NutritionOrder tgt = new org.hl7.fhir.dstu3.model.NutritionOrder(); +// copyDomainResource(src, tgt); +// for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) +// tgt.addIdentifier(convertIdentifier(t)); +// if (src.hasStatus()) +// tgt.setStatus(convertNutritionOrderStatus(src.getStatus())); +// if (src.hasPatient()) +// tgt.setPatient(convertReference(src.getPatient())); +// if (src.hasEncounter()) +// tgt.setEncounter(convertReference(src.getEncounter())); +// if (src.hasDateTime()) +// tgt.setDateTime(src.getDateTime()); +// if (src.hasOrderer()) +// tgt.setOrderer(convertReference(src.getOrderer())); +// for (org.hl7.fhir.r5.model.Reference t : src.getAllergyIntolerance()) +// tgt.addAllergyIntolerance(convertReference(t)); +// for (org.hl7.fhir.r5.model.CodeableConcept t : src.getFoodPreferenceModifier()) +// tgt.addFoodPreferenceModifier(convertCodeableConcept(t)); +// for (org.hl7.fhir.r5.model.CodeableConcept t : src.getExcludeFoodModifier()) +// tgt.addExcludeFoodModifier(convertCodeableConcept(t)); +// if (src.hasOralDiet()) +// tgt.setOralDiet(convertNutritionOrderOralDietComponent(src.getOralDiet())); +// for (org.hl7.fhir.r5.model.NutritionOrder.NutritionOrderSupplementComponent t : src.getSupplement()) +// tgt.addSupplement(convertNutritionOrderSupplementComponent(t)); +// if (src.hasEnteralFormula()) +// tgt.setEnteralFormula(convertNutritionOrderEnteralFormulaComponent(src.getEnteralFormula())); +// return tgt; +// } +// +// private static org.hl7.fhir.r5.model.NutritionOrder.NutritionOrderStatus convertNutritionOrderStatus(org.hl7.fhir.dstu3.model.NutritionOrder.NutritionOrderStatus src) throws FHIRException { +// if (src == null) +// return null; +// switch (src) { +// case PROPOSED: return org.hl7.fhir.r5.model.NutritionOrder.NutritionOrderStatus.PROPOSED; +// case DRAFT: return org.hl7.fhir.r5.model.NutritionOrder.NutritionOrderStatus.DRAFT; +// case PLANNED: return org.hl7.fhir.r5.model.NutritionOrder.NutritionOrderStatus.PLANNED; +// case REQUESTED: return org.hl7.fhir.r5.model.NutritionOrder.NutritionOrderStatus.REQUESTED; +// case ACTIVE: return org.hl7.fhir.r5.model.NutritionOrder.NutritionOrderStatus.ACTIVE; +// case ONHOLD: return org.hl7.fhir.r5.model.NutritionOrder.NutritionOrderStatus.ONHOLD; +// case COMPLETED: return org.hl7.fhir.r5.model.NutritionOrder.NutritionOrderStatus.COMPLETED; +// case CANCELLED: return org.hl7.fhir.r5.model.NutritionOrder.NutritionOrderStatus.CANCELLED; +// case ENTEREDINERROR: return org.hl7.fhir.r5.model.NutritionOrder.NutritionOrderStatus.ENTEREDINERROR; +// default: return org.hl7.fhir.r5.model.NutritionOrder.NutritionOrderStatus.NULL; +// } +//} +// +// private static org.hl7.fhir.dstu3.model.NutritionOrder.NutritionOrderStatus convertNutritionOrderStatus(org.hl7.fhir.r5.model.NutritionOrder.NutritionOrderStatus src) throws FHIRException { +// if (src == null) +// return null; +// switch (src) { +// case PROPOSED: return org.hl7.fhir.dstu3.model.NutritionOrder.NutritionOrderStatus.PROPOSED; +// case DRAFT: return org.hl7.fhir.dstu3.model.NutritionOrder.NutritionOrderStatus.DRAFT; +// case PLANNED: return org.hl7.fhir.dstu3.model.NutritionOrder.NutritionOrderStatus.PLANNED; +// case REQUESTED: return org.hl7.fhir.dstu3.model.NutritionOrder.NutritionOrderStatus.REQUESTED; +// case ACTIVE: return org.hl7.fhir.dstu3.model.NutritionOrder.NutritionOrderStatus.ACTIVE; +// case ONHOLD: return org.hl7.fhir.dstu3.model.NutritionOrder.NutritionOrderStatus.ONHOLD; +// case COMPLETED: return org.hl7.fhir.dstu3.model.NutritionOrder.NutritionOrderStatus.COMPLETED; +// case CANCELLED: return org.hl7.fhir.dstu3.model.NutritionOrder.NutritionOrderStatus.CANCELLED; +// case ENTEREDINERROR: return org.hl7.fhir.dstu3.model.NutritionOrder.NutritionOrderStatus.ENTEREDINERROR; +// default: return org.hl7.fhir.dstu3.model.NutritionOrder.NutritionOrderStatus.NULL; +// } +//} +// +// public static org.hl7.fhir.r5.model.NutritionOrder.NutritionOrderOralDietComponent convertNutritionOrderOralDietComponent(org.hl7.fhir.dstu3.model.NutritionOrder.NutritionOrderOralDietComponent src) throws FHIRException { +// if (src == null) +// return null; +// org.hl7.fhir.r5.model.NutritionOrder.NutritionOrderOralDietComponent tgt = new org.hl7.fhir.r5.model.NutritionOrder.NutritionOrderOralDietComponent(); +// copyElement(src, tgt); +// for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getType()) +// tgt.addType(convertCodeableConcept(t)); +// for (org.hl7.fhir.dstu3.model.Timing t : src.getSchedule()) +// tgt.addSchedule(convertTiming(t)); +// for (org.hl7.fhir.dstu3.model.NutritionOrder.NutritionOrderOralDietNutrientComponent t : src.getNutrient()) +// tgt.addNutrient(convertNutritionOrderOralDietNutrientComponent(t)); +// for (org.hl7.fhir.dstu3.model.NutritionOrder.NutritionOrderOralDietTextureComponent t : src.getTexture()) +// tgt.addTexture(convertNutritionOrderOralDietTextureComponent(t)); +// for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getFluidConsistencyType()) +// tgt.addFluidConsistencyType(convertCodeableConcept(t)); +// if (src.hasInstruction()) +// tgt.setInstruction(src.getInstruction()); +// return tgt; +// } +// +// public static org.hl7.fhir.dstu3.model.NutritionOrder.NutritionOrderOralDietComponent convertNutritionOrderOralDietComponent(org.hl7.fhir.r5.model.NutritionOrder.NutritionOrderOralDietComponent src) throws FHIRException { +// if (src == null) +// return null; +// org.hl7.fhir.dstu3.model.NutritionOrder.NutritionOrderOralDietComponent tgt = new org.hl7.fhir.dstu3.model.NutritionOrder.NutritionOrderOralDietComponent(); +// copyElement(src, tgt); +// for (org.hl7.fhir.r5.model.CodeableConcept t : src.getType()) +// tgt.addType(convertCodeableConcept(t)); +// for (org.hl7.fhir.r5.model.Timing t : src.getSchedule()) +// tgt.addSchedule(convertTiming(t)); +// for (org.hl7.fhir.r5.model.NutritionOrder.NutritionOrderOralDietNutrientComponent t : src.getNutrient()) +// tgt.addNutrient(convertNutritionOrderOralDietNutrientComponent(t)); +// for (org.hl7.fhir.r5.model.NutritionOrder.NutritionOrderOralDietTextureComponent t : src.getTexture()) +// tgt.addTexture(convertNutritionOrderOralDietTextureComponent(t)); +// for (org.hl7.fhir.r5.model.CodeableConcept t : src.getFluidConsistencyType()) +// tgt.addFluidConsistencyType(convertCodeableConcept(t)); +// if (src.hasInstruction()) +// tgt.setInstruction(src.getInstruction()); +// return tgt; +// } +// +// public static org.hl7.fhir.r5.model.NutritionOrder.NutritionOrderOralDietNutrientComponent convertNutritionOrderOralDietNutrientComponent(org.hl7.fhir.dstu3.model.NutritionOrder.NutritionOrderOralDietNutrientComponent src) throws FHIRException { +// if (src == null) +// return null; +// org.hl7.fhir.r5.model.NutritionOrder.NutritionOrderOralDietNutrientComponent tgt = new org.hl7.fhir.r5.model.NutritionOrder.NutritionOrderOralDietNutrientComponent(); +// copyElement(src, tgt); +// if (src.hasModifier()) +// tgt.setModifier(convertCodeableConcept(src.getModifier())); +// if (src.hasAmount()) +// tgt.setAmount(convertSimpleQuantity(src.getAmount())); +// return tgt; +// } +// +// public static org.hl7.fhir.dstu3.model.NutritionOrder.NutritionOrderOralDietNutrientComponent convertNutritionOrderOralDietNutrientComponent(org.hl7.fhir.r5.model.NutritionOrder.NutritionOrderOralDietNutrientComponent src) throws FHIRException { +// if (src == null) +// return null; +// org.hl7.fhir.dstu3.model.NutritionOrder.NutritionOrderOralDietNutrientComponent tgt = new org.hl7.fhir.dstu3.model.NutritionOrder.NutritionOrderOralDietNutrientComponent(); +// copyElement(src, tgt); +// if (src.hasModifier()) +// tgt.setModifier(convertCodeableConcept(src.getModifier())); +// if (src.hasAmount()) +// tgt.setAmount(convertSimpleQuantity(src.getAmount())); +// return tgt; +// } +// +// public static org.hl7.fhir.r5.model.NutritionOrder.NutritionOrderOralDietTextureComponent convertNutritionOrderOralDietTextureComponent(org.hl7.fhir.dstu3.model.NutritionOrder.NutritionOrderOralDietTextureComponent src) throws FHIRException { +// if (src == null) +// return null; +// org.hl7.fhir.r5.model.NutritionOrder.NutritionOrderOralDietTextureComponent tgt = new org.hl7.fhir.r5.model.NutritionOrder.NutritionOrderOralDietTextureComponent(); +// copyElement(src, tgt); +// if (src.hasModifier()) +// tgt.setModifier(convertCodeableConcept(src.getModifier())); +// if (src.hasFoodType()) +// tgt.setFoodType(convertCodeableConcept(src.getFoodType())); +// return tgt; +// } +// +// public static org.hl7.fhir.dstu3.model.NutritionOrder.NutritionOrderOralDietTextureComponent convertNutritionOrderOralDietTextureComponent(org.hl7.fhir.r5.model.NutritionOrder.NutritionOrderOralDietTextureComponent src) throws FHIRException { +// if (src == null) +// return null; +// org.hl7.fhir.dstu3.model.NutritionOrder.NutritionOrderOralDietTextureComponent tgt = new org.hl7.fhir.dstu3.model.NutritionOrder.NutritionOrderOralDietTextureComponent(); +// copyElement(src, tgt); +// if (src.hasModifier()) +// tgt.setModifier(convertCodeableConcept(src.getModifier())); +// if (src.hasFoodType()) +// tgt.setFoodType(convertCodeableConcept(src.getFoodType())); +// return tgt; +// } +// +// public static org.hl7.fhir.r5.model.NutritionOrder.NutritionOrderSupplementComponent convertNutritionOrderSupplementComponent(org.hl7.fhir.dstu3.model.NutritionOrder.NutritionOrderSupplementComponent src) throws FHIRException { +// if (src == null) +// return null; +// org.hl7.fhir.r5.model.NutritionOrder.NutritionOrderSupplementComponent tgt = new org.hl7.fhir.r5.model.NutritionOrder.NutritionOrderSupplementComponent(); +// copyElement(src, tgt); +// if (src.hasType()) +// tgt.setType(convertCodeableConcept(src.getType())); +// if (src.hasProductName()) +// tgt.setProductName(src.getProductName()); +// for (org.hl7.fhir.dstu3.model.Timing t : src.getSchedule()) +// tgt.addSchedule(convertTiming(t)); +// if (src.hasQuantity()) +// tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); +// if (src.hasInstruction()) +// tgt.setInstruction(src.getInstruction()); +// return tgt; +// } +// +// public static org.hl7.fhir.dstu3.model.NutritionOrder.NutritionOrderSupplementComponent convertNutritionOrderSupplementComponent(org.hl7.fhir.r5.model.NutritionOrder.NutritionOrderSupplementComponent src) throws FHIRException { +// if (src == null) +// return null; +// org.hl7.fhir.dstu3.model.NutritionOrder.NutritionOrderSupplementComponent tgt = new org.hl7.fhir.dstu3.model.NutritionOrder.NutritionOrderSupplementComponent(); +// copyElement(src, tgt); +// if (src.hasType()) +// tgt.setType(convertCodeableConcept(src.getType())); +// if (src.hasProductName()) +// tgt.setProductName(src.getProductName()); +// for (org.hl7.fhir.r5.model.Timing t : src.getSchedule()) +// tgt.addSchedule(convertTiming(t)); +// if (src.hasQuantity()) +// tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); +// if (src.hasInstruction()) +// tgt.setInstruction(src.getInstruction()); +// return tgt; +// } +// +// public static org.hl7.fhir.r5.model.NutritionOrder.NutritionOrderEnteralFormulaComponent convertNutritionOrderEnteralFormulaComponent(org.hl7.fhir.dstu3.model.NutritionOrder.NutritionOrderEnteralFormulaComponent src) throws FHIRException { +// if (src == null) +// return null; +// org.hl7.fhir.r5.model.NutritionOrder.NutritionOrderEnteralFormulaComponent tgt = new org.hl7.fhir.r5.model.NutritionOrder.NutritionOrderEnteralFormulaComponent(); +// copyElement(src, tgt); +// if (src.hasBaseFormulaType()) +// tgt.setBaseFormulaType(convertCodeableConcept(src.getBaseFormulaType())); +// if (src.hasBaseFormulaProductName()) +// tgt.setBaseFormulaProductName(src.getBaseFormulaProductName()); +// if (src.hasAdditiveType()) +// tgt.setAdditiveType(convertCodeableConcept(src.getAdditiveType())); +// if (src.hasAdditiveProductName()) +// tgt.setAdditiveProductName(src.getAdditiveProductName()); +// if (src.hasCaloricDensity()) +// tgt.setCaloricDensity(convertSimpleQuantity(src.getCaloricDensity())); +// if (src.hasRouteofAdministration()) +// tgt.setRouteofAdministration(convertCodeableConcept(src.getRouteofAdministration())); +// for (org.hl7.fhir.dstu3.model.NutritionOrder.NutritionOrderEnteralFormulaAdministrationComponent t : src.getAdministration()) +// tgt.addAdministration(convertNutritionOrderEnteralFormulaAdministrationComponent(t)); +// if (src.hasMaxVolumeToDeliver()) +// tgt.setMaxVolumeToDeliver(convertSimpleQuantity(src.getMaxVolumeToDeliver())); +// if (src.hasAdministrationInstruction()) +// tgt.setAdministrationInstruction(src.getAdministrationInstruction()); +// return tgt; +// } +// +// public static org.hl7.fhir.dstu3.model.NutritionOrder.NutritionOrderEnteralFormulaComponent convertNutritionOrderEnteralFormulaComponent(org.hl7.fhir.r5.model.NutritionOrder.NutritionOrderEnteralFormulaComponent src) throws FHIRException { +// if (src == null) +// return null; +// org.hl7.fhir.dstu3.model.NutritionOrder.NutritionOrderEnteralFormulaComponent tgt = new org.hl7.fhir.dstu3.model.NutritionOrder.NutritionOrderEnteralFormulaComponent(); +// copyElement(src, tgt); +// if (src.hasBaseFormulaType()) +// tgt.setBaseFormulaType(convertCodeableConcept(src.getBaseFormulaType())); +// if (src.hasBaseFormulaProductName()) +// tgt.setBaseFormulaProductName(src.getBaseFormulaProductName()); +// if (src.hasAdditiveType()) +// tgt.setAdditiveType(convertCodeableConcept(src.getAdditiveType())); +// if (src.hasAdditiveProductName()) +// tgt.setAdditiveProductName(src.getAdditiveProductName()); +// if (src.hasCaloricDensity()) +// tgt.setCaloricDensity(convertSimpleQuantity(src.getCaloricDensity())); +// if (src.hasRouteofAdministration()) +// tgt.setRouteofAdministration(convertCodeableConcept(src.getRouteofAdministration())); +// for (org.hl7.fhir.r5.model.NutritionOrder.NutritionOrderEnteralFormulaAdministrationComponent t : src.getAdministration()) +// tgt.addAdministration(convertNutritionOrderEnteralFormulaAdministrationComponent(t)); +// if (src.hasMaxVolumeToDeliver()) +// tgt.setMaxVolumeToDeliver(convertSimpleQuantity(src.getMaxVolumeToDeliver())); +// if (src.hasAdministrationInstruction()) +// tgt.setAdministrationInstruction(src.getAdministrationInstruction()); +// return tgt; +// } +// +// public static org.hl7.fhir.r5.model.NutritionOrder.NutritionOrderEnteralFormulaAdministrationComponent convertNutritionOrderEnteralFormulaAdministrationComponent(org.hl7.fhir.dstu3.model.NutritionOrder.NutritionOrderEnteralFormulaAdministrationComponent src) throws FHIRException { +// if (src == null) +// return null; +// org.hl7.fhir.r5.model.NutritionOrder.NutritionOrderEnteralFormulaAdministrationComponent tgt = new org.hl7.fhir.r5.model.NutritionOrder.NutritionOrderEnteralFormulaAdministrationComponent(); +// copyElement(src, tgt); +// if (src.hasSchedule()) +// tgt.setSchedule(convertTiming(src.getSchedule())); +// if (src.hasQuantity()) +// tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); +// if (src.hasRate()) +// tgt.setRate(convertType(src.getRate())); +// return tgt; +// } +// +// public static org.hl7.fhir.dstu3.model.NutritionOrder.NutritionOrderEnteralFormulaAdministrationComponent convertNutritionOrderEnteralFormulaAdministrationComponent(org.hl7.fhir.r5.model.NutritionOrder.NutritionOrderEnteralFormulaAdministrationComponent src) throws FHIRException { +// if (src == null) +// return null; +// org.hl7.fhir.dstu3.model.NutritionOrder.NutritionOrderEnteralFormulaAdministrationComponent tgt = new org.hl7.fhir.dstu3.model.NutritionOrder.NutritionOrderEnteralFormulaAdministrationComponent(); +// copyElement(src, tgt); +// if (src.hasSchedule()) +// tgt.setSchedule(convertTiming(src.getSchedule())); +// if (src.hasQuantity()) +// tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); +// if (src.hasRate()) +// tgt.setRate(convertType(src.getRate())); +// return tgt; +// } + + public static org.hl7.fhir.r5.model.Observation convertObservation(org.hl7.fhir.dstu3.model.Observation src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Observation tgt = new org.hl7.fhir.r5.model.Observation(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + for (org.hl7.fhir.dstu3.model.Reference t : src.getBasedOn()) + tgt.addBasedOn(convertReference(t)); + if (src.hasStatus()) + tgt.setStatus(convertObservationStatus(src.getStatus())); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getCategory()) + tgt.addCategory(convertCodeableConcept(t)); + if (src.hasCode()) + tgt.setCode(convertCodeableConcept(src.getCode())); + if (src.hasSubject()) + tgt.setSubject(convertReference(src.getSubject())); + if (src.hasContext()) + tgt.setEncounter(convertReference(src.getContext())); + if (src.hasEffective()) + tgt.setEffective(convertType(src.getEffective())); + if (src.hasIssued()) + tgt.setIssued(src.getIssued()); + for (org.hl7.fhir.dstu3.model.Reference t : src.getPerformer()) + tgt.addPerformer(convertReference(t)); + if (src.hasValue()) + tgt.setValue(convertType(src.getValue())); + if (src.hasDataAbsentReason()) + tgt.setDataAbsentReason(convertCodeableConcept(src.getDataAbsentReason())); + if (src.hasInterpretation()) + tgt.addInterpretation(convertCodeableConcept(src.getInterpretation())); + if (src.hasComment()) + tgt.addNote().setText(src.getComment()); + if (src.hasBodySite()) + tgt.setBodySite(convertCodeableConcept(src.getBodySite())); + if (src.hasMethod()) + tgt.setMethod(convertCodeableConcept(src.getMethod())); + if (src.hasSpecimen()) + tgt.setSpecimen(convertReference(src.getSpecimen())); + if (src.hasDevice()) + tgt.setDevice(convertReference(src.getDevice())); + for (org.hl7.fhir.dstu3.model.Observation.ObservationReferenceRangeComponent t : src.getReferenceRange()) + tgt.addReferenceRange(convertObservationReferenceRangeComponent(t)); + for (org.hl7.fhir.dstu3.model.Observation.ObservationRelatedComponent t : src.getRelated()) + if (t.getType() == org.hl7.fhir.dstu3.model.Observation.ObservationRelationshipType.HASMEMBER) + tgt.addHasMember(convertReference(t.getTarget())); + else if (t.getType() == org.hl7.fhir.dstu3.model.Observation.ObservationRelationshipType.DERIVEDFROM) + tgt.addDerivedFrom(convertReference(t.getTarget())); + for (org.hl7.fhir.dstu3.model.Observation.ObservationComponentComponent t : src.getComponent()) + tgt.addComponent(convertObservationComponentComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Observation convertObservation(org.hl7.fhir.r5.model.Observation src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Observation tgt = new org.hl7.fhir.dstu3.model.Observation(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getBasedOn()) + tgt.addBasedOn(convertReference(t)); + if (src.hasStatus()) + tgt.setStatus(convertObservationStatus(src.getStatus())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getCategory()) + tgt.addCategory(convertCodeableConcept(t)); + if (src.hasCode()) + tgt.setCode(convertCodeableConcept(src.getCode())); + if (src.hasSubject()) + tgt.setSubject(convertReference(src.getSubject())); + if (src.hasEncounter()) + tgt.setContext(convertReference(src.getEncounter())); + if (src.hasEffective()) + tgt.setEffective(convertType(src.getEffective())); + if (src.hasIssued()) + tgt.setIssued(src.getIssued()); + for (org.hl7.fhir.r5.model.Reference t : src.getPerformer()) + tgt.addPerformer(convertReference(t)); + if (src.hasValue()) + tgt.setValue(convertType(src.getValue())); + if (src.hasDataAbsentReason()) + tgt.setDataAbsentReason(convertCodeableConcept(src.getDataAbsentReason())); + if (src.hasInterpretation()) + tgt.setInterpretation(convertCodeableConcept(src.getInterpretationFirstRep())); + if (src.hasNote()) + tgt.setComment(src.getNoteFirstRep().getText()); + if (src.hasBodySite()) + tgt.setBodySite(convertCodeableConcept(src.getBodySite())); + if (src.hasMethod()) + tgt.setMethod(convertCodeableConcept(src.getMethod())); + if (src.hasSpecimen()) + tgt.setSpecimen(convertReference(src.getSpecimen())); + if (src.hasDevice()) + tgt.setDevice(convertReference(src.getDevice())); + for (org.hl7.fhir.r5.model.Observation.ObservationReferenceRangeComponent t : src.getReferenceRange()) + tgt.addReferenceRange(convertObservationReferenceRangeComponent(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getHasMember()) + tgt.addRelated(convertObservationRelatedComponent(t, org.hl7.fhir.dstu3.model.Observation.ObservationRelationshipType.HASMEMBER)); + for (org.hl7.fhir.r5.model.Reference t : src.getDerivedFrom()) + tgt.addRelated(convertObservationRelatedComponent(t, org.hl7.fhir.dstu3.model.Observation.ObservationRelationshipType.DERIVEDFROM)); + for (org.hl7.fhir.r5.model.Observation.ObservationComponentComponent t : src.getComponent()) + tgt.addComponent(convertObservationComponentComponent(t)); + return tgt; + } + + private static org.hl7.fhir.r5.model.Observation.ObservationStatus convertObservationStatus(org.hl7.fhir.dstu3.model.Observation.ObservationStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case REGISTERED: return org.hl7.fhir.r5.model.Observation.ObservationStatus.REGISTERED; + case PRELIMINARY: return org.hl7.fhir.r5.model.Observation.ObservationStatus.PRELIMINARY; + case FINAL: return org.hl7.fhir.r5.model.Observation.ObservationStatus.FINAL; + case AMENDED: return org.hl7.fhir.r5.model.Observation.ObservationStatus.AMENDED; + case CORRECTED: return org.hl7.fhir.r5.model.Observation.ObservationStatus.CORRECTED; + case CANCELLED: return org.hl7.fhir.r5.model.Observation.ObservationStatus.CANCELLED; + case ENTEREDINERROR: return org.hl7.fhir.r5.model.Observation.ObservationStatus.ENTEREDINERROR; + case UNKNOWN: return org.hl7.fhir.r5.model.Observation.ObservationStatus.UNKNOWN; + default: return org.hl7.fhir.r5.model.Observation.ObservationStatus.NULL; + } +} + + private static org.hl7.fhir.dstu3.model.Observation.ObservationStatus convertObservationStatus(org.hl7.fhir.r5.model.Observation.ObservationStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case REGISTERED: return org.hl7.fhir.dstu3.model.Observation.ObservationStatus.REGISTERED; + case PRELIMINARY: return org.hl7.fhir.dstu3.model.Observation.ObservationStatus.PRELIMINARY; + case FINAL: return org.hl7.fhir.dstu3.model.Observation.ObservationStatus.FINAL; + case AMENDED: return org.hl7.fhir.dstu3.model.Observation.ObservationStatus.AMENDED; + case CORRECTED: return org.hl7.fhir.dstu3.model.Observation.ObservationStatus.CORRECTED; + case CANCELLED: return org.hl7.fhir.dstu3.model.Observation.ObservationStatus.CANCELLED; + case ENTEREDINERROR: return org.hl7.fhir.dstu3.model.Observation.ObservationStatus.ENTEREDINERROR; + case UNKNOWN: return org.hl7.fhir.dstu3.model.Observation.ObservationStatus.UNKNOWN; + default: return org.hl7.fhir.dstu3.model.Observation.ObservationStatus.NULL; + } +} + + public static org.hl7.fhir.r5.model.Observation.ObservationReferenceRangeComponent convertObservationReferenceRangeComponent(org.hl7.fhir.dstu3.model.Observation.ObservationReferenceRangeComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Observation.ObservationReferenceRangeComponent tgt = new org.hl7.fhir.r5.model.Observation.ObservationReferenceRangeComponent(); + copyElement(src, tgt); + if (src.hasLow()) + tgt.setLow(convertSimpleQuantity(src.getLow())); + if (src.hasHigh()) + tgt.setHigh(convertSimpleQuantity(src.getHigh())); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getAppliesTo()) + tgt.addAppliesTo(convertCodeableConcept(t)); + if (src.hasAge()) + tgt.setAge(convertRange(src.getAge())); + if (src.hasText()) + tgt.setText(src.getText()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Observation.ObservationReferenceRangeComponent convertObservationReferenceRangeComponent(org.hl7.fhir.r5.model.Observation.ObservationReferenceRangeComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Observation.ObservationReferenceRangeComponent tgt = new org.hl7.fhir.dstu3.model.Observation.ObservationReferenceRangeComponent(); + copyElement(src, tgt); + if (src.hasLow()) + tgt.setLow(convertSimpleQuantity(src.getLow())); + if (src.hasHigh()) + tgt.setHigh(convertSimpleQuantity(src.getHigh())); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getAppliesTo()) + tgt.addAppliesTo(convertCodeableConcept(t)); + if (src.hasAge()) + tgt.setAge(convertRange(src.getAge())); + if (src.hasText()) + tgt.setText(src.getText()); + return tgt; + } + + + public static org.hl7.fhir.dstu3.model.Observation.ObservationRelatedComponent convertObservationRelatedComponent(org.hl7.fhir.r5.model.Reference src, org.hl7.fhir.dstu3.model.Observation.ObservationRelationshipType type) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Observation.ObservationRelatedComponent tgt = new org.hl7.fhir.dstu3.model.Observation.ObservationRelatedComponent(); + copyElement(src, tgt); + tgt.setType(type); + tgt.setTarget(convertReference(src)); + return tgt; + } + + public static org.hl7.fhir.r5.model.Observation.ObservationComponentComponent convertObservationComponentComponent(org.hl7.fhir.dstu3.model.Observation.ObservationComponentComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Observation.ObservationComponentComponent tgt = new org.hl7.fhir.r5.model.Observation.ObservationComponentComponent(); + copyElement(src, tgt); + if (src.hasCode()) + tgt.setCode(convertCodeableConcept(src.getCode())); + if (src.hasValue()) + tgt.setValue(convertType(src.getValue())); + if (src.hasDataAbsentReason()) + tgt.setDataAbsentReason(convertCodeableConcept(src.getDataAbsentReason())); + if (src.hasInterpretation()) + tgt.addInterpretation(convertCodeableConcept(src.getInterpretation())); + for (org.hl7.fhir.dstu3.model.Observation.ObservationReferenceRangeComponent t : src.getReferenceRange()) + tgt.addReferenceRange(convertObservationReferenceRangeComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Observation.ObservationComponentComponent convertObservationComponentComponent(org.hl7.fhir.r5.model.Observation.ObservationComponentComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Observation.ObservationComponentComponent tgt = new org.hl7.fhir.dstu3.model.Observation.ObservationComponentComponent(); + copyElement(src, tgt); + if (src.hasCode()) + tgt.setCode(convertCodeableConcept(src.getCode())); + if (src.hasValue()) + tgt.setValue(convertType(src.getValue())); + if (src.hasDataAbsentReason()) + tgt.setDataAbsentReason(convertCodeableConcept(src.getDataAbsentReason())); + if (src.hasInterpretation()) + tgt.setInterpretation(convertCodeableConcept(src.getInterpretationFirstRep())); + for (org.hl7.fhir.r5.model.Observation.ObservationReferenceRangeComponent t : src.getReferenceRange()) + tgt.addReferenceRange(convertObservationReferenceRangeComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.OperationDefinition convertOperationDefinition(org.hl7.fhir.dstu3.model.OperationDefinition src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.OperationDefinition tgt = new org.hl7.fhir.r5.model.OperationDefinition(); + copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasStatus()) + tgt.setStatus(convertPublicationStatus(src.getStatus())); + if (src.hasKind()) + tgt.setKind(convertOperationKind(src.getKind())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) + tgt.addContact(convertContactDetail(t)); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu3.model.UsageContext t : src.getUseContext()) + tgt.addUseContext(convertUsageContext(t)); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction()) + tgt.addJurisdiction(convertCodeableConcept(t)); + if (src.hasPurpose()) + tgt.setPurpose(src.getPurpose()); + if (src.hasIdempotent()) + tgt.setAffectsState(!src.getIdempotent()); + if (src.hasCode()) + tgt.setCode(src.getCode()); + if (src.hasComment()) + tgt.setComment(src.getComment()); + if (src.hasBase()) + tgt.setBaseElement(convertReferenceToCanonical(src.getBase())); + for (org.hl7.fhir.dstu3.model.CodeType t : src.getResource()) + tgt.addResource(t.getValue()); + if (src.hasSystem()) + tgt.setSystem(src.getSystem()); + if (src.hasType()) + tgt.setType(src.getType()); + if (src.hasInstance()) + tgt.setInstance(src.getInstance()); + for (org.hl7.fhir.dstu3.model.OperationDefinition.OperationDefinitionParameterComponent t : src.getParameter()) + tgt.addParameter(convertOperationDefinitionParameterComponent(t)); + for (org.hl7.fhir.dstu3.model.OperationDefinition.OperationDefinitionOverloadComponent t : src.getOverload()) + tgt.addOverload(convertOperationDefinitionOverloadComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.OperationDefinition convertOperationDefinition(org.hl7.fhir.r5.model.OperationDefinition src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.OperationDefinition tgt = new org.hl7.fhir.dstu3.model.OperationDefinition(); + copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasStatus()) + tgt.setStatus(convertPublicationStatus(src.getStatus())); + if (src.hasKind()) + tgt.setKind(convertOperationKind(src.getKind())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.r5.model.ContactDetail t : src.getContact()) + tgt.addContact(convertContactDetail(t)); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.r5.model.UsageContext t : src.getUseContext()) + tgt.addUseContext(convertUsageContext(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getJurisdiction()) + tgt.addJurisdiction(convertCodeableConcept(t)); + if (src.hasPurpose()) + tgt.setPurpose(src.getPurpose()); + if (src.hasAffectsState()) + tgt.setIdempotent(!src.getAffectsState()); + if (src.hasCode()) + tgt.setCode(src.getCode()); + if (src.hasComment()) + tgt.setComment(src.getComment()); + if (src.hasBase()) + tgt.setBase(convertCanonicalToReference(src.getBaseElement())); + for (org.hl7.fhir.r5.model.CodeType t : src.getResource()) + tgt.addResource(t.getValue()); + if (src.hasSystem()) + tgt.setSystem(src.getSystem()); + if (src.hasType()) + tgt.setType(src.getType()); + if (src.hasInstance()) + tgt.setInstance(src.getInstance()); + for (org.hl7.fhir.r5.model.OperationDefinition.OperationDefinitionParameterComponent t : src.getParameter()) + tgt.addParameter(convertOperationDefinitionParameterComponent(t)); + for (org.hl7.fhir.r5.model.OperationDefinition.OperationDefinitionOverloadComponent t : src.getOverload()) + tgt.addOverload(convertOperationDefinitionOverloadComponent(t)); + return tgt; + } + + private static org.hl7.fhir.r5.model.OperationDefinition.OperationKind convertOperationKind(org.hl7.fhir.dstu3.model.OperationDefinition.OperationKind src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case OPERATION: return org.hl7.fhir.r5.model.OperationDefinition.OperationKind.OPERATION; + case QUERY: return org.hl7.fhir.r5.model.OperationDefinition.OperationKind.QUERY; + default: return org.hl7.fhir.r5.model.OperationDefinition.OperationKind.NULL; + } +} + + private static org.hl7.fhir.dstu3.model.OperationDefinition.OperationKind convertOperationKind(org.hl7.fhir.r5.model.OperationDefinition.OperationKind src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case OPERATION: return org.hl7.fhir.dstu3.model.OperationDefinition.OperationKind.OPERATION; + case QUERY: return org.hl7.fhir.dstu3.model.OperationDefinition.OperationKind.QUERY; + default: return org.hl7.fhir.dstu3.model.OperationDefinition.OperationKind.NULL; + } +} + + public static org.hl7.fhir.r5.model.OperationDefinition.OperationDefinitionParameterComponent convertOperationDefinitionParameterComponent(org.hl7.fhir.dstu3.model.OperationDefinition.OperationDefinitionParameterComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.OperationDefinition.OperationDefinitionParameterComponent tgt = new org.hl7.fhir.r5.model.OperationDefinition.OperationDefinitionParameterComponent(); + copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasUse()) + tgt.setUse(convertOperationParameterUse(src.getUse())); + if (src.hasMin()) + tgt.setMin(src.getMin()); + if (src.hasMax()) + tgt.setMax(src.getMax()); + if (src.hasDocumentation()) + tgt.setDocumentation(src.getDocumentation()); + if (src.hasType()) + tgt.setType(src.getType()); + if (src.hasSearchType()) + tgt.setSearchType(convertSearchParamType(src.getSearchType())); + if (src.hasProfile()) + tgt.addTargetProfile(src.getProfile().getReference()); + if (src.hasBinding()) + tgt.setBinding(convertOperationDefinitionParameterBindingComponent(src.getBinding())); + for (org.hl7.fhir.dstu3.model.OperationDefinition.OperationDefinitionParameterComponent t : src.getPart()) + tgt.addPart(convertOperationDefinitionParameterComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.OperationDefinition.OperationDefinitionParameterComponent convertOperationDefinitionParameterComponent(org.hl7.fhir.r5.model.OperationDefinition.OperationDefinitionParameterComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.OperationDefinition.OperationDefinitionParameterComponent tgt = new org.hl7.fhir.dstu3.model.OperationDefinition.OperationDefinitionParameterComponent(); + copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasUse()) + tgt.setUse(convertOperationParameterUse(src.getUse())); + if (src.hasMin()) + tgt.setMin(src.getMin()); + if (src.hasMax()) + tgt.setMax(src.getMax()); + if (src.hasDocumentation()) + tgt.setDocumentation(src.getDocumentation()); + if (src.hasType()) + tgt.setType(src.getType()); + if (src.hasSearchType()) + tgt.setSearchType(convertSearchParamType(src.getSearchType())); + for (org.hl7.fhir.r5.model.UriType t : src.getTargetProfile()) + tgt.setProfile(new org.hl7.fhir.dstu3.model.Reference(t.getValue())); + if (src.hasBinding()) + tgt.setBinding(convertOperationDefinitionParameterBindingComponent(src.getBinding())); + for (org.hl7.fhir.r5.model.OperationDefinition.OperationDefinitionParameterComponent t : src.getPart()) + tgt.addPart(convertOperationDefinitionParameterComponent(t)); + return tgt; + } + + private static org.hl7.fhir.r5.model.OperationDefinition.OperationParameterUse convertOperationParameterUse(org.hl7.fhir.dstu3.model.OperationDefinition.OperationParameterUse src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case IN: return org.hl7.fhir.r5.model.OperationDefinition.OperationParameterUse.IN; + case OUT: return org.hl7.fhir.r5.model.OperationDefinition.OperationParameterUse.OUT; + default: return org.hl7.fhir.r5.model.OperationDefinition.OperationParameterUse.NULL; + } +} + + private static org.hl7.fhir.dstu3.model.OperationDefinition.OperationParameterUse convertOperationParameterUse(org.hl7.fhir.r5.model.OperationDefinition.OperationParameterUse src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case IN: return org.hl7.fhir.dstu3.model.OperationDefinition.OperationParameterUse.IN; + case OUT: return org.hl7.fhir.dstu3.model.OperationDefinition.OperationParameterUse.OUT; + default: return org.hl7.fhir.dstu3.model.OperationDefinition.OperationParameterUse.NULL; + } +} + + public static org.hl7.fhir.r5.model.OperationDefinition.OperationDefinitionParameterBindingComponent convertOperationDefinitionParameterBindingComponent(org.hl7.fhir.dstu3.model.OperationDefinition.OperationDefinitionParameterBindingComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.OperationDefinition.OperationDefinitionParameterBindingComponent tgt = new org.hl7.fhir.r5.model.OperationDefinition.OperationDefinitionParameterBindingComponent(); + copyElement(src, tgt); + if (src.hasStrength()) + tgt.setStrength(convertBindingStrength(src.getStrength())); + if (src.hasValueSet()) { + Type t = convertType(src.getValueSet()); + if (t instanceof org.hl7.fhir.r5.model.Reference) + tgt.setValueSet(((org.hl7.fhir.r5.model.Reference) t).getReference()); + else + tgt.setValueSet(t.primitiveValue()); + tgt.setValueSet(VersionConvertorConstants.refToVS(tgt.getValueSet())); + } + return tgt; + } + + public static org.hl7.fhir.dstu3.model.OperationDefinition.OperationDefinitionParameterBindingComponent convertOperationDefinitionParameterBindingComponent(org.hl7.fhir.r5.model.OperationDefinition.OperationDefinitionParameterBindingComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.OperationDefinition.OperationDefinitionParameterBindingComponent tgt = new org.hl7.fhir.dstu3.model.OperationDefinition.OperationDefinitionParameterBindingComponent(); + copyElement(src, tgt); + if (src.hasStrength()) + tgt.setStrength(convertBindingStrength(src.getStrength())); + if (src.hasValueSet()) { + String vsr = VersionConvertorConstants.vsToRef(src.getValueSet()); + if (vsr != null) + tgt.setValueSet(new org.hl7.fhir.dstu3.model.UriType(vsr)); + else + tgt.setValueSet(new org.hl7.fhir.dstu3.model.Reference(src.getValueSet())); + } + return tgt; + } + + public static org.hl7.fhir.r5.model.OperationDefinition.OperationDefinitionOverloadComponent convertOperationDefinitionOverloadComponent(org.hl7.fhir.dstu3.model.OperationDefinition.OperationDefinitionOverloadComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.OperationDefinition.OperationDefinitionOverloadComponent tgt = new org.hl7.fhir.r5.model.OperationDefinition.OperationDefinitionOverloadComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.dstu3.model.StringType t : src.getParameterName()) + tgt.addParameterName(t.getValue()); + if (src.hasComment()) + tgt.setComment(src.getComment()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.OperationDefinition.OperationDefinitionOverloadComponent convertOperationDefinitionOverloadComponent(org.hl7.fhir.r5.model.OperationDefinition.OperationDefinitionOverloadComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.OperationDefinition.OperationDefinitionOverloadComponent tgt = new org.hl7.fhir.dstu3.model.OperationDefinition.OperationDefinitionOverloadComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.r5.model.StringType t : src.getParameterName()) + tgt.addParameterName(t.getValue()); + if (src.hasComment()) + tgt.setComment(src.getComment()); + return tgt; + } + + public static org.hl7.fhir.r5.model.OperationOutcome convertOperationOutcome(org.hl7.fhir.dstu3.model.OperationOutcome src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.OperationOutcome tgt = new org.hl7.fhir.r5.model.OperationOutcome(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.OperationOutcome.OperationOutcomeIssueComponent t : src.getIssue()) + tgt.addIssue(convertOperationOutcomeIssueComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.OperationOutcome convertOperationOutcome(org.hl7.fhir.r5.model.OperationOutcome src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.OperationOutcome tgt = new org.hl7.fhir.dstu3.model.OperationOutcome(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.OperationOutcome.OperationOutcomeIssueComponent t : src.getIssue()) + tgt.addIssue(convertOperationOutcomeIssueComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.OperationOutcome.OperationOutcomeIssueComponent convertOperationOutcomeIssueComponent(org.hl7.fhir.dstu3.model.OperationOutcome.OperationOutcomeIssueComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.OperationOutcome.OperationOutcomeIssueComponent tgt = new org.hl7.fhir.r5.model.OperationOutcome.OperationOutcomeIssueComponent(); + copyElement(src, tgt); + if (src.hasSeverity()) + tgt.setSeverity(convertIssueSeverity(src.getSeverity())); + if (src.hasCode()) + tgt.setCode(convertIssueType(src.getCode())); + if (src.hasDetails()) + tgt.setDetails(convertCodeableConcept(src.getDetails())); + if (src.hasDiagnostics()) + tgt.setDiagnostics(src.getDiagnostics()); + for (org.hl7.fhir.dstu3.model.StringType t : src.getLocation()) + tgt.addLocation(t.getValue()); + for (org.hl7.fhir.dstu3.model.StringType t : src.getExpression()) + tgt.addExpression(t.getValue()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.OperationOutcome.OperationOutcomeIssueComponent convertOperationOutcomeIssueComponent(org.hl7.fhir.r5.model.OperationOutcome.OperationOutcomeIssueComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.OperationOutcome.OperationOutcomeIssueComponent tgt = new org.hl7.fhir.dstu3.model.OperationOutcome.OperationOutcomeIssueComponent(); + copyElement(src, tgt); + if (src.hasSeverity()) + tgt.setSeverity(convertIssueSeverity(src.getSeverity())); + if (src.hasCode()) + tgt.setCode(convertIssueType(src.getCode())); + if (src.hasDetails()) + tgt.setDetails(convertCodeableConcept(src.getDetails())); + if (src.hasDiagnostics()) + tgt.setDiagnostics(src.getDiagnostics()); + for (org.hl7.fhir.r5.model.StringType t : src.getLocation()) + tgt.addLocation(t.getValue()); + for (org.hl7.fhir.r5.model.StringType t : src.getExpression()) + tgt.addExpression(t.getValue()); + return tgt; + } + + private static org.hl7.fhir.r5.model.OperationOutcome.IssueSeverity convertIssueSeverity(org.hl7.fhir.dstu3.model.OperationOutcome.IssueSeverity src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case FATAL: return org.hl7.fhir.r5.model.OperationOutcome.IssueSeverity.FATAL; + case ERROR: return org.hl7.fhir.r5.model.OperationOutcome.IssueSeverity.ERROR; + case WARNING: return org.hl7.fhir.r5.model.OperationOutcome.IssueSeverity.WARNING; + case INFORMATION: return org.hl7.fhir.r5.model.OperationOutcome.IssueSeverity.INFORMATION; + default: return org.hl7.fhir.r5.model.OperationOutcome.IssueSeverity.NULL; + } +} + + private static org.hl7.fhir.dstu3.model.OperationOutcome.IssueSeverity convertIssueSeverity(org.hl7.fhir.r5.model.OperationOutcome.IssueSeverity src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case FATAL: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueSeverity.FATAL; + case ERROR: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueSeverity.ERROR; + case WARNING: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueSeverity.WARNING; + case INFORMATION: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueSeverity.INFORMATION; + default: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueSeverity.NULL; + } +} + + private static org.hl7.fhir.r5.model.OperationOutcome.IssueType convertIssueType(org.hl7.fhir.dstu3.model.OperationOutcome.IssueType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case INVALID: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.INVALID; + case STRUCTURE: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.STRUCTURE; + case REQUIRED: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.REQUIRED; + case VALUE: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.VALUE; + case INVARIANT: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.INVARIANT; + case SECURITY: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.SECURITY; + case LOGIN: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.LOGIN; + case UNKNOWN: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.UNKNOWN; + case EXPIRED: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.EXPIRED; + case FORBIDDEN: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.FORBIDDEN; + case SUPPRESSED: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.SUPPRESSED; + case PROCESSING: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.PROCESSING; + case NOTSUPPORTED: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.NOTSUPPORTED; + case DUPLICATE: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.DUPLICATE; + case NOTFOUND: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.NOTFOUND; + case TOOLONG: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.TOOLONG; + case CODEINVALID: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.CODEINVALID; + case EXTENSION: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.EXTENSION; + case TOOCOSTLY: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.TOOCOSTLY; + case BUSINESSRULE: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.BUSINESSRULE; + case CONFLICT: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.CONFLICT; + case INCOMPLETE: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.INCOMPLETE; + case TRANSIENT: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.TRANSIENT; + case LOCKERROR: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.LOCKERROR; + case NOSTORE: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.NOSTORE; + case EXCEPTION: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.EXCEPTION; + case TIMEOUT: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.TIMEOUT; + case THROTTLED: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.THROTTLED; + case INFORMATIONAL: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.INFORMATIONAL; + default: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.NULL; + } +} + + private static org.hl7.fhir.dstu3.model.OperationOutcome.IssueType convertIssueType(org.hl7.fhir.r5.model.OperationOutcome.IssueType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case INVALID: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.INVALID; + case STRUCTURE: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.STRUCTURE; + case REQUIRED: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.REQUIRED; + case VALUE: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.VALUE; + case INVARIANT: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.INVARIANT; + case SECURITY: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.SECURITY; + case LOGIN: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.LOGIN; + case UNKNOWN: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.UNKNOWN; + case EXPIRED: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.EXPIRED; + case FORBIDDEN: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.FORBIDDEN; + case SUPPRESSED: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.SUPPRESSED; + case PROCESSING: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.PROCESSING; + case NOTSUPPORTED: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.NOTSUPPORTED; + case DUPLICATE: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.DUPLICATE; + case NOTFOUND: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.NOTFOUND; + case TOOLONG: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.TOOLONG; + case CODEINVALID: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.CODEINVALID; + case EXTENSION: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.EXTENSION; + case TOOCOSTLY: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.TOOCOSTLY; + case BUSINESSRULE: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.BUSINESSRULE; + case CONFLICT: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.CONFLICT; + case INCOMPLETE: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.INCOMPLETE; + case TRANSIENT: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.TRANSIENT; + case LOCKERROR: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.LOCKERROR; + case NOSTORE: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.NOSTORE; + case EXCEPTION: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.EXCEPTION; + case TIMEOUT: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.TIMEOUT; + case THROTTLED: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.THROTTLED; + case INFORMATIONAL: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.INFORMATIONAL; + default: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.NULL; + } +} + + public static org.hl7.fhir.r5.model.Organization convertOrganization(org.hl7.fhir.dstu3.model.Organization src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Organization tgt = new org.hl7.fhir.r5.model.Organization(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasActive()) + tgt.setActive(src.getActive()); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getType()) + tgt.addType(convertCodeableConcept(t)); + if (src.hasName()) + tgt.setName(src.getName()); + for (org.hl7.fhir.dstu3.model.StringType t : src.getAlias()) + tgt.addAlias(t.getValue()); + for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom()) + tgt.addTelecom(convertContactPoint(t)); + for (org.hl7.fhir.dstu3.model.Address t : src.getAddress()) + tgt.addAddress(convertAddress(t)); + if (src.hasPartOf()) + tgt.setPartOf(convertReference(src.getPartOf())); + for (org.hl7.fhir.dstu3.model.Organization.OrganizationContactComponent t : src.getContact()) + tgt.addContact(convertOrganizationContactComponent(t)); + for (org.hl7.fhir.dstu3.model.Reference t : src.getEndpoint()) + tgt.addEndpoint(convertReference(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Organization convertOrganization(org.hl7.fhir.r5.model.Organization src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Organization tgt = new org.hl7.fhir.dstu3.model.Organization(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasActive()) + tgt.setActive(src.getActive()); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getType()) + tgt.addType(convertCodeableConcept(t)); + if (src.hasName()) + tgt.setName(src.getName()); + for (org.hl7.fhir.r5.model.StringType t : src.getAlias()) + tgt.addAlias(t.getValue()); + for (org.hl7.fhir.r5.model.ContactPoint t : src.getTelecom()) + tgt.addTelecom(convertContactPoint(t)); + for (org.hl7.fhir.r5.model.Address t : src.getAddress()) + tgt.addAddress(convertAddress(t)); + if (src.hasPartOf()) + tgt.setPartOf(convertReference(src.getPartOf())); + for (org.hl7.fhir.r5.model.Organization.OrganizationContactComponent t : src.getContact()) + tgt.addContact(convertOrganizationContactComponent(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getEndpoint()) + tgt.addEndpoint(convertReference(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.Organization.OrganizationContactComponent convertOrganizationContactComponent(org.hl7.fhir.dstu3.model.Organization.OrganizationContactComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Organization.OrganizationContactComponent tgt = new org.hl7.fhir.r5.model.Organization.OrganizationContactComponent(); + copyElement(src, tgt); + if (src.hasPurpose()) + tgt.setPurpose(convertCodeableConcept(src.getPurpose())); + if (src.hasName()) + tgt.setName(convertHumanName(src.getName())); + for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom()) + tgt.addTelecom(convertContactPoint(t)); + if (src.hasAddress()) + tgt.setAddress(convertAddress(src.getAddress())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Organization.OrganizationContactComponent convertOrganizationContactComponent(org.hl7.fhir.r5.model.Organization.OrganizationContactComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Organization.OrganizationContactComponent tgt = new org.hl7.fhir.dstu3.model.Organization.OrganizationContactComponent(); + copyElement(src, tgt); + if (src.hasPurpose()) + tgt.setPurpose(convertCodeableConcept(src.getPurpose())); + if (src.hasName()) + tgt.setName(convertHumanName(src.getName())); + for (org.hl7.fhir.r5.model.ContactPoint t : src.getTelecom()) + tgt.addTelecom(convertContactPoint(t)); + if (src.hasAddress()) + tgt.setAddress(convertAddress(src.getAddress())); + return tgt; + } + + public static org.hl7.fhir.r5.model.Patient convertPatient(org.hl7.fhir.dstu3.model.Patient src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Patient tgt = new org.hl7.fhir.r5.model.Patient(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasActive()) + tgt.setActive(src.getActive()); + for (org.hl7.fhir.dstu3.model.HumanName t : src.getName()) + tgt.addName(convertHumanName(t)); + for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom()) + tgt.addTelecom(convertContactPoint(t)); + if (src.hasGender()) + tgt.setGender(convertAdministrativeGender(src.getGender())); + if (src.hasBirthDate()) + tgt.setBirthDate(src.getBirthDate()); + if (src.hasDeceased()) + tgt.setDeceased(convertType(src.getDeceased())); + for (org.hl7.fhir.dstu3.model.Address t : src.getAddress()) + tgt.addAddress(convertAddress(t)); + if (src.hasMaritalStatus()) + tgt.setMaritalStatus(convertCodeableConcept(src.getMaritalStatus())); + if (src.hasMultipleBirth()) + tgt.setMultipleBirth(convertType(src.getMultipleBirth())); + for (org.hl7.fhir.dstu3.model.Attachment t : src.getPhoto()) + tgt.addPhoto(convertAttachment(t)); + for (org.hl7.fhir.dstu3.model.Patient.ContactComponent t : src.getContact()) + tgt.addContact(convertContactComponent(t)); + if (src.hasAnimal()) + tgt.addExtension(convertAnimalComponent(src.getAnimal())); + for (org.hl7.fhir.dstu3.model.Patient.PatientCommunicationComponent t : src.getCommunication()) + tgt.addCommunication(convertPatientCommunicationComponent(t)); + for (org.hl7.fhir.dstu3.model.Reference t : src.getGeneralPractitioner()) + tgt.addGeneralPractitioner(convertReference(t)); + if (src.hasManagingOrganization()) + tgt.setManagingOrganization(convertReference(src.getManagingOrganization())); + for (org.hl7.fhir.dstu3.model.Patient.PatientLinkComponent t : src.getLink()) + tgt.addLink(convertPatientLinkComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Patient convertPatient(org.hl7.fhir.r5.model.Patient src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Patient tgt = new org.hl7.fhir.dstu3.model.Patient(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasActive()) + tgt.setActive(src.getActive()); + for (org.hl7.fhir.r5.model.HumanName t : src.getName()) + tgt.addName(convertHumanName(t)); + for (org.hl7.fhir.r5.model.ContactPoint t : src.getTelecom()) + tgt.addTelecom(convertContactPoint(t)); + if (src.hasGender()) + tgt.setGender(convertAdministrativeGender(src.getGender())); + if (src.hasBirthDate()) + tgt.setBirthDate(src.getBirthDate()); + if (src.hasDeceased()) + tgt.setDeceased(convertType(src.getDeceased())); + for (org.hl7.fhir.r5.model.Address t : src.getAddress()) + tgt.addAddress(convertAddress(t)); + if (src.hasMaritalStatus()) + tgt.setMaritalStatus(convertCodeableConcept(src.getMaritalStatus())); + if (src.hasMultipleBirth()) + tgt.setMultipleBirth(convertType(src.getMultipleBirth())); + for (org.hl7.fhir.r5.model.Attachment t : src.getPhoto()) + tgt.addPhoto(convertAttachment(t)); + for (org.hl7.fhir.r5.model.Patient.ContactComponent t : src.getContact()) + tgt.addContact(convertContactComponent(t)); + if (src.hasExtension("http://hl7.org/fhir/StructureDefinition/patient-animal")) + tgt.setAnimal(convertAnimalComponent(src.getExtensionByUrl("http://hl7.org/fhir/StructureDefinition/patient-animal"))); + for (org.hl7.fhir.r5.model.Patient.PatientCommunicationComponent t : src.getCommunication()) + tgt.addCommunication(convertPatientCommunicationComponent(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getGeneralPractitioner()) + tgt.addGeneralPractitioner(convertReference(t)); + if (src.hasManagingOrganization()) + tgt.setManagingOrganization(convertReference(src.getManagingOrganization())); + for (org.hl7.fhir.r5.model.Patient.PatientLinkComponent t : src.getLink()) + tgt.addLink(convertPatientLinkComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.Patient.ContactComponent convertContactComponent(org.hl7.fhir.dstu3.model.Patient.ContactComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Patient.ContactComponent tgt = new org.hl7.fhir.r5.model.Patient.ContactComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getRelationship()) + tgt.addRelationship(convertCodeableConcept(t)); + if (src.hasName()) + tgt.setName(convertHumanName(src.getName())); + for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom()) + tgt.addTelecom(convertContactPoint(t)); + if (src.hasAddress()) + tgt.setAddress(convertAddress(src.getAddress())); + if (src.hasGender()) + tgt.setGender(convertAdministrativeGender(src.getGender())); + if (src.hasOrganization()) + tgt.setOrganization(convertReference(src.getOrganization())); + if (src.hasPeriod()) + tgt.setPeriod(convertPeriod(src.getPeriod())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Patient.ContactComponent convertContactComponent(org.hl7.fhir.r5.model.Patient.ContactComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Patient.ContactComponent tgt = new org.hl7.fhir.dstu3.model.Patient.ContactComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getRelationship()) + tgt.addRelationship(convertCodeableConcept(t)); + if (src.hasName()) + tgt.setName(convertHumanName(src.getName())); + for (org.hl7.fhir.r5.model.ContactPoint t : src.getTelecom()) + tgt.addTelecom(convertContactPoint(t)); + if (src.hasAddress()) + tgt.setAddress(convertAddress(src.getAddress())); + if (src.hasGender()) + tgt.setGender(convertAdministrativeGender(src.getGender())); + if (src.hasOrganization()) + tgt.setOrganization(convertReference(src.getOrganization())); + if (src.hasPeriod()) + tgt.setPeriod(convertPeriod(src.getPeriod())); + return tgt; + } + + public static org.hl7.fhir.r5.model.Extension convertAnimalComponent(org.hl7.fhir.dstu3.model.Patient.AnimalComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Extension tgt = new org.hl7.fhir.r5.model.Extension(); + tgt.setUrl("http://hl7.org/fhir/StructureDefinition/patient-animal"); + copyElement(src, tgt); + if (src.hasSpecies()) + tgt.addExtension("species", convertCodeableConcept(src.getSpecies())); + if (src.hasBreed()) + tgt.addExtension("breed", convertCodeableConcept(src.getBreed())); + if (src.hasGenderStatus()) + tgt.addExtension("genderStatus", convertCodeableConcept(src.getGenderStatus())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Patient.AnimalComponent convertAnimalComponent(org.hl7.fhir.r5.model.Extension src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Patient.AnimalComponent tgt = new org.hl7.fhir.dstu3.model.Patient.AnimalComponent(); + copyElement(src, tgt); + if (src.hasExtension("species")) + tgt.setSpecies(convertCodeableConcept((org.hl7.fhir.r5.model.CodeableConcept) src.getExtensionByUrl("species").getValue())); + if (src.hasExtension("breed")) + tgt.setBreed(convertCodeableConcept((org.hl7.fhir.r5.model.CodeableConcept) src.getExtensionByUrl("breed").getValue())); + if (src.hasExtension("genderStatus")) + tgt.setGenderStatus(convertCodeableConcept((org.hl7.fhir.r5.model.CodeableConcept) src.getExtensionByUrl("genderStatus").getValue())); + return tgt; + } + + public static org.hl7.fhir.r5.model.Patient.PatientCommunicationComponent convertPatientCommunicationComponent(org.hl7.fhir.dstu3.model.Patient.PatientCommunicationComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Patient.PatientCommunicationComponent tgt = new org.hl7.fhir.r5.model.Patient.PatientCommunicationComponent(); + copyElement(src, tgt); + if (src.hasLanguage()) + tgt.setLanguage(convertCodeableConcept(src.getLanguage())); + if (src.hasPreferred()) + tgt.setPreferred(src.getPreferred()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Patient.PatientCommunicationComponent convertPatientCommunicationComponent(org.hl7.fhir.r5.model.Patient.PatientCommunicationComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Patient.PatientCommunicationComponent tgt = new org.hl7.fhir.dstu3.model.Patient.PatientCommunicationComponent(); + copyElement(src, tgt); + if (src.hasLanguage()) + tgt.setLanguage(convertCodeableConcept(src.getLanguage())); + if (src.hasPreferred()) + tgt.setPreferred(src.getPreferred()); + return tgt; + } + + public static org.hl7.fhir.r5.model.Patient.PatientLinkComponent convertPatientLinkComponent(org.hl7.fhir.dstu3.model.Patient.PatientLinkComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Patient.PatientLinkComponent tgt = new org.hl7.fhir.r5.model.Patient.PatientLinkComponent(); + copyElement(src, tgt); + if (src.hasOther()) + tgt.setOther(convertReference(src.getOther())); + if (src.hasType()) + tgt.setType(convertLinkType(src.getType())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Patient.PatientLinkComponent convertPatientLinkComponent(org.hl7.fhir.r5.model.Patient.PatientLinkComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Patient.PatientLinkComponent tgt = new org.hl7.fhir.dstu3.model.Patient.PatientLinkComponent(); + copyElement(src, tgt); + if (src.hasOther()) + tgt.setOther(convertReference(src.getOther())); + if (src.hasType()) + tgt.setType(convertLinkType(src.getType())); + return tgt; + } + + private static org.hl7.fhir.r5.model.Patient.LinkType convertLinkType(org.hl7.fhir.dstu3.model.Patient.LinkType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case REPLACEDBY: return org.hl7.fhir.r5.model.Patient.LinkType.REPLACEDBY; + case REPLACES: return org.hl7.fhir.r5.model.Patient.LinkType.REPLACES; + case REFER: return org.hl7.fhir.r5.model.Patient.LinkType.REFER; + case SEEALSO: return org.hl7.fhir.r5.model.Patient.LinkType.SEEALSO; + default: return org.hl7.fhir.r5.model.Patient.LinkType.NULL; + } +} + + private static org.hl7.fhir.dstu3.model.Patient.LinkType convertLinkType(org.hl7.fhir.r5.model.Patient.LinkType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case REPLACEDBY: return org.hl7.fhir.dstu3.model.Patient.LinkType.REPLACEDBY; + case REPLACES: return org.hl7.fhir.dstu3.model.Patient.LinkType.REPLACES; + case REFER: return org.hl7.fhir.dstu3.model.Patient.LinkType.REFER; + case SEEALSO: return org.hl7.fhir.dstu3.model.Patient.LinkType.SEEALSO; + default: return org.hl7.fhir.dstu3.model.Patient.LinkType.NULL; + } +} + + public static org.hl7.fhir.r5.model.PaymentNotice convertPaymentNotice(org.hl7.fhir.dstu3.model.PaymentNotice src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.PaymentNotice tgt = new org.hl7.fhir.r5.model.PaymentNotice(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasStatus()) + tgt.setStatus(convertPaymentNoticeStatus(src.getStatus())); + if (src.hasRequest()) + tgt.setRequest(convertReference(src.getRequest())); + if (src.hasResponse()) + tgt.setResponse(convertReference(src.getResponse())); + if (src.hasStatusDate()) + tgt.setPaymentDate(src.getStatusDate()); + if (src.hasCreated()) + tgt.setCreated(src.getCreated()); + if (src.hasTarget()) + tgt.setRecipient(convertReference(src.getTarget())); + if (src.hasProvider()) + tgt.setProvider(convertReference(src.getProvider())); +// if (src.hasOrganization()) +// tgt.setOrganization(convertReference(src.getOrganization())); + if (src.hasPaymentStatus()) + tgt.setPaymentStatus(convertCodeableConcept(src.getPaymentStatus())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.PaymentNotice convertPaymentNotice(org.hl7.fhir.r5.model.PaymentNotice src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.PaymentNotice tgt = new org.hl7.fhir.dstu3.model.PaymentNotice(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasStatus()) + tgt.setStatus(convertPaymentNoticeStatus(src.getStatus())); + if (src.hasRequest()) + tgt.setRequest(convertReference(src.getRequest())); + if (src.hasResponse()) + tgt.setResponse(convertReference(src.getResponse())); + if (src.hasPaymentDate()) + tgt.setStatusDate(src.getPaymentDate()); + if (src.hasCreated()) + tgt.setCreated(src.getCreated()); + if (src.hasRecipient()) + tgt.setTarget(convertReference(src.getRecipient())); + if (src.hasProvider()) + tgt.setProvider(convertReference(src.getProvider())); +// if (src.hasOrganization()) +// tgt.setOrganization(convertReference(src.getOrganization())); + if (src.hasPaymentStatus()) + tgt.setPaymentStatus(convertCodeableConcept(src.getPaymentStatus())); + return tgt; + } + + private static org.hl7.fhir.r5.model.PaymentNotice.PaymentNoticeStatus convertPaymentNoticeStatus(org.hl7.fhir.dstu3.model.PaymentNotice.PaymentNoticeStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case ACTIVE: return org.hl7.fhir.r5.model.PaymentNotice.PaymentNoticeStatus.ACTIVE; + case CANCELLED: return org.hl7.fhir.r5.model.PaymentNotice.PaymentNoticeStatus.CANCELLED; + case DRAFT: return org.hl7.fhir.r5.model.PaymentNotice.PaymentNoticeStatus.DRAFT; + case ENTEREDINERROR: return org.hl7.fhir.r5.model.PaymentNotice.PaymentNoticeStatus.ENTEREDINERROR; + default: return org.hl7.fhir.r5.model.PaymentNotice.PaymentNoticeStatus.NULL; + } +} + + private static org.hl7.fhir.dstu3.model.PaymentNotice.PaymentNoticeStatus convertPaymentNoticeStatus(org.hl7.fhir.r5.model.PaymentNotice.PaymentNoticeStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case ACTIVE: return org.hl7.fhir.dstu3.model.PaymentNotice.PaymentNoticeStatus.ACTIVE; + case CANCELLED: return org.hl7.fhir.dstu3.model.PaymentNotice.PaymentNoticeStatus.CANCELLED; + case DRAFT: return org.hl7.fhir.dstu3.model.PaymentNotice.PaymentNoticeStatus.DRAFT; + case ENTEREDINERROR: return org.hl7.fhir.dstu3.model.PaymentNotice.PaymentNoticeStatus.ENTEREDINERROR; + default: return org.hl7.fhir.dstu3.model.PaymentNotice.PaymentNoticeStatus.NULL; + } +} + + + public static org.hl7.fhir.r5.model.Person convertPerson(org.hl7.fhir.dstu3.model.Person src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Person tgt = new org.hl7.fhir.r5.model.Person(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + for (org.hl7.fhir.dstu3.model.HumanName t : src.getName()) + tgt.addName(convertHumanName(t)); + for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom()) + tgt.addTelecom(convertContactPoint(t)); + if (src.hasGender()) + tgt.setGender(convertAdministrativeGender(src.getGender())); + if (src.hasBirthDate()) + tgt.setBirthDate(src.getBirthDate()); + for (org.hl7.fhir.dstu3.model.Address t : src.getAddress()) + tgt.addAddress(convertAddress(t)); + if (src.hasPhoto()) + tgt.setPhoto(convertAttachment(src.getPhoto())); + if (src.hasManagingOrganization()) + tgt.setManagingOrganization(convertReference(src.getManagingOrganization())); + if (src.hasActive()) + tgt.setActive(src.getActive()); + for (org.hl7.fhir.dstu3.model.Person.PersonLinkComponent t : src.getLink()) + tgt.addLink(convertPersonLinkComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Person convertPerson(org.hl7.fhir.r5.model.Person src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Person tgt = new org.hl7.fhir.dstu3.model.Person(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + for (org.hl7.fhir.r5.model.HumanName t : src.getName()) + tgt.addName(convertHumanName(t)); + for (org.hl7.fhir.r5.model.ContactPoint t : src.getTelecom()) + tgt.addTelecom(convertContactPoint(t)); + if (src.hasGender()) + tgt.setGender(convertAdministrativeGender(src.getGender())); + if (src.hasBirthDate()) + tgt.setBirthDate(src.getBirthDate()); + for (org.hl7.fhir.r5.model.Address t : src.getAddress()) + tgt.addAddress(convertAddress(t)); + if (src.hasPhoto()) + tgt.setPhoto(convertAttachment(src.getPhoto())); + if (src.hasManagingOrganization()) + tgt.setManagingOrganization(convertReference(src.getManagingOrganization())); + if (src.hasActive()) + tgt.setActive(src.getActive()); + for (org.hl7.fhir.r5.model.Person.PersonLinkComponent t : src.getLink()) + tgt.addLink(convertPersonLinkComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.Person.PersonLinkComponent convertPersonLinkComponent(org.hl7.fhir.dstu3.model.Person.PersonLinkComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Person.PersonLinkComponent tgt = new org.hl7.fhir.r5.model.Person.PersonLinkComponent(); + copyElement(src, tgt); + if (src.hasTarget()) + tgt.setTarget(convertReference(src.getTarget())); + if (src.hasAssurance()) + tgt.setAssurance(convertIdentityAssuranceLevel(src.getAssurance())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Person.PersonLinkComponent convertPersonLinkComponent(org.hl7.fhir.r5.model.Person.PersonLinkComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Person.PersonLinkComponent tgt = new org.hl7.fhir.dstu3.model.Person.PersonLinkComponent(); + copyElement(src, tgt); + if (src.hasTarget()) + tgt.setTarget(convertReference(src.getTarget())); + if (src.hasAssurance()) + tgt.setAssurance(convertIdentityAssuranceLevel(src.getAssurance())); + return tgt; + } + + private static org.hl7.fhir.r5.model.Person.IdentityAssuranceLevel convertIdentityAssuranceLevel(org.hl7.fhir.dstu3.model.Person.IdentityAssuranceLevel src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case LEVEL1: return org.hl7.fhir.r5.model.Person.IdentityAssuranceLevel.LEVEL1; + case LEVEL2: return org.hl7.fhir.r5.model.Person.IdentityAssuranceLevel.LEVEL2; + case LEVEL3: return org.hl7.fhir.r5.model.Person.IdentityAssuranceLevel.LEVEL3; + case LEVEL4: return org.hl7.fhir.r5.model.Person.IdentityAssuranceLevel.LEVEL4; + default: return org.hl7.fhir.r5.model.Person.IdentityAssuranceLevel.NULL; + } +} + + private static org.hl7.fhir.dstu3.model.Person.IdentityAssuranceLevel convertIdentityAssuranceLevel(org.hl7.fhir.r5.model.Person.IdentityAssuranceLevel src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case LEVEL1: return org.hl7.fhir.dstu3.model.Person.IdentityAssuranceLevel.LEVEL1; + case LEVEL2: return org.hl7.fhir.dstu3.model.Person.IdentityAssuranceLevel.LEVEL2; + case LEVEL3: return org.hl7.fhir.dstu3.model.Person.IdentityAssuranceLevel.LEVEL3; + case LEVEL4: return org.hl7.fhir.dstu3.model.Person.IdentityAssuranceLevel.LEVEL4; + default: return org.hl7.fhir.dstu3.model.Person.IdentityAssuranceLevel.NULL; + } +} + + public static org.hl7.fhir.r5.model.Practitioner convertPractitioner(org.hl7.fhir.dstu3.model.Practitioner src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Practitioner tgt = new org.hl7.fhir.r5.model.Practitioner(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasActive()) + tgt.setActive(src.getActive()); + for (org.hl7.fhir.dstu3.model.HumanName t : src.getName()) + tgt.addName(convertHumanName(t)); + for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom()) + tgt.addTelecom(convertContactPoint(t)); + for (org.hl7.fhir.dstu3.model.Address t : src.getAddress()) + tgt.addAddress(convertAddress(t)); + if (src.hasGender()) + tgt.setGender(convertAdministrativeGender(src.getGender())); + if (src.hasBirthDate()) + tgt.setBirthDate(src.getBirthDate()); + for (org.hl7.fhir.dstu3.model.Attachment t : src.getPhoto()) + tgt.addPhoto(convertAttachment(t)); + for (org.hl7.fhir.dstu3.model.Practitioner.PractitionerQualificationComponent t : src.getQualification()) + tgt.addQualification(convertPractitionerQualificationComponent(t)); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getCommunication()) + tgt.addCommunication(convertCodeableConcept(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Practitioner convertPractitioner(org.hl7.fhir.r5.model.Practitioner src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Practitioner tgt = new org.hl7.fhir.dstu3.model.Practitioner(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasActive()) + tgt.setActive(src.getActive()); + for (org.hl7.fhir.r5.model.HumanName t : src.getName()) + tgt.addName(convertHumanName(t)); + for (org.hl7.fhir.r5.model.ContactPoint t : src.getTelecom()) + tgt.addTelecom(convertContactPoint(t)); + for (org.hl7.fhir.r5.model.Address t : src.getAddress()) + tgt.addAddress(convertAddress(t)); + if (src.hasGender()) + tgt.setGender(convertAdministrativeGender(src.getGender())); + if (src.hasBirthDate()) + tgt.setBirthDate(src.getBirthDate()); + for (org.hl7.fhir.r5.model.Attachment t : src.getPhoto()) + tgt.addPhoto(convertAttachment(t)); + for (org.hl7.fhir.r5.model.Practitioner.PractitionerQualificationComponent t : src.getQualification()) + tgt.addQualification(convertPractitionerQualificationComponent(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getCommunication()) + tgt.addCommunication(convertCodeableConcept(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.Practitioner.PractitionerQualificationComponent convertPractitionerQualificationComponent(org.hl7.fhir.dstu3.model.Practitioner.PractitionerQualificationComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Practitioner.PractitionerQualificationComponent tgt = new org.hl7.fhir.r5.model.Practitioner.PractitionerQualificationComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasCode()) + tgt.setCode(convertCodeableConcept(src.getCode())); + if (src.hasPeriod()) + tgt.setPeriod(convertPeriod(src.getPeriod())); + if (src.hasIssuer()) + tgt.setIssuer(convertReference(src.getIssuer())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Practitioner.PractitionerQualificationComponent convertPractitionerQualificationComponent(org.hl7.fhir.r5.model.Practitioner.PractitionerQualificationComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Practitioner.PractitionerQualificationComponent tgt = new org.hl7.fhir.dstu3.model.Practitioner.PractitionerQualificationComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasCode()) + tgt.setCode(convertCodeableConcept(src.getCode())); + if (src.hasPeriod()) + tgt.setPeriod(convertPeriod(src.getPeriod())); + if (src.hasIssuer()) + tgt.setIssuer(convertReference(src.getIssuer())); + return tgt; + } + + public static org.hl7.fhir.r5.model.PractitionerRole convertPractitionerRole(org.hl7.fhir.dstu3.model.PractitionerRole src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.PractitionerRole tgt = new org.hl7.fhir.r5.model.PractitionerRole(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasActive()) + tgt.setActive(src.getActive()); + if (src.hasPeriod()) + tgt.setPeriod(convertPeriod(src.getPeriod())); + if (src.hasPractitioner()) + tgt.setPractitioner(convertReference(src.getPractitioner())); + if (src.hasOrganization()) + tgt.setOrganization(convertReference(src.getOrganization())); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getCode()) + tgt.addCode(convertCodeableConcept(t)); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getSpecialty()) + tgt.addSpecialty(convertCodeableConcept(t)); + for (org.hl7.fhir.dstu3.model.Reference t : src.getLocation()) + tgt.addLocation(convertReference(t)); + for (org.hl7.fhir.dstu3.model.Reference t : src.getHealthcareService()) + tgt.addHealthcareService(convertReference(t)); + for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom()) + tgt.addTelecom(convertContactPoint(t)); + for (org.hl7.fhir.dstu3.model.PractitionerRole.PractitionerRoleAvailableTimeComponent t : src.getAvailableTime()) + tgt.addAvailableTime(convertPractitionerRoleAvailableTimeComponent(t)); + for (org.hl7.fhir.dstu3.model.PractitionerRole.PractitionerRoleNotAvailableComponent t : src.getNotAvailable()) + tgt.addNotAvailable(convertPractitionerRoleNotAvailableComponent(t)); + if (src.hasAvailabilityExceptions()) + tgt.setAvailabilityExceptions(src.getAvailabilityExceptions()); + for (org.hl7.fhir.dstu3.model.Reference t : src.getEndpoint()) + tgt.addEndpoint(convertReference(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.PractitionerRole convertPractitionerRole(org.hl7.fhir.r5.model.PractitionerRole src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.PractitionerRole tgt = new org.hl7.fhir.dstu3.model.PractitionerRole(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasActive()) + tgt.setActive(src.getActive()); + if (src.hasPeriod()) + tgt.setPeriod(convertPeriod(src.getPeriod())); + if (src.hasPractitioner()) + tgt.setPractitioner(convertReference(src.getPractitioner())); + if (src.hasOrganization()) + tgt.setOrganization(convertReference(src.getOrganization())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getCode()) + tgt.addCode(convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getSpecialty()) + tgt.addSpecialty(convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getLocation()) + tgt.addLocation(convertReference(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getHealthcareService()) + tgt.addHealthcareService(convertReference(t)); + for (org.hl7.fhir.r5.model.ContactPoint t : src.getTelecom()) + tgt.addTelecom(convertContactPoint(t)); + for (org.hl7.fhir.r5.model.PractitionerRole.PractitionerRoleAvailableTimeComponent t : src.getAvailableTime()) + tgt.addAvailableTime(convertPractitionerRoleAvailableTimeComponent(t)); + for (org.hl7.fhir.r5.model.PractitionerRole.PractitionerRoleNotAvailableComponent t : src.getNotAvailable()) + tgt.addNotAvailable(convertPractitionerRoleNotAvailableComponent(t)); + if (src.hasAvailabilityExceptions()) + tgt.setAvailabilityExceptions(src.getAvailabilityExceptions()); + for (org.hl7.fhir.r5.model.Reference t : src.getEndpoint()) + tgt.addEndpoint(convertReference(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.PractitionerRole.PractitionerRoleAvailableTimeComponent convertPractitionerRoleAvailableTimeComponent(org.hl7.fhir.dstu3.model.PractitionerRole.PractitionerRoleAvailableTimeComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.PractitionerRole.PractitionerRoleAvailableTimeComponent tgt = new org.hl7.fhir.r5.model.PractitionerRole.PractitionerRoleAvailableTimeComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.dstu3.model.Enumeration t : src.getDaysOfWeek()) + tgt.addDaysOfWeek(convertDaysOfWeek(t.getValue())); + if (src.hasAllDay()) + tgt.setAllDay(src.getAllDay()); + if (src.hasAvailableStartTime()) + tgt.setAvailableStartTime(src.getAvailableStartTime()); + if (src.hasAvailableEndTime()) + tgt.setAvailableEndTime(src.getAvailableEndTime()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.PractitionerRole.PractitionerRoleAvailableTimeComponent convertPractitionerRoleAvailableTimeComponent(org.hl7.fhir.r5.model.PractitionerRole.PractitionerRoleAvailableTimeComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.PractitionerRole.PractitionerRoleAvailableTimeComponent tgt = new org.hl7.fhir.dstu3.model.PractitionerRole.PractitionerRoleAvailableTimeComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.r5.model.Enumeration t : src.getDaysOfWeek()) + tgt.addDaysOfWeek(convertDaysOfWeek(t.getValue())); + if (src.hasAllDay()) + tgt.setAllDay(src.getAllDay()); + if (src.hasAvailableStartTime()) + tgt.setAvailableStartTime(src.getAvailableStartTime()); + if (src.hasAvailableEndTime()) + tgt.setAvailableEndTime(src.getAvailableEndTime()); + return tgt; + } + + private static org.hl7.fhir.r5.model.PractitionerRole.DaysOfWeek convertDaysOfWeek(org.hl7.fhir.dstu3.model.PractitionerRole.DaysOfWeek src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case MON: return org.hl7.fhir.r5.model.PractitionerRole.DaysOfWeek.MON; + case TUE: return org.hl7.fhir.r5.model.PractitionerRole.DaysOfWeek.TUE; + case WED: return org.hl7.fhir.r5.model.PractitionerRole.DaysOfWeek.WED; + case THU: return org.hl7.fhir.r5.model.PractitionerRole.DaysOfWeek.THU; + case FRI: return org.hl7.fhir.r5.model.PractitionerRole.DaysOfWeek.FRI; + case SAT: return org.hl7.fhir.r5.model.PractitionerRole.DaysOfWeek.SAT; + case SUN: return org.hl7.fhir.r5.model.PractitionerRole.DaysOfWeek.SUN; + default: return org.hl7.fhir.r5.model.PractitionerRole.DaysOfWeek.NULL; + } +} + + private static org.hl7.fhir.dstu3.model.PractitionerRole.DaysOfWeek convertDaysOfWeek(org.hl7.fhir.r5.model.PractitionerRole.DaysOfWeek src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case MON: return org.hl7.fhir.dstu3.model.PractitionerRole.DaysOfWeek.MON; + case TUE: return org.hl7.fhir.dstu3.model.PractitionerRole.DaysOfWeek.TUE; + case WED: return org.hl7.fhir.dstu3.model.PractitionerRole.DaysOfWeek.WED; + case THU: return org.hl7.fhir.dstu3.model.PractitionerRole.DaysOfWeek.THU; + case FRI: return org.hl7.fhir.dstu3.model.PractitionerRole.DaysOfWeek.FRI; + case SAT: return org.hl7.fhir.dstu3.model.PractitionerRole.DaysOfWeek.SAT; + case SUN: return org.hl7.fhir.dstu3.model.PractitionerRole.DaysOfWeek.SUN; + default: return org.hl7.fhir.dstu3.model.PractitionerRole.DaysOfWeek.NULL; + } +} + + public static org.hl7.fhir.r5.model.PractitionerRole.PractitionerRoleNotAvailableComponent convertPractitionerRoleNotAvailableComponent(org.hl7.fhir.dstu3.model.PractitionerRole.PractitionerRoleNotAvailableComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.PractitionerRole.PractitionerRoleNotAvailableComponent tgt = new org.hl7.fhir.r5.model.PractitionerRole.PractitionerRoleNotAvailableComponent(); + copyElement(src, tgt); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + if (src.hasDuring()) + tgt.setDuring(convertPeriod(src.getDuring())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.PractitionerRole.PractitionerRoleNotAvailableComponent convertPractitionerRoleNotAvailableComponent(org.hl7.fhir.r5.model.PractitionerRole.PractitionerRoleNotAvailableComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.PractitionerRole.PractitionerRoleNotAvailableComponent tgt = new org.hl7.fhir.dstu3.model.PractitionerRole.PractitionerRoleNotAvailableComponent(); + copyElement(src, tgt); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + if (src.hasDuring()) + tgt.setDuring(convertPeriod(src.getDuring())); + return tgt; + } + + public static org.hl7.fhir.r5.model.Provenance convertProvenance(org.hl7.fhir.dstu3.model.Provenance src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Provenance tgt = new org.hl7.fhir.r5.model.Provenance(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Reference t : src.getTarget()) + tgt.addTarget(convertReference(t)); + if (src.hasPeriod()) + tgt.setOccurred(convertPeriod(src.getPeriod())); + if (src.hasRecorded()) + tgt.setRecorded(src.getRecorded()); + for (org.hl7.fhir.dstu3.model.UriType t : src.getPolicy()) + tgt.addPolicy(t.getValue()); + if (src.hasLocation()) + tgt.setLocation(convertReference(src.getLocation())); + for (org.hl7.fhir.dstu3.model.Coding t : src.getReason()) + tgt.addReason(convertCodingToCodeableConcept(t)); + if (src.hasActivity()) + tgt.setActivity(convertCodingToCodeableConcept(src.getActivity())); + for (org.hl7.fhir.dstu3.model.Provenance.ProvenanceAgentComponent t : src.getAgent()) + tgt.addAgent(convertProvenanceAgentComponent(t)); + for (org.hl7.fhir.dstu3.model.Provenance.ProvenanceEntityComponent t : src.getEntity()) + tgt.addEntity(convertProvenanceEntityComponent(t)); + for (org.hl7.fhir.dstu3.model.Signature t : src.getSignature()) + tgt.addSignature(convertSignature(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Provenance convertProvenance(org.hl7.fhir.r5.model.Provenance src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Provenance tgt = new org.hl7.fhir.dstu3.model.Provenance(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Reference t : src.getTarget()) + tgt.addTarget(convertReference(t)); + if (src.hasOccurredPeriod()) + tgt.setPeriod(convertPeriod(src.getOccurredPeriod())); + if (src.hasRecorded()) + tgt.setRecorded(src.getRecorded()); + for (org.hl7.fhir.r5.model.UriType t : src.getPolicy()) + tgt.addPolicy(t.getValue()); + if (src.hasLocation()) + tgt.setLocation(convertReference(src.getLocation())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getReason()) + for (org.hl7.fhir.r5.model.Coding tc : t.getCoding()) + tgt.addReason(convertCoding(tc)); + if (src.hasActivity()) + tgt.setActivity(convertCoding(src.getActivity())); + for (org.hl7.fhir.r5.model.Provenance.ProvenanceAgentComponent t : src.getAgent()) + tgt.addAgent(convertProvenanceAgentComponent(t)); + for (org.hl7.fhir.r5.model.Provenance.ProvenanceEntityComponent t : src.getEntity()) + tgt.addEntity(convertProvenanceEntityComponent(t)); + for (org.hl7.fhir.r5.model.Signature t : src.getSignature()) + tgt.addSignature(convertSignature(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.Provenance.ProvenanceAgentComponent convertProvenanceAgentComponent(org.hl7.fhir.dstu3.model.Provenance.ProvenanceAgentComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Provenance.ProvenanceAgentComponent tgt = new org.hl7.fhir.r5.model.Provenance.ProvenanceAgentComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getRole()) + tgt.addRole(convertCodeableConcept(t)); + if (src.hasWho()) { + Type t = convertType(src.getWho()); + if (t instanceof Reference) + tgt.setWho((Reference) t); + if (t instanceof UriType) + tgt.getWho().setReference(t.primitiveValue()); + } + if (src.hasOnBehalfOf()) { + Type t = convertType(src.getOnBehalfOf()); + if (t instanceof Reference) + tgt.setOnBehalfOf((Reference) t); + if (t instanceof UriType) + tgt.getOnBehalfOf().setReference(t.primitiveValue()); + } + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Provenance.ProvenanceAgentComponent convertProvenanceAgentComponent(org.hl7.fhir.r5.model.Provenance.ProvenanceAgentComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Provenance.ProvenanceAgentComponent tgt = new org.hl7.fhir.dstu3.model.Provenance.ProvenanceAgentComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getRole()) + tgt.addRole(convertCodeableConcept(t)); + if (src.hasWho()) + tgt.setWho(convertType(src.getWho())); + if (src.hasOnBehalfOf()) + tgt.setOnBehalfOf(convertType(src.getOnBehalfOf())); + return tgt; + } + + public static org.hl7.fhir.r5.model.Provenance.ProvenanceEntityComponent convertProvenanceEntityComponent(org.hl7.fhir.dstu3.model.Provenance.ProvenanceEntityComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Provenance.ProvenanceEntityComponent tgt = new org.hl7.fhir.r5.model.Provenance.ProvenanceEntityComponent(); + copyElement(src, tgt); + if (src.hasRole()) + tgt.setRole(convertProvenanceEntityRole(src.getRole())); + if (src.hasWhat()) { + Type t = convertType(src.getWhat()); + if (t instanceof Reference) + tgt.setWhat((Reference) t); + else if (t instanceof Identifier) + tgt.getWhat().setIdentifier((Identifier) t); + else if (t instanceof UriType) + tgt.getWhat().setReference(t.primitiveValue()); + } + for (org.hl7.fhir.dstu3.model.Provenance.ProvenanceAgentComponent t : src.getAgent()) + tgt.addAgent(convertProvenanceAgentComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Provenance.ProvenanceEntityComponent convertProvenanceEntityComponent(org.hl7.fhir.r5.model.Provenance.ProvenanceEntityComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Provenance.ProvenanceEntityComponent tgt = new org.hl7.fhir.dstu3.model.Provenance.ProvenanceEntityComponent(); + copyElement(src, tgt); + if (src.hasRole()) + tgt.setRole(convertProvenanceEntityRole(src.getRole())); + if (src.hasWhat()) + tgt.setWhat(convertType(src.getWhat())); + for (org.hl7.fhir.r5.model.Provenance.ProvenanceAgentComponent t : src.getAgent()) + tgt.addAgent(convertProvenanceAgentComponent(t)); + return tgt; + } + + private static org.hl7.fhir.r5.model.Provenance.ProvenanceEntityRole convertProvenanceEntityRole(org.hl7.fhir.dstu3.model.Provenance.ProvenanceEntityRole src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case DERIVATION: return org.hl7.fhir.r5.model.Provenance.ProvenanceEntityRole.DERIVATION; + case REVISION: return org.hl7.fhir.r5.model.Provenance.ProvenanceEntityRole.REVISION; + case QUOTATION: return org.hl7.fhir.r5.model.Provenance.ProvenanceEntityRole.QUOTATION; + case SOURCE: return org.hl7.fhir.r5.model.Provenance.ProvenanceEntityRole.SOURCE; + case REMOVAL: return org.hl7.fhir.r5.model.Provenance.ProvenanceEntityRole.REMOVAL; + default: return org.hl7.fhir.r5.model.Provenance.ProvenanceEntityRole.NULL; + } +} + + private static org.hl7.fhir.dstu3.model.Provenance.ProvenanceEntityRole convertProvenanceEntityRole(org.hl7.fhir.r5.model.Provenance.ProvenanceEntityRole src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case DERIVATION: return org.hl7.fhir.dstu3.model.Provenance.ProvenanceEntityRole.DERIVATION; + case REVISION: return org.hl7.fhir.dstu3.model.Provenance.ProvenanceEntityRole.REVISION; + case QUOTATION: return org.hl7.fhir.dstu3.model.Provenance.ProvenanceEntityRole.QUOTATION; + case SOURCE: return org.hl7.fhir.dstu3.model.Provenance.ProvenanceEntityRole.SOURCE; + case REMOVAL: return org.hl7.fhir.dstu3.model.Provenance.ProvenanceEntityRole.REMOVAL; + default: return org.hl7.fhir.dstu3.model.Provenance.ProvenanceEntityRole.NULL; + } +} + + public static org.hl7.fhir.r5.model.Questionnaire convertQuestionnaire(org.hl7.fhir.dstu3.model.Questionnaire src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Questionnaire tgt = new org.hl7.fhir.r5.model.Questionnaire(); + copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasTitle()) + tgt.setTitle(src.getTitle()); + if (src.hasStatus()) + tgt.setStatus(convertPublicationStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + if (src.hasPurpose()) + tgt.setPurpose(src.getPurpose()); + if (src.hasApprovalDate()) + tgt.setApprovalDate(src.getApprovalDate()); + if (src.hasLastReviewDate()) + tgt.setLastReviewDate(src.getLastReviewDate()); + if (src.hasEffectivePeriod()) + tgt.setEffectivePeriod(convertPeriod(src.getEffectivePeriod())); + for (org.hl7.fhir.dstu3.model.UsageContext t : src.getUseContext()) + tgt.addUseContext(convertUsageContext(t)); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction()) + tgt.addJurisdiction(convertCodeableConcept(t)); + for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) + tgt.addContact(convertContactDetail(t)); + if (src.hasCopyright()) + tgt.setCopyright(src.getCopyright()); + for (org.hl7.fhir.dstu3.model.Coding t : src.getCode()) + tgt.addCode(convertCoding(t)); + for (org.hl7.fhir.dstu3.model.CodeType t : src.getSubjectType()) + tgt.addSubjectType(t.getValue()); + for (org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemComponent t : src.getItem()) + tgt.addItem(convertQuestionnaireItemComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Questionnaire convertQuestionnaire(org.hl7.fhir.r5.model.Questionnaire src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Questionnaire tgt = new org.hl7.fhir.dstu3.model.Questionnaire(); + copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasTitle()) + tgt.setTitle(src.getTitle()); + if (src.hasStatus()) + tgt.setStatus(convertPublicationStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + if (src.hasPurpose()) + tgt.setPurpose(src.getPurpose()); + if (src.hasApprovalDate()) + tgt.setApprovalDate(src.getApprovalDate()); + if (src.hasLastReviewDate()) + tgt.setLastReviewDate(src.getLastReviewDate()); + if (src.hasEffectivePeriod()) + tgt.setEffectivePeriod(convertPeriod(src.getEffectivePeriod())); + for (org.hl7.fhir.r5.model.UsageContext t : src.getUseContext()) + tgt.addUseContext(convertUsageContext(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getJurisdiction()) + tgt.addJurisdiction(convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.ContactDetail t : src.getContact()) + tgt.addContact(convertContactDetail(t)); + if (src.hasCopyright()) + tgt.setCopyright(src.getCopyright()); + for (org.hl7.fhir.r5.model.Coding t : src.getCode()) + tgt.addCode(convertCoding(t)); + for (org.hl7.fhir.r5.model.CodeType t : src.getSubjectType()) + tgt.addSubjectType(t.getValue()); + for (org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemComponent t : src.getItem()) + tgt.addItem(convertQuestionnaireItemComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemComponent convertQuestionnaireItemComponent(org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemComponent tgt = new org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemComponent(); + copyElement(src, tgt); + if (src.hasLinkId()) + tgt.setLinkId(src.getLinkId()); + if (src.hasDefinition()) + tgt.setDefinition(src.getDefinition()); + for (org.hl7.fhir.dstu3.model.Coding t : src.getCode()) + tgt.addCode(convertCoding(t)); + if (src.hasPrefix()) + tgt.setPrefix(src.getPrefix()); + if (src.hasText()) + tgt.setText(src.getText()); + if (src.hasType()) + tgt.setType(convertQuestionnaireItemType(src.getType())); + for (org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemEnableWhenComponent t : src.getEnableWhen()) + tgt.addEnableWhen(convertQuestionnaireItemEnableWhenComponent(t)); + tgt.setEnableBehavior(Questionnaire.EnableWhenBehavior.ANY); + if (src.hasRequired()) + tgt.setRequired(src.getRequired()); + if (src.hasRepeats()) + tgt.setRepeats(src.getRepeats()); + if (src.hasReadOnly()) + tgt.setReadOnly(src.getReadOnly()); + if (src.hasMaxLength()) + tgt.setMaxLength(src.getMaxLength()); + if (src.hasOptions()) + tgt.setAnswerValueSetElement(convertReferenceToCanonical(src.getOptions())); + for (org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemOptionComponent t : src.getOption()) + tgt.addAnswerOption(convertQuestionnaireItemOptionComponent(t)); + if (src.hasInitial()) + tgt.addInitial().setValue(convertType(src.getInitial())); + for (org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemComponent t : src.getItem()) + tgt.addItem(convertQuestionnaireItemComponent(t)); + for (org.hl7.fhir.dstu3.model.Extension t : src.getModifierExtension()) { + tgt.addModifierExtension(convertExtension(t)); + } + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemComponent convertQuestionnaireItemComponent(org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemComponent tgt = new org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemComponent(); + copyElement(src, tgt); + if (src.hasLinkId()) + tgt.setLinkId(src.getLinkId()); + if (src.hasDefinition()) + tgt.setDefinition(src.getDefinition()); + for (org.hl7.fhir.r5.model.Coding t : src.getCode()) + tgt.addCode(convertCoding(t)); + if (src.hasPrefix()) + tgt.setPrefix(src.getPrefix()); + if (src.hasText()) + tgt.setText(src.getText()); + if (src.hasType()) + tgt.setType(convertQuestionnaireItemType(src.getType())); + for (org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemEnableWhenComponent t : src.getEnableWhen()) + tgt.addEnableWhen(convertQuestionnaireItemEnableWhenComponent(t)); + if (src.hasRequired()) + tgt.setRequired(src.getRequired()); + if (src.hasRepeats()) + tgt.setRepeats(src.getRepeats()); + if (src.hasReadOnly()) + tgt.setReadOnly(src.getReadOnly()); + if (src.hasMaxLength()) + tgt.setMaxLength(src.getMaxLength()); + if (src.hasAnswerValueSet()) + tgt.setOptions(convertCanonicalToReference(src.getAnswerValueSetElement())); + for (org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemAnswerOptionComponent t : src.getAnswerOption()) + tgt.addOption(convertQuestionnaireItemOptionComponent(t)); + if (src.hasInitial()) + tgt.setInitial(convertType(src.getInitialFirstRep().getValue())); + for (org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemComponent t : src.getItem()) + tgt.addItem(convertQuestionnaireItemComponent(t)); + return tgt; + } + + private static org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType convertQuestionnaireItemType(org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case GROUP: return org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.GROUP; + case DISPLAY: return org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.DISPLAY; + case QUESTION: return org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.QUESTION; + case BOOLEAN: return org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.BOOLEAN; + case DECIMAL: return org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.DECIMAL; + case INTEGER: return org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.INTEGER; + case DATE: return org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.DATE; + case DATETIME: return org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.DATETIME; + case TIME: return org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.TIME; + case STRING: return org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.STRING; + case TEXT: return org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.TEXT; + case URL: return org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.URL; + case CHOICE: return org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.CHOICE; + case OPENCHOICE: return org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.OPENCHOICE; + case ATTACHMENT: return org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.ATTACHMENT; + case REFERENCE: return org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.REFERENCE; + case QUANTITY: return org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.QUANTITY; + default: return org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.NULL; + } +} + + private static org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType convertQuestionnaireItemType(org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case GROUP: return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.GROUP; + case DISPLAY: return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.DISPLAY; + case QUESTION: return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.QUESTION; + case BOOLEAN: return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.BOOLEAN; + case DECIMAL: return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.DECIMAL; + case INTEGER: return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.INTEGER; + case DATE: return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.DATE; + case DATETIME: return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.DATETIME; + case TIME: return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.TIME; + case STRING: return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.STRING; + case TEXT: return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.TEXT; + case URL: return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.URL; + case CHOICE: return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.CHOICE; + case OPENCHOICE: return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.OPENCHOICE; + case ATTACHMENT: return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.ATTACHMENT; + case REFERENCE: return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.REFERENCE; + case QUANTITY: return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.QUANTITY; + default: return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.NULL; + } +} + + public static org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemEnableWhenComponent convertQuestionnaireItemEnableWhenComponent(org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemEnableWhenComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemEnableWhenComponent tgt = new org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemEnableWhenComponent(); + copyElement(src, tgt); + if (src.hasQuestion()) + tgt.setQuestion(src.getQuestion()); + if (src.hasHasAnswer()) { + tgt.setOperator(org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemOperator.EXISTS); + tgt.setAnswer(convertType(src.getHasAnswerElement())); + } + else if (src.hasAnswer()) { + tgt.setOperator(org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemOperator.EQUAL); + tgt.setAnswer(convertType(src.getAnswer())); + } + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemEnableWhenComponent convertQuestionnaireItemEnableWhenComponent(org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemEnableWhenComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemEnableWhenComponent tgt = new org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemEnableWhenComponent(); + copyElement(src, tgt); + if (src.hasQuestion()) + tgt.setQuestion(src.getQuestion()); + if (src.hasOperator() && src.getOperator() == org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemOperator.EXISTS) + tgt.setHasAnswer(src.getAnswerBooleanType().getValue()); + else if (src.hasAnswer()) + tgt.setAnswer(convertType(src.getAnswer())); + return tgt; + } + + public static org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemAnswerOptionComponent convertQuestionnaireItemOptionComponent(org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemOptionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemAnswerOptionComponent tgt = new org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemAnswerOptionComponent(); + copyElement(src, tgt); + if (src.hasValue()) + tgt.setValue(convertType(src.getValue())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemOptionComponent convertQuestionnaireItemOptionComponent(org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemAnswerOptionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemOptionComponent tgt = new org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemOptionComponent(); + copyElement(src, tgt); + if (src.hasValue()) + tgt.setValue(convertType(src.getValue())); + return tgt; + } + + public static org.hl7.fhir.r5.model.QuestionnaireResponse convertQuestionnaireResponse(org.hl7.fhir.dstu3.model.QuestionnaireResponse src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.QuestionnaireResponse tgt = new org.hl7.fhir.r5.model.QuestionnaireResponse(); + copyDomainResource(src, tgt); + if (src.hasIdentifier()) + tgt.setIdentifier(convertIdentifier(src.getIdentifier())); + for (org.hl7.fhir.dstu3.model.Reference t : src.getBasedOn()) + tgt.addBasedOn(convertReference(t)); + for (org.hl7.fhir.dstu3.model.Reference t : src.getParent()) + tgt.addPartOf(convertReference(t)); + if (src.hasQuestionnaire()) + tgt.setQuestionnaireElement(convertReferenceToCanonical(src.getQuestionnaire())); + if (src.hasStatus()) + tgt.setStatus(convertQuestionnaireResponseStatus(src.getStatus())); + if (src.hasSubject()) + tgt.setSubject(convertReference(src.getSubject())); + if (src.hasContext()) + tgt.setEncounter(convertReference(src.getContext())); + if (src.hasAuthored()) + tgt.setAuthored(src.getAuthored()); + if (src.hasAuthor()) + tgt.setAuthor(convertReference(src.getAuthor())); + if (src.hasSource()) + tgt.setSource(convertReference(src.getSource())); + for (org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseItemComponent t : src.getItem()) + tgt.addItem(convertQuestionnaireResponseItemComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.QuestionnaireResponse convertQuestionnaireResponse(org.hl7.fhir.r5.model.QuestionnaireResponse src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.QuestionnaireResponse tgt = new org.hl7.fhir.dstu3.model.QuestionnaireResponse(); + copyDomainResource(src, tgt); + if (src.hasIdentifier()) + tgt.setIdentifier(convertIdentifier(src.getIdentifier())); + for (org.hl7.fhir.r5.model.Reference t : src.getBasedOn()) + tgt.addBasedOn(convertReference(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getPartOf()) + tgt.addParent(convertReference(t)); + if (src.hasQuestionnaire()) + tgt.setQuestionnaire(convertCanonicalToReference(src.getQuestionnaireElement())); + if (src.hasStatus()) + tgt.setStatus(convertQuestionnaireResponseStatus(src.getStatus())); + if (src.hasSubject()) + tgt.setSubject(convertReference(src.getSubject())); + if (src.hasEncounter()) + tgt.setContext(convertReference(src.getEncounter())); + if (src.hasAuthored()) + tgt.setAuthored(src.getAuthored()); + if (src.hasAuthor()) + tgt.setAuthor(convertReference(src.getAuthor())); + if (src.hasSource()) + tgt.setSource(convertReference(src.getSource())); + for (org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseItemComponent t : src.getItem()) + tgt.addItem(convertQuestionnaireResponseItemComponent(t)); + return tgt; + } + + private static org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseStatus convertQuestionnaireResponseStatus(org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case INPROGRESS: return org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseStatus.INPROGRESS; + case COMPLETED: return org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseStatus.COMPLETED; + case AMENDED: return org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseStatus.AMENDED; + case ENTEREDINERROR: return org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseStatus.ENTEREDINERROR; + case STOPPED: return org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseStatus.STOPPED; + default: return org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseStatus.NULL; + } +} + + private static org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseStatus convertQuestionnaireResponseStatus(org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case INPROGRESS: return org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseStatus.INPROGRESS; + case COMPLETED: return org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseStatus.COMPLETED; + case AMENDED: return org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseStatus.AMENDED; + case ENTEREDINERROR: return org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseStatus.ENTEREDINERROR; + case STOPPED: return org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseStatus.STOPPED; + default: return org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseStatus.NULL; + } +} + + public static org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseItemComponent convertQuestionnaireResponseItemComponent(org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseItemComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseItemComponent tgt = new org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseItemComponent(); + copyElement(src, tgt); + if (src.hasLinkId()) + tgt.setLinkId(src.getLinkId()); + if (src.hasDefinition()) + tgt.setDefinition(src.getDefinition()); + if (src.hasText()) + tgt.setText(src.getText()); +// if (src.hasSubject()) +// tgt.setSubject(convertReference(src.getSubject())); + for (org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent t : src.getAnswer()) + tgt.addAnswer(convertQuestionnaireResponseItemAnswerComponent(t)); + for (org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseItemComponent t : src.getItem()) + tgt.addItem(convertQuestionnaireResponseItemComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseItemComponent convertQuestionnaireResponseItemComponent(org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseItemComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseItemComponent tgt = new org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseItemComponent(); + copyElement(src, tgt); + if (src.hasLinkId()) + tgt.setLinkId(src.getLinkId()); + if (src.hasDefinition()) + tgt.setDefinition(src.getDefinition()); + if (src.hasText()) + tgt.setText(src.getText()); +// if (src.hasSubject()) +// tgt.setSubject(convertReference(src.getSubject())); + for (org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent t : src.getAnswer()) + tgt.addAnswer(convertQuestionnaireResponseItemAnswerComponent(t)); + for (org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseItemComponent t : src.getItem()) + tgt.addItem(convertQuestionnaireResponseItemComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent convertQuestionnaireResponseItemAnswerComponent(org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent tgt = new org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent(); + copyElement(src, tgt); + if (src.hasValue()) + tgt.setValue(convertType(src.getValue())); + for (org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseItemComponent t : src.getItem()) + tgt.addItem(convertQuestionnaireResponseItemComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent convertQuestionnaireResponseItemAnswerComponent(org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent tgt = new org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent(); + copyElement(src, tgt); + if (src.hasValue()) + tgt.setValue(convertType(src.getValue())); + for (org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseItemComponent t : src.getItem()) + tgt.addItem(convertQuestionnaireResponseItemComponent(t)); + return tgt; + } + + + public static org.hl7.fhir.r5.model.RiskAssessment convertRiskAssessment(org.hl7.fhir.dstu3.model.RiskAssessment src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.RiskAssessment tgt = new org.hl7.fhir.r5.model.RiskAssessment(); + copyDomainResource(src, tgt); + if (src.hasIdentifier()) + tgt.addIdentifier(convertIdentifier(src.getIdentifier())); + if (src.hasBasedOn()) + tgt.setBasedOn(convertReference(src.getBasedOn())); + if (src.hasParent()) + tgt.setParent(convertReference(src.getParent())); + if (src.hasStatus()) + tgt.setStatus(convertRiskAssessmentStatus(src.getStatus())); + if (src.hasMethod()) + tgt.setMethod(convertCodeableConcept(src.getMethod())); + if (src.hasCode()) + tgt.setCode(convertCodeableConcept(src.getCode())); + if (src.hasSubject()) + tgt.setSubject(convertReference(src.getSubject())); + if (src.hasContext()) + tgt.setEncounter(convertReference(src.getContext())); + if (src.hasOccurrence()) + tgt.setOccurrence(convertType(src.getOccurrence())); + if (src.hasCondition()) + tgt.setCondition(convertReference(src.getCondition())); + if (src.hasPerformer()) + tgt.setPerformer(convertReference(src.getPerformer())); + if (src.hasReason()) { + org.hl7.fhir.r5.model.Type t = convertType(src.getReason()); + if (t instanceof org.hl7.fhir.r5.model.CodeableConcept) + tgt.addReasonCode((org.hl7.fhir.r5.model.CodeableConcept) t); + else + tgt.addReasonReference((org.hl7.fhir.r5.model.Reference) t); + } + for (org.hl7.fhir.dstu3.model.Reference t : src.getBasis()) + tgt.addBasis(convertReference(t)); + for (org.hl7.fhir.dstu3.model.RiskAssessment.RiskAssessmentPredictionComponent t : src.getPrediction()) + tgt.addPrediction(convertRiskAssessmentPredictionComponent(t)); + if (src.hasMitigation()) + tgt.setMitigation(src.getMitigation()); + if (src.hasComment()) + tgt.addNote().setText(src.getComment()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.RiskAssessment convertRiskAssessment(org.hl7.fhir.r5.model.RiskAssessment src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.RiskAssessment tgt = new org.hl7.fhir.dstu3.model.RiskAssessment(); + copyDomainResource(src, tgt); + if (src.hasIdentifier()) + tgt.setIdentifier(convertIdentifier(src.getIdentifierFirstRep())); + if (src.hasBasedOn()) + tgt.setBasedOn(convertReference(src.getBasedOn())); + if (src.hasParent()) + tgt.setParent(convertReference(src.getParent())); + if (src.hasStatus()) + tgt.setStatus(convertRiskAssessmentStatus(src.getStatus())); + if (src.hasMethod()) + tgt.setMethod(convertCodeableConcept(src.getMethod())); + if (src.hasCode()) + tgt.setCode(convertCodeableConcept(src.getCode())); + if (src.hasSubject()) + tgt.setSubject(convertReference(src.getSubject())); + if (src.hasEncounter()) + tgt.setContext(convertReference(src.getEncounter())); + if (src.hasOccurrence()) + tgt.setOccurrence(convertType(src.getOccurrence())); + if (src.hasCondition()) + tgt.setCondition(convertReference(src.getCondition())); + if (src.hasPerformer()) + tgt.setPerformer(convertReference(src.getPerformer())); + if (src.hasReasonCode()) + tgt.setReason(convertType(src.getReasonCodeFirstRep())); + if (src.hasReasonReference()) + tgt.setReason(convertType(src.getReasonReferenceFirstRep())); + for (org.hl7.fhir.r5.model.Reference t : src.getBasis()) + tgt.addBasis(convertReference(t)); + for (org.hl7.fhir.r5.model.RiskAssessment.RiskAssessmentPredictionComponent t : src.getPrediction()) + tgt.addPrediction(convertRiskAssessmentPredictionComponent(t)); + if (src.hasMitigation()) + tgt.setMitigation(src.getMitigation()); + if (src.hasNote()) + tgt.setComment(src.getNoteFirstRep().getText()); + return tgt; + } + + private static org.hl7.fhir.r5.model.RiskAssessment.RiskAssessmentStatus convertRiskAssessmentStatus(org.hl7.fhir.dstu3.model.RiskAssessment.RiskAssessmentStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case REGISTERED: return org.hl7.fhir.r5.model.RiskAssessment.RiskAssessmentStatus.REGISTERED; + case PRELIMINARY: return org.hl7.fhir.r5.model.RiskAssessment.RiskAssessmentStatus.PRELIMINARY; + case FINAL: return org.hl7.fhir.r5.model.RiskAssessment.RiskAssessmentStatus.FINAL; + case AMENDED: return org.hl7.fhir.r5.model.RiskAssessment.RiskAssessmentStatus.AMENDED; + case CORRECTED: return org.hl7.fhir.r5.model.RiskAssessment.RiskAssessmentStatus.CORRECTED; + case CANCELLED: return org.hl7.fhir.r5.model.RiskAssessment.RiskAssessmentStatus.CANCELLED; + case ENTEREDINERROR: return org.hl7.fhir.r5.model.RiskAssessment.RiskAssessmentStatus.ENTEREDINERROR; + case UNKNOWN: return org.hl7.fhir.r5.model.RiskAssessment.RiskAssessmentStatus.UNKNOWN; + default: return org.hl7.fhir.r5.model.RiskAssessment.RiskAssessmentStatus.NULL; + } +} + + private static org.hl7.fhir.dstu3.model.RiskAssessment.RiskAssessmentStatus convertRiskAssessmentStatus(org.hl7.fhir.r5.model.RiskAssessment.RiskAssessmentStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case REGISTERED: return org.hl7.fhir.dstu3.model.RiskAssessment.RiskAssessmentStatus.REGISTERED; + case PRELIMINARY: return org.hl7.fhir.dstu3.model.RiskAssessment.RiskAssessmentStatus.PRELIMINARY; + case FINAL: return org.hl7.fhir.dstu3.model.RiskAssessment.RiskAssessmentStatus.FINAL; + case AMENDED: return org.hl7.fhir.dstu3.model.RiskAssessment.RiskAssessmentStatus.AMENDED; + case CORRECTED: return org.hl7.fhir.dstu3.model.RiskAssessment.RiskAssessmentStatus.CORRECTED; + case CANCELLED: return org.hl7.fhir.dstu3.model.RiskAssessment.RiskAssessmentStatus.CANCELLED; + case ENTEREDINERROR: return org.hl7.fhir.dstu3.model.RiskAssessment.RiskAssessmentStatus.ENTEREDINERROR; + case UNKNOWN: return org.hl7.fhir.dstu3.model.RiskAssessment.RiskAssessmentStatus.UNKNOWN; + default: return org.hl7.fhir.dstu3.model.RiskAssessment.RiskAssessmentStatus.NULL; + } +} + + public static org.hl7.fhir.r5.model.RiskAssessment.RiskAssessmentPredictionComponent convertRiskAssessmentPredictionComponent(org.hl7.fhir.dstu3.model.RiskAssessment.RiskAssessmentPredictionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.RiskAssessment.RiskAssessmentPredictionComponent tgt = new org.hl7.fhir.r5.model.RiskAssessment.RiskAssessmentPredictionComponent(); + copyElement(src, tgt); + if (src.hasOutcome()) + tgt.setOutcome(convertCodeableConcept(src.getOutcome())); + if (src.hasProbability()) + tgt.setProbability(convertType(src.getProbability())); + if (src.hasQualitativeRisk()) + tgt.setQualitativeRisk(convertCodeableConcept(src.getQualitativeRisk())); + if (src.hasRelativeRisk()) + tgt.setRelativeRisk(src.getRelativeRisk()); + if (src.hasWhen()) + tgt.setWhen(convertType(src.getWhen())); + if (src.hasRationale()) + tgt.setRationale(src.getRationale()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.RiskAssessment.RiskAssessmentPredictionComponent convertRiskAssessmentPredictionComponent(org.hl7.fhir.r5.model.RiskAssessment.RiskAssessmentPredictionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.RiskAssessment.RiskAssessmentPredictionComponent tgt = new org.hl7.fhir.dstu3.model.RiskAssessment.RiskAssessmentPredictionComponent(); + copyElement(src, tgt); + if (src.hasOutcome()) + tgt.setOutcome(convertCodeableConcept(src.getOutcome())); + if (src.hasProbability()) + tgt.setProbability(convertType(src.getProbability())); + if (src.hasQualitativeRisk()) + tgt.setQualitativeRisk(convertCodeableConcept(src.getQualitativeRisk())); + if (src.hasRelativeRisk()) + tgt.setRelativeRisk(src.getRelativeRisk()); + if (src.hasWhen()) + tgt.setWhen(convertType(src.getWhen())); + if (src.hasRationale()) + tgt.setRationale(src.getRationale()); + return tgt; + } + + public static org.hl7.fhir.r5.model.Schedule convertSchedule(org.hl7.fhir.dstu3.model.Schedule src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Schedule tgt = new org.hl7.fhir.r5.model.Schedule(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasActive()) + tgt.setActive(src.getActive()); + if (src.hasServiceCategory()) + tgt.addServiceCategory(convertCodeableConcept(src.getServiceCategory())); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getServiceType()) + tgt.addServiceType(convertCodeableConcept(t)); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getSpecialty()) + tgt.addSpecialty(convertCodeableConcept(t)); + for (org.hl7.fhir.dstu3.model.Reference t : src.getActor()) + tgt.addActor(convertReference(t)); + if (src.hasPlanningHorizon()) + tgt.setPlanningHorizon(convertPeriod(src.getPlanningHorizon())); + if (src.hasComment()) + tgt.setComment(src.getComment()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Schedule convertSchedule(org.hl7.fhir.r5.model.Schedule src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Schedule tgt = new org.hl7.fhir.dstu3.model.Schedule(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasActive()) + tgt.setActive(src.getActive()); + if (src.hasServiceCategory()) + tgt.setServiceCategory(convertCodeableConcept(src.getServiceCategoryFirstRep())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getServiceType()) + tgt.addServiceType(convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getSpecialty()) + tgt.addSpecialty(convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getActor()) + tgt.addActor(convertReference(t)); + if (src.hasPlanningHorizon()) + tgt.setPlanningHorizon(convertPeriod(src.getPlanningHorizon())); + if (src.hasComment()) + tgt.setComment(src.getComment()); + return tgt; + } + + public static org.hl7.fhir.r5.model.SearchParameter convertSearchParameter(org.hl7.fhir.dstu3.model.SearchParameter src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.SearchParameter tgt = new org.hl7.fhir.r5.model.SearchParameter(); + copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasStatus()) + tgt.setStatus(convertPublicationStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) + tgt.addContact(convertContactDetail(t)); + for (org.hl7.fhir.dstu3.model.UsageContext t : src.getUseContext()) + tgt.addUseContext(convertUsageContext(t)); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction()) + tgt.addJurisdiction(convertCodeableConcept(t)); + if (src.hasPurpose()) + tgt.setPurpose(src.getPurpose()); + if (src.hasCode()) + tgt.setCode(src.getCode()); + for (org.hl7.fhir.dstu3.model.CodeType t : src.getBase()) + tgt.addBase(t.getValue()); + if (src.hasType()) + tgt.setType(convertSearchParamType(src.getType())); + if (src.hasDerivedFrom()) + tgt.setDerivedFrom(src.getDerivedFrom()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + if (src.hasExpression()) + tgt.setExpression(src.getExpression()); + if (src.hasXpath()) + tgt.setXpath(src.getXpath()); + if (src.hasXpathUsage()) + tgt.setXpathUsage(convertXPathUsageType(src.getXpathUsage())); + for (org.hl7.fhir.dstu3.model.CodeType t : src.getTarget()) + tgt.addTarget(t.getValue()); + for (org.hl7.fhir.dstu3.model.Enumeration t : src.getComparator()) + tgt.addComparator(convertSearchComparator(t.getValue())); + for (org.hl7.fhir.dstu3.model.Enumeration t : src.getModifier()) + tgt.addModifier(convertSearchModifierCode(t.getValue())); + for (org.hl7.fhir.dstu3.model.StringType t : src.getChain()) + tgt.addChain(t.getValue()); + for (org.hl7.fhir.dstu3.model.SearchParameter.SearchParameterComponentComponent t : src.getComponent()) + tgt.addComponent(convertSearchParameterComponentComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.SearchParameter convertSearchParameter(org.hl7.fhir.r5.model.SearchParameter src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.SearchParameter tgt = new org.hl7.fhir.dstu3.model.SearchParameter(); + copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasStatus()) + tgt.setStatus(convertPublicationStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.r5.model.ContactDetail t : src.getContact()) + tgt.addContact(convertContactDetail(t)); + for (org.hl7.fhir.r5.model.UsageContext t : src.getUseContext()) + tgt.addUseContext(convertUsageContext(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getJurisdiction()) + tgt.addJurisdiction(convertCodeableConcept(t)); + if (src.hasPurpose()) + tgt.setPurpose(src.getPurpose()); + if (src.hasCode()) + tgt.setCode(src.getCode()); + for (org.hl7.fhir.r5.model.CodeType t : src.getBase()) + tgt.addBase(t.getValue()); + if (src.hasType()) + tgt.setType(convertSearchParamType(src.getType())); + if (src.hasDerivedFrom()) + tgt.setDerivedFrom(src.getDerivedFrom()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + if (src.hasExpression()) + tgt.setExpression(src.getExpression()); + if (src.hasXpath()) + tgt.setXpath(src.getXpath()); + if (src.hasXpathUsage()) + tgt.setXpathUsage(convertXPathUsageType(src.getXpathUsage())); + for (org.hl7.fhir.r5.model.CodeType t : src.getTarget()) + tgt.addTarget(t.getValue()); + for (org.hl7.fhir.r5.model.Enumeration t : src.getComparator()) + tgt.addComparator(convertSearchComparator(t.getValue())); + for (org.hl7.fhir.r5.model.Enumeration t : src.getModifier()) + tgt.addModifier(convertSearchModifierCode(t.getValue())); + for (org.hl7.fhir.r5.model.StringType t : src.getChain()) + tgt.addChain(t.getValue()); + for (org.hl7.fhir.r5.model.SearchParameter.SearchParameterComponentComponent t : src.getComponent()) + tgt.addComponent(convertSearchParameterComponentComponent(t)); + return tgt; + } + + private static org.hl7.fhir.r5.model.SearchParameter.XPathUsageType convertXPathUsageType(org.hl7.fhir.dstu3.model.SearchParameter.XPathUsageType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case NORMAL: return org.hl7.fhir.r5.model.SearchParameter.XPathUsageType.NORMAL; + case PHONETIC: return org.hl7.fhir.r5.model.SearchParameter.XPathUsageType.PHONETIC; + case NEARBY: return org.hl7.fhir.r5.model.SearchParameter.XPathUsageType.NEARBY; + case DISTANCE: return org.hl7.fhir.r5.model.SearchParameter.XPathUsageType.DISTANCE; + case OTHER: return org.hl7.fhir.r5.model.SearchParameter.XPathUsageType.OTHER; + default: return org.hl7.fhir.r5.model.SearchParameter.XPathUsageType.NULL; + } +} + + private static org.hl7.fhir.dstu3.model.SearchParameter.XPathUsageType convertXPathUsageType(org.hl7.fhir.r5.model.SearchParameter.XPathUsageType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case NORMAL: return org.hl7.fhir.dstu3.model.SearchParameter.XPathUsageType.NORMAL; + case PHONETIC: return org.hl7.fhir.dstu3.model.SearchParameter.XPathUsageType.PHONETIC; + case NEARBY: return org.hl7.fhir.dstu3.model.SearchParameter.XPathUsageType.NEARBY; + case DISTANCE: return org.hl7.fhir.dstu3.model.SearchParameter.XPathUsageType.DISTANCE; + case OTHER: return org.hl7.fhir.dstu3.model.SearchParameter.XPathUsageType.OTHER; + default: return org.hl7.fhir.dstu3.model.SearchParameter.XPathUsageType.NULL; + } +} + + private static org.hl7.fhir.r5.model.SearchParameter.SearchComparator convertSearchComparator(org.hl7.fhir.dstu3.model.SearchParameter.SearchComparator src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case EQ: return org.hl7.fhir.r5.model.SearchParameter.SearchComparator.EQ; + case NE: return org.hl7.fhir.r5.model.SearchParameter.SearchComparator.NE; + case GT: return org.hl7.fhir.r5.model.SearchParameter.SearchComparator.GT; + case LT: return org.hl7.fhir.r5.model.SearchParameter.SearchComparator.LT; + case GE: return org.hl7.fhir.r5.model.SearchParameter.SearchComparator.GE; + case LE: return org.hl7.fhir.r5.model.SearchParameter.SearchComparator.LE; + case SA: return org.hl7.fhir.r5.model.SearchParameter.SearchComparator.SA; + case EB: return org.hl7.fhir.r5.model.SearchParameter.SearchComparator.EB; + case AP: return org.hl7.fhir.r5.model.SearchParameter.SearchComparator.AP; + default: return org.hl7.fhir.r5.model.SearchParameter.SearchComparator.NULL; + } +} + + private static org.hl7.fhir.dstu3.model.SearchParameter.SearchComparator convertSearchComparator(org.hl7.fhir.r5.model.SearchParameter.SearchComparator src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case EQ: return org.hl7.fhir.dstu3.model.SearchParameter.SearchComparator.EQ; + case NE: return org.hl7.fhir.dstu3.model.SearchParameter.SearchComparator.NE; + case GT: return org.hl7.fhir.dstu3.model.SearchParameter.SearchComparator.GT; + case LT: return org.hl7.fhir.dstu3.model.SearchParameter.SearchComparator.LT; + case GE: return org.hl7.fhir.dstu3.model.SearchParameter.SearchComparator.GE; + case LE: return org.hl7.fhir.dstu3.model.SearchParameter.SearchComparator.LE; + case SA: return org.hl7.fhir.dstu3.model.SearchParameter.SearchComparator.SA; + case EB: return org.hl7.fhir.dstu3.model.SearchParameter.SearchComparator.EB; + case AP: return org.hl7.fhir.dstu3.model.SearchParameter.SearchComparator.AP; + default: return org.hl7.fhir.dstu3.model.SearchParameter.SearchComparator.NULL; + } +} + + private static org.hl7.fhir.r5.model.SearchParameter.SearchModifierCode convertSearchModifierCode(org.hl7.fhir.dstu3.model.SearchParameter.SearchModifierCode src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case MISSING: return org.hl7.fhir.r5.model.SearchParameter.SearchModifierCode.MISSING; + case EXACT: return org.hl7.fhir.r5.model.SearchParameter.SearchModifierCode.EXACT; + case CONTAINS: return org.hl7.fhir.r5.model.SearchParameter.SearchModifierCode.CONTAINS; + case NOT: return org.hl7.fhir.r5.model.SearchParameter.SearchModifierCode.NOT; + case TEXT: return org.hl7.fhir.r5.model.SearchParameter.SearchModifierCode.TEXT; + case IN: return org.hl7.fhir.r5.model.SearchParameter.SearchModifierCode.IN; + case NOTIN: return org.hl7.fhir.r5.model.SearchParameter.SearchModifierCode.NOTIN; + case BELOW: return org.hl7.fhir.r5.model.SearchParameter.SearchModifierCode.BELOW; + case ABOVE: return org.hl7.fhir.r5.model.SearchParameter.SearchModifierCode.ABOVE; + case TYPE: return org.hl7.fhir.r5.model.SearchParameter.SearchModifierCode.TYPE; + default: return org.hl7.fhir.r5.model.SearchParameter.SearchModifierCode.NULL; + } +} + + private static org.hl7.fhir.dstu3.model.SearchParameter.SearchModifierCode convertSearchModifierCode(org.hl7.fhir.r5.model.SearchParameter.SearchModifierCode src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case MISSING: return org.hl7.fhir.dstu3.model.SearchParameter.SearchModifierCode.MISSING; + case EXACT: return org.hl7.fhir.dstu3.model.SearchParameter.SearchModifierCode.EXACT; + case CONTAINS: return org.hl7.fhir.dstu3.model.SearchParameter.SearchModifierCode.CONTAINS; + case NOT: return org.hl7.fhir.dstu3.model.SearchParameter.SearchModifierCode.NOT; + case TEXT: return org.hl7.fhir.dstu3.model.SearchParameter.SearchModifierCode.TEXT; + case IN: return org.hl7.fhir.dstu3.model.SearchParameter.SearchModifierCode.IN; + case NOTIN: return org.hl7.fhir.dstu3.model.SearchParameter.SearchModifierCode.NOTIN; + case BELOW: return org.hl7.fhir.dstu3.model.SearchParameter.SearchModifierCode.BELOW; + case ABOVE: return org.hl7.fhir.dstu3.model.SearchParameter.SearchModifierCode.ABOVE; + case TYPE: return org.hl7.fhir.dstu3.model.SearchParameter.SearchModifierCode.TYPE; + default: return org.hl7.fhir.dstu3.model.SearchParameter.SearchModifierCode.NULL; + } +} + + public static org.hl7.fhir.r5.model.SearchParameter.SearchParameterComponentComponent convertSearchParameterComponentComponent(org.hl7.fhir.dstu3.model.SearchParameter.SearchParameterComponentComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.SearchParameter.SearchParameterComponentComponent tgt = new org.hl7.fhir.r5.model.SearchParameter.SearchParameterComponentComponent(); + copyElement(src, tgt); + if (src.hasDefinition()) + tgt.setDefinitionElement(convertReferenceToCanonical(src.getDefinition())); + if (src.hasExpression()) + tgt.setExpression(src.getExpression()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.SearchParameter.SearchParameterComponentComponent convertSearchParameterComponentComponent(org.hl7.fhir.r5.model.SearchParameter.SearchParameterComponentComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.SearchParameter.SearchParameterComponentComponent tgt = new org.hl7.fhir.dstu3.model.SearchParameter.SearchParameterComponentComponent(); + copyElement(src, tgt); + if (src.hasDefinition()) + tgt.setDefinition(convertCanonicalToReference(src.getDefinitionElement())); + if (src.hasExpression()) + tgt.setExpression(src.getExpression()); + return tgt; + } + + public static org.hl7.fhir.r5.model.MolecularSequence convertSequence(org.hl7.fhir.dstu3.model.Sequence src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.MolecularSequence tgt = new org.hl7.fhir.r5.model.MolecularSequence(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasType()) + tgt.setType(convertSequenceType(src.getType())); + if (src.hasCoordinateSystem()) + tgt.setCoordinateSystem(src.getCoordinateSystem()); + if (src.hasPatient()) + tgt.setPatient(convertReference(src.getPatient())); + if (src.hasSpecimen()) + tgt.setSpecimen(convertReference(src.getSpecimen())); + if (src.hasDevice()) + tgt.setDevice(convertReference(src.getDevice())); + if (src.hasPerformer()) + tgt.setPerformer(convertReference(src.getPerformer())); + if (src.hasQuantity()) + tgt.setQuantity(convertQuantity(src.getQuantity())); + if (src.hasReferenceSeq()) + tgt.setReferenceSeq(convertSequenceReferenceSeqComponent(src.getReferenceSeq())); + for (org.hl7.fhir.dstu3.model.Sequence.SequenceVariantComponent t : src.getVariant()) + tgt.addVariant(convertSequenceVariantComponent(t)); + if (src.hasObservedSeq()) + tgt.setObservedSeq(src.getObservedSeq()); + for (org.hl7.fhir.dstu3.model.Sequence.SequenceQualityComponent t : src.getQuality()) + tgt.addQuality(convertSequenceQualityComponent(t)); + if (src.hasReadCoverage()) + tgt.setReadCoverage(src.getReadCoverage()); + for (org.hl7.fhir.dstu3.model.Sequence.SequenceRepositoryComponent t : src.getRepository()) + tgt.addRepository(convertSequenceRepositoryComponent(t)); + for (org.hl7.fhir.dstu3.model.Reference t : src.getPointer()) + tgt.addPointer(convertReference(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Sequence convertSequence(org.hl7.fhir.r5.model.MolecularSequence src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Sequence tgt = new org.hl7.fhir.dstu3.model.Sequence(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasType()) + tgt.setType(convertSequenceType(src.getType())); + if (src.hasCoordinateSystem()) + tgt.setCoordinateSystem(src.getCoordinateSystem()); + if (src.hasPatient()) + tgt.setPatient(convertReference(src.getPatient())); + if (src.hasSpecimen()) + tgt.setSpecimen(convertReference(src.getSpecimen())); + if (src.hasDevice()) + tgt.setDevice(convertReference(src.getDevice())); + if (src.hasPerformer()) + tgt.setPerformer(convertReference(src.getPerformer())); + if (src.hasQuantity()) + tgt.setQuantity(convertQuantity(src.getQuantity())); + if (src.hasReferenceSeq()) + tgt.setReferenceSeq(convertSequenceReferenceSeqComponent(src.getReferenceSeq())); + for (org.hl7.fhir.r5.model.MolecularSequence.MolecularSequenceVariantComponent t : src.getVariant()) + tgt.addVariant(convertSequenceVariantComponent(t)); + if (src.hasObservedSeq()) + tgt.setObservedSeq(src.getObservedSeq()); + for (org.hl7.fhir.r5.model.MolecularSequence.MolecularSequenceQualityComponent t : src.getQuality()) + tgt.addQuality(convertSequenceQualityComponent(t)); + if (src.hasReadCoverage()) + tgt.setReadCoverage(src.getReadCoverage()); + for (org.hl7.fhir.r5.model.MolecularSequence.MolecularSequenceRepositoryComponent t : src.getRepository()) + tgt.addRepository(convertSequenceRepositoryComponent(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getPointer()) + tgt.addPointer(convertReference(t)); + return tgt; + } + + private static org.hl7.fhir.r5.model.MolecularSequence.SequenceType convertSequenceType(org.hl7.fhir.dstu3.model.Sequence.SequenceType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case AA: return org.hl7.fhir.r5.model.MolecularSequence.SequenceType.AA; + case DNA: return org.hl7.fhir.r5.model.MolecularSequence.SequenceType.DNA; + case RNA: return org.hl7.fhir.r5.model.MolecularSequence.SequenceType.RNA; + default: return org.hl7.fhir.r5.model.MolecularSequence.SequenceType.NULL; + } +} + + private static org.hl7.fhir.dstu3.model.Sequence.SequenceType convertSequenceType(org.hl7.fhir.r5.model.MolecularSequence.SequenceType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case AA: return org.hl7.fhir.dstu3.model.Sequence.SequenceType.AA; + case DNA: return org.hl7.fhir.dstu3.model.Sequence.SequenceType.DNA; + case RNA: return org.hl7.fhir.dstu3.model.Sequence.SequenceType.RNA; + default: return org.hl7.fhir.dstu3.model.Sequence.SequenceType.NULL; + } +} + + public static org.hl7.fhir.r5.model.MolecularSequence.MolecularSequenceReferenceSeqComponent convertSequenceReferenceSeqComponent(org.hl7.fhir.dstu3.model.Sequence.SequenceReferenceSeqComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.MolecularSequence.MolecularSequenceReferenceSeqComponent tgt = new org.hl7.fhir.r5.model.MolecularSequence.MolecularSequenceReferenceSeqComponent(); + copyElement(src, tgt); + if (src.hasChromosome()) + tgt.setChromosome(convertCodeableConcept(src.getChromosome())); + if (src.hasGenomeBuild()) + tgt.setGenomeBuild(src.getGenomeBuild()); + if (src.hasReferenceSeqId()) + tgt.setReferenceSeqId(convertCodeableConcept(src.getReferenceSeqId())); + if (src.hasReferenceSeqPointer()) + tgt.setReferenceSeqPointer(convertReference(src.getReferenceSeqPointer())); + if (src.hasReferenceSeqString()) + tgt.setReferenceSeqString(src.getReferenceSeqString()); +// if (src.hasStrand()) +// tgt.setStrand(src.getStrand()); + if (src.hasWindowStart()) + tgt.setWindowStart(src.getWindowStart()); + if (src.hasWindowEnd()) + tgt.setWindowEnd(src.getWindowEnd()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Sequence.SequenceReferenceSeqComponent convertSequenceReferenceSeqComponent(org.hl7.fhir.r5.model.MolecularSequence.MolecularSequenceReferenceSeqComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Sequence.SequenceReferenceSeqComponent tgt = new org.hl7.fhir.dstu3.model.Sequence.SequenceReferenceSeqComponent(); + copyElement(src, tgt); + if (src.hasChromosome()) + tgt.setChromosome(convertCodeableConcept(src.getChromosome())); + if (src.hasGenomeBuild()) + tgt.setGenomeBuild(src.getGenomeBuild()); + if (src.hasReferenceSeqId()) + tgt.setReferenceSeqId(convertCodeableConcept(src.getReferenceSeqId())); + if (src.hasReferenceSeqPointer()) + tgt.setReferenceSeqPointer(convertReference(src.getReferenceSeqPointer())); + if (src.hasReferenceSeqString()) + tgt.setReferenceSeqString(src.getReferenceSeqString()); +// if (src.hasStrand()) +// tgt.setStrand(src.getStrand()); + if (src.hasWindowStart()) + tgt.setWindowStart(src.getWindowStart()); + if (src.hasWindowEnd()) + tgt.setWindowEnd(src.getWindowEnd()); + return tgt; + } + + public static org.hl7.fhir.r5.model.MolecularSequence.MolecularSequenceVariantComponent convertSequenceVariantComponent(org.hl7.fhir.dstu3.model.Sequence.SequenceVariantComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.MolecularSequence.MolecularSequenceVariantComponent tgt = new org.hl7.fhir.r5.model.MolecularSequence.MolecularSequenceVariantComponent(); + copyElement(src, tgt); + if (src.hasStart()) + tgt.setStart(src.getStart()); + if (src.hasEnd()) + tgt.setEnd(src.getEnd()); + if (src.hasObservedAllele()) + tgt.setObservedAllele(src.getObservedAllele()); + if (src.hasReferenceAllele()) + tgt.setReferenceAllele(src.getReferenceAllele()); + if (src.hasCigar()) + tgt.setCigar(src.getCigar()); + if (src.hasVariantPointer()) + tgt.setVariantPointer(convertReference(src.getVariantPointer())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Sequence.SequenceVariantComponent convertSequenceVariantComponent(org.hl7.fhir.r5.model.MolecularSequence.MolecularSequenceVariantComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Sequence.SequenceVariantComponent tgt = new org.hl7.fhir.dstu3.model.Sequence.SequenceVariantComponent(); + copyElement(src, tgt); + if (src.hasStart()) + tgt.setStart(src.getStart()); + if (src.hasEnd()) + tgt.setEnd(src.getEnd()); + if (src.hasObservedAllele()) + tgt.setObservedAllele(src.getObservedAllele()); + if (src.hasReferenceAllele()) + tgt.setReferenceAllele(src.getReferenceAllele()); + if (src.hasCigar()) + tgt.setCigar(src.getCigar()); + if (src.hasVariantPointer()) + tgt.setVariantPointer(convertReference(src.getVariantPointer())); + return tgt; + } + + public static org.hl7.fhir.r5.model.MolecularSequence.MolecularSequenceQualityComponent convertSequenceQualityComponent(org.hl7.fhir.dstu3.model.Sequence.SequenceQualityComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.MolecularSequence.MolecularSequenceQualityComponent tgt = new org.hl7.fhir.r5.model.MolecularSequence.MolecularSequenceQualityComponent(); + copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertQualityType(src.getType())); + if (src.hasStandardSequence()) + tgt.setStandardSequence(convertCodeableConcept(src.getStandardSequence())); + if (src.hasStart()) + tgt.setStart(src.getStart()); + if (src.hasEnd()) + tgt.setEnd(src.getEnd()); + if (src.hasScore()) + tgt.setScore(convertQuantity(src.getScore())); + if (src.hasMethod()) + tgt.setMethod(convertCodeableConcept(src.getMethod())); + if (src.hasTruthTP()) + tgt.setTruthTP(src.getTruthTP()); + if (src.hasQueryTP()) + tgt.setQueryTP(src.getQueryTP()); + if (src.hasTruthFN()) + tgt.setTruthFN(src.getTruthFN()); + if (src.hasQueryFP()) + tgt.setQueryFP(src.getQueryFP()); + if (src.hasGtFP()) + tgt.setGtFP(src.getGtFP()); + if (src.hasPrecision()) + tgt.setPrecision(src.getPrecision()); + if (src.hasRecall()) + tgt.setRecall(src.getRecall()); + if (src.hasFScore()) + tgt.setFScore(src.getFScore()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Sequence.SequenceQualityComponent convertSequenceQualityComponent(org.hl7.fhir.r5.model.MolecularSequence.MolecularSequenceQualityComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Sequence.SequenceQualityComponent tgt = new org.hl7.fhir.dstu3.model.Sequence.SequenceQualityComponent(); + copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertQualityType(src.getType())); + if (src.hasStandardSequence()) + tgt.setStandardSequence(convertCodeableConcept(src.getStandardSequence())); + if (src.hasStart()) + tgt.setStart(src.getStart()); + if (src.hasEnd()) + tgt.setEnd(src.getEnd()); + if (src.hasScore()) + tgt.setScore(convertQuantity(src.getScore())); + if (src.hasMethod()) + tgt.setMethod(convertCodeableConcept(src.getMethod())); + if (src.hasTruthTP()) + tgt.setTruthTP(src.getTruthTP()); + if (src.hasQueryTP()) + tgt.setQueryTP(src.getQueryTP()); + if (src.hasTruthFN()) + tgt.setTruthFN(src.getTruthFN()); + if (src.hasQueryFP()) + tgt.setQueryFP(src.getQueryFP()); + if (src.hasGtFP()) + tgt.setGtFP(src.getGtFP()); + if (src.hasPrecision()) + tgt.setPrecision(src.getPrecision()); + if (src.hasRecall()) + tgt.setRecall(src.getRecall()); + if (src.hasFScore()) + tgt.setFScore(src.getFScore()); + return tgt; + } + + private static org.hl7.fhir.r5.model.MolecularSequence.QualityType convertQualityType(org.hl7.fhir.dstu3.model.Sequence.QualityType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case INDEL: return org.hl7.fhir.r5.model.MolecularSequence.QualityType.INDEL; + case SNP: return org.hl7.fhir.r5.model.MolecularSequence.QualityType.SNP; + case UNKNOWN: return org.hl7.fhir.r5.model.MolecularSequence.QualityType.UNKNOWN; + default: return org.hl7.fhir.r5.model.MolecularSequence.QualityType.NULL; + } +} + + private static org.hl7.fhir.dstu3.model.Sequence.QualityType convertQualityType(org.hl7.fhir.r5.model.MolecularSequence.QualityType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case INDEL: return org.hl7.fhir.dstu3.model.Sequence.QualityType.INDEL; + case SNP: return org.hl7.fhir.dstu3.model.Sequence.QualityType.SNP; + case UNKNOWN: return org.hl7.fhir.dstu3.model.Sequence.QualityType.UNKNOWN; + default: return org.hl7.fhir.dstu3.model.Sequence.QualityType.NULL; + } +} + + public static org.hl7.fhir.r5.model.MolecularSequence.MolecularSequenceRepositoryComponent convertSequenceRepositoryComponent(org.hl7.fhir.dstu3.model.Sequence.SequenceRepositoryComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.MolecularSequence.MolecularSequenceRepositoryComponent tgt = new org.hl7.fhir.r5.model.MolecularSequence.MolecularSequenceRepositoryComponent(); + copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertRepositoryType(src.getType())); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasDatasetId()) + tgt.setDatasetId(src.getDatasetId()); + if (src.hasVariantsetId()) + tgt.setVariantsetId(src.getVariantsetId()); + if (src.hasReadsetId()) + tgt.setReadsetId(src.getReadsetId()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Sequence.SequenceRepositoryComponent convertSequenceRepositoryComponent(org.hl7.fhir.r5.model.MolecularSequence.MolecularSequenceRepositoryComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Sequence.SequenceRepositoryComponent tgt = new org.hl7.fhir.dstu3.model.Sequence.SequenceRepositoryComponent(); + copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertRepositoryType(src.getType())); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasDatasetId()) + tgt.setDatasetId(src.getDatasetId()); + if (src.hasVariantsetId()) + tgt.setVariantsetId(src.getVariantsetId()); + if (src.hasReadsetId()) + tgt.setReadsetId(src.getReadsetId()); + return tgt; + } + + private static org.hl7.fhir.r5.model.MolecularSequence.RepositoryType convertRepositoryType(org.hl7.fhir.dstu3.model.Sequence.RepositoryType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case DIRECTLINK: return org.hl7.fhir.r5.model.MolecularSequence.RepositoryType.DIRECTLINK; + case OPENAPI: return org.hl7.fhir.r5.model.MolecularSequence.RepositoryType.OPENAPI; + case LOGIN: return org.hl7.fhir.r5.model.MolecularSequence.RepositoryType.LOGIN; + case OAUTH: return org.hl7.fhir.r5.model.MolecularSequence.RepositoryType.OAUTH; + case OTHER: return org.hl7.fhir.r5.model.MolecularSequence.RepositoryType.OTHER; + default: return org.hl7.fhir.r5.model.MolecularSequence.RepositoryType.NULL; + } +} + + private static org.hl7.fhir.dstu3.model.Sequence.RepositoryType convertRepositoryType(org.hl7.fhir.r5.model.MolecularSequence.RepositoryType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case DIRECTLINK: return org.hl7.fhir.dstu3.model.Sequence.RepositoryType.DIRECTLINK; + case OPENAPI: return org.hl7.fhir.dstu3.model.Sequence.RepositoryType.OPENAPI; + case LOGIN: return org.hl7.fhir.dstu3.model.Sequence.RepositoryType.LOGIN; + case OAUTH: return org.hl7.fhir.dstu3.model.Sequence.RepositoryType.OAUTH; + case OTHER: return org.hl7.fhir.dstu3.model.Sequence.RepositoryType.OTHER; + default: return org.hl7.fhir.dstu3.model.Sequence.RepositoryType.NULL; + } +} + + public static org.hl7.fhir.r5.model.Slot convertSlot(org.hl7.fhir.dstu3.model.Slot src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Slot tgt = new org.hl7.fhir.r5.model.Slot(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasServiceCategory()) + tgt.addServiceCategory(convertCodeableConcept(src.getServiceCategory())); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getServiceType()) + tgt.addServiceType(convertCodeableConcept(t)); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getSpecialty()) + tgt.addSpecialty(convertCodeableConcept(t)); + if (src.hasAppointmentType()) + tgt.setAppointmentType(convertCodeableConcept(src.getAppointmentType())); + if (src.hasSchedule()) + tgt.setSchedule(convertReference(src.getSchedule())); + if (src.hasStatus()) + tgt.setStatus(convertSlotStatus(src.getStatus())); + if (src.hasStart()) + tgt.setStart(src.getStart()); + if (src.hasEnd()) + tgt.setEnd(src.getEnd()); + if (src.hasOverbooked()) + tgt.setOverbooked(src.getOverbooked()); + if (src.hasComment()) + tgt.setComment(src.getComment()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Slot convertSlot(org.hl7.fhir.r5.model.Slot src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Slot tgt = new org.hl7.fhir.dstu3.model.Slot(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasServiceCategory()) + tgt.setServiceCategory(convertCodeableConcept(src.getServiceCategoryFirstRep())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getServiceType()) + tgt.addServiceType(convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getSpecialty()) + tgt.addSpecialty(convertCodeableConcept(t)); + if (src.hasAppointmentType()) + tgt.setAppointmentType(convertCodeableConcept(src.getAppointmentType())); + if (src.hasSchedule()) + tgt.setSchedule(convertReference(src.getSchedule())); + if (src.hasStatus()) + tgt.setStatus(convertSlotStatus(src.getStatus())); + if (src.hasStart()) + tgt.setStart(src.getStart()); + if (src.hasEnd()) + tgt.setEnd(src.getEnd()); + if (src.hasOverbooked()) + tgt.setOverbooked(src.getOverbooked()); + if (src.hasComment()) + tgt.setComment(src.getComment()); + return tgt; + } + + private static org.hl7.fhir.r5.model.Slot.SlotStatus convertSlotStatus(org.hl7.fhir.dstu3.model.Slot.SlotStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case BUSY: return org.hl7.fhir.r5.model.Slot.SlotStatus.BUSY; + case FREE: return org.hl7.fhir.r5.model.Slot.SlotStatus.FREE; + case BUSYUNAVAILABLE: return org.hl7.fhir.r5.model.Slot.SlotStatus.BUSYUNAVAILABLE; + case BUSYTENTATIVE: return org.hl7.fhir.r5.model.Slot.SlotStatus.BUSYTENTATIVE; + case ENTEREDINERROR: return org.hl7.fhir.r5.model.Slot.SlotStatus.ENTEREDINERROR; + default: return org.hl7.fhir.r5.model.Slot.SlotStatus.NULL; + } +} + + private static org.hl7.fhir.dstu3.model.Slot.SlotStatus convertSlotStatus(org.hl7.fhir.r5.model.Slot.SlotStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case BUSY: return org.hl7.fhir.dstu3.model.Slot.SlotStatus.BUSY; + case FREE: return org.hl7.fhir.dstu3.model.Slot.SlotStatus.FREE; + case BUSYUNAVAILABLE: return org.hl7.fhir.dstu3.model.Slot.SlotStatus.BUSYUNAVAILABLE; + case BUSYTENTATIVE: return org.hl7.fhir.dstu3.model.Slot.SlotStatus.BUSYTENTATIVE; + case ENTEREDINERROR: return org.hl7.fhir.dstu3.model.Slot.SlotStatus.ENTEREDINERROR; + default: return org.hl7.fhir.dstu3.model.Slot.SlotStatus.NULL; + } +} + + public static org.hl7.fhir.r5.model.Specimen convertSpecimen(org.hl7.fhir.dstu3.model.Specimen src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Specimen tgt = new org.hl7.fhir.r5.model.Specimen(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasAccessionIdentifier()) + tgt.setAccessionIdentifier(convertIdentifier(src.getAccessionIdentifier())); + if (src.hasStatus()) + tgt.setStatus(convertSpecimenStatus(src.getStatus())); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + if (src.hasSubject()) + tgt.setSubject(convertReference(src.getSubject())); + if (src.hasReceivedTime()) + tgt.setReceivedTime(src.getReceivedTime()); + for (org.hl7.fhir.dstu3.model.Reference t : src.getParent()) + tgt.addParent(convertReference(t)); + for (org.hl7.fhir.dstu3.model.Reference t : src.getRequest()) + tgt.addRequest(convertReference(t)); + if (src.hasCollection()) + tgt.setCollection(convertSpecimenCollectionComponent(src.getCollection())); + for (org.hl7.fhir.dstu3.model.Specimen.SpecimenProcessingComponent t : src.getProcessing()) + tgt.addProcessing(convertSpecimenProcessingComponent(t)); + for (org.hl7.fhir.dstu3.model.Specimen.SpecimenContainerComponent t : src.getContainer()) + tgt.addContainer(convertSpecimenContainerComponent(t)); + for (org.hl7.fhir.dstu3.model.Annotation t : src.getNote()) + tgt.addNote(convertAnnotation(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Specimen convertSpecimen(org.hl7.fhir.r5.model.Specimen src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Specimen tgt = new org.hl7.fhir.dstu3.model.Specimen(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasAccessionIdentifier()) + tgt.setAccessionIdentifier(convertIdentifier(src.getAccessionIdentifier())); + if (src.hasStatus()) + tgt.setStatus(convertSpecimenStatus(src.getStatus())); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + if (src.hasSubject()) + tgt.setSubject(convertReference(src.getSubject())); + if (src.hasReceivedTime()) + tgt.setReceivedTime(src.getReceivedTime()); + for (org.hl7.fhir.r5.model.Reference t : src.getParent()) + tgt.addParent(convertReference(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getRequest()) + tgt.addRequest(convertReference(t)); + if (src.hasCollection()) + tgt.setCollection(convertSpecimenCollectionComponent(src.getCollection())); + for (org.hl7.fhir.r5.model.Specimen.SpecimenProcessingComponent t : src.getProcessing()) + tgt.addProcessing(convertSpecimenProcessingComponent(t)); + for (org.hl7.fhir.r5.model.Specimen.SpecimenContainerComponent t : src.getContainer()) + tgt.addContainer(convertSpecimenContainerComponent(t)); + for (org.hl7.fhir.r5.model.Annotation t : src.getNote()) + tgt.addNote(convertAnnotation(t)); + return tgt; + } + + private static org.hl7.fhir.r5.model.Specimen.SpecimenStatus convertSpecimenStatus(org.hl7.fhir.dstu3.model.Specimen.SpecimenStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case AVAILABLE: return org.hl7.fhir.r5.model.Specimen.SpecimenStatus.AVAILABLE; + case UNAVAILABLE: return org.hl7.fhir.r5.model.Specimen.SpecimenStatus.UNAVAILABLE; + case UNSATISFACTORY: return org.hl7.fhir.r5.model.Specimen.SpecimenStatus.UNSATISFACTORY; + case ENTEREDINERROR: return org.hl7.fhir.r5.model.Specimen.SpecimenStatus.ENTEREDINERROR; + default: return org.hl7.fhir.r5.model.Specimen.SpecimenStatus.NULL; + } +} + + private static org.hl7.fhir.dstu3.model.Specimen.SpecimenStatus convertSpecimenStatus(org.hl7.fhir.r5.model.Specimen.SpecimenStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case AVAILABLE: return org.hl7.fhir.dstu3.model.Specimen.SpecimenStatus.AVAILABLE; + case UNAVAILABLE: return org.hl7.fhir.dstu3.model.Specimen.SpecimenStatus.UNAVAILABLE; + case UNSATISFACTORY: return org.hl7.fhir.dstu3.model.Specimen.SpecimenStatus.UNSATISFACTORY; + case ENTEREDINERROR: return org.hl7.fhir.dstu3.model.Specimen.SpecimenStatus.ENTEREDINERROR; + default: return org.hl7.fhir.dstu3.model.Specimen.SpecimenStatus.NULL; + } +} + + public static org.hl7.fhir.r5.model.Specimen.SpecimenCollectionComponent convertSpecimenCollectionComponent(org.hl7.fhir.dstu3.model.Specimen.SpecimenCollectionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Specimen.SpecimenCollectionComponent tgt = new org.hl7.fhir.r5.model.Specimen.SpecimenCollectionComponent(); + copyElement(src, tgt); + if (src.hasCollector()) + tgt.setCollector(convertReference(src.getCollector())); + if (src.hasCollected()) + tgt.setCollected(convertType(src.getCollected())); + if (src.hasQuantity()) + tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); + if (src.hasMethod()) + tgt.setMethod(convertCodeableConcept(src.getMethod())); + if (src.hasBodySite()) + tgt.setBodySite(convertCodeableConcept(src.getBodySite())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Specimen.SpecimenCollectionComponent convertSpecimenCollectionComponent(org.hl7.fhir.r5.model.Specimen.SpecimenCollectionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Specimen.SpecimenCollectionComponent tgt = new org.hl7.fhir.dstu3.model.Specimen.SpecimenCollectionComponent(); + copyElement(src, tgt); + if (src.hasCollector()) + tgt.setCollector(convertReference(src.getCollector())); + if (src.hasCollected()) + tgt.setCollected(convertType(src.getCollected())); + if (src.hasQuantity()) + tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); + if (src.hasMethod()) + tgt.setMethod(convertCodeableConcept(src.getMethod())); + if (src.hasBodySite()) + tgt.setBodySite(convertCodeableConcept(src.getBodySite())); + return tgt; + } + + public static org.hl7.fhir.r5.model.Specimen.SpecimenProcessingComponent convertSpecimenProcessingComponent(org.hl7.fhir.dstu3.model.Specimen.SpecimenProcessingComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Specimen.SpecimenProcessingComponent tgt = new org.hl7.fhir.r5.model.Specimen.SpecimenProcessingComponent(); + copyElement(src, tgt); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + if (src.hasProcedure()) + tgt.setProcedure(convertCodeableConcept(src.getProcedure())); + for (org.hl7.fhir.dstu3.model.Reference t : src.getAdditive()) + tgt.addAdditive(convertReference(t)); + if (src.hasTime()) + tgt.setTime(convertType(src.getTime())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Specimen.SpecimenProcessingComponent convertSpecimenProcessingComponent(org.hl7.fhir.r5.model.Specimen.SpecimenProcessingComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Specimen.SpecimenProcessingComponent tgt = new org.hl7.fhir.dstu3.model.Specimen.SpecimenProcessingComponent(); + copyElement(src, tgt); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + if (src.hasProcedure()) + tgt.setProcedure(convertCodeableConcept(src.getProcedure())); + for (org.hl7.fhir.r5.model.Reference t : src.getAdditive()) + tgt.addAdditive(convertReference(t)); + if (src.hasTime()) + tgt.setTime(convertType(src.getTime())); + return tgt; + } + + public static org.hl7.fhir.r5.model.Specimen.SpecimenContainerComponent convertSpecimenContainerComponent(org.hl7.fhir.dstu3.model.Specimen.SpecimenContainerComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Specimen.SpecimenContainerComponent tgt = new org.hl7.fhir.r5.model.Specimen.SpecimenContainerComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + if (src.hasCapacity()) + tgt.setCapacity(convertSimpleQuantity(src.getCapacity())); + if (src.hasSpecimenQuantity()) + tgt.setSpecimenQuantity(convertSimpleQuantity(src.getSpecimenQuantity())); + if (src.hasAdditive()) + tgt.setAdditive(convertType(src.getAdditive())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Specimen.SpecimenContainerComponent convertSpecimenContainerComponent(org.hl7.fhir.r5.model.Specimen.SpecimenContainerComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Specimen.SpecimenContainerComponent tgt = new org.hl7.fhir.dstu3.model.Specimen.SpecimenContainerComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + if (src.hasCapacity()) + tgt.setCapacity(convertSimpleQuantity(src.getCapacity())); + if (src.hasSpecimenQuantity()) + tgt.setSpecimenQuantity(convertSimpleQuantity(src.getSpecimenQuantity())); + if (src.hasAdditive()) + tgt.setAdditive(convertType(src.getAdditive())); + return tgt; + } + + public static org.hl7.fhir.r5.model.StructureDefinition convertStructureDefinition(org.hl7.fhir.dstu3.model.StructureDefinition src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.StructureDefinition tgt = new org.hl7.fhir.r5.model.StructureDefinition(); + copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasTitle()) + tgt.setTitle(src.getTitle()); + if (src.hasStatus()) + tgt.setStatus(convertPublicationStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) + tgt.addContact(convertContactDetail(t)); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu3.model.UsageContext t : src.getUseContext()) + tgt.addUseContext(convertUsageContext(t)); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction()) + tgt.addJurisdiction(convertCodeableConcept(t)); + if (src.hasPurpose()) + tgt.setPurpose(src.getPurpose()); + if (src.hasCopyright()) + tgt.setCopyright(src.getCopyright()); + for (org.hl7.fhir.dstu3.model.Coding t : src.getKeyword()) + tgt.addKeyword(convertCoding(t)); + if (src.hasFhirVersion()) + tgt.setFhirVersion(org.hl7.fhir.r5.model.Enumerations.FHIRVersion.fromCode(src.getFhirVersion())); + for (org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionMappingComponent t : src.getMapping()) + tgt.addMapping(convertStructureDefinitionMappingComponent(t)); + if (src.hasKind()) + tgt.setKind(convertStructureDefinitionKind(src.getKind())); + if (src.hasAbstract()) + tgt.setAbstract(src.getAbstract()); + for (org.hl7.fhir.dstu3.model.StringType t : src.getContext()) { + org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionContextComponent ec = tgt.addContext(); + ec.setType(convertExtensionContext(src.getContextType())); + ec.setExpression(t.getValue()); + } + for (org.hl7.fhir.dstu3.model.StringType t : src.getContextInvariant()) + tgt.addContextInvariant(t.getValue()); + if (src.hasType()) + tgt.setType(src.getType()); + if (src.hasBaseDefinition()) + tgt.setBaseDefinition(src.getBaseDefinition()); + if (src.hasDerivation()) + tgt.setDerivation(convertTypeDerivationRule(src.getDerivation())); + if (src.hasSnapshot()) + tgt.setSnapshot(convertStructureDefinitionSnapshotComponent(src.getSnapshot())); + if (src.hasDifferential()) + tgt.setDifferential(convertStructureDefinitionDifferentialComponent(src.getDifferential())); + if (tgt.getDerivation() == org.hl7.fhir.r5.model.StructureDefinition.TypeDerivationRule.SPECIALIZATION) { + for (org.hl7.fhir.r5.model.ElementDefinition ed : tgt.getSnapshot().getElement()) { + if (!ed.hasBase()) { + ed.getBase().setPath(ed.getPath()).setMin(ed.getMin()).setMax(ed.getMax()); + } + } + } + return tgt; + } + + public static org.hl7.fhir.dstu3.model.StructureDefinition convertStructureDefinition(org.hl7.fhir.r5.model.StructureDefinition src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.StructureDefinition tgt = new org.hl7.fhir.dstu3.model.StructureDefinition(); + copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasTitle()) + tgt.setTitle(src.getTitle()); + if (src.hasStatus()) + tgt.setStatus(convertPublicationStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.r5.model.ContactDetail t : src.getContact()) + tgt.addContact(convertContactDetail(t)); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.r5.model.UsageContext t : src.getUseContext()) + tgt.addUseContext(convertUsageContext(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getJurisdiction()) + tgt.addJurisdiction(convertCodeableConcept(t)); + if (src.hasPurpose()) + tgt.setPurpose(src.getPurpose()); + if (src.hasCopyright()) + tgt.setCopyright(src.getCopyright()); + for (org.hl7.fhir.r5.model.Coding t : src.getKeyword()) + tgt.addKeyword(convertCoding(t)); + if (src.hasFhirVersion()) + tgt.setFhirVersion(src.getFhirVersion().toCode()); + for (org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionMappingComponent t : src.getMapping()) + tgt.addMapping(convertStructureDefinitionMappingComponent(t)); + if (src.hasKind()) + tgt.setKind(convertStructureDefinitionKind(src.getKind())); + if (src.hasAbstract()) + tgt.setAbstract(src.getAbstract()); + for (org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionContextComponent t : src.getContext()) { + if (!tgt.hasContextType()) + tgt.setContextType(convertExtensionContext(t.getType())); + tgt.addContext(t.getExpression()); + } + for (org.hl7.fhir.r5.model.StringType t : src.getContextInvariant()) + tgt.addContextInvariant(t.getValue()); + if (src.hasType()) + tgt.setType(src.getType()); + if (src.hasBaseDefinition()) + tgt.setBaseDefinition(src.getBaseDefinition()); + if (src.hasDerivation()) + tgt.setDerivation(convertTypeDerivationRule(src.getDerivation())); + if (src.hasSnapshot()) + tgt.setSnapshot(convertStructureDefinitionSnapshotComponent(src.getSnapshot())); + if (src.hasDifferential()) + tgt.setDifferential(convertStructureDefinitionDifferentialComponent(src.getDifferential())); + return tgt; + } + + private static org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionKind convertStructureDefinitionKind(org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionKind src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PRIMITIVETYPE: return org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionKind.PRIMITIVETYPE; + case COMPLEXTYPE: return org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionKind.COMPLEXTYPE; + case RESOURCE: return org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionKind.RESOURCE; + case LOGICAL: return org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionKind.LOGICAL; + default: return org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionKind.NULL; + } +} + + private static org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionKind convertStructureDefinitionKind(org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionKind src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PRIMITIVETYPE: return org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionKind.PRIMITIVETYPE; + case COMPLEXTYPE: return org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionKind.COMPLEXTYPE; + case RESOURCE: return org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionKind.RESOURCE; + case LOGICAL: return org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionKind.LOGICAL; + default: return org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionKind.NULL; + } +} + + private static org.hl7.fhir.r5.model.StructureDefinition.ExtensionContextType convertExtensionContext(org.hl7.fhir.dstu3.model.StructureDefinition.ExtensionContext src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case RESOURCE: return org.hl7.fhir.r5.model.StructureDefinition.ExtensionContextType.FHIRPATH; + case DATATYPE: return org.hl7.fhir.r5.model.StructureDefinition.ExtensionContextType.ELEMENT; + case EXTENSION: return org.hl7.fhir.r5.model.StructureDefinition.ExtensionContextType.EXTENSION; + default: return org.hl7.fhir.r5.model.StructureDefinition.ExtensionContextType.NULL; + } + } + + private static org.hl7.fhir.dstu3.model.StructureDefinition.ExtensionContext convertExtensionContext(org.hl7.fhir.r5.model.StructureDefinition.ExtensionContextType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case FHIRPATH: return org.hl7.fhir.dstu3.model.StructureDefinition.ExtensionContext.RESOURCE; + case ELEMENT: return org.hl7.fhir.dstu3.model.StructureDefinition.ExtensionContext.DATATYPE; + case EXTENSION: return org.hl7.fhir.dstu3.model.StructureDefinition.ExtensionContext.EXTENSION; + default: return org.hl7.fhir.dstu3.model.StructureDefinition.ExtensionContext.NULL; + } + } + + + private static org.hl7.fhir.r5.model.StructureDefinition.TypeDerivationRule convertTypeDerivationRule(org.hl7.fhir.dstu3.model.StructureDefinition.TypeDerivationRule src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case SPECIALIZATION: return org.hl7.fhir.r5.model.StructureDefinition.TypeDerivationRule.SPECIALIZATION; + case CONSTRAINT: return org.hl7.fhir.r5.model.StructureDefinition.TypeDerivationRule.CONSTRAINT; + default: return org.hl7.fhir.r5.model.StructureDefinition.TypeDerivationRule.NULL; + } +} + + private static org.hl7.fhir.dstu3.model.StructureDefinition.TypeDerivationRule convertTypeDerivationRule(org.hl7.fhir.r5.model.StructureDefinition.TypeDerivationRule src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case SPECIALIZATION: return org.hl7.fhir.dstu3.model.StructureDefinition.TypeDerivationRule.SPECIALIZATION; + case CONSTRAINT: return org.hl7.fhir.dstu3.model.StructureDefinition.TypeDerivationRule.CONSTRAINT; + default: return org.hl7.fhir.dstu3.model.StructureDefinition.TypeDerivationRule.NULL; + } +} + + public static org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionMappingComponent convertStructureDefinitionMappingComponent(org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionMappingComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionMappingComponent tgt = new org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionMappingComponent(); + copyElement(src, tgt); + if (src.hasIdentity()) + tgt.setIdentity(src.getIdentity()); + if (src.hasUri()) + tgt.setUri(src.getUri()); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasComment()) + tgt.setComment(src.getComment()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionMappingComponent convertStructureDefinitionMappingComponent(org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionMappingComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionMappingComponent tgt = new org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionMappingComponent(); + copyElement(src, tgt); + if (src.hasIdentity()) + tgt.setIdentity(src.getIdentity()); + if (src.hasUri()) + tgt.setUri(src.getUri()); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasComment()) + tgt.setComment(src.getComment()); + return tgt; + } + + public static org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionSnapshotComponent convertStructureDefinitionSnapshotComponent(org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionSnapshotComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionSnapshotComponent tgt = new org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionSnapshotComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.dstu3.model.ElementDefinition t : src.getElement()) + tgt.addElement(convertElementDefinition(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionSnapshotComponent convertStructureDefinitionSnapshotComponent(org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionSnapshotComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionSnapshotComponent tgt = new org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionSnapshotComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.r5.model.ElementDefinition t : src.getElement()) + tgt.addElement(convertElementDefinition(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionDifferentialComponent convertStructureDefinitionDifferentialComponent(org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionDifferentialComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionDifferentialComponent tgt = new org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionDifferentialComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.dstu3.model.ElementDefinition t : src.getElement()) + tgt.addElement(convertElementDefinition(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionDifferentialComponent convertStructureDefinitionDifferentialComponent(org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionDifferentialComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionDifferentialComponent tgt = new org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionDifferentialComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.r5.model.ElementDefinition t : src.getElement()) + tgt.addElement(convertElementDefinition(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.StructureMap convertStructureMap(org.hl7.fhir.dstu3.model.StructureMap src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.StructureMap tgt = new org.hl7.fhir.r5.model.StructureMap(); + copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasTitle()) + tgt.setTitle(src.getTitle()); + if (src.hasStatus()) + tgt.setStatus(convertPublicationStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) + tgt.addContact(convertContactDetail(t)); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu3.model.UsageContext t : src.getUseContext()) + tgt.addUseContext(convertUsageContext(t)); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction()) + tgt.addJurisdiction(convertCodeableConcept(t)); + if (src.hasPurpose()) + tgt.setPurpose(src.getPurpose()); + if (src.hasCopyright()) + tgt.setCopyright(src.getCopyright()); + for (org.hl7.fhir.dstu3.model.StructureMap.StructureMapStructureComponent t : src.getStructure()) + tgt.addStructure(convertStructureMapStructureComponent(t)); + for (org.hl7.fhir.dstu3.model.UriType t : src.getImport()) + tgt.addImport(t.getValue()); + for (org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupComponent t : src.getGroup()) + tgt.addGroup(convertStructureMapGroupComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.StructureMap convertStructureMap(org.hl7.fhir.r5.model.StructureMap src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.StructureMap tgt = new org.hl7.fhir.dstu3.model.StructureMap(); + copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasTitle()) + tgt.setTitle(src.getTitle()); + if (src.hasStatus()) + tgt.setStatus(convertPublicationStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.r5.model.ContactDetail t : src.getContact()) + tgt.addContact(convertContactDetail(t)); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.r5.model.UsageContext t : src.getUseContext()) + tgt.addUseContext(convertUsageContext(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getJurisdiction()) + tgt.addJurisdiction(convertCodeableConcept(t)); + if (src.hasPurpose()) + tgt.setPurpose(src.getPurpose()); + if (src.hasCopyright()) + tgt.setCopyright(src.getCopyright()); + for (org.hl7.fhir.r5.model.StructureMap.StructureMapStructureComponent t : src.getStructure()) + tgt.addStructure(convertStructureMapStructureComponent(t)); + for (org.hl7.fhir.r5.model.UriType t : src.getImport()) + tgt.addImport(t.getValue()); + for (org.hl7.fhir.r5.model.StructureMap.StructureMapGroupComponent t : src.getGroup()) + tgt.addGroup(convertStructureMapGroupComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.StructureMap.StructureMapStructureComponent convertStructureMapStructureComponent(org.hl7.fhir.dstu3.model.StructureMap.StructureMapStructureComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.StructureMap.StructureMapStructureComponent tgt = new org.hl7.fhir.r5.model.StructureMap.StructureMapStructureComponent(); + copyElement(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + if (src.hasMode()) + tgt.setMode(convertStructureMapModelMode(src.getMode())); + if (src.hasAlias()) + tgt.setAlias(src.getAlias()); + if (src.hasDocumentation()) + tgt.setDocumentation(src.getDocumentation()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.StructureMap.StructureMapStructureComponent convertStructureMapStructureComponent(org.hl7.fhir.r5.model.StructureMap.StructureMapStructureComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.StructureMap.StructureMapStructureComponent tgt = new org.hl7.fhir.dstu3.model.StructureMap.StructureMapStructureComponent(); + copyElement(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + if (src.hasMode()) + tgt.setMode(convertStructureMapModelMode(src.getMode())); + if (src.hasAlias()) + tgt.setAlias(src.getAlias()); + if (src.hasDocumentation()) + tgt.setDocumentation(src.getDocumentation()); + return tgt; + } + + private static org.hl7.fhir.r5.model.StructureMap.StructureMapModelMode convertStructureMapModelMode(org.hl7.fhir.dstu3.model.StructureMap.StructureMapModelMode src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case SOURCE: return org.hl7.fhir.r5.model.StructureMap.StructureMapModelMode.SOURCE; + case QUERIED: return org.hl7.fhir.r5.model.StructureMap.StructureMapModelMode.QUERIED; + case TARGET: return org.hl7.fhir.r5.model.StructureMap.StructureMapModelMode.TARGET; + case PRODUCED: return org.hl7.fhir.r5.model.StructureMap.StructureMapModelMode.PRODUCED; + default: return org.hl7.fhir.r5.model.StructureMap.StructureMapModelMode.NULL; + } +} + + private static org.hl7.fhir.dstu3.model.StructureMap.StructureMapModelMode convertStructureMapModelMode(org.hl7.fhir.r5.model.StructureMap.StructureMapModelMode src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case SOURCE: return org.hl7.fhir.dstu3.model.StructureMap.StructureMapModelMode.SOURCE; + case QUERIED: return org.hl7.fhir.dstu3.model.StructureMap.StructureMapModelMode.QUERIED; + case TARGET: return org.hl7.fhir.dstu3.model.StructureMap.StructureMapModelMode.TARGET; + case PRODUCED: return org.hl7.fhir.dstu3.model.StructureMap.StructureMapModelMode.PRODUCED; + default: return org.hl7.fhir.dstu3.model.StructureMap.StructureMapModelMode.NULL; + } +} + + public static org.hl7.fhir.r5.model.StructureMap.StructureMapGroupComponent convertStructureMapGroupComponent(org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.StructureMap.StructureMapGroupComponent tgt = new org.hl7.fhir.r5.model.StructureMap.StructureMapGroupComponent(); + copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasExtends()) + tgt.setExtends(src.getExtends()); + if (src.hasTypeMode()) + tgt.setTypeMode(convertStructureMapGroupTypeMode(src.getTypeMode())); + if (src.hasDocumentation()) + tgt.setDocumentation(src.getDocumentation()); + for (org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupInputComponent t : src.getInput()) + tgt.addInput(convertStructureMapGroupInputComponent(t)); + for (org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupRuleComponent t : src.getRule()) + tgt.addRule(convertStructureMapGroupRuleComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupComponent convertStructureMapGroupComponent(org.hl7.fhir.r5.model.StructureMap.StructureMapGroupComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupComponent tgt = new org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupComponent(); + copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasExtends()) + tgt.setExtends(src.getExtends()); + if (src.hasTypeMode()) + tgt.setTypeMode(convertStructureMapGroupTypeMode(src.getTypeMode())); + if (src.hasDocumentation()) + tgt.setDocumentation(src.getDocumentation()); + for (org.hl7.fhir.r5.model.StructureMap.StructureMapGroupInputComponent t : src.getInput()) + tgt.addInput(convertStructureMapGroupInputComponent(t)); + for (org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleComponent t : src.getRule()) + tgt.addRule(convertStructureMapGroupRuleComponent(t)); + return tgt; + } + + private static org.hl7.fhir.r5.model.StructureMap.StructureMapGroupTypeMode convertStructureMapGroupTypeMode(org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupTypeMode src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case NONE: return org.hl7.fhir.r5.model.StructureMap.StructureMapGroupTypeMode.NONE; + case TYPES: return org.hl7.fhir.r5.model.StructureMap.StructureMapGroupTypeMode.TYPES; + case TYPEANDTYPES: return org.hl7.fhir.r5.model.StructureMap.StructureMapGroupTypeMode.TYPEANDTYPES; + default: return org.hl7.fhir.r5.model.StructureMap.StructureMapGroupTypeMode.NULL; + } +} + + private static org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupTypeMode convertStructureMapGroupTypeMode(org.hl7.fhir.r5.model.StructureMap.StructureMapGroupTypeMode src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case NONE: return org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupTypeMode.NONE; + case TYPES: return org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupTypeMode.TYPES; + case TYPEANDTYPES: return org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupTypeMode.TYPEANDTYPES; + default: return org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupTypeMode.NULL; + } +} + + public static org.hl7.fhir.r5.model.StructureMap.StructureMapGroupInputComponent convertStructureMapGroupInputComponent(org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupInputComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.StructureMap.StructureMapGroupInputComponent tgt = new org.hl7.fhir.r5.model.StructureMap.StructureMapGroupInputComponent(); + copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasType()) + tgt.setType(src.getType()); + if (src.hasMode()) + tgt.setMode(convertStructureMapInputMode(src.getMode())); + if (src.hasDocumentation()) + tgt.setDocumentation(src.getDocumentation()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupInputComponent convertStructureMapGroupInputComponent(org.hl7.fhir.r5.model.StructureMap.StructureMapGroupInputComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupInputComponent tgt = new org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupInputComponent(); + copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasType()) + tgt.setType(src.getType()); + if (src.hasMode()) + tgt.setMode(convertStructureMapInputMode(src.getMode())); + if (src.hasDocumentation()) + tgt.setDocumentation(src.getDocumentation()); + return tgt; + } + + private static org.hl7.fhir.r5.model.StructureMap.StructureMapInputMode convertStructureMapInputMode(org.hl7.fhir.dstu3.model.StructureMap.StructureMapInputMode src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case SOURCE: return org.hl7.fhir.r5.model.StructureMap.StructureMapInputMode.SOURCE; + case TARGET: return org.hl7.fhir.r5.model.StructureMap.StructureMapInputMode.TARGET; + default: return org.hl7.fhir.r5.model.StructureMap.StructureMapInputMode.NULL; + } +} + + private static org.hl7.fhir.dstu3.model.StructureMap.StructureMapInputMode convertStructureMapInputMode(org.hl7.fhir.r5.model.StructureMap.StructureMapInputMode src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case SOURCE: return org.hl7.fhir.dstu3.model.StructureMap.StructureMapInputMode.SOURCE; + case TARGET: return org.hl7.fhir.dstu3.model.StructureMap.StructureMapInputMode.TARGET; + default: return org.hl7.fhir.dstu3.model.StructureMap.StructureMapInputMode.NULL; + } +} + + public static org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleComponent convertStructureMapGroupRuleComponent(org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupRuleComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleComponent tgt = new org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleComponent(); + copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + for (org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupRuleSourceComponent t : src.getSource()) + tgt.addSource(convertStructureMapGroupRuleSourceComponent(t)); + for (org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupRuleTargetComponent t : src.getTarget()) + tgt.addTarget(convertStructureMapGroupRuleTargetComponent(t)); + for (org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupRuleComponent t : src.getRule()) + tgt.addRule(convertStructureMapGroupRuleComponent(t)); + for (org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupRuleDependentComponent t : src.getDependent()) + tgt.addDependent(convertStructureMapGroupRuleDependentComponent(t)); + if (src.hasDocumentation()) + tgt.setDocumentation(src.getDocumentation()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupRuleComponent convertStructureMapGroupRuleComponent(org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupRuleComponent tgt = new org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupRuleComponent(); + copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + for (org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleSourceComponent t : src.getSource()) + tgt.addSource(convertStructureMapGroupRuleSourceComponent(t)); + for (org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleTargetComponent t : src.getTarget()) + tgt.addTarget(convertStructureMapGroupRuleTargetComponent(t)); + for (org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleComponent t : src.getRule()) + tgt.addRule(convertStructureMapGroupRuleComponent(t)); + for (org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleDependentComponent t : src.getDependent()) + tgt.addDependent(convertStructureMapGroupRuleDependentComponent(t)); + if (src.hasDocumentation()) + tgt.setDocumentation(src.getDocumentation()); + return tgt; + } + + public static org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleSourceComponent convertStructureMapGroupRuleSourceComponent(org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupRuleSourceComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleSourceComponent tgt = new org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleSourceComponent(); + copyElement(src, tgt); + if (src.hasContext()) + tgt.setContext(src.getContext()); + if (src.hasMin()) + tgt.setMin(src.getMin()); + if (src.hasMax()) + tgt.setMax(src.getMax()); + if (src.hasType()) + tgt.setType(src.getType()); + if (src.hasDefaultValue()) + tgt.setDefaultValue(convertType(src.getDefaultValue())); + if (src.hasElement()) + tgt.setElement(src.getElement()); + if (src.hasListMode()) + tgt.setListMode(convertStructureMapSourceListMode(src.getListMode())); + if (src.hasVariable()) + tgt.setVariable(src.getVariable()); + if (src.hasCondition()) + tgt.setCondition(src.getCondition()); + if (src.hasCheck()) + tgt.setCheck(src.getCheck()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupRuleSourceComponent convertStructureMapGroupRuleSourceComponent(org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleSourceComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupRuleSourceComponent tgt = new org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupRuleSourceComponent(); + copyElement(src, tgt); + if (src.hasContext()) + tgt.setContext(src.getContext()); + if (src.hasMin()) + tgt.setMin(src.getMin()); + if (src.hasMax()) + tgt.setMax(src.getMax()); + if (src.hasType()) + tgt.setType(src.getType()); + if (src.hasDefaultValue()) + tgt.setDefaultValue(convertType(src.getDefaultValue())); + if (src.hasElement()) + tgt.setElement(src.getElement()); + if (src.hasListMode()) + tgt.setListMode(convertStructureMapSourceListMode(src.getListMode())); + if (src.hasVariable()) + tgt.setVariable(src.getVariable()); + if (src.hasCondition()) + tgt.setCondition(src.getCondition()); + if (src.hasCheck()) + tgt.setCheck(src.getCheck()); + return tgt; + } + + private static org.hl7.fhir.r5.model.StructureMap.StructureMapSourceListMode convertStructureMapSourceListMode(org.hl7.fhir.dstu3.model.StructureMap.StructureMapSourceListMode src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case FIRST: return org.hl7.fhir.r5.model.StructureMap.StructureMapSourceListMode.FIRST; + case NOTFIRST: return org.hl7.fhir.r5.model.StructureMap.StructureMapSourceListMode.NOTFIRST; + case LAST: return org.hl7.fhir.r5.model.StructureMap.StructureMapSourceListMode.LAST; + case NOTLAST: return org.hl7.fhir.r5.model.StructureMap.StructureMapSourceListMode.NOTLAST; + case ONLYONE: return org.hl7.fhir.r5.model.StructureMap.StructureMapSourceListMode.ONLYONE; + default: return org.hl7.fhir.r5.model.StructureMap.StructureMapSourceListMode.NULL; + } +} + + private static org.hl7.fhir.dstu3.model.StructureMap.StructureMapSourceListMode convertStructureMapSourceListMode(org.hl7.fhir.r5.model.StructureMap.StructureMapSourceListMode src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case FIRST: return org.hl7.fhir.dstu3.model.StructureMap.StructureMapSourceListMode.FIRST; + case NOTFIRST: return org.hl7.fhir.dstu3.model.StructureMap.StructureMapSourceListMode.NOTFIRST; + case LAST: return org.hl7.fhir.dstu3.model.StructureMap.StructureMapSourceListMode.LAST; + case NOTLAST: return org.hl7.fhir.dstu3.model.StructureMap.StructureMapSourceListMode.NOTLAST; + case ONLYONE: return org.hl7.fhir.dstu3.model.StructureMap.StructureMapSourceListMode.ONLYONE; + default: return org.hl7.fhir.dstu3.model.StructureMap.StructureMapSourceListMode.NULL; + } +} + + public static org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleTargetComponent convertStructureMapGroupRuleTargetComponent(org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupRuleTargetComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleTargetComponent tgt = new org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleTargetComponent(); + copyElement(src, tgt); + if (src.hasContext()) + tgt.setContext(src.getContext()); + if (src.hasContextType()) + tgt.setContextType(convertStructureMapContextType(src.getContextType())); + if (src.hasElement()) + tgt.setElement(src.getElement()); + if (src.hasVariable()) + tgt.setVariable(src.getVariable()); + for (org.hl7.fhir.dstu3.model.Enumeration t : src.getListMode()) + tgt.addListMode(convertStructureMapTargetListMode(t.getValue())); + if (src.hasListRuleId()) + tgt.setListRuleId(src.getListRuleId()); + if (src.hasTransform()) + tgt.setTransform(convertStructureMapTransform(src.getTransform())); + for (org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupRuleTargetParameterComponent t : src.getParameter()) + tgt.addParameter(convertStructureMapGroupRuleTargetParameterComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupRuleTargetComponent convertStructureMapGroupRuleTargetComponent(org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleTargetComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupRuleTargetComponent tgt = new org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupRuleTargetComponent(); + copyElement(src, tgt); + if (src.hasContext()) + tgt.setContext(src.getContext()); + if (src.hasContextType()) + tgt.setContextType(convertStructureMapContextType(src.getContextType())); + if (src.hasElement()) + tgt.setElement(src.getElement()); + if (src.hasVariable()) + tgt.setVariable(src.getVariable()); + for (org.hl7.fhir.r5.model.Enumeration t : src.getListMode()) + tgt.addListMode(convertStructureMapTargetListMode(t.getValue())); + if (src.hasListRuleId()) + tgt.setListRuleId(src.getListRuleId()); + if (src.hasTransform()) + tgt.setTransform(convertStructureMapTransform(src.getTransform())); + for (org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleTargetParameterComponent t : src.getParameter()) + tgt.addParameter(convertStructureMapGroupRuleTargetParameterComponent(t)); + return tgt; + } + + private static org.hl7.fhir.r5.model.StructureMap.StructureMapContextType convertStructureMapContextType(org.hl7.fhir.dstu3.model.StructureMap.StructureMapContextType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case TYPE: return org.hl7.fhir.r5.model.StructureMap.StructureMapContextType.TYPE; + case VARIABLE: return org.hl7.fhir.r5.model.StructureMap.StructureMapContextType.VARIABLE; + default: return org.hl7.fhir.r5.model.StructureMap.StructureMapContextType.NULL; + } +} + + private static org.hl7.fhir.dstu3.model.StructureMap.StructureMapContextType convertStructureMapContextType(org.hl7.fhir.r5.model.StructureMap.StructureMapContextType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case TYPE: return org.hl7.fhir.dstu3.model.StructureMap.StructureMapContextType.TYPE; + case VARIABLE: return org.hl7.fhir.dstu3.model.StructureMap.StructureMapContextType.VARIABLE; + default: return org.hl7.fhir.dstu3.model.StructureMap.StructureMapContextType.NULL; + } +} + + private static org.hl7.fhir.r5.model.StructureMap.StructureMapTargetListMode convertStructureMapTargetListMode(org.hl7.fhir.dstu3.model.StructureMap.StructureMapTargetListMode src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case FIRST: return org.hl7.fhir.r5.model.StructureMap.StructureMapTargetListMode.FIRST; + case SHARE: return org.hl7.fhir.r5.model.StructureMap.StructureMapTargetListMode.SHARE; + case LAST: return org.hl7.fhir.r5.model.StructureMap.StructureMapTargetListMode.LAST; + case COLLATE: return org.hl7.fhir.r5.model.StructureMap.StructureMapTargetListMode.COLLATE; + default: return org.hl7.fhir.r5.model.StructureMap.StructureMapTargetListMode.NULL; + } +} + + private static org.hl7.fhir.dstu3.model.StructureMap.StructureMapTargetListMode convertStructureMapTargetListMode(org.hl7.fhir.r5.model.StructureMap.StructureMapTargetListMode src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case FIRST: return org.hl7.fhir.dstu3.model.StructureMap.StructureMapTargetListMode.FIRST; + case SHARE: return org.hl7.fhir.dstu3.model.StructureMap.StructureMapTargetListMode.SHARE; + case LAST: return org.hl7.fhir.dstu3.model.StructureMap.StructureMapTargetListMode.LAST; + case COLLATE: return org.hl7.fhir.dstu3.model.StructureMap.StructureMapTargetListMode.COLLATE; + default: return org.hl7.fhir.dstu3.model.StructureMap.StructureMapTargetListMode.NULL; + } +} + + private static org.hl7.fhir.r5.model.StructureMap.StructureMapTransform convertStructureMapTransform(org.hl7.fhir.dstu3.model.StructureMap.StructureMapTransform src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case CREATE: return org.hl7.fhir.r5.model.StructureMap.StructureMapTransform.CREATE; + case COPY: return org.hl7.fhir.r5.model.StructureMap.StructureMapTransform.COPY; + case TRUNCATE: return org.hl7.fhir.r5.model.StructureMap.StructureMapTransform.TRUNCATE; + case ESCAPE: return org.hl7.fhir.r5.model.StructureMap.StructureMapTransform.ESCAPE; + case CAST: return org.hl7.fhir.r5.model.StructureMap.StructureMapTransform.CAST; + case APPEND: return org.hl7.fhir.r5.model.StructureMap.StructureMapTransform.APPEND; + case TRANSLATE: return org.hl7.fhir.r5.model.StructureMap.StructureMapTransform.TRANSLATE; + case REFERENCE: return org.hl7.fhir.r5.model.StructureMap.StructureMapTransform.REFERENCE; + case DATEOP: return org.hl7.fhir.r5.model.StructureMap.StructureMapTransform.DATEOP; + case UUID: return org.hl7.fhir.r5.model.StructureMap.StructureMapTransform.UUID; + case POINTER: return org.hl7.fhir.r5.model.StructureMap.StructureMapTransform.POINTER; + case EVALUATE: return org.hl7.fhir.r5.model.StructureMap.StructureMapTransform.EVALUATE; + case CC: return org.hl7.fhir.r5.model.StructureMap.StructureMapTransform.CC; + case C: return org.hl7.fhir.r5.model.StructureMap.StructureMapTransform.C; + case QTY: return org.hl7.fhir.r5.model.StructureMap.StructureMapTransform.QTY; + case ID: return org.hl7.fhir.r5.model.StructureMap.StructureMapTransform.ID; + case CP: return org.hl7.fhir.r5.model.StructureMap.StructureMapTransform.CP; + default: return org.hl7.fhir.r5.model.StructureMap.StructureMapTransform.NULL; + } +} + + private static org.hl7.fhir.dstu3.model.StructureMap.StructureMapTransform convertStructureMapTransform(org.hl7.fhir.r5.model.StructureMap.StructureMapTransform src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case CREATE: return org.hl7.fhir.dstu3.model.StructureMap.StructureMapTransform.CREATE; + case COPY: return org.hl7.fhir.dstu3.model.StructureMap.StructureMapTransform.COPY; + case TRUNCATE: return org.hl7.fhir.dstu3.model.StructureMap.StructureMapTransform.TRUNCATE; + case ESCAPE: return org.hl7.fhir.dstu3.model.StructureMap.StructureMapTransform.ESCAPE; + case CAST: return org.hl7.fhir.dstu3.model.StructureMap.StructureMapTransform.CAST; + case APPEND: return org.hl7.fhir.dstu3.model.StructureMap.StructureMapTransform.APPEND; + case TRANSLATE: return org.hl7.fhir.dstu3.model.StructureMap.StructureMapTransform.TRANSLATE; + case REFERENCE: return org.hl7.fhir.dstu3.model.StructureMap.StructureMapTransform.REFERENCE; + case DATEOP: return org.hl7.fhir.dstu3.model.StructureMap.StructureMapTransform.DATEOP; + case UUID: return org.hl7.fhir.dstu3.model.StructureMap.StructureMapTransform.UUID; + case POINTER: return org.hl7.fhir.dstu3.model.StructureMap.StructureMapTransform.POINTER; + case EVALUATE: return org.hl7.fhir.dstu3.model.StructureMap.StructureMapTransform.EVALUATE; + case CC: return org.hl7.fhir.dstu3.model.StructureMap.StructureMapTransform.CC; + case C: return org.hl7.fhir.dstu3.model.StructureMap.StructureMapTransform.C; + case QTY: return org.hl7.fhir.dstu3.model.StructureMap.StructureMapTransform.QTY; + case ID: return org.hl7.fhir.dstu3.model.StructureMap.StructureMapTransform.ID; + case CP: return org.hl7.fhir.dstu3.model.StructureMap.StructureMapTransform.CP; + default: return org.hl7.fhir.dstu3.model.StructureMap.StructureMapTransform.NULL; + } +} + + public static org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleTargetParameterComponent convertStructureMapGroupRuleTargetParameterComponent(org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupRuleTargetParameterComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleTargetParameterComponent tgt = new org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleTargetParameterComponent(); + copyElement(src, tgt); + if (src.hasValue()) + tgt.setValue(convertType(src.getValue())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupRuleTargetParameterComponent convertStructureMapGroupRuleTargetParameterComponent(org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleTargetParameterComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupRuleTargetParameterComponent tgt = new org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupRuleTargetParameterComponent(); + copyElement(src, tgt); + if (src.hasValue()) + tgt.setValue(convertType(src.getValue())); + return tgt; + } + + public static org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleDependentComponent convertStructureMapGroupRuleDependentComponent(org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupRuleDependentComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleDependentComponent tgt = new org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleDependentComponent(); + copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + for (org.hl7.fhir.dstu3.model.StringType t : src.getVariable()) + tgt.addVariable(t.getValue()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupRuleDependentComponent convertStructureMapGroupRuleDependentComponent(org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleDependentComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupRuleDependentComponent tgt = new org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupRuleDependentComponent(); + copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + for (org.hl7.fhir.r5.model.StringType t : src.getVariable()) + tgt.addVariable(t.getValue()); + return tgt; + } + + public static org.hl7.fhir.r5.model.Subscription convertSubscription(org.hl7.fhir.dstu3.model.Subscription src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Subscription tgt = new org.hl7.fhir.r5.model.Subscription(); + copyDomainResource(src, tgt); + if (src.hasStatus()) + tgt.setStatus(convertSubscriptionStatus(src.getStatus())); + for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getContact()) + tgt.addContact(convertContactPoint(t)); + if (src.hasEnd()) + tgt.setEnd(src.getEnd()); + if (src.hasReason()) + tgt.setReason(src.getReason()); + if (src.hasCriteria()) + tgt.setCriteria(src.getCriteria()); + if (src.hasError()) + tgt.setError(src.getError()); + if (src.hasChannel()) + tgt.setChannel(convertSubscriptionChannelComponent(src.getChannel())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Subscription convertSubscription(org.hl7.fhir.r5.model.Subscription src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Subscription tgt = new org.hl7.fhir.dstu3.model.Subscription(); + copyDomainResource(src, tgt); + if (src.hasStatus()) + tgt.setStatus(convertSubscriptionStatus(src.getStatus())); + for (org.hl7.fhir.r5.model.ContactPoint t : src.getContact()) + tgt.addContact(convertContactPoint(t)); + if (src.hasEnd()) + tgt.setEnd(src.getEnd()); + if (src.hasReason()) + tgt.setReason(src.getReason()); + if (src.hasCriteria()) + tgt.setCriteria(src.getCriteria()); + if (src.hasError()) + tgt.setError(src.getError()); + if (src.hasChannel()) + tgt.setChannel(convertSubscriptionChannelComponent(src.getChannel())); + return tgt; + } + + private static org.hl7.fhir.r5.model.Subscription.SubscriptionStatus convertSubscriptionStatus(org.hl7.fhir.dstu3.model.Subscription.SubscriptionStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case REQUESTED: return org.hl7.fhir.r5.model.Subscription.SubscriptionStatus.REQUESTED; + case ACTIVE: return org.hl7.fhir.r5.model.Subscription.SubscriptionStatus.ACTIVE; + case ERROR: return org.hl7.fhir.r5.model.Subscription.SubscriptionStatus.ERROR; + case OFF: return org.hl7.fhir.r5.model.Subscription.SubscriptionStatus.OFF; + default: return org.hl7.fhir.r5.model.Subscription.SubscriptionStatus.NULL; + } +} + + private static org.hl7.fhir.dstu3.model.Subscription.SubscriptionStatus convertSubscriptionStatus(org.hl7.fhir.r5.model.Subscription.SubscriptionStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case REQUESTED: return org.hl7.fhir.dstu3.model.Subscription.SubscriptionStatus.REQUESTED; + case ACTIVE: return org.hl7.fhir.dstu3.model.Subscription.SubscriptionStatus.ACTIVE; + case ERROR: return org.hl7.fhir.dstu3.model.Subscription.SubscriptionStatus.ERROR; + case OFF: return org.hl7.fhir.dstu3.model.Subscription.SubscriptionStatus.OFF; + default: return org.hl7.fhir.dstu3.model.Subscription.SubscriptionStatus.NULL; + } +} + + public static org.hl7.fhir.r5.model.Subscription.SubscriptionChannelComponent convertSubscriptionChannelComponent(org.hl7.fhir.dstu3.model.Subscription.SubscriptionChannelComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Subscription.SubscriptionChannelComponent tgt = new org.hl7.fhir.r5.model.Subscription.SubscriptionChannelComponent(); + copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertSubscriptionChannelType(src.getType())); + if (src.hasEndpoint()) + tgt.setEndpoint(src.getEndpoint()); + if (src.hasPayload()) + tgt.setPayload(src.getPayload()); + for (org.hl7.fhir.dstu3.model.StringType t : src.getHeader()) + tgt.addHeader(t.getValue()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Subscription.SubscriptionChannelComponent convertSubscriptionChannelComponent(org.hl7.fhir.r5.model.Subscription.SubscriptionChannelComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Subscription.SubscriptionChannelComponent tgt = new org.hl7.fhir.dstu3.model.Subscription.SubscriptionChannelComponent(); + copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertSubscriptionChannelType(src.getType())); + if (src.hasEndpoint()) + tgt.setEndpoint(src.getEndpoint()); + if (src.hasPayload()) + tgt.setPayload(src.getPayload()); + for (org.hl7.fhir.r5.model.StringType t : src.getHeader()) + tgt.addHeader(t.getValue()); + return tgt; + } + + private static org.hl7.fhir.r5.model.Subscription.SubscriptionChannelType convertSubscriptionChannelType(org.hl7.fhir.dstu3.model.Subscription.SubscriptionChannelType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case RESTHOOK: return org.hl7.fhir.r5.model.Subscription.SubscriptionChannelType.RESTHOOK; + case WEBSOCKET: return org.hl7.fhir.r5.model.Subscription.SubscriptionChannelType.WEBSOCKET; + case EMAIL: return org.hl7.fhir.r5.model.Subscription.SubscriptionChannelType.EMAIL; + case SMS: return org.hl7.fhir.r5.model.Subscription.SubscriptionChannelType.SMS; + case MESSAGE: return org.hl7.fhir.r5.model.Subscription.SubscriptionChannelType.MESSAGE; + default: return org.hl7.fhir.r5.model.Subscription.SubscriptionChannelType.NULL; + } +} + + private static org.hl7.fhir.dstu3.model.Subscription.SubscriptionChannelType convertSubscriptionChannelType(org.hl7.fhir.r5.model.Subscription.SubscriptionChannelType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case RESTHOOK: return org.hl7.fhir.dstu3.model.Subscription.SubscriptionChannelType.RESTHOOK; + case WEBSOCKET: return org.hl7.fhir.dstu3.model.Subscription.SubscriptionChannelType.WEBSOCKET; + case EMAIL: return org.hl7.fhir.dstu3.model.Subscription.SubscriptionChannelType.EMAIL; + case SMS: return org.hl7.fhir.dstu3.model.Subscription.SubscriptionChannelType.SMS; + case MESSAGE: return org.hl7.fhir.dstu3.model.Subscription.SubscriptionChannelType.MESSAGE; + default: return org.hl7.fhir.dstu3.model.Subscription.SubscriptionChannelType.NULL; + } +} + + public static org.hl7.fhir.r5.model.Substance convertSubstance(org.hl7.fhir.dstu3.model.Substance src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Substance tgt = new org.hl7.fhir.r5.model.Substance(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasStatus()) + tgt.setStatus(convertFHIRSubstanceStatus(src.getStatus())); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getCategory()) + tgt.addCategory(convertCodeableConcept(t)); + if (src.hasCode()) + tgt.setCode(convertCodeableConcept(src.getCode())); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu3.model.Substance.SubstanceInstanceComponent t : src.getInstance()) + tgt.addInstance(convertSubstanceInstanceComponent(t)); + for (org.hl7.fhir.dstu3.model.Substance.SubstanceIngredientComponent t : src.getIngredient()) + tgt.addIngredient(convertSubstanceIngredientComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Substance convertSubstance(org.hl7.fhir.r5.model.Substance src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Substance tgt = new org.hl7.fhir.dstu3.model.Substance(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasStatus()) + tgt.setStatus(convertFHIRSubstanceStatus(src.getStatus())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getCategory()) + tgt.addCategory(convertCodeableConcept(t)); + if (src.hasCode()) + tgt.setCode(convertCodeableConcept(src.getCode())); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.r5.model.Substance.SubstanceInstanceComponent t : src.getInstance()) + tgt.addInstance(convertSubstanceInstanceComponent(t)); + for (org.hl7.fhir.r5.model.Substance.SubstanceIngredientComponent t : src.getIngredient()) + tgt.addIngredient(convertSubstanceIngredientComponent(t)); + return tgt; + } + + private static org.hl7.fhir.r5.model.Substance.FHIRSubstanceStatus convertFHIRSubstanceStatus(org.hl7.fhir.dstu3.model.Substance.FHIRSubstanceStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case ACTIVE: return org.hl7.fhir.r5.model.Substance.FHIRSubstanceStatus.ACTIVE; + case INACTIVE: return org.hl7.fhir.r5.model.Substance.FHIRSubstanceStatus.INACTIVE; + case ENTEREDINERROR: return org.hl7.fhir.r5.model.Substance.FHIRSubstanceStatus.ENTEREDINERROR; + default: return org.hl7.fhir.r5.model.Substance.FHIRSubstanceStatus.NULL; + } +} + + private static org.hl7.fhir.dstu3.model.Substance.FHIRSubstanceStatus convertFHIRSubstanceStatus(org.hl7.fhir.r5.model.Substance.FHIRSubstanceStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case ACTIVE: return org.hl7.fhir.dstu3.model.Substance.FHIRSubstanceStatus.ACTIVE; + case INACTIVE: return org.hl7.fhir.dstu3.model.Substance.FHIRSubstanceStatus.INACTIVE; + case ENTEREDINERROR: return org.hl7.fhir.dstu3.model.Substance.FHIRSubstanceStatus.ENTEREDINERROR; + default: return org.hl7.fhir.dstu3.model.Substance.FHIRSubstanceStatus.NULL; + } +} + + public static org.hl7.fhir.r5.model.Substance.SubstanceInstanceComponent convertSubstanceInstanceComponent(org.hl7.fhir.dstu3.model.Substance.SubstanceInstanceComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Substance.SubstanceInstanceComponent tgt = new org.hl7.fhir.r5.model.Substance.SubstanceInstanceComponent(); + copyElement(src, tgt); + if (src.hasIdentifier()) + tgt.setIdentifier(convertIdentifier(src.getIdentifier())); + if (src.hasExpiry()) + tgt.setExpiry(src.getExpiry()); + if (src.hasQuantity()) + tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Substance.SubstanceInstanceComponent convertSubstanceInstanceComponent(org.hl7.fhir.r5.model.Substance.SubstanceInstanceComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Substance.SubstanceInstanceComponent tgt = new org.hl7.fhir.dstu3.model.Substance.SubstanceInstanceComponent(); + copyElement(src, tgt); + if (src.hasIdentifier()) + tgt.setIdentifier(convertIdentifier(src.getIdentifier())); + if (src.hasExpiry()) + tgt.setExpiry(src.getExpiry()); + if (src.hasQuantity()) + tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); + return tgt; + } + + public static org.hl7.fhir.r5.model.Substance.SubstanceIngredientComponent convertSubstanceIngredientComponent(org.hl7.fhir.dstu3.model.Substance.SubstanceIngredientComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Substance.SubstanceIngredientComponent tgt = new org.hl7.fhir.r5.model.Substance.SubstanceIngredientComponent(); + copyElement(src, tgt); + if (src.hasQuantity()) + tgt.setQuantity(convertRatio(src.getQuantity())); + if (src.hasSubstance()) + tgt.setSubstance(convertType(src.getSubstance())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Substance.SubstanceIngredientComponent convertSubstanceIngredientComponent(org.hl7.fhir.r5.model.Substance.SubstanceIngredientComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Substance.SubstanceIngredientComponent tgt = new org.hl7.fhir.dstu3.model.Substance.SubstanceIngredientComponent(); + copyElement(src, tgt); + if (src.hasQuantity()) + tgt.setQuantity(convertRatio(src.getQuantity())); + if (src.hasSubstance()) + tgt.setSubstance(convertType(src.getSubstance())); + return tgt; + } + + public static org.hl7.fhir.r5.model.SupplyDelivery convertSupplyDelivery(org.hl7.fhir.dstu3.model.SupplyDelivery src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.SupplyDelivery tgt = new org.hl7.fhir.r5.model.SupplyDelivery(); + copyDomainResource(src, tgt); + if (src.hasIdentifier()) + tgt.addIdentifier(convertIdentifier(src.getIdentifier())); + for (org.hl7.fhir.dstu3.model.Reference t : src.getBasedOn()) + tgt.addBasedOn(convertReference(t)); + for (org.hl7.fhir.dstu3.model.Reference t : src.getPartOf()) + tgt.addPartOf(convertReference(t)); + if (src.hasStatus()) + tgt.setStatus(convertSupplyDeliveryStatus(src.getStatus())); + if (src.hasPatient()) + tgt.setPatient(convertReference(src.getPatient())); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + if (src.hasSuppliedItem()) + tgt.setSuppliedItem(convertSupplyDeliverySuppliedItemComponent(src.getSuppliedItem())); + if (src.hasOccurrence()) + tgt.setOccurrence(convertType(src.getOccurrence())); + if (src.hasSupplier()) + tgt.setSupplier(convertReference(src.getSupplier())); + if (src.hasDestination()) + tgt.setDestination(convertReference(src.getDestination())); + for (org.hl7.fhir.dstu3.model.Reference t : src.getReceiver()) + tgt.addReceiver(convertReference(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.SupplyDelivery convertSupplyDelivery(org.hl7.fhir.r5.model.SupplyDelivery src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.SupplyDelivery tgt = new org.hl7.fhir.dstu3.model.SupplyDelivery(); + copyDomainResource(src, tgt); + if (src.hasIdentifier()) + tgt.setIdentifier(convertIdentifier(src.getIdentifierFirstRep())); + for (org.hl7.fhir.r5.model.Reference t : src.getBasedOn()) + tgt.addBasedOn(convertReference(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getPartOf()) + tgt.addPartOf(convertReference(t)); + if (src.hasStatus()) + tgt.setStatus(convertSupplyDeliveryStatus(src.getStatus())); + if (src.hasPatient()) + tgt.setPatient(convertReference(src.getPatient())); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + if (src.hasSuppliedItem()) + tgt.setSuppliedItem(convertSupplyDeliverySuppliedItemComponent(src.getSuppliedItem())); + if (src.hasOccurrence()) + tgt.setOccurrence(convertType(src.getOccurrence())); + if (src.hasSupplier()) + tgt.setSupplier(convertReference(src.getSupplier())); + if (src.hasDestination()) + tgt.setDestination(convertReference(src.getDestination())); + for (org.hl7.fhir.r5.model.Reference t : src.getReceiver()) + tgt.addReceiver(convertReference(t)); + return tgt; + } + + private static org.hl7.fhir.r5.model.SupplyDelivery.SupplyDeliveryStatus convertSupplyDeliveryStatus(org.hl7.fhir.dstu3.model.SupplyDelivery.SupplyDeliveryStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case INPROGRESS: return org.hl7.fhir.r5.model.SupplyDelivery.SupplyDeliveryStatus.INPROGRESS; + case COMPLETED: return org.hl7.fhir.r5.model.SupplyDelivery.SupplyDeliveryStatus.COMPLETED; + case ABANDONED: return org.hl7.fhir.r5.model.SupplyDelivery.SupplyDeliveryStatus.ABANDONED; + case ENTEREDINERROR: return org.hl7.fhir.r5.model.SupplyDelivery.SupplyDeliveryStatus.ENTEREDINERROR; + default: return org.hl7.fhir.r5.model.SupplyDelivery.SupplyDeliveryStatus.NULL; + } +} + + private static org.hl7.fhir.dstu3.model.SupplyDelivery.SupplyDeliveryStatus convertSupplyDeliveryStatus(org.hl7.fhir.r5.model.SupplyDelivery.SupplyDeliveryStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case INPROGRESS: return org.hl7.fhir.dstu3.model.SupplyDelivery.SupplyDeliveryStatus.INPROGRESS; + case COMPLETED: return org.hl7.fhir.dstu3.model.SupplyDelivery.SupplyDeliveryStatus.COMPLETED; + case ABANDONED: return org.hl7.fhir.dstu3.model.SupplyDelivery.SupplyDeliveryStatus.ABANDONED; + case ENTEREDINERROR: return org.hl7.fhir.dstu3.model.SupplyDelivery.SupplyDeliveryStatus.ENTEREDINERROR; + default: return org.hl7.fhir.dstu3.model.SupplyDelivery.SupplyDeliveryStatus.NULL; + } +} + + public static org.hl7.fhir.r5.model.SupplyDelivery.SupplyDeliverySuppliedItemComponent convertSupplyDeliverySuppliedItemComponent(org.hl7.fhir.dstu3.model.SupplyDelivery.SupplyDeliverySuppliedItemComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.SupplyDelivery.SupplyDeliverySuppliedItemComponent tgt = new org.hl7.fhir.r5.model.SupplyDelivery.SupplyDeliverySuppliedItemComponent(); + copyElement(src, tgt); + if (src.hasQuantity()) + tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); + if (src.hasItem()) + tgt.setItem(convertType(src.getItem())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.SupplyDelivery.SupplyDeliverySuppliedItemComponent convertSupplyDeliverySuppliedItemComponent(org.hl7.fhir.r5.model.SupplyDelivery.SupplyDeliverySuppliedItemComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.SupplyDelivery.SupplyDeliverySuppliedItemComponent tgt = new org.hl7.fhir.dstu3.model.SupplyDelivery.SupplyDeliverySuppliedItemComponent(); + copyElement(src, tgt); + if (src.hasQuantity()) + tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); + if (src.hasItem()) + tgt.setItem(convertType(src.getItem())); + return tgt; + } + + + public static org.hl7.fhir.r5.model.TestReport convertTestReport(org.hl7.fhir.dstu3.model.TestReport src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.TestReport tgt = new org.hl7.fhir.r5.model.TestReport(); + copyDomainResource(src, tgt); + if (src.hasIdentifier()) + tgt.setIdentifier(convertIdentifier(src.getIdentifier())); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasStatus()) + tgt.setStatus(convertTestReportStatus(src.getStatus())); + if (src.hasTestScript()) + tgt.setTestScript(convertReference(src.getTestScript())); + if (src.hasResult()) + tgt.setResult(convertTestReportResult(src.getResult())); + if (src.hasScore()) + tgt.setScore(src.getScore()); + if (src.hasTester()) + tgt.setTester(src.getTester()); + if (src.hasIssued()) + tgt.setIssued(src.getIssued()); + for (org.hl7.fhir.dstu3.model.TestReport.TestReportParticipantComponent t : src.getParticipant()) + tgt.addParticipant(convertTestReportParticipantComponent(t)); + if (src.hasSetup()) + tgt.setSetup(convertTestReportSetupComponent(src.getSetup())); + for (org.hl7.fhir.dstu3.model.TestReport.TestReportTestComponent t : src.getTest()) + tgt.addTest(convertTestReportTestComponent(t)); + if (src.hasTeardown()) + tgt.setTeardown(convertTestReportTeardownComponent(src.getTeardown())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.TestReport convertTestReport(org.hl7.fhir.r5.model.TestReport src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.TestReport tgt = new org.hl7.fhir.dstu3.model.TestReport(); + copyDomainResource(src, tgt); + if (src.hasIdentifier()) + tgt.setIdentifier(convertIdentifier(src.getIdentifier())); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasStatus()) + tgt.setStatus(convertTestReportStatus(src.getStatus())); + if (src.hasTestScript()) + tgt.setTestScript(convertReference(src.getTestScript())); + if (src.hasResult()) + tgt.setResult(convertTestReportResult(src.getResult())); + if (src.hasScore()) + tgt.setScore(src.getScore()); + if (src.hasTester()) + tgt.setTester(src.getTester()); + if (src.hasIssued()) + tgt.setIssued(src.getIssued()); + for (org.hl7.fhir.r5.model.TestReport.TestReportParticipantComponent t : src.getParticipant()) + tgt.addParticipant(convertTestReportParticipantComponent(t)); + if (src.hasSetup()) + tgt.setSetup(convertTestReportSetupComponent(src.getSetup())); + for (org.hl7.fhir.r5.model.TestReport.TestReportTestComponent t : src.getTest()) + tgt.addTest(convertTestReportTestComponent(t)); + if (src.hasTeardown()) + tgt.setTeardown(convertTestReportTeardownComponent(src.getTeardown())); + return tgt; + } + + private static org.hl7.fhir.r5.model.TestReport.TestReportStatus convertTestReportStatus(org.hl7.fhir.dstu3.model.TestReport.TestReportStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case COMPLETED: return org.hl7.fhir.r5.model.TestReport.TestReportStatus.COMPLETED; + case INPROGRESS: return org.hl7.fhir.r5.model.TestReport.TestReportStatus.INPROGRESS; + case WAITING: return org.hl7.fhir.r5.model.TestReport.TestReportStatus.WAITING; + case STOPPED: return org.hl7.fhir.r5.model.TestReport.TestReportStatus.STOPPED; + case ENTEREDINERROR: return org.hl7.fhir.r5.model.TestReport.TestReportStatus.ENTEREDINERROR; + default: return org.hl7.fhir.r5.model.TestReport.TestReportStatus.NULL; + } +} + + private static org.hl7.fhir.dstu3.model.TestReport.TestReportStatus convertTestReportStatus(org.hl7.fhir.r5.model.TestReport.TestReportStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case COMPLETED: return org.hl7.fhir.dstu3.model.TestReport.TestReportStatus.COMPLETED; + case INPROGRESS: return org.hl7.fhir.dstu3.model.TestReport.TestReportStatus.INPROGRESS; + case WAITING: return org.hl7.fhir.dstu3.model.TestReport.TestReportStatus.WAITING; + case STOPPED: return org.hl7.fhir.dstu3.model.TestReport.TestReportStatus.STOPPED; + case ENTEREDINERROR: return org.hl7.fhir.dstu3.model.TestReport.TestReportStatus.ENTEREDINERROR; + default: return org.hl7.fhir.dstu3.model.TestReport.TestReportStatus.NULL; + } +} + + private static org.hl7.fhir.r5.model.TestReport.TestReportResult convertTestReportResult(org.hl7.fhir.dstu3.model.TestReport.TestReportResult src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PASS: return org.hl7.fhir.r5.model.TestReport.TestReportResult.PASS; + case FAIL: return org.hl7.fhir.r5.model.TestReport.TestReportResult.FAIL; + case PENDING: return org.hl7.fhir.r5.model.TestReport.TestReportResult.PENDING; + default: return org.hl7.fhir.r5.model.TestReport.TestReportResult.NULL; + } +} + + private static org.hl7.fhir.dstu3.model.TestReport.TestReportResult convertTestReportResult(org.hl7.fhir.r5.model.TestReport.TestReportResult src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PASS: return org.hl7.fhir.dstu3.model.TestReport.TestReportResult.PASS; + case FAIL: return org.hl7.fhir.dstu3.model.TestReport.TestReportResult.FAIL; + case PENDING: return org.hl7.fhir.dstu3.model.TestReport.TestReportResult.PENDING; + default: return org.hl7.fhir.dstu3.model.TestReport.TestReportResult.NULL; + } +} + + public static org.hl7.fhir.r5.model.TestReport.TestReportParticipantComponent convertTestReportParticipantComponent(org.hl7.fhir.dstu3.model.TestReport.TestReportParticipantComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.TestReport.TestReportParticipantComponent tgt = new org.hl7.fhir.r5.model.TestReport.TestReportParticipantComponent(); + copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertTestReportParticipantType(src.getType())); + if (src.hasUri()) + tgt.setUri(src.getUri()); + if (src.hasDisplay()) + tgt.setDisplay(src.getDisplay()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.TestReport.TestReportParticipantComponent convertTestReportParticipantComponent(org.hl7.fhir.r5.model.TestReport.TestReportParticipantComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.TestReport.TestReportParticipantComponent tgt = new org.hl7.fhir.dstu3.model.TestReport.TestReportParticipantComponent(); + copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertTestReportParticipantType(src.getType())); + if (src.hasUri()) + tgt.setUri(src.getUri()); + if (src.hasDisplay()) + tgt.setDisplay(src.getDisplay()); + return tgt; + } + + private static org.hl7.fhir.r5.model.TestReport.TestReportParticipantType convertTestReportParticipantType(org.hl7.fhir.dstu3.model.TestReport.TestReportParticipantType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case TESTENGINE: return org.hl7.fhir.r5.model.TestReport.TestReportParticipantType.TESTENGINE; + case CLIENT: return org.hl7.fhir.r5.model.TestReport.TestReportParticipantType.CLIENT; + case SERVER: return org.hl7.fhir.r5.model.TestReport.TestReportParticipantType.SERVER; + default: return org.hl7.fhir.r5.model.TestReport.TestReportParticipantType.NULL; + } +} + + private static org.hl7.fhir.dstu3.model.TestReport.TestReportParticipantType convertTestReportParticipantType(org.hl7.fhir.r5.model.TestReport.TestReportParticipantType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case TESTENGINE: return org.hl7.fhir.dstu3.model.TestReport.TestReportParticipantType.TESTENGINE; + case CLIENT: return org.hl7.fhir.dstu3.model.TestReport.TestReportParticipantType.CLIENT; + case SERVER: return org.hl7.fhir.dstu3.model.TestReport.TestReportParticipantType.SERVER; + default: return org.hl7.fhir.dstu3.model.TestReport.TestReportParticipantType.NULL; + } +} + + public static org.hl7.fhir.r5.model.TestReport.TestReportSetupComponent convertTestReportSetupComponent(org.hl7.fhir.dstu3.model.TestReport.TestReportSetupComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.TestReport.TestReportSetupComponent tgt = new org.hl7.fhir.r5.model.TestReport.TestReportSetupComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.dstu3.model.TestReport.SetupActionComponent t : src.getAction()) + tgt.addAction(convertSetupActionComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.TestReport.TestReportSetupComponent convertTestReportSetupComponent(org.hl7.fhir.r5.model.TestReport.TestReportSetupComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.TestReport.TestReportSetupComponent tgt = new org.hl7.fhir.dstu3.model.TestReport.TestReportSetupComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.r5.model.TestReport.SetupActionComponent t : src.getAction()) + tgt.addAction(convertSetupActionComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.TestReport.SetupActionComponent convertSetupActionComponent(org.hl7.fhir.dstu3.model.TestReport.SetupActionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.TestReport.SetupActionComponent tgt = new org.hl7.fhir.r5.model.TestReport.SetupActionComponent(); + copyElement(src, tgt); + if (src.hasOperation()) + tgt.setOperation(convertSetupActionOperationComponent(src.getOperation())); + if (src.hasAssert()) + tgt.setAssert(convertSetupActionAssertComponent(src.getAssert())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.TestReport.SetupActionComponent convertSetupActionComponent(org.hl7.fhir.r5.model.TestReport.SetupActionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.TestReport.SetupActionComponent tgt = new org.hl7.fhir.dstu3.model.TestReport.SetupActionComponent(); + copyElement(src, tgt); + if (src.hasOperation()) + tgt.setOperation(convertSetupActionOperationComponent(src.getOperation())); + if (src.hasAssert()) + tgt.setAssert(convertSetupActionAssertComponent(src.getAssert())); + return tgt; + } + + public static org.hl7.fhir.r5.model.TestReport.SetupActionOperationComponent convertSetupActionOperationComponent(org.hl7.fhir.dstu3.model.TestReport.SetupActionOperationComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.TestReport.SetupActionOperationComponent tgt = new org.hl7.fhir.r5.model.TestReport.SetupActionOperationComponent(); + copyElement(src, tgt); + if (src.hasResult()) + tgt.setResult(convertTestReportActionResult(src.getResult())); + if (src.hasMessage()) + tgt.setMessage(src.getMessage()); + if (src.hasDetail()) + tgt.setDetail(src.getDetail()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.TestReport.SetupActionOperationComponent convertSetupActionOperationComponent(org.hl7.fhir.r5.model.TestReport.SetupActionOperationComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.TestReport.SetupActionOperationComponent tgt = new org.hl7.fhir.dstu3.model.TestReport.SetupActionOperationComponent(); + copyElement(src, tgt); + if (src.hasResult()) + tgt.setResult(convertTestReportActionResult(src.getResult())); + if (src.hasMessage()) + tgt.setMessage(src.getMessage()); + if (src.hasDetail()) + tgt.setDetail(src.getDetail()); + return tgt; + } + + private static org.hl7.fhir.r5.model.TestReport.TestReportActionResult convertTestReportActionResult(org.hl7.fhir.dstu3.model.TestReport.TestReportActionResult src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PASS: return org.hl7.fhir.r5.model.TestReport.TestReportActionResult.PASS; + case SKIP: return org.hl7.fhir.r5.model.TestReport.TestReportActionResult.SKIP; + case FAIL: return org.hl7.fhir.r5.model.TestReport.TestReportActionResult.FAIL; + case WARNING: return org.hl7.fhir.r5.model.TestReport.TestReportActionResult.WARNING; + case ERROR: return org.hl7.fhir.r5.model.TestReport.TestReportActionResult.ERROR; + default: return org.hl7.fhir.r5.model.TestReport.TestReportActionResult.NULL; + } +} + + private static org.hl7.fhir.dstu3.model.TestReport.TestReportActionResult convertTestReportActionResult(org.hl7.fhir.r5.model.TestReport.TestReportActionResult src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PASS: return org.hl7.fhir.dstu3.model.TestReport.TestReportActionResult.PASS; + case SKIP: return org.hl7.fhir.dstu3.model.TestReport.TestReportActionResult.SKIP; + case FAIL: return org.hl7.fhir.dstu3.model.TestReport.TestReportActionResult.FAIL; + case WARNING: return org.hl7.fhir.dstu3.model.TestReport.TestReportActionResult.WARNING; + case ERROR: return org.hl7.fhir.dstu3.model.TestReport.TestReportActionResult.ERROR; + default: return org.hl7.fhir.dstu3.model.TestReport.TestReportActionResult.NULL; + } +} + + public static org.hl7.fhir.r5.model.TestReport.SetupActionAssertComponent convertSetupActionAssertComponent(org.hl7.fhir.dstu3.model.TestReport.SetupActionAssertComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.TestReport.SetupActionAssertComponent tgt = new org.hl7.fhir.r5.model.TestReport.SetupActionAssertComponent(); + copyElement(src, tgt); + if (src.hasResult()) + tgt.setResult(convertTestReportActionResult(src.getResult())); + if (src.hasMessage()) + tgt.setMessage(src.getMessage()); + if (src.hasDetail()) + tgt.setDetail(src.getDetail()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.TestReport.SetupActionAssertComponent convertSetupActionAssertComponent(org.hl7.fhir.r5.model.TestReport.SetupActionAssertComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.TestReport.SetupActionAssertComponent tgt = new org.hl7.fhir.dstu3.model.TestReport.SetupActionAssertComponent(); + copyElement(src, tgt); + if (src.hasResult()) + tgt.setResult(convertTestReportActionResult(src.getResult())); + if (src.hasMessage()) + tgt.setMessage(src.getMessage()); + if (src.hasDetail()) + tgt.setDetail(src.getDetail()); + return tgt; + } + + public static org.hl7.fhir.r5.model.TestReport.TestReportTestComponent convertTestReportTestComponent(org.hl7.fhir.dstu3.model.TestReport.TestReportTestComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.TestReport.TestReportTestComponent tgt = new org.hl7.fhir.r5.model.TestReport.TestReportTestComponent(); + copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu3.model.TestReport.TestActionComponent t : src.getAction()) + tgt.addAction(convertTestActionComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.TestReport.TestReportTestComponent convertTestReportTestComponent(org.hl7.fhir.r5.model.TestReport.TestReportTestComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.TestReport.TestReportTestComponent tgt = new org.hl7.fhir.dstu3.model.TestReport.TestReportTestComponent(); + copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.r5.model.TestReport.TestActionComponent t : src.getAction()) + tgt.addAction(convertTestActionComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.TestReport.TestActionComponent convertTestActionComponent(org.hl7.fhir.dstu3.model.TestReport.TestActionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.TestReport.TestActionComponent tgt = new org.hl7.fhir.r5.model.TestReport.TestActionComponent(); + copyElement(src, tgt); + if (src.hasOperation()) + tgt.setOperation(convertSetupActionOperationComponent(src.getOperation())); + if (src.hasAssert()) + tgt.setAssert(convertSetupActionAssertComponent(src.getAssert())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.TestReport.TestActionComponent convertTestActionComponent(org.hl7.fhir.r5.model.TestReport.TestActionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.TestReport.TestActionComponent tgt = new org.hl7.fhir.dstu3.model.TestReport.TestActionComponent(); + copyElement(src, tgt); + if (src.hasOperation()) + tgt.setOperation(convertSetupActionOperationComponent(src.getOperation())); + if (src.hasAssert()) + tgt.setAssert(convertSetupActionAssertComponent(src.getAssert())); + return tgt; + } + + public static org.hl7.fhir.r5.model.TestReport.TestReportTeardownComponent convertTestReportTeardownComponent(org.hl7.fhir.dstu3.model.TestReport.TestReportTeardownComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.TestReport.TestReportTeardownComponent tgt = new org.hl7.fhir.r5.model.TestReport.TestReportTeardownComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.dstu3.model.TestReport.TeardownActionComponent t : src.getAction()) + tgt.addAction(convertTeardownActionComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.TestReport.TestReportTeardownComponent convertTestReportTeardownComponent(org.hl7.fhir.r5.model.TestReport.TestReportTeardownComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.TestReport.TestReportTeardownComponent tgt = new org.hl7.fhir.dstu3.model.TestReport.TestReportTeardownComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.r5.model.TestReport.TeardownActionComponent t : src.getAction()) + tgt.addAction(convertTeardownActionComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.TestReport.TeardownActionComponent convertTeardownActionComponent(org.hl7.fhir.dstu3.model.TestReport.TeardownActionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.TestReport.TeardownActionComponent tgt = new org.hl7.fhir.r5.model.TestReport.TeardownActionComponent(); + copyElement(src, tgt); + if (src.hasOperation()) + tgt.setOperation(convertSetupActionOperationComponent(src.getOperation())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.TestReport.TeardownActionComponent convertTeardownActionComponent(org.hl7.fhir.r5.model.TestReport.TeardownActionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.TestReport.TeardownActionComponent tgt = new org.hl7.fhir.dstu3.model.TestReport.TeardownActionComponent(); + copyElement(src, tgt); + if (src.hasOperation()) + tgt.setOperation(convertSetupActionOperationComponent(src.getOperation())); + return tgt; + } + + public static org.hl7.fhir.r5.model.TestScript convertTestScript(org.hl7.fhir.dstu3.model.TestScript src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.TestScript tgt = new org.hl7.fhir.r5.model.TestScript(); + copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + if (src.hasIdentifier()) + tgt.setIdentifier(convertIdentifier(src.getIdentifier())); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasTitle()) + tgt.setTitle(src.getTitle()); + if (src.hasStatus()) + tgt.setStatus(convertPublicationStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) + tgt.addContact(convertContactDetail(t)); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu3.model.UsageContext t : src.getUseContext()) + tgt.addUseContext(convertUsageContext(t)); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction()) + tgt.addJurisdiction(convertCodeableConcept(t)); + if (src.hasPurpose()) + tgt.setPurpose(src.getPurpose()); + if (src.hasCopyright()) + tgt.setCopyright(src.getCopyright()); + for (org.hl7.fhir.dstu3.model.TestScript.TestScriptOriginComponent t : src.getOrigin()) + tgt.addOrigin(convertTestScriptOriginComponent(t)); + for (org.hl7.fhir.dstu3.model.TestScript.TestScriptDestinationComponent t : src.getDestination()) + tgt.addDestination(convertTestScriptDestinationComponent(t)); + if (src.hasMetadata()) + tgt.setMetadata(convertTestScriptMetadataComponent(src.getMetadata())); + for (org.hl7.fhir.dstu3.model.TestScript.TestScriptFixtureComponent t : src.getFixture()) + tgt.addFixture(convertTestScriptFixtureComponent(t)); + for (org.hl7.fhir.dstu3.model.Reference t : src.getProfile()) + tgt.addProfile(convertReference(t)); + for (org.hl7.fhir.dstu3.model.TestScript.TestScriptVariableComponent t : src.getVariable()) + tgt.addVariable(convertTestScriptVariableComponent(t)); + if (src.hasSetup()) + tgt.setSetup(convertTestScriptSetupComponent(src.getSetup())); + for (org.hl7.fhir.dstu3.model.TestScript.TestScriptTestComponent t : src.getTest()) + tgt.addTest(convertTestScriptTestComponent(t)); + if (src.hasTeardown()) + tgt.setTeardown(convertTestScriptTeardownComponent(src.getTeardown())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.TestScript convertTestScript(org.hl7.fhir.r5.model.TestScript src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.TestScript tgt = new org.hl7.fhir.dstu3.model.TestScript(); + copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + if (src.hasIdentifier()) + tgt.setIdentifier(convertIdentifier(src.getIdentifier())); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasTitle()) + tgt.setTitle(src.getTitle()); + if (src.hasStatus()) + tgt.setStatus(convertPublicationStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.r5.model.ContactDetail t : src.getContact()) + tgt.addContact(convertContactDetail(t)); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.r5.model.UsageContext t : src.getUseContext()) + tgt.addUseContext(convertUsageContext(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getJurisdiction()) + tgt.addJurisdiction(convertCodeableConcept(t)); + if (src.hasPurpose()) + tgt.setPurpose(src.getPurpose()); + if (src.hasCopyright()) + tgt.setCopyright(src.getCopyright()); + for (org.hl7.fhir.r5.model.TestScript.TestScriptOriginComponent t : src.getOrigin()) + tgt.addOrigin(convertTestScriptOriginComponent(t)); + for (org.hl7.fhir.r5.model.TestScript.TestScriptDestinationComponent t : src.getDestination()) + tgt.addDestination(convertTestScriptDestinationComponent(t)); + if (src.hasMetadata()) + tgt.setMetadata(convertTestScriptMetadataComponent(src.getMetadata())); + for (org.hl7.fhir.r5.model.TestScript.TestScriptFixtureComponent t : src.getFixture()) + tgt.addFixture(convertTestScriptFixtureComponent(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getProfile()) + tgt.addProfile(convertReference(t)); + for (org.hl7.fhir.r5.model.TestScript.TestScriptVariableComponent t : src.getVariable()) + tgt.addVariable(convertTestScriptVariableComponent(t)); + if (src.hasSetup()) + tgt.setSetup(convertTestScriptSetupComponent(src.getSetup())); + for (org.hl7.fhir.r5.model.TestScript.TestScriptTestComponent t : src.getTest()) + tgt.addTest(convertTestScriptTestComponent(t)); + if (src.hasTeardown()) + tgt.setTeardown(convertTestScriptTeardownComponent(src.getTeardown())); + return tgt; + } + + public static org.hl7.fhir.r5.model.TestScript.TestScriptOriginComponent convertTestScriptOriginComponent(org.hl7.fhir.dstu3.model.TestScript.TestScriptOriginComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.TestScript.TestScriptOriginComponent tgt = new org.hl7.fhir.r5.model.TestScript.TestScriptOriginComponent(); + copyElement(src, tgt); + if (src.hasIndex()) + tgt.setIndex(src.getIndex()); + if (src.hasProfile()) + tgt.setProfile(convertCoding(src.getProfile())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.TestScript.TestScriptOriginComponent convertTestScriptOriginComponent(org.hl7.fhir.r5.model.TestScript.TestScriptOriginComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.TestScript.TestScriptOriginComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.TestScriptOriginComponent(); + copyElement(src, tgt); + if (src.hasIndex()) + tgt.setIndex(src.getIndex()); + if (src.hasProfile()) + tgt.setProfile(convertCoding(src.getProfile())); + return tgt; + } + + public static org.hl7.fhir.r5.model.TestScript.TestScriptDestinationComponent convertTestScriptDestinationComponent(org.hl7.fhir.dstu3.model.TestScript.TestScriptDestinationComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.TestScript.TestScriptDestinationComponent tgt = new org.hl7.fhir.r5.model.TestScript.TestScriptDestinationComponent(); + copyElement(src, tgt); + if (src.hasIndex()) + tgt.setIndex(src.getIndex()); + if (src.hasProfile()) + tgt.setProfile(convertCoding(src.getProfile())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.TestScript.TestScriptDestinationComponent convertTestScriptDestinationComponent(org.hl7.fhir.r5.model.TestScript.TestScriptDestinationComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.TestScript.TestScriptDestinationComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.TestScriptDestinationComponent(); + copyElement(src, tgt); + if (src.hasIndex()) + tgt.setIndex(src.getIndex()); + if (src.hasProfile()) + tgt.setProfile(convertCoding(src.getProfile())); + return tgt; + } + + public static org.hl7.fhir.r5.model.TestScript.TestScriptMetadataComponent convertTestScriptMetadataComponent(org.hl7.fhir.dstu3.model.TestScript.TestScriptMetadataComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.TestScript.TestScriptMetadataComponent tgt = new org.hl7.fhir.r5.model.TestScript.TestScriptMetadataComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.dstu3.model.TestScript.TestScriptMetadataLinkComponent t : src.getLink()) + tgt.addLink(convertTestScriptMetadataLinkComponent(t)); + for (org.hl7.fhir.dstu3.model.TestScript.TestScriptMetadataCapabilityComponent t : src.getCapability()) + tgt.addCapability(convertTestScriptMetadataCapabilityComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.TestScript.TestScriptMetadataComponent convertTestScriptMetadataComponent(org.hl7.fhir.r5.model.TestScript.TestScriptMetadataComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.TestScript.TestScriptMetadataComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.TestScriptMetadataComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.r5.model.TestScript.TestScriptMetadataLinkComponent t : src.getLink()) + tgt.addLink(convertTestScriptMetadataLinkComponent(t)); + for (org.hl7.fhir.r5.model.TestScript.TestScriptMetadataCapabilityComponent t : src.getCapability()) + tgt.addCapability(convertTestScriptMetadataCapabilityComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.TestScript.TestScriptMetadataLinkComponent convertTestScriptMetadataLinkComponent(org.hl7.fhir.dstu3.model.TestScript.TestScriptMetadataLinkComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.TestScript.TestScriptMetadataLinkComponent tgt = new org.hl7.fhir.r5.model.TestScript.TestScriptMetadataLinkComponent(); + copyElement(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.TestScript.TestScriptMetadataLinkComponent convertTestScriptMetadataLinkComponent(org.hl7.fhir.r5.model.TestScript.TestScriptMetadataLinkComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.TestScript.TestScriptMetadataLinkComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.TestScriptMetadataLinkComponent(); + copyElement(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + return tgt; + } + + public static org.hl7.fhir.r5.model.TestScript.TestScriptMetadataCapabilityComponent convertTestScriptMetadataCapabilityComponent(org.hl7.fhir.dstu3.model.TestScript.TestScriptMetadataCapabilityComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.TestScript.TestScriptMetadataCapabilityComponent tgt = new org.hl7.fhir.r5.model.TestScript.TestScriptMetadataCapabilityComponent(); + copyElement(src, tgt); + if (src.hasRequired()) + tgt.setRequired(src.getRequired()); + if (src.hasValidated()) + tgt.setValidated(src.getValidated()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu3.model.IntegerType t : src.getOrigin()) + tgt.addOrigin(t.getValue()); + if (src.hasDestination()) + tgt.setDestination(src.getDestination()); + for (org.hl7.fhir.dstu3.model.UriType t : src.getLink()) + tgt.addLink(t.getValue()); + if (src.hasCapabilities()) + tgt.setCapabilitiesElement(convertReferenceToCanonical(src.getCapabilities())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.TestScript.TestScriptMetadataCapabilityComponent convertTestScriptMetadataCapabilityComponent(org.hl7.fhir.r5.model.TestScript.TestScriptMetadataCapabilityComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.TestScript.TestScriptMetadataCapabilityComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.TestScriptMetadataCapabilityComponent(); + copyElement(src, tgt); + if (src.hasRequired()) + tgt.setRequired(src.getRequired()); + if (src.hasValidated()) + tgt.setValidated(src.getValidated()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.r5.model.IntegerType t : src.getOrigin()) + tgt.addOrigin(t.getValue()); + if (src.hasDestination()) + tgt.setDestination(src.getDestination()); + for (org.hl7.fhir.r5.model.UriType t : src.getLink()) + tgt.addLink(t.getValue()); + if (src.hasCapabilities()) + tgt.setCapabilities(convertCanonicalToReference(src.getCapabilitiesElement())); + return tgt; + } + + public static org.hl7.fhir.r5.model.TestScript.TestScriptFixtureComponent convertTestScriptFixtureComponent(org.hl7.fhir.dstu3.model.TestScript.TestScriptFixtureComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.TestScript.TestScriptFixtureComponent tgt = new org.hl7.fhir.r5.model.TestScript.TestScriptFixtureComponent(); + copyElement(src, tgt); + if (src.hasAutocreate()) + tgt.setAutocreate(src.getAutocreate()); + if (src.hasAutodelete()) + tgt.setAutodelete(src.getAutodelete()); + if (src.hasResource()) + tgt.setResource(convertReference(src.getResource())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.TestScript.TestScriptFixtureComponent convertTestScriptFixtureComponent(org.hl7.fhir.r5.model.TestScript.TestScriptFixtureComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.TestScript.TestScriptFixtureComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.TestScriptFixtureComponent(); + copyElement(src, tgt); + if (src.hasAutocreate()) + tgt.setAutocreate(src.getAutocreate()); + if (src.hasAutodelete()) + tgt.setAutodelete(src.getAutodelete()); + if (src.hasResource()) + tgt.setResource(convertReference(src.getResource())); + return tgt; + } + + public static org.hl7.fhir.r5.model.TestScript.TestScriptVariableComponent convertTestScriptVariableComponent(org.hl7.fhir.dstu3.model.TestScript.TestScriptVariableComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.TestScript.TestScriptVariableComponent tgt = new org.hl7.fhir.r5.model.TestScript.TestScriptVariableComponent(); + copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasDefaultValue()) + tgt.setDefaultValue(src.getDefaultValue()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + if (src.hasExpression()) + tgt.setExpression(src.getExpression()); + if (src.hasHeaderField()) + tgt.setHeaderField(src.getHeaderField()); + if (src.hasHint()) + tgt.setHint(src.getHint()); + if (src.hasPath()) + tgt.setPath(src.getPath()); + if (src.hasSourceId()) + tgt.setSourceId(src.getSourceId()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.TestScript.TestScriptVariableComponent convertTestScriptVariableComponent(org.hl7.fhir.r5.model.TestScript.TestScriptVariableComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.TestScript.TestScriptVariableComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.TestScriptVariableComponent(); + copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasDefaultValue()) + tgt.setDefaultValue(src.getDefaultValue()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + if (src.hasExpression()) + tgt.setExpression(src.getExpression()); + if (src.hasHeaderField()) + tgt.setHeaderField(src.getHeaderField()); + if (src.hasHint()) + tgt.setHint(src.getHint()); + if (src.hasPath()) + tgt.setPath(src.getPath()); + if (src.hasSourceId()) + tgt.setSourceId(src.getSourceId()); + return tgt; + } + + public static org.hl7.fhir.r5.model.TestScript.TestScriptSetupComponent convertTestScriptSetupComponent(org.hl7.fhir.dstu3.model.TestScript.TestScriptSetupComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.TestScript.TestScriptSetupComponent tgt = new org.hl7.fhir.r5.model.TestScript.TestScriptSetupComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.dstu3.model.TestScript.SetupActionComponent t : src.getAction()) + tgt.addAction(convertSetupActionComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.TestScript.TestScriptSetupComponent convertTestScriptSetupComponent(org.hl7.fhir.r5.model.TestScript.TestScriptSetupComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.TestScript.TestScriptSetupComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.TestScriptSetupComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.r5.model.TestScript.SetupActionComponent t : src.getAction()) + tgt.addAction(convertSetupActionComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.TestScript.SetupActionComponent convertSetupActionComponent(org.hl7.fhir.dstu3.model.TestScript.SetupActionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.TestScript.SetupActionComponent tgt = new org.hl7.fhir.r5.model.TestScript.SetupActionComponent(); + copyElement(src, tgt); + if (src.hasOperation()) + tgt.setOperation(convertSetupActionOperationComponent(src.getOperation())); + if (src.hasAssert()) + tgt.setAssert(convertSetupActionAssertComponent(src.getAssert())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.TestScript.SetupActionComponent convertSetupActionComponent(org.hl7.fhir.r5.model.TestScript.SetupActionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.TestScript.SetupActionComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.SetupActionComponent(); + copyElement(src, tgt); + if (src.hasOperation()) + tgt.setOperation(convertSetupActionOperationComponent(src.getOperation())); + if (src.hasAssert()) + tgt.setAssert(convertSetupActionAssertComponent(src.getAssert())); + return tgt; + } + + public static org.hl7.fhir.r5.model.TestScript.SetupActionOperationComponent convertSetupActionOperationComponent(org.hl7.fhir.dstu3.model.TestScript.SetupActionOperationComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.TestScript.SetupActionOperationComponent tgt = new org.hl7.fhir.r5.model.TestScript.SetupActionOperationComponent(); + copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertCoding(src.getType())); + if (src.hasResource()) + tgt.setResource(src.getResource()); + if (src.hasLabel()) + tgt.setLabel(src.getLabel()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + if (src.hasAccept()) + tgt.setAccept(convertContentType(src.getAccept())); + if (src.hasContentType()) + tgt.setContentType(convertContentType(src.getContentType())); + if (src.hasDestination()) + tgt.setDestination(src.getDestination()); + if (src.hasEncodeRequestUrl()) + tgt.setEncodeRequestUrl(src.getEncodeRequestUrl()); + if (src.hasOrigin()) + tgt.setOrigin(src.getOrigin()); + if (src.hasParams()) + tgt.setParams(src.getParams()); + for (org.hl7.fhir.dstu3.model.TestScript.SetupActionOperationRequestHeaderComponent t : src.getRequestHeader()) + tgt.addRequestHeader(convertSetupActionOperationRequestHeaderComponent(t)); + if (src.hasRequestId()) + tgt.setRequestId(src.getRequestId()); + if (src.hasResponseId()) + tgt.setResponseId(src.getResponseId()); + if (src.hasSourceId()) + tgt.setSourceId(src.getSourceId()); + if (src.hasTargetId()) + tgt.setTargetId(src.getTargetId()); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.TestScript.SetupActionOperationComponent convertSetupActionOperationComponent(org.hl7.fhir.r5.model.TestScript.SetupActionOperationComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.TestScript.SetupActionOperationComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.SetupActionOperationComponent(); + copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertCoding(src.getType())); + if (src.hasResource()) + tgt.setResource(src.getResource()); + if (src.hasLabel()) + tgt.setLabel(src.getLabel()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + if (src.hasAccept()) + tgt.setAccept(convertContentType(src.getAccept())); + if (src.hasContentType()) + tgt.setContentType(convertContentType(src.getContentType())); + if (src.hasDestination()) + tgt.setDestination(src.getDestination()); + if (src.hasEncodeRequestUrl()) + tgt.setEncodeRequestUrl(src.getEncodeRequestUrl()); + if (src.hasOrigin()) + tgt.setOrigin(src.getOrigin()); + if (src.hasParams()) + tgt.setParams(src.getParams()); + for (org.hl7.fhir.r5.model.TestScript.SetupActionOperationRequestHeaderComponent t : src.getRequestHeader()) + tgt.addRequestHeader(convertSetupActionOperationRequestHeaderComponent(t)); + if (src.hasRequestId()) + tgt.setRequestId(src.getRequestId()); + if (src.hasResponseId()) + tgt.setResponseId(src.getResponseId()); + if (src.hasSourceId()) + tgt.setSourceId(src.getSourceId()); + if (src.hasTargetId()) + tgt.setTargetId(src.getTargetId()); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + return tgt; + } + + private static String convertContentType(org.hl7.fhir.dstu3.model.TestScript.ContentType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case XML: return "application/fhir+xml"; + case JSON: return "application/fhir+json"; + case TTL: return "text/turtle"; + case NONE: return null; + default: return null; + } +} + + private static org.hl7.fhir.dstu3.model.TestScript.ContentType convertContentType(String src) throws FHIRException { + if (src == null) + return null; + if (src.contains("xml")) return org.hl7.fhir.dstu3.model.TestScript.ContentType.XML; + if (src.contains("json")) return org.hl7.fhir.dstu3.model.TestScript.ContentType.JSON; + if (src.contains("tu")) return org.hl7.fhir.dstu3.model.TestScript.ContentType.TTL; + return org.hl7.fhir.dstu3.model.TestScript.ContentType.NONE; + } + + + public static org.hl7.fhir.r5.model.TestScript.SetupActionOperationRequestHeaderComponent convertSetupActionOperationRequestHeaderComponent(org.hl7.fhir.dstu3.model.TestScript.SetupActionOperationRequestHeaderComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.TestScript.SetupActionOperationRequestHeaderComponent tgt = new org.hl7.fhir.r5.model.TestScript.SetupActionOperationRequestHeaderComponent(); + copyElement(src, tgt); + if (src.hasField()) + tgt.setField(src.getField()); + if (src.hasValue()) + tgt.setValue(src.getValue()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.TestScript.SetupActionOperationRequestHeaderComponent convertSetupActionOperationRequestHeaderComponent(org.hl7.fhir.r5.model.TestScript.SetupActionOperationRequestHeaderComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.TestScript.SetupActionOperationRequestHeaderComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.SetupActionOperationRequestHeaderComponent(); + copyElement(src, tgt); + if (src.hasField()) + tgt.setField(src.getField()); + if (src.hasValue()) + tgt.setValue(src.getValue()); + return tgt; + } + + public static org.hl7.fhir.r5.model.TestScript.SetupActionAssertComponent convertSetupActionAssertComponent(org.hl7.fhir.dstu3.model.TestScript.SetupActionAssertComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.TestScript.SetupActionAssertComponent tgt = new org.hl7.fhir.r5.model.TestScript.SetupActionAssertComponent(); + copyElement(src, tgt); + if (src.hasLabel()) + tgt.setLabel(src.getLabel()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + if (src.hasDirection()) + tgt.setDirection(convertAssertionDirectionType(src.getDirection())); + if (src.hasCompareToSourceId()) + tgt.setCompareToSourceId(src.getCompareToSourceId()); + if (src.hasCompareToSourceExpression()) + tgt.setCompareToSourceExpression(src.getCompareToSourceExpression()); + if (src.hasCompareToSourcePath()) + tgt.setCompareToSourcePath(src.getCompareToSourcePath()); + if (src.hasContentType()) + tgt.setContentType(convertContentType(src.getContentType())); + if (src.hasExpression()) + tgt.setExpression(src.getExpression()); + if (src.hasHeaderField()) + tgt.setHeaderField(src.getHeaderField()); + if (src.hasMinimumId()) + tgt.setMinimumId(src.getMinimumId()); + if (src.hasNavigationLinks()) + tgt.setNavigationLinks(src.getNavigationLinks()); + if (src.hasOperator()) + tgt.setOperator(convertAssertionOperatorType(src.getOperator())); + if (src.hasPath()) + tgt.setPath(src.getPath()); + if (src.hasRequestMethod()) + tgt.setRequestMethod(convertTestScriptRequestMethodCode(src.getRequestMethod())); + if (src.hasRequestURL()) + tgt.setRequestURL(src.getRequestURL()); + if (src.hasResource()) + tgt.setResource(src.getResource()); + if (src.hasResponse()) + tgt.setResponse(convertAssertionResponseTypes(src.getResponse())); + if (src.hasResponseCode()) + tgt.setResponseCode(src.getResponseCode()); + if (src.hasSourceId()) + tgt.setSourceId(src.getSourceId()); + if (src.hasValidateProfileId()) + tgt.setValidateProfileId(src.getValidateProfileId()); + if (src.hasValue()) + tgt.setValue(src.getValue()); + if (src.hasWarningOnly()) + tgt.setWarningOnly(src.getWarningOnly()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.TestScript.SetupActionAssertComponent convertSetupActionAssertComponent(org.hl7.fhir.r5.model.TestScript.SetupActionAssertComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.TestScript.SetupActionAssertComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.SetupActionAssertComponent(); + copyElement(src, tgt); + if (src.hasLabel()) + tgt.setLabel(src.getLabel()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + if (src.hasDirection()) + tgt.setDirection(convertAssertionDirectionType(src.getDirection())); + if (src.hasCompareToSourceId()) + tgt.setCompareToSourceId(src.getCompareToSourceId()); + if (src.hasCompareToSourceExpression()) + tgt.setCompareToSourceExpression(src.getCompareToSourceExpression()); + if (src.hasCompareToSourcePath()) + tgt.setCompareToSourcePath(src.getCompareToSourcePath()); + if (src.hasContentType()) + tgt.setContentType(convertContentType(src.getContentType())); + if (src.hasExpression()) + tgt.setExpression(src.getExpression()); + if (src.hasHeaderField()) + tgt.setHeaderField(src.getHeaderField()); + if (src.hasMinimumId()) + tgt.setMinimumId(src.getMinimumId()); + if (src.hasNavigationLinks()) + tgt.setNavigationLinks(src.getNavigationLinks()); + if (src.hasOperator()) + tgt.setOperator(convertAssertionOperatorType(src.getOperator())); + if (src.hasPath()) + tgt.setPath(src.getPath()); + if (src.hasRequestMethod()) + tgt.setRequestMethod(convertTestScriptRequestMethodCode(src.getRequestMethod())); + if (src.hasRequestURL()) + tgt.setRequestURL(src.getRequestURL()); + if (src.hasResource()) + tgt.setResource(src.getResource()); + if (src.hasResponse()) + tgt.setResponse(convertAssertionResponseTypes(src.getResponse())); + if (src.hasResponseCode()) + tgt.setResponseCode(src.getResponseCode()); + if (src.hasSourceId()) + tgt.setSourceId(src.getSourceId()); + if (src.hasValidateProfileId()) + tgt.setValidateProfileId(src.getValidateProfileId()); + if (src.hasValue()) + tgt.setValue(src.getValue()); + if (src.hasWarningOnly()) + tgt.setWarningOnly(src.getWarningOnly()); + return tgt; + } + + private static org.hl7.fhir.r5.model.TestScript.AssertionDirectionType convertAssertionDirectionType(org.hl7.fhir.dstu3.model.TestScript.AssertionDirectionType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case RESPONSE: return org.hl7.fhir.r5.model.TestScript.AssertionDirectionType.RESPONSE; + case REQUEST: return org.hl7.fhir.r5.model.TestScript.AssertionDirectionType.REQUEST; + default: return org.hl7.fhir.r5.model.TestScript.AssertionDirectionType.NULL; + } +} + + private static org.hl7.fhir.dstu3.model.TestScript.AssertionDirectionType convertAssertionDirectionType(org.hl7.fhir.r5.model.TestScript.AssertionDirectionType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case RESPONSE: return org.hl7.fhir.dstu3.model.TestScript.AssertionDirectionType.RESPONSE; + case REQUEST: return org.hl7.fhir.dstu3.model.TestScript.AssertionDirectionType.REQUEST; + default: return org.hl7.fhir.dstu3.model.TestScript.AssertionDirectionType.NULL; + } +} + + private static org.hl7.fhir.r5.model.TestScript.AssertionOperatorType convertAssertionOperatorType(org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case EQUALS: return org.hl7.fhir.r5.model.TestScript.AssertionOperatorType.EQUALS; + case NOTEQUALS: return org.hl7.fhir.r5.model.TestScript.AssertionOperatorType.NOTEQUALS; + case IN: return org.hl7.fhir.r5.model.TestScript.AssertionOperatorType.IN; + case NOTIN: return org.hl7.fhir.r5.model.TestScript.AssertionOperatorType.NOTIN; + case GREATERTHAN: return org.hl7.fhir.r5.model.TestScript.AssertionOperatorType.GREATERTHAN; + case LESSTHAN: return org.hl7.fhir.r5.model.TestScript.AssertionOperatorType.LESSTHAN; + case EMPTY: return org.hl7.fhir.r5.model.TestScript.AssertionOperatorType.EMPTY; + case NOTEMPTY: return org.hl7.fhir.r5.model.TestScript.AssertionOperatorType.NOTEMPTY; + case CONTAINS: return org.hl7.fhir.r5.model.TestScript.AssertionOperatorType.CONTAINS; + case NOTCONTAINS: return org.hl7.fhir.r5.model.TestScript.AssertionOperatorType.NOTCONTAINS; + case EVAL: return org.hl7.fhir.r5.model.TestScript.AssertionOperatorType.EVAL; + default: return org.hl7.fhir.r5.model.TestScript.AssertionOperatorType.NULL; + } +} + + private static org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType convertAssertionOperatorType(org.hl7.fhir.r5.model.TestScript.AssertionOperatorType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case EQUALS: return org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType.EQUALS; + case NOTEQUALS: return org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType.NOTEQUALS; + case IN: return org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType.IN; + case NOTIN: return org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType.NOTIN; + case GREATERTHAN: return org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType.GREATERTHAN; + case LESSTHAN: return org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType.LESSTHAN; + case EMPTY: return org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType.EMPTY; + case NOTEMPTY: return org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType.NOTEMPTY; + case CONTAINS: return org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType.CONTAINS; + case NOTCONTAINS: return org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType.NOTCONTAINS; + case EVAL: return org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType.EVAL; + default: return org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType.NULL; + } +} + + private static org.hl7.fhir.r5.model.TestScript.TestScriptRequestMethodCode convertTestScriptRequestMethodCode(org.hl7.fhir.dstu3.model.TestScript.TestScriptRequestMethodCode src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case DELETE: return org.hl7.fhir.r5.model.TestScript.TestScriptRequestMethodCode.DELETE; + case GET: return org.hl7.fhir.r5.model.TestScript.TestScriptRequestMethodCode.GET; + case OPTIONS: return org.hl7.fhir.r5.model.TestScript.TestScriptRequestMethodCode.OPTIONS; + case PATCH: return org.hl7.fhir.r5.model.TestScript.TestScriptRequestMethodCode.PATCH; + case POST: return org.hl7.fhir.r5.model.TestScript.TestScriptRequestMethodCode.POST; + case PUT: return org.hl7.fhir.r5.model.TestScript.TestScriptRequestMethodCode.PUT; + default: return org.hl7.fhir.r5.model.TestScript.TestScriptRequestMethodCode.NULL; + } +} + + private static org.hl7.fhir.dstu3.model.TestScript.TestScriptRequestMethodCode convertTestScriptRequestMethodCode(org.hl7.fhir.r5.model.TestScript.TestScriptRequestMethodCode src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case DELETE: return org.hl7.fhir.dstu3.model.TestScript.TestScriptRequestMethodCode.DELETE; + case GET: return org.hl7.fhir.dstu3.model.TestScript.TestScriptRequestMethodCode.GET; + case OPTIONS: return org.hl7.fhir.dstu3.model.TestScript.TestScriptRequestMethodCode.OPTIONS; + case PATCH: return org.hl7.fhir.dstu3.model.TestScript.TestScriptRequestMethodCode.PATCH; + case POST: return org.hl7.fhir.dstu3.model.TestScript.TestScriptRequestMethodCode.POST; + case PUT: return org.hl7.fhir.dstu3.model.TestScript.TestScriptRequestMethodCode.PUT; + default: return org.hl7.fhir.dstu3.model.TestScript.TestScriptRequestMethodCode.NULL; + } +} + + private static org.hl7.fhir.r5.model.TestScript.AssertionResponseTypes convertAssertionResponseTypes(org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case OKAY: return org.hl7.fhir.r5.model.TestScript.AssertionResponseTypes.OKAY; + case CREATED: return org.hl7.fhir.r5.model.TestScript.AssertionResponseTypes.CREATED; + case NOCONTENT: return org.hl7.fhir.r5.model.TestScript.AssertionResponseTypes.NOCONTENT; + case NOTMODIFIED: return org.hl7.fhir.r5.model.TestScript.AssertionResponseTypes.NOTMODIFIED; + case BAD: return org.hl7.fhir.r5.model.TestScript.AssertionResponseTypes.BAD; + case FORBIDDEN: return org.hl7.fhir.r5.model.TestScript.AssertionResponseTypes.FORBIDDEN; + case NOTFOUND: return org.hl7.fhir.r5.model.TestScript.AssertionResponseTypes.NOTFOUND; + case METHODNOTALLOWED: return org.hl7.fhir.r5.model.TestScript.AssertionResponseTypes.METHODNOTALLOWED; + case CONFLICT: return org.hl7.fhir.r5.model.TestScript.AssertionResponseTypes.CONFLICT; + case GONE: return org.hl7.fhir.r5.model.TestScript.AssertionResponseTypes.GONE; + case PRECONDITIONFAILED: return org.hl7.fhir.r5.model.TestScript.AssertionResponseTypes.PRECONDITIONFAILED; + case UNPROCESSABLE: return org.hl7.fhir.r5.model.TestScript.AssertionResponseTypes.UNPROCESSABLE; + default: return org.hl7.fhir.r5.model.TestScript.AssertionResponseTypes.NULL; + } +} + + private static org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes convertAssertionResponseTypes(org.hl7.fhir.r5.model.TestScript.AssertionResponseTypes src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case OKAY: return org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.OKAY; + case CREATED: return org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.CREATED; + case NOCONTENT: return org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.NOCONTENT; + case NOTMODIFIED: return org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.NOTMODIFIED; + case BAD: return org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.BAD; + case FORBIDDEN: return org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.FORBIDDEN; + case NOTFOUND: return org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.NOTFOUND; + case METHODNOTALLOWED: return org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.METHODNOTALLOWED; + case CONFLICT: return org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.CONFLICT; + case GONE: return org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.GONE; + case PRECONDITIONFAILED: return org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.PRECONDITIONFAILED; + case UNPROCESSABLE: return org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.UNPROCESSABLE; + default: return org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.NULL; + } + } + + public static org.hl7.fhir.r5.model.TestScript.TestScriptTestComponent convertTestScriptTestComponent(org.hl7.fhir.dstu3.model.TestScript.TestScriptTestComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.TestScript.TestScriptTestComponent tgt = new org.hl7.fhir.r5.model.TestScript.TestScriptTestComponent(); + copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu3.model.TestScript.TestActionComponent t : src.getAction()) + tgt.addAction(convertTestActionComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.TestScript.TestScriptTestComponent convertTestScriptTestComponent(org.hl7.fhir.r5.model.TestScript.TestScriptTestComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.TestScript.TestScriptTestComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.TestScriptTestComponent(); + copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.r5.model.TestScript.TestActionComponent t : src.getAction()) + tgt.addAction(convertTestActionComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.TestScript.TestActionComponent convertTestActionComponent(org.hl7.fhir.dstu3.model.TestScript.TestActionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.TestScript.TestActionComponent tgt = new org.hl7.fhir.r5.model.TestScript.TestActionComponent(); + copyElement(src, tgt); + if (src.hasOperation()) + tgt.setOperation(convertSetupActionOperationComponent(src.getOperation())); + if (src.hasAssert()) + tgt.setAssert(convertSetupActionAssertComponent(src.getAssert())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.TestScript.TestActionComponent convertTestActionComponent(org.hl7.fhir.r5.model.TestScript.TestActionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.TestScript.TestActionComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.TestActionComponent(); + copyElement(src, tgt); + if (src.hasOperation()) + tgt.setOperation(convertSetupActionOperationComponent(src.getOperation())); + if (src.hasAssert()) + tgt.setAssert(convertSetupActionAssertComponent(src.getAssert())); + return tgt; + } + + public static org.hl7.fhir.r5.model.TestScript.TestScriptTeardownComponent convertTestScriptTeardownComponent(org.hl7.fhir.dstu3.model.TestScript.TestScriptTeardownComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.TestScript.TestScriptTeardownComponent tgt = new org.hl7.fhir.r5.model.TestScript.TestScriptTeardownComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.dstu3.model.TestScript.TeardownActionComponent t : src.getAction()) + tgt.addAction(convertTeardownActionComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.TestScript.TestScriptTeardownComponent convertTestScriptTeardownComponent(org.hl7.fhir.r5.model.TestScript.TestScriptTeardownComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.TestScript.TestScriptTeardownComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.TestScriptTeardownComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.r5.model.TestScript.TeardownActionComponent t : src.getAction()) + tgt.addAction(convertTeardownActionComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.TestScript.TeardownActionComponent convertTeardownActionComponent(org.hl7.fhir.dstu3.model.TestScript.TeardownActionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.TestScript.TeardownActionComponent tgt = new org.hl7.fhir.r5.model.TestScript.TeardownActionComponent(); + copyElement(src, tgt); + if (src.hasOperation()) + tgt.setOperation(convertSetupActionOperationComponent(src.getOperation())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.TestScript.TeardownActionComponent convertTeardownActionComponent(org.hl7.fhir.r5.model.TestScript.TeardownActionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.TestScript.TeardownActionComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.TeardownActionComponent(); + copyElement(src, tgt); + if (src.hasOperation()) + tgt.setOperation(convertSetupActionOperationComponent(src.getOperation())); + return tgt; + } + + public static org.hl7.fhir.r5.model.ValueSet convertValueSet(org.hl7.fhir.dstu3.model.ValueSet src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ValueSet tgt = new org.hl7.fhir.r5.model.ValueSet(); + copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasTitle()) + tgt.setTitle(src.getTitle()); + if (src.hasStatus()) + tgt.setStatus(convertPublicationStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) + tgt.addContact(convertContactDetail(t)); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu3.model.UsageContext t : src.getUseContext()) + tgt.addUseContext(convertUsageContext(t)); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction()) + tgt.addJurisdiction(convertCodeableConcept(t)); + if (src.hasImmutable()) + tgt.setImmutable(src.getImmutable()); + if (src.hasPurpose()) + tgt.setPurpose(src.getPurpose()); + if (src.hasCopyright()) + tgt.setCopyright(src.getCopyright()); + if (src.hasExtensible()) + tgt.addExtension("http://hl7.org/fhir/StructureDefinition/valueset-extensible", new BooleanType(src.getExtensible())); + if (src.hasCompose()) + tgt.setCompose(convertValueSetComposeComponent(src.getCompose())); + if (src.hasExpansion()) + tgt.setExpansion(convertValueSetExpansionComponent(src.getExpansion())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ValueSet convertValueSet(org.hl7.fhir.r5.model.ValueSet src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.ValueSet tgt = new org.hl7.fhir.dstu3.model.ValueSet(); + copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasTitle()) + tgt.setTitle(src.getTitle()); + if (src.hasStatus()) + tgt.setStatus(convertPublicationStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.r5.model.ContactDetail t : src.getContact()) + tgt.addContact(convertContactDetail(t)); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.r5.model.UsageContext t : src.getUseContext()) + tgt.addUseContext(convertUsageContext(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getJurisdiction()) + tgt.addJurisdiction(convertCodeableConcept(t)); + if (src.hasImmutable()) + tgt.setImmutable(src.getImmutable()); + if (src.hasPurpose()) + tgt.setPurpose(src.getPurpose()); + if (src.hasCopyright()) + tgt.setCopyright(src.getCopyright()); + if (src.hasExtension("http://hl7.org/fhir/StructureDefinition/valueset-extensible")) + tgt.setExtensible(((BooleanType) src.getExtensionByUrl("http://hl7.org/fhir/StructureDefinition/valueset-extensible").getValue()).booleanValue()); + if (src.hasCompose()) + tgt.setCompose(convertValueSetComposeComponent(src.getCompose())); + if (src.hasExpansion()) + tgt.setExpansion(convertValueSetExpansionComponent(src.getExpansion())); + return tgt; + } + + public static org.hl7.fhir.r5.model.ValueSet.ValueSetComposeComponent convertValueSetComposeComponent(org.hl7.fhir.dstu3.model.ValueSet.ValueSetComposeComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ValueSet.ValueSetComposeComponent tgt = new org.hl7.fhir.r5.model.ValueSet.ValueSetComposeComponent(); + copyElement(src, tgt); + if (src.hasLockedDate()) + tgt.setLockedDate(src.getLockedDate()); + if (src.hasInactive()) + tgt.setInactive(src.getInactive()); + for (org.hl7.fhir.dstu3.model.ValueSet.ConceptSetComponent t : src.getInclude()) + tgt.addInclude(convertConceptSetComponent(t)); + for (org.hl7.fhir.dstu3.model.ValueSet.ConceptSetComponent t : src.getExclude()) + tgt.addExclude(convertConceptSetComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ValueSet.ValueSetComposeComponent convertValueSetComposeComponent(org.hl7.fhir.r5.model.ValueSet.ValueSetComposeComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.ValueSet.ValueSetComposeComponent tgt = new org.hl7.fhir.dstu3.model.ValueSet.ValueSetComposeComponent(); + copyElement(src, tgt); + if (src.hasLockedDate()) + tgt.setLockedDate(src.getLockedDate()); + if (src.hasInactive()) + tgt.setInactive(src.getInactive()); + for (org.hl7.fhir.r5.model.ValueSet.ConceptSetComponent t : src.getInclude()) + tgt.addInclude(convertConceptSetComponent(t)); + for (org.hl7.fhir.r5.model.ValueSet.ConceptSetComponent t : src.getExclude()) + tgt.addExclude(convertConceptSetComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.ValueSet.ConceptSetComponent convertConceptSetComponent(org.hl7.fhir.dstu3.model.ValueSet.ConceptSetComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ValueSet.ConceptSetComponent tgt = new org.hl7.fhir.r5.model.ValueSet.ConceptSetComponent(); + copyElement(src, tgt); + if (src.hasSystem()) + tgt.setSystem(src.getSystem()); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + for (org.hl7.fhir.dstu3.model.ValueSet.ConceptReferenceComponent t : src.getConcept()) + tgt.addConcept(convertConceptReferenceComponent(t)); + for (org.hl7.fhir.dstu3.model.ValueSet.ConceptSetFilterComponent t : src.getFilter()) + tgt.addFilter(convertConceptSetFilterComponent(t)); + for (org.hl7.fhir.dstu3.model.UriType t : src.getValueSet()) + tgt.addValueSet(t.getValue()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ValueSet.ConceptSetComponent convertConceptSetComponent(org.hl7.fhir.r5.model.ValueSet.ConceptSetComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.ValueSet.ConceptSetComponent tgt = new org.hl7.fhir.dstu3.model.ValueSet.ConceptSetComponent(); + copyElement(src, tgt); + if (src.hasSystem()) + tgt.setSystem(src.getSystem()); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + for (org.hl7.fhir.r5.model.ValueSet.ConceptReferenceComponent t : src.getConcept()) + tgt.addConcept(convertConceptReferenceComponent(t)); + for (org.hl7.fhir.r5.model.ValueSet.ConceptSetFilterComponent t : src.getFilter()) + tgt.addFilter(convertConceptSetFilterComponent(t)); + for (org.hl7.fhir.r5.model.UriType t : src.getValueSet()) + tgt.addValueSet(t.getValue()); + return tgt; + } + + public static org.hl7.fhir.r5.model.ValueSet.ConceptReferenceComponent convertConceptReferenceComponent(org.hl7.fhir.dstu3.model.ValueSet.ConceptReferenceComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ValueSet.ConceptReferenceComponent tgt = new org.hl7.fhir.r5.model.ValueSet.ConceptReferenceComponent(); + copyElement(src, tgt); + if (src.hasCode()) + tgt.setCode(src.getCode()); + if (src.hasDisplay()) + tgt.setDisplay(src.getDisplay()); + for (org.hl7.fhir.dstu3.model.ValueSet.ConceptReferenceDesignationComponent t : src.getDesignation()) + tgt.addDesignation(convertConceptReferenceDesignationComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ValueSet.ConceptReferenceComponent convertConceptReferenceComponent(org.hl7.fhir.r5.model.ValueSet.ConceptReferenceComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.ValueSet.ConceptReferenceComponent tgt = new org.hl7.fhir.dstu3.model.ValueSet.ConceptReferenceComponent(); + copyElement(src, tgt); + if (src.hasCode()) + tgt.setCode(src.getCode()); + if (src.hasDisplay()) + tgt.setDisplay(src.getDisplay()); + for (org.hl7.fhir.r5.model.ValueSet.ConceptReferenceDesignationComponent t : src.getDesignation()) + tgt.addDesignation(convertConceptReferenceDesignationComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.ValueSet.ConceptReferenceDesignationComponent convertConceptReferenceDesignationComponent(org.hl7.fhir.dstu3.model.ValueSet.ConceptReferenceDesignationComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ValueSet.ConceptReferenceDesignationComponent tgt = new org.hl7.fhir.r5.model.ValueSet.ConceptReferenceDesignationComponent(); + copyElement(src, tgt); + if (src.hasLanguage()) + tgt.setLanguage(src.getLanguage()); + if (src.hasUse()) + tgt.setUse(convertCoding(src.getUse())); + if (src.hasValue()) + tgt.setValue(src.getValue()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ValueSet.ConceptReferenceDesignationComponent convertConceptReferenceDesignationComponent(org.hl7.fhir.r5.model.ValueSet.ConceptReferenceDesignationComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.ValueSet.ConceptReferenceDesignationComponent tgt = new org.hl7.fhir.dstu3.model.ValueSet.ConceptReferenceDesignationComponent(); + copyElement(src, tgt); + if (src.hasLanguage()) + tgt.setLanguage(src.getLanguage()); + if (src.hasUse()) + tgt.setUse(convertCoding(src.getUse())); + if (src.hasValue()) + tgt.setValue(src.getValue()); + return tgt; + } + + public static org.hl7.fhir.r5.model.ValueSet.ConceptSetFilterComponent convertConceptSetFilterComponent(org.hl7.fhir.dstu3.model.ValueSet.ConceptSetFilterComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ValueSet.ConceptSetFilterComponent tgt = new org.hl7.fhir.r5.model.ValueSet.ConceptSetFilterComponent(); + copyElement(src, tgt); + if (src.hasProperty()) + tgt.setProperty(src.getProperty()); + if (src.hasOp()) + tgt.setOp(convertFilterOperator(src.getOp())); + if (src.hasValue()) + tgt.setValue(src.getValue()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ValueSet.ConceptSetFilterComponent convertConceptSetFilterComponent(org.hl7.fhir.r5.model.ValueSet.ConceptSetFilterComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.ValueSet.ConceptSetFilterComponent tgt = new org.hl7.fhir.dstu3.model.ValueSet.ConceptSetFilterComponent(); + copyElement(src, tgt); + if (src.hasProperty()) + tgt.setProperty(src.getProperty()); + if (src.hasOp()) + tgt.setOp(convertFilterOperator(src.getOp())); + if (src.hasValue()) + tgt.setValue(src.getValue()); + return tgt; + } + + private static org.hl7.fhir.r5.model.ValueSet.FilterOperator convertFilterOperator(org.hl7.fhir.dstu3.model.ValueSet.FilterOperator src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case EQUAL: return org.hl7.fhir.r5.model.ValueSet.FilterOperator.EQUAL; + case ISA: return org.hl7.fhir.r5.model.ValueSet.FilterOperator.ISA; + case DESCENDENTOF: return org.hl7.fhir.r5.model.ValueSet.FilterOperator.DESCENDENTOF; + case ISNOTA: return org.hl7.fhir.r5.model.ValueSet.FilterOperator.ISNOTA; + case REGEX: return org.hl7.fhir.r5.model.ValueSet.FilterOperator.REGEX; + case IN: return org.hl7.fhir.r5.model.ValueSet.FilterOperator.IN; + case NOTIN: return org.hl7.fhir.r5.model.ValueSet.FilterOperator.NOTIN; + case GENERALIZES: return org.hl7.fhir.r5.model.ValueSet.FilterOperator.GENERALIZES; + case EXISTS: return org.hl7.fhir.r5.model.ValueSet.FilterOperator.EXISTS; + default: return org.hl7.fhir.r5.model.ValueSet.FilterOperator.NULL; + } +} + + private static org.hl7.fhir.dstu3.model.ValueSet.FilterOperator convertFilterOperator(org.hl7.fhir.r5.model.ValueSet.FilterOperator src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case EQUAL: return org.hl7.fhir.dstu3.model.ValueSet.FilterOperator.EQUAL; + case ISA: return org.hl7.fhir.dstu3.model.ValueSet.FilterOperator.ISA; + case DESCENDENTOF: return org.hl7.fhir.dstu3.model.ValueSet.FilterOperator.DESCENDENTOF; + case ISNOTA: return org.hl7.fhir.dstu3.model.ValueSet.FilterOperator.ISNOTA; + case REGEX: return org.hl7.fhir.dstu3.model.ValueSet.FilterOperator.REGEX; + case IN: return org.hl7.fhir.dstu3.model.ValueSet.FilterOperator.IN; + case NOTIN: return org.hl7.fhir.dstu3.model.ValueSet.FilterOperator.NOTIN; + case GENERALIZES: return org.hl7.fhir.dstu3.model.ValueSet.FilterOperator.GENERALIZES; + case EXISTS: return org.hl7.fhir.dstu3.model.ValueSet.FilterOperator.EXISTS; + default: return org.hl7.fhir.dstu3.model.ValueSet.FilterOperator.NULL; + } +} + + public static org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionComponent convertValueSetExpansionComponent(org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionComponent tgt = new org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionComponent(); + copyElement(src, tgt); + if (src.hasIdentifier()) + tgt.setIdentifier(src.getIdentifier()); + if (src.hasTimestamp()) + tgt.setTimestamp(src.getTimestamp()); + if (src.hasTotal()) + tgt.setTotal(src.getTotal()); + if (src.hasOffset()) + tgt.setOffset(src.getOffset()); + for (org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionParameterComponent t : src.getParameter()) + tgt.addParameter(convertValueSetExpansionParameterComponent(t)); + for (org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionContainsComponent t : src.getContains()) + tgt.addContains(convertValueSetExpansionContainsComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionComponent convertValueSetExpansionComponent(org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionComponent tgt = new org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionComponent(); + copyElement(src, tgt); + if (src.hasIdentifier()) + tgt.setIdentifier(src.getIdentifier()); + if (src.hasTimestamp()) + tgt.setTimestamp(src.getTimestamp()); + if (src.hasTotal()) + tgt.setTotal(src.getTotal()); + if (src.hasOffset()) + tgt.setOffset(src.getOffset()); + for (org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionParameterComponent t : src.getParameter()) + tgt.addParameter(convertValueSetExpansionParameterComponent(t)); + for (org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionContainsComponent t : src.getContains()) + tgt.addContains(convertValueSetExpansionContainsComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionParameterComponent convertValueSetExpansionParameterComponent(org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionParameterComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionParameterComponent tgt = new org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionParameterComponent(); + copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasValue()) + tgt.setValue(convertType(src.getValue())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionParameterComponent convertValueSetExpansionParameterComponent(org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionParameterComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionParameterComponent tgt = new org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionParameterComponent(); + copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasValue()) + tgt.setValue(convertType(src.getValue())); + return tgt; + } + + public static org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionContainsComponent convertValueSetExpansionContainsComponent(org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionContainsComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionContainsComponent tgt = new org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionContainsComponent(); + copyElement(src, tgt); + if (src.hasSystem()) + tgt.setSystem(src.getSystem()); + if (src.hasAbstract()) + tgt.setAbstract(src.getAbstract()); + if (src.hasInactive()) + tgt.setInactive(src.getInactive()); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasCode()) + tgt.setCode(src.getCode()); + if (src.hasDisplay()) + tgt.setDisplay(src.getDisplay()); + for (org.hl7.fhir.dstu3.model.ValueSet.ConceptReferenceDesignationComponent t : src.getDesignation()) + tgt.addDesignation(convertConceptReferenceDesignationComponent(t)); + for (org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionContainsComponent t : src.getContains()) + tgt.addContains(convertValueSetExpansionContainsComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionContainsComponent convertValueSetExpansionContainsComponent(org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionContainsComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionContainsComponent tgt = new org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionContainsComponent(); + copyElement(src, tgt); + if (src.hasSystem()) + tgt.setSystem(src.getSystem()); + if (src.hasAbstract()) + tgt.setAbstract(src.getAbstract()); + if (src.hasInactive()) + tgt.setInactive(src.getInactive()); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasCode()) + tgt.setCode(src.getCode()); + if (src.hasDisplay()) + tgt.setDisplay(src.getDisplay()); + for (org.hl7.fhir.r5.model.ValueSet.ConceptReferenceDesignationComponent t : src.getDesignation()) + tgt.addDesignation(convertConceptReferenceDesignationComponent(t)); + for (org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionContainsComponent t : src.getContains()) + tgt.addContains(convertValueSetExpansionContainsComponent(t)); + return tgt; + } + +// public static org.hl7.fhir.r5.model.VisionPrescription convertVisionPrescription(org.hl7.fhir.dstu3.model.VisionPrescription src) throws FHIRException { +// if (src == null) +// return null; +// org.hl7.fhir.r5.model.VisionPrescription tgt = new org.hl7.fhir.r5.model.VisionPrescription(); +// copyDomainResource(src, tgt); +// for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) +// tgt.addIdentifier(convertIdentifier(t)); +// if (src.hasStatus()) +// tgt.setStatus(convertVisionStatus(src.getStatus())); +// if (src.hasPatient()) +// tgt.setPatient(convertReference(src.getPatient())); +// if (src.hasEncounter()) +// tgt.setEncounter(convertReference(src.getEncounter())); +// if (src.hasDateWritten()) +// tgt.setDateWritten(src.getDateWritten()); +// if (src.hasPrescriber()) +// tgt.setPrescriber(convertReference(src.getPrescriber())); +// if (src.hasReason()) +// tgt.setReason(convertType(src.getReason())); +// for (org.hl7.fhir.dstu3.model.VisionPrescription.VisionPrescriptionDispenseComponent t : src.getDispense()) +// tgt.addDispense(convertVisionPrescriptionDispenseComponent(t)); +// return tgt; +// } +// +// public static org.hl7.fhir.dstu3.model.VisionPrescription convertVisionPrescription(org.hl7.fhir.r5.model.VisionPrescription src) throws FHIRException { +// if (src == null) +// return null; +// org.hl7.fhir.dstu3.model.VisionPrescription tgt = new org.hl7.fhir.dstu3.model.VisionPrescription(); +// copyDomainResource(src, tgt); +// for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) +// tgt.addIdentifier(convertIdentifier(t)); +// if (src.hasStatus()) +// tgt.setStatus(convertVisionStatus(src.getStatus())); +// if (src.hasPatient()) +// tgt.setPatient(convertReference(src.getPatient())); +// if (src.hasEncounter()) +// tgt.setEncounter(convertReference(src.getEncounter())); +// if (src.hasDateWritten()) +// tgt.setDateWritten(src.getDateWritten()); +// if (src.hasPrescriber()) +// tgt.setPrescriber(convertReference(src.getPrescriber())); +// if (src.hasReason()) +// tgt.setReason(convertType(src.getReason())); +// for (org.hl7.fhir.r5.model.VisionPrescription.VisionPrescriptionDispenseComponent t : src.getDispense()) +// tgt.addDispense(convertVisionPrescriptionDispenseComponent(t)); +// return tgt; +// } +// +// private static org.hl7.fhir.r5.model.VisionPrescription.VisionStatus convertVisionStatus(org.hl7.fhir.dstu3.model.VisionPrescription.VisionStatus src) throws FHIRException { +// if (src == null) +// return null; +// switch (src) { +// case ACTIVE: return org.hl7.fhir.r5.model.VisionPrescription.VisionStatus.ACTIVE; +// case CANCELLED: return org.hl7.fhir.r5.model.VisionPrescription.VisionStatus.CANCELLED; +// case DRAFT: return org.hl7.fhir.r5.model.VisionPrescription.VisionStatus.DRAFT; +// case ENTEREDINERROR: return org.hl7.fhir.r5.model.VisionPrescription.VisionStatus.ENTEREDINERROR; +// default: return org.hl7.fhir.r5.model.VisionPrescription.VisionStatus.NULL; +// } +//} +// +// private static org.hl7.fhir.dstu3.model.VisionPrescription.VisionStatus convertVisionStatus(org.hl7.fhir.r5.model.VisionPrescription.VisionStatus src) throws FHIRException { +// if (src == null) +// return null; +// switch (src) { +// case ACTIVE: return org.hl7.fhir.dstu3.model.VisionPrescription.VisionStatus.ACTIVE; +// case CANCELLED: return org.hl7.fhir.dstu3.model.VisionPrescription.VisionStatus.CANCELLED; +// case DRAFT: return org.hl7.fhir.dstu3.model.VisionPrescription.VisionStatus.DRAFT; +// case ENTEREDINERROR: return org.hl7.fhir.dstu3.model.VisionPrescription.VisionStatus.ENTEREDINERROR; +// default: return org.hl7.fhir.dstu3.model.VisionPrescription.VisionStatus.NULL; +// } +//} +// +// public static org.hl7.fhir.r5.model.VisionPrescription.VisionPrescriptionDispenseComponent convertVisionPrescriptionDispenseComponent(org.hl7.fhir.dstu3.model.VisionPrescription.VisionPrescriptionDispenseComponent src) throws FHIRException { +// if (src == null) +// return null; +// org.hl7.fhir.r5.model.VisionPrescription.VisionPrescriptionDispenseComponent tgt = new org.hl7.fhir.r5.model.VisionPrescription.VisionPrescriptionDispenseComponent(); +// copyElement(src, tgt); +// if (src.hasProduct()) +// tgt.setProduct(convertCodeableConcept(src.getProduct())); +// if (src.hasEye()) +// tgt.setEye(convertVisionEyes(src.getEye())); +// if (src.hasSphere()) +// tgt.setSphere(src.getSphere()); +// if (src.hasCylinder()) +// tgt.setCylinder(src.getCylinder()); +// if (src.hasAxis()) +// tgt.setAxis(src.getAxis()); +// if (src.hasPrism()) +// tgt.setPrism(src.getPrism()); +// if (src.hasBase()) +// tgt.setBase(convertVisionBase(src.getBase())); +// if (src.hasAdd()) +// tgt.setAdd(src.getAdd()); +// if (src.hasPower()) +// tgt.setPower(src.getPower()); +// if (src.hasBackCurve()) +// tgt.setBackCurve(src.getBackCurve()); +// if (src.hasDiameter()) +// tgt.setDiameter(src.getDiameter()); +// if (src.hasDuration()) +// tgt.setDuration(convertSimpleQuantity(src.getDuration())); +// if (src.hasColor()) +// tgt.setColor(src.getColor()); +// if (src.hasBrand()) +// tgt.setBrand(src.getBrand()); +// for (org.hl7.fhir.dstu3.model.Annotation t : src.getNote()) +// tgt.addNote(convertAnnotation(t)); +// return tgt; +// } +// +// public static org.hl7.fhir.dstu3.model.VisionPrescription.VisionPrescriptionDispenseComponent convertVisionPrescriptionDispenseComponent(org.hl7.fhir.r5.model.VisionPrescription.VisionPrescriptionDispenseComponent src) throws FHIRException { +// if (src == null) +// return null; +// org.hl7.fhir.dstu3.model.VisionPrescription.VisionPrescriptionDispenseComponent tgt = new org.hl7.fhir.dstu3.model.VisionPrescription.VisionPrescriptionDispenseComponent(); +// copyElement(src, tgt); +// if (src.hasProduct()) +// tgt.setProduct(convertCodeableConcept(src.getProduct())); +// if (src.hasEye()) +// tgt.setEye(convertVisionEyes(src.getEye())); +// if (src.hasSphere()) +// tgt.setSphere(src.getSphere()); +// if (src.hasCylinder()) +// tgt.setCylinder(src.getCylinder()); +// if (src.hasAxis()) +// tgt.setAxis(src.getAxis()); +// if (src.hasPrism()) +// tgt.setPrism(src.getPrism()); +// if (src.hasBase()) +// tgt.setBase(convertVisionBase(src.getBase())); +// if (src.hasAdd()) +// tgt.setAdd(src.getAdd()); +// if (src.hasPower()) +// tgt.setPower(src.getPower()); +// if (src.hasBackCurve()) +// tgt.setBackCurve(src.getBackCurve()); +// if (src.hasDiameter()) +// tgt.setDiameter(src.getDiameter()); +// if (src.hasDuration()) +// tgt.setDuration(convertSimpleQuantity(src.getDuration())); +// if (src.hasColor()) +// tgt.setColor(src.getColor()); +// if (src.hasBrand()) +// tgt.setBrand(src.getBrand()); +// for (org.hl7.fhir.r5.model.Annotation t : src.getNote()) +// tgt.addNote(convertAnnotation(t)); +// return tgt; +// } +// +// private static org.hl7.fhir.r5.model.VisionPrescription.VisionEyes convertVisionEyes(org.hl7.fhir.dstu3.model.VisionPrescription.VisionEyes src) throws FHIRException { +// if (src == null) +// return null; +// switch (src) { +// case RIGHT: return org.hl7.fhir.r5.model.VisionPrescription.VisionEyes.RIGHT; +// case LEFT: return org.hl7.fhir.r5.model.VisionPrescription.VisionEyes.LEFT; +// default: return org.hl7.fhir.r5.model.VisionPrescription.VisionEyes.NULL; +// } +//} +// +// private static org.hl7.fhir.dstu3.model.VisionPrescription.VisionEyes convertVisionEyes(org.hl7.fhir.r5.model.VisionPrescription.VisionEyes src) throws FHIRException { +// if (src == null) +// return null; +// switch (src) { +// case RIGHT: return org.hl7.fhir.dstu3.model.VisionPrescription.VisionEyes.RIGHT; +// case LEFT: return org.hl7.fhir.dstu3.model.VisionPrescription.VisionEyes.LEFT; +// default: return org.hl7.fhir.dstu3.model.VisionPrescription.VisionEyes.NULL; +// } +//} +// +// private static org.hl7.fhir.r5.model.VisionPrescription.VisionBase convertVisionBase(org.hl7.fhir.dstu3.model.VisionPrescription.VisionBase src) throws FHIRException { +// if (src == null) +// return null; +// switch (src) { +// case UP: return org.hl7.fhir.r5.model.VisionPrescription.VisionBase.UP; +// case DOWN: return org.hl7.fhir.r5.model.VisionPrescription.VisionBase.DOWN; +// case IN: return org.hl7.fhir.r5.model.VisionPrescription.VisionBase.IN; +// case OUT: return org.hl7.fhir.r5.model.VisionPrescription.VisionBase.OUT; +// default: return org.hl7.fhir.r5.model.VisionPrescription.VisionBase.NULL; +// } +//} +// +// private static org.hl7.fhir.dstu3.model.VisionPrescription.VisionBase convertVisionBase(org.hl7.fhir.r5.model.VisionPrescription.VisionBase src) throws FHIRException { +// if (src == null) +// return null; +// switch (src) { +// case UP: return org.hl7.fhir.dstu3.model.VisionPrescription.VisionBase.UP; +// case DOWN: return org.hl7.fhir.dstu3.model.VisionPrescription.VisionBase.DOWN; +// case IN: return org.hl7.fhir.dstu3.model.VisionPrescription.VisionBase.IN; +// case OUT: return org.hl7.fhir.dstu3.model.VisionPrescription.VisionBase.OUT; +// default: return org.hl7.fhir.dstu3.model.VisionPrescription.VisionBase.NULL; +// } +//} + + public static org.hl7.fhir.r5.model.PlanDefinition convertPlanDefinition(org.hl7.fhir.dstu3.model.PlanDefinition src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.PlanDefinition tgt = new org.hl7.fhir.r5.model.PlanDefinition(); + copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasTitle()) + tgt.setTitle(src.getTitle()); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + if (src.hasStatus()) + tgt.setStatus(convertPublicationStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + if (src.hasPurpose()) + tgt.setPurpose(src.getPurpose()); + if (src.hasUsage()) + tgt.setUsage(src.getUsage()); + if (src.hasApprovalDate()) + tgt.setApprovalDate(src.getApprovalDate()); + if (src.hasLastReviewDate()) + tgt.setLastReviewDate(src.getLastReviewDate()); + if (src.hasEffectivePeriod()) + tgt.setEffectivePeriod(convertPeriod(src.getEffectivePeriod())); + for (org.hl7.fhir.dstu3.model.UsageContext t : src.getUseContext()) + tgt.addUseContext(convertUsageContext(t)); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction()) + tgt.addJurisdiction(convertCodeableConcept(t)); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getTopic()) + tgt.addTopic(convertCodeableConcept(t)); + for (org.hl7.fhir.dstu3.model.Contributor t : src.getContributor()) { + if (t.getType() == ContributorType.AUTHOR) + for (ContactDetail c : t.getContact()) + tgt.addAuthor(convertContactDetail(c)); + if (t.getType() == ContributorType.EDITOR) + for (ContactDetail c : t.getContact()) + tgt.addEditor(convertContactDetail(c)); + if (t.getType() == ContributorType.REVIEWER) + for (ContactDetail c : t.getContact()) + tgt.addReviewer(convertContactDetail(c)); + if (t.getType() == ContributorType.ENDORSER) + for (ContactDetail c : t.getContact()) + tgt.addEndorser(convertContactDetail(c)); + } + for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) + tgt.addContact(convertContactDetail(t)); + if (src.hasCopyright()) + tgt.setCopyright(src.getCopyright()); + for (org.hl7.fhir.dstu3.model.RelatedArtifact t : src.getRelatedArtifact()) + tgt.addRelatedArtifact(convertRelatedArtifact(t)); + for (org.hl7.fhir.dstu3.model.Reference t : src.getLibrary()) + tgt.getLibrary().add(convertReferenceToCanonical(t)); + for (org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionGoalComponent t : src.getGoal()) + tgt.addGoal(convertPlanDefinitionGoalComponent(t)); + for (org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionActionComponent t : src.getAction()) + tgt.addAction(convertPlanDefinitionActionComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.PlanDefinition convertPlanDefinition(org.hl7.fhir.r5.model.PlanDefinition src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.PlanDefinition tgt = new org.hl7.fhir.dstu3.model.PlanDefinition(); + copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasTitle()) + tgt.setTitle(src.getTitle()); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + if (src.hasStatus()) + tgt.setStatus(convertPublicationStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + if (src.hasPurpose()) + tgt.setPurpose(src.getPurpose()); + if (src.hasUsage()) + tgt.setUsage(src.getUsage()); + if (src.hasApprovalDate()) + tgt.setApprovalDate(src.getApprovalDate()); + if (src.hasLastReviewDate()) + tgt.setLastReviewDate(src.getLastReviewDate()); + if (src.hasEffectivePeriod()) + tgt.setEffectivePeriod(convertPeriod(src.getEffectivePeriod())); + for (org.hl7.fhir.r5.model.UsageContext t : src.getUseContext()) + tgt.addUseContext(convertUsageContext(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getJurisdiction()) + tgt.addJurisdiction(convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getTopic()) + tgt.addTopic(convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.ContactDetail t : src.getAuthor()) { + org.hl7.fhir.dstu3.model.Contributor c = new org.hl7.fhir.dstu3.model.Contributor(); + c.setType(ContributorType.AUTHOR); + c.addContact(convertContactDetail(t)); + tgt.addContributor(c); + } + for (org.hl7.fhir.r5.model.ContactDetail t : src.getEditor()) { + org.hl7.fhir.dstu3.model.Contributor c = new org.hl7.fhir.dstu3.model.Contributor(); + c.setType(ContributorType.EDITOR); + c.addContact(convertContactDetail(t)); + tgt.addContributor(c); + } + for (org.hl7.fhir.r5.model.ContactDetail t : src.getReviewer()) { + org.hl7.fhir.dstu3.model.Contributor c = new org.hl7.fhir.dstu3.model.Contributor(); + c.setType(ContributorType.REVIEWER); + c.addContact(convertContactDetail(t)); + tgt.addContributor(c); + } + for (org.hl7.fhir.r5.model.ContactDetail t : src.getEndorser()) { + org.hl7.fhir.dstu3.model.Contributor c = new org.hl7.fhir.dstu3.model.Contributor(); + c.setType(ContributorType.ENDORSER); + c.addContact(convertContactDetail(t)); + tgt.addContributor(c); + } + for (org.hl7.fhir.r5.model.ContactDetail t : src.getContact()) + tgt.addContact(convertContactDetail(t)); + if (src.hasCopyright()) + tgt.setCopyright(src.getCopyright()); + for (org.hl7.fhir.r5.model.RelatedArtifact t : src.getRelatedArtifact()) + tgt.addRelatedArtifact(convertRelatedArtifact(t)); + for (org.hl7.fhir.r5.model.CanonicalType t : src.getLibrary()) + tgt.addLibrary(convertCanonicalToReference(t)); + for (org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionGoalComponent t : src.getGoal()) + tgt.addGoal(convertPlanDefinitionGoalComponent(t)); + for (org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionActionComponent t : src.getAction()) + tgt.addAction(convertPlanDefinitionActionComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionGoalComponent convertPlanDefinitionGoalComponent(org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionGoalComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionGoalComponent tgt = new org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionGoalComponent(); + copyElement(src, tgt); + if (src.hasCategory()) + tgt.setCategory(convertCodeableConcept(src.getCategory())); + if (src.hasDescription()) + tgt.setDescription(convertCodeableConcept(src.getDescription())); + if (src.hasPriority()) + tgt.setPriority(convertCodeableConcept(src.getPriority())); + if (src.hasStart()) + tgt.setStart(convertCodeableConcept(src.getStart())); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getAddresses()) + tgt.addAddresses(convertCodeableConcept(t)); + for (org.hl7.fhir.dstu3.model.RelatedArtifact t : src.getDocumentation()) + tgt.addDocumentation(convertRelatedArtifact(t)); + for (org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionGoalTargetComponent t : src.getTarget()) + tgt.addTarget(convertPlanDefinitionGoalTargetComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionGoalComponent convertPlanDefinitionGoalComponent(org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionGoalComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionGoalComponent tgt = new org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionGoalComponent(); + copyElement(src, tgt); + if (src.hasCategory()) + tgt.setCategory(convertCodeableConcept(src.getCategory())); + if (src.hasDescription()) + tgt.setDescription(convertCodeableConcept(src.getDescription())); + if (src.hasPriority()) + tgt.setPriority(convertCodeableConcept(src.getPriority())); + if (src.hasStart()) + tgt.setStart(convertCodeableConcept(src.getStart())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getAddresses()) + tgt.addAddresses(convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.RelatedArtifact t : src.getDocumentation()) + tgt.addDocumentation(convertRelatedArtifact(t)); + for (org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionGoalTargetComponent t : src.getTarget()) + tgt.addTarget(convertPlanDefinitionGoalTargetComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionGoalTargetComponent convertPlanDefinitionGoalTargetComponent(org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionGoalTargetComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionGoalTargetComponent tgt = new org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionGoalTargetComponent(); + copyElement(src, tgt); + if (src.hasMeasure()) + tgt.setMeasure(convertCodeableConcept(src.getMeasure())); + if (src.hasDetail()) + tgt.setDetail(convertType(src.getDetail())); + if (src.hasDue()) + tgt.setDue(convertDuration(src.getDue())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionGoalTargetComponent convertPlanDefinitionGoalTargetComponent(org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionGoalTargetComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionGoalTargetComponent tgt = new org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionGoalTargetComponent(); + copyElement(src, tgt); + if (src.hasMeasure()) + tgt.setMeasure(convertCodeableConcept(src.getMeasure())); + if (src.hasDetail()) + tgt.setDetail(convertType(src.getDetail())); + if (src.hasDue()) + tgt.setDue(convertDuration(src.getDue())); + return tgt; + } + + public static org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionActionComponent convertPlanDefinitionActionComponent(org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionActionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionActionComponent tgt = new org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionActionComponent(); + copyElement(src, tgt); + if (src.hasLabel()) + tgt.setPrefix(src.getLabel()); + if (src.hasTitle()) + tgt.setTitle(src.getTitle()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + if (src.hasTextEquivalent()) + tgt.setTextEquivalent(src.getTextEquivalent()); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getCode()) + tgt.addCode(convertCodeableConcept(t)); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getReason()) + tgt.addReason(convertCodeableConcept(t)); + for (org.hl7.fhir.dstu3.model.RelatedArtifact t : src.getDocumentation()) + tgt.addDocumentation(convertRelatedArtifact(t)); + for (org.hl7.fhir.dstu3.model.IdType t : src.getGoalId()) + tgt.addGoalId(t.getValue()); + for (org.hl7.fhir.dstu3.model.TriggerDefinition t : src.getTriggerDefinition()) + tgt.addTrigger(convertTriggerDefinition(t)); + for (org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionActionConditionComponent t : src.getCondition()) + tgt.addCondition(convertPlanDefinitionActionConditionComponent(t)); + for (org.hl7.fhir.dstu3.model.DataRequirement t : src.getInput()) + tgt.addInput(convertDataRequirement(t)); + for (org.hl7.fhir.dstu3.model.DataRequirement t : src.getOutput()) + tgt.addOutput(convertDataRequirement(t)); + for (org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionActionRelatedActionComponent t : src.getRelatedAction()) + tgt.addRelatedAction(convertPlanDefinitionActionRelatedActionComponent(t)); + if (src.hasTiming()) + tgt.setTiming(convertType(src.getTiming())); + for (org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionActionParticipantComponent t : src.getParticipant()) + tgt.addParticipant(convertPlanDefinitionActionParticipantComponent(t)); + if (src.hasType()) + tgt.getType().addCoding(convertCoding(src.getType())); + if (src.hasGroupingBehavior()) + tgt.setGroupingBehavior(convertActionGroupingBehavior(src.getGroupingBehavior())); + if (src.hasSelectionBehavior()) + tgt.setSelectionBehavior(convertActionSelectionBehavior(src.getSelectionBehavior())); + if (src.hasRequiredBehavior()) + tgt.setRequiredBehavior(convertActionRequiredBehavior(src.getRequiredBehavior())); + if (src.hasPrecheckBehavior()) + tgt.setPrecheckBehavior(convertActionPrecheckBehavior(src.getPrecheckBehavior())); + if (src.hasCardinalityBehavior()) + tgt.setCardinalityBehavior(convertActionCardinalityBehavior(src.getCardinalityBehavior())); + if (src.hasDefinition()) + tgt.setDefinition(convertReferenceToCanonical(src.getDefinition())); + if (src.hasTransform()) + tgt.setTransformElement(convertReferenceToCanonical(src.getTransform())); + for (org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionActionDynamicValueComponent t : src.getDynamicValue()) + tgt.addDynamicValue(convertPlanDefinitionActionDynamicValueComponent(t)); + for (org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionActionComponent t : src.getAction()) + tgt.addAction(convertPlanDefinitionActionComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionActionComponent convertPlanDefinitionActionComponent(org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionActionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionActionComponent tgt = new org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionActionComponent(); + copyElement(src, tgt); + if (src.hasPrefix()) + tgt.setLabel(src.getPrefix()); + if (src.hasTitle()) + tgt.setTitle(src.getTitle()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + if (src.hasTextEquivalent()) + tgt.setTextEquivalent(src.getTextEquivalent()); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getCode()) + tgt.addCode(convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getReason()) + tgt.addReason(convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.RelatedArtifact t : src.getDocumentation()) + tgt.addDocumentation(convertRelatedArtifact(t)); + for (org.hl7.fhir.r5.model.IdType t : src.getGoalId()) + tgt.addGoalId(t.getValue()); + for (org.hl7.fhir.r5.model.TriggerDefinition t : src.getTrigger()) + tgt.addTriggerDefinition(convertTriggerDefinition(t)); + for (org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionActionConditionComponent t : src.getCondition()) + tgt.addCondition(convertPlanDefinitionActionConditionComponent(t)); + for (org.hl7.fhir.r5.model.DataRequirement t : src.getInput()) + tgt.addInput(convertDataRequirement(t)); + for (org.hl7.fhir.r5.model.DataRequirement t : src.getOutput()) + tgt.addOutput(convertDataRequirement(t)); + for (org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionActionRelatedActionComponent t : src.getRelatedAction()) + tgt.addRelatedAction(convertPlanDefinitionActionRelatedActionComponent(t)); + if (src.hasTiming()) + tgt.setTiming(convertType(src.getTiming())); + for (org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionActionParticipantComponent t : src.getParticipant()) + tgt.addParticipant(convertPlanDefinitionActionParticipantComponent(t)); + if (src.hasType()) + tgt.setType(convertCoding(src.getType().getCodingFirstRep())); + if (src.hasGroupingBehavior()) + tgt.setGroupingBehavior(convertActionGroupingBehavior(src.getGroupingBehavior())); + if (src.hasSelectionBehavior()) + tgt.setSelectionBehavior(convertActionSelectionBehavior(src.getSelectionBehavior())); + if (src.hasRequiredBehavior()) + tgt.setRequiredBehavior(convertActionRequiredBehavior(src.getRequiredBehavior())); + if (src.hasPrecheckBehavior()) + tgt.setPrecheckBehavior(convertActionPrecheckBehavior(src.getPrecheckBehavior())); + if (src.hasCardinalityBehavior()) + tgt.setCardinalityBehavior(convertActionCardinalityBehavior(src.getCardinalityBehavior())); + if (src.hasDefinitionCanonicalType()) + tgt.setDefinition(convertCanonicalToReference(src.getDefinitionCanonicalType())); + if (src.hasTransform()) + tgt.setTransform(convertCanonicalToReference(src.getTransformElement())); + for (org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionActionDynamicValueComponent t : src.getDynamicValue()) + tgt.addDynamicValue(convertPlanDefinitionActionDynamicValueComponent(t)); + for (org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionActionComponent t : src.getAction()) + tgt.addAction(convertPlanDefinitionActionComponent(t)); + return tgt; + } + + private static org.hl7.fhir.r5.model.PlanDefinition.ActionGroupingBehavior convertActionGroupingBehavior(org.hl7.fhir.dstu3.model.PlanDefinition.ActionGroupingBehavior src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case VISUALGROUP: return org.hl7.fhir.r5.model.PlanDefinition.ActionGroupingBehavior.VISUALGROUP; + case LOGICALGROUP: return org.hl7.fhir.r5.model.PlanDefinition.ActionGroupingBehavior.LOGICALGROUP; + case SENTENCEGROUP: return org.hl7.fhir.r5.model.PlanDefinition.ActionGroupingBehavior.SENTENCEGROUP; + default: return org.hl7.fhir.r5.model.PlanDefinition.ActionGroupingBehavior.NULL; + } +} + + private static org.hl7.fhir.dstu3.model.PlanDefinition.ActionGroupingBehavior convertActionGroupingBehavior(org.hl7.fhir.r5.model.PlanDefinition.ActionGroupingBehavior src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case VISUALGROUP: return org.hl7.fhir.dstu3.model.PlanDefinition.ActionGroupingBehavior.VISUALGROUP; + case LOGICALGROUP: return org.hl7.fhir.dstu3.model.PlanDefinition.ActionGroupingBehavior.LOGICALGROUP; + case SENTENCEGROUP: return org.hl7.fhir.dstu3.model.PlanDefinition.ActionGroupingBehavior.SENTENCEGROUP; + default: return org.hl7.fhir.dstu3.model.PlanDefinition.ActionGroupingBehavior.NULL; + } +} + + private static org.hl7.fhir.r5.model.PlanDefinition.ActionSelectionBehavior convertActionSelectionBehavior(org.hl7.fhir.dstu3.model.PlanDefinition.ActionSelectionBehavior src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case ANY: return org.hl7.fhir.r5.model.PlanDefinition.ActionSelectionBehavior.ANY; + case ALL: return org.hl7.fhir.r5.model.PlanDefinition.ActionSelectionBehavior.ALL; + case ALLORNONE: return org.hl7.fhir.r5.model.PlanDefinition.ActionSelectionBehavior.ALLORNONE; + case EXACTLYONE: return org.hl7.fhir.r5.model.PlanDefinition.ActionSelectionBehavior.EXACTLYONE; + case ATMOSTONE: return org.hl7.fhir.r5.model.PlanDefinition.ActionSelectionBehavior.ATMOSTONE; + case ONEORMORE: return org.hl7.fhir.r5.model.PlanDefinition.ActionSelectionBehavior.ONEORMORE; + default: return org.hl7.fhir.r5.model.PlanDefinition.ActionSelectionBehavior.NULL; + } +} + + private static org.hl7.fhir.dstu3.model.PlanDefinition.ActionSelectionBehavior convertActionSelectionBehavior(org.hl7.fhir.r5.model.PlanDefinition.ActionSelectionBehavior src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case ANY: return org.hl7.fhir.dstu3.model.PlanDefinition.ActionSelectionBehavior.ANY; + case ALL: return org.hl7.fhir.dstu3.model.PlanDefinition.ActionSelectionBehavior.ALL; + case ALLORNONE: return org.hl7.fhir.dstu3.model.PlanDefinition.ActionSelectionBehavior.ALLORNONE; + case EXACTLYONE: return org.hl7.fhir.dstu3.model.PlanDefinition.ActionSelectionBehavior.EXACTLYONE; + case ATMOSTONE: return org.hl7.fhir.dstu3.model.PlanDefinition.ActionSelectionBehavior.ATMOSTONE; + case ONEORMORE: return org.hl7.fhir.dstu3.model.PlanDefinition.ActionSelectionBehavior.ONEORMORE; + default: return org.hl7.fhir.dstu3.model.PlanDefinition.ActionSelectionBehavior.NULL; + } +} + + private static org.hl7.fhir.r5.model.PlanDefinition.ActionRequiredBehavior convertActionRequiredBehavior(org.hl7.fhir.dstu3.model.PlanDefinition.ActionRequiredBehavior src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case MUST: return org.hl7.fhir.r5.model.PlanDefinition.ActionRequiredBehavior.MUST; + case COULD: return org.hl7.fhir.r5.model.PlanDefinition.ActionRequiredBehavior.COULD; + case MUSTUNLESSDOCUMENTED: return org.hl7.fhir.r5.model.PlanDefinition.ActionRequiredBehavior.MUSTUNLESSDOCUMENTED; + default: return org.hl7.fhir.r5.model.PlanDefinition.ActionRequiredBehavior.NULL; + } +} + + private static org.hl7.fhir.dstu3.model.PlanDefinition.ActionRequiredBehavior convertActionRequiredBehavior(org.hl7.fhir.r5.model.PlanDefinition.ActionRequiredBehavior src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case MUST: return org.hl7.fhir.dstu3.model.PlanDefinition.ActionRequiredBehavior.MUST; + case COULD: return org.hl7.fhir.dstu3.model.PlanDefinition.ActionRequiredBehavior.COULD; + case MUSTUNLESSDOCUMENTED: return org.hl7.fhir.dstu3.model.PlanDefinition.ActionRequiredBehavior.MUSTUNLESSDOCUMENTED; + default: return org.hl7.fhir.dstu3.model.PlanDefinition.ActionRequiredBehavior.NULL; + } +} + + private static org.hl7.fhir.r5.model.PlanDefinition.ActionPrecheckBehavior convertActionPrecheckBehavior(org.hl7.fhir.dstu3.model.PlanDefinition.ActionPrecheckBehavior src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case YES: return org.hl7.fhir.r5.model.PlanDefinition.ActionPrecheckBehavior.YES; + case NO: return org.hl7.fhir.r5.model.PlanDefinition.ActionPrecheckBehavior.NO; + default: return org.hl7.fhir.r5.model.PlanDefinition.ActionPrecheckBehavior.NULL; + } +} + + private static org.hl7.fhir.dstu3.model.PlanDefinition.ActionPrecheckBehavior convertActionPrecheckBehavior(org.hl7.fhir.r5.model.PlanDefinition.ActionPrecheckBehavior src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case YES: return org.hl7.fhir.dstu3.model.PlanDefinition.ActionPrecheckBehavior.YES; + case NO: return org.hl7.fhir.dstu3.model.PlanDefinition.ActionPrecheckBehavior.NO; + default: return org.hl7.fhir.dstu3.model.PlanDefinition.ActionPrecheckBehavior.NULL; + } +} + + private static org.hl7.fhir.r5.model.PlanDefinition.ActionCardinalityBehavior convertActionCardinalityBehavior(org.hl7.fhir.dstu3.model.PlanDefinition.ActionCardinalityBehavior src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case SINGLE: return org.hl7.fhir.r5.model.PlanDefinition.ActionCardinalityBehavior.SINGLE; + case MULTIPLE: return org.hl7.fhir.r5.model.PlanDefinition.ActionCardinalityBehavior.MULTIPLE; + default: return org.hl7.fhir.r5.model.PlanDefinition.ActionCardinalityBehavior.NULL; + } +} + + private static org.hl7.fhir.dstu3.model.PlanDefinition.ActionCardinalityBehavior convertActionCardinalityBehavior(org.hl7.fhir.r5.model.PlanDefinition.ActionCardinalityBehavior src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case SINGLE: return org.hl7.fhir.dstu3.model.PlanDefinition.ActionCardinalityBehavior.SINGLE; + case MULTIPLE: return org.hl7.fhir.dstu3.model.PlanDefinition.ActionCardinalityBehavior.MULTIPLE; + default: return org.hl7.fhir.dstu3.model.PlanDefinition.ActionCardinalityBehavior.NULL; + } +} + + public static org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionActionConditionComponent convertPlanDefinitionActionConditionComponent(org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionActionConditionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionActionConditionComponent tgt = new org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionActionConditionComponent(); + copyElement(src, tgt); + if (src.hasKind()) + tgt.setKind(convertActionConditionKind(src.getKind())); + if (src.hasDescription()) + tgt.getExpression().setDescription(src.getDescription()); + if (src.hasLanguage()) + tgt.getExpression().setLanguage(ExpressionLanguage.fromCode(src.getLanguage())); + if (src.hasExpression()) + tgt.getExpression().setExpression(src.getExpression()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionActionConditionComponent convertPlanDefinitionActionConditionComponent(org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionActionConditionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionActionConditionComponent tgt = new org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionActionConditionComponent(); + copyElement(src, tgt); + if (src.hasKind()) + tgt.setKind(convertActionConditionKind(src.getKind())); + if (src.getExpression().hasDescription()) + tgt.setDescription(src.getExpression().getDescription()); + if (src.getExpression().hasLanguage()) + tgt.setLanguage(src.getExpression().getLanguage().toCode()); + if (src.getExpression().hasExpression()) + tgt.setExpression(src.getExpression().getExpression()); + return tgt; + } + + private static org.hl7.fhir.r5.model.PlanDefinition.ActionConditionKind convertActionConditionKind(org.hl7.fhir.dstu3.model.PlanDefinition.ActionConditionKind src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case APPLICABILITY: return org.hl7.fhir.r5.model.PlanDefinition.ActionConditionKind.APPLICABILITY; + case START: return org.hl7.fhir.r5.model.PlanDefinition.ActionConditionKind.START; + case STOP: return org.hl7.fhir.r5.model.PlanDefinition.ActionConditionKind.STOP; + default: return org.hl7.fhir.r5.model.PlanDefinition.ActionConditionKind.NULL; + } +} + + private static org.hl7.fhir.dstu3.model.PlanDefinition.ActionConditionKind convertActionConditionKind(org.hl7.fhir.r5.model.PlanDefinition.ActionConditionKind src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case APPLICABILITY: return org.hl7.fhir.dstu3.model.PlanDefinition.ActionConditionKind.APPLICABILITY; + case START: return org.hl7.fhir.dstu3.model.PlanDefinition.ActionConditionKind.START; + case STOP: return org.hl7.fhir.dstu3.model.PlanDefinition.ActionConditionKind.STOP; + default: return org.hl7.fhir.dstu3.model.PlanDefinition.ActionConditionKind.NULL; + } +} + + public static org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionActionRelatedActionComponent convertPlanDefinitionActionRelatedActionComponent(org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionActionRelatedActionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionActionRelatedActionComponent tgt = new org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionActionRelatedActionComponent(); + copyElement(src, tgt); + if (src.hasActionId()) + tgt.setActionId(src.getActionId()); + if (src.hasRelationship()) + tgt.setRelationship(convertActionRelationshipType(src.getRelationship())); + if (src.hasOffset()) + tgt.setOffset(convertType(src.getOffset())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionActionRelatedActionComponent convertPlanDefinitionActionRelatedActionComponent(org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionActionRelatedActionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionActionRelatedActionComponent tgt = new org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionActionRelatedActionComponent(); + copyElement(src, tgt); + if (src.hasActionId()) + tgt.setActionId(src.getActionId()); + if (src.hasRelationship()) + tgt.setRelationship(convertActionRelationshipType(src.getRelationship())); + if (src.hasOffset()) + tgt.setOffset(convertType(src.getOffset())); + return tgt; + } + + private static org.hl7.fhir.r5.model.PlanDefinition.ActionRelationshipType convertActionRelationshipType(org.hl7.fhir.dstu3.model.PlanDefinition.ActionRelationshipType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case BEFORESTART: return org.hl7.fhir.r5.model.PlanDefinition.ActionRelationshipType.BEFORESTART; + case BEFORE: return org.hl7.fhir.r5.model.PlanDefinition.ActionRelationshipType.BEFORE; + case BEFOREEND: return org.hl7.fhir.r5.model.PlanDefinition.ActionRelationshipType.BEFOREEND; + case CONCURRENTWITHSTART: return org.hl7.fhir.r5.model.PlanDefinition.ActionRelationshipType.CONCURRENTWITHSTART; + case CONCURRENT: return org.hl7.fhir.r5.model.PlanDefinition.ActionRelationshipType.CONCURRENT; + case CONCURRENTWITHEND: return org.hl7.fhir.r5.model.PlanDefinition.ActionRelationshipType.CONCURRENTWITHEND; + case AFTERSTART: return org.hl7.fhir.r5.model.PlanDefinition.ActionRelationshipType.AFTERSTART; + case AFTER: return org.hl7.fhir.r5.model.PlanDefinition.ActionRelationshipType.AFTER; + case AFTEREND: return org.hl7.fhir.r5.model.PlanDefinition.ActionRelationshipType.AFTEREND; + default: return org.hl7.fhir.r5.model.PlanDefinition.ActionRelationshipType.NULL; + } +} + + private static org.hl7.fhir.dstu3.model.PlanDefinition.ActionRelationshipType convertActionRelationshipType(org.hl7.fhir.r5.model.PlanDefinition.ActionRelationshipType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case BEFORESTART: return org.hl7.fhir.dstu3.model.PlanDefinition.ActionRelationshipType.BEFORESTART; + case BEFORE: return org.hl7.fhir.dstu3.model.PlanDefinition.ActionRelationshipType.BEFORE; + case BEFOREEND: return org.hl7.fhir.dstu3.model.PlanDefinition.ActionRelationshipType.BEFOREEND; + case CONCURRENTWITHSTART: return org.hl7.fhir.dstu3.model.PlanDefinition.ActionRelationshipType.CONCURRENTWITHSTART; + case CONCURRENT: return org.hl7.fhir.dstu3.model.PlanDefinition.ActionRelationshipType.CONCURRENT; + case CONCURRENTWITHEND: return org.hl7.fhir.dstu3.model.PlanDefinition.ActionRelationshipType.CONCURRENTWITHEND; + case AFTERSTART: return org.hl7.fhir.dstu3.model.PlanDefinition.ActionRelationshipType.AFTERSTART; + case AFTER: return org.hl7.fhir.dstu3.model.PlanDefinition.ActionRelationshipType.AFTER; + case AFTEREND: return org.hl7.fhir.dstu3.model.PlanDefinition.ActionRelationshipType.AFTEREND; + default: return org.hl7.fhir.dstu3.model.PlanDefinition.ActionRelationshipType.NULL; + } +} + + public static org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionActionParticipantComponent convertPlanDefinitionActionParticipantComponent(org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionActionParticipantComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionActionParticipantComponent tgt = new org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionActionParticipantComponent(); + copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertActionParticipantType(src.getType())); + if (src.hasRole()) + tgt.setRole(convertCodeableConcept(src.getRole())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionActionParticipantComponent convertPlanDefinitionActionParticipantComponent(org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionActionParticipantComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionActionParticipantComponent tgt = new org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionActionParticipantComponent(); + copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertActionParticipantType(src.getType())); + if (src.hasRole()) + tgt.setRole(convertCodeableConcept(src.getRole())); + return tgt; + } + + private static org.hl7.fhir.r5.model.PlanDefinition.ActionParticipantType convertActionParticipantType(org.hl7.fhir.dstu3.model.PlanDefinition.ActionParticipantType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PATIENT: return org.hl7.fhir.r5.model.PlanDefinition.ActionParticipantType.PATIENT; + case PRACTITIONER: return org.hl7.fhir.r5.model.PlanDefinition.ActionParticipantType.PRACTITIONER; + case RELATEDPERSON: return org.hl7.fhir.r5.model.PlanDefinition.ActionParticipantType.RELATEDPERSON; + default: return org.hl7.fhir.r5.model.PlanDefinition.ActionParticipantType.NULL; + } +} + + private static org.hl7.fhir.dstu3.model.PlanDefinition.ActionParticipantType convertActionParticipantType(org.hl7.fhir.r5.model.PlanDefinition.ActionParticipantType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PATIENT: return org.hl7.fhir.dstu3.model.PlanDefinition.ActionParticipantType.PATIENT; + case PRACTITIONER: return org.hl7.fhir.dstu3.model.PlanDefinition.ActionParticipantType.PRACTITIONER; + case RELATEDPERSON: return org.hl7.fhir.dstu3.model.PlanDefinition.ActionParticipantType.RELATEDPERSON; + default: return org.hl7.fhir.dstu3.model.PlanDefinition.ActionParticipantType.NULL; + } +} + + public static org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionActionDynamicValueComponent convertPlanDefinitionActionDynamicValueComponent(org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionActionDynamicValueComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionActionDynamicValueComponent tgt = new org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionActionDynamicValueComponent(); + copyElement(src, tgt); + if (src.hasDescription()) + tgt.getExpression().setDescription(src.getDescription()); + if (src.hasPath()) + tgt.setPath(src.getPath()); + if (src.hasLanguage()) + tgt.getExpression().setLanguage(ExpressionLanguage.fromCode(src.getLanguage())); + if (src.hasExpression()) + tgt.getExpression().setExpression(src.getExpression()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionActionDynamicValueComponent convertPlanDefinitionActionDynamicValueComponent(org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionActionDynamicValueComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionActionDynamicValueComponent tgt = new org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionActionDynamicValueComponent(); + copyElement(src, tgt); + if (src.getExpression().hasDescription()) + tgt.setDescription(src.getExpression().getDescription()); + if (src.hasPath()) + tgt.setPath(src.getPath()); + if (src.getExpression().hasLanguage()) + tgt.setLanguage(src.getExpression().getLanguage().toCode()); + if (src.getExpression().hasExpression()) + tgt.setExpression(src.getExpression().getExpression()); + return tgt; + } + + public static org.hl7.fhir.r5.model.Library convertLibrary(org.hl7.fhir.dstu3.model.Library src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Library tgt = new org.hl7.fhir.r5.model.Library(); + copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasTitle()) + tgt.setTitle(src.getTitle()); + if (src.hasStatus()) + tgt.setStatus(convertPublicationStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) + tgt.addContact(convertContactDetail(t)); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu3.model.UsageContext t : src.getUseContext()) + tgt.addUseContext(convertUsageContext(t)); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction()) + tgt.addJurisdiction(convertCodeableConcept(t)); + if (src.hasPurpose()) + tgt.setPurpose(src.getPurpose()); + if (src.hasUsage()) + tgt.setUsage(src.getUsage()); + if (src.hasCopyright()) + tgt.setCopyright(src.getCopyright()); + if (src.hasApprovalDate()) + tgt.setApprovalDate(src.getApprovalDate()); + if (src.hasLastReviewDate()) + tgt.setLastReviewDate(src.getLastReviewDate()); + if (src.hasEffectivePeriod()) + tgt.setEffectivePeriod(convertPeriod(src.getEffectivePeriod())); + for (org.hl7.fhir.dstu3.model.Contributor t : src.getContributor()) { + if (t.getType() == ContributorType.AUTHOR) + for (ContactDetail c : t.getContact()) + tgt.addAuthor(convertContactDetail(c)); + if (t.getType() == ContributorType.EDITOR) + for (ContactDetail c : t.getContact()) + tgt.addEditor(convertContactDetail(c)); + if (t.getType() == ContributorType.REVIEWER) + for (ContactDetail c : t.getContact()) + tgt.addReviewer(convertContactDetail(c)); + if (t.getType() == ContributorType.ENDORSER) + for (ContactDetail c : t.getContact()) + tgt.addEndorser(convertContactDetail(c)); + } + + for (org.hl7.fhir.dstu3.model.RelatedArtifact t : src.getRelatedArtifact()) + tgt.addRelatedArtifact(convertRelatedArtifact(t)); + for (org.hl7.fhir.dstu3.model.ParameterDefinition t : src.getParameter()) + tgt.addParameter(convertParameterDefinition(t)); + for (org.hl7.fhir.dstu3.model.DataRequirement t : src.getDataRequirement()) + tgt.addDataRequirement(convertDataRequirement(t)); + for (org.hl7.fhir.dstu3.model.Attachment t : src.getContent()) + tgt.addContent(convertAttachment(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Library convertLibrary(org.hl7.fhir.r5.model.Library src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.dstu3.model.Library tgt = new org.hl7.fhir.dstu3.model.Library(); + copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasTitle()) + tgt.setTitle(src.getTitle()); + if (src.hasStatus()) + tgt.setStatus(convertPublicationStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.r5.model.ContactDetail t : src.getContact()) + tgt.addContact(convertContactDetail(t)); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.r5.model.UsageContext t : src.getUseContext()) + tgt.addUseContext(convertUsageContext(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getJurisdiction()) + tgt.addJurisdiction(convertCodeableConcept(t)); + if (src.hasPurpose()) + tgt.setPurpose(src.getPurpose()); + if (src.hasUsage()) + tgt.setUsage(src.getUsage()); + if (src.hasCopyright()) + tgt.setCopyright(src.getCopyright()); + if (src.hasApprovalDate()) + tgt.setApprovalDate(src.getApprovalDate()); + if (src.hasLastReviewDate()) + tgt.setLastReviewDate(src.getLastReviewDate()); + if (src.hasEffectivePeriod()) + tgt.setEffectivePeriod(convertPeriod(src.getEffectivePeriod())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getTopic()) + tgt.addTopic(convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.ContactDetail t : src.getAuthor()) { + org.hl7.fhir.dstu3.model.Contributor c = new org.hl7.fhir.dstu3.model.Contributor(); + c.setType(ContributorType.AUTHOR); + c.addContact(convertContactDetail(t)); + tgt.addContributor(c); + } + for (org.hl7.fhir.r5.model.ContactDetail t : src.getEditor()) { + org.hl7.fhir.dstu3.model.Contributor c = new org.hl7.fhir.dstu3.model.Contributor(); + c.setType(ContributorType.EDITOR); + c.addContact(convertContactDetail(t)); + tgt.addContributor(c); + } + for (org.hl7.fhir.r5.model.ContactDetail t : src.getReviewer()) { + org.hl7.fhir.dstu3.model.Contributor c = new org.hl7.fhir.dstu3.model.Contributor(); + c.setType(ContributorType.REVIEWER); + c.addContact(convertContactDetail(t)); + tgt.addContributor(c); + } + for (org.hl7.fhir.r5.model.ContactDetail t : src.getEndorser()) { + org.hl7.fhir.dstu3.model.Contributor c = new org.hl7.fhir.dstu3.model.Contributor(); + c.setType(ContributorType.ENDORSER); + c.addContact(convertContactDetail(t)); + tgt.addContributor(c); + } + for (org.hl7.fhir.r5.model.RelatedArtifact t : src.getRelatedArtifact()) + tgt.addRelatedArtifact(convertRelatedArtifact(t)); + for (org.hl7.fhir.r5.model.ParameterDefinition t : src.getParameter()) + tgt.addParameter(convertParameterDefinition(t)); + for (org.hl7.fhir.r5.model.DataRequirement t : src.getDataRequirement()) + tgt.addDataRequirement(convertDataRequirement(t)); + for (org.hl7.fhir.r5.model.Attachment t : src.getContent()) + tgt.addContent(convertAttachment(t)); + return tgt; + } + + + + public static org.hl7.fhir.r5.model.Resource convertResource(org.hl7.fhir.dstu3.model.Resource src, boolean nullOk) throws FHIRException { + if (src == null) + return null; + if (src instanceof org.hl7.fhir.dstu3.model.Parameters) + return convertParameters((org.hl7.fhir.dstu3.model.Parameters) src); + if (src instanceof org.hl7.fhir.dstu3.model.ActivityDefinition) + return convertActivityDefinition((org.hl7.fhir.dstu3.model.ActivityDefinition) src); + if (src instanceof org.hl7.fhir.dstu3.model.AllergyIntolerance) + return convertAllergyIntolerance((org.hl7.fhir.dstu3.model.AllergyIntolerance) src); + if (src instanceof org.hl7.fhir.dstu3.model.Appointment) + return convertAppointment((org.hl7.fhir.dstu3.model.Appointment) src); + if (src instanceof org.hl7.fhir.dstu3.model.AppointmentResponse) + return convertAppointmentResponse((org.hl7.fhir.dstu3.model.AppointmentResponse) src); + if (src instanceof org.hl7.fhir.dstu3.model.AuditEvent) + return convertAuditEvent((org.hl7.fhir.dstu3.model.AuditEvent) src); + if (src instanceof org.hl7.fhir.dstu3.model.Basic) + return convertBasic((org.hl7.fhir.dstu3.model.Basic) src); + if (src instanceof org.hl7.fhir.dstu3.model.Binary) + return convertBinary((org.hl7.fhir.dstu3.model.Binary) src); + if (src instanceof org.hl7.fhir.dstu3.model.BodySite) + return convertBodySite((org.hl7.fhir.dstu3.model.BodySite) src); + if (src instanceof org.hl7.fhir.dstu3.model.Bundle) + return convertBundle((org.hl7.fhir.dstu3.model.Bundle) src); + if (src instanceof org.hl7.fhir.dstu3.model.CapabilityStatement) + return convertCapabilityStatement((org.hl7.fhir.dstu3.model.CapabilityStatement) src); + if (src instanceof org.hl7.fhir.dstu3.model.CareTeam) + return convertCareTeam((org.hl7.fhir.dstu3.model.CareTeam) src); +// if (src instanceof org.hl7.fhir.dstu3.model.Claim) +// return convertClaim((org.hl7.fhir.dstu3.model.Claim) src); + if (src instanceof org.hl7.fhir.dstu3.model.ClinicalImpression) + return convertClinicalImpression((org.hl7.fhir.dstu3.model.ClinicalImpression) src); + if (src instanceof org.hl7.fhir.dstu3.model.CodeSystem) + return convertCodeSystem((org.hl7.fhir.dstu3.model.CodeSystem) src); + if (src instanceof org.hl7.fhir.dstu3.model.Communication) + return convertCommunication((org.hl7.fhir.dstu3.model.Communication) src); + if (src instanceof org.hl7.fhir.dstu3.model.CompartmentDefinition) + return convertCompartmentDefinition((org.hl7.fhir.dstu3.model.CompartmentDefinition) src); + if (src instanceof org.hl7.fhir.dstu3.model.Composition) + return convertComposition((org.hl7.fhir.dstu3.model.Composition) src); + if (src instanceof org.hl7.fhir.dstu3.model.ConceptMap) + return convertConceptMap((org.hl7.fhir.dstu3.model.ConceptMap) src); + if (src instanceof org.hl7.fhir.dstu3.model.Condition) + return convertCondition((org.hl7.fhir.dstu3.model.Condition) src); + if (src instanceof org.hl7.fhir.dstu3.model.Consent) + return convertConsent((org.hl7.fhir.dstu3.model.Consent) src); +// if (src instanceof org.hl7.fhir.dstu3.model.Contract) +// return convertContract((org.hl7.fhir.dstu3.model.Contract) src); +// if (src instanceof org.hl7.fhir.dstu3.model.Coverage) +// return convertCoverage((org.hl7.fhir.dstu3.model.Coverage) src); + if (src instanceof org.hl7.fhir.dstu3.model.DataElement) + return convertDataElement((org.hl7.fhir.dstu3.model.DataElement) src); + if (src instanceof org.hl7.fhir.dstu3.model.DetectedIssue) + return convertDetectedIssue((org.hl7.fhir.dstu3.model.DetectedIssue) src); +// if (src instanceof org.hl7.fhir.dstu3.model.Device) +// return convertDevice((org.hl7.fhir.dstu3.model.Device) src); +// if (src instanceof org.hl7.fhir.dstu3.model.DeviceComponent) +// return convertDeviceComponent((org.hl7.fhir.dstu3.model.DeviceComponent) src); +// if (src instanceof org.hl7.fhir.dstu3.model.DeviceMetric) +// return convertDeviceMetric((org.hl7.fhir.dstu3.model.DeviceMetric) src); + if (src instanceof org.hl7.fhir.dstu3.model.DeviceUseStatement) + return convertDeviceUseStatement((org.hl7.fhir.dstu3.model.DeviceUseStatement) src); + if (src instanceof org.hl7.fhir.dstu3.model.DiagnosticReport) + return convertDiagnosticReport((org.hl7.fhir.dstu3.model.DiagnosticReport) src); +// if (src instanceof org.hl7.fhir.dstu3.model.DocumentManifest) +// return convertDocumentManifest((org.hl7.fhir.dstu3.model.DocumentManifest) src); + if (src instanceof org.hl7.fhir.dstu3.model.DocumentReference) + return convertDocumentReference((org.hl7.fhir.dstu3.model.DocumentReference) src); + if (src instanceof org.hl7.fhir.dstu3.model.Encounter) + return convertEncounter((org.hl7.fhir.dstu3.model.Encounter) src); + if (src instanceof org.hl7.fhir.dstu3.model.Endpoint) + return convertEndpoint((org.hl7.fhir.dstu3.model.Endpoint) src); + if (src instanceof org.hl7.fhir.dstu3.model.EpisodeOfCare) + return convertEpisodeOfCare((org.hl7.fhir.dstu3.model.EpisodeOfCare) src); + if (src instanceof org.hl7.fhir.dstu3.model.ExpansionProfile) + return convertExpansionProfile((org.hl7.fhir.dstu3.model.ExpansionProfile) src); + if (src instanceof org.hl7.fhir.dstu3.model.FamilyMemberHistory) + return convertFamilyMemberHistory((org.hl7.fhir.dstu3.model.FamilyMemberHistory) src); + if (src instanceof org.hl7.fhir.dstu3.model.Flag) + return convertFlag((org.hl7.fhir.dstu3.model.Flag) src); + if (src instanceof org.hl7.fhir.dstu3.model.Goal) + return convertGoal((org.hl7.fhir.dstu3.model.Goal) src); + if (src instanceof org.hl7.fhir.dstu3.model.GraphDefinition) + return convertGraphDefinition((org.hl7.fhir.dstu3.model.GraphDefinition) src); + if (src instanceof org.hl7.fhir.dstu3.model.Group) + return convertGroup((org.hl7.fhir.dstu3.model.Group) src); + if (src instanceof org.hl7.fhir.dstu3.model.HealthcareService) + return convertHealthcareService((org.hl7.fhir.dstu3.model.HealthcareService) src); + if (src instanceof org.hl7.fhir.dstu3.model.Immunization) + return convertImmunization((org.hl7.fhir.dstu3.model.Immunization) src); + if (src instanceof org.hl7.fhir.dstu3.model.ImplementationGuide) + return convertImplementationGuide((org.hl7.fhir.dstu3.model.ImplementationGuide) src); + if (src instanceof org.hl7.fhir.dstu3.model.Library) + return convertLibrary((org.hl7.fhir.dstu3.model.Library) src); + if (src instanceof org.hl7.fhir.dstu3.model.Linkage) + return convertLinkage((org.hl7.fhir.dstu3.model.Linkage) src); + if (src instanceof org.hl7.fhir.dstu3.model.ListResource) + return convertList((org.hl7.fhir.dstu3.model.ListResource) src); + if (src instanceof org.hl7.fhir.dstu3.model.Location) + return convertLocation((org.hl7.fhir.dstu3.model.Location) src); + if (src instanceof org.hl7.fhir.dstu3.model.Medication) + return convertMedication((org.hl7.fhir.dstu3.model.Medication) src); + if (src instanceof org.hl7.fhir.dstu3.model.MedicationAdministration) + return convertMedicationAdministration((org.hl7.fhir.dstu3.model.MedicationAdministration) src); + if (src instanceof org.hl7.fhir.dstu3.model.MedicationDispense) + return convertMedicationDispense((org.hl7.fhir.dstu3.model.MedicationDispense) src); + if (src instanceof org.hl7.fhir.dstu3.model.MedicationRequest) + return convertMedicationRequest((org.hl7.fhir.dstu3.model.MedicationRequest) src); + if (src instanceof org.hl7.fhir.dstu3.model.MedicationStatement) + return convertMedicationStatement((org.hl7.fhir.dstu3.model.MedicationStatement) src); + if (src instanceof org.hl7.fhir.dstu3.model.MessageDefinition) + return convertMessageDefinition((org.hl7.fhir.dstu3.model.MessageDefinition) src); + if (src instanceof org.hl7.fhir.dstu3.model.MessageHeader) + return convertMessageHeader((org.hl7.fhir.dstu3.model.MessageHeader) src); + if (src instanceof org.hl7.fhir.dstu3.model.NamingSystem) + return convertNamingSystem((org.hl7.fhir.dstu3.model.NamingSystem) src); +// if (src instanceof org.hl7.fhir.dstu3.model.NutritionOrder) +// return convertNutritionOrder((org.hl7.fhir.dstu3.model.NutritionOrder) src); + if (src instanceof org.hl7.fhir.dstu3.model.Observation) + return convertObservation((org.hl7.fhir.dstu3.model.Observation) src); + if (src instanceof org.hl7.fhir.dstu3.model.OperationDefinition) + return convertOperationDefinition((org.hl7.fhir.dstu3.model.OperationDefinition) src); + if (src instanceof org.hl7.fhir.dstu3.model.OperationOutcome) + return convertOperationOutcome((org.hl7.fhir.dstu3.model.OperationOutcome) src); + if (src instanceof org.hl7.fhir.dstu3.model.Organization) + return convertOrganization((org.hl7.fhir.dstu3.model.Organization) src); + if (src instanceof org.hl7.fhir.dstu3.model.Patient) + return convertPatient((org.hl7.fhir.dstu3.model.Patient) src); + if (src instanceof org.hl7.fhir.dstu3.model.PaymentNotice) + return convertPaymentNotice((org.hl7.fhir.dstu3.model.PaymentNotice) src); + if (src instanceof org.hl7.fhir.dstu3.model.Person) + return convertPerson((org.hl7.fhir.dstu3.model.Person) src); + if (src instanceof org.hl7.fhir.dstu3.model.PlanDefinition) + return convertPlanDefinition((org.hl7.fhir.dstu3.model.PlanDefinition) src); + if (src instanceof org.hl7.fhir.dstu3.model.Practitioner) + return convertPractitioner((org.hl7.fhir.dstu3.model.Practitioner) src); + if (src instanceof org.hl7.fhir.dstu3.model.PractitionerRole) + return convertPractitionerRole((org.hl7.fhir.dstu3.model.PractitionerRole) src); + if (src instanceof org.hl7.fhir.dstu3.model.Questionnaire) + return convertQuestionnaire((org.hl7.fhir.dstu3.model.Questionnaire) src); + if (src instanceof org.hl7.fhir.dstu3.model.QuestionnaireResponse) + return convertQuestionnaireResponse((org.hl7.fhir.dstu3.model.QuestionnaireResponse) src); + if (src instanceof org.hl7.fhir.dstu3.model.RiskAssessment) + return convertRiskAssessment((org.hl7.fhir.dstu3.model.RiskAssessment) src); + if (src instanceof org.hl7.fhir.dstu3.model.Schedule) + return convertSchedule((org.hl7.fhir.dstu3.model.Schedule) src); + if (src instanceof org.hl7.fhir.dstu3.model.SearchParameter) + return convertSearchParameter((org.hl7.fhir.dstu3.model.SearchParameter) src); + if (src instanceof org.hl7.fhir.dstu3.model.Sequence) + return convertSequence((org.hl7.fhir.dstu3.model.Sequence) src); + if (src instanceof org.hl7.fhir.dstu3.model.Slot) + return convertSlot((org.hl7.fhir.dstu3.model.Slot) src); + if (src instanceof org.hl7.fhir.dstu3.model.Specimen) + return convertSpecimen((org.hl7.fhir.dstu3.model.Specimen) src); + if (src instanceof org.hl7.fhir.dstu3.model.StructureDefinition) + return convertStructureDefinition((org.hl7.fhir.dstu3.model.StructureDefinition) src); + if (src instanceof org.hl7.fhir.dstu3.model.StructureMap) + return convertStructureMap((org.hl7.fhir.dstu3.model.StructureMap) src); + if (src instanceof org.hl7.fhir.dstu3.model.Subscription) + return convertSubscription((org.hl7.fhir.dstu3.model.Subscription) src); + if (src instanceof org.hl7.fhir.dstu3.model.Substance) + return convertSubstance((org.hl7.fhir.dstu3.model.Substance) src); + if (src instanceof org.hl7.fhir.dstu3.model.SupplyDelivery) + return convertSupplyDelivery((org.hl7.fhir.dstu3.model.SupplyDelivery) src); + if (src instanceof org.hl7.fhir.dstu3.model.TestReport) + return convertTestReport((org.hl7.fhir.dstu3.model.TestReport) src); + if (src instanceof org.hl7.fhir.dstu3.model.TestScript) + return convertTestScript((org.hl7.fhir.dstu3.model.TestScript) src); + if (src instanceof org.hl7.fhir.dstu3.model.ValueSet) + return convertValueSet((org.hl7.fhir.dstu3.model.ValueSet) src); +// if (src instanceof org.hl7.fhir.dstu3.model.VisionPrescription) +// return convertVisionPrescription((org.hl7.fhir.dstu3.model.VisionPrescription) src); + if (!nullOk) + throw new FHIRException("Unknown resource "+src.fhirType()); + else + return null; + } + + public static org.hl7.fhir.dstu3.model.Resource convertResource(org.hl7.fhir.r5.model.Resource src, boolean nullOk) throws FHIRException { + if (src == null) + return null; + if (src instanceof org.hl7.fhir.r5.model.Parameters) { + if (((org.hl7.fhir.r5.model.Parameters) src).hasParameter("profile-url")) + return convertExpansionProfile((org.hl7.fhir.r5.model.Parameters) src); + else + return convertParameters((org.hl7.fhir.r5.model.Parameters) src); + } + if (src instanceof org.hl7.fhir.r5.model.ActivityDefinition) + return convertActivityDefinition((org.hl7.fhir.r5.model.ActivityDefinition) src); + if (src instanceof org.hl7.fhir.r5.model.AllergyIntolerance) + return convertAllergyIntolerance((org.hl7.fhir.r5.model.AllergyIntolerance) src); + if (src instanceof org.hl7.fhir.r5.model.Appointment) + return convertAppointment((org.hl7.fhir.r5.model.Appointment) src); + if (src instanceof org.hl7.fhir.r5.model.AppointmentResponse) + return convertAppointmentResponse((org.hl7.fhir.r5.model.AppointmentResponse) src); + if (src instanceof org.hl7.fhir.r5.model.AuditEvent) + return convertAuditEvent((org.hl7.fhir.r5.model.AuditEvent) src); + if (src instanceof org.hl7.fhir.r5.model.Basic) + return convertBasic((org.hl7.fhir.r5.model.Basic) src); + if (src instanceof org.hl7.fhir.r5.model.Binary) + return convertBinary((org.hl7.fhir.r5.model.Binary) src); + if (src instanceof org.hl7.fhir.r5.model.BodyStructure) + return convertBodySite((org.hl7.fhir.r5.model.BodyStructure) src); + if (src instanceof org.hl7.fhir.r5.model.Bundle) + return convertBundle((org.hl7.fhir.r5.model.Bundle) src); + if (src instanceof org.hl7.fhir.r5.model.CapabilityStatement) + return convertCapabilityStatement((org.hl7.fhir.r5.model.CapabilityStatement) src); + if (src instanceof org.hl7.fhir.r5.model.CareTeam) + return convertCareTeam((org.hl7.fhir.r5.model.CareTeam) src); +// if (src instanceof org.hl7.fhir.r5.model.Claim) +// return convertClaim((org.hl7.fhir.r5.model.Claim) src); + if (src instanceof org.hl7.fhir.r5.model.ClinicalImpression) + return convertClinicalImpression((org.hl7.fhir.r5.model.ClinicalImpression) src); + if (src instanceof org.hl7.fhir.r5.model.CodeSystem) + return convertCodeSystem((org.hl7.fhir.r5.model.CodeSystem) src); + if (src instanceof org.hl7.fhir.r5.model.Communication) + return convertCommunication((org.hl7.fhir.r5.model.Communication) src); + if (src instanceof org.hl7.fhir.r5.model.CompartmentDefinition) + return convertCompartmentDefinition((org.hl7.fhir.r5.model.CompartmentDefinition) src); + if (src instanceof org.hl7.fhir.r5.model.Composition) + return convertComposition((org.hl7.fhir.r5.model.Composition) src); + if (src instanceof org.hl7.fhir.r5.model.ConceptMap) + return convertConceptMap((org.hl7.fhir.r5.model.ConceptMap) src); + if (src instanceof org.hl7.fhir.r5.model.Condition) + return convertCondition((org.hl7.fhir.r5.model.Condition) src); + if (src instanceof org.hl7.fhir.r5.model.Consent) + return convertConsent((org.hl7.fhir.r5.model.Consent) src); +// if (src instanceof org.hl7.fhir.r5.model.Contract) +// return convertContract((org.hl7.fhir.r5.model.Contract) src); +// if (src instanceof org.hl7.fhir.r5.model.Coverage) +// return convertCoverage((org.hl7.fhir.r5.model.Coverage) src); + if (src instanceof org.hl7.fhir.r5.model.DetectedIssue) + return convertDetectedIssue((org.hl7.fhir.r5.model.DetectedIssue) src); +// if (src instanceof org.hl7.fhir.r5.model.Device) +// return convertDevice((org.hl7.fhir.r5.model.Device) src); +// if (src instanceof org.hl7.fhir.r5.model.DeviceComponent) +// return convertDeviceComponent((org.hl7.fhir.r5.model.DeviceComponent) src); +// if (src instanceof org.hl7.fhir.r5.model.DeviceMetric) +// return convertDeviceMetric((org.hl7.fhir.r5.model.DeviceMetric) src); + if (src instanceof org.hl7.fhir.r5.model.DeviceUseStatement) + return convertDeviceUseStatement((org.hl7.fhir.r5.model.DeviceUseStatement) src); + if (src instanceof org.hl7.fhir.r5.model.DiagnosticReport) + return convertDiagnosticReport((org.hl7.fhir.r5.model.DiagnosticReport) src); +// if (src instanceof org.hl7.fhir.r5.model.DocumentManifest) +// return convertDocumentManifest((org.hl7.fhir.r5.model.DocumentManifest) src); + if (src instanceof org.hl7.fhir.r5.model.DocumentReference) + return convertDocumentReference((org.hl7.fhir.r5.model.DocumentReference) src); + if (src instanceof org.hl7.fhir.r5.model.Encounter) + return convertEncounter((org.hl7.fhir.r5.model.Encounter) src); + if (src instanceof org.hl7.fhir.r5.model.Endpoint) + return convertEndpoint((org.hl7.fhir.r5.model.Endpoint) src); + if (src instanceof org.hl7.fhir.r5.model.EpisodeOfCare) + return convertEpisodeOfCare((org.hl7.fhir.r5.model.EpisodeOfCare) src); + if (src instanceof org.hl7.fhir.r5.model.FamilyMemberHistory) + return convertFamilyMemberHistory((org.hl7.fhir.r5.model.FamilyMemberHistory) src); + if (src instanceof org.hl7.fhir.r5.model.Flag) + return convertFlag((org.hl7.fhir.r5.model.Flag) src); + if (src instanceof org.hl7.fhir.r5.model.Goal) + return convertGoal((org.hl7.fhir.r5.model.Goal) src); + if (src instanceof org.hl7.fhir.r5.model.GraphDefinition) + return convertGraphDefinition((org.hl7.fhir.r5.model.GraphDefinition) src); + if (src instanceof org.hl7.fhir.r5.model.Group) + return convertGroup((org.hl7.fhir.r5.model.Group) src); + if (src instanceof org.hl7.fhir.r5.model.HealthcareService) + return convertHealthcareService((org.hl7.fhir.r5.model.HealthcareService) src); + if (src instanceof org.hl7.fhir.r5.model.Immunization) + return convertImmunization((org.hl7.fhir.r5.model.Immunization) src); + if (src instanceof org.hl7.fhir.r5.model.ImplementationGuide) + return convertImplementationGuide((org.hl7.fhir.r5.model.ImplementationGuide) src); + if (src instanceof org.hl7.fhir.r5.model.Library) + return convertLibrary((org.hl7.fhir.r5.model.Library) src); + if (src instanceof org.hl7.fhir.r5.model.Linkage) + return convertLinkage((org.hl7.fhir.r5.model.Linkage) src); + if (src instanceof org.hl7.fhir.r5.model.ListResource) + return convertList((org.hl7.fhir.r5.model.ListResource) src); + if (src instanceof org.hl7.fhir.r5.model.Location) + return convertLocation((org.hl7.fhir.r5.model.Location) src); + if (src instanceof org.hl7.fhir.r5.model.Medication) + return convertMedication((org.hl7.fhir.r5.model.Medication) src); + if (src instanceof org.hl7.fhir.r5.model.MedicationAdministration) + return convertMedicationAdministration((org.hl7.fhir.r5.model.MedicationAdministration) src); + if (src instanceof org.hl7.fhir.r5.model.MedicationDispense) + return convertMedicationDispense((org.hl7.fhir.r5.model.MedicationDispense) src); + if (src instanceof org.hl7.fhir.r5.model.MedicationRequest) + return convertMedicationRequest((org.hl7.fhir.r5.model.MedicationRequest) src); + if (src instanceof org.hl7.fhir.r5.model.MedicationStatement) + return convertMedicationStatement((org.hl7.fhir.r5.model.MedicationStatement) src); + if (src instanceof org.hl7.fhir.r5.model.MessageDefinition) + return convertMessageDefinition((org.hl7.fhir.r5.model.MessageDefinition) src); + if (src instanceof org.hl7.fhir.r5.model.MessageHeader) + return convertMessageHeader((org.hl7.fhir.r5.model.MessageHeader) src); + if (src instanceof org.hl7.fhir.r5.model.NamingSystem) + return convertNamingSystem((org.hl7.fhir.r5.model.NamingSystem) src); +// if (src instanceof org.hl7.fhir.r5.model.NutritionOrder) +// return convertNutritionOrder((org.hl7.fhir.r5.model.NutritionOrder) src); + if (src instanceof org.hl7.fhir.r5.model.Observation) + return convertObservation((org.hl7.fhir.r5.model.Observation) src); + if (src instanceof org.hl7.fhir.r5.model.OperationDefinition) + return convertOperationDefinition((org.hl7.fhir.r5.model.OperationDefinition) src); + if (src instanceof org.hl7.fhir.r5.model.OperationOutcome) + return convertOperationOutcome((org.hl7.fhir.r5.model.OperationOutcome) src); + if (src instanceof org.hl7.fhir.r5.model.Organization) + return convertOrganization((org.hl7.fhir.r5.model.Organization) src); + if (src instanceof org.hl7.fhir.r5.model.Patient) + return convertPatient((org.hl7.fhir.r5.model.Patient) src); + if (src instanceof org.hl7.fhir.r5.model.PaymentNotice) + return convertPaymentNotice((org.hl7.fhir.r5.model.PaymentNotice) src); + if (src instanceof org.hl7.fhir.r5.model.Person) + return convertPerson((org.hl7.fhir.r5.model.Person) src); + if (src instanceof org.hl7.fhir.r5.model.PlanDefinition) + return convertPlanDefinition((org.hl7.fhir.r5.model.PlanDefinition) src); + if (src instanceof org.hl7.fhir.r5.model.Practitioner) + return convertPractitioner((org.hl7.fhir.r5.model.Practitioner) src); + if (src instanceof org.hl7.fhir.r5.model.PractitionerRole) + return convertPractitionerRole((org.hl7.fhir.r5.model.PractitionerRole) src); +// if (src instanceof org.hl7.fhir.r5.model.Provenance) +// return convertProvenance((org.hl7.fhir.r5.model.Provenance) src); + if (src instanceof org.hl7.fhir.r5.model.Questionnaire) + return convertQuestionnaire((org.hl7.fhir.r5.model.Questionnaire) src); + if (src instanceof org.hl7.fhir.r5.model.QuestionnaireResponse) + return convertQuestionnaireResponse((org.hl7.fhir.r5.model.QuestionnaireResponse) src); + if (src instanceof org.hl7.fhir.r5.model.RiskAssessment) + return convertRiskAssessment((org.hl7.fhir.r5.model.RiskAssessment) src); + if (src instanceof org.hl7.fhir.r5.model.Schedule) + return convertSchedule((org.hl7.fhir.r5.model.Schedule) src); + if (src instanceof org.hl7.fhir.r5.model.SearchParameter) + return convertSearchParameter((org.hl7.fhir.r5.model.SearchParameter) src); + if (src instanceof org.hl7.fhir.r5.model.MolecularSequence) + return convertSequence((org.hl7.fhir.r5.model.MolecularSequence) src); + if (src instanceof org.hl7.fhir.r5.model.Slot) + return convertSlot((org.hl7.fhir.r5.model.Slot) src); + if (src instanceof org.hl7.fhir.r5.model.Specimen) + return convertSpecimen((org.hl7.fhir.r5.model.Specimen) src); + if (src instanceof org.hl7.fhir.r5.model.StructureDefinition) + return convertStructureDefinition((org.hl7.fhir.r5.model.StructureDefinition) src); + if (src instanceof org.hl7.fhir.r5.model.StructureMap) + return convertStructureMap((org.hl7.fhir.r5.model.StructureMap) src); + if (src instanceof org.hl7.fhir.r5.model.Subscription) + return convertSubscription((org.hl7.fhir.r5.model.Subscription) src); + if (src instanceof org.hl7.fhir.r5.model.Substance) + return convertSubstance((org.hl7.fhir.r5.model.Substance) src); + if (src instanceof org.hl7.fhir.r5.model.SupplyDelivery) + return convertSupplyDelivery((org.hl7.fhir.r5.model.SupplyDelivery) src); + if (src instanceof org.hl7.fhir.r5.model.TestReport) + return convertTestReport((org.hl7.fhir.r5.model.TestReport) src); + if (src instanceof org.hl7.fhir.r5.model.TestScript) + return convertTestScript((org.hl7.fhir.r5.model.TestScript) src); + if (src instanceof org.hl7.fhir.r5.model.ValueSet) + return convertValueSet((org.hl7.fhir.r5.model.ValueSet) src); +// if (src instanceof org.hl7.fhir.r5.model.VisionPrescription) +// return convertVisionPrescription((org.hl7.fhir.r5.model.VisionPrescription) src); + if (!nullOk) + throw new FHIRException("Unknown resource "+src.fhirType()); + else + return null; + } + + public static TerminologyCapabilities convertTerminologyCapabilities(Parameters src, boolean b) { + TerminologyCapabilities res = new TerminologyCapabilities(); + for (ParametersParameterComponent p : src.getParameter()) { + if (p.getName().equals("system")) + res.addCodeSystem().setUri(p.getValue().primitiveValue()); + } + return res; + } + + public static boolean convertsResource(String rt) { + return Utilities.existsInList(rt, "Parameters", "ActivityDefinition", "AllergyIntolerance", "Appointment", "AppointmentResponse", "AuditEvent", "Basic", "Binary", "BodyStructure", "Bundle", "CapabilityStatement", + "CareTeam", "ClinicalImpression", "CodeSystem", "Communication", "CompartmentDefinition", "Composition", "ConceptMap", "Condition", "Consent", "DetectedIssue", "DeviceUseStatement", "DiagnosticReport", "DocumentReference", + "Encounter", "Endpoint", "EpisodeOfCare", "FamilyMemberHistory", "Flag", "Goal", "GraphDefinition", "Group", "HealthcareService", "Immunization", "ImplementationGuide", "Library", "Linkage", "ListResource", "Location", + "Medication", "MedicationAdministration", "MedicationDispense", "MedicationRequest", "MedicationStatement", "MessageDefinition", "MessageHeader", "NamingSystem", "Observation", "OperationDefinition", "OperationOutcome", + "Organization", "Patient", "PaymentNotice", "Person", "PlanDefinition", "Practitioner", "PractitionerRole", "ProcessRequest", "Questionnaire", "QuestionnaireResponse", "RiskAssessment", "Schedule", "SearchParameter", + "Sequence", "Slot", "Specimen", "StructureDefinition", "StructureMap", "Subscription", "Substance", "SupplyDelivery", "TestReport", "TestScript", "ValueSet"); + } + + +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/VersionConvertor_40_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/VersionConvertor_40_50.java new file mode 100644 index 000000000..4f03d740b --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/VersionConvertor_40_50.java @@ -0,0 +1,3837 @@ +package org.hl7.fhir.convertors; + +import org.hl7.fhir.convertors.conv40_50.*; +import org.hl7.fhir.exceptions.FHIRException; + + +/* + Copyright (c) 2011+, HL7, Inc. + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of HL7 nor the names of its contributors may be used to + endorse or promote products derived from this software without specific + prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + + */ + +// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0 + + +public class VersionConvertor_40_50 { + + protected static void copyElement(org.hl7.fhir.r4.model.Element src, org.hl7.fhir.r5.model.Element tgt) throws FHIRException { + if (src.hasId()) + tgt.setId(src.getId()); + for (org.hl7.fhir.r4.model.Extension e : src.getExtension()) { + tgt.addExtension(convertExtension(e)); + } + } + + protected static void copyElement(org.hl7.fhir.r5.model.Element src, org.hl7.fhir.r4.model.Element tgt) throws FHIRException { + if (src.hasId()) + tgt.setId(src.getId()); + for (org.hl7.fhir.r5.model.Extension e : src.getExtension()) { + tgt.addExtension(convertExtension(e)); + } + } + + protected static void copyBackboneElement(org.hl7.fhir.r4.model.BackboneElement src, org.hl7.fhir.r5.model.BackboneElement tgt) throws FHIRException { + copyElement(src, tgt); + for (org.hl7.fhir.r4.model.Extension e : src.getModifierExtension()) { + tgt.addModifierExtension(convertExtension(e)); + } + } + + protected static void copyBackboneElement(org.hl7.fhir.r5.model.BackboneElement src, org.hl7.fhir.r4.model.BackboneElement tgt) throws FHIRException { + copyElement(src, tgt); + for (org.hl7.fhir.r5.model.Extension e : src.getModifierExtension()) { + tgt.addModifierExtension(convertExtension(e)); + } + } + + protected static void copyBackboneElement(org.hl7.fhir.r5.model.BackboneType src, org.hl7.fhir.r4.model.BackboneType tgt) throws FHIRException { + copyElement(src, tgt); + for (org.hl7.fhir.r5.model.Extension e : src.getModifierExtension()) { + tgt.addModifierExtension(convertExtension(e)); + } + } + + protected static void copyBackboneElement(org.hl7.fhir.r4.model.BackboneType src, org.hl7.fhir.r5.model.BackboneType tgt) throws FHIRException { + copyElement(src, tgt); + for (org.hl7.fhir.r4.model.Extension e : src.getModifierExtension()) { + tgt.addModifierExtension(convertExtension(e)); + } + } + + protected static org.hl7.fhir.utilities.xhtml.XhtmlNode convertXhtml(org.hl7.fhir.utilities.xhtml.XhtmlNode src) throws FHIRException { + return src; + } + + public static org.hl7.fhir.r5.model.Base64BinaryType convertBase64Binary(org.hl7.fhir.r4.model.Base64BinaryType src) throws FHIRException { + org.hl7.fhir.r5.model.Base64BinaryType tgt = new org.hl7.fhir.r5.model.Base64BinaryType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.r4.model.Base64BinaryType convertBase64Binary(org.hl7.fhir.r5.model.Base64BinaryType src) throws FHIRException { + org.hl7.fhir.r4.model.Base64BinaryType tgt = new org.hl7.fhir.r4.model.Base64BinaryType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.r5.model.BooleanType convertBoolean(org.hl7.fhir.r4.model.BooleanType src) throws FHIRException { + org.hl7.fhir.r5.model.BooleanType tgt = new org.hl7.fhir.r5.model.BooleanType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.r4.model.BooleanType convertBoolean(org.hl7.fhir.r5.model.BooleanType src) throws FHIRException { + org.hl7.fhir.r4.model.BooleanType tgt = new org.hl7.fhir.r4.model.BooleanType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.r5.model.CanonicalType convertCanonical(org.hl7.fhir.r4.model.CanonicalType src) throws FHIRException { + org.hl7.fhir.r5.model.CanonicalType tgt = new org.hl7.fhir.r5.model.CanonicalType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.r4.model.CanonicalType convertCanonical(org.hl7.fhir.r5.model.CanonicalType src) throws FHIRException { + org.hl7.fhir.r4.model.CanonicalType tgt = new org.hl7.fhir.r4.model.CanonicalType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.r5.model.CodeType convertCode(org.hl7.fhir.r4.model.CodeType src) throws FHIRException { + org.hl7.fhir.r5.model.CodeType tgt = new org.hl7.fhir.r5.model.CodeType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.r4.model.CodeType convertCode(org.hl7.fhir.r5.model.CodeType src) throws FHIRException { + org.hl7.fhir.r4.model.CodeType tgt = new org.hl7.fhir.r4.model.CodeType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.r5.model.DateType convertDate(org.hl7.fhir.r4.model.DateType src) throws FHIRException { + org.hl7.fhir.r5.model.DateType tgt = new org.hl7.fhir.r5.model.DateType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.r4.model.DateType convertDate(org.hl7.fhir.r5.model.DateType src) throws FHIRException { + org.hl7.fhir.r4.model.DateType tgt = new org.hl7.fhir.r4.model.DateType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.r5.model.DateTimeType convertDateTime(org.hl7.fhir.r4.model.DateTimeType src) throws FHIRException { + org.hl7.fhir.r5.model.DateTimeType tgt = new org.hl7.fhir.r5.model.DateTimeType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.r4.model.DateTimeType convertDateTime(org.hl7.fhir.r5.model.DateTimeType src) throws FHIRException { + org.hl7.fhir.r4.model.DateTimeType tgt = new org.hl7.fhir.r4.model.DateTimeType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.r5.model.DecimalType convertDecimal(org.hl7.fhir.r4.model.DecimalType src) throws FHIRException { + org.hl7.fhir.r5.model.DecimalType tgt = new org.hl7.fhir.r5.model.DecimalType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.r4.model.DecimalType convertDecimal(org.hl7.fhir.r5.model.DecimalType src) throws FHIRException { + org.hl7.fhir.r4.model.DecimalType tgt = new org.hl7.fhir.r4.model.DecimalType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.r5.model.IdType convertId(org.hl7.fhir.r4.model.IdType src) throws FHIRException { + org.hl7.fhir.r5.model.IdType tgt = new org.hl7.fhir.r5.model.IdType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.r4.model.IdType convertId(org.hl7.fhir.r5.model.IdType src) throws FHIRException { + org.hl7.fhir.r4.model.IdType tgt = new org.hl7.fhir.r4.model.IdType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.r5.model.InstantType convertInstant(org.hl7.fhir.r4.model.InstantType src) throws FHIRException { + org.hl7.fhir.r5.model.InstantType tgt = new org.hl7.fhir.r5.model.InstantType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.r4.model.InstantType convertInstant(org.hl7.fhir.r5.model.InstantType src) throws FHIRException { + org.hl7.fhir.r4.model.InstantType tgt = new org.hl7.fhir.r4.model.InstantType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.r5.model.IntegerType convertInteger(org.hl7.fhir.r4.model.IntegerType src) throws FHIRException { + org.hl7.fhir.r5.model.IntegerType tgt = new org.hl7.fhir.r5.model.IntegerType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.r4.model.IntegerType convertInteger(org.hl7.fhir.r5.model.IntegerType src) throws FHIRException { + org.hl7.fhir.r4.model.IntegerType tgt = new org.hl7.fhir.r4.model.IntegerType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.r5.model.MarkdownType convertMarkdown(org.hl7.fhir.r4.model.MarkdownType src) throws FHIRException { + org.hl7.fhir.r5.model.MarkdownType tgt = new org.hl7.fhir.r5.model.MarkdownType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.r4.model.MarkdownType convertMarkdown(org.hl7.fhir.r5.model.MarkdownType src) throws FHIRException { + org.hl7.fhir.r4.model.MarkdownType tgt = new org.hl7.fhir.r4.model.MarkdownType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.r5.model.OidType convertOid(org.hl7.fhir.r4.model.OidType src) throws FHIRException { + org.hl7.fhir.r5.model.OidType tgt = new org.hl7.fhir.r5.model.OidType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.r4.model.OidType convertOid(org.hl7.fhir.r5.model.OidType src) throws FHIRException { + org.hl7.fhir.r4.model.OidType tgt = new org.hl7.fhir.r4.model.OidType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.r5.model.PositiveIntType convertPositiveInt(org.hl7.fhir.r4.model.PositiveIntType src) throws FHIRException { + org.hl7.fhir.r5.model.PositiveIntType tgt = new org.hl7.fhir.r5.model.PositiveIntType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.r4.model.PositiveIntType convertPositiveInt(org.hl7.fhir.r5.model.PositiveIntType src) throws FHIRException { + org.hl7.fhir.r4.model.PositiveIntType tgt = new org.hl7.fhir.r4.model.PositiveIntType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.r5.model.StringType convertString(org.hl7.fhir.r4.model.StringType src) throws FHIRException { + org.hl7.fhir.r5.model.StringType tgt = new org.hl7.fhir.r5.model.StringType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.r4.model.StringType convertString(org.hl7.fhir.r5.model.StringType src) throws FHIRException { + org.hl7.fhir.r4.model.StringType tgt = new org.hl7.fhir.r4.model.StringType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.r5.model.TimeType convertTime(org.hl7.fhir.r4.model.TimeType src) throws FHIRException { + org.hl7.fhir.r5.model.TimeType tgt = new org.hl7.fhir.r5.model.TimeType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.r4.model.TimeType convertTime(org.hl7.fhir.r5.model.TimeType src) throws FHIRException { + org.hl7.fhir.r4.model.TimeType tgt = new org.hl7.fhir.r4.model.TimeType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.r5.model.UnsignedIntType convertUnsignedInt(org.hl7.fhir.r4.model.UnsignedIntType src) throws FHIRException { + org.hl7.fhir.r5.model.UnsignedIntType tgt = new org.hl7.fhir.r5.model.UnsignedIntType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.r4.model.UnsignedIntType convertUnsignedInt(org.hl7.fhir.r5.model.UnsignedIntType src) throws FHIRException { + org.hl7.fhir.r4.model.UnsignedIntType tgt = new org.hl7.fhir.r4.model.UnsignedIntType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.r5.model.UriType convertUri(org.hl7.fhir.r4.model.UriType src) throws FHIRException { + org.hl7.fhir.r5.model.UriType tgt = new org.hl7.fhir.r5.model.UriType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.r4.model.UriType convertUri(org.hl7.fhir.r5.model.UriType src) throws FHIRException { + org.hl7.fhir.r4.model.UriType tgt = new org.hl7.fhir.r4.model.UriType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.r5.model.UrlType convertUrl(org.hl7.fhir.r4.model.UrlType src) throws FHIRException { + org.hl7.fhir.r5.model.UrlType tgt = new org.hl7.fhir.r5.model.UrlType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.r4.model.UrlType convertUrl(org.hl7.fhir.r5.model.UrlType src) throws FHIRException { + org.hl7.fhir.r4.model.UrlType tgt = new org.hl7.fhir.r4.model.UrlType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.r5.model.UuidType convertUuid(org.hl7.fhir.r4.model.UuidType src) throws FHIRException { + org.hl7.fhir.r5.model.UuidType tgt = new org.hl7.fhir.r5.model.UuidType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.r4.model.UuidType convertUuid(org.hl7.fhir.r5.model.UuidType src) throws FHIRException { + org.hl7.fhir.r4.model.UuidType tgt = new org.hl7.fhir.r4.model.UuidType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.r5.model.Extension convertExtension(org.hl7.fhir.r4.model.Extension src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Extension tgt = new org.hl7.fhir.r5.model.Extension(); + copyElement(src, tgt); + if (src.hasUrl()) + tgt.setUrlElement(convertUri(src.getUrlElement())); + if (src.hasValue()) + tgt.setValue(convertType(src.getValue())); + return tgt; + } + + public static org.hl7.fhir.r4.model.Extension convertExtension(org.hl7.fhir.r5.model.Extension src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Extension tgt = new org.hl7.fhir.r4.model.Extension(); + copyElement(src, tgt); + if (src.hasUrl()) + tgt.setUrlElement(convertUri(src.getUrlElement())); + if (src.hasValue()) + tgt.setValue(convertType(src.getValue())); + return tgt; + } + + public static org.hl7.fhir.r5.model.Narrative convertNarrative(org.hl7.fhir.r4.model.Narrative src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Narrative tgt = new org.hl7.fhir.r5.model.Narrative(); + copyElement(src, tgt); + if (src.hasStatus()) + tgt.setStatus(convertNarrativeStatus(src.getStatus())); + if (src.hasDiv()) + tgt.setDiv(convertXhtml(src.getDiv())); + return tgt; + } + + public static org.hl7.fhir.r4.model.Narrative convertNarrative(org.hl7.fhir.r5.model.Narrative src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Narrative tgt = new org.hl7.fhir.r4.model.Narrative(); + copyElement(src, tgt); + if (src.hasStatus()) + tgt.setStatus(convertNarrativeStatus(src.getStatus())); + if (src.hasDiv()) + tgt.setDiv(convertXhtml(src.getDiv())); + return tgt; + } + + public static org.hl7.fhir.r5.model.Narrative.NarrativeStatus convertNarrativeStatus(org.hl7.fhir.r4.model.Narrative.NarrativeStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case GENERATED: return org.hl7.fhir.r5.model.Narrative.NarrativeStatus.GENERATED; + case EXTENSIONS: return org.hl7.fhir.r5.model.Narrative.NarrativeStatus.EXTENSIONS; + case ADDITIONAL: return org.hl7.fhir.r5.model.Narrative.NarrativeStatus.ADDITIONAL; + case EMPTY: return org.hl7.fhir.r5.model.Narrative.NarrativeStatus.EMPTY; + default: return org.hl7.fhir.r5.model.Narrative.NarrativeStatus.NULL; + } + } + + public static org.hl7.fhir.r4.model.Narrative.NarrativeStatus convertNarrativeStatus(org.hl7.fhir.r5.model.Narrative.NarrativeStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case GENERATED: return org.hl7.fhir.r4.model.Narrative.NarrativeStatus.GENERATED; + case EXTENSIONS: return org.hl7.fhir.r4.model.Narrative.NarrativeStatus.EXTENSIONS; + case ADDITIONAL: return org.hl7.fhir.r4.model.Narrative.NarrativeStatus.ADDITIONAL; + case EMPTY: return org.hl7.fhir.r4.model.Narrative.NarrativeStatus.EMPTY; + default: return org.hl7.fhir.r4.model.Narrative.NarrativeStatus.NULL; + } + } + + public static org.hl7.fhir.r5.model.Address convertAddress(org.hl7.fhir.r4.model.Address src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Address tgt = new org.hl7.fhir.r5.model.Address(); + copyElement(src, tgt); + if (src.hasUse()) + tgt.setUse(convertAddressUse(src.getUse())); + if (src.hasType()) + tgt.setType(convertAddressType(src.getType())); + if (src.hasText()) + tgt.setTextElement(convertString(src.getTextElement())); + for (org.hl7.fhir.r4.model.StringType t : src.getLine()) + tgt.getLine().add(convertString(t)); + if (src.hasCity()) + tgt.setCityElement(convertString(src.getCityElement())); + if (src.hasDistrict()) + tgt.setDistrictElement(convertString(src.getDistrictElement())); + if (src.hasState()) + tgt.setStateElement(convertString(src.getStateElement())); + if (src.hasPostalCode()) + tgt.setPostalCodeElement(convertString(src.getPostalCodeElement())); + if (src.hasCountry()) + tgt.setCountryElement(convertString(src.getCountryElement())); + if (src.hasPeriod()) + tgt.setPeriod(convertPeriod(src.getPeriod())); + return tgt; + } + + public static org.hl7.fhir.r4.model.Address convertAddress(org.hl7.fhir.r5.model.Address src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Address tgt = new org.hl7.fhir.r4.model.Address(); + copyElement(src, tgt); + if (src.hasUse()) + tgt.setUse(convertAddressUse(src.getUse())); + if (src.hasType()) + tgt.setType(convertAddressType(src.getType())); + if (src.hasText()) + tgt.setTextElement(convertString(src.getTextElement())); + for (org.hl7.fhir.r5.model.StringType t : src.getLine()) + tgt.getLine().add(convertString(t)); + if (src.hasCity()) + tgt.setCityElement(convertString(src.getCityElement())); + if (src.hasDistrict()) + tgt.setDistrictElement(convertString(src.getDistrictElement())); + if (src.hasState()) + tgt.setStateElement(convertString(src.getStateElement())); + if (src.hasPostalCode()) + tgt.setPostalCodeElement(convertString(src.getPostalCodeElement())); + if (src.hasCountry()) + tgt.setCountryElement(convertString(src.getCountryElement())); + if (src.hasPeriod()) + tgt.setPeriod(convertPeriod(src.getPeriod())); + return tgt; + } + + public static org.hl7.fhir.r5.model.Address.AddressUse convertAddressUse(org.hl7.fhir.r4.model.Address.AddressUse src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case HOME: return org.hl7.fhir.r5.model.Address.AddressUse.HOME; + case WORK: return org.hl7.fhir.r5.model.Address.AddressUse.WORK; + case TEMP: return org.hl7.fhir.r5.model.Address.AddressUse.TEMP; + case OLD: return org.hl7.fhir.r5.model.Address.AddressUse.OLD; + case BILLING: return org.hl7.fhir.r5.model.Address.AddressUse.BILLING; + default: return org.hl7.fhir.r5.model.Address.AddressUse.NULL; + } + } + + public static org.hl7.fhir.r4.model.Address.AddressUse convertAddressUse(org.hl7.fhir.r5.model.Address.AddressUse src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case HOME: return org.hl7.fhir.r4.model.Address.AddressUse.HOME; + case WORK: return org.hl7.fhir.r4.model.Address.AddressUse.WORK; + case TEMP: return org.hl7.fhir.r4.model.Address.AddressUse.TEMP; + case OLD: return org.hl7.fhir.r4.model.Address.AddressUse.OLD; + case BILLING: return org.hl7.fhir.r4.model.Address.AddressUse.BILLING; + default: return org.hl7.fhir.r4.model.Address.AddressUse.NULL; + } + } + + public static org.hl7.fhir.r5.model.Address.AddressType convertAddressType(org.hl7.fhir.r4.model.Address.AddressType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case POSTAL: return org.hl7.fhir.r5.model.Address.AddressType.POSTAL; + case PHYSICAL: return org.hl7.fhir.r5.model.Address.AddressType.PHYSICAL; + case BOTH: return org.hl7.fhir.r5.model.Address.AddressType.BOTH; + default: return org.hl7.fhir.r5.model.Address.AddressType.NULL; + } + } + + public static org.hl7.fhir.r4.model.Address.AddressType convertAddressType(org.hl7.fhir.r5.model.Address.AddressType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case POSTAL: return org.hl7.fhir.r4.model.Address.AddressType.POSTAL; + case PHYSICAL: return org.hl7.fhir.r4.model.Address.AddressType.PHYSICAL; + case BOTH: return org.hl7.fhir.r4.model.Address.AddressType.BOTH; + default: return org.hl7.fhir.r4.model.Address.AddressType.NULL; + } + } + + public static org.hl7.fhir.r5.model.Age convertAge(org.hl7.fhir.r4.model.Age src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Age tgt = new org.hl7.fhir.r5.model.Age(); + copyQuantity(src, tgt); + return tgt; + } + + public static org.hl7.fhir.r4.model.Age convertAge(org.hl7.fhir.r5.model.Age src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Age tgt = new org.hl7.fhir.r4.model.Age(); + copyQuantity(src, tgt); + return tgt; + } + + public static org.hl7.fhir.r5.model.Annotation convertAnnotation(org.hl7.fhir.r4.model.Annotation src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Annotation tgt = new org.hl7.fhir.r5.model.Annotation(); + copyElement(src, tgt); + if (src.hasAuthor()) + tgt.setAuthor(convertType(src.getAuthor())); + if (src.hasTime()) + tgt.setTimeElement(convertDateTime(src.getTimeElement())); + if (src.hasText()) + tgt.setTextElement(convertMarkdown(src.getTextElement())); + return tgt; + } + + public static org.hl7.fhir.r4.model.Annotation convertAnnotation(org.hl7.fhir.r5.model.Annotation src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Annotation tgt = new org.hl7.fhir.r4.model.Annotation(); + copyElement(src, tgt); + if (src.hasAuthor()) + tgt.setAuthor(convertType(src.getAuthor())); + if (src.hasTime()) + tgt.setTimeElement(convertDateTime(src.getTimeElement())); + if (src.hasText()) + tgt.setTextElement(convertMarkdown(src.getTextElement())); + return tgt; + } + + public static org.hl7.fhir.r5.model.Attachment convertAttachment(org.hl7.fhir.r4.model.Attachment src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Attachment tgt = new org.hl7.fhir.r5.model.Attachment(); + copyElement(src, tgt); + if (src.hasContentType()) + tgt.setContentTypeElement(convertCode(src.getContentTypeElement())); + if (src.hasLanguage()) + tgt.setLanguageElement(convertCode(src.getLanguageElement())); + if (src.hasData()) + tgt.setDataElement(convertBase64Binary(src.getDataElement())); + if (src.hasUrl()) + tgt.setUrlElement(convertUrl(src.getUrlElement())); + if (src.hasSize()) + tgt.setSizeElement(convertUnsignedInt(src.getSizeElement())); + if (src.hasHash()) + tgt.setHashElement(convertBase64Binary(src.getHashElement())); + if (src.hasTitle()) + tgt.setTitleElement(convertString(src.getTitleElement())); + if (src.hasCreation()) + tgt.setCreationElement(convertDateTime(src.getCreationElement())); + return tgt; + } + + public static org.hl7.fhir.r4.model.Attachment convertAttachment(org.hl7.fhir.r5.model.Attachment src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Attachment tgt = new org.hl7.fhir.r4.model.Attachment(); + copyElement(src, tgt); + if (src.hasContentType()) + tgt.setContentTypeElement(convertCode(src.getContentTypeElement())); + if (src.hasLanguage()) + tgt.setLanguageElement(convertCode(src.getLanguageElement())); + if (src.hasData()) + tgt.setDataElement(convertBase64Binary(src.getDataElement())); + if (src.hasUrl()) + tgt.setUrlElement(convertUrl(src.getUrlElement())); + if (src.hasSize()) + tgt.setSizeElement(convertUnsignedInt(src.getSizeElement())); + if (src.hasHash()) + tgt.setHashElement(convertBase64Binary(src.getHashElement())); + if (src.hasTitle()) + tgt.setTitleElement(convertString(src.getTitleElement())); + if (src.hasCreation()) + tgt.setCreationElement(convertDateTime(src.getCreationElement())); + return tgt; + } + + public static org.hl7.fhir.r5.model.CodeableConcept convertCodeableConcept(org.hl7.fhir.r4.model.CodeableConcept src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.CodeableConcept tgt = new org.hl7.fhir.r5.model.CodeableConcept(); + copyElement(src, tgt); + for (org.hl7.fhir.r4.model.Coding t : src.getCoding()) + tgt.addCoding(convertCoding(t)); + if (src.hasText()) + tgt.setTextElement(convertString(src.getTextElement())); + return tgt; + } + + public static org.hl7.fhir.r4.model.CodeableConcept convertCodeableConcept(org.hl7.fhir.r5.model.CodeableConcept src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.CodeableConcept tgt = new org.hl7.fhir.r4.model.CodeableConcept(); + copyElement(src, tgt); + for (org.hl7.fhir.r5.model.Coding t : src.getCoding()) + tgt.addCoding(convertCoding(t)); + if (src.hasText()) + tgt.setTextElement(convertString(src.getTextElement())); + return tgt; + } + + public static org.hl7.fhir.r5.model.Coding convertCoding(org.hl7.fhir.r4.model.Coding src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Coding tgt = new org.hl7.fhir.r5.model.Coding(); + copyElement(src, tgt); + if (src.hasSystem()) + tgt.setSystemElement(convertUri(src.getSystemElement())); + if (src.hasVersion()) + tgt.setVersionElement(convertString(src.getVersionElement())); + if (src.hasCode()) + tgt.setCodeElement(convertCode(src.getCodeElement())); + if (src.hasDisplay()) + tgt.setDisplayElement(convertString(src.getDisplayElement())); + if (src.hasUserSelected()) + tgt.setUserSelectedElement(convertBoolean(src.getUserSelectedElement())); + return tgt; + } + + public static org.hl7.fhir.r4.model.Coding convertCoding(org.hl7.fhir.r5.model.Coding src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Coding tgt = new org.hl7.fhir.r4.model.Coding(); + copyElement(src, tgt); + if (src.hasSystem()) + tgt.setSystemElement(convertUri(src.getSystemElement())); + if (src.hasVersion()) + tgt.setVersionElement(convertString(src.getVersionElement())); + if (src.hasCode()) + tgt.setCodeElement(convertCode(src.getCodeElement())); + if (src.hasDisplay()) + tgt.setDisplayElement(convertString(src.getDisplayElement())); + if (src.hasUserSelected()) + tgt.setUserSelectedElement(convertBoolean(src.getUserSelectedElement())); + return tgt; + } + + public static org.hl7.fhir.r5.model.ContactDetail convertContactDetail(org.hl7.fhir.r4.model.ContactDetail src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ContactDetail tgt = new org.hl7.fhir.r5.model.ContactDetail(); + copyElement(src, tgt); + if (src.hasName()) + tgt.setNameElement(convertString(src.getNameElement())); + for (org.hl7.fhir.r4.model.ContactPoint t : src.getTelecom()) + tgt.addTelecom(convertContactPoint(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.ContactDetail convertContactDetail(org.hl7.fhir.r5.model.ContactDetail src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.ContactDetail tgt = new org.hl7.fhir.r4.model.ContactDetail(); + copyElement(src, tgt); + if (src.hasName()) + tgt.setNameElement(convertString(src.getNameElement())); + for (org.hl7.fhir.r5.model.ContactPoint t : src.getTelecom()) + tgt.addTelecom(convertContactPoint(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.ContactPoint convertContactPoint(org.hl7.fhir.r4.model.ContactPoint src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ContactPoint tgt = new org.hl7.fhir.r5.model.ContactPoint(); + copyElement(src, tgt); + if (src.hasSystem()) + tgt.setSystem(convertContactPointSystem(src.getSystem())); + if (src.hasValue()) + tgt.setValueElement(convertString(src.getValueElement())); + if (src.hasUse()) + tgt.setUse(convertContactPointUse(src.getUse())); + if (src.hasRank()) + tgt.setRankElement(convertPositiveInt(src.getRankElement())); + if (src.hasPeriod()) + tgt.setPeriod(convertPeriod(src.getPeriod())); + return tgt; + } + + public static org.hl7.fhir.r4.model.ContactPoint convertContactPoint(org.hl7.fhir.r5.model.ContactPoint src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.ContactPoint tgt = new org.hl7.fhir.r4.model.ContactPoint(); + copyElement(src, tgt); + if (src.hasSystem()) + tgt.setSystem(convertContactPointSystem(src.getSystem())); + if (src.hasValue()) + tgt.setValueElement(convertString(src.getValueElement())); + if (src.hasUse()) + tgt.setUse(convertContactPointUse(src.getUse())); + if (src.hasRank()) + tgt.setRankElement(convertPositiveInt(src.getRankElement())); + if (src.hasPeriod()) + tgt.setPeriod(convertPeriod(src.getPeriod())); + return tgt; + } + + public static org.hl7.fhir.r5.model.ContactPoint.ContactPointSystem convertContactPointSystem(org.hl7.fhir.r4.model.ContactPoint.ContactPointSystem src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PHONE: return org.hl7.fhir.r5.model.ContactPoint.ContactPointSystem.PHONE; + case FAX: return org.hl7.fhir.r5.model.ContactPoint.ContactPointSystem.FAX; + case EMAIL: return org.hl7.fhir.r5.model.ContactPoint.ContactPointSystem.EMAIL; + case PAGER: return org.hl7.fhir.r5.model.ContactPoint.ContactPointSystem.PAGER; + case URL: return org.hl7.fhir.r5.model.ContactPoint.ContactPointSystem.URL; + case SMS: return org.hl7.fhir.r5.model.ContactPoint.ContactPointSystem.SMS; + case OTHER: return org.hl7.fhir.r5.model.ContactPoint.ContactPointSystem.OTHER; + default: return org.hl7.fhir.r5.model.ContactPoint.ContactPointSystem.NULL; + } + } + + public static org.hl7.fhir.r4.model.ContactPoint.ContactPointSystem convertContactPointSystem(org.hl7.fhir.r5.model.ContactPoint.ContactPointSystem src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PHONE: return org.hl7.fhir.r4.model.ContactPoint.ContactPointSystem.PHONE; + case FAX: return org.hl7.fhir.r4.model.ContactPoint.ContactPointSystem.FAX; + case EMAIL: return org.hl7.fhir.r4.model.ContactPoint.ContactPointSystem.EMAIL; + case PAGER: return org.hl7.fhir.r4.model.ContactPoint.ContactPointSystem.PAGER; + case URL: return org.hl7.fhir.r4.model.ContactPoint.ContactPointSystem.URL; + case SMS: return org.hl7.fhir.r4.model.ContactPoint.ContactPointSystem.SMS; + case OTHER: return org.hl7.fhir.r4.model.ContactPoint.ContactPointSystem.OTHER; + default: return org.hl7.fhir.r4.model.ContactPoint.ContactPointSystem.NULL; + } + } + + public static org.hl7.fhir.r5.model.ContactPoint.ContactPointUse convertContactPointUse(org.hl7.fhir.r4.model.ContactPoint.ContactPointUse src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case HOME: return org.hl7.fhir.r5.model.ContactPoint.ContactPointUse.HOME; + case WORK: return org.hl7.fhir.r5.model.ContactPoint.ContactPointUse.WORK; + case TEMP: return org.hl7.fhir.r5.model.ContactPoint.ContactPointUse.TEMP; + case OLD: return org.hl7.fhir.r5.model.ContactPoint.ContactPointUse.OLD; + case MOBILE: return org.hl7.fhir.r5.model.ContactPoint.ContactPointUse.MOBILE; + default: return org.hl7.fhir.r5.model.ContactPoint.ContactPointUse.NULL; + } + } + + public static org.hl7.fhir.r4.model.ContactPoint.ContactPointUse convertContactPointUse(org.hl7.fhir.r5.model.ContactPoint.ContactPointUse src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case HOME: return org.hl7.fhir.r4.model.ContactPoint.ContactPointUse.HOME; + case WORK: return org.hl7.fhir.r4.model.ContactPoint.ContactPointUse.WORK; + case TEMP: return org.hl7.fhir.r4.model.ContactPoint.ContactPointUse.TEMP; + case OLD: return org.hl7.fhir.r4.model.ContactPoint.ContactPointUse.OLD; + case MOBILE: return org.hl7.fhir.r4.model.ContactPoint.ContactPointUse.MOBILE; + default: return org.hl7.fhir.r4.model.ContactPoint.ContactPointUse.NULL; + } + } + + public static org.hl7.fhir.r5.model.Contributor convertContributor(org.hl7.fhir.r4.model.Contributor src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Contributor tgt = new org.hl7.fhir.r5.model.Contributor(); + copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertContributorType(src.getType())); + if (src.hasName()) + tgt.setNameElement(convertString(src.getNameElement())); + for (org.hl7.fhir.r4.model.ContactDetail t : src.getContact()) + tgt.addContact(convertContactDetail(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.Contributor convertContributor(org.hl7.fhir.r5.model.Contributor src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Contributor tgt = new org.hl7.fhir.r4.model.Contributor(); + copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertContributorType(src.getType())); + if (src.hasName()) + tgt.setNameElement(convertString(src.getNameElement())); + for (org.hl7.fhir.r5.model.ContactDetail t : src.getContact()) + tgt.addContact(convertContactDetail(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.Contributor.ContributorType convertContributorType(org.hl7.fhir.r4.model.Contributor.ContributorType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case AUTHOR: return org.hl7.fhir.r5.model.Contributor.ContributorType.AUTHOR; + case EDITOR: return org.hl7.fhir.r5.model.Contributor.ContributorType.EDITOR; + case REVIEWER: return org.hl7.fhir.r5.model.Contributor.ContributorType.REVIEWER; + case ENDORSER: return org.hl7.fhir.r5.model.Contributor.ContributorType.ENDORSER; + default: return org.hl7.fhir.r5.model.Contributor.ContributorType.NULL; + } + } + + public static org.hl7.fhir.r4.model.Contributor.ContributorType convertContributorType(org.hl7.fhir.r5.model.Contributor.ContributorType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case AUTHOR: return org.hl7.fhir.r4.model.Contributor.ContributorType.AUTHOR; + case EDITOR: return org.hl7.fhir.r4.model.Contributor.ContributorType.EDITOR; + case REVIEWER: return org.hl7.fhir.r4.model.Contributor.ContributorType.REVIEWER; + case ENDORSER: return org.hl7.fhir.r4.model.Contributor.ContributorType.ENDORSER; + default: return org.hl7.fhir.r4.model.Contributor.ContributorType.NULL; + } + } + + public static org.hl7.fhir.r5.model.Count convertCount(org.hl7.fhir.r4.model.Count src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Count tgt = new org.hl7.fhir.r5.model.Count(); + copyQuantity(src, tgt); + return tgt; + } + + public static org.hl7.fhir.r4.model.Count convertCount(org.hl7.fhir.r5.model.Count src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Count tgt = new org.hl7.fhir.r4.model.Count(); + copyQuantity(src, tgt); + return tgt; + } + + public static org.hl7.fhir.r5.model.DataRequirement convertDataRequirement(org.hl7.fhir.r4.model.DataRequirement src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.DataRequirement tgt = new org.hl7.fhir.r5.model.DataRequirement(); + copyElement(src, tgt); + if (src.hasType()) + tgt.setTypeElement(convertCode(src.getTypeElement())); + for (org.hl7.fhir.r4.model.CanonicalType t : src.getProfile()) + tgt.getProfile().add(convertCanonical(t)); + if (src.hasSubject()) + tgt.setSubject(convertType(src.getSubject())); + for (org.hl7.fhir.r4.model.StringType t : src.getMustSupport()) + tgt.getMustSupport().add(convertString(t)); + for (org.hl7.fhir.r4.model.DataRequirement.DataRequirementCodeFilterComponent t : src.getCodeFilter()) + tgt.addCodeFilter(convertDataRequirementCodeFilterComponent(t)); + for (org.hl7.fhir.r4.model.DataRequirement.DataRequirementDateFilterComponent t : src.getDateFilter()) + tgt.addDateFilter(convertDataRequirementDateFilterComponent(t)); + if (src.hasLimit()) + tgt.setLimitElement(convertPositiveInt(src.getLimitElement())); + for (org.hl7.fhir.r4.model.DataRequirement.DataRequirementSortComponent t : src.getSort()) + tgt.addSort(convertDataRequirementSortComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.DataRequirement convertDataRequirement(org.hl7.fhir.r5.model.DataRequirement src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.DataRequirement tgt = new org.hl7.fhir.r4.model.DataRequirement(); + copyElement(src, tgt); + if (src.hasType()) + tgt.setTypeElement(convertCode(src.getTypeElement())); + for (org.hl7.fhir.r5.model.CanonicalType t : src.getProfile()) + tgt.getProfile().add(convertCanonical(t)); + if (src.hasSubject()) + tgt.setSubject(convertType(src.getSubject())); + for (org.hl7.fhir.r5.model.StringType t : src.getMustSupport()) + tgt.getMustSupport().add(convertString(t)); + for (org.hl7.fhir.r5.model.DataRequirement.DataRequirementCodeFilterComponent t : src.getCodeFilter()) + tgt.addCodeFilter(convertDataRequirementCodeFilterComponent(t)); + for (org.hl7.fhir.r5.model.DataRequirement.DataRequirementDateFilterComponent t : src.getDateFilter()) + tgt.addDateFilter(convertDataRequirementDateFilterComponent(t)); + if (src.hasLimit()) + tgt.setLimitElement(convertPositiveInt(src.getLimitElement())); + for (org.hl7.fhir.r5.model.DataRequirement.DataRequirementSortComponent t : src.getSort()) + tgt.addSort(convertDataRequirementSortComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.DataRequirement.DataRequirementCodeFilterComponent convertDataRequirementCodeFilterComponent(org.hl7.fhir.r4.model.DataRequirement.DataRequirementCodeFilterComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.DataRequirement.DataRequirementCodeFilterComponent tgt = new org.hl7.fhir.r5.model.DataRequirement.DataRequirementCodeFilterComponent(); + copyElement(src, tgt); + if (src.hasPath()) + tgt.setPathElement(convertString(src.getPathElement())); + if (src.hasSearchParam()) + tgt.setSearchParamElement(convertString(src.getSearchParamElement())); + if (src.hasValueSet()) + tgt.setValueSetElement(convertCanonical(src.getValueSetElement())); + for (org.hl7.fhir.r4.model.Coding t : src.getCode()) + tgt.addCode(convertCoding(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.DataRequirement.DataRequirementCodeFilterComponent convertDataRequirementCodeFilterComponent(org.hl7.fhir.r5.model.DataRequirement.DataRequirementCodeFilterComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.DataRequirement.DataRequirementCodeFilterComponent tgt = new org.hl7.fhir.r4.model.DataRequirement.DataRequirementCodeFilterComponent(); + copyElement(src, tgt); + if (src.hasPath()) + tgt.setPathElement(convertString(src.getPathElement())); + if (src.hasSearchParam()) + tgt.setSearchParamElement(convertString(src.getSearchParamElement())); + if (src.hasValueSet()) + tgt.setValueSetElement(convertCanonical(src.getValueSetElement())); + for (org.hl7.fhir.r5.model.Coding t : src.getCode()) + tgt.addCode(convertCoding(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.DataRequirement.DataRequirementDateFilterComponent convertDataRequirementDateFilterComponent(org.hl7.fhir.r4.model.DataRequirement.DataRequirementDateFilterComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.DataRequirement.DataRequirementDateFilterComponent tgt = new org.hl7.fhir.r5.model.DataRequirement.DataRequirementDateFilterComponent(); + copyElement(src, tgt); + if (src.hasPath()) + tgt.setPathElement(convertString(src.getPathElement())); + if (src.hasSearchParam()) + tgt.setSearchParamElement(convertString(src.getSearchParamElement())); + if (src.hasValue()) + tgt.setValue(convertType(src.getValue())); + return tgt; + } + + public static org.hl7.fhir.r4.model.DataRequirement.DataRequirementDateFilterComponent convertDataRequirementDateFilterComponent(org.hl7.fhir.r5.model.DataRequirement.DataRequirementDateFilterComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.DataRequirement.DataRequirementDateFilterComponent tgt = new org.hl7.fhir.r4.model.DataRequirement.DataRequirementDateFilterComponent(); + copyElement(src, tgt); + if (src.hasPath()) + tgt.setPathElement(convertString(src.getPathElement())); + if (src.hasSearchParam()) + tgt.setSearchParamElement(convertString(src.getSearchParamElement())); + if (src.hasValue()) + tgt.setValue(convertType(src.getValue())); + return tgt; + } + + public static org.hl7.fhir.r5.model.DataRequirement.DataRequirementSortComponent convertDataRequirementSortComponent(org.hl7.fhir.r4.model.DataRequirement.DataRequirementSortComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.DataRequirement.DataRequirementSortComponent tgt = new org.hl7.fhir.r5.model.DataRequirement.DataRequirementSortComponent(); + copyElement(src, tgt); + if (src.hasPath()) + tgt.setPathElement(convertString(src.getPathElement())); + if (src.hasDirection()) + tgt.setDirection(convertSortDirection(src.getDirection())); + return tgt; + } + + public static org.hl7.fhir.r4.model.DataRequirement.DataRequirementSortComponent convertDataRequirementSortComponent(org.hl7.fhir.r5.model.DataRequirement.DataRequirementSortComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.DataRequirement.DataRequirementSortComponent tgt = new org.hl7.fhir.r4.model.DataRequirement.DataRequirementSortComponent(); + copyElement(src, tgt); + if (src.hasPath()) + tgt.setPathElement(convertString(src.getPathElement())); + if (src.hasDirection()) + tgt.setDirection(convertSortDirection(src.getDirection())); + return tgt; + } + + public static org.hl7.fhir.r5.model.DataRequirement.SortDirection convertSortDirection(org.hl7.fhir.r4.model.DataRequirement.SortDirection src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case ASCENDING: return org.hl7.fhir.r5.model.DataRequirement.SortDirection.ASCENDING; + case DESCENDING: return org.hl7.fhir.r5.model.DataRequirement.SortDirection.DESCENDING; + default: return org.hl7.fhir.r5.model.DataRequirement.SortDirection.NULL; + } + } + + public static org.hl7.fhir.r4.model.DataRequirement.SortDirection convertSortDirection(org.hl7.fhir.r5.model.DataRequirement.SortDirection src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case ASCENDING: return org.hl7.fhir.r4.model.DataRequirement.SortDirection.ASCENDING; + case DESCENDING: return org.hl7.fhir.r4.model.DataRequirement.SortDirection.DESCENDING; + default: return org.hl7.fhir.r4.model.DataRequirement.SortDirection.NULL; + } + } + + public static org.hl7.fhir.r5.model.Distance convertDistance(org.hl7.fhir.r4.model.Distance src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Distance tgt = new org.hl7.fhir.r5.model.Distance(); + copyQuantity(src, tgt); + return tgt; + } + + public static org.hl7.fhir.r4.model.Distance convertDistance(org.hl7.fhir.r5.model.Distance src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Distance tgt = new org.hl7.fhir.r4.model.Distance(); + copyQuantity(src, tgt); + return tgt; + } + + public static org.hl7.fhir.r5.model.Dosage convertDosage(org.hl7.fhir.r4.model.Dosage src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Dosage tgt = new org.hl7.fhir.r5.model.Dosage(); + copyBackboneElement(src, tgt); + if (src.hasSequence()) + tgt.setSequenceElement(convertInteger(src.getSequenceElement())); + if (src.hasText()) + tgt.setTextElement(convertString(src.getTextElement())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getAdditionalInstruction()) + tgt.addAdditionalInstruction(convertCodeableConcept(t)); + if (src.hasPatientInstruction()) + tgt.setPatientInstructionElement(convertString(src.getPatientInstructionElement())); + if (src.hasTiming()) + tgt.setTiming(convertTiming(src.getTiming())); + if (src.hasAsNeeded()) + tgt.setAsNeeded(convertType(src.getAsNeeded())); + if (src.hasSite()) + tgt.setSite(convertCodeableConcept(src.getSite())); + if (src.hasRoute()) + tgt.setRoute(convertCodeableConcept(src.getRoute())); + if (src.hasMethod()) + tgt.setMethod(convertCodeableConcept(src.getMethod())); + for (org.hl7.fhir.r4.model.Dosage.DosageDoseAndRateComponent t : src.getDoseAndRate()) + tgt.addDoseAndRate(convertDosageDoseAndRateComponent(t)); + if (src.hasMaxDosePerPeriod()) + tgt.setMaxDosePerPeriod(convertRatio(src.getMaxDosePerPeriod())); + if (src.hasMaxDosePerAdministration()) + tgt.setMaxDosePerAdministration(convertSimpleQuantity(src.getMaxDosePerAdministration())); + if (src.hasMaxDosePerLifetime()) + tgt.setMaxDosePerLifetime(convertSimpleQuantity(src.getMaxDosePerLifetime())); + return tgt; + } + + public static org.hl7.fhir.r4.model.Dosage convertDosage(org.hl7.fhir.r5.model.Dosage src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Dosage tgt = new org.hl7.fhir.r4.model.Dosage(); + copyBackboneElement(src, tgt); + if (src.hasSequence()) + tgt.setSequenceElement(convertInteger(src.getSequenceElement())); + if (src.hasText()) + tgt.setTextElement(convertString(src.getTextElement())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getAdditionalInstruction()) + tgt.addAdditionalInstruction(convertCodeableConcept(t)); + if (src.hasPatientInstruction()) + tgt.setPatientInstructionElement(convertString(src.getPatientInstructionElement())); + if (src.hasTiming()) + tgt.setTiming(convertTiming(src.getTiming())); + if (src.hasAsNeeded()) + tgt.setAsNeeded(convertType(src.getAsNeeded())); + if (src.hasSite()) + tgt.setSite(convertCodeableConcept(src.getSite())); + if (src.hasRoute()) + tgt.setRoute(convertCodeableConcept(src.getRoute())); + if (src.hasMethod()) + tgt.setMethod(convertCodeableConcept(src.getMethod())); + for (org.hl7.fhir.r5.model.Dosage.DosageDoseAndRateComponent t : src.getDoseAndRate()) + tgt.addDoseAndRate(convertDosageDoseAndRateComponent(t)); + if (src.hasMaxDosePerPeriod()) + tgt.setMaxDosePerPeriod(convertRatio(src.getMaxDosePerPeriod())); + if (src.hasMaxDosePerAdministration()) + tgt.setMaxDosePerAdministration(convertSimpleQuantity(src.getMaxDosePerAdministration())); + if (src.hasMaxDosePerLifetime()) + tgt.setMaxDosePerLifetime(convertSimpleQuantity(src.getMaxDosePerLifetime())); + return tgt; + } + + public static org.hl7.fhir.r5.model.Dosage.DosageDoseAndRateComponent convertDosageDoseAndRateComponent(org.hl7.fhir.r4.model.Dosage.DosageDoseAndRateComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Dosage.DosageDoseAndRateComponent tgt = new org.hl7.fhir.r5.model.Dosage.DosageDoseAndRateComponent(); + copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + if (src.hasDose()) + tgt.setDose(convertType(src.getDose())); + if (src.hasRate()) + tgt.setRate(convertType(src.getRate())); + return tgt; + } + + public static org.hl7.fhir.r4.model.Dosage.DosageDoseAndRateComponent convertDosageDoseAndRateComponent(org.hl7.fhir.r5.model.Dosage.DosageDoseAndRateComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Dosage.DosageDoseAndRateComponent tgt = new org.hl7.fhir.r4.model.Dosage.DosageDoseAndRateComponent(); + copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + if (src.hasDose()) + tgt.setDose(convertType(src.getDose())); + if (src.hasRate()) + tgt.setRate(convertType(src.getRate())); + return tgt; + } + + public static org.hl7.fhir.r5.model.Duration convertDuration(org.hl7.fhir.r4.model.Duration src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Duration tgt = new org.hl7.fhir.r5.model.Duration(); + copyQuantity(src, tgt); + return tgt; + } + + public static org.hl7.fhir.r4.model.Duration convertDuration(org.hl7.fhir.r5.model.Duration src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Duration tgt = new org.hl7.fhir.r4.model.Duration(); + copyQuantity(src, tgt); + return tgt; + } + + public static org.hl7.fhir.r5.model.Expression convertExpression(org.hl7.fhir.r4.model.Expression src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Expression tgt = new org.hl7.fhir.r5.model.Expression(); + copyElement(src, tgt); + if (src.hasDescription()) + tgt.setDescriptionElement(convertString(src.getDescriptionElement())); + if (src.hasName()) + tgt.setNameElement(convertId(src.getNameElement())); + if (src.hasLanguage()) + tgt.setLanguage(convertExpressionLanguage(src.getLanguage())); + if (src.hasExpression()) + tgt.setExpressionElement(convertString(src.getExpressionElement())); + if (src.hasReference()) + tgt.setReferenceElement(convertUri(src.getReferenceElement())); + return tgt; + } + + public static org.hl7.fhir.r4.model.Expression convertExpression(org.hl7.fhir.r5.model.Expression src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Expression tgt = new org.hl7.fhir.r4.model.Expression(); + copyElement(src, tgt); + if (src.hasDescription()) + tgt.setDescriptionElement(convertString(src.getDescriptionElement())); + if (src.hasName()) + tgt.setNameElement(convertId(src.getNameElement())); + if (src.hasLanguage()) + tgt.setLanguage(convertExpressionLanguage(src.getLanguage())); + if (src.hasExpression()) + tgt.setExpressionElement(convertString(src.getExpressionElement())); + if (src.hasReference()) + tgt.setReferenceElement(convertUri(src.getReferenceElement())); + return tgt; + } + + public static org.hl7.fhir.r5.model.Expression.ExpressionLanguage convertExpressionLanguage(org.hl7.fhir.r4.model.Expression.ExpressionLanguage src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case TEXT_CQL: return org.hl7.fhir.r5.model.Expression.ExpressionLanguage.TEXT_CQL; + case TEXT_FHIRPATH: return org.hl7.fhir.r5.model.Expression.ExpressionLanguage.TEXT_FHIRPATH; + case APPLICATION_XFHIRQUERY: return org.hl7.fhir.r5.model.Expression.ExpressionLanguage.APPLICATION_XFHIRQUERY; + default: return org.hl7.fhir.r5.model.Expression.ExpressionLanguage.NULL; + } + } + + public static org.hl7.fhir.r4.model.Expression.ExpressionLanguage convertExpressionLanguage(org.hl7.fhir.r5.model.Expression.ExpressionLanguage src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case TEXT_CQL: return org.hl7.fhir.r4.model.Expression.ExpressionLanguage.TEXT_CQL; + case TEXT_FHIRPATH: return org.hl7.fhir.r4.model.Expression.ExpressionLanguage.TEXT_FHIRPATH; + case APPLICATION_XFHIRQUERY: return org.hl7.fhir.r4.model.Expression.ExpressionLanguage.APPLICATION_XFHIRQUERY; + default: return org.hl7.fhir.r4.model.Expression.ExpressionLanguage.NULL; + } + } + + public static org.hl7.fhir.r5.model.HumanName convertHumanName(org.hl7.fhir.r4.model.HumanName src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.HumanName tgt = new org.hl7.fhir.r5.model.HumanName(); + copyElement(src, tgt); + if (src.hasUse()) + tgt.setUse(convertNameUse(src.getUse())); + if (src.hasText()) + tgt.setTextElement(convertString(src.getTextElement())); + if (src.hasFamily()) + tgt.setFamilyElement(convertString(src.getFamilyElement())); + for (org.hl7.fhir.r4.model.StringType t : src.getGiven()) + tgt.getGiven().add(convertString(t)); + for (org.hl7.fhir.r4.model.StringType t : src.getPrefix()) + tgt.getPrefix().add(convertString(t)); + for (org.hl7.fhir.r4.model.StringType t : src.getSuffix()) + tgt.getSuffix().add(convertString(t)); + if (src.hasPeriod()) + tgt.setPeriod(convertPeriod(src.getPeriod())); + return tgt; + } + + public static org.hl7.fhir.r4.model.HumanName convertHumanName(org.hl7.fhir.r5.model.HumanName src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.HumanName tgt = new org.hl7.fhir.r4.model.HumanName(); + copyElement(src, tgt); + if (src.hasUse()) + tgt.setUse(convertNameUse(src.getUse())); + if (src.hasText()) + tgt.setTextElement(convertString(src.getTextElement())); + if (src.hasFamily()) + tgt.setFamilyElement(convertString(src.getFamilyElement())); + for (org.hl7.fhir.r5.model.StringType t : src.getGiven()) + tgt.getGiven().add(convertString(t)); + for (org.hl7.fhir.r5.model.StringType t : src.getPrefix()) + tgt.getPrefix().add(convertString(t)); + for (org.hl7.fhir.r5.model.StringType t : src.getSuffix()) + tgt.getSuffix().add(convertString(t)); + if (src.hasPeriod()) + tgt.setPeriod(convertPeriod(src.getPeriod())); + return tgt; + } + + public static org.hl7.fhir.r5.model.HumanName.NameUse convertNameUse(org.hl7.fhir.r4.model.HumanName.NameUse src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case USUAL: return org.hl7.fhir.r5.model.HumanName.NameUse.USUAL; + case OFFICIAL: return org.hl7.fhir.r5.model.HumanName.NameUse.OFFICIAL; + case TEMP: return org.hl7.fhir.r5.model.HumanName.NameUse.TEMP; + case NICKNAME: return org.hl7.fhir.r5.model.HumanName.NameUse.NICKNAME; + case ANONYMOUS: return org.hl7.fhir.r5.model.HumanName.NameUse.ANONYMOUS; + case OLD: return org.hl7.fhir.r5.model.HumanName.NameUse.OLD; + case MAIDEN: return org.hl7.fhir.r5.model.HumanName.NameUse.MAIDEN; + default: return org.hl7.fhir.r5.model.HumanName.NameUse.NULL; + } + } + + public static org.hl7.fhir.r4.model.HumanName.NameUse convertNameUse(org.hl7.fhir.r5.model.HumanName.NameUse src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case USUAL: return org.hl7.fhir.r4.model.HumanName.NameUse.USUAL; + case OFFICIAL: return org.hl7.fhir.r4.model.HumanName.NameUse.OFFICIAL; + case TEMP: return org.hl7.fhir.r4.model.HumanName.NameUse.TEMP; + case NICKNAME: return org.hl7.fhir.r4.model.HumanName.NameUse.NICKNAME; + case ANONYMOUS: return org.hl7.fhir.r4.model.HumanName.NameUse.ANONYMOUS; + case OLD: return org.hl7.fhir.r4.model.HumanName.NameUse.OLD; + case MAIDEN: return org.hl7.fhir.r4.model.HumanName.NameUse.MAIDEN; + default: return org.hl7.fhir.r4.model.HumanName.NameUse.NULL; + } + } + + public static org.hl7.fhir.r5.model.Identifier convertIdentifier(org.hl7.fhir.r4.model.Identifier src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Identifier tgt = new org.hl7.fhir.r5.model.Identifier(); + copyElement(src, tgt); + if (src.hasUse()) + tgt.setUse(convertIdentifierUse(src.getUse())); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + if (src.hasSystem()) + tgt.setSystemElement(convertUri(src.getSystemElement())); + if (src.hasValue()) + tgt.setValueElement(convertString(src.getValueElement())); + if (src.hasPeriod()) + tgt.setPeriod(convertPeriod(src.getPeriod())); + if (src.hasAssigner()) + tgt.setAssigner(convertReference(src.getAssigner())); + return tgt; + } + + public static org.hl7.fhir.r4.model.Identifier convertIdentifier(org.hl7.fhir.r5.model.Identifier src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Identifier tgt = new org.hl7.fhir.r4.model.Identifier(); + copyElement(src, tgt); + if (src.hasUse()) + tgt.setUse(convertIdentifierUse(src.getUse())); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + if (src.hasSystem()) + tgt.setSystemElement(convertUri(src.getSystemElement())); + if (src.hasValue()) + tgt.setValueElement(convertString(src.getValueElement())); + if (src.hasPeriod()) + tgt.setPeriod(convertPeriod(src.getPeriod())); + if (src.hasAssigner()) + tgt.setAssigner(convertReference(src.getAssigner())); + return tgt; + } + + public static org.hl7.fhir.r5.model.Identifier.IdentifierUse convertIdentifierUse(org.hl7.fhir.r4.model.Identifier.IdentifierUse src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case USUAL: return org.hl7.fhir.r5.model.Identifier.IdentifierUse.USUAL; + case OFFICIAL: return org.hl7.fhir.r5.model.Identifier.IdentifierUse.OFFICIAL; + case TEMP: return org.hl7.fhir.r5.model.Identifier.IdentifierUse.TEMP; + case SECONDARY: return org.hl7.fhir.r5.model.Identifier.IdentifierUse.SECONDARY; + case OLD: return org.hl7.fhir.r5.model.Identifier.IdentifierUse.OLD; + default: return org.hl7.fhir.r5.model.Identifier.IdentifierUse.NULL; + } + } + + public static org.hl7.fhir.r4.model.Identifier.IdentifierUse convertIdentifierUse(org.hl7.fhir.r5.model.Identifier.IdentifierUse src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case USUAL: return org.hl7.fhir.r4.model.Identifier.IdentifierUse.USUAL; + case OFFICIAL: return org.hl7.fhir.r4.model.Identifier.IdentifierUse.OFFICIAL; + case TEMP: return org.hl7.fhir.r4.model.Identifier.IdentifierUse.TEMP; + case SECONDARY: return org.hl7.fhir.r4.model.Identifier.IdentifierUse.SECONDARY; + case OLD: return org.hl7.fhir.r4.model.Identifier.IdentifierUse.OLD; + default: return org.hl7.fhir.r4.model.Identifier.IdentifierUse.NULL; + } + } + + public static org.hl7.fhir.r5.model.MarketingStatus convertMarketingStatus(org.hl7.fhir.r4.model.MarketingStatus src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.MarketingStatus tgt = new org.hl7.fhir.r5.model.MarketingStatus(); + copyBackboneElement(src, tgt); + if (src.hasCountry()) + tgt.setCountry(convertCodeableConcept(src.getCountry())); + if (src.hasJurisdiction()) + tgt.setJurisdiction(convertCodeableConcept(src.getJurisdiction())); + if (src.hasStatus()) + tgt.setStatus(convertCodeableConcept(src.getStatus())); + if (src.hasDateRange()) + tgt.setDateRange(convertPeriod(src.getDateRange())); + if (src.hasRestoreDate()) + tgt.setRestoreDateElement(convertDateTime(src.getRestoreDateElement())); + return tgt; + } + + public static org.hl7.fhir.r4.model.MarketingStatus convertMarketingStatus(org.hl7.fhir.r5.model.MarketingStatus src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.MarketingStatus tgt = new org.hl7.fhir.r4.model.MarketingStatus(); + copyBackboneElement(src, tgt); + if (src.hasCountry()) + tgt.setCountry(convertCodeableConcept(src.getCountry())); + if (src.hasJurisdiction()) + tgt.setJurisdiction(convertCodeableConcept(src.getJurisdiction())); + if (src.hasStatus()) + tgt.setStatus(convertCodeableConcept(src.getStatus())); + if (src.hasDateRange()) + tgt.setDateRange(convertPeriod(src.getDateRange())); + if (src.hasRestoreDate()) + tgt.setRestoreDateElement(convertDateTime(src.getRestoreDateElement())); + return tgt; + } + + public static org.hl7.fhir.r5.model.Meta convertMeta(org.hl7.fhir.r4.model.Meta src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Meta tgt = new org.hl7.fhir.r5.model.Meta(); + copyElement(src, tgt); + if (src.hasVersionId()) + tgt.setVersionIdElement(convertId(src.getVersionIdElement())); + if (src.hasLastUpdated()) + tgt.setLastUpdatedElement(convertInstant(src.getLastUpdatedElement())); + if (src.hasSource()) + tgt.setSourceElement(convertUri(src.getSourceElement())); + for (org.hl7.fhir.r4.model.CanonicalType t : src.getProfile()) + tgt.getProfile().add(convertCanonical(t)); + for (org.hl7.fhir.r4.model.Coding t : src.getSecurity()) + tgt.addSecurity(convertCoding(t)); + for (org.hl7.fhir.r4.model.Coding t : src.getTag()) + tgt.addTag(convertCoding(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.Meta convertMeta(org.hl7.fhir.r5.model.Meta src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Meta tgt = new org.hl7.fhir.r4.model.Meta(); + copyElement(src, tgt); + if (src.hasVersionId()) + tgt.setVersionIdElement(convertId(src.getVersionIdElement())); + if (src.hasLastUpdated()) + tgt.setLastUpdatedElement(convertInstant(src.getLastUpdatedElement())); + if (src.hasSource()) + tgt.setSourceElement(convertUri(src.getSourceElement())); + for (org.hl7.fhir.r5.model.CanonicalType t : src.getProfile()) + tgt.getProfile().add(convertCanonical(t)); + for (org.hl7.fhir.r5.model.Coding t : src.getSecurity()) + tgt.addSecurity(convertCoding(t)); + for (org.hl7.fhir.r5.model.Coding t : src.getTag()) + tgt.addTag(convertCoding(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.Money convertMoney(org.hl7.fhir.r4.model.Money src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Money tgt = new org.hl7.fhir.r5.model.Money(); + copyElement(src, tgt); + if (src.hasValue()) + tgt.setValueElement(convertDecimal(src.getValueElement())); + if (src.hasCurrency()) + tgt.setCurrencyElement(convertCode(src.getCurrencyElement())); + return tgt; + } + + public static org.hl7.fhir.r4.model.Money convertMoney(org.hl7.fhir.r5.model.Money src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Money tgt = new org.hl7.fhir.r4.model.Money(); + copyElement(src, tgt); + if (src.hasValue()) + tgt.setValueElement(convertDecimal(src.getValueElement())); + if (src.hasCurrency()) + tgt.setCurrencyElement(convertCode(src.getCurrencyElement())); + return tgt; + } + + public static org.hl7.fhir.r5.model.ParameterDefinition convertParameterDefinition(org.hl7.fhir.r4.model.ParameterDefinition src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ParameterDefinition tgt = new org.hl7.fhir.r5.model.ParameterDefinition(); + copyElement(src, tgt); + if (src.hasName()) + tgt.setNameElement(convertCode(src.getNameElement())); + if (src.hasUse()) + tgt.setUse(convertParameterUse(src.getUse())); + if (src.hasMin()) + tgt.setMinElement(convertInteger(src.getMinElement())); + if (src.hasMax()) + tgt.setMaxElement(convertString(src.getMaxElement())); + if (src.hasDocumentation()) + tgt.setDocumentationElement(convertString(src.getDocumentationElement())); + if (src.hasType()) + tgt.setTypeElement(convertCode(src.getTypeElement())); + if (src.hasProfile()) + tgt.setProfileElement(convertCanonical(src.getProfileElement())); + return tgt; + } + + public static org.hl7.fhir.r4.model.ParameterDefinition convertParameterDefinition(org.hl7.fhir.r5.model.ParameterDefinition src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.ParameterDefinition tgt = new org.hl7.fhir.r4.model.ParameterDefinition(); + copyElement(src, tgt); + if (src.hasName()) + tgt.setNameElement(convertCode(src.getNameElement())); + if (src.hasUse()) + tgt.setUse(convertParameterUse(src.getUse())); + if (src.hasMin()) + tgt.setMinElement(convertInteger(src.getMinElement())); + if (src.hasMax()) + tgt.setMaxElement(convertString(src.getMaxElement())); + if (src.hasDocumentation()) + tgt.setDocumentationElement(convertString(src.getDocumentationElement())); + if (src.hasType()) + tgt.setTypeElement(convertCode(src.getTypeElement())); + if (src.hasProfile()) + tgt.setProfileElement(convertCanonical(src.getProfileElement())); + return tgt; + } + + public static org.hl7.fhir.r5.model.ParameterDefinition.ParameterUse convertParameterUse(org.hl7.fhir.r4.model.ParameterDefinition.ParameterUse src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case IN: return org.hl7.fhir.r5.model.ParameterDefinition.ParameterUse.IN; + case OUT: return org.hl7.fhir.r5.model.ParameterDefinition.ParameterUse.OUT; + default: return org.hl7.fhir.r5.model.ParameterDefinition.ParameterUse.NULL; + } + } + + public static org.hl7.fhir.r4.model.ParameterDefinition.ParameterUse convertParameterUse(org.hl7.fhir.r5.model.ParameterDefinition.ParameterUse src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case IN: return org.hl7.fhir.r4.model.ParameterDefinition.ParameterUse.IN; + case OUT: return org.hl7.fhir.r4.model.ParameterDefinition.ParameterUse.OUT; + default: return org.hl7.fhir.r4.model.ParameterDefinition.ParameterUse.NULL; + } + } + + public static org.hl7.fhir.r5.model.Period convertPeriod(org.hl7.fhir.r4.model.Period src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Period tgt = new org.hl7.fhir.r5.model.Period(); + copyElement(src, tgt); + if (src.hasStart()) + tgt.setStartElement(convertDateTime(src.getStartElement())); + if (src.hasEnd()) + tgt.setEndElement(convertDateTime(src.getEndElement())); + return tgt; + } + + public static org.hl7.fhir.r4.model.Period convertPeriod(org.hl7.fhir.r5.model.Period src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Period tgt = new org.hl7.fhir.r4.model.Period(); + copyElement(src, tgt); + if (src.hasStart()) + tgt.setStartElement(convertDateTime(src.getStartElement())); + if (src.hasEnd()) + tgt.setEndElement(convertDateTime(src.getEndElement())); + return tgt; + } + + public static org.hl7.fhir.r5.model.Population convertPopulation(org.hl7.fhir.r4.model.Population src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Population tgt = new org.hl7.fhir.r5.model.Population(); + copyBackboneElement(src, tgt); + if (src.hasAge()) + tgt.setAge(convertType(src.getAge())); + if (src.hasGender()) + tgt.setGender(convertCodeableConcept(src.getGender())); + if (src.hasRace()) + tgt.setRace(convertCodeableConcept(src.getRace())); + if (src.hasPhysiologicalCondition()) + tgt.setPhysiologicalCondition(convertCodeableConcept(src.getPhysiologicalCondition())); + return tgt; + } + + public static org.hl7.fhir.r4.model.Population convertPopulation(org.hl7.fhir.r5.model.Population src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Population tgt = new org.hl7.fhir.r4.model.Population(); + copyBackboneElement(src, tgt); + if (src.hasAge()) + tgt.setAge(convertType(src.getAge())); + if (src.hasGender()) + tgt.setGender(convertCodeableConcept(src.getGender())); + if (src.hasRace()) + tgt.setRace(convertCodeableConcept(src.getRace())); + if (src.hasPhysiologicalCondition()) + tgt.setPhysiologicalCondition(convertCodeableConcept(src.getPhysiologicalCondition())); + return tgt; + } + + public static org.hl7.fhir.r5.model.ProdCharacteristic convertProdCharacteristic(org.hl7.fhir.r4.model.ProdCharacteristic src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ProdCharacteristic tgt = new org.hl7.fhir.r5.model.ProdCharacteristic(); + copyBackboneElement(src, tgt); + if (src.hasHeight()) + tgt.setHeight(convertQuantity(src.getHeight())); + if (src.hasWidth()) + tgt.setWidth(convertQuantity(src.getWidth())); + if (src.hasDepth()) + tgt.setDepth(convertQuantity(src.getDepth())); + if (src.hasWeight()) + tgt.setWeight(convertQuantity(src.getWeight())); + if (src.hasNominalVolume()) + tgt.setNominalVolume(convertQuantity(src.getNominalVolume())); + if (src.hasExternalDiameter()) + tgt.setExternalDiameter(convertQuantity(src.getExternalDiameter())); + if (src.hasShape()) + tgt.setShapeElement(convertString(src.getShapeElement())); + for (org.hl7.fhir.r4.model.StringType t : src.getColor()) + tgt.getColor().add(convertString(t)); + for (org.hl7.fhir.r4.model.StringType t : src.getImprint()) + tgt.getImprint().add(convertString(t)); + for (org.hl7.fhir.r4.model.Attachment t : src.getImage()) + tgt.addImage(convertAttachment(t)); + if (src.hasScoring()) + tgt.setScoring(convertCodeableConcept(src.getScoring())); + return tgt; + } + + public static org.hl7.fhir.r4.model.ProdCharacteristic convertProdCharacteristic(org.hl7.fhir.r5.model.ProdCharacteristic src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.ProdCharacteristic tgt = new org.hl7.fhir.r4.model.ProdCharacteristic(); + copyBackboneElement(src, tgt); + if (src.hasHeight()) + tgt.setHeight(convertQuantity(src.getHeight())); + if (src.hasWidth()) + tgt.setWidth(convertQuantity(src.getWidth())); + if (src.hasDepth()) + tgt.setDepth(convertQuantity(src.getDepth())); + if (src.hasWeight()) + tgt.setWeight(convertQuantity(src.getWeight())); + if (src.hasNominalVolume()) + tgt.setNominalVolume(convertQuantity(src.getNominalVolume())); + if (src.hasExternalDiameter()) + tgt.setExternalDiameter(convertQuantity(src.getExternalDiameter())); + if (src.hasShape()) + tgt.setShapeElement(convertString(src.getShapeElement())); + for (org.hl7.fhir.r5.model.StringType t : src.getColor()) + tgt.getColor().add(convertString(t)); + for (org.hl7.fhir.r5.model.StringType t : src.getImprint()) + tgt.getImprint().add(convertString(t)); + for (org.hl7.fhir.r5.model.Attachment t : src.getImage()) + tgt.addImage(convertAttachment(t)); + if (src.hasScoring()) + tgt.setScoring(convertCodeableConcept(src.getScoring())); + return tgt; + } + + public static org.hl7.fhir.r5.model.ProductShelfLife convertProductShelfLife(org.hl7.fhir.r4.model.ProductShelfLife src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ProductShelfLife tgt = new org.hl7.fhir.r5.model.ProductShelfLife(); + copyBackboneElement(src, tgt); + if (src.hasIdentifier()) + tgt.setIdentifier(convertIdentifier(src.getIdentifier())); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + if (src.hasPeriod()) + tgt.setPeriod(convertQuantity(src.getPeriod())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getSpecialPrecautionsForStorage()) + tgt.addSpecialPrecautionsForStorage(convertCodeableConcept(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.ProductShelfLife convertProductShelfLife(org.hl7.fhir.r5.model.ProductShelfLife src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.ProductShelfLife tgt = new org.hl7.fhir.r4.model.ProductShelfLife(); + copyBackboneElement(src, tgt); + if (src.hasIdentifier()) + tgt.setIdentifier(convertIdentifier(src.getIdentifier())); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + if (src.hasPeriod()) + tgt.setPeriod(convertQuantity(src.getPeriod())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getSpecialPrecautionsForStorage()) + tgt.addSpecialPrecautionsForStorage(convertCodeableConcept(t)); + return tgt; + } + + public static void copyQuantity(org.hl7.fhir.r4.model.Quantity src, org.hl7.fhir.r5.model.Quantity tgt) throws FHIRException { + if (src == null || tgt == null) + return; + copyElement(src, tgt); + if (src.hasValue()) + tgt.setValue(src.getValue()); + if (src.hasComparator()) + tgt.setComparator(convertQuantityComparator(src.getComparator())); + if (src.hasUnit()) + tgt.setUnit(src.getUnit()); + if (src.hasSystem()) + tgt.setSystem(src.getSystem()); + if (src.hasCode()) + tgt.setCode(src.getCode()); + } + + public static void copyQuantity(org.hl7.fhir.r5.model.Quantity src, org.hl7.fhir.r4.model.Quantity tgt) throws FHIRException { + if (src == null || tgt == null) + return; + copyElement(src, tgt); + if (src.hasValue()) + tgt.setValue(src.getValue()); + if (src.hasComparator()) + tgt.setComparator(convertQuantityComparator(src.getComparator())); + if (src.hasUnit()) + tgt.setUnit(src.getUnit()); + if (src.hasSystem()) + tgt.setSystem(src.getSystem()); + if (src.hasCode()) + tgt.setCode(src.getCode()); + } + + public static org.hl7.fhir.r5.model.Quantity convertQuantity(org.hl7.fhir.r4.model.Quantity src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Quantity tgt = new org.hl7.fhir.r5.model.Quantity(); + copyElement(src, tgt); + if (src.hasValue()) + tgt.setValueElement(convertDecimal(src.getValueElement())); + if (src.hasComparator()) + tgt.setComparator(convertQuantityComparator(src.getComparator())); + if (src.hasUnit()) + tgt.setUnitElement(convertString(src.getUnitElement())); + if (src.hasSystem()) + tgt.setSystemElement(convertUri(src.getSystemElement())); + if (src.hasCode()) + tgt.setCodeElement(convertCode(src.getCodeElement())); + return tgt; + } + + public static org.hl7.fhir.r4.model.Quantity convertQuantity(org.hl7.fhir.r5.model.Quantity src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Quantity tgt = new org.hl7.fhir.r4.model.Quantity(); + copyElement(src, tgt); + if (src.hasValue()) + tgt.setValueElement(convertDecimal(src.getValueElement())); + if (src.hasComparator()) + tgt.setComparator(convertQuantityComparator(src.getComparator())); + if (src.hasUnit()) + tgt.setUnitElement(convertString(src.getUnitElement())); + if (src.hasSystem()) + tgt.setSystemElement(convertUri(src.getSystemElement())); + if (src.hasCode()) + tgt.setCodeElement(convertCode(src.getCodeElement())); + return tgt; + } + + public static org.hl7.fhir.r5.model.Quantity.QuantityComparator convertQuantityComparator(org.hl7.fhir.r4.model.Quantity.QuantityComparator src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case LESS_THAN: return org.hl7.fhir.r5.model.Quantity.QuantityComparator.LESS_THAN; + case LESS_OR_EQUAL: return org.hl7.fhir.r5.model.Quantity.QuantityComparator.LESS_OR_EQUAL; + case GREATER_OR_EQUAL: return org.hl7.fhir.r5.model.Quantity.QuantityComparator.GREATER_OR_EQUAL; + case GREATER_THAN: return org.hl7.fhir.r5.model.Quantity.QuantityComparator.GREATER_THAN; + default: return org.hl7.fhir.r5.model.Quantity.QuantityComparator.NULL; + } + } + + public static org.hl7.fhir.r4.model.Quantity.QuantityComparator convertQuantityComparator(org.hl7.fhir.r5.model.Quantity.QuantityComparator src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case LESS_THAN: return org.hl7.fhir.r4.model.Quantity.QuantityComparator.LESS_THAN; + case LESS_OR_EQUAL: return org.hl7.fhir.r4.model.Quantity.QuantityComparator.LESS_OR_EQUAL; + case GREATER_OR_EQUAL: return org.hl7.fhir.r4.model.Quantity.QuantityComparator.GREATER_OR_EQUAL; + case GREATER_THAN: return org.hl7.fhir.r4.model.Quantity.QuantityComparator.GREATER_THAN; + default: return org.hl7.fhir.r4.model.Quantity.QuantityComparator.NULL; + } + } + + public static org.hl7.fhir.r5.model.Range convertRange(org.hl7.fhir.r4.model.Range src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Range tgt = new org.hl7.fhir.r5.model.Range(); + copyElement(src, tgt); + if (src.hasLow()) + tgt.setLow(convertSimpleQuantity(src.getLow())); + if (src.hasHigh()) + tgt.setHigh(convertSimpleQuantity(src.getHigh())); + return tgt; + } + + public static org.hl7.fhir.r4.model.Range convertRange(org.hl7.fhir.r5.model.Range src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Range tgt = new org.hl7.fhir.r4.model.Range(); + copyElement(src, tgt); + if (src.hasLow()) + tgt.setLow(convertSimpleQuantity(src.getLow())); + if (src.hasHigh()) + tgt.setHigh(convertSimpleQuantity(src.getHigh())); + return tgt; + } + + public static org.hl7.fhir.r5.model.Ratio convertRatio(org.hl7.fhir.r4.model.Ratio src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Ratio tgt = new org.hl7.fhir.r5.model.Ratio(); + copyElement(src, tgt); + if (src.hasNumerator()) + tgt.setNumerator(convertQuantity(src.getNumerator())); + if (src.hasDenominator()) + tgt.setDenominator(convertQuantity(src.getDenominator())); + return tgt; + } + + public static org.hl7.fhir.r4.model.Ratio convertRatio(org.hl7.fhir.r5.model.Ratio src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Ratio tgt = new org.hl7.fhir.r4.model.Ratio(); + copyElement(src, tgt); + if (src.hasNumerator()) + tgt.setNumerator(convertQuantity(src.getNumerator())); + if (src.hasDenominator()) + tgt.setDenominator(convertQuantity(src.getDenominator())); + return tgt; + } + + public static org.hl7.fhir.r5.model.Reference convertReference(org.hl7.fhir.r4.model.Reference src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Reference tgt = new org.hl7.fhir.r5.model.Reference(); + copyElement(src, tgt); + if (src.hasReference()) + tgt.setReferenceElement(convertString(src.getReferenceElement_())); + if (src.hasType()) + tgt.setTypeElement(convertUri(src.getTypeElement())); + if (src.hasIdentifier()) + tgt.setIdentifier(convertIdentifier(src.getIdentifier())); + if (src.hasDisplay()) + tgt.setDisplayElement(convertString(src.getDisplayElement())); + return tgt; + } + + public static org.hl7.fhir.r4.model.Reference convertReference(org.hl7.fhir.r5.model.Reference src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Reference tgt = new org.hl7.fhir.r4.model.Reference(); + copyElement(src, tgt); + if (src.hasReference()) + tgt.setReferenceElement(convertString(src.getReferenceElement_())); + if (src.hasType()) + tgt.setTypeElement(convertUri(src.getTypeElement())); + if (src.hasIdentifier()) + tgt.setIdentifier(convertIdentifier(src.getIdentifier())); + if (src.hasDisplay()) + tgt.setDisplayElement(convertString(src.getDisplayElement())); + return tgt; + } + + public static org.hl7.fhir.r5.model.RelatedArtifact convertRelatedArtifact(org.hl7.fhir.r4.model.RelatedArtifact src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.RelatedArtifact tgt = new org.hl7.fhir.r5.model.RelatedArtifact(); + copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertRelatedArtifactType(src.getType())); + if (src.hasLabel()) + tgt.setLabelElement(convertString(src.getLabelElement())); + if (src.hasDisplay()) + tgt.setDisplayElement(convertString(src.getDisplayElement())); + if (src.hasCitation()) + tgt.setCitationElement(convertMarkdown(src.getCitationElement())); + if (src.hasUrl()) + tgt.setUrlElement(convertUrl(src.getUrlElement())); + if (src.hasDocument()) + tgt.setDocument(convertAttachment(src.getDocument())); + if (src.hasResource()) + tgt.setResourceElement(convertCanonical(src.getResourceElement())); + return tgt; + } + + public static org.hl7.fhir.r4.model.RelatedArtifact convertRelatedArtifact(org.hl7.fhir.r5.model.RelatedArtifact src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.RelatedArtifact tgt = new org.hl7.fhir.r4.model.RelatedArtifact(); + copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertRelatedArtifactType(src.getType())); + if (src.hasLabel()) + tgt.setLabelElement(convertString(src.getLabelElement())); + if (src.hasDisplay()) + tgt.setDisplayElement(convertString(src.getDisplayElement())); + if (src.hasCitation()) + tgt.setCitationElement(convertMarkdown(src.getCitationElement())); + if (src.hasUrl()) + tgt.setUrlElement(convertUrl(src.getUrlElement())); + if (src.hasDocument()) + tgt.setDocument(convertAttachment(src.getDocument())); + if (src.hasResource()) + tgt.setResourceElement(convertCanonical(src.getResourceElement())); + return tgt; + } + + public static org.hl7.fhir.r5.model.RelatedArtifact.RelatedArtifactType convertRelatedArtifactType(org.hl7.fhir.r4.model.RelatedArtifact.RelatedArtifactType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case DOCUMENTATION: return org.hl7.fhir.r5.model.RelatedArtifact.RelatedArtifactType.DOCUMENTATION; + case JUSTIFICATION: return org.hl7.fhir.r5.model.RelatedArtifact.RelatedArtifactType.JUSTIFICATION; + case CITATION: return org.hl7.fhir.r5.model.RelatedArtifact.RelatedArtifactType.CITATION; + case PREDECESSOR: return org.hl7.fhir.r5.model.RelatedArtifact.RelatedArtifactType.PREDECESSOR; + case SUCCESSOR: return org.hl7.fhir.r5.model.RelatedArtifact.RelatedArtifactType.SUCCESSOR; + case DERIVEDFROM: return org.hl7.fhir.r5.model.RelatedArtifact.RelatedArtifactType.DERIVEDFROM; + case DEPENDSON: return org.hl7.fhir.r5.model.RelatedArtifact.RelatedArtifactType.DEPENDSON; + case COMPOSEDOF: return org.hl7.fhir.r5.model.RelatedArtifact.RelatedArtifactType.COMPOSEDOF; + default: return org.hl7.fhir.r5.model.RelatedArtifact.RelatedArtifactType.NULL; + } + } + + public static org.hl7.fhir.r4.model.RelatedArtifact.RelatedArtifactType convertRelatedArtifactType(org.hl7.fhir.r5.model.RelatedArtifact.RelatedArtifactType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case DOCUMENTATION: return org.hl7.fhir.r4.model.RelatedArtifact.RelatedArtifactType.DOCUMENTATION; + case JUSTIFICATION: return org.hl7.fhir.r4.model.RelatedArtifact.RelatedArtifactType.JUSTIFICATION; + case CITATION: return org.hl7.fhir.r4.model.RelatedArtifact.RelatedArtifactType.CITATION; + case PREDECESSOR: return org.hl7.fhir.r4.model.RelatedArtifact.RelatedArtifactType.PREDECESSOR; + case SUCCESSOR: return org.hl7.fhir.r4.model.RelatedArtifact.RelatedArtifactType.SUCCESSOR; + case DERIVEDFROM: return org.hl7.fhir.r4.model.RelatedArtifact.RelatedArtifactType.DERIVEDFROM; + case DEPENDSON: return org.hl7.fhir.r4.model.RelatedArtifact.RelatedArtifactType.DEPENDSON; + case COMPOSEDOF: return org.hl7.fhir.r4.model.RelatedArtifact.RelatedArtifactType.COMPOSEDOF; + default: return org.hl7.fhir.r4.model.RelatedArtifact.RelatedArtifactType.NULL; + } + } + + public static org.hl7.fhir.r5.model.SampledData convertSampledData(org.hl7.fhir.r4.model.SampledData src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.SampledData tgt = new org.hl7.fhir.r5.model.SampledData(); + copyElement(src, tgt); + if (src.hasOrigin()) + tgt.setOrigin(convertSimpleQuantity(src.getOrigin())); + if (src.hasPeriod()) + tgt.setPeriodElement(convertDecimal(src.getPeriodElement())); + if (src.hasFactor()) + tgt.setFactorElement(convertDecimal(src.getFactorElement())); + if (src.hasLowerLimit()) + tgt.setLowerLimitElement(convertDecimal(src.getLowerLimitElement())); + if (src.hasUpperLimit()) + tgt.setUpperLimitElement(convertDecimal(src.getUpperLimitElement())); + if (src.hasDimensions()) + tgt.setDimensionsElement(convertPositiveInt(src.getDimensionsElement())); + if (src.hasData()) + tgt.setDataElement(convertString(src.getDataElement())); + return tgt; + } + + public static org.hl7.fhir.r4.model.SampledData convertSampledData(org.hl7.fhir.r5.model.SampledData src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.SampledData tgt = new org.hl7.fhir.r4.model.SampledData(); + copyElement(src, tgt); + if (src.hasOrigin()) + tgt.setOrigin(convertSimpleQuantity(src.getOrigin())); + if (src.hasPeriod()) + tgt.setPeriodElement(convertDecimal(src.getPeriodElement())); + if (src.hasFactor()) + tgt.setFactorElement(convertDecimal(src.getFactorElement())); + if (src.hasLowerLimit()) + tgt.setLowerLimitElement(convertDecimal(src.getLowerLimitElement())); + if (src.hasUpperLimit()) + tgt.setUpperLimitElement(convertDecimal(src.getUpperLimitElement())); + if (src.hasDimensions()) + tgt.setDimensionsElement(convertPositiveInt(src.getDimensionsElement())); + if (src.hasData()) + tgt.setDataElement(convertString(src.getDataElement())); + return tgt; + } + + public static org.hl7.fhir.r5.model.Signature convertSignature(org.hl7.fhir.r4.model.Signature src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Signature tgt = new org.hl7.fhir.r5.model.Signature(); + copyElement(src, tgt); + for (org.hl7.fhir.r4.model.Coding t : src.getType()) + tgt.addType(convertCoding(t)); + if (src.hasWhen()) + tgt.setWhenElement(convertInstant(src.getWhenElement())); + if (src.hasWho()) + tgt.setWho(convertReference(src.getWho())); + if (src.hasOnBehalfOf()) + tgt.setOnBehalfOf(convertReference(src.getOnBehalfOf())); + if (src.hasTargetFormat()) + tgt.setTargetFormatElement(convertCode(src.getTargetFormatElement())); + if (src.hasSigFormat()) + tgt.setSigFormatElement(convertCode(src.getSigFormatElement())); + if (src.hasData()) + tgt.setDataElement(convertBase64Binary(src.getDataElement())); + return tgt; + } + + public static org.hl7.fhir.r4.model.Signature convertSignature(org.hl7.fhir.r5.model.Signature src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Signature tgt = new org.hl7.fhir.r4.model.Signature(); + copyElement(src, tgt); + for (org.hl7.fhir.r5.model.Coding t : src.getType()) + tgt.addType(convertCoding(t)); + if (src.hasWhen()) + tgt.setWhenElement(convertInstant(src.getWhenElement())); + if (src.hasWho()) + tgt.setWho(convertReference(src.getWho())); + if (src.hasOnBehalfOf()) + tgt.setOnBehalfOf(convertReference(src.getOnBehalfOf())); + if (src.hasTargetFormat()) + tgt.setTargetFormatElement(convertCode(src.getTargetFormatElement())); + if (src.hasSigFormat()) + tgt.setSigFormatElement(convertCode(src.getSigFormatElement())); + if (src.hasData()) + tgt.setDataElement(convertBase64Binary(src.getDataElement())); + return tgt; + } + + public static org.hl7.fhir.r5.model.SubstanceAmount convertSubstanceAmount(org.hl7.fhir.r4.model.SubstanceAmount src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.SubstanceAmount tgt = new org.hl7.fhir.r5.model.SubstanceAmount(); + copyBackboneElement(src, tgt); + if (src.hasAmount()) + tgt.setAmount(convertType(src.getAmount())); + if (src.hasAmountType()) + tgt.setAmountType(convertCodeableConcept(src.getAmountType())); + if (src.hasAmountText()) + tgt.setAmountTextElement(convertString(src.getAmountTextElement())); + if (src.hasReferenceRange()) + tgt.setReferenceRange(convertSubstanceAmountReferenceRangeComponent(src.getReferenceRange())); + return tgt; + } + + public static org.hl7.fhir.r4.model.SubstanceAmount convertSubstanceAmount(org.hl7.fhir.r5.model.SubstanceAmount src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.SubstanceAmount tgt = new org.hl7.fhir.r4.model.SubstanceAmount(); + copyBackboneElement(src, tgt); + if (src.hasAmount()) + tgt.setAmount(convertType(src.getAmount())); + if (src.hasAmountType()) + tgt.setAmountType(convertCodeableConcept(src.getAmountType())); + if (src.hasAmountText()) + tgt.setAmountTextElement(convertString(src.getAmountTextElement())); + if (src.hasReferenceRange()) + tgt.setReferenceRange(convertSubstanceAmountReferenceRangeComponent(src.getReferenceRange())); + return tgt; + } + + public static org.hl7.fhir.r5.model.SubstanceAmount.SubstanceAmountReferenceRangeComponent convertSubstanceAmountReferenceRangeComponent(org.hl7.fhir.r4.model.SubstanceAmount.SubstanceAmountReferenceRangeComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.SubstanceAmount.SubstanceAmountReferenceRangeComponent tgt = new org.hl7.fhir.r5.model.SubstanceAmount.SubstanceAmountReferenceRangeComponent(); + copyElement(src, tgt); + if (src.hasLowLimit()) + tgt.setLowLimit(convertQuantity(src.getLowLimit())); + if (src.hasHighLimit()) + tgt.setHighLimit(convertQuantity(src.getHighLimit())); + return tgt; + } + + public static org.hl7.fhir.r4.model.SubstanceAmount.SubstanceAmountReferenceRangeComponent convertSubstanceAmountReferenceRangeComponent(org.hl7.fhir.r5.model.SubstanceAmount.SubstanceAmountReferenceRangeComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.SubstanceAmount.SubstanceAmountReferenceRangeComponent tgt = new org.hl7.fhir.r4.model.SubstanceAmount.SubstanceAmountReferenceRangeComponent(); + copyElement(src, tgt); + if (src.hasLowLimit()) + tgt.setLowLimit(convertQuantity(src.getLowLimit())); + if (src.hasHighLimit()) + tgt.setHighLimit(convertQuantity(src.getHighLimit())); + return tgt; + } + + public static org.hl7.fhir.r5.model.Timing convertTiming(org.hl7.fhir.r4.model.Timing src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Timing tgt = new org.hl7.fhir.r5.model.Timing(); + copyBackboneElement(src, tgt); + for (org.hl7.fhir.r4.model.DateTimeType t : src.getEvent()) + tgt.getEvent().add(convertDateTime(t)); + if (src.hasRepeat()) + tgt.setRepeat(convertTimingRepeatComponent(src.getRepeat())); + if (src.hasCode()) + tgt.setCode(convertCodeableConcept(src.getCode())); + return tgt; + } + + public static org.hl7.fhir.r4.model.Timing convertTiming(org.hl7.fhir.r5.model.Timing src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Timing tgt = new org.hl7.fhir.r4.model.Timing(); + copyBackboneElement(src, tgt); + for (org.hl7.fhir.r5.model.DateTimeType t : src.getEvent()) + tgt.getEvent().add(convertDateTime(t)); + if (src.hasRepeat()) + tgt.setRepeat(convertTimingRepeatComponent(src.getRepeat())); + if (src.hasCode()) + tgt.setCode(convertCodeableConcept(src.getCode())); + return tgt; + } + + public static org.hl7.fhir.r5.model.Timing.TimingRepeatComponent convertTimingRepeatComponent(org.hl7.fhir.r4.model.Timing.TimingRepeatComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Timing.TimingRepeatComponent tgt = new org.hl7.fhir.r5.model.Timing.TimingRepeatComponent(); + copyElement(src, tgt); + if (src.hasBounds()) + tgt.setBounds(convertType(src.getBounds())); + if (src.hasCount()) + tgt.setCountElement(convertPositiveInt(src.getCountElement())); + if (src.hasCountMax()) + tgt.setCountMaxElement(convertPositiveInt(src.getCountMaxElement())); + if (src.hasDuration()) + tgt.setDurationElement(convertDecimal(src.getDurationElement())); + if (src.hasDurationMax()) + tgt.setDurationMaxElement(convertDecimal(src.getDurationMaxElement())); + if (src.hasDurationUnit()) + tgt.setDurationUnit(convertUnitsOfTime(src.getDurationUnit())); + if (src.hasFrequency()) + tgt.setFrequencyElement(convertPositiveInt(src.getFrequencyElement())); + if (src.hasFrequencyMax()) + tgt.setFrequencyMaxElement(convertPositiveInt(src.getFrequencyMaxElement())); + if (src.hasPeriod()) + tgt.setPeriodElement(convertDecimal(src.getPeriodElement())); + if (src.hasPeriodMax()) + tgt.setPeriodMaxElement(convertDecimal(src.getPeriodMaxElement())); + if (src.hasPeriodUnit()) + tgt.setPeriodUnit(convertUnitsOfTime(src.getPeriodUnit())); + for (org.hl7.fhir.r4.model.Enumeration t : src.getDayOfWeek()) + tgt.addDayOfWeek(convertDayOfWeek(t.getValue())); + for (org.hl7.fhir.r4.model.TimeType t : src.getTimeOfDay()) + tgt.getTimeOfDay().add(convertTime(t)); + for (org.hl7.fhir.r4.model.Enumeration t : src.getWhen()) + tgt.addWhen(convertEventTiming(t.getValue())); + if (src.hasOffset()) + tgt.setOffsetElement(convertUnsignedInt(src.getOffsetElement())); + return tgt; + } + + public static org.hl7.fhir.r4.model.Timing.TimingRepeatComponent convertTimingRepeatComponent(org.hl7.fhir.r5.model.Timing.TimingRepeatComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Timing.TimingRepeatComponent tgt = new org.hl7.fhir.r4.model.Timing.TimingRepeatComponent(); + copyElement(src, tgt); + if (src.hasBounds()) + tgt.setBounds(convertType(src.getBounds())); + if (src.hasCount()) + tgt.setCountElement(convertPositiveInt(src.getCountElement())); + if (src.hasCountMax()) + tgt.setCountMaxElement(convertPositiveInt(src.getCountMaxElement())); + if (src.hasDuration()) + tgt.setDurationElement(convertDecimal(src.getDurationElement())); + if (src.hasDurationMax()) + tgt.setDurationMaxElement(convertDecimal(src.getDurationMaxElement())); + if (src.hasDurationUnit()) + tgt.setDurationUnit(convertUnitsOfTime(src.getDurationUnit())); + if (src.hasFrequency()) + tgt.setFrequencyElement(convertPositiveInt(src.getFrequencyElement())); + if (src.hasFrequencyMax()) + tgt.setFrequencyMaxElement(convertPositiveInt(src.getFrequencyMaxElement())); + if (src.hasPeriod()) + tgt.setPeriodElement(convertDecimal(src.getPeriodElement())); + if (src.hasPeriodMax()) + tgt.setPeriodMaxElement(convertDecimal(src.getPeriodMaxElement())); + if (src.hasPeriodUnit()) + tgt.setPeriodUnit(convertUnitsOfTime(src.getPeriodUnit())); + for (org.hl7.fhir.r5.model.Enumeration t : src.getDayOfWeek()) + tgt.addDayOfWeek(convertDayOfWeek(t.getValue())); + for (org.hl7.fhir.r5.model.TimeType t : src.getTimeOfDay()) + tgt.getTimeOfDay().add(convertTime(t)); + for (org.hl7.fhir.r5.model.Enumeration t : src.getWhen()) + tgt.addWhen(convertEventTiming(t.getValue())); + if (src.hasOffset()) + tgt.setOffsetElement(convertUnsignedInt(src.getOffsetElement())); + return tgt; + } + + public static org.hl7.fhir.r5.model.Timing.UnitsOfTime convertUnitsOfTime(org.hl7.fhir.r4.model.Timing.UnitsOfTime src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case S: return org.hl7.fhir.r5.model.Timing.UnitsOfTime.S; + case MIN: return org.hl7.fhir.r5.model.Timing.UnitsOfTime.MIN; + case H: return org.hl7.fhir.r5.model.Timing.UnitsOfTime.H; + case D: return org.hl7.fhir.r5.model.Timing.UnitsOfTime.D; + case WK: return org.hl7.fhir.r5.model.Timing.UnitsOfTime.WK; + case MO: return org.hl7.fhir.r5.model.Timing.UnitsOfTime.MO; + case A: return org.hl7.fhir.r5.model.Timing.UnitsOfTime.A; + default: return org.hl7.fhir.r5.model.Timing.UnitsOfTime.NULL; + } + } + + public static org.hl7.fhir.r4.model.Timing.UnitsOfTime convertUnitsOfTime(org.hl7.fhir.r5.model.Timing.UnitsOfTime src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case S: return org.hl7.fhir.r4.model.Timing.UnitsOfTime.S; + case MIN: return org.hl7.fhir.r4.model.Timing.UnitsOfTime.MIN; + case H: return org.hl7.fhir.r4.model.Timing.UnitsOfTime.H; + case D: return org.hl7.fhir.r4.model.Timing.UnitsOfTime.D; + case WK: return org.hl7.fhir.r4.model.Timing.UnitsOfTime.WK; + case MO: return org.hl7.fhir.r4.model.Timing.UnitsOfTime.MO; + case A: return org.hl7.fhir.r4.model.Timing.UnitsOfTime.A; + default: return org.hl7.fhir.r4.model.Timing.UnitsOfTime.NULL; + } + } + + public static org.hl7.fhir.r5.model.Timing.DayOfWeek convertDayOfWeek(org.hl7.fhir.r4.model.Timing.DayOfWeek src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case MON: return org.hl7.fhir.r5.model.Timing.DayOfWeek.MON; + case TUE: return org.hl7.fhir.r5.model.Timing.DayOfWeek.TUE; + case WED: return org.hl7.fhir.r5.model.Timing.DayOfWeek.WED; + case THU: return org.hl7.fhir.r5.model.Timing.DayOfWeek.THU; + case FRI: return org.hl7.fhir.r5.model.Timing.DayOfWeek.FRI; + case SAT: return org.hl7.fhir.r5.model.Timing.DayOfWeek.SAT; + case SUN: return org.hl7.fhir.r5.model.Timing.DayOfWeek.SUN; + default: return org.hl7.fhir.r5.model.Timing.DayOfWeek.NULL; + } + } + + public static org.hl7.fhir.r4.model.Timing.DayOfWeek convertDayOfWeek(org.hl7.fhir.r5.model.Timing.DayOfWeek src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case MON: return org.hl7.fhir.r4.model.Timing.DayOfWeek.MON; + case TUE: return org.hl7.fhir.r4.model.Timing.DayOfWeek.TUE; + case WED: return org.hl7.fhir.r4.model.Timing.DayOfWeek.WED; + case THU: return org.hl7.fhir.r4.model.Timing.DayOfWeek.THU; + case FRI: return org.hl7.fhir.r4.model.Timing.DayOfWeek.FRI; + case SAT: return org.hl7.fhir.r4.model.Timing.DayOfWeek.SAT; + case SUN: return org.hl7.fhir.r4.model.Timing.DayOfWeek.SUN; + default: return org.hl7.fhir.r4.model.Timing.DayOfWeek.NULL; + } + } + + public static org.hl7.fhir.r5.model.Timing.EventTiming convertEventTiming(org.hl7.fhir.r4.model.Timing.EventTiming src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case MORN: return org.hl7.fhir.r5.model.Timing.EventTiming.MORN; + case MORN_EARLY: return org.hl7.fhir.r5.model.Timing.EventTiming.MORN_EARLY; + case MORN_LATE: return org.hl7.fhir.r5.model.Timing.EventTiming.MORN_LATE; + case NOON: return org.hl7.fhir.r5.model.Timing.EventTiming.NOON; + case AFT: return org.hl7.fhir.r5.model.Timing.EventTiming.AFT; + case AFT_EARLY: return org.hl7.fhir.r5.model.Timing.EventTiming.AFT_EARLY; + case AFT_LATE: return org.hl7.fhir.r5.model.Timing.EventTiming.AFT_LATE; + case EVE: return org.hl7.fhir.r5.model.Timing.EventTiming.EVE; + case EVE_EARLY: return org.hl7.fhir.r5.model.Timing.EventTiming.EVE_EARLY; + case EVE_LATE: return org.hl7.fhir.r5.model.Timing.EventTiming.EVE_LATE; + case NIGHT: return org.hl7.fhir.r5.model.Timing.EventTiming.NIGHT; + case PHS: return org.hl7.fhir.r5.model.Timing.EventTiming.PHS; + case HS: return org.hl7.fhir.r5.model.Timing.EventTiming.HS; + case WAKE: return org.hl7.fhir.r5.model.Timing.EventTiming.WAKE; + case C: return org.hl7.fhir.r5.model.Timing.EventTiming.C; + case CM: return org.hl7.fhir.r5.model.Timing.EventTiming.CM; + case CD: return org.hl7.fhir.r5.model.Timing.EventTiming.CD; + case CV: return org.hl7.fhir.r5.model.Timing.EventTiming.CV; + case AC: return org.hl7.fhir.r5.model.Timing.EventTiming.AC; + case ACM: return org.hl7.fhir.r5.model.Timing.EventTiming.ACM; + case ACD: return org.hl7.fhir.r5.model.Timing.EventTiming.ACD; + case ACV: return org.hl7.fhir.r5.model.Timing.EventTiming.ACV; + case PC: return org.hl7.fhir.r5.model.Timing.EventTiming.PC; + case PCM: return org.hl7.fhir.r5.model.Timing.EventTiming.PCM; + case PCD: return org.hl7.fhir.r5.model.Timing.EventTiming.PCD; + case PCV: return org.hl7.fhir.r5.model.Timing.EventTiming.PCV; + default: return org.hl7.fhir.r5.model.Timing.EventTiming.NULL; + } + } + + public static org.hl7.fhir.r4.model.Timing.EventTiming convertEventTiming(org.hl7.fhir.r5.model.Timing.EventTiming src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case MORN: return org.hl7.fhir.r4.model.Timing.EventTiming.MORN; + case MORN_EARLY: return org.hl7.fhir.r4.model.Timing.EventTiming.MORN_EARLY; + case MORN_LATE: return org.hl7.fhir.r4.model.Timing.EventTiming.MORN_LATE; + case NOON: return org.hl7.fhir.r4.model.Timing.EventTiming.NOON; + case AFT: return org.hl7.fhir.r4.model.Timing.EventTiming.AFT; + case AFT_EARLY: return org.hl7.fhir.r4.model.Timing.EventTiming.AFT_EARLY; + case AFT_LATE: return org.hl7.fhir.r4.model.Timing.EventTiming.AFT_LATE; + case EVE: return org.hl7.fhir.r4.model.Timing.EventTiming.EVE; + case EVE_EARLY: return org.hl7.fhir.r4.model.Timing.EventTiming.EVE_EARLY; + case EVE_LATE: return org.hl7.fhir.r4.model.Timing.EventTiming.EVE_LATE; + case NIGHT: return org.hl7.fhir.r4.model.Timing.EventTiming.NIGHT; + case PHS: return org.hl7.fhir.r4.model.Timing.EventTiming.PHS; + case HS: return org.hl7.fhir.r4.model.Timing.EventTiming.HS; + case WAKE: return org.hl7.fhir.r4.model.Timing.EventTiming.WAKE; + case C: return org.hl7.fhir.r4.model.Timing.EventTiming.C; + case CM: return org.hl7.fhir.r4.model.Timing.EventTiming.CM; + case CD: return org.hl7.fhir.r4.model.Timing.EventTiming.CD; + case CV: return org.hl7.fhir.r4.model.Timing.EventTiming.CV; + case AC: return org.hl7.fhir.r4.model.Timing.EventTiming.AC; + case ACM: return org.hl7.fhir.r4.model.Timing.EventTiming.ACM; + case ACD: return org.hl7.fhir.r4.model.Timing.EventTiming.ACD; + case ACV: return org.hl7.fhir.r4.model.Timing.EventTiming.ACV; + case PC: return org.hl7.fhir.r4.model.Timing.EventTiming.PC; + case PCM: return org.hl7.fhir.r4.model.Timing.EventTiming.PCM; + case PCD: return org.hl7.fhir.r4.model.Timing.EventTiming.PCD; + case PCV: return org.hl7.fhir.r4.model.Timing.EventTiming.PCV; + default: return org.hl7.fhir.r4.model.Timing.EventTiming.NULL; + } + } + + public static org.hl7.fhir.r5.model.TriggerDefinition convertTriggerDefinition(org.hl7.fhir.r4.model.TriggerDefinition src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.TriggerDefinition tgt = new org.hl7.fhir.r5.model.TriggerDefinition(); + copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertTriggerType(src.getType())); + if (src.hasName()) + tgt.setNameElement(convertString(src.getNameElement())); + if (src.hasTiming()) + tgt.setTiming(convertType(src.getTiming())); + for (org.hl7.fhir.r4.model.DataRequirement t : src.getData()) + tgt.addData(convertDataRequirement(t)); + if (src.hasCondition()) + tgt.setCondition(convertExpression(src.getCondition())); + return tgt; + } + + public static org.hl7.fhir.r4.model.TriggerDefinition convertTriggerDefinition(org.hl7.fhir.r5.model.TriggerDefinition src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.TriggerDefinition tgt = new org.hl7.fhir.r4.model.TriggerDefinition(); + copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertTriggerType(src.getType())); + if (src.hasName()) + tgt.setNameElement(convertString(src.getNameElement())); + if (src.hasTiming()) + tgt.setTiming(convertType(src.getTiming())); + for (org.hl7.fhir.r5.model.DataRequirement t : src.getData()) + tgt.addData(convertDataRequirement(t)); + if (src.hasCondition()) + tgt.setCondition(convertExpression(src.getCondition())); + return tgt; + } + + public static org.hl7.fhir.r5.model.TriggerDefinition.TriggerType convertTriggerType(org.hl7.fhir.r4.model.TriggerDefinition.TriggerType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case NAMEDEVENT: return org.hl7.fhir.r5.model.TriggerDefinition.TriggerType.NAMEDEVENT; + case PERIODIC: return org.hl7.fhir.r5.model.TriggerDefinition.TriggerType.PERIODIC; + case DATACHANGED: return org.hl7.fhir.r5.model.TriggerDefinition.TriggerType.DATACHANGED; + case DATAADDED: return org.hl7.fhir.r5.model.TriggerDefinition.TriggerType.DATAADDED; + case DATAMODIFIED: return org.hl7.fhir.r5.model.TriggerDefinition.TriggerType.DATAMODIFIED; + case DATAREMOVED: return org.hl7.fhir.r5.model.TriggerDefinition.TriggerType.DATAREMOVED; + case DATAACCESSED: return org.hl7.fhir.r5.model.TriggerDefinition.TriggerType.DATAACCESSED; + case DATAACCESSENDED: return org.hl7.fhir.r5.model.TriggerDefinition.TriggerType.DATAACCESSENDED; + default: return org.hl7.fhir.r5.model.TriggerDefinition.TriggerType.NULL; + } + } + + public static org.hl7.fhir.r4.model.TriggerDefinition.TriggerType convertTriggerType(org.hl7.fhir.r5.model.TriggerDefinition.TriggerType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case NAMEDEVENT: return org.hl7.fhir.r4.model.TriggerDefinition.TriggerType.NAMEDEVENT; + case PERIODIC: return org.hl7.fhir.r4.model.TriggerDefinition.TriggerType.PERIODIC; + case DATACHANGED: return org.hl7.fhir.r4.model.TriggerDefinition.TriggerType.DATACHANGED; + case DATAADDED: return org.hl7.fhir.r4.model.TriggerDefinition.TriggerType.DATAADDED; + case DATAMODIFIED: return org.hl7.fhir.r4.model.TriggerDefinition.TriggerType.DATAMODIFIED; + case DATAREMOVED: return org.hl7.fhir.r4.model.TriggerDefinition.TriggerType.DATAREMOVED; + case DATAACCESSED: return org.hl7.fhir.r4.model.TriggerDefinition.TriggerType.DATAACCESSED; + case DATAACCESSENDED: return org.hl7.fhir.r4.model.TriggerDefinition.TriggerType.DATAACCESSENDED; + default: return org.hl7.fhir.r4.model.TriggerDefinition.TriggerType.NULL; + } + } + + public static org.hl7.fhir.r5.model.UsageContext convertUsageContext(org.hl7.fhir.r4.model.UsageContext src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.UsageContext tgt = new org.hl7.fhir.r5.model.UsageContext(); + copyElement(src, tgt); + if (src.hasCode()) + tgt.setCode(convertCoding(src.getCode())); + if (src.hasValue()) + tgt.setValue(convertType(src.getValue())); + return tgt; + } + + public static org.hl7.fhir.r4.model.UsageContext convertUsageContext(org.hl7.fhir.r5.model.UsageContext src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.UsageContext tgt = new org.hl7.fhir.r4.model.UsageContext(); + copyElement(src, tgt); + if (src.hasCode()) + tgt.setCode(convertCoding(src.getCode())); + if (src.hasValue()) + tgt.setValue(convertType(src.getValue())); + return tgt; + } + + public static org.hl7.fhir.r5.model.ElementDefinition convertElementDefinition(org.hl7.fhir.r4.model.ElementDefinition src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ElementDefinition tgt = new org.hl7.fhir.r5.model.ElementDefinition(); + copyBackboneElement(src, tgt); + if (src.hasPath()) + tgt.setPathElement(convertString(src.getPathElement())); + for (org.hl7.fhir.r4.model.Enumeration t : src.getRepresentation()) + tgt.addRepresentation(convertPropertyRepresentation(t.getValue())); + if (src.hasSliceName()) + tgt.setSliceNameElement(convertString(src.getSliceNameElement())); + if (src.hasSliceIsConstraining()) + tgt.setSliceIsConstrainingElement(convertBoolean(src.getSliceIsConstrainingElement())); + if (src.hasLabel()) + tgt.setLabelElement(convertString(src.getLabelElement())); + for (org.hl7.fhir.r4.model.Coding t : src.getCode()) + tgt.addCode(convertCoding(t)); + if (src.hasSlicing()) + tgt.setSlicing(convertElementDefinitionSlicingComponent(src.getSlicing())); + if (src.hasShort()) + tgt.setShortElement(convertString(src.getShortElement())); + if (src.hasDefinition()) + tgt.setDefinitionElement(convertMarkdown(src.getDefinitionElement())); + if (src.hasComment()) + tgt.setCommentElement(convertMarkdown(src.getCommentElement())); + if (src.hasRequirements()) + tgt.setRequirementsElement(convertMarkdown(src.getRequirementsElement())); + for (org.hl7.fhir.r4.model.StringType t : src.getAlias()) + tgt.getAlias().add(convertString(t)); + if (src.hasMin()) + tgt.setMinElement(convertUnsignedInt(src.getMinElement())); + if (src.hasMax()) + tgt.setMaxElement(convertString(src.getMaxElement())); + if (src.hasBase()) + tgt.setBase(convertElementDefinitionBaseComponent(src.getBase())); + if (src.hasContentReference()) + tgt.setContentReferenceElement(convertUri(src.getContentReferenceElement())); + for (org.hl7.fhir.r4.model.ElementDefinition.TypeRefComponent t : src.getType()) + tgt.addType(convertTypeRefComponent(t)); + if (src.hasDefaultValue()) + tgt.setDefaultValue(convertType(src.getDefaultValue())); + if (src.hasMeaningWhenMissing()) + tgt.setMeaningWhenMissingElement(convertMarkdown(src.getMeaningWhenMissingElement())); + if (src.hasOrderMeaning()) + tgt.setOrderMeaningElement(convertString(src.getOrderMeaningElement())); + if (src.hasFixed()) + tgt.setFixed(convertType(src.getFixed())); + if (src.hasPattern()) + tgt.setPattern(convertType(src.getPattern())); + for (org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionExampleComponent t : src.getExample()) + tgt.addExample(convertElementDefinitionExampleComponent(t)); + if (src.hasMinValue()) + tgt.setMinValue(convertType(src.getMinValue())); + if (src.hasMaxValue()) + tgt.setMaxValue(convertType(src.getMaxValue())); + if (src.hasMaxLength()) + tgt.setMaxLengthElement(convertInteger(src.getMaxLengthElement())); + for (org.hl7.fhir.r4.model.IdType t : src.getCondition()) + tgt.getCondition().add(convertId(t)); + for (org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionConstraintComponent t : src.getConstraint()) + tgt.addConstraint(convertElementDefinitionConstraintComponent(t)); + if (src.hasMustSupport()) + tgt.setMustSupportElement(convertBoolean(src.getMustSupportElement())); + if (src.hasIsModifier()) + tgt.setIsModifierElement(convertBoolean(src.getIsModifierElement())); + if (src.hasIsModifierReason()) + tgt.setIsModifierReasonElement(convertString(src.getIsModifierReasonElement())); + if (src.hasIsSummary()) + tgt.setIsSummaryElement(convertBoolean(src.getIsSummaryElement())); + if (src.hasBinding()) + tgt.setBinding(convertElementDefinitionBindingComponent(src.getBinding())); + for (org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionMappingComponent t : src.getMapping()) + tgt.addMapping(convertElementDefinitionMappingComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.ElementDefinition convertElementDefinition(org.hl7.fhir.r5.model.ElementDefinition src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.ElementDefinition tgt = new org.hl7.fhir.r4.model.ElementDefinition(); + copyBackboneElement(src, tgt); + if (src.hasPath()) + tgt.setPathElement(convertString(src.getPathElement())); + for (org.hl7.fhir.r5.model.Enumeration t : src.getRepresentation()) + tgt.addRepresentation(convertPropertyRepresentation(t.getValue())); + if (src.hasSliceName()) + tgt.setSliceNameElement(convertString(src.getSliceNameElement())); + if (src.hasSliceIsConstraining()) + tgt.setSliceIsConstrainingElement(convertBoolean(src.getSliceIsConstrainingElement())); + if (src.hasLabel()) + tgt.setLabelElement(convertString(src.getLabelElement())); + for (org.hl7.fhir.r5.model.Coding t : src.getCode()) + tgt.addCode(convertCoding(t)); + if (src.hasSlicing()) + tgt.setSlicing(convertElementDefinitionSlicingComponent(src.getSlicing())); + if (src.hasShort()) + tgt.setShortElement(convertString(src.getShortElement())); + if (src.hasDefinition()) + tgt.setDefinitionElement(convertMarkdown(src.getDefinitionElement())); + if (src.hasComment()) + tgt.setCommentElement(convertMarkdown(src.getCommentElement())); + if (src.hasRequirements()) + tgt.setRequirementsElement(convertMarkdown(src.getRequirementsElement())); + for (org.hl7.fhir.r5.model.StringType t : src.getAlias()) + tgt.getAlias().add(convertString(t)); + if (src.hasMin()) + tgt.setMinElement(convertUnsignedInt(src.getMinElement())); + if (src.hasMax()) + tgt.setMaxElement(convertString(src.getMaxElement())); + if (src.hasBase()) + tgt.setBase(convertElementDefinitionBaseComponent(src.getBase())); + if (src.hasContentReference()) + tgt.setContentReferenceElement(convertUri(src.getContentReferenceElement())); + for (org.hl7.fhir.r5.model.ElementDefinition.TypeRefComponent t : src.getType()) + tgt.addType(convertTypeRefComponent(t)); + if (src.hasDefaultValue()) + tgt.setDefaultValue(convertType(src.getDefaultValue())); + if (src.hasMeaningWhenMissing()) + tgt.setMeaningWhenMissingElement(convertMarkdown(src.getMeaningWhenMissingElement())); + if (src.hasOrderMeaning()) + tgt.setOrderMeaningElement(convertString(src.getOrderMeaningElement())); + if (src.hasFixed()) + tgt.setFixed(convertType(src.getFixed())); + if (src.hasPattern()) + tgt.setPattern(convertType(src.getPattern())); + for (org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionExampleComponent t : src.getExample()) + tgt.addExample(convertElementDefinitionExampleComponent(t)); + if (src.hasMinValue()) + tgt.setMinValue(convertType(src.getMinValue())); + if (src.hasMaxValue()) + tgt.setMaxValue(convertType(src.getMaxValue())); + if (src.hasMaxLength()) + tgt.setMaxLengthElement(convertInteger(src.getMaxLengthElement())); + for (org.hl7.fhir.r5.model.IdType t : src.getCondition()) + tgt.getCondition().add(convertId(t)); + for (org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionConstraintComponent t : src.getConstraint()) + tgt.addConstraint(convertElementDefinitionConstraintComponent(t)); + if (src.hasMustSupport()) + tgt.setMustSupportElement(convertBoolean(src.getMustSupportElement())); + if (src.hasIsModifier()) + tgt.setIsModifierElement(convertBoolean(src.getIsModifierElement())); + if (src.hasIsModifierReason()) + tgt.setIsModifierReasonElement(convertString(src.getIsModifierReasonElement())); + if (src.hasIsSummary()) + tgt.setIsSummaryElement(convertBoolean(src.getIsSummaryElement())); + if (src.hasBinding()) + tgt.setBinding(convertElementDefinitionBindingComponent(src.getBinding())); + for (org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionMappingComponent t : src.getMapping()) + tgt.addMapping(convertElementDefinitionMappingComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.ElementDefinition.PropertyRepresentation convertPropertyRepresentation(org.hl7.fhir.r4.model.ElementDefinition.PropertyRepresentation src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case XMLATTR: return org.hl7.fhir.r5.model.ElementDefinition.PropertyRepresentation.XMLATTR; + case XMLTEXT: return org.hl7.fhir.r5.model.ElementDefinition.PropertyRepresentation.XMLTEXT; + case TYPEATTR: return org.hl7.fhir.r5.model.ElementDefinition.PropertyRepresentation.TYPEATTR; + case CDATEXT: return org.hl7.fhir.r5.model.ElementDefinition.PropertyRepresentation.CDATEXT; + case XHTML: return org.hl7.fhir.r5.model.ElementDefinition.PropertyRepresentation.XHTML; + default: return org.hl7.fhir.r5.model.ElementDefinition.PropertyRepresentation.NULL; + } + } + + public static org.hl7.fhir.r4.model.ElementDefinition.PropertyRepresentation convertPropertyRepresentation(org.hl7.fhir.r5.model.ElementDefinition.PropertyRepresentation src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case XMLATTR: return org.hl7.fhir.r4.model.ElementDefinition.PropertyRepresentation.XMLATTR; + case XMLTEXT: return org.hl7.fhir.r4.model.ElementDefinition.PropertyRepresentation.XMLTEXT; + case TYPEATTR: return org.hl7.fhir.r4.model.ElementDefinition.PropertyRepresentation.TYPEATTR; + case CDATEXT: return org.hl7.fhir.r4.model.ElementDefinition.PropertyRepresentation.CDATEXT; + case XHTML: return org.hl7.fhir.r4.model.ElementDefinition.PropertyRepresentation.XHTML; + default: return org.hl7.fhir.r4.model.ElementDefinition.PropertyRepresentation.NULL; + } + } + + public static org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionSlicingComponent convertElementDefinitionSlicingComponent(org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionSlicingComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionSlicingComponent tgt = new org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionSlicingComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent t : src.getDiscriminator()) + tgt.addDiscriminator(convertElementDefinitionSlicingDiscriminatorComponent(t)); + if (src.hasDescription()) + tgt.setDescriptionElement(convertString(src.getDescriptionElement())); + if (src.hasOrdered()) + tgt.setOrderedElement(convertBoolean(src.getOrderedElement())); + if (src.hasRules()) + tgt.setRules(convertSlicingRules(src.getRules())); + return tgt; + } + + public static org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionSlicingComponent convertElementDefinitionSlicingComponent(org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionSlicingComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionSlicingComponent tgt = new org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionSlicingComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent t : src.getDiscriminator()) + tgt.addDiscriminator(convertElementDefinitionSlicingDiscriminatorComponent(t)); + if (src.hasDescription()) + tgt.setDescriptionElement(convertString(src.getDescriptionElement())); + if (src.hasOrdered()) + tgt.setOrderedElement(convertBoolean(src.getOrderedElement())); + if (src.hasRules()) + tgt.setRules(convertSlicingRules(src.getRules())); + return tgt; + } + + public static org.hl7.fhir.r5.model.ElementDefinition.SlicingRules convertSlicingRules(org.hl7.fhir.r4.model.ElementDefinition.SlicingRules src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case CLOSED: return org.hl7.fhir.r5.model.ElementDefinition.SlicingRules.CLOSED; + case OPEN: return org.hl7.fhir.r5.model.ElementDefinition.SlicingRules.OPEN; + case OPENATEND: return org.hl7.fhir.r5.model.ElementDefinition.SlicingRules.OPENATEND; + default: return org.hl7.fhir.r5.model.ElementDefinition.SlicingRules.NULL; + } + } + + public static org.hl7.fhir.r4.model.ElementDefinition.SlicingRules convertSlicingRules(org.hl7.fhir.r5.model.ElementDefinition.SlicingRules src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case CLOSED: return org.hl7.fhir.r4.model.ElementDefinition.SlicingRules.CLOSED; + case OPEN: return org.hl7.fhir.r4.model.ElementDefinition.SlicingRules.OPEN; + case OPENATEND: return org.hl7.fhir.r4.model.ElementDefinition.SlicingRules.OPENATEND; + default: return org.hl7.fhir.r4.model.ElementDefinition.SlicingRules.NULL; + } + } + + public static org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent convertElementDefinitionSlicingDiscriminatorComponent(org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent tgt = new org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent(); + copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertDiscriminatorType(src.getType())); + if (src.hasPath()) + tgt.setPathElement(convertString(src.getPathElement())); + return tgt; + } + + public static org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent convertElementDefinitionSlicingDiscriminatorComponent(org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent tgt = new org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent(); + copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertDiscriminatorType(src.getType())); + if (src.hasPath()) + tgt.setPathElement(convertString(src.getPathElement())); + return tgt; + } + + public static org.hl7.fhir.r5.model.ElementDefinition.DiscriminatorType convertDiscriminatorType(org.hl7.fhir.r4.model.ElementDefinition.DiscriminatorType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case VALUE: return org.hl7.fhir.r5.model.ElementDefinition.DiscriminatorType.VALUE; + case EXISTS: return org.hl7.fhir.r5.model.ElementDefinition.DiscriminatorType.EXISTS; + case PATTERN: return org.hl7.fhir.r5.model.ElementDefinition.DiscriminatorType.PATTERN; + case TYPE: return org.hl7.fhir.r5.model.ElementDefinition.DiscriminatorType.TYPE; + case PROFILE: return org.hl7.fhir.r5.model.ElementDefinition.DiscriminatorType.PROFILE; + default: return org.hl7.fhir.r5.model.ElementDefinition.DiscriminatorType.NULL; + } + } + + public static org.hl7.fhir.r4.model.ElementDefinition.DiscriminatorType convertDiscriminatorType(org.hl7.fhir.r5.model.ElementDefinition.DiscriminatorType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case VALUE: return org.hl7.fhir.r4.model.ElementDefinition.DiscriminatorType.VALUE; + case EXISTS: return org.hl7.fhir.r4.model.ElementDefinition.DiscriminatorType.EXISTS; + case PATTERN: return org.hl7.fhir.r4.model.ElementDefinition.DiscriminatorType.PATTERN; + case TYPE: return org.hl7.fhir.r4.model.ElementDefinition.DiscriminatorType.TYPE; + case PROFILE: return org.hl7.fhir.r4.model.ElementDefinition.DiscriminatorType.PROFILE; + default: return org.hl7.fhir.r4.model.ElementDefinition.DiscriminatorType.NULL; + } + } + + public static org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionBaseComponent convertElementDefinitionBaseComponent(org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionBaseComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionBaseComponent tgt = new org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionBaseComponent(); + copyElement(src, tgt); + if (src.hasPath()) + tgt.setPathElement(convertString(src.getPathElement())); + if (src.hasMin()) + tgt.setMinElement(convertUnsignedInt(src.getMinElement())); + if (src.hasMax()) + tgt.setMaxElement(convertString(src.getMaxElement())); + return tgt; + } + + public static org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionBaseComponent convertElementDefinitionBaseComponent(org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionBaseComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionBaseComponent tgt = new org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionBaseComponent(); + copyElement(src, tgt); + if (src.hasPath()) + tgt.setPathElement(convertString(src.getPathElement())); + if (src.hasMin()) + tgt.setMinElement(convertUnsignedInt(src.getMinElement())); + if (src.hasMax()) + tgt.setMaxElement(convertString(src.getMaxElement())); + return tgt; + } + + public static org.hl7.fhir.r5.model.ElementDefinition.TypeRefComponent convertTypeRefComponent(org.hl7.fhir.r4.model.ElementDefinition.TypeRefComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ElementDefinition.TypeRefComponent tgt = new org.hl7.fhir.r5.model.ElementDefinition.TypeRefComponent(); + copyElement(src, tgt); + if (src.hasCode()) + tgt.setCodeElement(convertUri(src.getCodeElement())); + for (org.hl7.fhir.r4.model.CanonicalType t : src.getProfile()) + tgt.getProfile().add(convertCanonical(t)); + for (org.hl7.fhir.r4.model.CanonicalType t : src.getTargetProfile()) + tgt.getTargetProfile().add(convertCanonical(t)); + for (org.hl7.fhir.r4.model.Enumeration t : src.getAggregation()) + tgt.addAggregation(convertAggregationMode(t.getValue())); + if (src.hasVersioning()) + tgt.setVersioning(convertReferenceVersionRules(src.getVersioning())); + return tgt; + } + + public static org.hl7.fhir.r4.model.ElementDefinition.TypeRefComponent convertTypeRefComponent(org.hl7.fhir.r5.model.ElementDefinition.TypeRefComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.ElementDefinition.TypeRefComponent tgt = new org.hl7.fhir.r4.model.ElementDefinition.TypeRefComponent(); + copyElement(src, tgt); + if (src.hasCode()) + tgt.setCodeElement(convertUri(src.getCodeElement())); + for (org.hl7.fhir.r5.model.CanonicalType t : src.getProfile()) + tgt.getProfile().add(convertCanonical(t)); + for (org.hl7.fhir.r5.model.CanonicalType t : src.getTargetProfile()) + tgt.getTargetProfile().add(convertCanonical(t)); + for (org.hl7.fhir.r5.model.Enumeration t : src.getAggregation()) + tgt.addAggregation(convertAggregationMode(t.getValue())); + if (src.hasVersioning()) + tgt.setVersioning(convertReferenceVersionRules(src.getVersioning())); + return tgt; + } + + public static org.hl7.fhir.r5.model.ElementDefinition.AggregationMode convertAggregationMode(org.hl7.fhir.r4.model.ElementDefinition.AggregationMode src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case CONTAINED: return org.hl7.fhir.r5.model.ElementDefinition.AggregationMode.CONTAINED; + case REFERENCED: return org.hl7.fhir.r5.model.ElementDefinition.AggregationMode.REFERENCED; + case BUNDLED: return org.hl7.fhir.r5.model.ElementDefinition.AggregationMode.BUNDLED; + default: return org.hl7.fhir.r5.model.ElementDefinition.AggregationMode.NULL; + } + } + + public static org.hl7.fhir.r4.model.ElementDefinition.AggregationMode convertAggregationMode(org.hl7.fhir.r5.model.ElementDefinition.AggregationMode src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case CONTAINED: return org.hl7.fhir.r4.model.ElementDefinition.AggregationMode.CONTAINED; + case REFERENCED: return org.hl7.fhir.r4.model.ElementDefinition.AggregationMode.REFERENCED; + case BUNDLED: return org.hl7.fhir.r4.model.ElementDefinition.AggregationMode.BUNDLED; + default: return org.hl7.fhir.r4.model.ElementDefinition.AggregationMode.NULL; + } + } + + public static org.hl7.fhir.r5.model.ElementDefinition.ReferenceVersionRules convertReferenceVersionRules(org.hl7.fhir.r4.model.ElementDefinition.ReferenceVersionRules src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case EITHER: return org.hl7.fhir.r5.model.ElementDefinition.ReferenceVersionRules.EITHER; + case INDEPENDENT: return org.hl7.fhir.r5.model.ElementDefinition.ReferenceVersionRules.INDEPENDENT; + case SPECIFIC: return org.hl7.fhir.r5.model.ElementDefinition.ReferenceVersionRules.SPECIFIC; + default: return org.hl7.fhir.r5.model.ElementDefinition.ReferenceVersionRules.NULL; + } + } + + public static org.hl7.fhir.r4.model.ElementDefinition.ReferenceVersionRules convertReferenceVersionRules(org.hl7.fhir.r5.model.ElementDefinition.ReferenceVersionRules src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case EITHER: return org.hl7.fhir.r4.model.ElementDefinition.ReferenceVersionRules.EITHER; + case INDEPENDENT: return org.hl7.fhir.r4.model.ElementDefinition.ReferenceVersionRules.INDEPENDENT; + case SPECIFIC: return org.hl7.fhir.r4.model.ElementDefinition.ReferenceVersionRules.SPECIFIC; + default: return org.hl7.fhir.r4.model.ElementDefinition.ReferenceVersionRules.NULL; + } + } + + public static org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionExampleComponent convertElementDefinitionExampleComponent(org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionExampleComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionExampleComponent tgt = new org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionExampleComponent(); + copyElement(src, tgt); + if (src.hasLabel()) + tgt.setLabelElement(convertString(src.getLabelElement())); + if (src.hasValue()) + tgt.setValue(convertType(src.getValue())); + return tgt; + } + + public static org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionExampleComponent convertElementDefinitionExampleComponent(org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionExampleComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionExampleComponent tgt = new org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionExampleComponent(); + copyElement(src, tgt); + if (src.hasLabel()) + tgt.setLabelElement(convertString(src.getLabelElement())); + if (src.hasValue()) + tgt.setValue(convertType(src.getValue())); + return tgt; + } + + public static org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionConstraintComponent convertElementDefinitionConstraintComponent(org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionConstraintComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionConstraintComponent tgt = new org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionConstraintComponent(); + copyElement(src, tgt); + if (src.hasKey()) + tgt.setKeyElement(convertId(src.getKeyElement())); + if (src.hasRequirements()) + tgt.setRequirementsElement(convertString(src.getRequirementsElement())); + if (src.hasSeverity()) + tgt.setSeverity(convertConstraintSeverity(src.getSeverity())); + if (src.hasHuman()) + tgt.setHumanElement(convertString(src.getHumanElement())); + if (src.hasExpression()) + tgt.setExpressionElement(convertString(src.getExpressionElement())); + if (src.hasXpath()) + tgt.setXpathElement(convertString(src.getXpathElement())); + if (src.hasSource()) + tgt.setSourceElement(convertCanonical(src.getSourceElement())); + return tgt; + } + + public static org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionConstraintComponent convertElementDefinitionConstraintComponent(org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionConstraintComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionConstraintComponent tgt = new org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionConstraintComponent(); + copyElement(src, tgt); + if (src.hasKey()) + tgt.setKeyElement(convertId(src.getKeyElement())); + if (src.hasRequirements()) + tgt.setRequirementsElement(convertString(src.getRequirementsElement())); + if (src.hasSeverity()) + tgt.setSeverity(convertConstraintSeverity(src.getSeverity())); + if (src.hasHuman()) + tgt.setHumanElement(convertString(src.getHumanElement())); + if (src.hasExpression()) + tgt.setExpressionElement(convertString(src.getExpressionElement())); + if (src.hasXpath()) + tgt.setXpathElement(convertString(src.getXpathElement())); + if (src.hasSource()) + tgt.setSourceElement(convertCanonical(src.getSourceElement())); + return tgt; + } + + public static org.hl7.fhir.r5.model.ElementDefinition.ConstraintSeverity convertConstraintSeverity(org.hl7.fhir.r4.model.ElementDefinition.ConstraintSeverity src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case ERROR: return org.hl7.fhir.r5.model.ElementDefinition.ConstraintSeverity.ERROR; + case WARNING: return org.hl7.fhir.r5.model.ElementDefinition.ConstraintSeverity.WARNING; + default: return org.hl7.fhir.r5.model.ElementDefinition.ConstraintSeverity.NULL; + } + } + + public static org.hl7.fhir.r4.model.ElementDefinition.ConstraintSeverity convertConstraintSeverity(org.hl7.fhir.r5.model.ElementDefinition.ConstraintSeverity src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case ERROR: return org.hl7.fhir.r4.model.ElementDefinition.ConstraintSeverity.ERROR; + case WARNING: return org.hl7.fhir.r4.model.ElementDefinition.ConstraintSeverity.WARNING; + default: return org.hl7.fhir.r4.model.ElementDefinition.ConstraintSeverity.NULL; + } + } + + public static org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionBindingComponent convertElementDefinitionBindingComponent(org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionBindingComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionBindingComponent tgt = new org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionBindingComponent(); + copyElement(src, tgt); + if (src.hasStrength()) + tgt.setStrength(Enumerations.convertBindingStrength(src.getStrength())); + if (src.hasDescription()) + tgt.setDescriptionElement(convertString(src.getDescriptionElement())); + if (src.hasValueSet()) + tgt.setValueSetElement(convertCanonical(src.getValueSetElement())); + return tgt; + } + + public static org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionBindingComponent convertElementDefinitionBindingComponent(org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionBindingComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionBindingComponent tgt = new org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionBindingComponent(); + copyElement(src, tgt); + if (src.hasStrength()) + tgt.setStrength(Enumerations.convertBindingStrength(src.getStrength())); + if (src.hasDescription()) + tgt.setDescriptionElement(convertString(src.getDescriptionElement())); + if (src.hasValueSet()) + tgt.setValueSetElement(convertCanonical(src.getValueSetElement())); + return tgt; + } + + public static org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionMappingComponent convertElementDefinitionMappingComponent(org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionMappingComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionMappingComponent tgt = new org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionMappingComponent(); + copyElement(src, tgt); + if (src.hasIdentity()) + tgt.setIdentityElement(convertId(src.getIdentityElement())); + if (src.hasLanguage()) + tgt.setLanguageElement(convertCode(src.getLanguageElement())); + if (src.hasMap()) + tgt.setMapElement(convertString(src.getMapElement())); + if (src.hasComment()) + tgt.setCommentElement(convertString(src.getCommentElement())); + return tgt; + } + + public static org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionMappingComponent convertElementDefinitionMappingComponent(org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionMappingComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionMappingComponent tgt = new org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionMappingComponent(); + copyElement(src, tgt); + if (src.hasIdentity()) + tgt.setIdentityElement(convertId(src.getIdentityElement())); + if (src.hasLanguage()) + tgt.setLanguageElement(convertCode(src.getLanguageElement())); + if (src.hasMap()) + tgt.setMapElement(convertString(src.getMapElement())); + if (src.hasComment()) + tgt.setCommentElement(convertString(src.getCommentElement())); + return tgt; + } + + public static org.hl7.fhir.r5.model.Quantity convertMoneyQuantity(org.hl7.fhir.r4.model.Quantity src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Quantity tgt = new org.hl7.fhir.r5.model.Quantity(); + copyElement(src, tgt); + if (src.hasValue()) + tgt.setValueElement(convertDecimal(src.getValueElement())); + if (src.hasComparator()) + tgt.setComparator(convertQuantityComparator(src.getComparator())); + if (src.hasUnit()) + tgt.setUnitElement(convertString(src.getUnitElement())); + if (src.hasSystem()) + tgt.setSystemElement(convertUri(src.getSystemElement())); + if (src.hasCode()) + tgt.setCodeElement(convertCode(src.getCodeElement())); + return tgt; + } + + public static org.hl7.fhir.r4.model.Quantity convertMoneyQuantity(org.hl7.fhir.r5.model.Quantity src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Quantity tgt = new org.hl7.fhir.r4.model.Quantity(); + copyElement(src, tgt); + if (src.hasValue()) + tgt.setValueElement(convertDecimal(src.getValueElement())); + if (src.hasComparator()) + tgt.setComparator(convertQuantityComparator(src.getComparator())); + if (src.hasUnit()) + tgt.setUnitElement(convertString(src.getUnitElement())); + if (src.hasSystem()) + tgt.setSystemElement(convertUri(src.getSystemElement())); + if (src.hasCode()) + tgt.setCodeElement(convertCode(src.getCodeElement())); + return tgt; + } + + public static org.hl7.fhir.r5.model.Quantity convertSimpleQuantity(org.hl7.fhir.r4.model.Quantity src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Quantity tgt = new org.hl7.fhir.r5.model.Quantity(); + copyElement(src, tgt); + if (src.hasValue()) + tgt.setValueElement(convertDecimal(src.getValueElement())); + if (src.hasComparator()) + tgt.setComparator(convertQuantityComparator(src.getComparator())); + if (src.hasUnit()) + tgt.setUnitElement(convertString(src.getUnitElement())); + if (src.hasSystem()) + tgt.setSystemElement(convertUri(src.getSystemElement())); + if (src.hasCode()) + tgt.setCodeElement(convertCode(src.getCodeElement())); + return tgt; + } + + public static org.hl7.fhir.r4.model.Quantity convertSimpleQuantity(org.hl7.fhir.r5.model.Quantity src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Quantity tgt = new org.hl7.fhir.r4.model.Quantity(); + copyElement(src, tgt); + if (src.hasValue()) + tgt.setValueElement(convertDecimal(src.getValueElement())); + if (src.hasComparator()) + tgt.setComparator(convertQuantityComparator(src.getComparator())); + if (src.hasUnit()) + tgt.setUnitElement(convertString(src.getUnitElement())); + if (src.hasSystem()) + tgt.setSystemElement(convertUri(src.getSystemElement())); + if (src.hasCode()) + tgt.setCodeElement(convertCode(src.getCodeElement())); + return tgt; + } + + public static org.hl7.fhir.r5.model.Type convertType(org.hl7.fhir.r4.model.Type src) throws FHIRException { + if (src == null) + return null; + if (src instanceof org.hl7.fhir.r4.model.Base64BinaryType) + return convertBase64Binary((org.hl7.fhir.r4.model.Base64BinaryType) src); + if (src instanceof org.hl7.fhir.r4.model.BooleanType) + return convertBoolean((org.hl7.fhir.r4.model.BooleanType) src); + if (src instanceof org.hl7.fhir.r4.model.CanonicalType) + return convertCanonical((org.hl7.fhir.r4.model.CanonicalType) src); + if (src instanceof org.hl7.fhir.r4.model.CodeType) + return convertCode((org.hl7.fhir.r4.model.CodeType) src); + if (src instanceof org.hl7.fhir.r4.model.DateType) + return convertDate((org.hl7.fhir.r4.model.DateType) src); + if (src instanceof org.hl7.fhir.r4.model.DateTimeType) + return convertDateTime((org.hl7.fhir.r4.model.DateTimeType) src); + if (src instanceof org.hl7.fhir.r4.model.DecimalType) + return convertDecimal((org.hl7.fhir.r4.model.DecimalType) src); + if (src instanceof org.hl7.fhir.r4.model.IdType) + return convertId((org.hl7.fhir.r4.model.IdType) src); + if (src instanceof org.hl7.fhir.r4.model.InstantType) + return convertInstant((org.hl7.fhir.r4.model.InstantType) src); + if (src instanceof org.hl7.fhir.r4.model.IntegerType) + return convertInteger((org.hl7.fhir.r4.model.IntegerType) src); + if (src instanceof org.hl7.fhir.r4.model.MarkdownType) + return convertMarkdown((org.hl7.fhir.r4.model.MarkdownType) src); + if (src instanceof org.hl7.fhir.r4.model.OidType) + return convertOid((org.hl7.fhir.r4.model.OidType) src); + if (src instanceof org.hl7.fhir.r4.model.PositiveIntType) + return convertPositiveInt((org.hl7.fhir.r4.model.PositiveIntType) src); + if (src instanceof org.hl7.fhir.r4.model.StringType) + return convertString((org.hl7.fhir.r4.model.StringType) src); + if (src instanceof org.hl7.fhir.r4.model.TimeType) + return convertTime((org.hl7.fhir.r4.model.TimeType) src); + if (src instanceof org.hl7.fhir.r4.model.UnsignedIntType) + return convertUnsignedInt((org.hl7.fhir.r4.model.UnsignedIntType) src); + if (src instanceof org.hl7.fhir.r4.model.UriType) + return convertUri((org.hl7.fhir.r4.model.UriType) src); + if (src instanceof org.hl7.fhir.r4.model.UrlType) + return convertUrl((org.hl7.fhir.r4.model.UrlType) src); + if (src instanceof org.hl7.fhir.r4.model.UuidType) + return convertUuid((org.hl7.fhir.r4.model.UuidType) src); + if (src instanceof org.hl7.fhir.r4.model.Extension) + return convertExtension((org.hl7.fhir.r4.model.Extension) src); + if (src instanceof org.hl7.fhir.r4.model.Narrative) + return convertNarrative((org.hl7.fhir.r4.model.Narrative) src); + if (src instanceof org.hl7.fhir.r4.model.Address) + return convertAddress((org.hl7.fhir.r4.model.Address) src); + if (src instanceof org.hl7.fhir.r4.model.Age) + return convertAge((org.hl7.fhir.r4.model.Age) src); + if (src instanceof org.hl7.fhir.r4.model.Annotation) + return convertAnnotation((org.hl7.fhir.r4.model.Annotation) src); + if (src instanceof org.hl7.fhir.r4.model.Attachment) + return convertAttachment((org.hl7.fhir.r4.model.Attachment) src); + if (src instanceof org.hl7.fhir.r4.model.CodeableConcept) + return convertCodeableConcept((org.hl7.fhir.r4.model.CodeableConcept) src); + if (src instanceof org.hl7.fhir.r4.model.Coding) + return convertCoding((org.hl7.fhir.r4.model.Coding) src); + if (src instanceof org.hl7.fhir.r4.model.ContactDetail) + return convertContactDetail((org.hl7.fhir.r4.model.ContactDetail) src); + if (src instanceof org.hl7.fhir.r4.model.ContactPoint) + return convertContactPoint((org.hl7.fhir.r4.model.ContactPoint) src); + if (src instanceof org.hl7.fhir.r4.model.Contributor) + return convertContributor((org.hl7.fhir.r4.model.Contributor) src); + if (src instanceof org.hl7.fhir.r4.model.Count) + return convertCount((org.hl7.fhir.r4.model.Count) src); + if (src instanceof org.hl7.fhir.r4.model.DataRequirement) + return convertDataRequirement((org.hl7.fhir.r4.model.DataRequirement) src); + if (src instanceof org.hl7.fhir.r4.model.Distance) + return convertDistance((org.hl7.fhir.r4.model.Distance) src); + if (src instanceof org.hl7.fhir.r4.model.Dosage) + return convertDosage((org.hl7.fhir.r4.model.Dosage) src); + if (src instanceof org.hl7.fhir.r4.model.Duration) + return convertDuration((org.hl7.fhir.r4.model.Duration) src); + if (src instanceof org.hl7.fhir.r4.model.Expression) + return convertExpression((org.hl7.fhir.r4.model.Expression) src); + if (src instanceof org.hl7.fhir.r4.model.HumanName) + return convertHumanName((org.hl7.fhir.r4.model.HumanName) src); + if (src instanceof org.hl7.fhir.r4.model.Identifier) + return convertIdentifier((org.hl7.fhir.r4.model.Identifier) src); + if (src instanceof org.hl7.fhir.r4.model.MarketingStatus) + return convertMarketingStatus((org.hl7.fhir.r4.model.MarketingStatus) src); + if (src instanceof org.hl7.fhir.r4.model.Meta) + return convertMeta((org.hl7.fhir.r4.model.Meta) src); + if (src instanceof org.hl7.fhir.r4.model.Money) + return convertMoney((org.hl7.fhir.r4.model.Money) src); + if (src instanceof org.hl7.fhir.r4.model.ParameterDefinition) + return convertParameterDefinition((org.hl7.fhir.r4.model.ParameterDefinition) src); + if (src instanceof org.hl7.fhir.r4.model.Period) + return convertPeriod((org.hl7.fhir.r4.model.Period) src); + if (src instanceof org.hl7.fhir.r4.model.Population) + return convertPopulation((org.hl7.fhir.r4.model.Population) src); + if (src instanceof org.hl7.fhir.r4.model.ProdCharacteristic) + return convertProdCharacteristic((org.hl7.fhir.r4.model.ProdCharacteristic) src); + if (src instanceof org.hl7.fhir.r4.model.ProductShelfLife) + return convertProductShelfLife((org.hl7.fhir.r4.model.ProductShelfLife) src); + if (src instanceof org.hl7.fhir.r4.model.Quantity) + return convertQuantity((org.hl7.fhir.r4.model.Quantity) src); + if (src instanceof org.hl7.fhir.r4.model.Range) + return convertRange((org.hl7.fhir.r4.model.Range) src); + if (src instanceof org.hl7.fhir.r4.model.Ratio) + return convertRatio((org.hl7.fhir.r4.model.Ratio) src); + if (src instanceof org.hl7.fhir.r4.model.Reference) + return convertReference((org.hl7.fhir.r4.model.Reference) src); + if (src instanceof org.hl7.fhir.r4.model.RelatedArtifact) + return convertRelatedArtifact((org.hl7.fhir.r4.model.RelatedArtifact) src); + if (src instanceof org.hl7.fhir.r4.model.SampledData) + return convertSampledData((org.hl7.fhir.r4.model.SampledData) src); + if (src instanceof org.hl7.fhir.r4.model.Signature) + return convertSignature((org.hl7.fhir.r4.model.Signature) src); + if (src instanceof org.hl7.fhir.r4.model.SubstanceAmount) + return convertSubstanceAmount((org.hl7.fhir.r4.model.SubstanceAmount) src); + if (src instanceof org.hl7.fhir.r4.model.Timing) + return convertTiming((org.hl7.fhir.r4.model.Timing) src); + if (src instanceof org.hl7.fhir.r4.model.TriggerDefinition) + return convertTriggerDefinition((org.hl7.fhir.r4.model.TriggerDefinition) src); + if (src instanceof org.hl7.fhir.r4.model.UsageContext) + return convertUsageContext((org.hl7.fhir.r4.model.UsageContext) src); + if (src instanceof org.hl7.fhir.r4.model.ElementDefinition) + return convertElementDefinition((org.hl7.fhir.r4.model.ElementDefinition) src); + if (src instanceof org.hl7.fhir.r4.model.MoneyQuantity) + return convertMoneyQuantity((org.hl7.fhir.r4.model.MoneyQuantity) src); + if (src instanceof org.hl7.fhir.r4.model.SimpleQuantity) + return convertSimpleQuantity((org.hl7.fhir.r4.model.SimpleQuantity) src); + throw new Error("Unknown type "+src.fhirType()); + } + + public static org.hl7.fhir.r4.model.Type convertType(org.hl7.fhir.r5.model.Type src) throws FHIRException { + if (src == null) + return null; + if (src instanceof org.hl7.fhir.r5.model.Base64BinaryType) + return convertBase64Binary((org.hl7.fhir.r5.model.Base64BinaryType) src); + if (src instanceof org.hl7.fhir.r5.model.BooleanType) + return convertBoolean((org.hl7.fhir.r5.model.BooleanType) src); + if (src instanceof org.hl7.fhir.r5.model.CanonicalType) + return convertCanonical((org.hl7.fhir.r5.model.CanonicalType) src); + if (src instanceof org.hl7.fhir.r5.model.CodeType) + return convertCode((org.hl7.fhir.r5.model.CodeType) src); + if (src instanceof org.hl7.fhir.r5.model.DateType) + return convertDate((org.hl7.fhir.r5.model.DateType) src); + if (src instanceof org.hl7.fhir.r5.model.DateTimeType) + return convertDateTime((org.hl7.fhir.r5.model.DateTimeType) src); + if (src instanceof org.hl7.fhir.r5.model.DecimalType) + return convertDecimal((org.hl7.fhir.r5.model.DecimalType) src); + if (src instanceof org.hl7.fhir.r5.model.IdType) + return convertId((org.hl7.fhir.r5.model.IdType) src); + if (src instanceof org.hl7.fhir.r5.model.InstantType) + return convertInstant((org.hl7.fhir.r5.model.InstantType) src); + if (src instanceof org.hl7.fhir.r5.model.IntegerType) + return convertInteger((org.hl7.fhir.r5.model.IntegerType) src); + if (src instanceof org.hl7.fhir.r5.model.MarkdownType) + return convertMarkdown((org.hl7.fhir.r5.model.MarkdownType) src); + if (src instanceof org.hl7.fhir.r5.model.OidType) + return convertOid((org.hl7.fhir.r5.model.OidType) src); + if (src instanceof org.hl7.fhir.r5.model.PositiveIntType) + return convertPositiveInt((org.hl7.fhir.r5.model.PositiveIntType) src); + if (src instanceof org.hl7.fhir.r5.model.StringType) + return convertString((org.hl7.fhir.r5.model.StringType) src); + if (src instanceof org.hl7.fhir.r5.model.TimeType) + return convertTime((org.hl7.fhir.r5.model.TimeType) src); + if (src instanceof org.hl7.fhir.r5.model.UnsignedIntType) + return convertUnsignedInt((org.hl7.fhir.r5.model.UnsignedIntType) src); + if (src instanceof org.hl7.fhir.r5.model.UriType) + return convertUri((org.hl7.fhir.r5.model.UriType) src); + if (src instanceof org.hl7.fhir.r5.model.UrlType) + return convertUrl((org.hl7.fhir.r5.model.UrlType) src); + if (src instanceof org.hl7.fhir.r5.model.UuidType) + return convertUuid((org.hl7.fhir.r5.model.UuidType) src); + if (src instanceof org.hl7.fhir.r5.model.Extension) + return convertExtension((org.hl7.fhir.r5.model.Extension) src); + if (src instanceof org.hl7.fhir.r5.model.Narrative) + return convertNarrative((org.hl7.fhir.r5.model.Narrative) src); + if (src instanceof org.hl7.fhir.r5.model.Address) + return convertAddress((org.hl7.fhir.r5.model.Address) src); + if (src instanceof org.hl7.fhir.r5.model.Age) + return convertAge((org.hl7.fhir.r5.model.Age) src); + if (src instanceof org.hl7.fhir.r5.model.Annotation) + return convertAnnotation((org.hl7.fhir.r5.model.Annotation) src); + if (src instanceof org.hl7.fhir.r5.model.Attachment) + return convertAttachment((org.hl7.fhir.r5.model.Attachment) src); + if (src instanceof org.hl7.fhir.r5.model.CodeableConcept) + return convertCodeableConcept((org.hl7.fhir.r5.model.CodeableConcept) src); + if (src instanceof org.hl7.fhir.r5.model.Coding) + return convertCoding((org.hl7.fhir.r5.model.Coding) src); + if (src instanceof org.hl7.fhir.r5.model.ContactDetail) + return convertContactDetail((org.hl7.fhir.r5.model.ContactDetail) src); + if (src instanceof org.hl7.fhir.r5.model.ContactPoint) + return convertContactPoint((org.hl7.fhir.r5.model.ContactPoint) src); + if (src instanceof org.hl7.fhir.r5.model.Contributor) + return convertContributor((org.hl7.fhir.r5.model.Contributor) src); + if (src instanceof org.hl7.fhir.r5.model.Count) + return convertCount((org.hl7.fhir.r5.model.Count) src); + if (src instanceof org.hl7.fhir.r5.model.DataRequirement) + return convertDataRequirement((org.hl7.fhir.r5.model.DataRequirement) src); + if (src instanceof org.hl7.fhir.r5.model.Distance) + return convertDistance((org.hl7.fhir.r5.model.Distance) src); + if (src instanceof org.hl7.fhir.r5.model.Dosage) + return convertDosage((org.hl7.fhir.r5.model.Dosage) src); + if (src instanceof org.hl7.fhir.r5.model.Duration) + return convertDuration((org.hl7.fhir.r5.model.Duration) src); + if (src instanceof org.hl7.fhir.r5.model.Expression) + return convertExpression((org.hl7.fhir.r5.model.Expression) src); + if (src instanceof org.hl7.fhir.r5.model.HumanName) + return convertHumanName((org.hl7.fhir.r5.model.HumanName) src); + if (src instanceof org.hl7.fhir.r5.model.Identifier) + return convertIdentifier((org.hl7.fhir.r5.model.Identifier) src); + if (src instanceof org.hl7.fhir.r5.model.MarketingStatus) + return convertMarketingStatus((org.hl7.fhir.r5.model.MarketingStatus) src); + if (src instanceof org.hl7.fhir.r5.model.Meta) + return convertMeta((org.hl7.fhir.r5.model.Meta) src); + if (src instanceof org.hl7.fhir.r5.model.Money) + return convertMoney((org.hl7.fhir.r5.model.Money) src); + if (src instanceof org.hl7.fhir.r5.model.ParameterDefinition) + return convertParameterDefinition((org.hl7.fhir.r5.model.ParameterDefinition) src); + if (src instanceof org.hl7.fhir.r5.model.Period) + return convertPeriod((org.hl7.fhir.r5.model.Period) src); + if (src instanceof org.hl7.fhir.r5.model.Population) + return convertPopulation((org.hl7.fhir.r5.model.Population) src); + if (src instanceof org.hl7.fhir.r5.model.ProdCharacteristic) + return convertProdCharacteristic((org.hl7.fhir.r5.model.ProdCharacteristic) src); + if (src instanceof org.hl7.fhir.r5.model.ProductShelfLife) + return convertProductShelfLife((org.hl7.fhir.r5.model.ProductShelfLife) src); + if (src instanceof org.hl7.fhir.r5.model.Quantity) + return convertQuantity((org.hl7.fhir.r5.model.Quantity) src); + if (src instanceof org.hl7.fhir.r5.model.Range) + return convertRange((org.hl7.fhir.r5.model.Range) src); + if (src instanceof org.hl7.fhir.r5.model.Ratio) + return convertRatio((org.hl7.fhir.r5.model.Ratio) src); + if (src instanceof org.hl7.fhir.r5.model.Reference) + return convertReference((org.hl7.fhir.r5.model.Reference) src); + if (src instanceof org.hl7.fhir.r5.model.RelatedArtifact) + return convertRelatedArtifact((org.hl7.fhir.r5.model.RelatedArtifact) src); + if (src instanceof org.hl7.fhir.r5.model.SampledData) + return convertSampledData((org.hl7.fhir.r5.model.SampledData) src); + if (src instanceof org.hl7.fhir.r5.model.Signature) + return convertSignature((org.hl7.fhir.r5.model.Signature) src); + if (src instanceof org.hl7.fhir.r5.model.SubstanceAmount) + return convertSubstanceAmount((org.hl7.fhir.r5.model.SubstanceAmount) src); + if (src instanceof org.hl7.fhir.r5.model.Timing) + return convertTiming((org.hl7.fhir.r5.model.Timing) src); + if (src instanceof org.hl7.fhir.r5.model.TriggerDefinition) + return convertTriggerDefinition((org.hl7.fhir.r5.model.TriggerDefinition) src); + if (src instanceof org.hl7.fhir.r5.model.UsageContext) + return convertUsageContext((org.hl7.fhir.r5.model.UsageContext) src); + if (src instanceof org.hl7.fhir.r5.model.ElementDefinition) + return convertElementDefinition((org.hl7.fhir.r5.model.ElementDefinition) src); + if (src instanceof org.hl7.fhir.r5.model.MoneyQuantity) + return convertMoneyQuantity((org.hl7.fhir.r5.model.MoneyQuantity) src); + if (src instanceof org.hl7.fhir.r5.model.SimpleQuantity) + return convertSimpleQuantity((org.hl7.fhir.r5.model.SimpleQuantity) src); + throw new Error("Unknown type "+src.fhirType()); + } + + protected static void copyDomainResource(org.hl7.fhir.r4.model.DomainResource src, org.hl7.fhir.r5.model.DomainResource tgt) throws FHIRException { + copyResource(src, tgt); + if (src.hasText()) + tgt.setText(convertNarrative(src.getText())); + for (org.hl7.fhir.r4.model.Resource t : src.getContained()) + tgt.addContained(convertResource(t)); + for (org.hl7.fhir.r4.model.Extension t : src.getExtension()) + tgt.addExtension(convertExtension(t)); + for (org.hl7.fhir.r4.model.Extension t : src.getModifierExtension()) + tgt.addModifierExtension(convertExtension(t)); + } + protected static void copyDomainResource(org.hl7.fhir.r5.model.DomainResource src, org.hl7.fhir.r4.model.DomainResource tgt) throws FHIRException { + copyResource(src, tgt); + if (src.hasText()) + tgt.setText(convertNarrative(src.getText())); + for (org.hl7.fhir.r5.model.Resource t : src.getContained()) + tgt.addContained(convertResource(t)); + for (org.hl7.fhir.r5.model.Extension t : src.getExtension()) + tgt.addExtension(convertExtension(t)); + for (org.hl7.fhir.r5.model.Extension t : src.getModifierExtension()) + tgt.addModifierExtension(convertExtension(t)); + } + + protected static void copyResource(org.hl7.fhir.r4.model.Resource src, org.hl7.fhir.r5.model.Resource tgt) throws FHIRException { + if (src.hasId()) + tgt.setIdElement(convertId(src.getIdElement())); + if (src.hasMeta()) + tgt.setMeta(convertMeta(src.getMeta())); + if (src.hasImplicitRules()) + tgt.setImplicitRulesElement(convertUri(src.getImplicitRulesElement())); + if (src.hasLanguage()) + tgt.setLanguageElement(convertCode(src.getLanguageElement())); + } + protected static void copyResource(org.hl7.fhir.r5.model.Resource src, org.hl7.fhir.r4.model.Resource tgt) throws FHIRException { + if (src.hasId()) + tgt.setIdElement(convertId(src.getIdElement())); + if (src.hasMeta()) + tgt.setMeta(convertMeta(src.getMeta())); + if (src.hasImplicitRules()) + tgt.setImplicitRulesElement(convertUri(src.getImplicitRulesElement())); + if (src.hasLanguage()) + tgt.setLanguageElement(convertCode(src.getLanguageElement())); + } + public static org.hl7.fhir.r5.model.Resource convertResource(org.hl7.fhir.r4.model.Resource src) throws FHIRException { + if (src == null) + return null; + if (src instanceof org.hl7.fhir.r4.model.Parameters) + return Parameters.convertParameters((org.hl7.fhir.r4.model.Parameters) src); + if (src instanceof org.hl7.fhir.r4.model.Account) + return Account.convertAccount((org.hl7.fhir.r4.model.Account) src); + if (src instanceof org.hl7.fhir.r4.model.ActivityDefinition) + return ActivityDefinition.convertActivityDefinition((org.hl7.fhir.r4.model.ActivityDefinition) src); + if (src instanceof org.hl7.fhir.r4.model.AdverseEvent) + return AdverseEvent.convertAdverseEvent((org.hl7.fhir.r4.model.AdverseEvent) src); + if (src instanceof org.hl7.fhir.r4.model.AllergyIntolerance) + return AllergyIntolerance.convertAllergyIntolerance((org.hl7.fhir.r4.model.AllergyIntolerance) src); + if (src instanceof org.hl7.fhir.r4.model.Appointment) + return Appointment.convertAppointment((org.hl7.fhir.r4.model.Appointment) src); + if (src instanceof org.hl7.fhir.r4.model.AppointmentResponse) + return AppointmentResponse.convertAppointmentResponse((org.hl7.fhir.r4.model.AppointmentResponse) src); + if (src instanceof org.hl7.fhir.r4.model.AuditEvent) + return AuditEvent.convertAuditEvent((org.hl7.fhir.r4.model.AuditEvent) src); + if (src instanceof org.hl7.fhir.r4.model.Basic) + return Basic.convertBasic((org.hl7.fhir.r4.model.Basic) src); + if (src instanceof org.hl7.fhir.r4.model.Binary) + return Binary.convertBinary((org.hl7.fhir.r4.model.Binary) src); + if (src instanceof org.hl7.fhir.r4.model.BiologicallyDerivedProduct) + return BiologicallyDerivedProduct.convertBiologicallyDerivedProduct((org.hl7.fhir.r4.model.BiologicallyDerivedProduct) src); + if (src instanceof org.hl7.fhir.r4.model.BodyStructure) + return BodyStructure.convertBodyStructure((org.hl7.fhir.r4.model.BodyStructure) src); + if (src instanceof org.hl7.fhir.r4.model.Bundle) + return Bundle.convertBundle((org.hl7.fhir.r4.model.Bundle) src); + if (src instanceof org.hl7.fhir.r4.model.CapabilityStatement) + return CapabilityStatement.convertCapabilityStatement((org.hl7.fhir.r4.model.CapabilityStatement) src); + if (src instanceof org.hl7.fhir.r4.model.CarePlan) + return CarePlan.convertCarePlan((org.hl7.fhir.r4.model.CarePlan) src); + if (src instanceof org.hl7.fhir.r4.model.CareTeam) + return CareTeam.convertCareTeam((org.hl7.fhir.r4.model.CareTeam) src); + if (src instanceof org.hl7.fhir.r4.model.CatalogEntry) + return CatalogEntry.convertCatalogEntry((org.hl7.fhir.r4.model.CatalogEntry) src); + if (src instanceof org.hl7.fhir.r4.model.ChargeItem) + return ChargeItem.convertChargeItem((org.hl7.fhir.r4.model.ChargeItem) src); + if (src instanceof org.hl7.fhir.r4.model.ChargeItemDefinition) + return ChargeItemDefinition.convertChargeItemDefinition((org.hl7.fhir.r4.model.ChargeItemDefinition) src); + if (src instanceof org.hl7.fhir.r4.model.Claim) + return Claim.convertClaim((org.hl7.fhir.r4.model.Claim) src); + if (src instanceof org.hl7.fhir.r4.model.ClaimResponse) + return ClaimResponse.convertClaimResponse((org.hl7.fhir.r4.model.ClaimResponse) src); + if (src instanceof org.hl7.fhir.r4.model.ClinicalImpression) + return ClinicalImpression.convertClinicalImpression((org.hl7.fhir.r4.model.ClinicalImpression) src); + if (src instanceof org.hl7.fhir.r4.model.CodeSystem) + return CodeSystem.convertCodeSystem((org.hl7.fhir.r4.model.CodeSystem) src); + if (src instanceof org.hl7.fhir.r4.model.Communication) + return Communication.convertCommunication((org.hl7.fhir.r4.model.Communication) src); + if (src instanceof org.hl7.fhir.r4.model.CommunicationRequest) + return CommunicationRequest.convertCommunicationRequest((org.hl7.fhir.r4.model.CommunicationRequest) src); + if (src instanceof org.hl7.fhir.r4.model.CompartmentDefinition) + return CompartmentDefinition.convertCompartmentDefinition((org.hl7.fhir.r4.model.CompartmentDefinition) src); + if (src instanceof org.hl7.fhir.r4.model.Composition) + return Composition.convertComposition((org.hl7.fhir.r4.model.Composition) src); + if (src instanceof org.hl7.fhir.r4.model.ConceptMap) + return ConceptMap.convertConceptMap((org.hl7.fhir.r4.model.ConceptMap) src); + if (src instanceof org.hl7.fhir.r4.model.Condition) + return Condition.convertCondition((org.hl7.fhir.r4.model.Condition) src); + if (src instanceof org.hl7.fhir.r4.model.Consent) + return Consent.convertConsent((org.hl7.fhir.r4.model.Consent) src); + if (src instanceof org.hl7.fhir.r4.model.Contract) + return Contract.convertContract((org.hl7.fhir.r4.model.Contract) src); + if (src instanceof org.hl7.fhir.r4.model.Coverage) + return Coverage.convertCoverage((org.hl7.fhir.r4.model.Coverage) src); + if (src instanceof org.hl7.fhir.r4.model.CoverageEligibilityRequest) + return CoverageEligibilityRequest.convertCoverageEligibilityRequest((org.hl7.fhir.r4.model.CoverageEligibilityRequest) src); + if (src instanceof org.hl7.fhir.r4.model.CoverageEligibilityResponse) + return CoverageEligibilityResponse.convertCoverageEligibilityResponse((org.hl7.fhir.r4.model.CoverageEligibilityResponse) src); + if (src instanceof org.hl7.fhir.r4.model.DetectedIssue) + return DetectedIssue.convertDetectedIssue((org.hl7.fhir.r4.model.DetectedIssue) src); + if (src instanceof org.hl7.fhir.r4.model.Device) + return Device.convertDevice((org.hl7.fhir.r4.model.Device) src); + if (src instanceof org.hl7.fhir.r4.model.DeviceDefinition) + return DeviceDefinition.convertDeviceDefinition((org.hl7.fhir.r4.model.DeviceDefinition) src); + if (src instanceof org.hl7.fhir.r4.model.DeviceMetric) + return DeviceMetric.convertDeviceMetric((org.hl7.fhir.r4.model.DeviceMetric) src); + if (src instanceof org.hl7.fhir.r4.model.DeviceRequest) + return DeviceRequest.convertDeviceRequest((org.hl7.fhir.r4.model.DeviceRequest) src); + if (src instanceof org.hl7.fhir.r4.model.DeviceUseStatement) + return DeviceUseStatement.convertDeviceUseStatement((org.hl7.fhir.r4.model.DeviceUseStatement) src); + if (src instanceof org.hl7.fhir.r4.model.DiagnosticReport) + return DiagnosticReport.convertDiagnosticReport((org.hl7.fhir.r4.model.DiagnosticReport) src); + if (src instanceof org.hl7.fhir.r4.model.DocumentManifest) + return DocumentManifest.convertDocumentManifest((org.hl7.fhir.r4.model.DocumentManifest) src); + if (src instanceof org.hl7.fhir.r4.model.DocumentReference) + return DocumentReference.convertDocumentReference((org.hl7.fhir.r4.model.DocumentReference) src); + if (src instanceof org.hl7.fhir.r4.model.EffectEvidenceSynthesis) + return EffectEvidenceSynthesis.convertEffectEvidenceSynthesis((org.hl7.fhir.r4.model.EffectEvidenceSynthesis) src); + if (src instanceof org.hl7.fhir.r4.model.Encounter) + return Encounter.convertEncounter((org.hl7.fhir.r4.model.Encounter) src); + if (src instanceof org.hl7.fhir.r4.model.Endpoint) + return Endpoint.convertEndpoint((org.hl7.fhir.r4.model.Endpoint) src); + if (src instanceof org.hl7.fhir.r4.model.EnrollmentRequest) + return EnrollmentRequest.convertEnrollmentRequest((org.hl7.fhir.r4.model.EnrollmentRequest) src); + if (src instanceof org.hl7.fhir.r4.model.EnrollmentResponse) + return EnrollmentResponse.convertEnrollmentResponse((org.hl7.fhir.r4.model.EnrollmentResponse) src); + if (src instanceof org.hl7.fhir.r4.model.EpisodeOfCare) + return EpisodeOfCare.convertEpisodeOfCare((org.hl7.fhir.r4.model.EpisodeOfCare) src); + if (src instanceof org.hl7.fhir.r4.model.EventDefinition) + return EventDefinition.convertEventDefinition((org.hl7.fhir.r4.model.EventDefinition) src); + if (src instanceof org.hl7.fhir.r4.model.Evidence) + return Evidence.convertEvidence((org.hl7.fhir.r4.model.Evidence) src); + if (src instanceof org.hl7.fhir.r4.model.EvidenceVariable) + return EvidenceVariable.convertEvidenceVariable((org.hl7.fhir.r4.model.EvidenceVariable) src); + if (src instanceof org.hl7.fhir.r4.model.ExampleScenario) + return ExampleScenario.convertExampleScenario((org.hl7.fhir.r4.model.ExampleScenario) src); + if (src instanceof org.hl7.fhir.r4.model.ExplanationOfBenefit) + return ExplanationOfBenefit.convertExplanationOfBenefit((org.hl7.fhir.r4.model.ExplanationOfBenefit) src); + if (src instanceof org.hl7.fhir.r4.model.FamilyMemberHistory) + return FamilyMemberHistory.convertFamilyMemberHistory((org.hl7.fhir.r4.model.FamilyMemberHistory) src); + if (src instanceof org.hl7.fhir.r4.model.Flag) + return Flag.convertFlag((org.hl7.fhir.r4.model.Flag) src); + if (src instanceof org.hl7.fhir.r4.model.Goal) + return Goal.convertGoal((org.hl7.fhir.r4.model.Goal) src); + if (src instanceof org.hl7.fhir.r4.model.GraphDefinition) + return GraphDefinition.convertGraphDefinition((org.hl7.fhir.r4.model.GraphDefinition) src); + if (src instanceof org.hl7.fhir.r4.model.Group) + return Group.convertGroup((org.hl7.fhir.r4.model.Group) src); + if (src instanceof org.hl7.fhir.r4.model.GuidanceResponse) + return GuidanceResponse.convertGuidanceResponse((org.hl7.fhir.r4.model.GuidanceResponse) src); + if (src instanceof org.hl7.fhir.r4.model.HealthcareService) + return HealthcareService.convertHealthcareService((org.hl7.fhir.r4.model.HealthcareService) src); + if (src instanceof org.hl7.fhir.r4.model.ImagingStudy) + return ImagingStudy.convertImagingStudy((org.hl7.fhir.r4.model.ImagingStudy) src); + if (src instanceof org.hl7.fhir.r4.model.Immunization) + return Immunization.convertImmunization((org.hl7.fhir.r4.model.Immunization) src); + if (src instanceof org.hl7.fhir.r4.model.ImmunizationEvaluation) + return ImmunizationEvaluation.convertImmunizationEvaluation((org.hl7.fhir.r4.model.ImmunizationEvaluation) src); + if (src instanceof org.hl7.fhir.r4.model.ImmunizationRecommendation) + return ImmunizationRecommendation.convertImmunizationRecommendation((org.hl7.fhir.r4.model.ImmunizationRecommendation) src); + if (src instanceof org.hl7.fhir.r4.model.ImplementationGuide) + return ImplementationGuide.convertImplementationGuide((org.hl7.fhir.r4.model.ImplementationGuide) src); + if (src instanceof org.hl7.fhir.r4.model.InsurancePlan) + return InsurancePlan.convertInsurancePlan((org.hl7.fhir.r4.model.InsurancePlan) src); + if (src instanceof org.hl7.fhir.r4.model.Invoice) + return Invoice.convertInvoice((org.hl7.fhir.r4.model.Invoice) src); + if (src instanceof org.hl7.fhir.r4.model.Library) + return Library.convertLibrary((org.hl7.fhir.r4.model.Library) src); + if (src instanceof org.hl7.fhir.r4.model.Linkage) + return Linkage.convertLinkage((org.hl7.fhir.r4.model.Linkage) src); + if (src instanceof org.hl7.fhir.r4.model.ListResource) + return ListResource.convertListResource((org.hl7.fhir.r4.model.ListResource) src); + if (src instanceof org.hl7.fhir.r4.model.Location) + return Location.convertLocation((org.hl7.fhir.r4.model.Location) src); + if (src instanceof org.hl7.fhir.r4.model.Measure) + return Measure.convertMeasure((org.hl7.fhir.r4.model.Measure) src); + if (src instanceof org.hl7.fhir.r4.model.MeasureReport) + return MeasureReport.convertMeasureReport((org.hl7.fhir.r4.model.MeasureReport) src); + if (src instanceof org.hl7.fhir.r4.model.Media) + return Media.convertMedia((org.hl7.fhir.r4.model.Media) src); + if (src instanceof org.hl7.fhir.r4.model.Medication) + return Medication.convertMedication((org.hl7.fhir.r4.model.Medication) src); + if (src instanceof org.hl7.fhir.r4.model.MedicationAdministration) + return MedicationAdministration.convertMedicationAdministration((org.hl7.fhir.r4.model.MedicationAdministration) src); + if (src instanceof org.hl7.fhir.r4.model.MedicationDispense) + return MedicationDispense.convertMedicationDispense((org.hl7.fhir.r4.model.MedicationDispense) src); + if (src instanceof org.hl7.fhir.r4.model.MedicationKnowledge) + return MedicationKnowledge.convertMedicationKnowledge((org.hl7.fhir.r4.model.MedicationKnowledge) src); + if (src instanceof org.hl7.fhir.r4.model.MedicationRequest) + return MedicationRequest.convertMedicationRequest((org.hl7.fhir.r4.model.MedicationRequest) src); + if (src instanceof org.hl7.fhir.r4.model.MedicationStatement) + return MedicationStatement.convertMedicationStatement((org.hl7.fhir.r4.model.MedicationStatement) src); + if (src instanceof org.hl7.fhir.r4.model.MedicinalProduct) + return MedicinalProduct.convertMedicinalProduct((org.hl7.fhir.r4.model.MedicinalProduct) src); + if (src instanceof org.hl7.fhir.r4.model.MedicinalProductAuthorization) + return MedicinalProductAuthorization.convertMedicinalProductAuthorization((org.hl7.fhir.r4.model.MedicinalProductAuthorization) src); + if (src instanceof org.hl7.fhir.r4.model.MedicinalProductContraindication) + return MedicinalProductContraindication.convertMedicinalProductContraindication((org.hl7.fhir.r4.model.MedicinalProductContraindication) src); + if (src instanceof org.hl7.fhir.r4.model.MedicinalProductIndication) + return MedicinalProductIndication.convertMedicinalProductIndication((org.hl7.fhir.r4.model.MedicinalProductIndication) src); + if (src instanceof org.hl7.fhir.r4.model.MedicinalProductIngredient) + return MedicinalProductIngredient.convertMedicinalProductIngredient((org.hl7.fhir.r4.model.MedicinalProductIngredient) src); + if (src instanceof org.hl7.fhir.r4.model.MedicinalProductInteraction) + return MedicinalProductInteraction.convertMedicinalProductInteraction((org.hl7.fhir.r4.model.MedicinalProductInteraction) src); + if (src instanceof org.hl7.fhir.r4.model.MedicinalProductManufactured) + return MedicinalProductManufactured.convertMedicinalProductManufactured((org.hl7.fhir.r4.model.MedicinalProductManufactured) src); + if (src instanceof org.hl7.fhir.r4.model.MedicinalProductPackaged) + return MedicinalProductPackaged.convertMedicinalProductPackaged((org.hl7.fhir.r4.model.MedicinalProductPackaged) src); + if (src instanceof org.hl7.fhir.r4.model.MedicinalProductPharmaceutical) + return MedicinalProductPharmaceutical.convertMedicinalProductPharmaceutical((org.hl7.fhir.r4.model.MedicinalProductPharmaceutical) src); + if (src instanceof org.hl7.fhir.r4.model.MedicinalProductUndesirableEffect) + return MedicinalProductUndesirableEffect.convertMedicinalProductUndesirableEffect((org.hl7.fhir.r4.model.MedicinalProductUndesirableEffect) src); + if (src instanceof org.hl7.fhir.r4.model.MessageDefinition) + return MessageDefinition.convertMessageDefinition((org.hl7.fhir.r4.model.MessageDefinition) src); + if (src instanceof org.hl7.fhir.r4.model.MessageHeader) + return MessageHeader.convertMessageHeader((org.hl7.fhir.r4.model.MessageHeader) src); + if (src instanceof org.hl7.fhir.r4.model.MolecularSequence) + return MolecularSequence.convertMolecularSequence((org.hl7.fhir.r4.model.MolecularSequence) src); + if (src instanceof org.hl7.fhir.r4.model.NamingSystem) + return NamingSystem.convertNamingSystem((org.hl7.fhir.r4.model.NamingSystem) src); + if (src instanceof org.hl7.fhir.r4.model.NutritionOrder) + return NutritionOrder.convertNutritionOrder((org.hl7.fhir.r4.model.NutritionOrder) src); + if (src instanceof org.hl7.fhir.r4.model.Observation) + return Observation.convertObservation((org.hl7.fhir.r4.model.Observation) src); + if (src instanceof org.hl7.fhir.r4.model.ObservationDefinition) + return ObservationDefinition.convertObservationDefinition((org.hl7.fhir.r4.model.ObservationDefinition) src); + if (src instanceof org.hl7.fhir.r4.model.OperationDefinition) + return OperationDefinition.convertOperationDefinition((org.hl7.fhir.r4.model.OperationDefinition) src); + if (src instanceof org.hl7.fhir.r4.model.OperationOutcome) + return OperationOutcome.convertOperationOutcome((org.hl7.fhir.r4.model.OperationOutcome) src); + if (src instanceof org.hl7.fhir.r4.model.Organization) + return Organization.convertOrganization((org.hl7.fhir.r4.model.Organization) src); + if (src instanceof org.hl7.fhir.r4.model.OrganizationAffiliation) + return OrganizationAffiliation.convertOrganizationAffiliation((org.hl7.fhir.r4.model.OrganizationAffiliation) src); + if (src instanceof org.hl7.fhir.r4.model.Patient) + return Patient.convertPatient((org.hl7.fhir.r4.model.Patient) src); + if (src instanceof org.hl7.fhir.r4.model.PaymentNotice) + return PaymentNotice.convertPaymentNotice((org.hl7.fhir.r4.model.PaymentNotice) src); + if (src instanceof org.hl7.fhir.r4.model.PaymentReconciliation) + return PaymentReconciliation.convertPaymentReconciliation((org.hl7.fhir.r4.model.PaymentReconciliation) src); + if (src instanceof org.hl7.fhir.r4.model.Person) + return Person.convertPerson((org.hl7.fhir.r4.model.Person) src); + if (src instanceof org.hl7.fhir.r4.model.PlanDefinition) + return PlanDefinition.convertPlanDefinition((org.hl7.fhir.r4.model.PlanDefinition) src); + if (src instanceof org.hl7.fhir.r4.model.Practitioner) + return Practitioner.convertPractitioner((org.hl7.fhir.r4.model.Practitioner) src); + if (src instanceof org.hl7.fhir.r4.model.PractitionerRole) + return PractitionerRole.convertPractitionerRole((org.hl7.fhir.r4.model.PractitionerRole) src); + if (src instanceof org.hl7.fhir.r4.model.Procedure) + return Procedure.convertProcedure((org.hl7.fhir.r4.model.Procedure) src); + if (src instanceof org.hl7.fhir.r4.model.Provenance) + return Provenance.convertProvenance((org.hl7.fhir.r4.model.Provenance) src); + if (src instanceof org.hl7.fhir.r4.model.Questionnaire) + return Questionnaire.convertQuestionnaire((org.hl7.fhir.r4.model.Questionnaire) src); + if (src instanceof org.hl7.fhir.r4.model.QuestionnaireResponse) + return QuestionnaireResponse.convertQuestionnaireResponse((org.hl7.fhir.r4.model.QuestionnaireResponse) src); + if (src instanceof org.hl7.fhir.r4.model.RelatedPerson) + return RelatedPerson.convertRelatedPerson((org.hl7.fhir.r4.model.RelatedPerson) src); + if (src instanceof org.hl7.fhir.r4.model.RequestGroup) + return RequestGroup.convertRequestGroup((org.hl7.fhir.r4.model.RequestGroup) src); + if (src instanceof org.hl7.fhir.r4.model.ResearchDefinition) + return ResearchDefinition.convertResearchDefinition((org.hl7.fhir.r4.model.ResearchDefinition) src); + if (src instanceof org.hl7.fhir.r4.model.ResearchElementDefinition) + return ResearchElementDefinition.convertResearchElementDefinition((org.hl7.fhir.r4.model.ResearchElementDefinition) src); + if (src instanceof org.hl7.fhir.r4.model.ResearchStudy) + return ResearchStudy.convertResearchStudy((org.hl7.fhir.r4.model.ResearchStudy) src); + if (src instanceof org.hl7.fhir.r4.model.ResearchSubject) + return ResearchSubject.convertResearchSubject((org.hl7.fhir.r4.model.ResearchSubject) src); + if (src instanceof org.hl7.fhir.r4.model.RiskAssessment) + return RiskAssessment.convertRiskAssessment((org.hl7.fhir.r4.model.RiskAssessment) src); + if (src instanceof org.hl7.fhir.r4.model.RiskEvidenceSynthesis) + return RiskEvidenceSynthesis.convertRiskEvidenceSynthesis((org.hl7.fhir.r4.model.RiskEvidenceSynthesis) src); + if (src instanceof org.hl7.fhir.r4.model.Schedule) + return Schedule.convertSchedule((org.hl7.fhir.r4.model.Schedule) src); + if (src instanceof org.hl7.fhir.r4.model.SearchParameter) + return SearchParameter.convertSearchParameter((org.hl7.fhir.r4.model.SearchParameter) src); + if (src instanceof org.hl7.fhir.r4.model.ServiceRequest) + return ServiceRequest.convertServiceRequest((org.hl7.fhir.r4.model.ServiceRequest) src); + if (src instanceof org.hl7.fhir.r4.model.Slot) + return Slot.convertSlot((org.hl7.fhir.r4.model.Slot) src); + if (src instanceof org.hl7.fhir.r4.model.Specimen) + return Specimen.convertSpecimen((org.hl7.fhir.r4.model.Specimen) src); + if (src instanceof org.hl7.fhir.r4.model.SpecimenDefinition) + return SpecimenDefinition.convertSpecimenDefinition((org.hl7.fhir.r4.model.SpecimenDefinition) src); + if (src instanceof org.hl7.fhir.r4.model.StructureDefinition) + return StructureDefinition.convertStructureDefinition((org.hl7.fhir.r4.model.StructureDefinition) src); + if (src instanceof org.hl7.fhir.r4.model.StructureMap) + return StructureMap.convertStructureMap((org.hl7.fhir.r4.model.StructureMap) src); + if (src instanceof org.hl7.fhir.r4.model.Subscription) + return Subscription.convertSubscription((org.hl7.fhir.r4.model.Subscription) src); + if (src instanceof org.hl7.fhir.r4.model.Substance) + return Substance.convertSubstance((org.hl7.fhir.r4.model.Substance) src); + if (src instanceof org.hl7.fhir.r4.model.SubstanceNucleicAcid) + return SubstanceNucleicAcid.convertSubstanceNucleicAcid((org.hl7.fhir.r4.model.SubstanceNucleicAcid) src); + if (src instanceof org.hl7.fhir.r4.model.SubstancePolymer) + return SubstancePolymer.convertSubstancePolymer((org.hl7.fhir.r4.model.SubstancePolymer) src); + if (src instanceof org.hl7.fhir.r4.model.SubstanceProtein) + return SubstanceProtein.convertSubstanceProtein((org.hl7.fhir.r4.model.SubstanceProtein) src); + if (src instanceof org.hl7.fhir.r4.model.SubstanceReferenceInformation) + return SubstanceReferenceInformation.convertSubstanceReferenceInformation((org.hl7.fhir.r4.model.SubstanceReferenceInformation) src); + if (src instanceof org.hl7.fhir.r4.model.SubstanceSourceMaterial) + return SubstanceSourceMaterial.convertSubstanceSourceMaterial((org.hl7.fhir.r4.model.SubstanceSourceMaterial) src); + if (src instanceof org.hl7.fhir.r4.model.SubstanceSpecification) + return SubstanceSpecification.convertSubstanceSpecification((org.hl7.fhir.r4.model.SubstanceSpecification) src); + if (src instanceof org.hl7.fhir.r4.model.SupplyDelivery) + return SupplyDelivery.convertSupplyDelivery((org.hl7.fhir.r4.model.SupplyDelivery) src); + if (src instanceof org.hl7.fhir.r4.model.SupplyRequest) + return SupplyRequest.convertSupplyRequest((org.hl7.fhir.r4.model.SupplyRequest) src); + if (src instanceof org.hl7.fhir.r4.model.Task) + return Task.convertTask((org.hl7.fhir.r4.model.Task) src); + if (src instanceof org.hl7.fhir.r4.model.TerminologyCapabilities) + return TerminologyCapabilities.convertTerminologyCapabilities((org.hl7.fhir.r4.model.TerminologyCapabilities) src); + if (src instanceof org.hl7.fhir.r4.model.TestReport) + return TestReport.convertTestReport((org.hl7.fhir.r4.model.TestReport) src); + if (src instanceof org.hl7.fhir.r4.model.TestScript) + return TestScript.convertTestScript((org.hl7.fhir.r4.model.TestScript) src); + if (src instanceof org.hl7.fhir.r4.model.ValueSet) + return ValueSet.convertValueSet((org.hl7.fhir.r4.model.ValueSet) src); + if (src instanceof org.hl7.fhir.r4.model.VerificationResult) + return VerificationResult.convertVerificationResult((org.hl7.fhir.r4.model.VerificationResult) src); + if (src instanceof org.hl7.fhir.r4.model.VisionPrescription) + return VisionPrescription.convertVisionPrescription((org.hl7.fhir.r4.model.VisionPrescription) src); + throw new Error("Unknown resource "+src.fhirType()); + } + + public static org.hl7.fhir.r4.model.Resource convertResource(org.hl7.fhir.r5.model.Resource src) throws FHIRException { + if (src == null) + return null; + if (src instanceof org.hl7.fhir.r5.model.Parameters) + return Parameters.convertParameters((org.hl7.fhir.r5.model.Parameters) src); + if (src instanceof org.hl7.fhir.r5.model.Account) + return Account.convertAccount((org.hl7.fhir.r5.model.Account) src); + if (src instanceof org.hl7.fhir.r5.model.ActivityDefinition) + return ActivityDefinition.convertActivityDefinition((org.hl7.fhir.r5.model.ActivityDefinition) src); + if (src instanceof org.hl7.fhir.r5.model.AdverseEvent) + return AdverseEvent.convertAdverseEvent((org.hl7.fhir.r5.model.AdverseEvent) src); + if (src instanceof org.hl7.fhir.r5.model.AllergyIntolerance) + return AllergyIntolerance.convertAllergyIntolerance((org.hl7.fhir.r5.model.AllergyIntolerance) src); + if (src instanceof org.hl7.fhir.r5.model.Appointment) + return Appointment.convertAppointment((org.hl7.fhir.r5.model.Appointment) src); + if (src instanceof org.hl7.fhir.r5.model.AppointmentResponse) + return AppointmentResponse.convertAppointmentResponse((org.hl7.fhir.r5.model.AppointmentResponse) src); + if (src instanceof org.hl7.fhir.r5.model.AuditEvent) + return AuditEvent.convertAuditEvent((org.hl7.fhir.r5.model.AuditEvent) src); + if (src instanceof org.hl7.fhir.r5.model.Basic) + return Basic.convertBasic((org.hl7.fhir.r5.model.Basic) src); + if (src instanceof org.hl7.fhir.r5.model.Binary) + return Binary.convertBinary((org.hl7.fhir.r5.model.Binary) src); + if (src instanceof org.hl7.fhir.r5.model.BiologicallyDerivedProduct) + return BiologicallyDerivedProduct.convertBiologicallyDerivedProduct((org.hl7.fhir.r5.model.BiologicallyDerivedProduct) src); + if (src instanceof org.hl7.fhir.r5.model.BodyStructure) + return BodyStructure.convertBodyStructure((org.hl7.fhir.r5.model.BodyStructure) src); + if (src instanceof org.hl7.fhir.r5.model.Bundle) + return Bundle.convertBundle((org.hl7.fhir.r5.model.Bundle) src); + if (src instanceof org.hl7.fhir.r5.model.CapabilityStatement) + return CapabilityStatement.convertCapabilityStatement((org.hl7.fhir.r5.model.CapabilityStatement) src); + if (src instanceof org.hl7.fhir.r5.model.CarePlan) + return CarePlan.convertCarePlan((org.hl7.fhir.r5.model.CarePlan) src); + if (src instanceof org.hl7.fhir.r5.model.CareTeam) + return CareTeam.convertCareTeam((org.hl7.fhir.r5.model.CareTeam) src); + if (src instanceof org.hl7.fhir.r5.model.CatalogEntry) + return CatalogEntry.convertCatalogEntry((org.hl7.fhir.r5.model.CatalogEntry) src); + if (src instanceof org.hl7.fhir.r5.model.ChargeItem) + return ChargeItem.convertChargeItem((org.hl7.fhir.r5.model.ChargeItem) src); + if (src instanceof org.hl7.fhir.r5.model.ChargeItemDefinition) + return ChargeItemDefinition.convertChargeItemDefinition((org.hl7.fhir.r5.model.ChargeItemDefinition) src); + if (src instanceof org.hl7.fhir.r5.model.Claim) + return Claim.convertClaim((org.hl7.fhir.r5.model.Claim) src); + if (src instanceof org.hl7.fhir.r5.model.ClaimResponse) + return ClaimResponse.convertClaimResponse((org.hl7.fhir.r5.model.ClaimResponse) src); + if (src instanceof org.hl7.fhir.r5.model.ClinicalImpression) + return ClinicalImpression.convertClinicalImpression((org.hl7.fhir.r5.model.ClinicalImpression) src); + if (src instanceof org.hl7.fhir.r5.model.CodeSystem) + return CodeSystem.convertCodeSystem((org.hl7.fhir.r5.model.CodeSystem) src); + if (src instanceof org.hl7.fhir.r5.model.Communication) + return Communication.convertCommunication((org.hl7.fhir.r5.model.Communication) src); + if (src instanceof org.hl7.fhir.r5.model.CommunicationRequest) + return CommunicationRequest.convertCommunicationRequest((org.hl7.fhir.r5.model.CommunicationRequest) src); + if (src instanceof org.hl7.fhir.r5.model.CompartmentDefinition) + return CompartmentDefinition.convertCompartmentDefinition((org.hl7.fhir.r5.model.CompartmentDefinition) src); + if (src instanceof org.hl7.fhir.r5.model.Composition) + return Composition.convertComposition((org.hl7.fhir.r5.model.Composition) src); + if (src instanceof org.hl7.fhir.r5.model.ConceptMap) + return ConceptMap.convertConceptMap((org.hl7.fhir.r5.model.ConceptMap) src); + if (src instanceof org.hl7.fhir.r5.model.Condition) + return Condition.convertCondition((org.hl7.fhir.r5.model.Condition) src); + if (src instanceof org.hl7.fhir.r5.model.Consent) + return Consent.convertConsent((org.hl7.fhir.r5.model.Consent) src); + if (src instanceof org.hl7.fhir.r5.model.Contract) + return Contract.convertContract((org.hl7.fhir.r5.model.Contract) src); + if (src instanceof org.hl7.fhir.r5.model.Coverage) + return Coverage.convertCoverage((org.hl7.fhir.r5.model.Coverage) src); + if (src instanceof org.hl7.fhir.r5.model.CoverageEligibilityRequest) + return CoverageEligibilityRequest.convertCoverageEligibilityRequest((org.hl7.fhir.r5.model.CoverageEligibilityRequest) src); + if (src instanceof org.hl7.fhir.r5.model.CoverageEligibilityResponse) + return CoverageEligibilityResponse.convertCoverageEligibilityResponse((org.hl7.fhir.r5.model.CoverageEligibilityResponse) src); + if (src instanceof org.hl7.fhir.r5.model.DetectedIssue) + return DetectedIssue.convertDetectedIssue((org.hl7.fhir.r5.model.DetectedIssue) src); + if (src instanceof org.hl7.fhir.r5.model.Device) + return Device.convertDevice((org.hl7.fhir.r5.model.Device) src); + if (src instanceof org.hl7.fhir.r5.model.DeviceDefinition) + return DeviceDefinition.convertDeviceDefinition((org.hl7.fhir.r5.model.DeviceDefinition) src); + if (src instanceof org.hl7.fhir.r5.model.DeviceMetric) + return DeviceMetric.convertDeviceMetric((org.hl7.fhir.r5.model.DeviceMetric) src); + if (src instanceof org.hl7.fhir.r5.model.DeviceRequest) + return DeviceRequest.convertDeviceRequest((org.hl7.fhir.r5.model.DeviceRequest) src); + if (src instanceof org.hl7.fhir.r5.model.DeviceUseStatement) + return DeviceUseStatement.convertDeviceUseStatement((org.hl7.fhir.r5.model.DeviceUseStatement) src); + if (src instanceof org.hl7.fhir.r5.model.DiagnosticReport) + return DiagnosticReport.convertDiagnosticReport((org.hl7.fhir.r5.model.DiagnosticReport) src); + if (src instanceof org.hl7.fhir.r5.model.DocumentManifest) + return DocumentManifest.convertDocumentManifest((org.hl7.fhir.r5.model.DocumentManifest) src); + if (src instanceof org.hl7.fhir.r5.model.DocumentReference) + return DocumentReference.convertDocumentReference((org.hl7.fhir.r5.model.DocumentReference) src); + if (src instanceof org.hl7.fhir.r5.model.EffectEvidenceSynthesis) + return EffectEvidenceSynthesis.convertEffectEvidenceSynthesis((org.hl7.fhir.r5.model.EffectEvidenceSynthesis) src); + if (src instanceof org.hl7.fhir.r5.model.Encounter) + return Encounter.convertEncounter((org.hl7.fhir.r5.model.Encounter) src); + if (src instanceof org.hl7.fhir.r5.model.Endpoint) + return Endpoint.convertEndpoint((org.hl7.fhir.r5.model.Endpoint) src); + if (src instanceof org.hl7.fhir.r5.model.EnrollmentRequest) + return EnrollmentRequest.convertEnrollmentRequest((org.hl7.fhir.r5.model.EnrollmentRequest) src); + if (src instanceof org.hl7.fhir.r5.model.EnrollmentResponse) + return EnrollmentResponse.convertEnrollmentResponse((org.hl7.fhir.r5.model.EnrollmentResponse) src); + if (src instanceof org.hl7.fhir.r5.model.EpisodeOfCare) + return EpisodeOfCare.convertEpisodeOfCare((org.hl7.fhir.r5.model.EpisodeOfCare) src); + if (src instanceof org.hl7.fhir.r5.model.EventDefinition) + return EventDefinition.convertEventDefinition((org.hl7.fhir.r5.model.EventDefinition) src); + if (src instanceof org.hl7.fhir.r5.model.Evidence) + return Evidence.convertEvidence((org.hl7.fhir.r5.model.Evidence) src); + if (src instanceof org.hl7.fhir.r5.model.EvidenceVariable) + return EvidenceVariable.convertEvidenceVariable((org.hl7.fhir.r5.model.EvidenceVariable) src); + if (src instanceof org.hl7.fhir.r5.model.ExampleScenario) + return ExampleScenario.convertExampleScenario((org.hl7.fhir.r5.model.ExampleScenario) src); + if (src instanceof org.hl7.fhir.r5.model.ExplanationOfBenefit) + return ExplanationOfBenefit.convertExplanationOfBenefit((org.hl7.fhir.r5.model.ExplanationOfBenefit) src); + if (src instanceof org.hl7.fhir.r5.model.FamilyMemberHistory) + return FamilyMemberHistory.convertFamilyMemberHistory((org.hl7.fhir.r5.model.FamilyMemberHistory) src); + if (src instanceof org.hl7.fhir.r5.model.Flag) + return Flag.convertFlag((org.hl7.fhir.r5.model.Flag) src); + if (src instanceof org.hl7.fhir.r5.model.Goal) + return Goal.convertGoal((org.hl7.fhir.r5.model.Goal) src); + if (src instanceof org.hl7.fhir.r5.model.GraphDefinition) + return GraphDefinition.convertGraphDefinition((org.hl7.fhir.r5.model.GraphDefinition) src); + if (src instanceof org.hl7.fhir.r5.model.Group) + return Group.convertGroup((org.hl7.fhir.r5.model.Group) src); + if (src instanceof org.hl7.fhir.r5.model.GuidanceResponse) + return GuidanceResponse.convertGuidanceResponse((org.hl7.fhir.r5.model.GuidanceResponse) src); + if (src instanceof org.hl7.fhir.r5.model.HealthcareService) + return HealthcareService.convertHealthcareService((org.hl7.fhir.r5.model.HealthcareService) src); + if (src instanceof org.hl7.fhir.r5.model.ImagingStudy) + return ImagingStudy.convertImagingStudy((org.hl7.fhir.r5.model.ImagingStudy) src); + if (src instanceof org.hl7.fhir.r5.model.Immunization) + return Immunization.convertImmunization((org.hl7.fhir.r5.model.Immunization) src); + if (src instanceof org.hl7.fhir.r5.model.ImmunizationEvaluation) + return ImmunizationEvaluation.convertImmunizationEvaluation((org.hl7.fhir.r5.model.ImmunizationEvaluation) src); + if (src instanceof org.hl7.fhir.r5.model.ImmunizationRecommendation) + return ImmunizationRecommendation.convertImmunizationRecommendation((org.hl7.fhir.r5.model.ImmunizationRecommendation) src); + if (src instanceof org.hl7.fhir.r5.model.ImplementationGuide) + return ImplementationGuide.convertImplementationGuide((org.hl7.fhir.r5.model.ImplementationGuide) src); + if (src instanceof org.hl7.fhir.r5.model.InsurancePlan) + return InsurancePlan.convertInsurancePlan((org.hl7.fhir.r5.model.InsurancePlan) src); + if (src instanceof org.hl7.fhir.r5.model.Invoice) + return Invoice.convertInvoice((org.hl7.fhir.r5.model.Invoice) src); + if (src instanceof org.hl7.fhir.r5.model.Library) + return Library.convertLibrary((org.hl7.fhir.r5.model.Library) src); + if (src instanceof org.hl7.fhir.r5.model.Linkage) + return Linkage.convertLinkage((org.hl7.fhir.r5.model.Linkage) src); + if (src instanceof org.hl7.fhir.r5.model.ListResource) + return ListResource.convertListResource((org.hl7.fhir.r5.model.ListResource) src); + if (src instanceof org.hl7.fhir.r5.model.Location) + return Location.convertLocation((org.hl7.fhir.r5.model.Location) src); + if (src instanceof org.hl7.fhir.r5.model.Measure) + return Measure.convertMeasure((org.hl7.fhir.r5.model.Measure) src); + if (src instanceof org.hl7.fhir.r5.model.MeasureReport) + return MeasureReport.convertMeasureReport((org.hl7.fhir.r5.model.MeasureReport) src); + if (src instanceof org.hl7.fhir.r5.model.Media) + return Media.convertMedia((org.hl7.fhir.r5.model.Media) src); + if (src instanceof org.hl7.fhir.r5.model.Medication) + return Medication.convertMedication((org.hl7.fhir.r5.model.Medication) src); + if (src instanceof org.hl7.fhir.r5.model.MedicationAdministration) + return MedicationAdministration.convertMedicationAdministration((org.hl7.fhir.r5.model.MedicationAdministration) src); + if (src instanceof org.hl7.fhir.r5.model.MedicationDispense) + return MedicationDispense.convertMedicationDispense((org.hl7.fhir.r5.model.MedicationDispense) src); + if (src instanceof org.hl7.fhir.r5.model.MedicationKnowledge) + return MedicationKnowledge.convertMedicationKnowledge((org.hl7.fhir.r5.model.MedicationKnowledge) src); + if (src instanceof org.hl7.fhir.r5.model.MedicationRequest) + return MedicationRequest.convertMedicationRequest((org.hl7.fhir.r5.model.MedicationRequest) src); + if (src instanceof org.hl7.fhir.r5.model.MedicationStatement) + return MedicationStatement.convertMedicationStatement((org.hl7.fhir.r5.model.MedicationStatement) src); + if (src instanceof org.hl7.fhir.r5.model.MedicinalProduct) + return MedicinalProduct.convertMedicinalProduct((org.hl7.fhir.r5.model.MedicinalProduct) src); + if (src instanceof org.hl7.fhir.r5.model.MedicinalProductAuthorization) + return MedicinalProductAuthorization.convertMedicinalProductAuthorization((org.hl7.fhir.r5.model.MedicinalProductAuthorization) src); + if (src instanceof org.hl7.fhir.r5.model.MedicinalProductContraindication) + return MedicinalProductContraindication.convertMedicinalProductContraindication((org.hl7.fhir.r5.model.MedicinalProductContraindication) src); + if (src instanceof org.hl7.fhir.r5.model.MedicinalProductIndication) + return MedicinalProductIndication.convertMedicinalProductIndication((org.hl7.fhir.r5.model.MedicinalProductIndication) src); + if (src instanceof org.hl7.fhir.r5.model.MedicinalProductIngredient) + return MedicinalProductIngredient.convertMedicinalProductIngredient((org.hl7.fhir.r5.model.MedicinalProductIngredient) src); + if (src instanceof org.hl7.fhir.r5.model.MedicinalProductInteraction) + return MedicinalProductInteraction.convertMedicinalProductInteraction((org.hl7.fhir.r5.model.MedicinalProductInteraction) src); + if (src instanceof org.hl7.fhir.r5.model.MedicinalProductManufactured) + return MedicinalProductManufactured.convertMedicinalProductManufactured((org.hl7.fhir.r5.model.MedicinalProductManufactured) src); + if (src instanceof org.hl7.fhir.r5.model.MedicinalProductPackaged) + return MedicinalProductPackaged.convertMedicinalProductPackaged((org.hl7.fhir.r5.model.MedicinalProductPackaged) src); + if (src instanceof org.hl7.fhir.r5.model.MedicinalProductPharmaceutical) + return MedicinalProductPharmaceutical.convertMedicinalProductPharmaceutical((org.hl7.fhir.r5.model.MedicinalProductPharmaceutical) src); + if (src instanceof org.hl7.fhir.r5.model.MedicinalProductUndesirableEffect) + return MedicinalProductUndesirableEffect.convertMedicinalProductUndesirableEffect((org.hl7.fhir.r5.model.MedicinalProductUndesirableEffect) src); + if (src instanceof org.hl7.fhir.r5.model.MessageDefinition) + return MessageDefinition.convertMessageDefinition((org.hl7.fhir.r5.model.MessageDefinition) src); + if (src instanceof org.hl7.fhir.r5.model.MessageHeader) + return MessageHeader.convertMessageHeader((org.hl7.fhir.r5.model.MessageHeader) src); + if (src instanceof org.hl7.fhir.r5.model.MolecularSequence) + return MolecularSequence.convertMolecularSequence((org.hl7.fhir.r5.model.MolecularSequence) src); + if (src instanceof org.hl7.fhir.r5.model.NamingSystem) + return NamingSystem.convertNamingSystem((org.hl7.fhir.r5.model.NamingSystem) src); + if (src instanceof org.hl7.fhir.r5.model.NutritionOrder) + return NutritionOrder.convertNutritionOrder((org.hl7.fhir.r5.model.NutritionOrder) src); + if (src instanceof org.hl7.fhir.r5.model.Observation) + return Observation.convertObservation((org.hl7.fhir.r5.model.Observation) src); + if (src instanceof org.hl7.fhir.r5.model.ObservationDefinition) + return ObservationDefinition.convertObservationDefinition((org.hl7.fhir.r5.model.ObservationDefinition) src); + if (src instanceof org.hl7.fhir.r5.model.OperationDefinition) + return OperationDefinition.convertOperationDefinition((org.hl7.fhir.r5.model.OperationDefinition) src); + if (src instanceof org.hl7.fhir.r5.model.OperationOutcome) + return OperationOutcome.convertOperationOutcome((org.hl7.fhir.r5.model.OperationOutcome) src); + if (src instanceof org.hl7.fhir.r5.model.Organization) + return Organization.convertOrganization((org.hl7.fhir.r5.model.Organization) src); + if (src instanceof org.hl7.fhir.r5.model.OrganizationAffiliation) + return OrganizationAffiliation.convertOrganizationAffiliation((org.hl7.fhir.r5.model.OrganizationAffiliation) src); + if (src instanceof org.hl7.fhir.r5.model.Patient) + return Patient.convertPatient((org.hl7.fhir.r5.model.Patient) src); + if (src instanceof org.hl7.fhir.r5.model.PaymentNotice) + return PaymentNotice.convertPaymentNotice((org.hl7.fhir.r5.model.PaymentNotice) src); + if (src instanceof org.hl7.fhir.r5.model.PaymentReconciliation) + return PaymentReconciliation.convertPaymentReconciliation((org.hl7.fhir.r5.model.PaymentReconciliation) src); + if (src instanceof org.hl7.fhir.r5.model.Person) + return Person.convertPerson((org.hl7.fhir.r5.model.Person) src); + if (src instanceof org.hl7.fhir.r5.model.PlanDefinition) + return PlanDefinition.convertPlanDefinition((org.hl7.fhir.r5.model.PlanDefinition) src); + if (src instanceof org.hl7.fhir.r5.model.Practitioner) + return Practitioner.convertPractitioner((org.hl7.fhir.r5.model.Practitioner) src); + if (src instanceof org.hl7.fhir.r5.model.PractitionerRole) + return PractitionerRole.convertPractitionerRole((org.hl7.fhir.r5.model.PractitionerRole) src); + if (src instanceof org.hl7.fhir.r5.model.Procedure) + return Procedure.convertProcedure((org.hl7.fhir.r5.model.Procedure) src); + if (src instanceof org.hl7.fhir.r5.model.Provenance) + return Provenance.convertProvenance((org.hl7.fhir.r5.model.Provenance) src); + if (src instanceof org.hl7.fhir.r5.model.Questionnaire) + return Questionnaire.convertQuestionnaire((org.hl7.fhir.r5.model.Questionnaire) src); + if (src instanceof org.hl7.fhir.r5.model.QuestionnaireResponse) + return QuestionnaireResponse.convertQuestionnaireResponse((org.hl7.fhir.r5.model.QuestionnaireResponse) src); + if (src instanceof org.hl7.fhir.r5.model.RelatedPerson) + return RelatedPerson.convertRelatedPerson((org.hl7.fhir.r5.model.RelatedPerson) src); + if (src instanceof org.hl7.fhir.r5.model.RequestGroup) + return RequestGroup.convertRequestGroup((org.hl7.fhir.r5.model.RequestGroup) src); + if (src instanceof org.hl7.fhir.r5.model.ResearchDefinition) + return ResearchDefinition.convertResearchDefinition((org.hl7.fhir.r5.model.ResearchDefinition) src); + if (src instanceof org.hl7.fhir.r5.model.ResearchElementDefinition) + return ResearchElementDefinition.convertResearchElementDefinition((org.hl7.fhir.r5.model.ResearchElementDefinition) src); + if (src instanceof org.hl7.fhir.r5.model.ResearchStudy) + return ResearchStudy.convertResearchStudy((org.hl7.fhir.r5.model.ResearchStudy) src); + if (src instanceof org.hl7.fhir.r5.model.ResearchSubject) + return ResearchSubject.convertResearchSubject((org.hl7.fhir.r5.model.ResearchSubject) src); + if (src instanceof org.hl7.fhir.r5.model.RiskAssessment) + return RiskAssessment.convertRiskAssessment((org.hl7.fhir.r5.model.RiskAssessment) src); + if (src instanceof org.hl7.fhir.r5.model.RiskEvidenceSynthesis) + return RiskEvidenceSynthesis.convertRiskEvidenceSynthesis((org.hl7.fhir.r5.model.RiskEvidenceSynthesis) src); + if (src instanceof org.hl7.fhir.r5.model.Schedule) + return Schedule.convertSchedule((org.hl7.fhir.r5.model.Schedule) src); + if (src instanceof org.hl7.fhir.r5.model.SearchParameter) + return SearchParameter.convertSearchParameter((org.hl7.fhir.r5.model.SearchParameter) src); + if (src instanceof org.hl7.fhir.r5.model.ServiceRequest) + return ServiceRequest.convertServiceRequest((org.hl7.fhir.r5.model.ServiceRequest) src); + if (src instanceof org.hl7.fhir.r5.model.Slot) + return Slot.convertSlot((org.hl7.fhir.r5.model.Slot) src); + if (src instanceof org.hl7.fhir.r5.model.Specimen) + return Specimen.convertSpecimen((org.hl7.fhir.r5.model.Specimen) src); + if (src instanceof org.hl7.fhir.r5.model.SpecimenDefinition) + return SpecimenDefinition.convertSpecimenDefinition((org.hl7.fhir.r5.model.SpecimenDefinition) src); + if (src instanceof org.hl7.fhir.r5.model.StructureDefinition) + return StructureDefinition.convertStructureDefinition((org.hl7.fhir.r5.model.StructureDefinition) src); + if (src instanceof org.hl7.fhir.r5.model.StructureMap) + return StructureMap.convertStructureMap((org.hl7.fhir.r5.model.StructureMap) src); + if (src instanceof org.hl7.fhir.r5.model.Subscription) + return Subscription.convertSubscription((org.hl7.fhir.r5.model.Subscription) src); + if (src instanceof org.hl7.fhir.r5.model.Substance) + return Substance.convertSubstance((org.hl7.fhir.r5.model.Substance) src); + if (src instanceof org.hl7.fhir.r5.model.SubstanceNucleicAcid) + return SubstanceNucleicAcid.convertSubstanceNucleicAcid((org.hl7.fhir.r5.model.SubstanceNucleicAcid) src); + if (src instanceof org.hl7.fhir.r5.model.SubstancePolymer) + return SubstancePolymer.convertSubstancePolymer((org.hl7.fhir.r5.model.SubstancePolymer) src); + if (src instanceof org.hl7.fhir.r5.model.SubstanceProtein) + return SubstanceProtein.convertSubstanceProtein((org.hl7.fhir.r5.model.SubstanceProtein) src); + if (src instanceof org.hl7.fhir.r5.model.SubstanceReferenceInformation) + return SubstanceReferenceInformation.convertSubstanceReferenceInformation((org.hl7.fhir.r5.model.SubstanceReferenceInformation) src); + if (src instanceof org.hl7.fhir.r5.model.SubstanceSourceMaterial) + return SubstanceSourceMaterial.convertSubstanceSourceMaterial((org.hl7.fhir.r5.model.SubstanceSourceMaterial) src); + if (src instanceof org.hl7.fhir.r5.model.SubstanceSpecification) + return SubstanceSpecification.convertSubstanceSpecification((org.hl7.fhir.r5.model.SubstanceSpecification) src); + if (src instanceof org.hl7.fhir.r5.model.SupplyDelivery) + return SupplyDelivery.convertSupplyDelivery((org.hl7.fhir.r5.model.SupplyDelivery) src); + if (src instanceof org.hl7.fhir.r5.model.SupplyRequest) + return SupplyRequest.convertSupplyRequest((org.hl7.fhir.r5.model.SupplyRequest) src); + if (src instanceof org.hl7.fhir.r5.model.Task) + return Task.convertTask((org.hl7.fhir.r5.model.Task) src); + if (src instanceof org.hl7.fhir.r5.model.TerminologyCapabilities) + return TerminologyCapabilities.convertTerminologyCapabilities((org.hl7.fhir.r5.model.TerminologyCapabilities) src); + if (src instanceof org.hl7.fhir.r5.model.TestReport) + return TestReport.convertTestReport((org.hl7.fhir.r5.model.TestReport) src); + if (src instanceof org.hl7.fhir.r5.model.TestScript) + return TestScript.convertTestScript((org.hl7.fhir.r5.model.TestScript) src); + if (src instanceof org.hl7.fhir.r5.model.ValueSet) + return ValueSet.convertValueSet((org.hl7.fhir.r5.model.ValueSet) src); + if (src instanceof org.hl7.fhir.r5.model.VerificationResult) + return VerificationResult.convertVerificationResult((org.hl7.fhir.r5.model.VerificationResult) src); + if (src instanceof org.hl7.fhir.r5.model.VisionPrescription) + return VisionPrescription.convertVisionPrescription((org.hl7.fhir.r5.model.VisionPrescription) src); + throw new Error("Unknown resource "+src.fhirType()); + } + + +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Account.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Account.java new file mode 100644 index 000000000..58bb9c3ca --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Account.java @@ -0,0 +1,181 @@ +package org.hl7.fhir.convertors.conv40_50; + +import org.hl7.fhir.exceptions.FHIRException; + +import org.hl7.fhir.convertors.VersionConvertor_40_50; + + +/* + Copyright (c) 2011+, HL7, Inc. + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of HL7 nor the names of its contributors may be used to + endorse or promote products derived from this software without specific + prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + +*/ + +// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0 + + +public class Account extends VersionConvertor_40_50 { + + public static org.hl7.fhir.r5.model.Account convertAccount(org.hl7.fhir.r4.model.Account src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Account tgt = new org.hl7.fhir.r5.model.Account(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasStatus()) + tgt.setStatus(convertAccountStatus(src.getStatus())); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + if (src.hasName()) + tgt.setNameElement(convertString(src.getNameElement())); + for (org.hl7.fhir.r4.model.Reference t : src.getSubject()) + tgt.addSubject(convertReference(t)); + if (src.hasServicePeriod()) + tgt.setServicePeriod(convertPeriod(src.getServicePeriod())); + for (org.hl7.fhir.r4.model.Account.CoverageComponent t : src.getCoverage()) + tgt.addCoverage(convertCoverageComponent(t)); + if (src.hasOwner()) + tgt.setOwner(convertReference(src.getOwner())); + if (src.hasDescription()) + tgt.setDescriptionElement(convertString(src.getDescriptionElement())); + for (org.hl7.fhir.r4.model.Account.GuarantorComponent t : src.getGuarantor()) + tgt.addGuarantor(convertGuarantorComponent(t)); + if (src.hasPartOf()) + tgt.setPartOf(convertReference(src.getPartOf())); + return tgt; + } + + public static org.hl7.fhir.r4.model.Account convertAccount(org.hl7.fhir.r5.model.Account src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Account tgt = new org.hl7.fhir.r4.model.Account(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasStatus()) + tgt.setStatus(convertAccountStatus(src.getStatus())); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + if (src.hasName()) + tgt.setNameElement(convertString(src.getNameElement())); + for (org.hl7.fhir.r5.model.Reference t : src.getSubject()) + tgt.addSubject(convertReference(t)); + if (src.hasServicePeriod()) + tgt.setServicePeriod(convertPeriod(src.getServicePeriod())); + for (org.hl7.fhir.r5.model.Account.CoverageComponent t : src.getCoverage()) + tgt.addCoverage(convertCoverageComponent(t)); + if (src.hasOwner()) + tgt.setOwner(convertReference(src.getOwner())); + if (src.hasDescription()) + tgt.setDescriptionElement(convertString(src.getDescriptionElement())); + for (org.hl7.fhir.r5.model.Account.GuarantorComponent t : src.getGuarantor()) + tgt.addGuarantor(convertGuarantorComponent(t)); + if (src.hasPartOf()) + tgt.setPartOf(convertReference(src.getPartOf())); + return tgt; + } + + public static org.hl7.fhir.r5.model.Account.AccountStatus convertAccountStatus(org.hl7.fhir.r4.model.Account.AccountStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case ACTIVE: return org.hl7.fhir.r5.model.Account.AccountStatus.ACTIVE; + case INACTIVE: return org.hl7.fhir.r5.model.Account.AccountStatus.INACTIVE; + case ENTEREDINERROR: return org.hl7.fhir.r5.model.Account.AccountStatus.ENTEREDINERROR; + case ONHOLD: return org.hl7.fhir.r5.model.Account.AccountStatus.ONHOLD; + case UNKNOWN: return org.hl7.fhir.r5.model.Account.AccountStatus.UNKNOWN; + default: return org.hl7.fhir.r5.model.Account.AccountStatus.NULL; + } +} + + public static org.hl7.fhir.r4.model.Account.AccountStatus convertAccountStatus(org.hl7.fhir.r5.model.Account.AccountStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case ACTIVE: return org.hl7.fhir.r4.model.Account.AccountStatus.ACTIVE; + case INACTIVE: return org.hl7.fhir.r4.model.Account.AccountStatus.INACTIVE; + case ENTEREDINERROR: return org.hl7.fhir.r4.model.Account.AccountStatus.ENTEREDINERROR; + case ONHOLD: return org.hl7.fhir.r4.model.Account.AccountStatus.ONHOLD; + case UNKNOWN: return org.hl7.fhir.r4.model.Account.AccountStatus.UNKNOWN; + default: return org.hl7.fhir.r4.model.Account.AccountStatus.NULL; + } +} + + public static org.hl7.fhir.r5.model.Account.CoverageComponent convertCoverageComponent(org.hl7.fhir.r4.model.Account.CoverageComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Account.CoverageComponent tgt = new org.hl7.fhir.r5.model.Account.CoverageComponent(); + copyElement(src, tgt); + if (src.hasCoverage()) + tgt.setCoverage(convertReference(src.getCoverage())); + if (src.hasPriority()) + tgt.setPriorityElement(convertPositiveInt(src.getPriorityElement())); + return tgt; + } + + public static org.hl7.fhir.r4.model.Account.CoverageComponent convertCoverageComponent(org.hl7.fhir.r5.model.Account.CoverageComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Account.CoverageComponent tgt = new org.hl7.fhir.r4.model.Account.CoverageComponent(); + copyElement(src, tgt); + if (src.hasCoverage()) + tgt.setCoverage(convertReference(src.getCoverage())); + if (src.hasPriority()) + tgt.setPriorityElement(convertPositiveInt(src.getPriorityElement())); + return tgt; + } + + public static org.hl7.fhir.r5.model.Account.GuarantorComponent convertGuarantorComponent(org.hl7.fhir.r4.model.Account.GuarantorComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Account.GuarantorComponent tgt = new org.hl7.fhir.r5.model.Account.GuarantorComponent(); + copyElement(src, tgt); + if (src.hasParty()) + tgt.setParty(convertReference(src.getParty())); + if (src.hasOnHold()) + tgt.setOnHoldElement(convertBoolean(src.getOnHoldElement())); + if (src.hasPeriod()) + tgt.setPeriod(convertPeriod(src.getPeriod())); + return tgt; + } + + public static org.hl7.fhir.r4.model.Account.GuarantorComponent convertGuarantorComponent(org.hl7.fhir.r5.model.Account.GuarantorComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Account.GuarantorComponent tgt = new org.hl7.fhir.r4.model.Account.GuarantorComponent(); + copyElement(src, tgt); + if (src.hasParty()) + tgt.setParty(convertReference(src.getParty())); + if (src.hasOnHold()) + tgt.setOnHoldElement(convertBoolean(src.getOnHoldElement())); + if (src.hasPeriod()) + tgt.setPeriod(convertPeriod(src.getPeriod())); + return tgt; + } + + +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/ActivityDefinition.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/ActivityDefinition.java new file mode 100644 index 000000000..cccfcf278 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/ActivityDefinition.java @@ -0,0 +1,419 @@ +package org.hl7.fhir.convertors.conv40_50; + +import org.hl7.fhir.exceptions.FHIRException; + +import org.hl7.fhir.convertors.VersionConvertor_40_50; + + +/* + Copyright (c) 2011+, HL7, Inc. + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of HL7 nor the names of its contributors may be used to + endorse or promote products derived from this software without specific + prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + +*/ + +// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0 + + +public class ActivityDefinition extends VersionConvertor_40_50 { + + public static org.hl7.fhir.r5.model.ActivityDefinition convertActivityDefinition(org.hl7.fhir.r4.model.ActivityDefinition src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ActivityDefinition tgt = new org.hl7.fhir.r5.model.ActivityDefinition(); + copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrlElement(convertUri(src.getUrlElement())); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasVersion()) + tgt.setVersionElement(convertString(src.getVersionElement())); + if (src.hasName()) + tgt.setNameElement(convertString(src.getNameElement())); + if (src.hasTitle()) + tgt.setTitleElement(convertString(src.getTitleElement())); + if (src.hasSubtitle()) + tgt.setSubtitleElement(convertString(src.getSubtitleElement())); + if (src.hasStatus()) + tgt.setStatus(Enumerations.convertPublicationStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimentalElement(convertBoolean(src.getExperimentalElement())); + if (src.hasSubject()) + tgt.setSubject(convertType(src.getSubject())); + if (src.hasDate()) + tgt.setDateElement(convertDateTime(src.getDateElement())); + if (src.hasPublisher()) + tgt.setPublisherElement(convertString(src.getPublisherElement())); + for (org.hl7.fhir.r4.model.ContactDetail t : src.getContact()) + tgt.addContact(convertContactDetail(t)); + if (src.hasDescription()) + tgt.setDescriptionElement(convertMarkdown(src.getDescriptionElement())); + for (org.hl7.fhir.r4.model.UsageContext t : src.getUseContext()) + tgt.addUseContext(convertUsageContext(t)); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getJurisdiction()) + tgt.addJurisdiction(convertCodeableConcept(t)); + if (src.hasPurpose()) + tgt.setPurposeElement(convertMarkdown(src.getPurposeElement())); + if (src.hasUsage()) + tgt.setUsageElement(convertString(src.getUsageElement())); + if (src.hasCopyright()) + tgt.setCopyrightElement(convertMarkdown(src.getCopyrightElement())); + if (src.hasApprovalDate()) + tgt.setApprovalDateElement(convertDate(src.getApprovalDateElement())); + if (src.hasLastReviewDate()) + tgt.setLastReviewDateElement(convertDate(src.getLastReviewDateElement())); + if (src.hasEffectivePeriod()) + tgt.setEffectivePeriod(convertPeriod(src.getEffectivePeriod())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getTopic()) + tgt.addTopic(convertCodeableConcept(t)); + for (org.hl7.fhir.r4.model.ContactDetail t : src.getAuthor()) + tgt.addAuthor(convertContactDetail(t)); + for (org.hl7.fhir.r4.model.ContactDetail t : src.getEditor()) + tgt.addEditor(convertContactDetail(t)); + for (org.hl7.fhir.r4.model.ContactDetail t : src.getReviewer()) + tgt.addReviewer(convertContactDetail(t)); + for (org.hl7.fhir.r4.model.ContactDetail t : src.getEndorser()) + tgt.addEndorser(convertContactDetail(t)); + for (org.hl7.fhir.r4.model.RelatedArtifact t : src.getRelatedArtifact()) + tgt.addRelatedArtifact(convertRelatedArtifact(t)); + for (org.hl7.fhir.r4.model.CanonicalType t : src.getLibrary()) + tgt.getLibrary().add(convertCanonical(t)); + if (src.hasKind()) + tgt.setKind(convertActivityDefinitionKind(src.getKind())); + if (src.hasProfile()) + tgt.setProfileElement(convertCanonical(src.getProfileElement())); + if (src.hasCode()) + tgt.setCode(convertCodeableConcept(src.getCode())); + if (src.hasIntent()) + tgt.setIntent(convertRequestIntent(src.getIntent())); + if (src.hasPriority()) + tgt.setPriority(convertRequestPriority(src.getPriority())); + if (src.hasDoNotPerform()) + tgt.setDoNotPerformElement(convertBoolean(src.getDoNotPerformElement())); + if (src.hasTiming()) + tgt.setTiming(convertType(src.getTiming())); + if (src.hasLocation()) + tgt.setLocation(convertReference(src.getLocation())); + for (org.hl7.fhir.r4.model.ActivityDefinition.ActivityDefinitionParticipantComponent t : src.getParticipant()) + tgt.addParticipant(convertActivityDefinitionParticipantComponent(t)); + if (src.hasProduct()) + tgt.setProduct(convertType(src.getProduct())); + if (src.hasQuantity()) + tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); + for (org.hl7.fhir.r4.model.Dosage t : src.getDosage()) + tgt.addDosage(convertDosage(t)); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getBodySite()) + tgt.addBodySite(convertCodeableConcept(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getSpecimenRequirement()) + tgt.addSpecimenRequirement(convertReference(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getObservationRequirement()) + tgt.addObservationRequirement(convertReference(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getObservationResultRequirement()) + tgt.addObservationResultRequirement(convertReference(t)); + if (src.hasTransform()) + tgt.setTransformElement(convertCanonical(src.getTransformElement())); + for (org.hl7.fhir.r4.model.ActivityDefinition.ActivityDefinitionDynamicValueComponent t : src.getDynamicValue()) + tgt.addDynamicValue(convertActivityDefinitionDynamicValueComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.ActivityDefinition convertActivityDefinition(org.hl7.fhir.r5.model.ActivityDefinition src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.ActivityDefinition tgt = new org.hl7.fhir.r4.model.ActivityDefinition(); + copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrlElement(convertUri(src.getUrlElement())); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasVersion()) + tgt.setVersionElement(convertString(src.getVersionElement())); + if (src.hasName()) + tgt.setNameElement(convertString(src.getNameElement())); + if (src.hasTitle()) + tgt.setTitleElement(convertString(src.getTitleElement())); + if (src.hasSubtitle()) + tgt.setSubtitleElement(convertString(src.getSubtitleElement())); + if (src.hasStatus()) + tgt.setStatus(Enumerations.convertPublicationStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimentalElement(convertBoolean(src.getExperimentalElement())); + if (src.hasSubject()) + tgt.setSubject(convertType(src.getSubject())); + if (src.hasDate()) + tgt.setDateElement(convertDateTime(src.getDateElement())); + if (src.hasPublisher()) + tgt.setPublisherElement(convertString(src.getPublisherElement())); + for (org.hl7.fhir.r5.model.ContactDetail t : src.getContact()) + tgt.addContact(convertContactDetail(t)); + if (src.hasDescription()) + tgt.setDescriptionElement(convertMarkdown(src.getDescriptionElement())); + for (org.hl7.fhir.r5.model.UsageContext t : src.getUseContext()) + tgt.addUseContext(convertUsageContext(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getJurisdiction()) + tgt.addJurisdiction(convertCodeableConcept(t)); + if (src.hasPurpose()) + tgt.setPurposeElement(convertMarkdown(src.getPurposeElement())); + if (src.hasUsage()) + tgt.setUsageElement(convertString(src.getUsageElement())); + if (src.hasCopyright()) + tgt.setCopyrightElement(convertMarkdown(src.getCopyrightElement())); + if (src.hasApprovalDate()) + tgt.setApprovalDateElement(convertDate(src.getApprovalDateElement())); + if (src.hasLastReviewDate()) + tgt.setLastReviewDateElement(convertDate(src.getLastReviewDateElement())); + if (src.hasEffectivePeriod()) + tgt.setEffectivePeriod(convertPeriod(src.getEffectivePeriod())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getTopic()) + tgt.addTopic(convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.ContactDetail t : src.getAuthor()) + tgt.addAuthor(convertContactDetail(t)); + for (org.hl7.fhir.r5.model.ContactDetail t : src.getEditor()) + tgt.addEditor(convertContactDetail(t)); + for (org.hl7.fhir.r5.model.ContactDetail t : src.getReviewer()) + tgt.addReviewer(convertContactDetail(t)); + for (org.hl7.fhir.r5.model.ContactDetail t : src.getEndorser()) + tgt.addEndorser(convertContactDetail(t)); + for (org.hl7.fhir.r5.model.RelatedArtifact t : src.getRelatedArtifact()) + tgt.addRelatedArtifact(convertRelatedArtifact(t)); + for (org.hl7.fhir.r5.model.CanonicalType t : src.getLibrary()) + tgt.getLibrary().add(convertCanonical(t)); + if (src.hasKind()) + tgt.setKind(convertActivityDefinitionKind(src.getKind())); + if (src.hasProfile()) + tgt.setProfileElement(convertCanonical(src.getProfileElement())); + if (src.hasCode()) + tgt.setCode(convertCodeableConcept(src.getCode())); + if (src.hasIntent()) + tgt.setIntent(convertRequestIntent(src.getIntent())); + if (src.hasPriority()) + tgt.setPriority(convertRequestPriority(src.getPriority())); + if (src.hasDoNotPerform()) + tgt.setDoNotPerformElement(convertBoolean(src.getDoNotPerformElement())); + if (src.hasTiming()) + tgt.setTiming(convertType(src.getTiming())); + if (src.hasLocation()) + tgt.setLocation(convertReference(src.getLocation())); + for (org.hl7.fhir.r5.model.ActivityDefinition.ActivityDefinitionParticipantComponent t : src.getParticipant()) + tgt.addParticipant(convertActivityDefinitionParticipantComponent(t)); + if (src.hasProduct()) + tgt.setProduct(convertType(src.getProduct())); + if (src.hasQuantity()) + tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); + for (org.hl7.fhir.r5.model.Dosage t : src.getDosage()) + tgt.addDosage(convertDosage(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getBodySite()) + tgt.addBodySite(convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getSpecimenRequirement()) + tgt.addSpecimenRequirement(convertReference(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getObservationRequirement()) + tgt.addObservationRequirement(convertReference(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getObservationResultRequirement()) + tgt.addObservationResultRequirement(convertReference(t)); + if (src.hasTransform()) + tgt.setTransformElement(convertCanonical(src.getTransformElement())); + for (org.hl7.fhir.r5.model.ActivityDefinition.ActivityDefinitionDynamicValueComponent t : src.getDynamicValue()) + tgt.addDynamicValue(convertActivityDefinitionDynamicValueComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.ActivityDefinition.ActivityDefinitionKind convertActivityDefinitionKind(org.hl7.fhir.r4.model.ActivityDefinition.ActivityDefinitionKind src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case APPOINTMENT: return org.hl7.fhir.r5.model.ActivityDefinition.ActivityDefinitionKind.APPOINTMENT; + case APPOINTMENTRESPONSE: return org.hl7.fhir.r5.model.ActivityDefinition.ActivityDefinitionKind.APPOINTMENTRESPONSE; + case CAREPLAN: return org.hl7.fhir.r5.model.ActivityDefinition.ActivityDefinitionKind.CAREPLAN; + case CLAIM: return org.hl7.fhir.r5.model.ActivityDefinition.ActivityDefinitionKind.CLAIM; + case COMMUNICATIONREQUEST: return org.hl7.fhir.r5.model.ActivityDefinition.ActivityDefinitionKind.COMMUNICATIONREQUEST; + case CONTRACT: return org.hl7.fhir.r5.model.ActivityDefinition.ActivityDefinitionKind.CONTRACT; + case DEVICEREQUEST: return org.hl7.fhir.r5.model.ActivityDefinition.ActivityDefinitionKind.DEVICEREQUEST; + case ENROLLMENTREQUEST: return org.hl7.fhir.r5.model.ActivityDefinition.ActivityDefinitionKind.ENROLLMENTREQUEST; + case IMMUNIZATIONRECOMMENDATION: return org.hl7.fhir.r5.model.ActivityDefinition.ActivityDefinitionKind.IMMUNIZATIONRECOMMENDATION; + case MEDICATIONREQUEST: return org.hl7.fhir.r5.model.ActivityDefinition.ActivityDefinitionKind.MEDICATIONREQUEST; + case NUTRITIONORDER: return org.hl7.fhir.r5.model.ActivityDefinition.ActivityDefinitionKind.NUTRITIONORDER; + case SERVICEREQUEST: return org.hl7.fhir.r5.model.ActivityDefinition.ActivityDefinitionKind.SERVICEREQUEST; + case SUPPLYREQUEST: return org.hl7.fhir.r5.model.ActivityDefinition.ActivityDefinitionKind.SUPPLYREQUEST; + case TASK: return org.hl7.fhir.r5.model.ActivityDefinition.ActivityDefinitionKind.TASK; + case VISIONPRESCRIPTION: return org.hl7.fhir.r5.model.ActivityDefinition.ActivityDefinitionKind.VISIONPRESCRIPTION; + default: return org.hl7.fhir.r5.model.ActivityDefinition.ActivityDefinitionKind.NULL; + } +} + + public static org.hl7.fhir.r4.model.ActivityDefinition.ActivityDefinitionKind convertActivityDefinitionKind(org.hl7.fhir.r5.model.ActivityDefinition.ActivityDefinitionKind src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case APPOINTMENT: return org.hl7.fhir.r4.model.ActivityDefinition.ActivityDefinitionKind.APPOINTMENT; + case APPOINTMENTRESPONSE: return org.hl7.fhir.r4.model.ActivityDefinition.ActivityDefinitionKind.APPOINTMENTRESPONSE; + case CAREPLAN: return org.hl7.fhir.r4.model.ActivityDefinition.ActivityDefinitionKind.CAREPLAN; + case CLAIM: return org.hl7.fhir.r4.model.ActivityDefinition.ActivityDefinitionKind.CLAIM; + case COMMUNICATIONREQUEST: return org.hl7.fhir.r4.model.ActivityDefinition.ActivityDefinitionKind.COMMUNICATIONREQUEST; + case CONTRACT: return org.hl7.fhir.r4.model.ActivityDefinition.ActivityDefinitionKind.CONTRACT; + case DEVICEREQUEST: return org.hl7.fhir.r4.model.ActivityDefinition.ActivityDefinitionKind.DEVICEREQUEST; + case ENROLLMENTREQUEST: return org.hl7.fhir.r4.model.ActivityDefinition.ActivityDefinitionKind.ENROLLMENTREQUEST; + case IMMUNIZATIONRECOMMENDATION: return org.hl7.fhir.r4.model.ActivityDefinition.ActivityDefinitionKind.IMMUNIZATIONRECOMMENDATION; + case MEDICATIONREQUEST: return org.hl7.fhir.r4.model.ActivityDefinition.ActivityDefinitionKind.MEDICATIONREQUEST; + case NUTRITIONORDER: return org.hl7.fhir.r4.model.ActivityDefinition.ActivityDefinitionKind.NUTRITIONORDER; + case SERVICEREQUEST: return org.hl7.fhir.r4.model.ActivityDefinition.ActivityDefinitionKind.SERVICEREQUEST; + case SUPPLYREQUEST: return org.hl7.fhir.r4.model.ActivityDefinition.ActivityDefinitionKind.SUPPLYREQUEST; + case TASK: return org.hl7.fhir.r4.model.ActivityDefinition.ActivityDefinitionKind.TASK; + case VISIONPRESCRIPTION: return org.hl7.fhir.r4.model.ActivityDefinition.ActivityDefinitionKind.VISIONPRESCRIPTION; + default: return org.hl7.fhir.r4.model.ActivityDefinition.ActivityDefinitionKind.NULL; + } +} + + public static org.hl7.fhir.r5.model.ActivityDefinition.RequestIntent convertRequestIntent(org.hl7.fhir.r4.model.ActivityDefinition.RequestIntent src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PROPOSAL: return org.hl7.fhir.r5.model.ActivityDefinition.RequestIntent.PROPOSAL; + case PLAN: return org.hl7.fhir.r5.model.ActivityDefinition.RequestIntent.PLAN; + case DIRECTIVE: return org.hl7.fhir.r5.model.ActivityDefinition.RequestIntent.DIRECTIVE; + case ORDER: return org.hl7.fhir.r5.model.ActivityDefinition.RequestIntent.ORDER; + case ORIGINALORDER: return org.hl7.fhir.r5.model.ActivityDefinition.RequestIntent.ORIGINALORDER; + case REFLEXORDER: return org.hl7.fhir.r5.model.ActivityDefinition.RequestIntent.REFLEXORDER; + case FILLERORDER: return org.hl7.fhir.r5.model.ActivityDefinition.RequestIntent.FILLERORDER; + case INSTANCEORDER: return org.hl7.fhir.r5.model.ActivityDefinition.RequestIntent.INSTANCEORDER; + case OPTION: return org.hl7.fhir.r5.model.ActivityDefinition.RequestIntent.OPTION; + default: return org.hl7.fhir.r5.model.ActivityDefinition.RequestIntent.NULL; + } +} + + public static org.hl7.fhir.r4.model.ActivityDefinition.RequestIntent convertRequestIntent(org.hl7.fhir.r5.model.ActivityDefinition.RequestIntent src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PROPOSAL: return org.hl7.fhir.r4.model.ActivityDefinition.RequestIntent.PROPOSAL; + case PLAN: return org.hl7.fhir.r4.model.ActivityDefinition.RequestIntent.PLAN; + case DIRECTIVE: return org.hl7.fhir.r4.model.ActivityDefinition.RequestIntent.DIRECTIVE; + case ORDER: return org.hl7.fhir.r4.model.ActivityDefinition.RequestIntent.ORDER; + case ORIGINALORDER: return org.hl7.fhir.r4.model.ActivityDefinition.RequestIntent.ORIGINALORDER; + case REFLEXORDER: return org.hl7.fhir.r4.model.ActivityDefinition.RequestIntent.REFLEXORDER; + case FILLERORDER: return org.hl7.fhir.r4.model.ActivityDefinition.RequestIntent.FILLERORDER; + case INSTANCEORDER: return org.hl7.fhir.r4.model.ActivityDefinition.RequestIntent.INSTANCEORDER; + case OPTION: return org.hl7.fhir.r4.model.ActivityDefinition.RequestIntent.OPTION; + default: return org.hl7.fhir.r4.model.ActivityDefinition.RequestIntent.NULL; + } +} + + public static org.hl7.fhir.r5.model.ActivityDefinition.RequestPriority convertRequestPriority(org.hl7.fhir.r4.model.ActivityDefinition.RequestPriority src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case ROUTINE: return org.hl7.fhir.r5.model.ActivityDefinition.RequestPriority.ROUTINE; + case URGENT: return org.hl7.fhir.r5.model.ActivityDefinition.RequestPriority.URGENT; + case ASAP: return org.hl7.fhir.r5.model.ActivityDefinition.RequestPriority.ASAP; + case STAT: return org.hl7.fhir.r5.model.ActivityDefinition.RequestPriority.STAT; + default: return org.hl7.fhir.r5.model.ActivityDefinition.RequestPriority.NULL; + } +} + + public static org.hl7.fhir.r4.model.ActivityDefinition.RequestPriority convertRequestPriority(org.hl7.fhir.r5.model.ActivityDefinition.RequestPriority src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case ROUTINE: return org.hl7.fhir.r4.model.ActivityDefinition.RequestPriority.ROUTINE; + case URGENT: return org.hl7.fhir.r4.model.ActivityDefinition.RequestPriority.URGENT; + case ASAP: return org.hl7.fhir.r4.model.ActivityDefinition.RequestPriority.ASAP; + case STAT: return org.hl7.fhir.r4.model.ActivityDefinition.RequestPriority.STAT; + default: return org.hl7.fhir.r4.model.ActivityDefinition.RequestPriority.NULL; + } +} + + public static org.hl7.fhir.r5.model.ActivityDefinition.ActivityDefinitionParticipantComponent convertActivityDefinitionParticipantComponent(org.hl7.fhir.r4.model.ActivityDefinition.ActivityDefinitionParticipantComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ActivityDefinition.ActivityDefinitionParticipantComponent tgt = new org.hl7.fhir.r5.model.ActivityDefinition.ActivityDefinitionParticipantComponent(); + copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertActivityParticipantType(src.getType())); + if (src.hasRole()) + tgt.setRole(convertCodeableConcept(src.getRole())); + return tgt; + } + + public static org.hl7.fhir.r4.model.ActivityDefinition.ActivityDefinitionParticipantComponent convertActivityDefinitionParticipantComponent(org.hl7.fhir.r5.model.ActivityDefinition.ActivityDefinitionParticipantComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.ActivityDefinition.ActivityDefinitionParticipantComponent tgt = new org.hl7.fhir.r4.model.ActivityDefinition.ActivityDefinitionParticipantComponent(); + copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertActivityParticipantType(src.getType())); + if (src.hasRole()) + tgt.setRole(convertCodeableConcept(src.getRole())); + return tgt; + } + + public static org.hl7.fhir.r5.model.ActivityDefinition.ActivityParticipantType convertActivityParticipantType(org.hl7.fhir.r4.model.ActivityDefinition.ActivityParticipantType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PATIENT: return org.hl7.fhir.r5.model.ActivityDefinition.ActivityParticipantType.PATIENT; + case PRACTITIONER: return org.hl7.fhir.r5.model.ActivityDefinition.ActivityParticipantType.PRACTITIONER; + case RELATEDPERSON: return org.hl7.fhir.r5.model.ActivityDefinition.ActivityParticipantType.RELATEDPERSON; + case DEVICE: return org.hl7.fhir.r5.model.ActivityDefinition.ActivityParticipantType.DEVICE; + default: return org.hl7.fhir.r5.model.ActivityDefinition.ActivityParticipantType.NULL; + } +} + + public static org.hl7.fhir.r4.model.ActivityDefinition.ActivityParticipantType convertActivityParticipantType(org.hl7.fhir.r5.model.ActivityDefinition.ActivityParticipantType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PATIENT: return org.hl7.fhir.r4.model.ActivityDefinition.ActivityParticipantType.PATIENT; + case PRACTITIONER: return org.hl7.fhir.r4.model.ActivityDefinition.ActivityParticipantType.PRACTITIONER; + case RELATEDPERSON: return org.hl7.fhir.r4.model.ActivityDefinition.ActivityParticipantType.RELATEDPERSON; + case DEVICE: return org.hl7.fhir.r4.model.ActivityDefinition.ActivityParticipantType.DEVICE; + default: return org.hl7.fhir.r4.model.ActivityDefinition.ActivityParticipantType.NULL; + } +} + + public static org.hl7.fhir.r5.model.ActivityDefinition.ActivityDefinitionDynamicValueComponent convertActivityDefinitionDynamicValueComponent(org.hl7.fhir.r4.model.ActivityDefinition.ActivityDefinitionDynamicValueComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ActivityDefinition.ActivityDefinitionDynamicValueComponent tgt = new org.hl7.fhir.r5.model.ActivityDefinition.ActivityDefinitionDynamicValueComponent(); + copyElement(src, tgt); + if (src.hasPath()) + tgt.setPathElement(convertString(src.getPathElement())); + if (src.hasExpression()) + tgt.setExpression(convertExpression(src.getExpression())); + return tgt; + } + + public static org.hl7.fhir.r4.model.ActivityDefinition.ActivityDefinitionDynamicValueComponent convertActivityDefinitionDynamicValueComponent(org.hl7.fhir.r5.model.ActivityDefinition.ActivityDefinitionDynamicValueComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.ActivityDefinition.ActivityDefinitionDynamicValueComponent tgt = new org.hl7.fhir.r4.model.ActivityDefinition.ActivityDefinitionDynamicValueComponent(); + copyElement(src, tgt); + if (src.hasPath()) + tgt.setPathElement(convertString(src.getPathElement())); + if (src.hasExpression()) + tgt.setExpression(convertExpression(src.getExpression())); + return tgt; + } + + +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/AdverseEvent.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/AdverseEvent.java new file mode 100644 index 000000000..f5b7d1a5e --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/AdverseEvent.java @@ -0,0 +1,215 @@ +package org.hl7.fhir.convertors.conv40_50; + +import org.hl7.fhir.exceptions.FHIRException; + +import org.hl7.fhir.convertors.VersionConvertor_40_50; + + +/* + Copyright (c) 2011+, HL7, Inc. + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of HL7 nor the names of its contributors may be used to + endorse or promote products derived from this software without specific + prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + +*/ + +// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0 + + +public class AdverseEvent extends VersionConvertor_40_50 { + + public static org.hl7.fhir.r5.model.AdverseEvent convertAdverseEvent(org.hl7.fhir.r4.model.AdverseEvent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.AdverseEvent tgt = new org.hl7.fhir.r5.model.AdverseEvent(); + copyDomainResource(src, tgt); + if (src.hasIdentifier()) + tgt.setIdentifier(convertIdentifier(src.getIdentifier())); + if (src.hasActuality()) + tgt.setActuality(convertAdverseEventActuality(src.getActuality())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getCategory()) + tgt.addCategory(convertCodeableConcept(t)); + if (src.hasEvent()) + tgt.setEvent(convertCodeableConcept(src.getEvent())); + if (src.hasSubject()) + tgt.setSubject(convertReference(src.getSubject())); + if (src.hasEncounter()) + tgt.setEncounter(convertReference(src.getEncounter())); + if (src.hasDate()) + tgt.setDateElement(convertDateTime(src.getDateElement())); + if (src.hasDetected()) + tgt.setDetectedElement(convertDateTime(src.getDetectedElement())); + if (src.hasRecordedDate()) + tgt.setRecordedDateElement(convertDateTime(src.getRecordedDateElement())); + for (org.hl7.fhir.r4.model.Reference t : src.getResultingCondition()) + tgt.addResultingCondition(convertReference(t)); + if (src.hasLocation()) + tgt.setLocation(convertReference(src.getLocation())); + if (src.hasSeriousness()) + tgt.setSeriousness(convertCodeableConcept(src.getSeriousness())); + if (src.hasSeverity()) + tgt.setSeverity(convertCodeableConcept(src.getSeverity())); + if (src.hasOutcome()) + tgt.setOutcome(convertCodeableConcept(src.getOutcome())); + if (src.hasRecorder()) + tgt.setRecorder(convertReference(src.getRecorder())); + for (org.hl7.fhir.r4.model.Reference t : src.getContributor()) + tgt.addContributor(convertReference(t)); + for (org.hl7.fhir.r4.model.AdverseEvent.AdverseEventSuspectEntityComponent t : src.getSuspectEntity()) + tgt.addSuspectEntity(convertAdverseEventSuspectEntityComponent(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getSubjectMedicalHistory()) + tgt.addSubjectMedicalHistory(convertReference(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getReferenceDocument()) + tgt.addReferenceDocument(convertReference(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getStudy()) + tgt.addStudy(convertReference(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.AdverseEvent convertAdverseEvent(org.hl7.fhir.r5.model.AdverseEvent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.AdverseEvent tgt = new org.hl7.fhir.r4.model.AdverseEvent(); + copyDomainResource(src, tgt); + if (src.hasIdentifier()) + tgt.setIdentifier(convertIdentifier(src.getIdentifier())); + if (src.hasActuality()) + tgt.setActuality(convertAdverseEventActuality(src.getActuality())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getCategory()) + tgt.addCategory(convertCodeableConcept(t)); + if (src.hasEvent()) + tgt.setEvent(convertCodeableConcept(src.getEvent())); + if (src.hasSubject()) + tgt.setSubject(convertReference(src.getSubject())); + if (src.hasEncounter()) + tgt.setEncounter(convertReference(src.getEncounter())); + if (src.hasDate()) + tgt.setDateElement(convertDateTime(src.getDateElement())); + if (src.hasDetected()) + tgt.setDetectedElement(convertDateTime(src.getDetectedElement())); + if (src.hasRecordedDate()) + tgt.setRecordedDateElement(convertDateTime(src.getRecordedDateElement())); + for (org.hl7.fhir.r5.model.Reference t : src.getResultingCondition()) + tgt.addResultingCondition(convertReference(t)); + if (src.hasLocation()) + tgt.setLocation(convertReference(src.getLocation())); + if (src.hasSeriousness()) + tgt.setSeriousness(convertCodeableConcept(src.getSeriousness())); + if (src.hasSeverity()) + tgt.setSeverity(convertCodeableConcept(src.getSeverity())); + if (src.hasOutcome()) + tgt.setOutcome(convertCodeableConcept(src.getOutcome())); + if (src.hasRecorder()) + tgt.setRecorder(convertReference(src.getRecorder())); + for (org.hl7.fhir.r5.model.Reference t : src.getContributor()) + tgt.addContributor(convertReference(t)); + for (org.hl7.fhir.r5.model.AdverseEvent.AdverseEventSuspectEntityComponent t : src.getSuspectEntity()) + tgt.addSuspectEntity(convertAdverseEventSuspectEntityComponent(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getSubjectMedicalHistory()) + tgt.addSubjectMedicalHistory(convertReference(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getReferenceDocument()) + tgt.addReferenceDocument(convertReference(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getStudy()) + tgt.addStudy(convertReference(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.AdverseEvent.AdverseEventActuality convertAdverseEventActuality(org.hl7.fhir.r4.model.AdverseEvent.AdverseEventActuality src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case ACTUAL: return org.hl7.fhir.r5.model.AdverseEvent.AdverseEventActuality.ACTUAL; + case POTENTIAL: return org.hl7.fhir.r5.model.AdverseEvent.AdverseEventActuality.POTENTIAL; + default: return org.hl7.fhir.r5.model.AdverseEvent.AdverseEventActuality.NULL; + } +} + + public static org.hl7.fhir.r4.model.AdverseEvent.AdverseEventActuality convertAdverseEventActuality(org.hl7.fhir.r5.model.AdverseEvent.AdverseEventActuality src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case ACTUAL: return org.hl7.fhir.r4.model.AdverseEvent.AdverseEventActuality.ACTUAL; + case POTENTIAL: return org.hl7.fhir.r4.model.AdverseEvent.AdverseEventActuality.POTENTIAL; + default: return org.hl7.fhir.r4.model.AdverseEvent.AdverseEventActuality.NULL; + } +} + + public static org.hl7.fhir.r5.model.AdverseEvent.AdverseEventSuspectEntityComponent convertAdverseEventSuspectEntityComponent(org.hl7.fhir.r4.model.AdverseEvent.AdverseEventSuspectEntityComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.AdverseEvent.AdverseEventSuspectEntityComponent tgt = new org.hl7.fhir.r5.model.AdverseEvent.AdverseEventSuspectEntityComponent(); + copyElement(src, tgt); + if (src.hasInstance()) + tgt.setInstance(convertReference(src.getInstance())); + for (org.hl7.fhir.r4.model.AdverseEvent.AdverseEventSuspectEntityCausalityComponent t : src.getCausality()) + tgt.addCausality(convertAdverseEventSuspectEntityCausalityComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.AdverseEvent.AdverseEventSuspectEntityComponent convertAdverseEventSuspectEntityComponent(org.hl7.fhir.r5.model.AdverseEvent.AdverseEventSuspectEntityComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.AdverseEvent.AdverseEventSuspectEntityComponent tgt = new org.hl7.fhir.r4.model.AdverseEvent.AdverseEventSuspectEntityComponent(); + copyElement(src, tgt); + if (src.hasInstance()) + tgt.setInstance(convertReference(src.getInstance())); + for (org.hl7.fhir.r5.model.AdverseEvent.AdverseEventSuspectEntityCausalityComponent t : src.getCausality()) + tgt.addCausality(convertAdverseEventSuspectEntityCausalityComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.AdverseEvent.AdverseEventSuspectEntityCausalityComponent convertAdverseEventSuspectEntityCausalityComponent(org.hl7.fhir.r4.model.AdverseEvent.AdverseEventSuspectEntityCausalityComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.AdverseEvent.AdverseEventSuspectEntityCausalityComponent tgt = new org.hl7.fhir.r5.model.AdverseEvent.AdverseEventSuspectEntityCausalityComponent(); + copyElement(src, tgt); + if (src.hasAssessment()) + tgt.setAssessment(convertCodeableConcept(src.getAssessment())); + if (src.hasProductRelatedness()) + tgt.setProductRelatednessElement(convertString(src.getProductRelatednessElement())); + if (src.hasAuthor()) + tgt.setAuthor(convertReference(src.getAuthor())); + if (src.hasMethod()) + tgt.setMethod(convertCodeableConcept(src.getMethod())); + return tgt; + } + + public static org.hl7.fhir.r4.model.AdverseEvent.AdverseEventSuspectEntityCausalityComponent convertAdverseEventSuspectEntityCausalityComponent(org.hl7.fhir.r5.model.AdverseEvent.AdverseEventSuspectEntityCausalityComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.AdverseEvent.AdverseEventSuspectEntityCausalityComponent tgt = new org.hl7.fhir.r4.model.AdverseEvent.AdverseEventSuspectEntityCausalityComponent(); + copyElement(src, tgt); + if (src.hasAssessment()) + tgt.setAssessment(convertCodeableConcept(src.getAssessment())); + if (src.hasProductRelatedness()) + tgt.setProductRelatednessElement(convertString(src.getProductRelatednessElement())); + if (src.hasAuthor()) + tgt.setAuthor(convertReference(src.getAuthor())); + if (src.hasMethod()) + tgt.setMethod(convertCodeableConcept(src.getMethod())); + return tgt; + } + + +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/AllergyIntolerance.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/AllergyIntolerance.java new file mode 100644 index 000000000..d8ba2611b --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/AllergyIntolerance.java @@ -0,0 +1,255 @@ +package org.hl7.fhir.convertors.conv40_50; + +import org.hl7.fhir.exceptions.FHIRException; + +import org.hl7.fhir.convertors.VersionConvertor_40_50; + + +/* + Copyright (c) 2011+, HL7, Inc. + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of HL7 nor the names of its contributors may be used to + endorse or promote products derived from this software without specific + prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + +*/ + +// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0 + + +public class AllergyIntolerance extends VersionConvertor_40_50 { + + public static org.hl7.fhir.r5.model.AllergyIntolerance convertAllergyIntolerance(org.hl7.fhir.r4.model.AllergyIntolerance src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.AllergyIntolerance tgt = new org.hl7.fhir.r5.model.AllergyIntolerance(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasClinicalStatus()) + tgt.setClinicalStatus(convertCodeableConcept(src.getClinicalStatus())); + if (src.hasVerificationStatus()) + tgt.setVerificationStatus(convertCodeableConcept(src.getVerificationStatus())); + if (src.hasType()) + tgt.setType(convertAllergyIntoleranceType(src.getType())); + for (org.hl7.fhir.r4.model.Enumeration t : src.getCategory()) + tgt.addCategory(convertAllergyIntoleranceCategory(t.getValue())); + if (src.hasCriticality()) + tgt.setCriticality(convertAllergyIntoleranceCriticality(src.getCriticality())); + if (src.hasCode()) + tgt.setCode(convertCodeableConcept(src.getCode())); + if (src.hasPatient()) + tgt.setPatient(convertReference(src.getPatient())); + if (src.hasEncounter()) + tgt.setEncounter(convertReference(src.getEncounter())); + if (src.hasOnset()) + tgt.setOnset(convertType(src.getOnset())); + if (src.hasRecordedDate()) + tgt.setRecordedDateElement(convertDateTime(src.getRecordedDateElement())); + if (src.hasRecorder()) + tgt.setRecorder(convertReference(src.getRecorder())); + if (src.hasAsserter()) + tgt.setAsserter(convertReference(src.getAsserter())); + if (src.hasLastOccurrence()) + tgt.setLastOccurrenceElement(convertDateTime(src.getLastOccurrenceElement())); + for (org.hl7.fhir.r4.model.Annotation t : src.getNote()) + tgt.addNote(convertAnnotation(t)); + for (org.hl7.fhir.r4.model.AllergyIntolerance.AllergyIntoleranceReactionComponent t : src.getReaction()) + tgt.addReaction(convertAllergyIntoleranceReactionComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.AllergyIntolerance convertAllergyIntolerance(org.hl7.fhir.r5.model.AllergyIntolerance src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.AllergyIntolerance tgt = new org.hl7.fhir.r4.model.AllergyIntolerance(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasClinicalStatus()) + tgt.setClinicalStatus(convertCodeableConcept(src.getClinicalStatus())); + if (src.hasVerificationStatus()) + tgt.setVerificationStatus(convertCodeableConcept(src.getVerificationStatus())); + if (src.hasType()) + tgt.setType(convertAllergyIntoleranceType(src.getType())); + for (org.hl7.fhir.r5.model.Enumeration t : src.getCategory()) + tgt.addCategory(convertAllergyIntoleranceCategory(t.getValue())); + if (src.hasCriticality()) + tgt.setCriticality(convertAllergyIntoleranceCriticality(src.getCriticality())); + if (src.hasCode()) + tgt.setCode(convertCodeableConcept(src.getCode())); + if (src.hasPatient()) + tgt.setPatient(convertReference(src.getPatient())); + if (src.hasEncounter()) + tgt.setEncounter(convertReference(src.getEncounter())); + if (src.hasOnset()) + tgt.setOnset(convertType(src.getOnset())); + if (src.hasRecordedDate()) + tgt.setRecordedDateElement(convertDateTime(src.getRecordedDateElement())); + if (src.hasRecorder()) + tgt.setRecorder(convertReference(src.getRecorder())); + if (src.hasAsserter()) + tgt.setAsserter(convertReference(src.getAsserter())); + if (src.hasLastOccurrence()) + tgt.setLastOccurrenceElement(convertDateTime(src.getLastOccurrenceElement())); + for (org.hl7.fhir.r5.model.Annotation t : src.getNote()) + tgt.addNote(convertAnnotation(t)); + for (org.hl7.fhir.r5.model.AllergyIntolerance.AllergyIntoleranceReactionComponent t : src.getReaction()) + tgt.addReaction(convertAllergyIntoleranceReactionComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.AllergyIntolerance.AllergyIntoleranceType convertAllergyIntoleranceType(org.hl7.fhir.r4.model.AllergyIntolerance.AllergyIntoleranceType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case ALLERGY: return org.hl7.fhir.r5.model.AllergyIntolerance.AllergyIntoleranceType.ALLERGY; + case INTOLERANCE: return org.hl7.fhir.r5.model.AllergyIntolerance.AllergyIntoleranceType.INTOLERANCE; + default: return org.hl7.fhir.r5.model.AllergyIntolerance.AllergyIntoleranceType.NULL; + } +} + + public static org.hl7.fhir.r4.model.AllergyIntolerance.AllergyIntoleranceType convertAllergyIntoleranceType(org.hl7.fhir.r5.model.AllergyIntolerance.AllergyIntoleranceType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case ALLERGY: return org.hl7.fhir.r4.model.AllergyIntolerance.AllergyIntoleranceType.ALLERGY; + case INTOLERANCE: return org.hl7.fhir.r4.model.AllergyIntolerance.AllergyIntoleranceType.INTOLERANCE; + default: return org.hl7.fhir.r4.model.AllergyIntolerance.AllergyIntoleranceType.NULL; + } +} + + public static org.hl7.fhir.r5.model.AllergyIntolerance.AllergyIntoleranceCategory convertAllergyIntoleranceCategory(org.hl7.fhir.r4.model.AllergyIntolerance.AllergyIntoleranceCategory src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case FOOD: return org.hl7.fhir.r5.model.AllergyIntolerance.AllergyIntoleranceCategory.FOOD; + case MEDICATION: return org.hl7.fhir.r5.model.AllergyIntolerance.AllergyIntoleranceCategory.MEDICATION; + case ENVIRONMENT: return org.hl7.fhir.r5.model.AllergyIntolerance.AllergyIntoleranceCategory.ENVIRONMENT; + case BIOLOGIC: return org.hl7.fhir.r5.model.AllergyIntolerance.AllergyIntoleranceCategory.BIOLOGIC; + default: return org.hl7.fhir.r5.model.AllergyIntolerance.AllergyIntoleranceCategory.NULL; + } +} + + public static org.hl7.fhir.r4.model.AllergyIntolerance.AllergyIntoleranceCategory convertAllergyIntoleranceCategory(org.hl7.fhir.r5.model.AllergyIntolerance.AllergyIntoleranceCategory src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case FOOD: return org.hl7.fhir.r4.model.AllergyIntolerance.AllergyIntoleranceCategory.FOOD; + case MEDICATION: return org.hl7.fhir.r4.model.AllergyIntolerance.AllergyIntoleranceCategory.MEDICATION; + case ENVIRONMENT: return org.hl7.fhir.r4.model.AllergyIntolerance.AllergyIntoleranceCategory.ENVIRONMENT; + case BIOLOGIC: return org.hl7.fhir.r4.model.AllergyIntolerance.AllergyIntoleranceCategory.BIOLOGIC; + default: return org.hl7.fhir.r4.model.AllergyIntolerance.AllergyIntoleranceCategory.NULL; + } +} + + public static org.hl7.fhir.r5.model.AllergyIntolerance.AllergyIntoleranceCriticality convertAllergyIntoleranceCriticality(org.hl7.fhir.r4.model.AllergyIntolerance.AllergyIntoleranceCriticality src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case LOW: return org.hl7.fhir.r5.model.AllergyIntolerance.AllergyIntoleranceCriticality.LOW; + case HIGH: return org.hl7.fhir.r5.model.AllergyIntolerance.AllergyIntoleranceCriticality.HIGH; + case UNABLETOASSESS: return org.hl7.fhir.r5.model.AllergyIntolerance.AllergyIntoleranceCriticality.UNABLETOASSESS; + default: return org.hl7.fhir.r5.model.AllergyIntolerance.AllergyIntoleranceCriticality.NULL; + } +} + + public static org.hl7.fhir.r4.model.AllergyIntolerance.AllergyIntoleranceCriticality convertAllergyIntoleranceCriticality(org.hl7.fhir.r5.model.AllergyIntolerance.AllergyIntoleranceCriticality src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case LOW: return org.hl7.fhir.r4.model.AllergyIntolerance.AllergyIntoleranceCriticality.LOW; + case HIGH: return org.hl7.fhir.r4.model.AllergyIntolerance.AllergyIntoleranceCriticality.HIGH; + case UNABLETOASSESS: return org.hl7.fhir.r4.model.AllergyIntolerance.AllergyIntoleranceCriticality.UNABLETOASSESS; + default: return org.hl7.fhir.r4.model.AllergyIntolerance.AllergyIntoleranceCriticality.NULL; + } +} + + public static org.hl7.fhir.r5.model.AllergyIntolerance.AllergyIntoleranceReactionComponent convertAllergyIntoleranceReactionComponent(org.hl7.fhir.r4.model.AllergyIntolerance.AllergyIntoleranceReactionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.AllergyIntolerance.AllergyIntoleranceReactionComponent tgt = new org.hl7.fhir.r5.model.AllergyIntolerance.AllergyIntoleranceReactionComponent(); + copyElement(src, tgt); + if (src.hasSubstance()) + tgt.setSubstance(convertCodeableConcept(src.getSubstance())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getManifestation()) + tgt.addManifestation(convertCodeableConcept(t)); + if (src.hasDescription()) + tgt.setDescriptionElement(convertString(src.getDescriptionElement())); + if (src.hasOnset()) + tgt.setOnsetElement(convertDateTime(src.getOnsetElement())); + if (src.hasSeverity()) + tgt.setSeverity(convertAllergyIntoleranceSeverity(src.getSeverity())); + if (src.hasExposureRoute()) + tgt.setExposureRoute(convertCodeableConcept(src.getExposureRoute())); + for (org.hl7.fhir.r4.model.Annotation t : src.getNote()) + tgt.addNote(convertAnnotation(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.AllergyIntolerance.AllergyIntoleranceReactionComponent convertAllergyIntoleranceReactionComponent(org.hl7.fhir.r5.model.AllergyIntolerance.AllergyIntoleranceReactionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.AllergyIntolerance.AllergyIntoleranceReactionComponent tgt = new org.hl7.fhir.r4.model.AllergyIntolerance.AllergyIntoleranceReactionComponent(); + copyElement(src, tgt); + if (src.hasSubstance()) + tgt.setSubstance(convertCodeableConcept(src.getSubstance())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getManifestation()) + tgt.addManifestation(convertCodeableConcept(t)); + if (src.hasDescription()) + tgt.setDescriptionElement(convertString(src.getDescriptionElement())); + if (src.hasOnset()) + tgt.setOnsetElement(convertDateTime(src.getOnsetElement())); + if (src.hasSeverity()) + tgt.setSeverity(convertAllergyIntoleranceSeverity(src.getSeverity())); + if (src.hasExposureRoute()) + tgt.setExposureRoute(convertCodeableConcept(src.getExposureRoute())); + for (org.hl7.fhir.r5.model.Annotation t : src.getNote()) + tgt.addNote(convertAnnotation(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.AllergyIntolerance.AllergyIntoleranceSeverity convertAllergyIntoleranceSeverity(org.hl7.fhir.r4.model.AllergyIntolerance.AllergyIntoleranceSeverity src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case MILD: return org.hl7.fhir.r5.model.AllergyIntolerance.AllergyIntoleranceSeverity.MILD; + case MODERATE: return org.hl7.fhir.r5.model.AllergyIntolerance.AllergyIntoleranceSeverity.MODERATE; + case SEVERE: return org.hl7.fhir.r5.model.AllergyIntolerance.AllergyIntoleranceSeverity.SEVERE; + default: return org.hl7.fhir.r5.model.AllergyIntolerance.AllergyIntoleranceSeverity.NULL; + } +} + + public static org.hl7.fhir.r4.model.AllergyIntolerance.AllergyIntoleranceSeverity convertAllergyIntoleranceSeverity(org.hl7.fhir.r5.model.AllergyIntolerance.AllergyIntoleranceSeverity src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case MILD: return org.hl7.fhir.r4.model.AllergyIntolerance.AllergyIntoleranceSeverity.MILD; + case MODERATE: return org.hl7.fhir.r4.model.AllergyIntolerance.AllergyIntoleranceSeverity.MODERATE; + case SEVERE: return org.hl7.fhir.r4.model.AllergyIntolerance.AllergyIntoleranceSeverity.SEVERE; + default: return org.hl7.fhir.r4.model.AllergyIntolerance.AllergyIntoleranceSeverity.NULL; + } +} + + +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Appointment.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Appointment.java new file mode 100644 index 000000000..6e1d9a943 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Appointment.java @@ -0,0 +1,265 @@ +package org.hl7.fhir.convertors.conv40_50; + +import org.hl7.fhir.exceptions.FHIRException; + +import org.hl7.fhir.convertors.VersionConvertor_40_50; + + +/* + Copyright (c) 2011+, HL7, Inc. + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of HL7 nor the names of its contributors may be used to + endorse or promote products derived from this software without specific + prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + +*/ + +// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0 + + +public class Appointment extends VersionConvertor_40_50 { + + public static org.hl7.fhir.r5.model.Appointment convertAppointment(org.hl7.fhir.r4.model.Appointment src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Appointment tgt = new org.hl7.fhir.r5.model.Appointment(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasStatus()) + tgt.setStatus(convertAppointmentStatus(src.getStatus())); + if (src.hasCancelationReason()) + tgt.setCancelationReason(convertCodeableConcept(src.getCancelationReason())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getServiceCategory()) + tgt.addServiceCategory(convertCodeableConcept(t)); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getServiceType()) + tgt.addServiceType(convertCodeableConcept(t)); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getSpecialty()) + tgt.addSpecialty(convertCodeableConcept(t)); + if (src.hasAppointmentType()) + tgt.setAppointmentType(convertCodeableConcept(src.getAppointmentType())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getReasonCode()) + tgt.addReasonCode(convertCodeableConcept(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getReasonReference()) + tgt.addReasonReference(convertReference(t)); + if (src.hasPriority()) + tgt.setPriorityElement(convertUnsignedInt(src.getPriorityElement())); + if (src.hasDescription()) + tgt.setDescriptionElement(convertString(src.getDescriptionElement())); + for (org.hl7.fhir.r4.model.Reference t : src.getSupportingInformation()) + tgt.addSupportingInformation(convertReference(t)); + if (src.hasStart()) + tgt.setStartElement(convertInstant(src.getStartElement())); + if (src.hasEnd()) + tgt.setEndElement(convertInstant(src.getEndElement())); + if (src.hasMinutesDuration()) + tgt.setMinutesDurationElement(convertPositiveInt(src.getMinutesDurationElement())); + for (org.hl7.fhir.r4.model.Reference t : src.getSlot()) + tgt.addSlot(convertReference(t)); + if (src.hasCreated()) + tgt.setCreatedElement(convertDateTime(src.getCreatedElement())); + if (src.hasComment()) + tgt.setCommentElement(convertString(src.getCommentElement())); + if (src.hasPatientInstruction()) + tgt.setPatientInstructionElement(convertString(src.getPatientInstructionElement())); + for (org.hl7.fhir.r4.model.Reference t : src.getBasedOn()) + tgt.addBasedOn(convertReference(t)); + for (org.hl7.fhir.r4.model.Appointment.AppointmentParticipantComponent t : src.getParticipant()) + tgt.addParticipant(convertAppointmentParticipantComponent(t)); + for (org.hl7.fhir.r4.model.Period t : src.getRequestedPeriod()) + tgt.addRequestedPeriod(convertPeriod(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.Appointment convertAppointment(org.hl7.fhir.r5.model.Appointment src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Appointment tgt = new org.hl7.fhir.r4.model.Appointment(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasStatus()) + tgt.setStatus(convertAppointmentStatus(src.getStatus())); + if (src.hasCancelationReason()) + tgt.setCancelationReason(convertCodeableConcept(src.getCancelationReason())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getServiceCategory()) + tgt.addServiceCategory(convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getServiceType()) + tgt.addServiceType(convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getSpecialty()) + tgt.addSpecialty(convertCodeableConcept(t)); + if (src.hasAppointmentType()) + tgt.setAppointmentType(convertCodeableConcept(src.getAppointmentType())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getReasonCode()) + tgt.addReasonCode(convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getReasonReference()) + tgt.addReasonReference(convertReference(t)); + if (src.hasPriority()) + tgt.setPriorityElement(convertUnsignedInt(src.getPriorityElement())); + if (src.hasDescription()) + tgt.setDescriptionElement(convertString(src.getDescriptionElement())); + for (org.hl7.fhir.r5.model.Reference t : src.getSupportingInformation()) + tgt.addSupportingInformation(convertReference(t)); + if (src.hasStart()) + tgt.setStartElement(convertInstant(src.getStartElement())); + if (src.hasEnd()) + tgt.setEndElement(convertInstant(src.getEndElement())); + if (src.hasMinutesDuration()) + tgt.setMinutesDurationElement(convertPositiveInt(src.getMinutesDurationElement())); + for (org.hl7.fhir.r5.model.Reference t : src.getSlot()) + tgt.addSlot(convertReference(t)); + if (src.hasCreated()) + tgt.setCreatedElement(convertDateTime(src.getCreatedElement())); + if (src.hasComment()) + tgt.setCommentElement(convertString(src.getCommentElement())); + if (src.hasPatientInstruction()) + tgt.setPatientInstructionElement(convertString(src.getPatientInstructionElement())); + for (org.hl7.fhir.r5.model.Reference t : src.getBasedOn()) + tgt.addBasedOn(convertReference(t)); + for (org.hl7.fhir.r5.model.Appointment.AppointmentParticipantComponent t : src.getParticipant()) + tgt.addParticipant(convertAppointmentParticipantComponent(t)); + for (org.hl7.fhir.r5.model.Period t : src.getRequestedPeriod()) + tgt.addRequestedPeriod(convertPeriod(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.Appointment.AppointmentStatus convertAppointmentStatus(org.hl7.fhir.r4.model.Appointment.AppointmentStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PROPOSED: return org.hl7.fhir.r5.model.Appointment.AppointmentStatus.PROPOSED; + case PENDING: return org.hl7.fhir.r5.model.Appointment.AppointmentStatus.PENDING; + case BOOKED: return org.hl7.fhir.r5.model.Appointment.AppointmentStatus.BOOKED; + case ARRIVED: return org.hl7.fhir.r5.model.Appointment.AppointmentStatus.ARRIVED; + case FULFILLED: return org.hl7.fhir.r5.model.Appointment.AppointmentStatus.FULFILLED; + case CANCELLED: return org.hl7.fhir.r5.model.Appointment.AppointmentStatus.CANCELLED; + case NOSHOW: return org.hl7.fhir.r5.model.Appointment.AppointmentStatus.NOSHOW; + case ENTEREDINERROR: return org.hl7.fhir.r5.model.Appointment.AppointmentStatus.ENTEREDINERROR; + case CHECKEDIN: return org.hl7.fhir.r5.model.Appointment.AppointmentStatus.CHECKEDIN; + case WAITLIST: return org.hl7.fhir.r5.model.Appointment.AppointmentStatus.WAITLIST; + default: return org.hl7.fhir.r5.model.Appointment.AppointmentStatus.NULL; + } +} + + public static org.hl7.fhir.r4.model.Appointment.AppointmentStatus convertAppointmentStatus(org.hl7.fhir.r5.model.Appointment.AppointmentStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PROPOSED: return org.hl7.fhir.r4.model.Appointment.AppointmentStatus.PROPOSED; + case PENDING: return org.hl7.fhir.r4.model.Appointment.AppointmentStatus.PENDING; + case BOOKED: return org.hl7.fhir.r4.model.Appointment.AppointmentStatus.BOOKED; + case ARRIVED: return org.hl7.fhir.r4.model.Appointment.AppointmentStatus.ARRIVED; + case FULFILLED: return org.hl7.fhir.r4.model.Appointment.AppointmentStatus.FULFILLED; + case CANCELLED: return org.hl7.fhir.r4.model.Appointment.AppointmentStatus.CANCELLED; + case NOSHOW: return org.hl7.fhir.r4.model.Appointment.AppointmentStatus.NOSHOW; + case ENTEREDINERROR: return org.hl7.fhir.r4.model.Appointment.AppointmentStatus.ENTEREDINERROR; + case CHECKEDIN: return org.hl7.fhir.r4.model.Appointment.AppointmentStatus.CHECKEDIN; + case WAITLIST: return org.hl7.fhir.r4.model.Appointment.AppointmentStatus.WAITLIST; + default: return org.hl7.fhir.r4.model.Appointment.AppointmentStatus.NULL; + } +} + + public static org.hl7.fhir.r5.model.Appointment.AppointmentParticipantComponent convertAppointmentParticipantComponent(org.hl7.fhir.r4.model.Appointment.AppointmentParticipantComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Appointment.AppointmentParticipantComponent tgt = new org.hl7.fhir.r5.model.Appointment.AppointmentParticipantComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getType()) + tgt.addType(convertCodeableConcept(t)); + if (src.hasActor()) + tgt.setActor(convertReference(src.getActor())); + if (src.hasRequired()) + tgt.setRequired(convertParticipantRequired(src.getRequired())); + if (src.hasStatus()) + tgt.setStatus(convertParticipationStatus(src.getStatus())); + if (src.hasPeriod()) + tgt.setPeriod(convertPeriod(src.getPeriod())); + return tgt; + } + + public static org.hl7.fhir.r4.model.Appointment.AppointmentParticipantComponent convertAppointmentParticipantComponent(org.hl7.fhir.r5.model.Appointment.AppointmentParticipantComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Appointment.AppointmentParticipantComponent tgt = new org.hl7.fhir.r4.model.Appointment.AppointmentParticipantComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getType()) + tgt.addType(convertCodeableConcept(t)); + if (src.hasActor()) + tgt.setActor(convertReference(src.getActor())); + if (src.hasRequired()) + tgt.setRequired(convertParticipantRequired(src.getRequired())); + if (src.hasStatus()) + tgt.setStatus(convertParticipationStatus(src.getStatus())); + if (src.hasPeriod()) + tgt.setPeriod(convertPeriod(src.getPeriod())); + return tgt; + } + + public static org.hl7.fhir.r5.model.Appointment.ParticipantRequired convertParticipantRequired(org.hl7.fhir.r4.model.Appointment.ParticipantRequired src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case REQUIRED: return org.hl7.fhir.r5.model.Appointment.ParticipantRequired.REQUIRED; + case OPTIONAL: return org.hl7.fhir.r5.model.Appointment.ParticipantRequired.OPTIONAL; + case INFORMATIONONLY: return org.hl7.fhir.r5.model.Appointment.ParticipantRequired.INFORMATIONONLY; + default: return org.hl7.fhir.r5.model.Appointment.ParticipantRequired.NULL; + } +} + + public static org.hl7.fhir.r4.model.Appointment.ParticipantRequired convertParticipantRequired(org.hl7.fhir.r5.model.Appointment.ParticipantRequired src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case REQUIRED: return org.hl7.fhir.r4.model.Appointment.ParticipantRequired.REQUIRED; + case OPTIONAL: return org.hl7.fhir.r4.model.Appointment.ParticipantRequired.OPTIONAL; + case INFORMATIONONLY: return org.hl7.fhir.r4.model.Appointment.ParticipantRequired.INFORMATIONONLY; + default: return org.hl7.fhir.r4.model.Appointment.ParticipantRequired.NULL; + } +} + + public static org.hl7.fhir.r5.model.Appointment.ParticipationStatus convertParticipationStatus(org.hl7.fhir.r4.model.Appointment.ParticipationStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case ACCEPTED: return org.hl7.fhir.r5.model.Appointment.ParticipationStatus.ACCEPTED; + case DECLINED: return org.hl7.fhir.r5.model.Appointment.ParticipationStatus.DECLINED; + case TENTATIVE: return org.hl7.fhir.r5.model.Appointment.ParticipationStatus.TENTATIVE; + case NEEDSACTION: return org.hl7.fhir.r5.model.Appointment.ParticipationStatus.NEEDSACTION; + default: return org.hl7.fhir.r5.model.Appointment.ParticipationStatus.NULL; + } +} + + public static org.hl7.fhir.r4.model.Appointment.ParticipationStatus convertParticipationStatus(org.hl7.fhir.r5.model.Appointment.ParticipationStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case ACCEPTED: return org.hl7.fhir.r4.model.Appointment.ParticipationStatus.ACCEPTED; + case DECLINED: return org.hl7.fhir.r4.model.Appointment.ParticipationStatus.DECLINED; + case TENTATIVE: return org.hl7.fhir.r4.model.Appointment.ParticipationStatus.TENTATIVE; + case NEEDSACTION: return org.hl7.fhir.r4.model.Appointment.ParticipationStatus.NEEDSACTION; + default: return org.hl7.fhir.r4.model.Appointment.ParticipationStatus.NULL; + } +} + + +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/AppointmentResponse.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/AppointmentResponse.java new file mode 100644 index 000000000..78e3f83b5 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/AppointmentResponse.java @@ -0,0 +1,115 @@ +package org.hl7.fhir.convertors.conv40_50; + +import org.hl7.fhir.exceptions.FHIRException; + +import org.hl7.fhir.convertors.VersionConvertor_40_50; + + +/* + Copyright (c) 2011+, HL7, Inc. + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of HL7 nor the names of its contributors may be used to + endorse or promote products derived from this software without specific + prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + +*/ + +// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0 + + +public class AppointmentResponse extends VersionConvertor_40_50 { + + public static org.hl7.fhir.r5.model.AppointmentResponse convertAppointmentResponse(org.hl7.fhir.r4.model.AppointmentResponse src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.AppointmentResponse tgt = new org.hl7.fhir.r5.model.AppointmentResponse(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasAppointment()) + tgt.setAppointment(convertReference(src.getAppointment())); + if (src.hasStart()) + tgt.setStartElement(convertInstant(src.getStartElement())); + if (src.hasEnd()) + tgt.setEndElement(convertInstant(src.getEndElement())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getParticipantType()) + tgt.addParticipantType(convertCodeableConcept(t)); + if (src.hasActor()) + tgt.setActor(convertReference(src.getActor())); + if (src.hasParticipantStatus()) + tgt.setParticipantStatus(convertParticipantStatus(src.getParticipantStatus())); + if (src.hasComment()) + tgt.setCommentElement(convertString(src.getCommentElement())); + return tgt; + } + + public static org.hl7.fhir.r4.model.AppointmentResponse convertAppointmentResponse(org.hl7.fhir.r5.model.AppointmentResponse src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.AppointmentResponse tgt = new org.hl7.fhir.r4.model.AppointmentResponse(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasAppointment()) + tgt.setAppointment(convertReference(src.getAppointment())); + if (src.hasStart()) + tgt.setStartElement(convertInstant(src.getStartElement())); + if (src.hasEnd()) + tgt.setEndElement(convertInstant(src.getEndElement())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getParticipantType()) + tgt.addParticipantType(convertCodeableConcept(t)); + if (src.hasActor()) + tgt.setActor(convertReference(src.getActor())); + if (src.hasParticipantStatus()) + tgt.setParticipantStatus(convertParticipantStatus(src.getParticipantStatus())); + if (src.hasComment()) + tgt.setCommentElement(convertString(src.getCommentElement())); + return tgt; + } + + public static org.hl7.fhir.r5.model.AppointmentResponse.ParticipantStatus convertParticipantStatus(org.hl7.fhir.r4.model.AppointmentResponse.ParticipantStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case ACCEPTED: return org.hl7.fhir.r5.model.AppointmentResponse.ParticipantStatus.ACCEPTED; + case DECLINED: return org.hl7.fhir.r5.model.AppointmentResponse.ParticipantStatus.DECLINED; + case TENTATIVE: return org.hl7.fhir.r5.model.AppointmentResponse.ParticipantStatus.TENTATIVE; + case NEEDSACTION: return org.hl7.fhir.r5.model.AppointmentResponse.ParticipantStatus.NEEDSACTION; + default: return org.hl7.fhir.r5.model.AppointmentResponse.ParticipantStatus.NULL; + } +} + + public static org.hl7.fhir.r4.model.AppointmentResponse.ParticipantStatus convertParticipantStatus(org.hl7.fhir.r5.model.AppointmentResponse.ParticipantStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case ACCEPTED: return org.hl7.fhir.r4.model.AppointmentResponse.ParticipantStatus.ACCEPTED; + case DECLINED: return org.hl7.fhir.r4.model.AppointmentResponse.ParticipantStatus.DECLINED; + case TENTATIVE: return org.hl7.fhir.r4.model.AppointmentResponse.ParticipantStatus.TENTATIVE; + case NEEDSACTION: return org.hl7.fhir.r4.model.AppointmentResponse.ParticipantStatus.NEEDSACTION; + default: return org.hl7.fhir.r4.model.AppointmentResponse.ParticipantStatus.NULL; + } +} + + +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/AuditEvent.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/AuditEvent.java new file mode 100644 index 000000000..5debfa0f0 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/AuditEvent.java @@ -0,0 +1,367 @@ +package org.hl7.fhir.convertors.conv40_50; + +import org.hl7.fhir.exceptions.FHIRException; + +import org.hl7.fhir.convertors.VersionConvertor_40_50; + + +/* + Copyright (c) 2011+, HL7, Inc. + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of HL7 nor the names of its contributors may be used to + endorse or promote products derived from this software without specific + prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + +*/ + +// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0 + + +public class AuditEvent extends VersionConvertor_40_50 { + + public static org.hl7.fhir.r5.model.AuditEvent convertAuditEvent(org.hl7.fhir.r4.model.AuditEvent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.AuditEvent tgt = new org.hl7.fhir.r5.model.AuditEvent(); + copyDomainResource(src, tgt); + if (src.hasType()) + tgt.setType(convertCoding(src.getType())); + for (org.hl7.fhir.r4.model.Coding t : src.getSubtype()) + tgt.addSubtype(convertCoding(t)); + if (src.hasAction()) + tgt.setAction(convertAuditEventAction(src.getAction())); + if (src.hasPeriod()) + tgt.setPeriod(convertPeriod(src.getPeriod())); + if (src.hasRecorded()) + tgt.setRecordedElement(convertInstant(src.getRecordedElement())); + if (src.hasOutcome()) + tgt.setOutcome(convertAuditEventOutcome(src.getOutcome())); + if (src.hasOutcomeDesc()) + tgt.setOutcomeDescElement(convertString(src.getOutcomeDescElement())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getPurposeOfEvent()) + tgt.addPurposeOfEvent(convertCodeableConcept(t)); + for (org.hl7.fhir.r4.model.AuditEvent.AuditEventAgentComponent t : src.getAgent()) + tgt.addAgent(convertAuditEventAgentComponent(t)); + if (src.hasSource()) + tgt.setSource(convertAuditEventSourceComponent(src.getSource())); + for (org.hl7.fhir.r4.model.AuditEvent.AuditEventEntityComponent t : src.getEntity()) + tgt.addEntity(convertAuditEventEntityComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.AuditEvent convertAuditEvent(org.hl7.fhir.r5.model.AuditEvent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.AuditEvent tgt = new org.hl7.fhir.r4.model.AuditEvent(); + copyDomainResource(src, tgt); + if (src.hasType()) + tgt.setType(convertCoding(src.getType())); + for (org.hl7.fhir.r5.model.Coding t : src.getSubtype()) + tgt.addSubtype(convertCoding(t)); + if (src.hasAction()) + tgt.setAction(convertAuditEventAction(src.getAction())); + if (src.hasPeriod()) + tgt.setPeriod(convertPeriod(src.getPeriod())); + if (src.hasRecorded()) + tgt.setRecordedElement(convertInstant(src.getRecordedElement())); + if (src.hasOutcome()) + tgt.setOutcome(convertAuditEventOutcome(src.getOutcome())); + if (src.hasOutcomeDesc()) + tgt.setOutcomeDescElement(convertString(src.getOutcomeDescElement())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getPurposeOfEvent()) + tgt.addPurposeOfEvent(convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.AuditEvent.AuditEventAgentComponent t : src.getAgent()) + tgt.addAgent(convertAuditEventAgentComponent(t)); + if (src.hasSource()) + tgt.setSource(convertAuditEventSourceComponent(src.getSource())); + for (org.hl7.fhir.r5.model.AuditEvent.AuditEventEntityComponent t : src.getEntity()) + tgt.addEntity(convertAuditEventEntityComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.AuditEvent.AuditEventAction convertAuditEventAction(org.hl7.fhir.r4.model.AuditEvent.AuditEventAction src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case C: return org.hl7.fhir.r5.model.AuditEvent.AuditEventAction.C; + case R: return org.hl7.fhir.r5.model.AuditEvent.AuditEventAction.R; + case U: return org.hl7.fhir.r5.model.AuditEvent.AuditEventAction.U; + case D: return org.hl7.fhir.r5.model.AuditEvent.AuditEventAction.D; + case E: return org.hl7.fhir.r5.model.AuditEvent.AuditEventAction.E; + default: return org.hl7.fhir.r5.model.AuditEvent.AuditEventAction.NULL; + } +} + + public static org.hl7.fhir.r4.model.AuditEvent.AuditEventAction convertAuditEventAction(org.hl7.fhir.r5.model.AuditEvent.AuditEventAction src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case C: return org.hl7.fhir.r4.model.AuditEvent.AuditEventAction.C; + case R: return org.hl7.fhir.r4.model.AuditEvent.AuditEventAction.R; + case U: return org.hl7.fhir.r4.model.AuditEvent.AuditEventAction.U; + case D: return org.hl7.fhir.r4.model.AuditEvent.AuditEventAction.D; + case E: return org.hl7.fhir.r4.model.AuditEvent.AuditEventAction.E; + default: return org.hl7.fhir.r4.model.AuditEvent.AuditEventAction.NULL; + } +} + + public static org.hl7.fhir.r5.model.AuditEvent.AuditEventOutcome convertAuditEventOutcome(org.hl7.fhir.r4.model.AuditEvent.AuditEventOutcome src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case _0: return org.hl7.fhir.r5.model.AuditEvent.AuditEventOutcome._0; + case _4: return org.hl7.fhir.r5.model.AuditEvent.AuditEventOutcome._4; + case _8: return org.hl7.fhir.r5.model.AuditEvent.AuditEventOutcome._8; + case _12: return org.hl7.fhir.r5.model.AuditEvent.AuditEventOutcome._12; + default: return org.hl7.fhir.r5.model.AuditEvent.AuditEventOutcome.NULL; + } +} + + public static org.hl7.fhir.r4.model.AuditEvent.AuditEventOutcome convertAuditEventOutcome(org.hl7.fhir.r5.model.AuditEvent.AuditEventOutcome src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case _0: return org.hl7.fhir.r4.model.AuditEvent.AuditEventOutcome._0; + case _4: return org.hl7.fhir.r4.model.AuditEvent.AuditEventOutcome._4; + case _8: return org.hl7.fhir.r4.model.AuditEvent.AuditEventOutcome._8; + case _12: return org.hl7.fhir.r4.model.AuditEvent.AuditEventOutcome._12; + default: return org.hl7.fhir.r4.model.AuditEvent.AuditEventOutcome.NULL; + } +} + + public static org.hl7.fhir.r5.model.AuditEvent.AuditEventAgentComponent convertAuditEventAgentComponent(org.hl7.fhir.r4.model.AuditEvent.AuditEventAgentComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.AuditEvent.AuditEventAgentComponent tgt = new org.hl7.fhir.r5.model.AuditEvent.AuditEventAgentComponent(); + copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getRole()) + tgt.addRole(convertCodeableConcept(t)); + if (src.hasWho()) + tgt.setWho(convertReference(src.getWho())); + if (src.hasAltId()) + tgt.setAltIdElement(convertString(src.getAltIdElement())); + if (src.hasName()) + tgt.setNameElement(convertString(src.getNameElement())); + if (src.hasRequestor()) + tgt.setRequestorElement(convertBoolean(src.getRequestorElement())); + if (src.hasLocation()) + tgt.setLocation(convertReference(src.getLocation())); + for (org.hl7.fhir.r4.model.UriType t : src.getPolicy()) + tgt.getPolicy().add(convertUri(t)); + if (src.hasMedia()) + tgt.setMedia(convertCoding(src.getMedia())); + if (src.hasNetwork()) + tgt.setNetwork(convertAuditEventAgentNetworkComponent(src.getNetwork())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getPurposeOfUse()) + tgt.addPurposeOfUse(convertCodeableConcept(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.AuditEvent.AuditEventAgentComponent convertAuditEventAgentComponent(org.hl7.fhir.r5.model.AuditEvent.AuditEventAgentComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.AuditEvent.AuditEventAgentComponent tgt = new org.hl7.fhir.r4.model.AuditEvent.AuditEventAgentComponent(); + copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getRole()) + tgt.addRole(convertCodeableConcept(t)); + if (src.hasWho()) + tgt.setWho(convertReference(src.getWho())); + if (src.hasAltId()) + tgt.setAltIdElement(convertString(src.getAltIdElement())); + if (src.hasName()) + tgt.setNameElement(convertString(src.getNameElement())); + if (src.hasRequestor()) + tgt.setRequestorElement(convertBoolean(src.getRequestorElement())); + if (src.hasLocation()) + tgt.setLocation(convertReference(src.getLocation())); + for (org.hl7.fhir.r5.model.UriType t : src.getPolicy()) + tgt.getPolicy().add(convertUri(t)); + if (src.hasMedia()) + tgt.setMedia(convertCoding(src.getMedia())); + if (src.hasNetwork()) + tgt.setNetwork(convertAuditEventAgentNetworkComponent(src.getNetwork())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getPurposeOfUse()) + tgt.addPurposeOfUse(convertCodeableConcept(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.AuditEvent.AuditEventAgentNetworkComponent convertAuditEventAgentNetworkComponent(org.hl7.fhir.r4.model.AuditEvent.AuditEventAgentNetworkComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.AuditEvent.AuditEventAgentNetworkComponent tgt = new org.hl7.fhir.r5.model.AuditEvent.AuditEventAgentNetworkComponent(); + copyElement(src, tgt); + if (src.hasAddress()) + tgt.setAddressElement(convertString(src.getAddressElement())); + if (src.hasType()) + tgt.setType(convertAuditEventAgentNetworkType(src.getType())); + return tgt; + } + + public static org.hl7.fhir.r4.model.AuditEvent.AuditEventAgentNetworkComponent convertAuditEventAgentNetworkComponent(org.hl7.fhir.r5.model.AuditEvent.AuditEventAgentNetworkComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.AuditEvent.AuditEventAgentNetworkComponent tgt = new org.hl7.fhir.r4.model.AuditEvent.AuditEventAgentNetworkComponent(); + copyElement(src, tgt); + if (src.hasAddress()) + tgt.setAddressElement(convertString(src.getAddressElement())); + if (src.hasType()) + tgt.setType(convertAuditEventAgentNetworkType(src.getType())); + return tgt; + } + + public static org.hl7.fhir.r5.model.AuditEvent.AuditEventAgentNetworkType convertAuditEventAgentNetworkType(org.hl7.fhir.r4.model.AuditEvent.AuditEventAgentNetworkType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case _1: return org.hl7.fhir.r5.model.AuditEvent.AuditEventAgentNetworkType._1; + case _2: return org.hl7.fhir.r5.model.AuditEvent.AuditEventAgentNetworkType._2; + case _3: return org.hl7.fhir.r5.model.AuditEvent.AuditEventAgentNetworkType._3; + case _4: return org.hl7.fhir.r5.model.AuditEvent.AuditEventAgentNetworkType._4; + case _5: return org.hl7.fhir.r5.model.AuditEvent.AuditEventAgentNetworkType._5; + default: return org.hl7.fhir.r5.model.AuditEvent.AuditEventAgentNetworkType.NULL; + } +} + + public static org.hl7.fhir.r4.model.AuditEvent.AuditEventAgentNetworkType convertAuditEventAgentNetworkType(org.hl7.fhir.r5.model.AuditEvent.AuditEventAgentNetworkType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case _1: return org.hl7.fhir.r4.model.AuditEvent.AuditEventAgentNetworkType._1; + case _2: return org.hl7.fhir.r4.model.AuditEvent.AuditEventAgentNetworkType._2; + case _3: return org.hl7.fhir.r4.model.AuditEvent.AuditEventAgentNetworkType._3; + case _4: return org.hl7.fhir.r4.model.AuditEvent.AuditEventAgentNetworkType._4; + case _5: return org.hl7.fhir.r4.model.AuditEvent.AuditEventAgentNetworkType._5; + default: return org.hl7.fhir.r4.model.AuditEvent.AuditEventAgentNetworkType.NULL; + } +} + + public static org.hl7.fhir.r5.model.AuditEvent.AuditEventSourceComponent convertAuditEventSourceComponent(org.hl7.fhir.r4.model.AuditEvent.AuditEventSourceComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.AuditEvent.AuditEventSourceComponent tgt = new org.hl7.fhir.r5.model.AuditEvent.AuditEventSourceComponent(); + copyElement(src, tgt); + if (src.hasSite()) + tgt.setSiteElement(convertString(src.getSiteElement())); + if (src.hasObserver()) + tgt.setObserver(convertReference(src.getObserver())); + for (org.hl7.fhir.r4.model.Coding t : src.getType()) + tgt.addType(convertCoding(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.AuditEvent.AuditEventSourceComponent convertAuditEventSourceComponent(org.hl7.fhir.r5.model.AuditEvent.AuditEventSourceComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.AuditEvent.AuditEventSourceComponent tgt = new org.hl7.fhir.r4.model.AuditEvent.AuditEventSourceComponent(); + copyElement(src, tgt); + if (src.hasSite()) + tgt.setSiteElement(convertString(src.getSiteElement())); + if (src.hasObserver()) + tgt.setObserver(convertReference(src.getObserver())); + for (org.hl7.fhir.r5.model.Coding t : src.getType()) + tgt.addType(convertCoding(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.AuditEvent.AuditEventEntityComponent convertAuditEventEntityComponent(org.hl7.fhir.r4.model.AuditEvent.AuditEventEntityComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.AuditEvent.AuditEventEntityComponent tgt = new org.hl7.fhir.r5.model.AuditEvent.AuditEventEntityComponent(); + copyElement(src, tgt); + if (src.hasWhat()) + tgt.setWhat(convertReference(src.getWhat())); + if (src.hasType()) + tgt.setType(convertCoding(src.getType())); + if (src.hasRole()) + tgt.setRole(convertCoding(src.getRole())); + if (src.hasLifecycle()) + tgt.setLifecycle(convertCoding(src.getLifecycle())); + for (org.hl7.fhir.r4.model.Coding t : src.getSecurityLabel()) + tgt.addSecurityLabel(convertCoding(t)); + if (src.hasName()) + tgt.setNameElement(convertString(src.getNameElement())); + if (src.hasDescription()) + tgt.setDescriptionElement(convertString(src.getDescriptionElement())); + if (src.hasQuery()) + tgt.setQueryElement(convertBase64Binary(src.getQueryElement())); + for (org.hl7.fhir.r4.model.AuditEvent.AuditEventEntityDetailComponent t : src.getDetail()) + tgt.addDetail(convertAuditEventEntityDetailComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.AuditEvent.AuditEventEntityComponent convertAuditEventEntityComponent(org.hl7.fhir.r5.model.AuditEvent.AuditEventEntityComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.AuditEvent.AuditEventEntityComponent tgt = new org.hl7.fhir.r4.model.AuditEvent.AuditEventEntityComponent(); + copyElement(src, tgt); + if (src.hasWhat()) + tgt.setWhat(convertReference(src.getWhat())); + if (src.hasType()) + tgt.setType(convertCoding(src.getType())); + if (src.hasRole()) + tgt.setRole(convertCoding(src.getRole())); + if (src.hasLifecycle()) + tgt.setLifecycle(convertCoding(src.getLifecycle())); + for (org.hl7.fhir.r5.model.Coding t : src.getSecurityLabel()) + tgt.addSecurityLabel(convertCoding(t)); + if (src.hasName()) + tgt.setNameElement(convertString(src.getNameElement())); + if (src.hasDescription()) + tgt.setDescriptionElement(convertString(src.getDescriptionElement())); + if (src.hasQuery()) + tgt.setQueryElement(convertBase64Binary(src.getQueryElement())); + for (org.hl7.fhir.r5.model.AuditEvent.AuditEventEntityDetailComponent t : src.getDetail()) + tgt.addDetail(convertAuditEventEntityDetailComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.AuditEvent.AuditEventEntityDetailComponent convertAuditEventEntityDetailComponent(org.hl7.fhir.r4.model.AuditEvent.AuditEventEntityDetailComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.AuditEvent.AuditEventEntityDetailComponent tgt = new org.hl7.fhir.r5.model.AuditEvent.AuditEventEntityDetailComponent(); + copyElement(src, tgt); + if (src.hasType()) + tgt.setTypeElement(convertString(src.getTypeElement())); + if (src.hasValue()) + tgt.setValue(convertType(src.getValue())); + return tgt; + } + + public static org.hl7.fhir.r4.model.AuditEvent.AuditEventEntityDetailComponent convertAuditEventEntityDetailComponent(org.hl7.fhir.r5.model.AuditEvent.AuditEventEntityDetailComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.AuditEvent.AuditEventEntityDetailComponent tgt = new org.hl7.fhir.r4.model.AuditEvent.AuditEventEntityDetailComponent(); + copyElement(src, tgt); + if (src.hasType()) + tgt.setTypeElement(convertString(src.getTypeElement())); + if (src.hasValue()) + tgt.setValue(convertType(src.getValue())); + return tgt; + } + + +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Basic.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Basic.java new file mode 100644 index 000000000..b5ece09bf --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Basic.java @@ -0,0 +1,79 @@ +package org.hl7.fhir.convertors.conv40_50; + +import org.hl7.fhir.exceptions.FHIRException; + +import org.hl7.fhir.convertors.VersionConvertor_40_50; + + +/* + Copyright (c) 2011+, HL7, Inc. + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of HL7 nor the names of its contributors may be used to + endorse or promote products derived from this software without specific + prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + +*/ + +// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0 + + +public class Basic extends VersionConvertor_40_50 { + + public static org.hl7.fhir.r5.model.Basic convertBasic(org.hl7.fhir.r4.model.Basic src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Basic tgt = new org.hl7.fhir.r5.model.Basic(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasCode()) + tgt.setCode(convertCodeableConcept(src.getCode())); + if (src.hasSubject()) + tgt.setSubject(convertReference(src.getSubject())); + if (src.hasCreated()) + tgt.setCreatedElement(convertDate(src.getCreatedElement())); + if (src.hasAuthor()) + tgt.setAuthor(convertReference(src.getAuthor())); + return tgt; + } + + public static org.hl7.fhir.r4.model.Basic convertBasic(org.hl7.fhir.r5.model.Basic src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Basic tgt = new org.hl7.fhir.r4.model.Basic(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasCode()) + tgt.setCode(convertCodeableConcept(src.getCode())); + if (src.hasSubject()) + tgt.setSubject(convertReference(src.getSubject())); + if (src.hasCreated()) + tgt.setCreatedElement(convertDate(src.getCreatedElement())); + if (src.hasAuthor()) + tgt.setAuthor(convertReference(src.getAuthor())); + return tgt; + } + + +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Binary.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Binary.java new file mode 100644 index 000000000..21f85098b --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Binary.java @@ -0,0 +1,71 @@ +package org.hl7.fhir.convertors.conv40_50; + +import org.hl7.fhir.exceptions.FHIRException; + +import org.hl7.fhir.convertors.VersionConvertor_40_50; + + +/* + Copyright (c) 2011+, HL7, Inc. + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of HL7 nor the names of its contributors may be used to + endorse or promote products derived from this software without specific + prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + +*/ + +// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0 + + +public class Binary extends VersionConvertor_40_50 { + + public static org.hl7.fhir.r5.model.Binary convertBinary(org.hl7.fhir.r4.model.Binary src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Binary tgt = new org.hl7.fhir.r5.model.Binary(); + copyResource(src, tgt); + if (src.hasContentType()) + tgt.setContentTypeElement(convertCode(src.getContentTypeElement())); + if (src.hasSecurityContext()) + tgt.setSecurityContext(convertReference(src.getSecurityContext())); + if (src.hasData()) + tgt.setDataElement(convertBase64Binary(src.getDataElement())); + return tgt; + } + + public static org.hl7.fhir.r4.model.Binary convertBinary(org.hl7.fhir.r5.model.Binary src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Binary tgt = new org.hl7.fhir.r4.model.Binary(); + copyResource(src, tgt); + if (src.hasContentType()) + tgt.setContentTypeElement(convertCode(src.getContentTypeElement())); + if (src.hasSecurityContext()) + tgt.setSecurityContext(convertReference(src.getSecurityContext())); + if (src.hasData()) + tgt.setDataElement(convertBase64Binary(src.getDataElement())); + return tgt; + } + + +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/BiologicallyDerivedProduct.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/BiologicallyDerivedProduct.java new file mode 100644 index 000000000..266b94454 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/BiologicallyDerivedProduct.java @@ -0,0 +1,287 @@ +package org.hl7.fhir.convertors.conv40_50; + +import org.hl7.fhir.exceptions.FHIRException; + +import org.hl7.fhir.convertors.VersionConvertor_40_50; + + +/* + Copyright (c) 2011+, HL7, Inc. + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of HL7 nor the names of its contributors may be used to + endorse or promote products derived from this software without specific + prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + +*/ + +// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0 + + +public class BiologicallyDerivedProduct extends VersionConvertor_40_50 { + + public static org.hl7.fhir.r5.model.BiologicallyDerivedProduct convertBiologicallyDerivedProduct(org.hl7.fhir.r4.model.BiologicallyDerivedProduct src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.BiologicallyDerivedProduct tgt = new org.hl7.fhir.r5.model.BiologicallyDerivedProduct(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasProductCategory()) + tgt.setProductCategory(convertBiologicallyDerivedProductCategory(src.getProductCategory())); + if (src.hasProductCode()) + tgt.setProductCode(convertCodeableConcept(src.getProductCode())); + if (src.hasStatus()) + tgt.setStatus(convertBiologicallyDerivedProductStatus(src.getStatus())); + for (org.hl7.fhir.r4.model.Reference t : src.getRequest()) + tgt.addRequest(convertReference(t)); + if (src.hasQuantity()) + tgt.setQuantityElement(convertInteger(src.getQuantityElement())); + for (org.hl7.fhir.r4.model.Reference t : src.getParent()) + tgt.addParent(convertReference(t)); + if (src.hasCollection()) + tgt.setCollection(convertBiologicallyDerivedProductCollectionComponent(src.getCollection())); + for (org.hl7.fhir.r4.model.BiologicallyDerivedProduct.BiologicallyDerivedProductProcessingComponent t : src.getProcessing()) + tgt.addProcessing(convertBiologicallyDerivedProductProcessingComponent(t)); + if (src.hasManipulation()) + tgt.setManipulation(convertBiologicallyDerivedProductManipulationComponent(src.getManipulation())); + for (org.hl7.fhir.r4.model.BiologicallyDerivedProduct.BiologicallyDerivedProductStorageComponent t : src.getStorage()) + tgt.addStorage(convertBiologicallyDerivedProductStorageComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.BiologicallyDerivedProduct convertBiologicallyDerivedProduct(org.hl7.fhir.r5.model.BiologicallyDerivedProduct src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.BiologicallyDerivedProduct tgt = new org.hl7.fhir.r4.model.BiologicallyDerivedProduct(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasProductCategory()) + tgt.setProductCategory(convertBiologicallyDerivedProductCategory(src.getProductCategory())); + if (src.hasProductCode()) + tgt.setProductCode(convertCodeableConcept(src.getProductCode())); + if (src.hasStatus()) + tgt.setStatus(convertBiologicallyDerivedProductStatus(src.getStatus())); + for (org.hl7.fhir.r5.model.Reference t : src.getRequest()) + tgt.addRequest(convertReference(t)); + if (src.hasQuantity()) + tgt.setQuantityElement(convertInteger(src.getQuantityElement())); + for (org.hl7.fhir.r5.model.Reference t : src.getParent()) + tgt.addParent(convertReference(t)); + if (src.hasCollection()) + tgt.setCollection(convertBiologicallyDerivedProductCollectionComponent(src.getCollection())); + for (org.hl7.fhir.r5.model.BiologicallyDerivedProduct.BiologicallyDerivedProductProcessingComponent t : src.getProcessing()) + tgt.addProcessing(convertBiologicallyDerivedProductProcessingComponent(t)); + if (src.hasManipulation()) + tgt.setManipulation(convertBiologicallyDerivedProductManipulationComponent(src.getManipulation())); + for (org.hl7.fhir.r5.model.BiologicallyDerivedProduct.BiologicallyDerivedProductStorageComponent t : src.getStorage()) + tgt.addStorage(convertBiologicallyDerivedProductStorageComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.BiologicallyDerivedProduct.BiologicallyDerivedProductCategory convertBiologicallyDerivedProductCategory(org.hl7.fhir.r4.model.BiologicallyDerivedProduct.BiologicallyDerivedProductCategory src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case ORGAN: return org.hl7.fhir.r5.model.BiologicallyDerivedProduct.BiologicallyDerivedProductCategory.ORGAN; + case TISSUE: return org.hl7.fhir.r5.model.BiologicallyDerivedProduct.BiologicallyDerivedProductCategory.TISSUE; + case FLUID: return org.hl7.fhir.r5.model.BiologicallyDerivedProduct.BiologicallyDerivedProductCategory.FLUID; + case CELLS: return org.hl7.fhir.r5.model.BiologicallyDerivedProduct.BiologicallyDerivedProductCategory.CELLS; + case BIOLOGICALAGENT: return org.hl7.fhir.r5.model.BiologicallyDerivedProduct.BiologicallyDerivedProductCategory.BIOLOGICALAGENT; + default: return org.hl7.fhir.r5.model.BiologicallyDerivedProduct.BiologicallyDerivedProductCategory.NULL; + } +} + + public static org.hl7.fhir.r4.model.BiologicallyDerivedProduct.BiologicallyDerivedProductCategory convertBiologicallyDerivedProductCategory(org.hl7.fhir.r5.model.BiologicallyDerivedProduct.BiologicallyDerivedProductCategory src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case ORGAN: return org.hl7.fhir.r4.model.BiologicallyDerivedProduct.BiologicallyDerivedProductCategory.ORGAN; + case TISSUE: return org.hl7.fhir.r4.model.BiologicallyDerivedProduct.BiologicallyDerivedProductCategory.TISSUE; + case FLUID: return org.hl7.fhir.r4.model.BiologicallyDerivedProduct.BiologicallyDerivedProductCategory.FLUID; + case CELLS: return org.hl7.fhir.r4.model.BiologicallyDerivedProduct.BiologicallyDerivedProductCategory.CELLS; + case BIOLOGICALAGENT: return org.hl7.fhir.r4.model.BiologicallyDerivedProduct.BiologicallyDerivedProductCategory.BIOLOGICALAGENT; + default: return org.hl7.fhir.r4.model.BiologicallyDerivedProduct.BiologicallyDerivedProductCategory.NULL; + } +} + + public static org.hl7.fhir.r5.model.BiologicallyDerivedProduct.BiologicallyDerivedProductStatus convertBiologicallyDerivedProductStatus(org.hl7.fhir.r4.model.BiologicallyDerivedProduct.BiologicallyDerivedProductStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case AVAILABLE: return org.hl7.fhir.r5.model.BiologicallyDerivedProduct.BiologicallyDerivedProductStatus.AVAILABLE; + case UNAVAILABLE: return org.hl7.fhir.r5.model.BiologicallyDerivedProduct.BiologicallyDerivedProductStatus.UNAVAILABLE; + default: return org.hl7.fhir.r5.model.BiologicallyDerivedProduct.BiologicallyDerivedProductStatus.NULL; + } +} + + public static org.hl7.fhir.r4.model.BiologicallyDerivedProduct.BiologicallyDerivedProductStatus convertBiologicallyDerivedProductStatus(org.hl7.fhir.r5.model.BiologicallyDerivedProduct.BiologicallyDerivedProductStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case AVAILABLE: return org.hl7.fhir.r4.model.BiologicallyDerivedProduct.BiologicallyDerivedProductStatus.AVAILABLE; + case UNAVAILABLE: return org.hl7.fhir.r4.model.BiologicallyDerivedProduct.BiologicallyDerivedProductStatus.UNAVAILABLE; + default: return org.hl7.fhir.r4.model.BiologicallyDerivedProduct.BiologicallyDerivedProductStatus.NULL; + } +} + + public static org.hl7.fhir.r5.model.BiologicallyDerivedProduct.BiologicallyDerivedProductCollectionComponent convertBiologicallyDerivedProductCollectionComponent(org.hl7.fhir.r4.model.BiologicallyDerivedProduct.BiologicallyDerivedProductCollectionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.BiologicallyDerivedProduct.BiologicallyDerivedProductCollectionComponent tgt = new org.hl7.fhir.r5.model.BiologicallyDerivedProduct.BiologicallyDerivedProductCollectionComponent(); + copyElement(src, tgt); + if (src.hasCollector()) + tgt.setCollector(convertReference(src.getCollector())); + if (src.hasSource()) + tgt.setSource(convertReference(src.getSource())); + if (src.hasCollected()) + tgt.setCollected(convertType(src.getCollected())); + return tgt; + } + + public static org.hl7.fhir.r4.model.BiologicallyDerivedProduct.BiologicallyDerivedProductCollectionComponent convertBiologicallyDerivedProductCollectionComponent(org.hl7.fhir.r5.model.BiologicallyDerivedProduct.BiologicallyDerivedProductCollectionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.BiologicallyDerivedProduct.BiologicallyDerivedProductCollectionComponent tgt = new org.hl7.fhir.r4.model.BiologicallyDerivedProduct.BiologicallyDerivedProductCollectionComponent(); + copyElement(src, tgt); + if (src.hasCollector()) + tgt.setCollector(convertReference(src.getCollector())); + if (src.hasSource()) + tgt.setSource(convertReference(src.getSource())); + if (src.hasCollected()) + tgt.setCollected(convertType(src.getCollected())); + return tgt; + } + + public static org.hl7.fhir.r5.model.BiologicallyDerivedProduct.BiologicallyDerivedProductProcessingComponent convertBiologicallyDerivedProductProcessingComponent(org.hl7.fhir.r4.model.BiologicallyDerivedProduct.BiologicallyDerivedProductProcessingComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.BiologicallyDerivedProduct.BiologicallyDerivedProductProcessingComponent tgt = new org.hl7.fhir.r5.model.BiologicallyDerivedProduct.BiologicallyDerivedProductProcessingComponent(); + copyElement(src, tgt); + if (src.hasDescription()) + tgt.setDescriptionElement(convertString(src.getDescriptionElement())); + if (src.hasProcedure()) + tgt.setProcedure(convertCodeableConcept(src.getProcedure())); + if (src.hasAdditive()) + tgt.setAdditive(convertReference(src.getAdditive())); + if (src.hasTime()) + tgt.setTime(convertType(src.getTime())); + return tgt; + } + + public static org.hl7.fhir.r4.model.BiologicallyDerivedProduct.BiologicallyDerivedProductProcessingComponent convertBiologicallyDerivedProductProcessingComponent(org.hl7.fhir.r5.model.BiologicallyDerivedProduct.BiologicallyDerivedProductProcessingComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.BiologicallyDerivedProduct.BiologicallyDerivedProductProcessingComponent tgt = new org.hl7.fhir.r4.model.BiologicallyDerivedProduct.BiologicallyDerivedProductProcessingComponent(); + copyElement(src, tgt); + if (src.hasDescription()) + tgt.setDescriptionElement(convertString(src.getDescriptionElement())); + if (src.hasProcedure()) + tgt.setProcedure(convertCodeableConcept(src.getProcedure())); + if (src.hasAdditive()) + tgt.setAdditive(convertReference(src.getAdditive())); + if (src.hasTime()) + tgt.setTime(convertType(src.getTime())); + return tgt; + } + + public static org.hl7.fhir.r5.model.BiologicallyDerivedProduct.BiologicallyDerivedProductManipulationComponent convertBiologicallyDerivedProductManipulationComponent(org.hl7.fhir.r4.model.BiologicallyDerivedProduct.BiologicallyDerivedProductManipulationComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.BiologicallyDerivedProduct.BiologicallyDerivedProductManipulationComponent tgt = new org.hl7.fhir.r5.model.BiologicallyDerivedProduct.BiologicallyDerivedProductManipulationComponent(); + copyElement(src, tgt); + if (src.hasDescription()) + tgt.setDescriptionElement(convertString(src.getDescriptionElement())); + if (src.hasTime()) + tgt.setTime(convertType(src.getTime())); + return tgt; + } + + public static org.hl7.fhir.r4.model.BiologicallyDerivedProduct.BiologicallyDerivedProductManipulationComponent convertBiologicallyDerivedProductManipulationComponent(org.hl7.fhir.r5.model.BiologicallyDerivedProduct.BiologicallyDerivedProductManipulationComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.BiologicallyDerivedProduct.BiologicallyDerivedProductManipulationComponent tgt = new org.hl7.fhir.r4.model.BiologicallyDerivedProduct.BiologicallyDerivedProductManipulationComponent(); + copyElement(src, tgt); + if (src.hasDescription()) + tgt.setDescriptionElement(convertString(src.getDescriptionElement())); + if (src.hasTime()) + tgt.setTime(convertType(src.getTime())); + return tgt; + } + + public static org.hl7.fhir.r5.model.BiologicallyDerivedProduct.BiologicallyDerivedProductStorageComponent convertBiologicallyDerivedProductStorageComponent(org.hl7.fhir.r4.model.BiologicallyDerivedProduct.BiologicallyDerivedProductStorageComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.BiologicallyDerivedProduct.BiologicallyDerivedProductStorageComponent tgt = new org.hl7.fhir.r5.model.BiologicallyDerivedProduct.BiologicallyDerivedProductStorageComponent(); + copyElement(src, tgt); + if (src.hasDescription()) + tgt.setDescriptionElement(convertString(src.getDescriptionElement())); + if (src.hasTemperature()) + tgt.setTemperatureElement(convertDecimal(src.getTemperatureElement())); + if (src.hasScale()) + tgt.setScale(convertBiologicallyDerivedProductStorageScale(src.getScale())); + if (src.hasDuration()) + tgt.setDuration(convertPeriod(src.getDuration())); + return tgt; + } + + public static org.hl7.fhir.r4.model.BiologicallyDerivedProduct.BiologicallyDerivedProductStorageComponent convertBiologicallyDerivedProductStorageComponent(org.hl7.fhir.r5.model.BiologicallyDerivedProduct.BiologicallyDerivedProductStorageComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.BiologicallyDerivedProduct.BiologicallyDerivedProductStorageComponent tgt = new org.hl7.fhir.r4.model.BiologicallyDerivedProduct.BiologicallyDerivedProductStorageComponent(); + copyElement(src, tgt); + if (src.hasDescription()) + tgt.setDescriptionElement(convertString(src.getDescriptionElement())); + if (src.hasTemperature()) + tgt.setTemperatureElement(convertDecimal(src.getTemperatureElement())); + if (src.hasScale()) + tgt.setScale(convertBiologicallyDerivedProductStorageScale(src.getScale())); + if (src.hasDuration()) + tgt.setDuration(convertPeriod(src.getDuration())); + return tgt; + } + + public static org.hl7.fhir.r5.model.BiologicallyDerivedProduct.BiologicallyDerivedProductStorageScale convertBiologicallyDerivedProductStorageScale(org.hl7.fhir.r4.model.BiologicallyDerivedProduct.BiologicallyDerivedProductStorageScale src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case FARENHEIT: return org.hl7.fhir.r5.model.BiologicallyDerivedProduct.BiologicallyDerivedProductStorageScale.FARENHEIT; + case CELSIUS: return org.hl7.fhir.r5.model.BiologicallyDerivedProduct.BiologicallyDerivedProductStorageScale.CELSIUS; + case KELVIN: return org.hl7.fhir.r5.model.BiologicallyDerivedProduct.BiologicallyDerivedProductStorageScale.KELVIN; + default: return org.hl7.fhir.r5.model.BiologicallyDerivedProduct.BiologicallyDerivedProductStorageScale.NULL; + } +} + + public static org.hl7.fhir.r4.model.BiologicallyDerivedProduct.BiologicallyDerivedProductStorageScale convertBiologicallyDerivedProductStorageScale(org.hl7.fhir.r5.model.BiologicallyDerivedProduct.BiologicallyDerivedProductStorageScale src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case FARENHEIT: return org.hl7.fhir.r4.model.BiologicallyDerivedProduct.BiologicallyDerivedProductStorageScale.FARENHEIT; + case CELSIUS: return org.hl7.fhir.r4.model.BiologicallyDerivedProduct.BiologicallyDerivedProductStorageScale.CELSIUS; + case KELVIN: return org.hl7.fhir.r4.model.BiologicallyDerivedProduct.BiologicallyDerivedProductStorageScale.KELVIN; + default: return org.hl7.fhir.r4.model.BiologicallyDerivedProduct.BiologicallyDerivedProductStorageScale.NULL; + } +} + + +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/BodyStructure.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/BodyStructure.java new file mode 100644 index 000000000..007909af6 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/BodyStructure.java @@ -0,0 +1,91 @@ +package org.hl7.fhir.convertors.conv40_50; + +import org.hl7.fhir.exceptions.FHIRException; + +import org.hl7.fhir.convertors.VersionConvertor_40_50; + + +/* + Copyright (c) 2011+, HL7, Inc. + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of HL7 nor the names of its contributors may be used to + endorse or promote products derived from this software without specific + prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + +*/ + +// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0 + + +public class BodyStructure extends VersionConvertor_40_50 { + + public static org.hl7.fhir.r5.model.BodyStructure convertBodyStructure(org.hl7.fhir.r4.model.BodyStructure src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.BodyStructure tgt = new org.hl7.fhir.r5.model.BodyStructure(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasActive()) + tgt.setActiveElement(convertBoolean(src.getActiveElement())); + if (src.hasMorphology()) + tgt.setMorphology(convertCodeableConcept(src.getMorphology())); + if (src.hasLocation()) + tgt.setLocation(convertCodeableConcept(src.getLocation())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getLocationQualifier()) + tgt.addLocationQualifier(convertCodeableConcept(t)); + if (src.hasDescription()) + tgt.setDescriptionElement(convertString(src.getDescriptionElement())); + for (org.hl7.fhir.r4.model.Attachment t : src.getImage()) + tgt.addImage(convertAttachment(t)); + if (src.hasPatient()) + tgt.setPatient(convertReference(src.getPatient())); + return tgt; + } + + public static org.hl7.fhir.r4.model.BodyStructure convertBodyStructure(org.hl7.fhir.r5.model.BodyStructure src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.BodyStructure tgt = new org.hl7.fhir.r4.model.BodyStructure(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasActive()) + tgt.setActiveElement(convertBoolean(src.getActiveElement())); + if (src.hasMorphology()) + tgt.setMorphology(convertCodeableConcept(src.getMorphology())); + if (src.hasLocation()) + tgt.setLocation(convertCodeableConcept(src.getLocation())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getLocationQualifier()) + tgt.addLocationQualifier(convertCodeableConcept(t)); + if (src.hasDescription()) + tgt.setDescriptionElement(convertString(src.getDescriptionElement())); + for (org.hl7.fhir.r5.model.Attachment t : src.getImage()) + tgt.addImage(convertAttachment(t)); + if (src.hasPatient()) + tgt.setPatient(convertReference(src.getPatient())); + return tgt; + } + + +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Bundle.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Bundle.java new file mode 100644 index 000000000..03ce29120 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Bundle.java @@ -0,0 +1,335 @@ +package org.hl7.fhir.convertors.conv40_50; + +import org.hl7.fhir.exceptions.FHIRException; + +import org.hl7.fhir.convertors.VersionConvertor_40_50; + + +/* + Copyright (c) 2011+, HL7, Inc. + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of HL7 nor the names of its contributors may be used to + endorse or promote products derived from this software without specific + prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + +*/ + +// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0 + + +public class Bundle extends VersionConvertor_40_50 { + + public static org.hl7.fhir.r5.model.Bundle convertBundle(org.hl7.fhir.r4.model.Bundle src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Bundle tgt = new org.hl7.fhir.r5.model.Bundle(); + copyResource(src, tgt); + if (src.hasIdentifier()) + tgt.setIdentifier(convertIdentifier(src.getIdentifier())); + if (src.hasType()) + tgt.setType(convertBundleType(src.getType())); + if (src.hasTimestamp()) + tgt.setTimestampElement(convertInstant(src.getTimestampElement())); + if (src.hasTotal()) + tgt.setTotalElement(convertUnsignedInt(src.getTotalElement())); + for (org.hl7.fhir.r4.model.Bundle.BundleLinkComponent t : src.getLink()) + tgt.addLink(convertBundleLinkComponent(t)); + for (org.hl7.fhir.r4.model.Bundle.BundleEntryComponent t : src.getEntry()) + tgt.addEntry(convertBundleEntryComponent(t)); + if (src.hasSignature()) + tgt.setSignature(convertSignature(src.getSignature())); + return tgt; + } + + public static org.hl7.fhir.r4.model.Bundle convertBundle(org.hl7.fhir.r5.model.Bundle src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Bundle tgt = new org.hl7.fhir.r4.model.Bundle(); + copyResource(src, tgt); + if (src.hasIdentifier()) + tgt.setIdentifier(convertIdentifier(src.getIdentifier())); + if (src.hasType()) + tgt.setType(convertBundleType(src.getType())); + if (src.hasTimestamp()) + tgt.setTimestampElement(convertInstant(src.getTimestampElement())); + if (src.hasTotal()) + tgt.setTotalElement(convertUnsignedInt(src.getTotalElement())); + for (org.hl7.fhir.r5.model.Bundle.BundleLinkComponent t : src.getLink()) + tgt.addLink(convertBundleLinkComponent(t)); + for (org.hl7.fhir.r5.model.Bundle.BundleEntryComponent t : src.getEntry()) + tgt.addEntry(convertBundleEntryComponent(t)); + if (src.hasSignature()) + tgt.setSignature(convertSignature(src.getSignature())); + return tgt; + } + + public static org.hl7.fhir.r5.model.Bundle.BundleType convertBundleType(org.hl7.fhir.r4.model.Bundle.BundleType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case DOCUMENT: return org.hl7.fhir.r5.model.Bundle.BundleType.DOCUMENT; + case MESSAGE: return org.hl7.fhir.r5.model.Bundle.BundleType.MESSAGE; + case TRANSACTION: return org.hl7.fhir.r5.model.Bundle.BundleType.TRANSACTION; + case TRANSACTIONRESPONSE: return org.hl7.fhir.r5.model.Bundle.BundleType.TRANSACTIONRESPONSE; + case BATCH: return org.hl7.fhir.r5.model.Bundle.BundleType.BATCH; + case BATCHRESPONSE: return org.hl7.fhir.r5.model.Bundle.BundleType.BATCHRESPONSE; + case HISTORY: return org.hl7.fhir.r5.model.Bundle.BundleType.HISTORY; + case SEARCHSET: return org.hl7.fhir.r5.model.Bundle.BundleType.SEARCHSET; + case COLLECTION: return org.hl7.fhir.r5.model.Bundle.BundleType.COLLECTION; + default: return org.hl7.fhir.r5.model.Bundle.BundleType.NULL; + } +} + + public static org.hl7.fhir.r4.model.Bundle.BundleType convertBundleType(org.hl7.fhir.r5.model.Bundle.BundleType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case DOCUMENT: return org.hl7.fhir.r4.model.Bundle.BundleType.DOCUMENT; + case MESSAGE: return org.hl7.fhir.r4.model.Bundle.BundleType.MESSAGE; + case TRANSACTION: return org.hl7.fhir.r4.model.Bundle.BundleType.TRANSACTION; + case TRANSACTIONRESPONSE: return org.hl7.fhir.r4.model.Bundle.BundleType.TRANSACTIONRESPONSE; + case BATCH: return org.hl7.fhir.r4.model.Bundle.BundleType.BATCH; + case BATCHRESPONSE: return org.hl7.fhir.r4.model.Bundle.BundleType.BATCHRESPONSE; + case HISTORY: return org.hl7.fhir.r4.model.Bundle.BundleType.HISTORY; + case SEARCHSET: return org.hl7.fhir.r4.model.Bundle.BundleType.SEARCHSET; + case COLLECTION: return org.hl7.fhir.r4.model.Bundle.BundleType.COLLECTION; + default: return org.hl7.fhir.r4.model.Bundle.BundleType.NULL; + } +} + + public static org.hl7.fhir.r5.model.Bundle.BundleLinkComponent convertBundleLinkComponent(org.hl7.fhir.r4.model.Bundle.BundleLinkComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Bundle.BundleLinkComponent tgt = new org.hl7.fhir.r5.model.Bundle.BundleLinkComponent(); + copyElement(src, tgt); + if (src.hasRelation()) + tgt.setRelationElement(convertString(src.getRelationElement())); + if (src.hasUrl()) + tgt.setUrlElement(convertUri(src.getUrlElement())); + return tgt; + } + + public static org.hl7.fhir.r4.model.Bundle.BundleLinkComponent convertBundleLinkComponent(org.hl7.fhir.r5.model.Bundle.BundleLinkComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Bundle.BundleLinkComponent tgt = new org.hl7.fhir.r4.model.Bundle.BundleLinkComponent(); + copyElement(src, tgt); + if (src.hasRelation()) + tgt.setRelationElement(convertString(src.getRelationElement())); + if (src.hasUrl()) + tgt.setUrlElement(convertUri(src.getUrlElement())); + return tgt; + } + + public static org.hl7.fhir.r5.model.Bundle.BundleEntryComponent convertBundleEntryComponent(org.hl7.fhir.r4.model.Bundle.BundleEntryComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Bundle.BundleEntryComponent tgt = new org.hl7.fhir.r5.model.Bundle.BundleEntryComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.r4.model.Bundle.BundleLinkComponent t : src.getLink()) + tgt.addLink(convertBundleLinkComponent(t)); + if (src.hasFullUrl()) + tgt.setFullUrlElement(convertUri(src.getFullUrlElement())); + if (src.hasResource()) + tgt.setResource(convertResource(src.getResource())); + if (src.hasSearch()) + tgt.setSearch(convertBundleEntrySearchComponent(src.getSearch())); + if (src.hasRequest()) + tgt.setRequest(convertBundleEntryRequestComponent(src.getRequest())); + if (src.hasResponse()) + tgt.setResponse(convertBundleEntryResponseComponent(src.getResponse())); + return tgt; + } + + public static org.hl7.fhir.r4.model.Bundle.BundleEntryComponent convertBundleEntryComponent(org.hl7.fhir.r5.model.Bundle.BundleEntryComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Bundle.BundleEntryComponent tgt = new org.hl7.fhir.r4.model.Bundle.BundleEntryComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.r5.model.Bundle.BundleLinkComponent t : src.getLink()) + tgt.addLink(convertBundleLinkComponent(t)); + if (src.hasFullUrl()) + tgt.setFullUrlElement(convertUri(src.getFullUrlElement())); + if (src.hasResource()) + tgt.setResource(convertResource(src.getResource())); + if (src.hasSearch()) + tgt.setSearch(convertBundleEntrySearchComponent(src.getSearch())); + if (src.hasRequest()) + tgt.setRequest(convertBundleEntryRequestComponent(src.getRequest())); + if (src.hasResponse()) + tgt.setResponse(convertBundleEntryResponseComponent(src.getResponse())); + return tgt; + } + + public static org.hl7.fhir.r5.model.Bundle.BundleEntrySearchComponent convertBundleEntrySearchComponent(org.hl7.fhir.r4.model.Bundle.BundleEntrySearchComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Bundle.BundleEntrySearchComponent tgt = new org.hl7.fhir.r5.model.Bundle.BundleEntrySearchComponent(); + copyElement(src, tgt); + if (src.hasMode()) + tgt.setMode(convertSearchEntryMode(src.getMode())); + if (src.hasScore()) + tgt.setScoreElement(convertDecimal(src.getScoreElement())); + return tgt; + } + + public static org.hl7.fhir.r4.model.Bundle.BundleEntrySearchComponent convertBundleEntrySearchComponent(org.hl7.fhir.r5.model.Bundle.BundleEntrySearchComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Bundle.BundleEntrySearchComponent tgt = new org.hl7.fhir.r4.model.Bundle.BundleEntrySearchComponent(); + copyElement(src, tgt); + if (src.hasMode()) + tgt.setMode(convertSearchEntryMode(src.getMode())); + if (src.hasScore()) + tgt.setScoreElement(convertDecimal(src.getScoreElement())); + return tgt; + } + + public static org.hl7.fhir.r5.model.Bundle.SearchEntryMode convertSearchEntryMode(org.hl7.fhir.r4.model.Bundle.SearchEntryMode src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case MATCH: return org.hl7.fhir.r5.model.Bundle.SearchEntryMode.MATCH; + case INCLUDE: return org.hl7.fhir.r5.model.Bundle.SearchEntryMode.INCLUDE; + case OUTCOME: return org.hl7.fhir.r5.model.Bundle.SearchEntryMode.OUTCOME; + default: return org.hl7.fhir.r5.model.Bundle.SearchEntryMode.NULL; + } +} + + public static org.hl7.fhir.r4.model.Bundle.SearchEntryMode convertSearchEntryMode(org.hl7.fhir.r5.model.Bundle.SearchEntryMode src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case MATCH: return org.hl7.fhir.r4.model.Bundle.SearchEntryMode.MATCH; + case INCLUDE: return org.hl7.fhir.r4.model.Bundle.SearchEntryMode.INCLUDE; + case OUTCOME: return org.hl7.fhir.r4.model.Bundle.SearchEntryMode.OUTCOME; + default: return org.hl7.fhir.r4.model.Bundle.SearchEntryMode.NULL; + } +} + + public static org.hl7.fhir.r5.model.Bundle.BundleEntryRequestComponent convertBundleEntryRequestComponent(org.hl7.fhir.r4.model.Bundle.BundleEntryRequestComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Bundle.BundleEntryRequestComponent tgt = new org.hl7.fhir.r5.model.Bundle.BundleEntryRequestComponent(); + copyElement(src, tgt); + if (src.hasMethod()) + tgt.setMethod(convertHTTPVerb(src.getMethod())); + if (src.hasUrl()) + tgt.setUrlElement(convertUri(src.getUrlElement())); + if (src.hasIfNoneMatch()) + tgt.setIfNoneMatchElement(convertString(src.getIfNoneMatchElement())); + if (src.hasIfModifiedSince()) + tgt.setIfModifiedSinceElement(convertInstant(src.getIfModifiedSinceElement())); + if (src.hasIfMatch()) + tgt.setIfMatchElement(convertString(src.getIfMatchElement())); + if (src.hasIfNoneExist()) + tgt.setIfNoneExistElement(convertString(src.getIfNoneExistElement())); + return tgt; + } + + public static org.hl7.fhir.r4.model.Bundle.BundleEntryRequestComponent convertBundleEntryRequestComponent(org.hl7.fhir.r5.model.Bundle.BundleEntryRequestComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Bundle.BundleEntryRequestComponent tgt = new org.hl7.fhir.r4.model.Bundle.BundleEntryRequestComponent(); + copyElement(src, tgt); + if (src.hasMethod()) + tgt.setMethod(convertHTTPVerb(src.getMethod())); + if (src.hasUrl()) + tgt.setUrlElement(convertUri(src.getUrlElement())); + if (src.hasIfNoneMatch()) + tgt.setIfNoneMatchElement(convertString(src.getIfNoneMatchElement())); + if (src.hasIfModifiedSince()) + tgt.setIfModifiedSinceElement(convertInstant(src.getIfModifiedSinceElement())); + if (src.hasIfMatch()) + tgt.setIfMatchElement(convertString(src.getIfMatchElement())); + if (src.hasIfNoneExist()) + tgt.setIfNoneExistElement(convertString(src.getIfNoneExistElement())); + return tgt; + } + + public static org.hl7.fhir.r5.model.Bundle.HTTPVerb convertHTTPVerb(org.hl7.fhir.r4.model.Bundle.HTTPVerb src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case GET: return org.hl7.fhir.r5.model.Bundle.HTTPVerb.GET; + case HEAD: return org.hl7.fhir.r5.model.Bundle.HTTPVerb.HEAD; + case POST: return org.hl7.fhir.r5.model.Bundle.HTTPVerb.POST; + case PUT: return org.hl7.fhir.r5.model.Bundle.HTTPVerb.PUT; + case DELETE: return org.hl7.fhir.r5.model.Bundle.HTTPVerb.DELETE; + case PATCH: return org.hl7.fhir.r5.model.Bundle.HTTPVerb.PATCH; + default: return org.hl7.fhir.r5.model.Bundle.HTTPVerb.NULL; + } +} + + public static org.hl7.fhir.r4.model.Bundle.HTTPVerb convertHTTPVerb(org.hl7.fhir.r5.model.Bundle.HTTPVerb src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case GET: return org.hl7.fhir.r4.model.Bundle.HTTPVerb.GET; + case HEAD: return org.hl7.fhir.r4.model.Bundle.HTTPVerb.HEAD; + case POST: return org.hl7.fhir.r4.model.Bundle.HTTPVerb.POST; + case PUT: return org.hl7.fhir.r4.model.Bundle.HTTPVerb.PUT; + case DELETE: return org.hl7.fhir.r4.model.Bundle.HTTPVerb.DELETE; + case PATCH: return org.hl7.fhir.r4.model.Bundle.HTTPVerb.PATCH; + default: return org.hl7.fhir.r4.model.Bundle.HTTPVerb.NULL; + } +} + + public static org.hl7.fhir.r5.model.Bundle.BundleEntryResponseComponent convertBundleEntryResponseComponent(org.hl7.fhir.r4.model.Bundle.BundleEntryResponseComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Bundle.BundleEntryResponseComponent tgt = new org.hl7.fhir.r5.model.Bundle.BundleEntryResponseComponent(); + copyElement(src, tgt); + if (src.hasStatus()) + tgt.setStatusElement(convertString(src.getStatusElement())); + if (src.hasLocation()) + tgt.setLocationElement(convertUri(src.getLocationElement())); + if (src.hasEtag()) + tgt.setEtagElement(convertString(src.getEtagElement())); + if (src.hasLastModified()) + tgt.setLastModifiedElement(convertInstant(src.getLastModifiedElement())); + if (src.hasOutcome()) + tgt.setOutcome(convertResource(src.getOutcome())); + return tgt; + } + + public static org.hl7.fhir.r4.model.Bundle.BundleEntryResponseComponent convertBundleEntryResponseComponent(org.hl7.fhir.r5.model.Bundle.BundleEntryResponseComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Bundle.BundleEntryResponseComponent tgt = new org.hl7.fhir.r4.model.Bundle.BundleEntryResponseComponent(); + copyElement(src, tgt); + if (src.hasStatus()) + tgt.setStatusElement(convertString(src.getStatusElement())); + if (src.hasLocation()) + tgt.setLocationElement(convertUri(src.getLocationElement())); + if (src.hasEtag()) + tgt.setEtagElement(convertString(src.getEtagElement())); + if (src.hasLastModified()) + tgt.setLastModifiedElement(convertInstant(src.getLastModifiedElement())); + if (src.hasOutcome()) + tgt.setOutcome(convertResource(src.getOutcome())); + return tgt; + } + + +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/CapabilityStatement.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/CapabilityStatement.java new file mode 100644 index 000000000..d70b4c487 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/CapabilityStatement.java @@ -0,0 +1,829 @@ +package org.hl7.fhir.convertors.conv40_50; + +import org.hl7.fhir.exceptions.FHIRException; + +import org.hl7.fhir.convertors.VersionConvertor_40_50; + + +/* + Copyright (c) 2011+, HL7, Inc. + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of HL7 nor the names of its contributors may be used to + endorse or promote products derived from this software without specific + prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + +*/ + +// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0 + + +public class CapabilityStatement extends VersionConvertor_40_50 { + + public static org.hl7.fhir.r5.model.CapabilityStatement convertCapabilityStatement(org.hl7.fhir.r4.model.CapabilityStatement src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.CapabilityStatement tgt = new org.hl7.fhir.r5.model.CapabilityStatement(); + copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrlElement(convertUri(src.getUrlElement())); + if (src.hasVersion()) + tgt.setVersionElement(convertString(src.getVersionElement())); + if (src.hasName()) + tgt.setNameElement(convertString(src.getNameElement())); + if (src.hasTitle()) + tgt.setTitleElement(convertString(src.getTitleElement())); + if (src.hasStatus()) + tgt.setStatus(Enumerations.convertPublicationStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimentalElement(convertBoolean(src.getExperimentalElement())); + if (src.hasDate()) + tgt.setDateElement(convertDateTime(src.getDateElement())); + if (src.hasPublisher()) + tgt.setPublisherElement(convertString(src.getPublisherElement())); + for (org.hl7.fhir.r4.model.ContactDetail t : src.getContact()) + tgt.addContact(convertContactDetail(t)); + if (src.hasDescription()) + tgt.setDescriptionElement(convertMarkdown(src.getDescriptionElement())); + for (org.hl7.fhir.r4.model.UsageContext t : src.getUseContext()) + tgt.addUseContext(convertUsageContext(t)); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getJurisdiction()) + tgt.addJurisdiction(convertCodeableConcept(t)); + if (src.hasPurpose()) + tgt.setPurposeElement(convertMarkdown(src.getPurposeElement())); + if (src.hasCopyright()) + tgt.setCopyrightElement(convertMarkdown(src.getCopyrightElement())); + if (src.hasKind()) + tgt.setKind(convertCapabilityStatementKind(src.getKind())); + for (org.hl7.fhir.r4.model.CanonicalType t : src.getInstantiates()) + tgt.getInstantiates().add(convertCanonical(t)); + for (org.hl7.fhir.r4.model.CanonicalType t : src.getImports()) + tgt.getImports().add(convertCanonical(t)); + if (src.hasSoftware()) + tgt.setSoftware(convertCapabilityStatementSoftwareComponent(src.getSoftware())); + if (src.hasImplementation()) + tgt.setImplementation(convertCapabilityStatementImplementationComponent(src.getImplementation())); + if (src.hasFhirVersion()) + tgt.setFhirVersion(Enumerations.convertFHIRVersion(src.getFhirVersion())); + for (org.hl7.fhir.r4.model.CodeType t : src.getFormat()) + tgt.getFormat().add(convertCode(t)); + for (org.hl7.fhir.r4.model.CodeType t : src.getPatchFormat()) + tgt.getPatchFormat().add(convertCode(t)); + for (org.hl7.fhir.r4.model.CanonicalType t : src.getImplementationGuide()) + tgt.getImplementationGuide().add(convertCanonical(t)); + for (org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestComponent t : src.getRest()) + tgt.addRest(convertCapabilityStatementRestComponent(t)); + for (org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementMessagingComponent t : src.getMessaging()) + tgt.addMessaging(convertCapabilityStatementMessagingComponent(t)); + for (org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementDocumentComponent t : src.getDocument()) + tgt.addDocument(convertCapabilityStatementDocumentComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.CapabilityStatement convertCapabilityStatement(org.hl7.fhir.r5.model.CapabilityStatement src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.CapabilityStatement tgt = new org.hl7.fhir.r4.model.CapabilityStatement(); + copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrlElement(convertUri(src.getUrlElement())); + if (src.hasVersion()) + tgt.setVersionElement(convertString(src.getVersionElement())); + if (src.hasName()) + tgt.setNameElement(convertString(src.getNameElement())); + if (src.hasTitle()) + tgt.setTitleElement(convertString(src.getTitleElement())); + if (src.hasStatus()) + tgt.setStatus(Enumerations.convertPublicationStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimentalElement(convertBoolean(src.getExperimentalElement())); + if (src.hasDate()) + tgt.setDateElement(convertDateTime(src.getDateElement())); + if (src.hasPublisher()) + tgt.setPublisherElement(convertString(src.getPublisherElement())); + for (org.hl7.fhir.r5.model.ContactDetail t : src.getContact()) + tgt.addContact(convertContactDetail(t)); + if (src.hasDescription()) + tgt.setDescriptionElement(convertMarkdown(src.getDescriptionElement())); + for (org.hl7.fhir.r5.model.UsageContext t : src.getUseContext()) + tgt.addUseContext(convertUsageContext(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getJurisdiction()) + tgt.addJurisdiction(convertCodeableConcept(t)); + if (src.hasPurpose()) + tgt.setPurposeElement(convertMarkdown(src.getPurposeElement())); + if (src.hasCopyright()) + tgt.setCopyrightElement(convertMarkdown(src.getCopyrightElement())); + if (src.hasKind()) + tgt.setKind(convertCapabilityStatementKind(src.getKind())); + for (org.hl7.fhir.r5.model.CanonicalType t : src.getInstantiates()) + tgt.getInstantiates().add(convertCanonical(t)); + for (org.hl7.fhir.r5.model.CanonicalType t : src.getImports()) + tgt.getImports().add(convertCanonical(t)); + if (src.hasSoftware()) + tgt.setSoftware(convertCapabilityStatementSoftwareComponent(src.getSoftware())); + if (src.hasImplementation()) + tgt.setImplementation(convertCapabilityStatementImplementationComponent(src.getImplementation())); + if (src.hasFhirVersion()) + tgt.setFhirVersion(Enumerations.convertFHIRVersion(src.getFhirVersion())); + for (org.hl7.fhir.r5.model.CodeType t : src.getFormat()) + tgt.getFormat().add(convertCode(t)); + for (org.hl7.fhir.r5.model.CodeType t : src.getPatchFormat()) + tgt.getPatchFormat().add(convertCode(t)); + for (org.hl7.fhir.r5.model.CanonicalType t : src.getImplementationGuide()) + tgt.getImplementationGuide().add(convertCanonical(t)); + for (org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestComponent t : src.getRest()) + tgt.addRest(convertCapabilityStatementRestComponent(t)); + for (org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementMessagingComponent t : src.getMessaging()) + tgt.addMessaging(convertCapabilityStatementMessagingComponent(t)); + for (org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementDocumentComponent t : src.getDocument()) + tgt.addDocument(convertCapabilityStatementDocumentComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementKind convertCapabilityStatementKind(org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementKind src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case INSTANCE: return org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementKind.INSTANCE; + case CAPABILITY: return org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementKind.CAPABILITY; + case REQUIREMENTS: return org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementKind.REQUIREMENTS; + default: return org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementKind.NULL; + } +} + + public static org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementKind convertCapabilityStatementKind(org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementKind src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case INSTANCE: return org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementKind.INSTANCE; + case CAPABILITY: return org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementKind.CAPABILITY; + case REQUIREMENTS: return org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementKind.REQUIREMENTS; + default: return org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementKind.NULL; + } +} + + public static org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementSoftwareComponent convertCapabilityStatementSoftwareComponent(org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementSoftwareComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementSoftwareComponent tgt = new org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementSoftwareComponent(); + copyElement(src, tgt); + if (src.hasName()) + tgt.setNameElement(convertString(src.getNameElement())); + if (src.hasVersion()) + tgt.setVersionElement(convertString(src.getVersionElement())); + if (src.hasReleaseDate()) + tgt.setReleaseDateElement(convertDateTime(src.getReleaseDateElement())); + return tgt; + } + + public static org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementSoftwareComponent convertCapabilityStatementSoftwareComponent(org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementSoftwareComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementSoftwareComponent tgt = new org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementSoftwareComponent(); + copyElement(src, tgt); + if (src.hasName()) + tgt.setNameElement(convertString(src.getNameElement())); + if (src.hasVersion()) + tgt.setVersionElement(convertString(src.getVersionElement())); + if (src.hasReleaseDate()) + tgt.setReleaseDateElement(convertDateTime(src.getReleaseDateElement())); + return tgt; + } + + public static org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementImplementationComponent convertCapabilityStatementImplementationComponent(org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementImplementationComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementImplementationComponent tgt = new org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementImplementationComponent(); + copyElement(src, tgt); + if (src.hasDescription()) + tgt.setDescriptionElement(convertString(src.getDescriptionElement())); + if (src.hasUrl()) + tgt.setUrlElement(convertUrl(src.getUrlElement())); + if (src.hasCustodian()) + tgt.setCustodian(convertReference(src.getCustodian())); + return tgt; + } + + public static org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementImplementationComponent convertCapabilityStatementImplementationComponent(org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementImplementationComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementImplementationComponent tgt = new org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementImplementationComponent(); + copyElement(src, tgt); + if (src.hasDescription()) + tgt.setDescriptionElement(convertString(src.getDescriptionElement())); + if (src.hasUrl()) + tgt.setUrlElement(convertUrl(src.getUrlElement())); + if (src.hasCustodian()) + tgt.setCustodian(convertReference(src.getCustodian())); + return tgt; + } + + public static org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestComponent convertCapabilityStatementRestComponent(org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestComponent tgt = new org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestComponent(); + copyElement(src, tgt); + if (src.hasMode()) + tgt.setMode(convertRestfulCapabilityMode(src.getMode())); + if (src.hasDocumentation()) + tgt.setDocumentationElement(convertMarkdown(src.getDocumentationElement())); + if (src.hasSecurity()) + tgt.setSecurity(convertCapabilityStatementRestSecurityComponent(src.getSecurity())); + for (org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceComponent t : src.getResource()) + tgt.addResource(convertCapabilityStatementRestResourceComponent(t)); + for (org.hl7.fhir.r4.model.CapabilityStatement.SystemInteractionComponent t : src.getInteraction()) + tgt.addInteraction(convertSystemInteractionComponent(t)); + for (org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent t : src.getSearchParam()) + tgt.addSearchParam(convertCapabilityStatementRestResourceSearchParamComponent(t)); + for (org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceOperationComponent t : src.getOperation()) + tgt.addOperation(convertCapabilityStatementRestResourceOperationComponent(t)); + for (org.hl7.fhir.r4.model.CanonicalType t : src.getCompartment()) + tgt.getCompartment().add(convertCanonical(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestComponent convertCapabilityStatementRestComponent(org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestComponent tgt = new org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestComponent(); + copyElement(src, tgt); + if (src.hasMode()) + tgt.setMode(convertRestfulCapabilityMode(src.getMode())); + if (src.hasDocumentation()) + tgt.setDocumentationElement(convertMarkdown(src.getDocumentationElement())); + if (src.hasSecurity()) + tgt.setSecurity(convertCapabilityStatementRestSecurityComponent(src.getSecurity())); + for (org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceComponent t : src.getResource()) + tgt.addResource(convertCapabilityStatementRestResourceComponent(t)); + for (org.hl7.fhir.r5.model.CapabilityStatement.SystemInteractionComponent t : src.getInteraction()) + tgt.addInteraction(convertSystemInteractionComponent(t)); + for (org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent t : src.getSearchParam()) + tgt.addSearchParam(convertCapabilityStatementRestResourceSearchParamComponent(t)); + for (org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceOperationComponent t : src.getOperation()) + tgt.addOperation(convertCapabilityStatementRestResourceOperationComponent(t)); + for (org.hl7.fhir.r5.model.CanonicalType t : src.getCompartment()) + tgt.getCompartment().add(convertCanonical(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.CapabilityStatement.RestfulCapabilityMode convertRestfulCapabilityMode(org.hl7.fhir.r4.model.CapabilityStatement.RestfulCapabilityMode src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case CLIENT: return org.hl7.fhir.r5.model.CapabilityStatement.RestfulCapabilityMode.CLIENT; + case SERVER: return org.hl7.fhir.r5.model.CapabilityStatement.RestfulCapabilityMode.SERVER; + default: return org.hl7.fhir.r5.model.CapabilityStatement.RestfulCapabilityMode.NULL; + } +} + + public static org.hl7.fhir.r4.model.CapabilityStatement.RestfulCapabilityMode convertRestfulCapabilityMode(org.hl7.fhir.r5.model.CapabilityStatement.RestfulCapabilityMode src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case CLIENT: return org.hl7.fhir.r4.model.CapabilityStatement.RestfulCapabilityMode.CLIENT; + case SERVER: return org.hl7.fhir.r4.model.CapabilityStatement.RestfulCapabilityMode.SERVER; + default: return org.hl7.fhir.r4.model.CapabilityStatement.RestfulCapabilityMode.NULL; + } +} + + public static org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestSecurityComponent convertCapabilityStatementRestSecurityComponent(org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestSecurityComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestSecurityComponent tgt = new org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestSecurityComponent(); + copyElement(src, tgt); + if (src.hasCors()) + tgt.setCorsElement(convertBoolean(src.getCorsElement())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getService()) + tgt.addService(convertCodeableConcept(t)); + if (src.hasDescription()) + tgt.setDescriptionElement(convertMarkdown(src.getDescriptionElement())); + return tgt; + } + + public static org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestSecurityComponent convertCapabilityStatementRestSecurityComponent(org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestSecurityComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestSecurityComponent tgt = new org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestSecurityComponent(); + copyElement(src, tgt); + if (src.hasCors()) + tgt.setCorsElement(convertBoolean(src.getCorsElement())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getService()) + tgt.addService(convertCodeableConcept(t)); + if (src.hasDescription()) + tgt.setDescriptionElement(convertMarkdown(src.getDescriptionElement())); + return tgt; + } + + public static org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceComponent convertCapabilityStatementRestResourceComponent(org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceComponent tgt = new org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceComponent(); + copyElement(src, tgt); + if (src.hasType()) + tgt.setTypeElement(convertCode(src.getTypeElement())); + if (src.hasProfile()) + tgt.setProfileElement(convertCanonical(src.getProfileElement())); + for (org.hl7.fhir.r4.model.CanonicalType t : src.getSupportedProfile()) + tgt.getSupportedProfile().add(convertCanonical(t)); + if (src.hasDocumentation()) + tgt.setDocumentationElement(convertMarkdown(src.getDocumentationElement())); + for (org.hl7.fhir.r4.model.CapabilityStatement.ResourceInteractionComponent t : src.getInteraction()) + tgt.addInteraction(convertResourceInteractionComponent(t)); + if (src.hasVersioning()) + tgt.setVersioning(convertResourceVersionPolicy(src.getVersioning())); + if (src.hasReadHistory()) + tgt.setReadHistoryElement(convertBoolean(src.getReadHistoryElement())); + if (src.hasUpdateCreate()) + tgt.setUpdateCreateElement(convertBoolean(src.getUpdateCreateElement())); + if (src.hasConditionalCreate()) + tgt.setConditionalCreateElement(convertBoolean(src.getConditionalCreateElement())); + if (src.hasConditionalRead()) + tgt.setConditionalRead(convertConditionalReadStatus(src.getConditionalRead())); + if (src.hasConditionalUpdate()) + tgt.setConditionalUpdateElement(convertBoolean(src.getConditionalUpdateElement())); + if (src.hasConditionalDelete()) + tgt.setConditionalDelete(convertConditionalDeleteStatus(src.getConditionalDelete())); + for (org.hl7.fhir.r4.model.Enumeration t : src.getReferencePolicy()) + tgt.addReferencePolicy(convertReferenceHandlingPolicy(t.getValue())); + for (org.hl7.fhir.r4.model.StringType t : src.getSearchInclude()) + tgt.getSearchInclude().add(convertString(t)); + for (org.hl7.fhir.r4.model.StringType t : src.getSearchRevInclude()) + tgt.getSearchRevInclude().add(convertString(t)); + for (org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent t : src.getSearchParam()) + tgt.addSearchParam(convertCapabilityStatementRestResourceSearchParamComponent(t)); + for (org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceOperationComponent t : src.getOperation()) + tgt.addOperation(convertCapabilityStatementRestResourceOperationComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceComponent convertCapabilityStatementRestResourceComponent(org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceComponent tgt = new org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceComponent(); + copyElement(src, tgt); + if (src.hasType()) + tgt.setTypeElement(convertCode(src.getTypeElement())); + if (src.hasProfile()) + tgt.setProfileElement(convertCanonical(src.getProfileElement())); + for (org.hl7.fhir.r5.model.CanonicalType t : src.getSupportedProfile()) + tgt.getSupportedProfile().add(convertCanonical(t)); + if (src.hasDocumentation()) + tgt.setDocumentationElement(convertMarkdown(src.getDocumentationElement())); + for (org.hl7.fhir.r5.model.CapabilityStatement.ResourceInteractionComponent t : src.getInteraction()) + tgt.addInteraction(convertResourceInteractionComponent(t)); + if (src.hasVersioning()) + tgt.setVersioning(convertResourceVersionPolicy(src.getVersioning())); + if (src.hasReadHistory()) + tgt.setReadHistoryElement(convertBoolean(src.getReadHistoryElement())); + if (src.hasUpdateCreate()) + tgt.setUpdateCreateElement(convertBoolean(src.getUpdateCreateElement())); + if (src.hasConditionalCreate()) + tgt.setConditionalCreateElement(convertBoolean(src.getConditionalCreateElement())); + if (src.hasConditionalRead()) + tgt.setConditionalRead(convertConditionalReadStatus(src.getConditionalRead())); + if (src.hasConditionalUpdate()) + tgt.setConditionalUpdateElement(convertBoolean(src.getConditionalUpdateElement())); + if (src.hasConditionalDelete()) + tgt.setConditionalDelete(convertConditionalDeleteStatus(src.getConditionalDelete())); + for (org.hl7.fhir.r5.model.Enumeration t : src.getReferencePolicy()) + tgt.addReferencePolicy(convertReferenceHandlingPolicy(t.getValue())); + for (org.hl7.fhir.r5.model.StringType t : src.getSearchInclude()) + tgt.getSearchInclude().add(convertString(t)); + for (org.hl7.fhir.r5.model.StringType t : src.getSearchRevInclude()) + tgt.getSearchRevInclude().add(convertString(t)); + for (org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent t : src.getSearchParam()) + tgt.addSearchParam(convertCapabilityStatementRestResourceSearchParamComponent(t)); + for (org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceOperationComponent t : src.getOperation()) + tgt.addOperation(convertCapabilityStatementRestResourceOperationComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.CapabilityStatement.ResourceVersionPolicy convertResourceVersionPolicy(org.hl7.fhir.r4.model.CapabilityStatement.ResourceVersionPolicy src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case NOVERSION: return org.hl7.fhir.r5.model.CapabilityStatement.ResourceVersionPolicy.NOVERSION; + case VERSIONED: return org.hl7.fhir.r5.model.CapabilityStatement.ResourceVersionPolicy.VERSIONED; + case VERSIONEDUPDATE: return org.hl7.fhir.r5.model.CapabilityStatement.ResourceVersionPolicy.VERSIONEDUPDATE; + default: return org.hl7.fhir.r5.model.CapabilityStatement.ResourceVersionPolicy.NULL; + } +} + + public static org.hl7.fhir.r4.model.CapabilityStatement.ResourceVersionPolicy convertResourceVersionPolicy(org.hl7.fhir.r5.model.CapabilityStatement.ResourceVersionPolicy src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case NOVERSION: return org.hl7.fhir.r4.model.CapabilityStatement.ResourceVersionPolicy.NOVERSION; + case VERSIONED: return org.hl7.fhir.r4.model.CapabilityStatement.ResourceVersionPolicy.VERSIONED; + case VERSIONEDUPDATE: return org.hl7.fhir.r4.model.CapabilityStatement.ResourceVersionPolicy.VERSIONEDUPDATE; + default: return org.hl7.fhir.r4.model.CapabilityStatement.ResourceVersionPolicy.NULL; + } +} + + public static org.hl7.fhir.r5.model.CapabilityStatement.ConditionalReadStatus convertConditionalReadStatus(org.hl7.fhir.r4.model.CapabilityStatement.ConditionalReadStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case NOTSUPPORTED: return org.hl7.fhir.r5.model.CapabilityStatement.ConditionalReadStatus.NOTSUPPORTED; + case MODIFIEDSINCE: return org.hl7.fhir.r5.model.CapabilityStatement.ConditionalReadStatus.MODIFIEDSINCE; + case NOTMATCH: return org.hl7.fhir.r5.model.CapabilityStatement.ConditionalReadStatus.NOTMATCH; + case FULLSUPPORT: return org.hl7.fhir.r5.model.CapabilityStatement.ConditionalReadStatus.FULLSUPPORT; + default: return org.hl7.fhir.r5.model.CapabilityStatement.ConditionalReadStatus.NULL; + } +} + + public static org.hl7.fhir.r4.model.CapabilityStatement.ConditionalReadStatus convertConditionalReadStatus(org.hl7.fhir.r5.model.CapabilityStatement.ConditionalReadStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case NOTSUPPORTED: return org.hl7.fhir.r4.model.CapabilityStatement.ConditionalReadStatus.NOTSUPPORTED; + case MODIFIEDSINCE: return org.hl7.fhir.r4.model.CapabilityStatement.ConditionalReadStatus.MODIFIEDSINCE; + case NOTMATCH: return org.hl7.fhir.r4.model.CapabilityStatement.ConditionalReadStatus.NOTMATCH; + case FULLSUPPORT: return org.hl7.fhir.r4.model.CapabilityStatement.ConditionalReadStatus.FULLSUPPORT; + default: return org.hl7.fhir.r4.model.CapabilityStatement.ConditionalReadStatus.NULL; + } +} + + public static org.hl7.fhir.r5.model.CapabilityStatement.ConditionalDeleteStatus convertConditionalDeleteStatus(org.hl7.fhir.r4.model.CapabilityStatement.ConditionalDeleteStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case NOTSUPPORTED: return org.hl7.fhir.r5.model.CapabilityStatement.ConditionalDeleteStatus.NOTSUPPORTED; + case SINGLE: return org.hl7.fhir.r5.model.CapabilityStatement.ConditionalDeleteStatus.SINGLE; + case MULTIPLE: return org.hl7.fhir.r5.model.CapabilityStatement.ConditionalDeleteStatus.MULTIPLE; + default: return org.hl7.fhir.r5.model.CapabilityStatement.ConditionalDeleteStatus.NULL; + } +} + + public static org.hl7.fhir.r4.model.CapabilityStatement.ConditionalDeleteStatus convertConditionalDeleteStatus(org.hl7.fhir.r5.model.CapabilityStatement.ConditionalDeleteStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case NOTSUPPORTED: return org.hl7.fhir.r4.model.CapabilityStatement.ConditionalDeleteStatus.NOTSUPPORTED; + case SINGLE: return org.hl7.fhir.r4.model.CapabilityStatement.ConditionalDeleteStatus.SINGLE; + case MULTIPLE: return org.hl7.fhir.r4.model.CapabilityStatement.ConditionalDeleteStatus.MULTIPLE; + default: return org.hl7.fhir.r4.model.CapabilityStatement.ConditionalDeleteStatus.NULL; + } +} + + public static org.hl7.fhir.r5.model.CapabilityStatement.ReferenceHandlingPolicy convertReferenceHandlingPolicy(org.hl7.fhir.r4.model.CapabilityStatement.ReferenceHandlingPolicy src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case LITERAL: return org.hl7.fhir.r5.model.CapabilityStatement.ReferenceHandlingPolicy.LITERAL; + case LOGICAL: return org.hl7.fhir.r5.model.CapabilityStatement.ReferenceHandlingPolicy.LOGICAL; + case RESOLVES: return org.hl7.fhir.r5.model.CapabilityStatement.ReferenceHandlingPolicy.RESOLVES; + case ENFORCED: return org.hl7.fhir.r5.model.CapabilityStatement.ReferenceHandlingPolicy.ENFORCED; + case LOCAL: return org.hl7.fhir.r5.model.CapabilityStatement.ReferenceHandlingPolicy.LOCAL; + default: return org.hl7.fhir.r5.model.CapabilityStatement.ReferenceHandlingPolicy.NULL; + } +} + + public static org.hl7.fhir.r4.model.CapabilityStatement.ReferenceHandlingPolicy convertReferenceHandlingPolicy(org.hl7.fhir.r5.model.CapabilityStatement.ReferenceHandlingPolicy src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case LITERAL: return org.hl7.fhir.r4.model.CapabilityStatement.ReferenceHandlingPolicy.LITERAL; + case LOGICAL: return org.hl7.fhir.r4.model.CapabilityStatement.ReferenceHandlingPolicy.LOGICAL; + case RESOLVES: return org.hl7.fhir.r4.model.CapabilityStatement.ReferenceHandlingPolicy.RESOLVES; + case ENFORCED: return org.hl7.fhir.r4.model.CapabilityStatement.ReferenceHandlingPolicy.ENFORCED; + case LOCAL: return org.hl7.fhir.r4.model.CapabilityStatement.ReferenceHandlingPolicy.LOCAL; + default: return org.hl7.fhir.r4.model.CapabilityStatement.ReferenceHandlingPolicy.NULL; + } +} + + public static org.hl7.fhir.r5.model.CapabilityStatement.ResourceInteractionComponent convertResourceInteractionComponent(org.hl7.fhir.r4.model.CapabilityStatement.ResourceInteractionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.CapabilityStatement.ResourceInteractionComponent tgt = new org.hl7.fhir.r5.model.CapabilityStatement.ResourceInteractionComponent(); + copyElement(src, tgt); + if (src.hasCode()) + tgt.setCode(convertTypeRestfulInteraction(src.getCode())); + if (src.hasDocumentation()) + tgt.setDocumentationElement(convertMarkdown(src.getDocumentationElement())); + return tgt; + } + + public static org.hl7.fhir.r4.model.CapabilityStatement.ResourceInteractionComponent convertResourceInteractionComponent(org.hl7.fhir.r5.model.CapabilityStatement.ResourceInteractionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.CapabilityStatement.ResourceInteractionComponent tgt = new org.hl7.fhir.r4.model.CapabilityStatement.ResourceInteractionComponent(); + copyElement(src, tgt); + if (src.hasCode()) + tgt.setCode(convertTypeRestfulInteraction(src.getCode())); + if (src.hasDocumentation()) + tgt.setDocumentationElement(convertMarkdown(src.getDocumentationElement())); + return tgt; + } + + public static org.hl7.fhir.r5.model.CapabilityStatement.TypeRestfulInteraction convertTypeRestfulInteraction(org.hl7.fhir.r4.model.CapabilityStatement.TypeRestfulInteraction src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case READ: return org.hl7.fhir.r5.model.CapabilityStatement.TypeRestfulInteraction.READ; + case VREAD: return org.hl7.fhir.r5.model.CapabilityStatement.TypeRestfulInteraction.VREAD; + case UPDATE: return org.hl7.fhir.r5.model.CapabilityStatement.TypeRestfulInteraction.UPDATE; + case PATCH: return org.hl7.fhir.r5.model.CapabilityStatement.TypeRestfulInteraction.PATCH; + case DELETE: return org.hl7.fhir.r5.model.CapabilityStatement.TypeRestfulInteraction.DELETE; + case HISTORYINSTANCE: return org.hl7.fhir.r5.model.CapabilityStatement.TypeRestfulInteraction.HISTORYINSTANCE; + case HISTORYTYPE: return org.hl7.fhir.r5.model.CapabilityStatement.TypeRestfulInteraction.HISTORYTYPE; + case CREATE: return org.hl7.fhir.r5.model.CapabilityStatement.TypeRestfulInteraction.CREATE; + case SEARCHTYPE: return org.hl7.fhir.r5.model.CapabilityStatement.TypeRestfulInteraction.SEARCHTYPE; + default: return org.hl7.fhir.r5.model.CapabilityStatement.TypeRestfulInteraction.NULL; + } +} + + public static org.hl7.fhir.r4.model.CapabilityStatement.TypeRestfulInteraction convertTypeRestfulInteraction(org.hl7.fhir.r5.model.CapabilityStatement.TypeRestfulInteraction src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case READ: return org.hl7.fhir.r4.model.CapabilityStatement.TypeRestfulInteraction.READ; + case VREAD: return org.hl7.fhir.r4.model.CapabilityStatement.TypeRestfulInteraction.VREAD; + case UPDATE: return org.hl7.fhir.r4.model.CapabilityStatement.TypeRestfulInteraction.UPDATE; + case PATCH: return org.hl7.fhir.r4.model.CapabilityStatement.TypeRestfulInteraction.PATCH; + case DELETE: return org.hl7.fhir.r4.model.CapabilityStatement.TypeRestfulInteraction.DELETE; + case HISTORYINSTANCE: return org.hl7.fhir.r4.model.CapabilityStatement.TypeRestfulInteraction.HISTORYINSTANCE; + case HISTORYTYPE: return org.hl7.fhir.r4.model.CapabilityStatement.TypeRestfulInteraction.HISTORYTYPE; + case CREATE: return org.hl7.fhir.r4.model.CapabilityStatement.TypeRestfulInteraction.CREATE; + case SEARCHTYPE: return org.hl7.fhir.r4.model.CapabilityStatement.TypeRestfulInteraction.SEARCHTYPE; + default: return org.hl7.fhir.r4.model.CapabilityStatement.TypeRestfulInteraction.NULL; + } +} + + public static org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent convertCapabilityStatementRestResourceSearchParamComponent(org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent tgt = new org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent(); + copyElement(src, tgt); + if (src.hasName()) + tgt.setNameElement(convertString(src.getNameElement())); + if (src.hasDefinition()) + tgt.setDefinitionElement(convertCanonical(src.getDefinitionElement())); + if (src.hasType()) + tgt.setType(Enumerations.convertSearchParamType(src.getType())); + if (src.hasDocumentation()) + tgt.setDocumentationElement(convertMarkdown(src.getDocumentationElement())); + return tgt; + } + + public static org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent convertCapabilityStatementRestResourceSearchParamComponent(org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent tgt = new org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent(); + copyElement(src, tgt); + if (src.hasName()) + tgt.setNameElement(convertString(src.getNameElement())); + if (src.hasDefinition()) + tgt.setDefinitionElement(convertCanonical(src.getDefinitionElement())); + if (src.hasType()) + tgt.setType(Enumerations.convertSearchParamType(src.getType())); + if (src.hasDocumentation()) + tgt.setDocumentationElement(convertMarkdown(src.getDocumentationElement())); + return tgt; + } + + public static org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceOperationComponent convertCapabilityStatementRestResourceOperationComponent(org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceOperationComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceOperationComponent tgt = new org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceOperationComponent(); + copyElement(src, tgt); + if (src.hasName()) + tgt.setNameElement(convertString(src.getNameElement())); + if (src.hasDefinition()) + tgt.setDefinitionElement(convertCanonical(src.getDefinitionElement())); + if (src.hasDocumentation()) + tgt.setDocumentationElement(convertMarkdown(src.getDocumentationElement())); + return tgt; + } + + public static org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceOperationComponent convertCapabilityStatementRestResourceOperationComponent(org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceOperationComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceOperationComponent tgt = new org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceOperationComponent(); + copyElement(src, tgt); + if (src.hasName()) + tgt.setNameElement(convertString(src.getNameElement())); + if (src.hasDefinition()) + tgt.setDefinitionElement(convertCanonical(src.getDefinitionElement())); + if (src.hasDocumentation()) + tgt.setDocumentationElement(convertMarkdown(src.getDocumentationElement())); + return tgt; + } + + public static org.hl7.fhir.r5.model.CapabilityStatement.SystemInteractionComponent convertSystemInteractionComponent(org.hl7.fhir.r4.model.CapabilityStatement.SystemInteractionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.CapabilityStatement.SystemInteractionComponent tgt = new org.hl7.fhir.r5.model.CapabilityStatement.SystemInteractionComponent(); + copyElement(src, tgt); + if (src.hasCode()) + tgt.setCode(convertSystemRestfulInteraction(src.getCode())); + if (src.hasDocumentation()) + tgt.setDocumentationElement(convertMarkdown(src.getDocumentationElement())); + return tgt; + } + + public static org.hl7.fhir.r4.model.CapabilityStatement.SystemInteractionComponent convertSystemInteractionComponent(org.hl7.fhir.r5.model.CapabilityStatement.SystemInteractionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.CapabilityStatement.SystemInteractionComponent tgt = new org.hl7.fhir.r4.model.CapabilityStatement.SystemInteractionComponent(); + copyElement(src, tgt); + if (src.hasCode()) + tgt.setCode(convertSystemRestfulInteraction(src.getCode())); + if (src.hasDocumentation()) + tgt.setDocumentationElement(convertMarkdown(src.getDocumentationElement())); + return tgt; + } + + public static org.hl7.fhir.r5.model.CapabilityStatement.SystemRestfulInteraction convertSystemRestfulInteraction(org.hl7.fhir.r4.model.CapabilityStatement.SystemRestfulInteraction src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case TRANSACTION: return org.hl7.fhir.r5.model.CapabilityStatement.SystemRestfulInteraction.TRANSACTION; + case BATCH: return org.hl7.fhir.r5.model.CapabilityStatement.SystemRestfulInteraction.BATCH; + case SEARCHSYSTEM: return org.hl7.fhir.r5.model.CapabilityStatement.SystemRestfulInteraction.SEARCHSYSTEM; + case HISTORYSYSTEM: return org.hl7.fhir.r5.model.CapabilityStatement.SystemRestfulInteraction.HISTORYSYSTEM; + default: return org.hl7.fhir.r5.model.CapabilityStatement.SystemRestfulInteraction.NULL; + } +} + + public static org.hl7.fhir.r4.model.CapabilityStatement.SystemRestfulInteraction convertSystemRestfulInteraction(org.hl7.fhir.r5.model.CapabilityStatement.SystemRestfulInteraction src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case TRANSACTION: return org.hl7.fhir.r4.model.CapabilityStatement.SystemRestfulInteraction.TRANSACTION; + case BATCH: return org.hl7.fhir.r4.model.CapabilityStatement.SystemRestfulInteraction.BATCH; + case SEARCHSYSTEM: return org.hl7.fhir.r4.model.CapabilityStatement.SystemRestfulInteraction.SEARCHSYSTEM; + case HISTORYSYSTEM: return org.hl7.fhir.r4.model.CapabilityStatement.SystemRestfulInteraction.HISTORYSYSTEM; + default: return org.hl7.fhir.r4.model.CapabilityStatement.SystemRestfulInteraction.NULL; + } +} + + public static org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementMessagingComponent convertCapabilityStatementMessagingComponent(org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementMessagingComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementMessagingComponent tgt = new org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementMessagingComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementMessagingEndpointComponent t : src.getEndpoint()) + tgt.addEndpoint(convertCapabilityStatementMessagingEndpointComponent(t)); + if (src.hasReliableCache()) + tgt.setReliableCacheElement(convertUnsignedInt(src.getReliableCacheElement())); + if (src.hasDocumentation()) + tgt.setDocumentationElement(convertMarkdown(src.getDocumentationElement())); + for (org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent t : src.getSupportedMessage()) + tgt.addSupportedMessage(convertCapabilityStatementMessagingSupportedMessageComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementMessagingComponent convertCapabilityStatementMessagingComponent(org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementMessagingComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementMessagingComponent tgt = new org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementMessagingComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementMessagingEndpointComponent t : src.getEndpoint()) + tgt.addEndpoint(convertCapabilityStatementMessagingEndpointComponent(t)); + if (src.hasReliableCache()) + tgt.setReliableCacheElement(convertUnsignedInt(src.getReliableCacheElement())); + if (src.hasDocumentation()) + tgt.setDocumentationElement(convertMarkdown(src.getDocumentationElement())); + for (org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent t : src.getSupportedMessage()) + tgt.addSupportedMessage(convertCapabilityStatementMessagingSupportedMessageComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementMessagingEndpointComponent convertCapabilityStatementMessagingEndpointComponent(org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementMessagingEndpointComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementMessagingEndpointComponent tgt = new org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementMessagingEndpointComponent(); + copyElement(src, tgt); + if (src.hasProtocol()) + tgt.setProtocol(convertCoding(src.getProtocol())); + if (src.hasAddress()) + tgt.setAddressElement(convertUrl(src.getAddressElement())); + return tgt; + } + + public static org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementMessagingEndpointComponent convertCapabilityStatementMessagingEndpointComponent(org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementMessagingEndpointComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementMessagingEndpointComponent tgt = new org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementMessagingEndpointComponent(); + copyElement(src, tgt); + if (src.hasProtocol()) + tgt.setProtocol(convertCoding(src.getProtocol())); + if (src.hasAddress()) + tgt.setAddressElement(convertUrl(src.getAddressElement())); + return tgt; + } + + public static org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent convertCapabilityStatementMessagingSupportedMessageComponent(org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent tgt = new org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent(); + copyElement(src, tgt); + if (src.hasMode()) + tgt.setMode(convertEventCapabilityMode(src.getMode())); + if (src.hasDefinition()) + tgt.setDefinitionElement(convertCanonical(src.getDefinitionElement())); + return tgt; + } + + public static org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent convertCapabilityStatementMessagingSupportedMessageComponent(org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent tgt = new org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent(); + copyElement(src, tgt); + if (src.hasMode()) + tgt.setMode(convertEventCapabilityMode(src.getMode())); + if (src.hasDefinition()) + tgt.setDefinitionElement(convertCanonical(src.getDefinitionElement())); + return tgt; + } + + public static org.hl7.fhir.r5.model.CapabilityStatement.EventCapabilityMode convertEventCapabilityMode(org.hl7.fhir.r4.model.CapabilityStatement.EventCapabilityMode src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case SENDER: return org.hl7.fhir.r5.model.CapabilityStatement.EventCapabilityMode.SENDER; + case RECEIVER: return org.hl7.fhir.r5.model.CapabilityStatement.EventCapabilityMode.RECEIVER; + default: return org.hl7.fhir.r5.model.CapabilityStatement.EventCapabilityMode.NULL; + } +} + + public static org.hl7.fhir.r4.model.CapabilityStatement.EventCapabilityMode convertEventCapabilityMode(org.hl7.fhir.r5.model.CapabilityStatement.EventCapabilityMode src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case SENDER: return org.hl7.fhir.r4.model.CapabilityStatement.EventCapabilityMode.SENDER; + case RECEIVER: return org.hl7.fhir.r4.model.CapabilityStatement.EventCapabilityMode.RECEIVER; + default: return org.hl7.fhir.r4.model.CapabilityStatement.EventCapabilityMode.NULL; + } +} + + public static org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementDocumentComponent convertCapabilityStatementDocumentComponent(org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementDocumentComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementDocumentComponent tgt = new org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementDocumentComponent(); + copyElement(src, tgt); + if (src.hasMode()) + tgt.setMode(convertDocumentMode(src.getMode())); + if (src.hasDocumentation()) + tgt.setDocumentationElement(convertMarkdown(src.getDocumentationElement())); + if (src.hasProfile()) + tgt.setProfileElement(convertCanonical(src.getProfileElement())); + return tgt; + } + + public static org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementDocumentComponent convertCapabilityStatementDocumentComponent(org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementDocumentComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementDocumentComponent tgt = new org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementDocumentComponent(); + copyElement(src, tgt); + if (src.hasMode()) + tgt.setMode(convertDocumentMode(src.getMode())); + if (src.hasDocumentation()) + tgt.setDocumentationElement(convertMarkdown(src.getDocumentationElement())); + if (src.hasProfile()) + tgt.setProfileElement(convertCanonical(src.getProfileElement())); + return tgt; + } + + public static org.hl7.fhir.r5.model.CapabilityStatement.DocumentMode convertDocumentMode(org.hl7.fhir.r4.model.CapabilityStatement.DocumentMode src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PRODUCER: return org.hl7.fhir.r5.model.CapabilityStatement.DocumentMode.PRODUCER; + case CONSUMER: return org.hl7.fhir.r5.model.CapabilityStatement.DocumentMode.CONSUMER; + default: return org.hl7.fhir.r5.model.CapabilityStatement.DocumentMode.NULL; + } +} + + public static org.hl7.fhir.r4.model.CapabilityStatement.DocumentMode convertDocumentMode(org.hl7.fhir.r5.model.CapabilityStatement.DocumentMode src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PRODUCER: return org.hl7.fhir.r4.model.CapabilityStatement.DocumentMode.PRODUCER; + case CONSUMER: return org.hl7.fhir.r4.model.CapabilityStatement.DocumentMode.CONSUMER; + default: return org.hl7.fhir.r4.model.CapabilityStatement.DocumentMode.NULL; + } +} + + +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/CarePlan.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/CarePlan.java new file mode 100644 index 000000000..fe91e5d18 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/CarePlan.java @@ -0,0 +1,391 @@ +package org.hl7.fhir.convertors.conv40_50; + +import org.hl7.fhir.exceptions.FHIRException; + +import org.hl7.fhir.convertors.VersionConvertor_40_50; + + +/* + Copyright (c) 2011+, HL7, Inc. + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of HL7 nor the names of its contributors may be used to + endorse or promote products derived from this software without specific + prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + +*/ + +// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0 + + +public class CarePlan extends VersionConvertor_40_50 { + + public static org.hl7.fhir.r5.model.CarePlan convertCarePlan(org.hl7.fhir.r4.model.CarePlan src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.CarePlan tgt = new org.hl7.fhir.r5.model.CarePlan(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + for (org.hl7.fhir.r4.model.CanonicalType t : src.getInstantiatesCanonical()) + tgt.getInstantiatesCanonical().add(convertCanonical(t)); + for (org.hl7.fhir.r4.model.UriType t : src.getInstantiatesUri()) + tgt.getInstantiatesUri().add(convertUri(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getBasedOn()) + tgt.addBasedOn(convertReference(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getReplaces()) + tgt.addReplaces(convertReference(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getPartOf()) + tgt.addPartOf(convertReference(t)); + if (src.hasStatus()) + tgt.setStatus(convertCarePlanStatus(src.getStatus())); + if (src.hasIntent()) + tgt.setIntent(convertCarePlanIntent(src.getIntent())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getCategory()) + tgt.addCategory(convertCodeableConcept(t)); + if (src.hasTitle()) + tgt.setTitleElement(convertString(src.getTitleElement())); + if (src.hasDescription()) + tgt.setDescriptionElement(convertString(src.getDescriptionElement())); + if (src.hasSubject()) + tgt.setSubject(convertReference(src.getSubject())); + if (src.hasEncounter()) + tgt.setEncounter(convertReference(src.getEncounter())); + if (src.hasPeriod()) + tgt.setPeriod(convertPeriod(src.getPeriod())); + if (src.hasCreated()) + tgt.setCreatedElement(convertDateTime(src.getCreatedElement())); + if (src.hasAuthor()) + tgt.setAuthor(convertReference(src.getAuthor())); + for (org.hl7.fhir.r4.model.Reference t : src.getContributor()) + tgt.addContributor(convertReference(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getCareTeam()) + tgt.addCareTeam(convertReference(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getAddresses()) + tgt.addAddresses(convertReference(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getSupportingInfo()) + tgt.addSupportingInfo(convertReference(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getGoal()) + tgt.addGoal(convertReference(t)); + for (org.hl7.fhir.r4.model.CarePlan.CarePlanActivityComponent t : src.getActivity()) + tgt.addActivity(convertCarePlanActivityComponent(t)); + for (org.hl7.fhir.r4.model.Annotation t : src.getNote()) + tgt.addNote(convertAnnotation(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.CarePlan convertCarePlan(org.hl7.fhir.r5.model.CarePlan src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.CarePlan tgt = new org.hl7.fhir.r4.model.CarePlan(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + for (org.hl7.fhir.r5.model.CanonicalType t : src.getInstantiatesCanonical()) + tgt.getInstantiatesCanonical().add(convertCanonical(t)); + for (org.hl7.fhir.r5.model.UriType t : src.getInstantiatesUri()) + tgt.getInstantiatesUri().add(convertUri(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getBasedOn()) + tgt.addBasedOn(convertReference(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getReplaces()) + tgt.addReplaces(convertReference(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getPartOf()) + tgt.addPartOf(convertReference(t)); + if (src.hasStatus()) + tgt.setStatus(convertCarePlanStatus(src.getStatus())); + if (src.hasIntent()) + tgt.setIntent(convertCarePlanIntent(src.getIntent())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getCategory()) + tgt.addCategory(convertCodeableConcept(t)); + if (src.hasTitle()) + tgt.setTitleElement(convertString(src.getTitleElement())); + if (src.hasDescription()) + tgt.setDescriptionElement(convertString(src.getDescriptionElement())); + if (src.hasSubject()) + tgt.setSubject(convertReference(src.getSubject())); + if (src.hasEncounter()) + tgt.setEncounter(convertReference(src.getEncounter())); + if (src.hasPeriod()) + tgt.setPeriod(convertPeriod(src.getPeriod())); + if (src.hasCreated()) + tgt.setCreatedElement(convertDateTime(src.getCreatedElement())); + if (src.hasAuthor()) + tgt.setAuthor(convertReference(src.getAuthor())); + for (org.hl7.fhir.r5.model.Reference t : src.getContributor()) + tgt.addContributor(convertReference(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getCareTeam()) + tgt.addCareTeam(convertReference(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getAddresses()) + tgt.addAddresses(convertReference(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getSupportingInfo()) + tgt.addSupportingInfo(convertReference(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getGoal()) + tgt.addGoal(convertReference(t)); + for (org.hl7.fhir.r5.model.CarePlan.CarePlanActivityComponent t : src.getActivity()) + tgt.addActivity(convertCarePlanActivityComponent(t)); + for (org.hl7.fhir.r5.model.Annotation t : src.getNote()) + tgt.addNote(convertAnnotation(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.CarePlan.CarePlanStatus convertCarePlanStatus(org.hl7.fhir.r4.model.CarePlan.CarePlanStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case DRAFT: return org.hl7.fhir.r5.model.CarePlan.CarePlanStatus.DRAFT; + case ACTIVE: return org.hl7.fhir.r5.model.CarePlan.CarePlanStatus.ACTIVE; + case ONHOLD: return org.hl7.fhir.r5.model.CarePlan.CarePlanStatus.ONHOLD; + case REVOKED: return org.hl7.fhir.r5.model.CarePlan.CarePlanStatus.REVOKED; + case COMPLETED: return org.hl7.fhir.r5.model.CarePlan.CarePlanStatus.COMPLETED; + case ENTEREDINERROR: return org.hl7.fhir.r5.model.CarePlan.CarePlanStatus.ENTEREDINERROR; + case UNKNOWN: return org.hl7.fhir.r5.model.CarePlan.CarePlanStatus.UNKNOWN; + default: return org.hl7.fhir.r5.model.CarePlan.CarePlanStatus.NULL; + } +} + + public static org.hl7.fhir.r4.model.CarePlan.CarePlanStatus convertCarePlanStatus(org.hl7.fhir.r5.model.CarePlan.CarePlanStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case DRAFT: return org.hl7.fhir.r4.model.CarePlan.CarePlanStatus.DRAFT; + case ACTIVE: return org.hl7.fhir.r4.model.CarePlan.CarePlanStatus.ACTIVE; + case ONHOLD: return org.hl7.fhir.r4.model.CarePlan.CarePlanStatus.ONHOLD; + case REVOKED: return org.hl7.fhir.r4.model.CarePlan.CarePlanStatus.REVOKED; + case COMPLETED: return org.hl7.fhir.r4.model.CarePlan.CarePlanStatus.COMPLETED; + case ENTEREDINERROR: return org.hl7.fhir.r4.model.CarePlan.CarePlanStatus.ENTEREDINERROR; + case UNKNOWN: return org.hl7.fhir.r4.model.CarePlan.CarePlanStatus.UNKNOWN; + default: return org.hl7.fhir.r4.model.CarePlan.CarePlanStatus.NULL; + } +} + + public static org.hl7.fhir.r5.model.CarePlan.CarePlanIntent convertCarePlanIntent(org.hl7.fhir.r4.model.CarePlan.CarePlanIntent src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PROPOSAL: return org.hl7.fhir.r5.model.CarePlan.CarePlanIntent.PROPOSAL; + case PLAN: return org.hl7.fhir.r5.model.CarePlan.CarePlanIntent.PLAN; + case ORDER: return org.hl7.fhir.r5.model.CarePlan.CarePlanIntent.ORDER; + case OPTION: return org.hl7.fhir.r5.model.CarePlan.CarePlanIntent.OPTION; + default: return org.hl7.fhir.r5.model.CarePlan.CarePlanIntent.NULL; + } +} + + public static org.hl7.fhir.r4.model.CarePlan.CarePlanIntent convertCarePlanIntent(org.hl7.fhir.r5.model.CarePlan.CarePlanIntent src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PROPOSAL: return org.hl7.fhir.r4.model.CarePlan.CarePlanIntent.PROPOSAL; + case PLAN: return org.hl7.fhir.r4.model.CarePlan.CarePlanIntent.PLAN; + case ORDER: return org.hl7.fhir.r4.model.CarePlan.CarePlanIntent.ORDER; + case OPTION: return org.hl7.fhir.r4.model.CarePlan.CarePlanIntent.OPTION; + default: return org.hl7.fhir.r4.model.CarePlan.CarePlanIntent.NULL; + } +} + + public static org.hl7.fhir.r5.model.CarePlan.CarePlanActivityComponent convertCarePlanActivityComponent(org.hl7.fhir.r4.model.CarePlan.CarePlanActivityComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.CarePlan.CarePlanActivityComponent tgt = new org.hl7.fhir.r5.model.CarePlan.CarePlanActivityComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getOutcomeCodeableConcept()) + tgt.addOutcomeCodeableConcept(convertCodeableConcept(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getOutcomeReference()) + tgt.addOutcomeReference(convertReference(t)); + for (org.hl7.fhir.r4.model.Annotation t : src.getProgress()) + tgt.addProgress(convertAnnotation(t)); + if (src.hasReference()) + tgt.setReference(convertReference(src.getReference())); + if (src.hasDetail()) + tgt.setDetail(convertCarePlanActivityDetailComponent(src.getDetail())); + return tgt; + } + + public static org.hl7.fhir.r4.model.CarePlan.CarePlanActivityComponent convertCarePlanActivityComponent(org.hl7.fhir.r5.model.CarePlan.CarePlanActivityComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.CarePlan.CarePlanActivityComponent tgt = new org.hl7.fhir.r4.model.CarePlan.CarePlanActivityComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getOutcomeCodeableConcept()) + tgt.addOutcomeCodeableConcept(convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getOutcomeReference()) + tgt.addOutcomeReference(convertReference(t)); + for (org.hl7.fhir.r5.model.Annotation t : src.getProgress()) + tgt.addProgress(convertAnnotation(t)); + if (src.hasReference()) + tgt.setReference(convertReference(src.getReference())); + if (src.hasDetail()) + tgt.setDetail(convertCarePlanActivityDetailComponent(src.getDetail())); + return tgt; + } + + public static org.hl7.fhir.r5.model.CarePlan.CarePlanActivityDetailComponent convertCarePlanActivityDetailComponent(org.hl7.fhir.r4.model.CarePlan.CarePlanActivityDetailComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.CarePlan.CarePlanActivityDetailComponent tgt = new org.hl7.fhir.r5.model.CarePlan.CarePlanActivityDetailComponent(); + copyElement(src, tgt); + if (src.hasKind()) + tgt.setKind(convertCarePlanActivityKind(src.getKind())); + for (org.hl7.fhir.r4.model.CanonicalType t : src.getInstantiatesCanonical()) + tgt.getInstantiatesCanonical().add(convertCanonical(t)); + for (org.hl7.fhir.r4.model.UriType t : src.getInstantiatesUri()) + tgt.getInstantiatesUri().add(convertUri(t)); + if (src.hasCode()) + tgt.setCode(convertCodeableConcept(src.getCode())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getReasonCode()) + tgt.addReasonCode(convertCodeableConcept(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getReasonReference()) + tgt.addReasonReference(convertReference(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getGoal()) + tgt.addGoal(convertReference(t)); + if (src.hasStatus()) + tgt.setStatus(convertCarePlanActivityStatus(src.getStatus())); + if (src.hasStatusReason()) + tgt.setStatusReason(convertCodeableConcept(src.getStatusReason())); + if (src.hasDoNotPerform()) + tgt.setDoNotPerformElement(convertBoolean(src.getDoNotPerformElement())); + if (src.hasScheduled()) + tgt.setScheduled(convertType(src.getScheduled())); + if (src.hasLocation()) + tgt.setLocation(convertReference(src.getLocation())); + for (org.hl7.fhir.r4.model.Reference t : src.getPerformer()) + tgt.addPerformer(convertReference(t)); + if (src.hasProduct()) + tgt.setProduct(convertType(src.getProduct())); + if (src.hasDailyAmount()) + tgt.setDailyAmount(convertSimpleQuantity(src.getDailyAmount())); + if (src.hasQuantity()) + tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); + if (src.hasDescription()) + tgt.setDescriptionElement(convertString(src.getDescriptionElement())); + return tgt; + } + + public static org.hl7.fhir.r4.model.CarePlan.CarePlanActivityDetailComponent convertCarePlanActivityDetailComponent(org.hl7.fhir.r5.model.CarePlan.CarePlanActivityDetailComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.CarePlan.CarePlanActivityDetailComponent tgt = new org.hl7.fhir.r4.model.CarePlan.CarePlanActivityDetailComponent(); + copyElement(src, tgt); + if (src.hasKind()) + tgt.setKind(convertCarePlanActivityKind(src.getKind())); + for (org.hl7.fhir.r5.model.CanonicalType t : src.getInstantiatesCanonical()) + tgt.getInstantiatesCanonical().add(convertCanonical(t)); + for (org.hl7.fhir.r5.model.UriType t : src.getInstantiatesUri()) + tgt.getInstantiatesUri().add(convertUri(t)); + if (src.hasCode()) + tgt.setCode(convertCodeableConcept(src.getCode())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getReasonCode()) + tgt.addReasonCode(convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getReasonReference()) + tgt.addReasonReference(convertReference(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getGoal()) + tgt.addGoal(convertReference(t)); + if (src.hasStatus()) + tgt.setStatus(convertCarePlanActivityStatus(src.getStatus())); + if (src.hasStatusReason()) + tgt.setStatusReason(convertCodeableConcept(src.getStatusReason())); + if (src.hasDoNotPerform()) + tgt.setDoNotPerformElement(convertBoolean(src.getDoNotPerformElement())); + if (src.hasScheduled()) + tgt.setScheduled(convertType(src.getScheduled())); + if (src.hasLocation()) + tgt.setLocation(convertReference(src.getLocation())); + for (org.hl7.fhir.r5.model.Reference t : src.getPerformer()) + tgt.addPerformer(convertReference(t)); + if (src.hasProduct()) + tgt.setProduct(convertType(src.getProduct())); + if (src.hasDailyAmount()) + tgt.setDailyAmount(convertSimpleQuantity(src.getDailyAmount())); + if (src.hasQuantity()) + tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); + if (src.hasDescription()) + tgt.setDescriptionElement(convertString(src.getDescriptionElement())); + return tgt; + } + + public static org.hl7.fhir.r5.model.CarePlan.CarePlanActivityKind convertCarePlanActivityKind(org.hl7.fhir.r4.model.CarePlan.CarePlanActivityKind src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case APPOINTMENT: return org.hl7.fhir.r5.model.CarePlan.CarePlanActivityKind.APPOINTMENT; + case COMMUNICATIONREQUEST: return org.hl7.fhir.r5.model.CarePlan.CarePlanActivityKind.COMMUNICATIONREQUEST; + case DEVICEREQUEST: return org.hl7.fhir.r5.model.CarePlan.CarePlanActivityKind.DEVICEREQUEST; + case MEDICATIONREQUEST: return org.hl7.fhir.r5.model.CarePlan.CarePlanActivityKind.MEDICATIONREQUEST; + case NUTRITIONORDER: return org.hl7.fhir.r5.model.CarePlan.CarePlanActivityKind.NUTRITIONORDER; + case TASK: return org.hl7.fhir.r5.model.CarePlan.CarePlanActivityKind.TASK; + case SERVICEREQUEST: return org.hl7.fhir.r5.model.CarePlan.CarePlanActivityKind.SERVICEREQUEST; + case VISIONPRESCRIPTION: return org.hl7.fhir.r5.model.CarePlan.CarePlanActivityKind.VISIONPRESCRIPTION; + default: return org.hl7.fhir.r5.model.CarePlan.CarePlanActivityKind.NULL; + } +} + + public static org.hl7.fhir.r4.model.CarePlan.CarePlanActivityKind convertCarePlanActivityKind(org.hl7.fhir.r5.model.CarePlan.CarePlanActivityKind src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case APPOINTMENT: return org.hl7.fhir.r4.model.CarePlan.CarePlanActivityKind.APPOINTMENT; + case COMMUNICATIONREQUEST: return org.hl7.fhir.r4.model.CarePlan.CarePlanActivityKind.COMMUNICATIONREQUEST; + case DEVICEREQUEST: return org.hl7.fhir.r4.model.CarePlan.CarePlanActivityKind.DEVICEREQUEST; + case MEDICATIONREQUEST: return org.hl7.fhir.r4.model.CarePlan.CarePlanActivityKind.MEDICATIONREQUEST; + case NUTRITIONORDER: return org.hl7.fhir.r4.model.CarePlan.CarePlanActivityKind.NUTRITIONORDER; + case TASK: return org.hl7.fhir.r4.model.CarePlan.CarePlanActivityKind.TASK; + case SERVICEREQUEST: return org.hl7.fhir.r4.model.CarePlan.CarePlanActivityKind.SERVICEREQUEST; + case VISIONPRESCRIPTION: return org.hl7.fhir.r4.model.CarePlan.CarePlanActivityKind.VISIONPRESCRIPTION; + default: return org.hl7.fhir.r4.model.CarePlan.CarePlanActivityKind.NULL; + } +} + + public static org.hl7.fhir.r5.model.CarePlan.CarePlanActivityStatus convertCarePlanActivityStatus(org.hl7.fhir.r4.model.CarePlan.CarePlanActivityStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case NOTSTARTED: return org.hl7.fhir.r5.model.CarePlan.CarePlanActivityStatus.NOTSTARTED; + case SCHEDULED: return org.hl7.fhir.r5.model.CarePlan.CarePlanActivityStatus.SCHEDULED; + case INPROGRESS: return org.hl7.fhir.r5.model.CarePlan.CarePlanActivityStatus.INPROGRESS; + case ONHOLD: return org.hl7.fhir.r5.model.CarePlan.CarePlanActivityStatus.ONHOLD; + case COMPLETED: return org.hl7.fhir.r5.model.CarePlan.CarePlanActivityStatus.COMPLETED; + case CANCELLED: return org.hl7.fhir.r5.model.CarePlan.CarePlanActivityStatus.CANCELLED; + case STOPPED: return org.hl7.fhir.r5.model.CarePlan.CarePlanActivityStatus.STOPPED; + case UNKNOWN: return org.hl7.fhir.r5.model.CarePlan.CarePlanActivityStatus.UNKNOWN; + case ENTEREDINERROR: return org.hl7.fhir.r5.model.CarePlan.CarePlanActivityStatus.ENTEREDINERROR; + default: return org.hl7.fhir.r5.model.CarePlan.CarePlanActivityStatus.NULL; + } +} + + public static org.hl7.fhir.r4.model.CarePlan.CarePlanActivityStatus convertCarePlanActivityStatus(org.hl7.fhir.r5.model.CarePlan.CarePlanActivityStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case NOTSTARTED: return org.hl7.fhir.r4.model.CarePlan.CarePlanActivityStatus.NOTSTARTED; + case SCHEDULED: return org.hl7.fhir.r4.model.CarePlan.CarePlanActivityStatus.SCHEDULED; + case INPROGRESS: return org.hl7.fhir.r4.model.CarePlan.CarePlanActivityStatus.INPROGRESS; + case ONHOLD: return org.hl7.fhir.r4.model.CarePlan.CarePlanActivityStatus.ONHOLD; + case COMPLETED: return org.hl7.fhir.r4.model.CarePlan.CarePlanActivityStatus.COMPLETED; + case CANCELLED: return org.hl7.fhir.r4.model.CarePlan.CarePlanActivityStatus.CANCELLED; + case STOPPED: return org.hl7.fhir.r4.model.CarePlan.CarePlanActivityStatus.STOPPED; + case UNKNOWN: return org.hl7.fhir.r4.model.CarePlan.CarePlanActivityStatus.UNKNOWN; + case ENTEREDINERROR: return org.hl7.fhir.r4.model.CarePlan.CarePlanActivityStatus.ENTEREDINERROR; + default: return org.hl7.fhir.r4.model.CarePlan.CarePlanActivityStatus.NULL; + } +} + + +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/CareTeam.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/CareTeam.java new file mode 100644 index 000000000..e0f3909d2 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/CareTeam.java @@ -0,0 +1,169 @@ +package org.hl7.fhir.convertors.conv40_50; + +import org.hl7.fhir.exceptions.FHIRException; + +import org.hl7.fhir.convertors.VersionConvertor_40_50; + + +/* + Copyright (c) 2011+, HL7, Inc. + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of HL7 nor the names of its contributors may be used to + endorse or promote products derived from this software without specific + prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + +*/ + +// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0 + + +public class CareTeam extends VersionConvertor_40_50 { + + public static org.hl7.fhir.r5.model.CareTeam convertCareTeam(org.hl7.fhir.r4.model.CareTeam src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.CareTeam tgt = new org.hl7.fhir.r5.model.CareTeam(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasStatus()) + tgt.setStatus(convertCareTeamStatus(src.getStatus())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getCategory()) + tgt.addCategory(convertCodeableConcept(t)); + if (src.hasName()) + tgt.setNameElement(convertString(src.getNameElement())); + if (src.hasSubject()) + tgt.setSubject(convertReference(src.getSubject())); + if (src.hasEncounter()) + tgt.setEncounter(convertReference(src.getEncounter())); + if (src.hasPeriod()) + tgt.setPeriod(convertPeriod(src.getPeriod())); + for (org.hl7.fhir.r4.model.CareTeam.CareTeamParticipantComponent t : src.getParticipant()) + tgt.addParticipant(convertCareTeamParticipantComponent(t)); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getReasonCode()) + tgt.addReasonCode(convertCodeableConcept(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getReasonReference()) + tgt.addReasonReference(convertReference(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getManagingOrganization()) + tgt.addManagingOrganization(convertReference(t)); + for (org.hl7.fhir.r4.model.ContactPoint t : src.getTelecom()) + tgt.addTelecom(convertContactPoint(t)); + for (org.hl7.fhir.r4.model.Annotation t : src.getNote()) + tgt.addNote(convertAnnotation(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.CareTeam convertCareTeam(org.hl7.fhir.r5.model.CareTeam src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.CareTeam tgt = new org.hl7.fhir.r4.model.CareTeam(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasStatus()) + tgt.setStatus(convertCareTeamStatus(src.getStatus())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getCategory()) + tgt.addCategory(convertCodeableConcept(t)); + if (src.hasName()) + tgt.setNameElement(convertString(src.getNameElement())); + if (src.hasSubject()) + tgt.setSubject(convertReference(src.getSubject())); + if (src.hasEncounter()) + tgt.setEncounter(convertReference(src.getEncounter())); + if (src.hasPeriod()) + tgt.setPeriod(convertPeriod(src.getPeriod())); + for (org.hl7.fhir.r5.model.CareTeam.CareTeamParticipantComponent t : src.getParticipant()) + tgt.addParticipant(convertCareTeamParticipantComponent(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getReasonCode()) + tgt.addReasonCode(convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getReasonReference()) + tgt.addReasonReference(convertReference(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getManagingOrganization()) + tgt.addManagingOrganization(convertReference(t)); + for (org.hl7.fhir.r5.model.ContactPoint t : src.getTelecom()) + tgt.addTelecom(convertContactPoint(t)); + for (org.hl7.fhir.r5.model.Annotation t : src.getNote()) + tgt.addNote(convertAnnotation(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.CareTeam.CareTeamStatus convertCareTeamStatus(org.hl7.fhir.r4.model.CareTeam.CareTeamStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PROPOSED: return org.hl7.fhir.r5.model.CareTeam.CareTeamStatus.PROPOSED; + case ACTIVE: return org.hl7.fhir.r5.model.CareTeam.CareTeamStatus.ACTIVE; + case SUSPENDED: return org.hl7.fhir.r5.model.CareTeam.CareTeamStatus.SUSPENDED; + case INACTIVE: return org.hl7.fhir.r5.model.CareTeam.CareTeamStatus.INACTIVE; + case ENTEREDINERROR: return org.hl7.fhir.r5.model.CareTeam.CareTeamStatus.ENTEREDINERROR; + default: return org.hl7.fhir.r5.model.CareTeam.CareTeamStatus.NULL; + } +} + + public static org.hl7.fhir.r4.model.CareTeam.CareTeamStatus convertCareTeamStatus(org.hl7.fhir.r5.model.CareTeam.CareTeamStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PROPOSED: return org.hl7.fhir.r4.model.CareTeam.CareTeamStatus.PROPOSED; + case ACTIVE: return org.hl7.fhir.r4.model.CareTeam.CareTeamStatus.ACTIVE; + case SUSPENDED: return org.hl7.fhir.r4.model.CareTeam.CareTeamStatus.SUSPENDED; + case INACTIVE: return org.hl7.fhir.r4.model.CareTeam.CareTeamStatus.INACTIVE; + case ENTEREDINERROR: return org.hl7.fhir.r4.model.CareTeam.CareTeamStatus.ENTEREDINERROR; + default: return org.hl7.fhir.r4.model.CareTeam.CareTeamStatus.NULL; + } +} + + public static org.hl7.fhir.r5.model.CareTeam.CareTeamParticipantComponent convertCareTeamParticipantComponent(org.hl7.fhir.r4.model.CareTeam.CareTeamParticipantComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.CareTeam.CareTeamParticipantComponent tgt = new org.hl7.fhir.r5.model.CareTeam.CareTeamParticipantComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getRole()) + tgt.addRole(convertCodeableConcept(t)); + if (src.hasMember()) + tgt.setMember(convertReference(src.getMember())); + if (src.hasOnBehalfOf()) + tgt.setOnBehalfOf(convertReference(src.getOnBehalfOf())); + if (src.hasPeriod()) + tgt.setPeriod(convertPeriod(src.getPeriod())); + return tgt; + } + + public static org.hl7.fhir.r4.model.CareTeam.CareTeamParticipantComponent convertCareTeamParticipantComponent(org.hl7.fhir.r5.model.CareTeam.CareTeamParticipantComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.CareTeam.CareTeamParticipantComponent tgt = new org.hl7.fhir.r4.model.CareTeam.CareTeamParticipantComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getRole()) + tgt.addRole(convertCodeableConcept(t)); + if (src.hasMember()) + tgt.setMember(convertReference(src.getMember())); + if (src.hasOnBehalfOf()) + tgt.setOnBehalfOf(convertReference(src.getOnBehalfOf())); + if (src.hasPeriod()) + tgt.setPeriod(convertPeriod(src.getPeriod())); + return tgt; + } + + +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/CatalogEntry.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/CatalogEntry.java new file mode 100644 index 000000000..aaee0c70f --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/CatalogEntry.java @@ -0,0 +1,155 @@ +package org.hl7.fhir.convertors.conv40_50; + +import org.hl7.fhir.exceptions.FHIRException; + +import org.hl7.fhir.convertors.VersionConvertor_40_50; + + +/* + Copyright (c) 2011+, HL7, Inc. + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of HL7 nor the names of its contributors may be used to + endorse or promote products derived from this software without specific + prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + +*/ + +// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0 + + +public class CatalogEntry extends VersionConvertor_40_50 { + + public static org.hl7.fhir.r5.model.CatalogEntry convertCatalogEntry(org.hl7.fhir.r4.model.CatalogEntry src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.CatalogEntry tgt = new org.hl7.fhir.r5.model.CatalogEntry(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + if (src.hasOrderable()) + tgt.setOrderableElement(convertBoolean(src.getOrderableElement())); + if (src.hasReferencedItem()) + tgt.setReferencedItem(convertReference(src.getReferencedItem())); + for (org.hl7.fhir.r4.model.Identifier t : src.getAdditionalIdentifier()) + tgt.addAdditionalIdentifier(convertIdentifier(t)); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getClassification()) + tgt.addClassification(convertCodeableConcept(t)); + if (src.hasStatus()) + tgt.setStatus(Enumerations.convertPublicationStatus(src.getStatus())); + if (src.hasValidityPeriod()) + tgt.setValidityPeriod(convertPeriod(src.getValidityPeriod())); + if (src.hasValidTo()) + tgt.setValidToElement(convertDateTime(src.getValidToElement())); + if (src.hasLastUpdated()) + tgt.setLastUpdatedElement(convertDateTime(src.getLastUpdatedElement())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getAdditionalCharacteristic()) + tgt.addAdditionalCharacteristic(convertCodeableConcept(t)); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getAdditionalClassification()) + tgt.addAdditionalClassification(convertCodeableConcept(t)); + for (org.hl7.fhir.r4.model.CatalogEntry.CatalogEntryRelatedEntryComponent t : src.getRelatedEntry()) + tgt.addRelatedEntry(convertCatalogEntryRelatedEntryComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.CatalogEntry convertCatalogEntry(org.hl7.fhir.r5.model.CatalogEntry src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.CatalogEntry tgt = new org.hl7.fhir.r4.model.CatalogEntry(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + if (src.hasOrderable()) + tgt.setOrderableElement(convertBoolean(src.getOrderableElement())); + if (src.hasReferencedItem()) + tgt.setReferencedItem(convertReference(src.getReferencedItem())); + for (org.hl7.fhir.r5.model.Identifier t : src.getAdditionalIdentifier()) + tgt.addAdditionalIdentifier(convertIdentifier(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getClassification()) + tgt.addClassification(convertCodeableConcept(t)); + if (src.hasStatus()) + tgt.setStatus(Enumerations.convertPublicationStatus(src.getStatus())); + if (src.hasValidityPeriod()) + tgt.setValidityPeriod(convertPeriod(src.getValidityPeriod())); + if (src.hasValidTo()) + tgt.setValidToElement(convertDateTime(src.getValidToElement())); + if (src.hasLastUpdated()) + tgt.setLastUpdatedElement(convertDateTime(src.getLastUpdatedElement())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getAdditionalCharacteristic()) + tgt.addAdditionalCharacteristic(convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getAdditionalClassification()) + tgt.addAdditionalClassification(convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.CatalogEntry.CatalogEntryRelatedEntryComponent t : src.getRelatedEntry()) + tgt.addRelatedEntry(convertCatalogEntryRelatedEntryComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.CatalogEntry.CatalogEntryRelatedEntryComponent convertCatalogEntryRelatedEntryComponent(org.hl7.fhir.r4.model.CatalogEntry.CatalogEntryRelatedEntryComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.CatalogEntry.CatalogEntryRelatedEntryComponent tgt = new org.hl7.fhir.r5.model.CatalogEntry.CatalogEntryRelatedEntryComponent(); + copyElement(src, tgt); + if (src.hasRelationtype()) + tgt.setRelationtype(convertCatalogEntryRelationType(src.getRelationtype())); + if (src.hasItem()) + tgt.setItem(convertReference(src.getItem())); + return tgt; + } + + public static org.hl7.fhir.r4.model.CatalogEntry.CatalogEntryRelatedEntryComponent convertCatalogEntryRelatedEntryComponent(org.hl7.fhir.r5.model.CatalogEntry.CatalogEntryRelatedEntryComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.CatalogEntry.CatalogEntryRelatedEntryComponent tgt = new org.hl7.fhir.r4.model.CatalogEntry.CatalogEntryRelatedEntryComponent(); + copyElement(src, tgt); + if (src.hasRelationtype()) + tgt.setRelationtype(convertCatalogEntryRelationType(src.getRelationtype())); + if (src.hasItem()) + tgt.setItem(convertReference(src.getItem())); + return tgt; + } + + public static org.hl7.fhir.r5.model.CatalogEntry.CatalogEntryRelationType convertCatalogEntryRelationType(org.hl7.fhir.r4.model.CatalogEntry.CatalogEntryRelationType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case TRIGGERS: return org.hl7.fhir.r5.model.CatalogEntry.CatalogEntryRelationType.TRIGGERS; + case ISREPLACEDBY: return org.hl7.fhir.r5.model.CatalogEntry.CatalogEntryRelationType.ISREPLACEDBY; + default: return org.hl7.fhir.r5.model.CatalogEntry.CatalogEntryRelationType.NULL; + } +} + + public static org.hl7.fhir.r4.model.CatalogEntry.CatalogEntryRelationType convertCatalogEntryRelationType(org.hl7.fhir.r5.model.CatalogEntry.CatalogEntryRelationType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case TRIGGERS: return org.hl7.fhir.r4.model.CatalogEntry.CatalogEntryRelationType.TRIGGERS; + case ISREPLACEDBY: return org.hl7.fhir.r4.model.CatalogEntry.CatalogEntryRelationType.ISREPLACEDBY; + default: return org.hl7.fhir.r4.model.CatalogEntry.CatalogEntryRelationType.NULL; + } +} + + +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/ChargeItem.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/ChargeItem.java new file mode 100644 index 000000000..da97ec795 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/ChargeItem.java @@ -0,0 +1,217 @@ +package org.hl7.fhir.convertors.conv40_50; + +import org.hl7.fhir.exceptions.FHIRException; + +import org.hl7.fhir.convertors.VersionConvertor_40_50; + + +/* + Copyright (c) 2011+, HL7, Inc. + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of HL7 nor the names of its contributors may be used to + endorse or promote products derived from this software without specific + prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + +*/ + +// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0 + + +public class ChargeItem extends VersionConvertor_40_50 { + + public static org.hl7.fhir.r5.model.ChargeItem convertChargeItem(org.hl7.fhir.r4.model.ChargeItem src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ChargeItem tgt = new org.hl7.fhir.r5.model.ChargeItem(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + for (org.hl7.fhir.r4.model.UriType t : src.getDefinitionUri()) + tgt.getDefinitionUri().add(convertUri(t)); + for (org.hl7.fhir.r4.model.CanonicalType t : src.getDefinitionCanonical()) + tgt.getDefinitionCanonical().add(convertCanonical(t)); + if (src.hasStatus()) + tgt.setStatus(convertChargeItemStatus(src.getStatus())); + for (org.hl7.fhir.r4.model.Reference t : src.getPartOf()) + tgt.addPartOf(convertReference(t)); + if (src.hasCode()) + tgt.setCode(convertCodeableConcept(src.getCode())); + if (src.hasSubject()) + tgt.setSubject(convertReference(src.getSubject())); + if (src.hasContext()) + tgt.setContext(convertReference(src.getContext())); + if (src.hasOccurrence()) + tgt.setOccurrence(convertType(src.getOccurrence())); + for (org.hl7.fhir.r4.model.ChargeItem.ChargeItemPerformerComponent t : src.getPerformer()) + tgt.addPerformer(convertChargeItemPerformerComponent(t)); + if (src.hasPerformingOrganization()) + tgt.setPerformingOrganization(convertReference(src.getPerformingOrganization())); + if (src.hasRequestingOrganization()) + tgt.setRequestingOrganization(convertReference(src.getRequestingOrganization())); + if (src.hasCostCenter()) + tgt.setCostCenter(convertReference(src.getCostCenter())); + if (src.hasQuantity()) + tgt.setQuantity(convertQuantity(src.getQuantity())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getBodysite()) + tgt.addBodysite(convertCodeableConcept(t)); + if (src.hasFactorOverride()) + tgt.setFactorOverrideElement(convertDecimal(src.getFactorOverrideElement())); + if (src.hasPriceOverride()) + tgt.setPriceOverride(convertMoney(src.getPriceOverride())); + if (src.hasOverrideReason()) + tgt.setOverrideReasonElement(convertString(src.getOverrideReasonElement())); + if (src.hasEnterer()) + tgt.setEnterer(convertReference(src.getEnterer())); + if (src.hasEnteredDate()) + tgt.setEnteredDateElement(convertDateTime(src.getEnteredDateElement())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getReason()) + tgt.addReason(convertCodeableConcept(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getService()) + tgt.addService(convertReference(t)); + if (src.hasProduct()) + tgt.setProduct(convertType(src.getProduct())); + for (org.hl7.fhir.r4.model.Reference t : src.getAccount()) + tgt.addAccount(convertReference(t)); + for (org.hl7.fhir.r4.model.Annotation t : src.getNote()) + tgt.addNote(convertAnnotation(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getSupportingInformation()) + tgt.addSupportingInformation(convertReference(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.ChargeItem convertChargeItem(org.hl7.fhir.r5.model.ChargeItem src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.ChargeItem tgt = new org.hl7.fhir.r4.model.ChargeItem(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + for (org.hl7.fhir.r5.model.UriType t : src.getDefinitionUri()) + tgt.getDefinitionUri().add(convertUri(t)); + for (org.hl7.fhir.r5.model.CanonicalType t : src.getDefinitionCanonical()) + tgt.getDefinitionCanonical().add(convertCanonical(t)); + if (src.hasStatus()) + tgt.setStatus(convertChargeItemStatus(src.getStatus())); + for (org.hl7.fhir.r5.model.Reference t : src.getPartOf()) + tgt.addPartOf(convertReference(t)); + if (src.hasCode()) + tgt.setCode(convertCodeableConcept(src.getCode())); + if (src.hasSubject()) + tgt.setSubject(convertReference(src.getSubject())); + if (src.hasContext()) + tgt.setContext(convertReference(src.getContext())); + if (src.hasOccurrence()) + tgt.setOccurrence(convertType(src.getOccurrence())); + for (org.hl7.fhir.r5.model.ChargeItem.ChargeItemPerformerComponent t : src.getPerformer()) + tgt.addPerformer(convertChargeItemPerformerComponent(t)); + if (src.hasPerformingOrganization()) + tgt.setPerformingOrganization(convertReference(src.getPerformingOrganization())); + if (src.hasRequestingOrganization()) + tgt.setRequestingOrganization(convertReference(src.getRequestingOrganization())); + if (src.hasCostCenter()) + tgt.setCostCenter(convertReference(src.getCostCenter())); + if (src.hasQuantity()) + tgt.setQuantity(convertQuantity(src.getQuantity())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getBodysite()) + tgt.addBodysite(convertCodeableConcept(t)); + if (src.hasFactorOverride()) + tgt.setFactorOverrideElement(convertDecimal(src.getFactorOverrideElement())); + if (src.hasPriceOverride()) + tgt.setPriceOverride(convertMoney(src.getPriceOverride())); + if (src.hasOverrideReason()) + tgt.setOverrideReasonElement(convertString(src.getOverrideReasonElement())); + if (src.hasEnterer()) + tgt.setEnterer(convertReference(src.getEnterer())); + if (src.hasEnteredDate()) + tgt.setEnteredDateElement(convertDateTime(src.getEnteredDateElement())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getReason()) + tgt.addReason(convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getService()) + tgt.addService(convertReference(t)); + if (src.hasProduct()) + tgt.setProduct(convertType(src.getProduct())); + for (org.hl7.fhir.r5.model.Reference t : src.getAccount()) + tgt.addAccount(convertReference(t)); + for (org.hl7.fhir.r5.model.Annotation t : src.getNote()) + tgt.addNote(convertAnnotation(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getSupportingInformation()) + tgt.addSupportingInformation(convertReference(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.ChargeItem.ChargeItemStatus convertChargeItemStatus(org.hl7.fhir.r4.model.ChargeItem.ChargeItemStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PLANNED: return org.hl7.fhir.r5.model.ChargeItem.ChargeItemStatus.PLANNED; + case BILLABLE: return org.hl7.fhir.r5.model.ChargeItem.ChargeItemStatus.BILLABLE; + case NOTBILLABLE: return org.hl7.fhir.r5.model.ChargeItem.ChargeItemStatus.NOTBILLABLE; + case ABORTED: return org.hl7.fhir.r5.model.ChargeItem.ChargeItemStatus.ABORTED; + case BILLED: return org.hl7.fhir.r5.model.ChargeItem.ChargeItemStatus.BILLED; + case ENTEREDINERROR: return org.hl7.fhir.r5.model.ChargeItem.ChargeItemStatus.ENTEREDINERROR; + case UNKNOWN: return org.hl7.fhir.r5.model.ChargeItem.ChargeItemStatus.UNKNOWN; + default: return org.hl7.fhir.r5.model.ChargeItem.ChargeItemStatus.NULL; + } +} + + public static org.hl7.fhir.r4.model.ChargeItem.ChargeItemStatus convertChargeItemStatus(org.hl7.fhir.r5.model.ChargeItem.ChargeItemStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PLANNED: return org.hl7.fhir.r4.model.ChargeItem.ChargeItemStatus.PLANNED; + case BILLABLE: return org.hl7.fhir.r4.model.ChargeItem.ChargeItemStatus.BILLABLE; + case NOTBILLABLE: return org.hl7.fhir.r4.model.ChargeItem.ChargeItemStatus.NOTBILLABLE; + case ABORTED: return org.hl7.fhir.r4.model.ChargeItem.ChargeItemStatus.ABORTED; + case BILLED: return org.hl7.fhir.r4.model.ChargeItem.ChargeItemStatus.BILLED; + case ENTEREDINERROR: return org.hl7.fhir.r4.model.ChargeItem.ChargeItemStatus.ENTEREDINERROR; + case UNKNOWN: return org.hl7.fhir.r4.model.ChargeItem.ChargeItemStatus.UNKNOWN; + default: return org.hl7.fhir.r4.model.ChargeItem.ChargeItemStatus.NULL; + } +} + + public static org.hl7.fhir.r5.model.ChargeItem.ChargeItemPerformerComponent convertChargeItemPerformerComponent(org.hl7.fhir.r4.model.ChargeItem.ChargeItemPerformerComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ChargeItem.ChargeItemPerformerComponent tgt = new org.hl7.fhir.r5.model.ChargeItem.ChargeItemPerformerComponent(); + copyElement(src, tgt); + if (src.hasFunction()) + tgt.setFunction(convertCodeableConcept(src.getFunction())); + if (src.hasActor()) + tgt.setActor(convertReference(src.getActor())); + return tgt; + } + + public static org.hl7.fhir.r4.model.ChargeItem.ChargeItemPerformerComponent convertChargeItemPerformerComponent(org.hl7.fhir.r5.model.ChargeItem.ChargeItemPerformerComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.ChargeItem.ChargeItemPerformerComponent tgt = new org.hl7.fhir.r4.model.ChargeItem.ChargeItemPerformerComponent(); + copyElement(src, tgt); + if (src.hasFunction()) + tgt.setFunction(convertCodeableConcept(src.getFunction())); + if (src.hasActor()) + tgt.setActor(convertReference(src.getActor())); + return tgt; + } + + +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/ChargeItemDefinition.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/ChargeItemDefinition.java new file mode 100644 index 000000000..4a2b55004 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/ChargeItemDefinition.java @@ -0,0 +1,263 @@ +package org.hl7.fhir.convertors.conv40_50; + +import org.hl7.fhir.exceptions.FHIRException; + +import org.hl7.fhir.convertors.VersionConvertor_40_50; + + +/* + Copyright (c) 2011+, HL7, Inc. + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of HL7 nor the names of its contributors may be used to + endorse or promote products derived from this software without specific + prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + +*/ + +// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0 + + +public class ChargeItemDefinition extends VersionConvertor_40_50 { + + public static org.hl7.fhir.r5.model.ChargeItemDefinition convertChargeItemDefinition(org.hl7.fhir.r4.model.ChargeItemDefinition src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ChargeItemDefinition tgt = new org.hl7.fhir.r5.model.ChargeItemDefinition(); + copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrlElement(convertUri(src.getUrlElement())); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasVersion()) + tgt.setVersionElement(convertString(src.getVersionElement())); + if (src.hasTitle()) + tgt.setTitleElement(convertString(src.getTitleElement())); + for (org.hl7.fhir.r4.model.UriType t : src.getDerivedFromUri()) + tgt.getDerivedFromUri().add(convertUri(t)); + for (org.hl7.fhir.r4.model.CanonicalType t : src.getPartOf()) + tgt.getPartOf().add(convertCanonical(t)); + for (org.hl7.fhir.r4.model.CanonicalType t : src.getReplaces()) + tgt.getReplaces().add(convertCanonical(t)); + if (src.hasStatus()) + tgt.setStatus(Enumerations.convertPublicationStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimentalElement(convertBoolean(src.getExperimentalElement())); + if (src.hasDate()) + tgt.setDateElement(convertDateTime(src.getDateElement())); + if (src.hasPublisher()) + tgt.setPublisherElement(convertString(src.getPublisherElement())); + for (org.hl7.fhir.r4.model.ContactDetail t : src.getContact()) + tgt.addContact(convertContactDetail(t)); + if (src.hasDescription()) + tgt.setDescriptionElement(convertMarkdown(src.getDescriptionElement())); + for (org.hl7.fhir.r4.model.UsageContext t : src.getUseContext()) + tgt.addUseContext(convertUsageContext(t)); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getJurisdiction()) + tgt.addJurisdiction(convertCodeableConcept(t)); + if (src.hasCopyright()) + tgt.setCopyrightElement(convertMarkdown(src.getCopyrightElement())); + if (src.hasApprovalDate()) + tgt.setApprovalDateElement(convertDate(src.getApprovalDateElement())); + if (src.hasLastReviewDate()) + tgt.setLastReviewDateElement(convertDate(src.getLastReviewDateElement())); + if (src.hasEffectivePeriod()) + tgt.setEffectivePeriod(convertPeriod(src.getEffectivePeriod())); + if (src.hasCode()) + tgt.setCode(convertCodeableConcept(src.getCode())); + for (org.hl7.fhir.r4.model.Reference t : src.getInstance()) + tgt.addInstance(convertReference(t)); + for (org.hl7.fhir.r4.model.ChargeItemDefinition.ChargeItemDefinitionApplicabilityComponent t : src.getApplicability()) + tgt.addApplicability(convertChargeItemDefinitionApplicabilityComponent(t)); + for (org.hl7.fhir.r4.model.ChargeItemDefinition.ChargeItemDefinitionPropertyGroupComponent t : src.getPropertyGroup()) + tgt.addPropertyGroup(convertChargeItemDefinitionPropertyGroupComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.ChargeItemDefinition convertChargeItemDefinition(org.hl7.fhir.r5.model.ChargeItemDefinition src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.ChargeItemDefinition tgt = new org.hl7.fhir.r4.model.ChargeItemDefinition(); + copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrlElement(convertUri(src.getUrlElement())); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasVersion()) + tgt.setVersionElement(convertString(src.getVersionElement())); + if (src.hasTitle()) + tgt.setTitleElement(convertString(src.getTitleElement())); + for (org.hl7.fhir.r5.model.UriType t : src.getDerivedFromUri()) + tgt.getDerivedFromUri().add(convertUri(t)); + for (org.hl7.fhir.r5.model.CanonicalType t : src.getPartOf()) + tgt.getPartOf().add(convertCanonical(t)); + for (org.hl7.fhir.r5.model.CanonicalType t : src.getReplaces()) + tgt.getReplaces().add(convertCanonical(t)); + if (src.hasStatus()) + tgt.setStatus(Enumerations.convertPublicationStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimentalElement(convertBoolean(src.getExperimentalElement())); + if (src.hasDate()) + tgt.setDateElement(convertDateTime(src.getDateElement())); + if (src.hasPublisher()) + tgt.setPublisherElement(convertString(src.getPublisherElement())); + for (org.hl7.fhir.r5.model.ContactDetail t : src.getContact()) + tgt.addContact(convertContactDetail(t)); + if (src.hasDescription()) + tgt.setDescriptionElement(convertMarkdown(src.getDescriptionElement())); + for (org.hl7.fhir.r5.model.UsageContext t : src.getUseContext()) + tgt.addUseContext(convertUsageContext(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getJurisdiction()) + tgt.addJurisdiction(convertCodeableConcept(t)); + if (src.hasCopyright()) + tgt.setCopyrightElement(convertMarkdown(src.getCopyrightElement())); + if (src.hasApprovalDate()) + tgt.setApprovalDateElement(convertDate(src.getApprovalDateElement())); + if (src.hasLastReviewDate()) + tgt.setLastReviewDateElement(convertDate(src.getLastReviewDateElement())); + if (src.hasEffectivePeriod()) + tgt.setEffectivePeriod(convertPeriod(src.getEffectivePeriod())); + if (src.hasCode()) + tgt.setCode(convertCodeableConcept(src.getCode())); + for (org.hl7.fhir.r5.model.Reference t : src.getInstance()) + tgt.addInstance(convertReference(t)); + for (org.hl7.fhir.r5.model.ChargeItemDefinition.ChargeItemDefinitionApplicabilityComponent t : src.getApplicability()) + tgt.addApplicability(convertChargeItemDefinitionApplicabilityComponent(t)); + for (org.hl7.fhir.r5.model.ChargeItemDefinition.ChargeItemDefinitionPropertyGroupComponent t : src.getPropertyGroup()) + tgt.addPropertyGroup(convertChargeItemDefinitionPropertyGroupComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.ChargeItemDefinition.ChargeItemDefinitionApplicabilityComponent convertChargeItemDefinitionApplicabilityComponent(org.hl7.fhir.r4.model.ChargeItemDefinition.ChargeItemDefinitionApplicabilityComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ChargeItemDefinition.ChargeItemDefinitionApplicabilityComponent tgt = new org.hl7.fhir.r5.model.ChargeItemDefinition.ChargeItemDefinitionApplicabilityComponent(); + copyElement(src, tgt); + if (src.hasDescription()) + tgt.setDescriptionElement(convertString(src.getDescriptionElement())); + if (src.hasLanguage()) + tgt.setLanguageElement(convertString(src.getLanguageElement())); + if (src.hasExpression()) + tgt.setExpressionElement(convertString(src.getExpressionElement())); + return tgt; + } + + public static org.hl7.fhir.r4.model.ChargeItemDefinition.ChargeItemDefinitionApplicabilityComponent convertChargeItemDefinitionApplicabilityComponent(org.hl7.fhir.r5.model.ChargeItemDefinition.ChargeItemDefinitionApplicabilityComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.ChargeItemDefinition.ChargeItemDefinitionApplicabilityComponent tgt = new org.hl7.fhir.r4.model.ChargeItemDefinition.ChargeItemDefinitionApplicabilityComponent(); + copyElement(src, tgt); + if (src.hasDescription()) + tgt.setDescriptionElement(convertString(src.getDescriptionElement())); + if (src.hasLanguage()) + tgt.setLanguageElement(convertString(src.getLanguageElement())); + if (src.hasExpression()) + tgt.setExpressionElement(convertString(src.getExpressionElement())); + return tgt; + } + + public static org.hl7.fhir.r5.model.ChargeItemDefinition.ChargeItemDefinitionPropertyGroupComponent convertChargeItemDefinitionPropertyGroupComponent(org.hl7.fhir.r4.model.ChargeItemDefinition.ChargeItemDefinitionPropertyGroupComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ChargeItemDefinition.ChargeItemDefinitionPropertyGroupComponent tgt = new org.hl7.fhir.r5.model.ChargeItemDefinition.ChargeItemDefinitionPropertyGroupComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.r4.model.ChargeItemDefinition.ChargeItemDefinitionApplicabilityComponent t : src.getApplicability()) + tgt.addApplicability(convertChargeItemDefinitionApplicabilityComponent(t)); + for (org.hl7.fhir.r4.model.ChargeItemDefinition.ChargeItemDefinitionPropertyGroupPriceComponentComponent t : src.getPriceComponent()) + tgt.addPriceComponent(convertChargeItemDefinitionPropertyGroupPriceComponentComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.ChargeItemDefinition.ChargeItemDefinitionPropertyGroupComponent convertChargeItemDefinitionPropertyGroupComponent(org.hl7.fhir.r5.model.ChargeItemDefinition.ChargeItemDefinitionPropertyGroupComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.ChargeItemDefinition.ChargeItemDefinitionPropertyGroupComponent tgt = new org.hl7.fhir.r4.model.ChargeItemDefinition.ChargeItemDefinitionPropertyGroupComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.r5.model.ChargeItemDefinition.ChargeItemDefinitionApplicabilityComponent t : src.getApplicability()) + tgt.addApplicability(convertChargeItemDefinitionApplicabilityComponent(t)); + for (org.hl7.fhir.r5.model.ChargeItemDefinition.ChargeItemDefinitionPropertyGroupPriceComponentComponent t : src.getPriceComponent()) + tgt.addPriceComponent(convertChargeItemDefinitionPropertyGroupPriceComponentComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.ChargeItemDefinition.ChargeItemDefinitionPropertyGroupPriceComponentComponent convertChargeItemDefinitionPropertyGroupPriceComponentComponent(org.hl7.fhir.r4.model.ChargeItemDefinition.ChargeItemDefinitionPropertyGroupPriceComponentComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ChargeItemDefinition.ChargeItemDefinitionPropertyGroupPriceComponentComponent tgt = new org.hl7.fhir.r5.model.ChargeItemDefinition.ChargeItemDefinitionPropertyGroupPriceComponentComponent(); + copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertChargeItemDefinitionPriceComponentType(src.getType())); + if (src.hasCode()) + tgt.setCode(convertCodeableConcept(src.getCode())); + if (src.hasFactor()) + tgt.setFactorElement(convertDecimal(src.getFactorElement())); + if (src.hasAmount()) + tgt.setAmount(convertMoney(src.getAmount())); + return tgt; + } + + public static org.hl7.fhir.r4.model.ChargeItemDefinition.ChargeItemDefinitionPropertyGroupPriceComponentComponent convertChargeItemDefinitionPropertyGroupPriceComponentComponent(org.hl7.fhir.r5.model.ChargeItemDefinition.ChargeItemDefinitionPropertyGroupPriceComponentComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.ChargeItemDefinition.ChargeItemDefinitionPropertyGroupPriceComponentComponent tgt = new org.hl7.fhir.r4.model.ChargeItemDefinition.ChargeItemDefinitionPropertyGroupPriceComponentComponent(); + copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertChargeItemDefinitionPriceComponentType(src.getType())); + if (src.hasCode()) + tgt.setCode(convertCodeableConcept(src.getCode())); + if (src.hasFactor()) + tgt.setFactorElement(convertDecimal(src.getFactorElement())); + if (src.hasAmount()) + tgt.setAmount(convertMoney(src.getAmount())); + return tgt; + } + + public static org.hl7.fhir.r5.model.ChargeItemDefinition.ChargeItemDefinitionPriceComponentType convertChargeItemDefinitionPriceComponentType(org.hl7.fhir.r4.model.ChargeItemDefinition.ChargeItemDefinitionPriceComponentType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case BASE: return org.hl7.fhir.r5.model.ChargeItemDefinition.ChargeItemDefinitionPriceComponentType.BASE; + case SURCHARGE: return org.hl7.fhir.r5.model.ChargeItemDefinition.ChargeItemDefinitionPriceComponentType.SURCHARGE; + case DEDUCTION: return org.hl7.fhir.r5.model.ChargeItemDefinition.ChargeItemDefinitionPriceComponentType.DEDUCTION; + case DISCOUNT: return org.hl7.fhir.r5.model.ChargeItemDefinition.ChargeItemDefinitionPriceComponentType.DISCOUNT; + case TAX: return org.hl7.fhir.r5.model.ChargeItemDefinition.ChargeItemDefinitionPriceComponentType.TAX; + case INFORMATIONAL: return org.hl7.fhir.r5.model.ChargeItemDefinition.ChargeItemDefinitionPriceComponentType.INFORMATIONAL; + default: return org.hl7.fhir.r5.model.ChargeItemDefinition.ChargeItemDefinitionPriceComponentType.NULL; + } +} + + public static org.hl7.fhir.r4.model.ChargeItemDefinition.ChargeItemDefinitionPriceComponentType convertChargeItemDefinitionPriceComponentType(org.hl7.fhir.r5.model.ChargeItemDefinition.ChargeItemDefinitionPriceComponentType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case BASE: return org.hl7.fhir.r4.model.ChargeItemDefinition.ChargeItemDefinitionPriceComponentType.BASE; + case SURCHARGE: return org.hl7.fhir.r4.model.ChargeItemDefinition.ChargeItemDefinitionPriceComponentType.SURCHARGE; + case DEDUCTION: return org.hl7.fhir.r4.model.ChargeItemDefinition.ChargeItemDefinitionPriceComponentType.DEDUCTION; + case DISCOUNT: return org.hl7.fhir.r4.model.ChargeItemDefinition.ChargeItemDefinitionPriceComponentType.DISCOUNT; + case TAX: return org.hl7.fhir.r4.model.ChargeItemDefinition.ChargeItemDefinitionPriceComponentType.TAX; + case INFORMATIONAL: return org.hl7.fhir.r4.model.ChargeItemDefinition.ChargeItemDefinitionPriceComponentType.INFORMATIONAL; + default: return org.hl7.fhir.r4.model.ChargeItemDefinition.ChargeItemDefinitionPriceComponentType.NULL; + } +} + + +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Claim.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Claim.java new file mode 100644 index 000000000..3d958c2fa --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Claim.java @@ -0,0 +1,709 @@ +package org.hl7.fhir.convertors.conv40_50; + +import org.hl7.fhir.exceptions.FHIRException; + +import org.hl7.fhir.convertors.VersionConvertor_40_50; + + +/* + Copyright (c) 2011+, HL7, Inc. + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of HL7 nor the names of its contributors may be used to + endorse or promote products derived from this software without specific + prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + +*/ + +// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0 + + +public class Claim extends VersionConvertor_40_50 { + + public static org.hl7.fhir.r5.model.Claim convertClaim(org.hl7.fhir.r4.model.Claim src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Claim tgt = new org.hl7.fhir.r5.model.Claim(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasStatus()) + tgt.setStatus(convertClaimStatus(src.getStatus())); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + if (src.hasSubType()) + tgt.setSubType(convertCodeableConcept(src.getSubType())); + if (src.hasUse()) + tgt.setUse(convertUse(src.getUse())); + if (src.hasPatient()) + tgt.setPatient(convertReference(src.getPatient())); + if (src.hasBillablePeriod()) + tgt.setBillablePeriod(convertPeriod(src.getBillablePeriod())); + if (src.hasCreated()) + tgt.setCreatedElement(convertDateTime(src.getCreatedElement())); + if (src.hasEnterer()) + tgt.setEnterer(convertReference(src.getEnterer())); + if (src.hasInsurer()) + tgt.setInsurer(convertReference(src.getInsurer())); + if (src.hasProvider()) + tgt.setProvider(convertReference(src.getProvider())); + if (src.hasPriority()) + tgt.setPriority(convertCodeableConcept(src.getPriority())); + if (src.hasFundsReserve()) + tgt.setFundsReserve(convertCodeableConcept(src.getFundsReserve())); + for (org.hl7.fhir.r4.model.Claim.RelatedClaimComponent t : src.getRelated()) + tgt.addRelated(convertRelatedClaimComponent(t)); + if (src.hasPrescription()) + tgt.setPrescription(convertReference(src.getPrescription())); + if (src.hasOriginalPrescription()) + tgt.setOriginalPrescription(convertReference(src.getOriginalPrescription())); + if (src.hasPayee()) + tgt.setPayee(convertPayeeComponent(src.getPayee())); + if (src.hasReferral()) + tgt.setReferral(convertReference(src.getReferral())); + if (src.hasFacility()) + tgt.setFacility(convertReference(src.getFacility())); + for (org.hl7.fhir.r4.model.Claim.CareTeamComponent t : src.getCareTeam()) + tgt.addCareTeam(convertCareTeamComponent(t)); + for (org.hl7.fhir.r4.model.Claim.SupportingInformationComponent t : src.getSupportingInfo()) + tgt.addSupportingInfo(convertSupportingInformationComponent(t)); + for (org.hl7.fhir.r4.model.Claim.DiagnosisComponent t : src.getDiagnosis()) + tgt.addDiagnosis(convertDiagnosisComponent(t)); + for (org.hl7.fhir.r4.model.Claim.ProcedureComponent t : src.getProcedure()) + tgt.addProcedure(convertProcedureComponent(t)); + for (org.hl7.fhir.r4.model.Claim.InsuranceComponent t : src.getInsurance()) + tgt.addInsurance(convertInsuranceComponent(t)); + if (src.hasAccident()) + tgt.setAccident(convertAccidentComponent(src.getAccident())); + for (org.hl7.fhir.r4.model.Claim.ItemComponent t : src.getItem()) + tgt.addItem(convertItemComponent(t)); + if (src.hasTotal()) + tgt.setTotal(convertMoney(src.getTotal())); + return tgt; + } + + public static org.hl7.fhir.r4.model.Claim convertClaim(org.hl7.fhir.r5.model.Claim src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Claim tgt = new org.hl7.fhir.r4.model.Claim(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasStatus()) + tgt.setStatus(convertClaimStatus(src.getStatus())); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + if (src.hasSubType()) + tgt.setSubType(convertCodeableConcept(src.getSubType())); + if (src.hasUse()) + tgt.setUse(convertUse(src.getUse())); + if (src.hasPatient()) + tgt.setPatient(convertReference(src.getPatient())); + if (src.hasBillablePeriod()) + tgt.setBillablePeriod(convertPeriod(src.getBillablePeriod())); + if (src.hasCreated()) + tgt.setCreatedElement(convertDateTime(src.getCreatedElement())); + if (src.hasEnterer()) + tgt.setEnterer(convertReference(src.getEnterer())); + if (src.hasInsurer()) + tgt.setInsurer(convertReference(src.getInsurer())); + if (src.hasProvider()) + tgt.setProvider(convertReference(src.getProvider())); + if (src.hasPriority()) + tgt.setPriority(convertCodeableConcept(src.getPriority())); + if (src.hasFundsReserve()) + tgt.setFundsReserve(convertCodeableConcept(src.getFundsReserve())); + for (org.hl7.fhir.r5.model.Claim.RelatedClaimComponent t : src.getRelated()) + tgt.addRelated(convertRelatedClaimComponent(t)); + if (src.hasPrescription()) + tgt.setPrescription(convertReference(src.getPrescription())); + if (src.hasOriginalPrescription()) + tgt.setOriginalPrescription(convertReference(src.getOriginalPrescription())); + if (src.hasPayee()) + tgt.setPayee(convertPayeeComponent(src.getPayee())); + if (src.hasReferral()) + tgt.setReferral(convertReference(src.getReferral())); + if (src.hasFacility()) + tgt.setFacility(convertReference(src.getFacility())); + for (org.hl7.fhir.r5.model.Claim.CareTeamComponent t : src.getCareTeam()) + tgt.addCareTeam(convertCareTeamComponent(t)); + for (org.hl7.fhir.r5.model.Claim.SupportingInformationComponent t : src.getSupportingInfo()) + tgt.addSupportingInfo(convertSupportingInformationComponent(t)); + for (org.hl7.fhir.r5.model.Claim.DiagnosisComponent t : src.getDiagnosis()) + tgt.addDiagnosis(convertDiagnosisComponent(t)); + for (org.hl7.fhir.r5.model.Claim.ProcedureComponent t : src.getProcedure()) + tgt.addProcedure(convertProcedureComponent(t)); + for (org.hl7.fhir.r5.model.Claim.InsuranceComponent t : src.getInsurance()) + tgt.addInsurance(convertInsuranceComponent(t)); + if (src.hasAccident()) + tgt.setAccident(convertAccidentComponent(src.getAccident())); + for (org.hl7.fhir.r5.model.Claim.ItemComponent t : src.getItem()) + tgt.addItem(convertItemComponent(t)); + if (src.hasTotal()) + tgt.setTotal(convertMoney(src.getTotal())); + return tgt; + } + + public static org.hl7.fhir.r5.model.Claim.ClaimStatus convertClaimStatus(org.hl7.fhir.r4.model.Claim.ClaimStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case ACTIVE: return org.hl7.fhir.r5.model.Claim.ClaimStatus.ACTIVE; + case CANCELLED: return org.hl7.fhir.r5.model.Claim.ClaimStatus.CANCELLED; + case DRAFT: return org.hl7.fhir.r5.model.Claim.ClaimStatus.DRAFT; + case ENTEREDINERROR: return org.hl7.fhir.r5.model.Claim.ClaimStatus.ENTEREDINERROR; + default: return org.hl7.fhir.r5.model.Claim.ClaimStatus.NULL; + } +} + + public static org.hl7.fhir.r4.model.Claim.ClaimStatus convertClaimStatus(org.hl7.fhir.r5.model.Claim.ClaimStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case ACTIVE: return org.hl7.fhir.r4.model.Claim.ClaimStatus.ACTIVE; + case CANCELLED: return org.hl7.fhir.r4.model.Claim.ClaimStatus.CANCELLED; + case DRAFT: return org.hl7.fhir.r4.model.Claim.ClaimStatus.DRAFT; + case ENTEREDINERROR: return org.hl7.fhir.r4.model.Claim.ClaimStatus.ENTEREDINERROR; + default: return org.hl7.fhir.r4.model.Claim.ClaimStatus.NULL; + } +} + + public static org.hl7.fhir.r5.model.Claim.Use convertUse(org.hl7.fhir.r4.model.Claim.Use src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case CLAIM: return org.hl7.fhir.r5.model.Claim.Use.CLAIM; + case PREAUTHORIZATION: return org.hl7.fhir.r5.model.Claim.Use.PREAUTHORIZATION; + case PREDETERMINATION: return org.hl7.fhir.r5.model.Claim.Use.PREDETERMINATION; + default: return org.hl7.fhir.r5.model.Claim.Use.NULL; + } +} + + public static org.hl7.fhir.r4.model.Claim.Use convertUse(org.hl7.fhir.r5.model.Claim.Use src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case CLAIM: return org.hl7.fhir.r4.model.Claim.Use.CLAIM; + case PREAUTHORIZATION: return org.hl7.fhir.r4.model.Claim.Use.PREAUTHORIZATION; + case PREDETERMINATION: return org.hl7.fhir.r4.model.Claim.Use.PREDETERMINATION; + default: return org.hl7.fhir.r4.model.Claim.Use.NULL; + } +} + + public static org.hl7.fhir.r5.model.Claim.RelatedClaimComponent convertRelatedClaimComponent(org.hl7.fhir.r4.model.Claim.RelatedClaimComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Claim.RelatedClaimComponent tgt = new org.hl7.fhir.r5.model.Claim.RelatedClaimComponent(); + copyElement(src, tgt); + if (src.hasClaim()) + tgt.setClaim(convertReference(src.getClaim())); + if (src.hasRelationship()) + tgt.setRelationship(convertCodeableConcept(src.getRelationship())); + if (src.hasReference()) + tgt.setReference(convertIdentifier(src.getReference())); + return tgt; + } + + public static org.hl7.fhir.r4.model.Claim.RelatedClaimComponent convertRelatedClaimComponent(org.hl7.fhir.r5.model.Claim.RelatedClaimComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Claim.RelatedClaimComponent tgt = new org.hl7.fhir.r4.model.Claim.RelatedClaimComponent(); + copyElement(src, tgt); + if (src.hasClaim()) + tgt.setClaim(convertReference(src.getClaim())); + if (src.hasRelationship()) + tgt.setRelationship(convertCodeableConcept(src.getRelationship())); + if (src.hasReference()) + tgt.setReference(convertIdentifier(src.getReference())); + return tgt; + } + + public static org.hl7.fhir.r5.model.Claim.PayeeComponent convertPayeeComponent(org.hl7.fhir.r4.model.Claim.PayeeComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Claim.PayeeComponent tgt = new org.hl7.fhir.r5.model.Claim.PayeeComponent(); + copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + if (src.hasParty()) + tgt.setParty(convertReference(src.getParty())); + return tgt; + } + + public static org.hl7.fhir.r4.model.Claim.PayeeComponent convertPayeeComponent(org.hl7.fhir.r5.model.Claim.PayeeComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Claim.PayeeComponent tgt = new org.hl7.fhir.r4.model.Claim.PayeeComponent(); + copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + if (src.hasParty()) + tgt.setParty(convertReference(src.getParty())); + return tgt; + } + + public static org.hl7.fhir.r5.model.Claim.CareTeamComponent convertCareTeamComponent(org.hl7.fhir.r4.model.Claim.CareTeamComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Claim.CareTeamComponent tgt = new org.hl7.fhir.r5.model.Claim.CareTeamComponent(); + copyElement(src, tgt); + if (src.hasSequence()) + tgt.setSequenceElement(convertPositiveInt(src.getSequenceElement())); + if (src.hasProvider()) + tgt.setProvider(convertReference(src.getProvider())); + if (src.hasResponsible()) + tgt.setResponsibleElement(convertBoolean(src.getResponsibleElement())); + if (src.hasRole()) + tgt.setRole(convertCodeableConcept(src.getRole())); + if (src.hasQualification()) + tgt.setQualification(convertCodeableConcept(src.getQualification())); + return tgt; + } + + public static org.hl7.fhir.r4.model.Claim.CareTeamComponent convertCareTeamComponent(org.hl7.fhir.r5.model.Claim.CareTeamComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Claim.CareTeamComponent tgt = new org.hl7.fhir.r4.model.Claim.CareTeamComponent(); + copyElement(src, tgt); + if (src.hasSequence()) + tgt.setSequenceElement(convertPositiveInt(src.getSequenceElement())); + if (src.hasProvider()) + tgt.setProvider(convertReference(src.getProvider())); + if (src.hasResponsible()) + tgt.setResponsibleElement(convertBoolean(src.getResponsibleElement())); + if (src.hasRole()) + tgt.setRole(convertCodeableConcept(src.getRole())); + if (src.hasQualification()) + tgt.setQualification(convertCodeableConcept(src.getQualification())); + return tgt; + } + + public static org.hl7.fhir.r5.model.Claim.SupportingInformationComponent convertSupportingInformationComponent(org.hl7.fhir.r4.model.Claim.SupportingInformationComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Claim.SupportingInformationComponent tgt = new org.hl7.fhir.r5.model.Claim.SupportingInformationComponent(); + copyElement(src, tgt); + if (src.hasSequence()) + tgt.setSequenceElement(convertPositiveInt(src.getSequenceElement())); + if (src.hasCategory()) + tgt.setCategory(convertCodeableConcept(src.getCategory())); + if (src.hasCode()) + tgt.setCode(convertCodeableConcept(src.getCode())); + if (src.hasTiming()) + tgt.setTiming(convertType(src.getTiming())); + if (src.hasValue()) + tgt.setValue(convertType(src.getValue())); + if (src.hasReason()) + tgt.setReason(convertCodeableConcept(src.getReason())); + return tgt; + } + + public static org.hl7.fhir.r4.model.Claim.SupportingInformationComponent convertSupportingInformationComponent(org.hl7.fhir.r5.model.Claim.SupportingInformationComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Claim.SupportingInformationComponent tgt = new org.hl7.fhir.r4.model.Claim.SupportingInformationComponent(); + copyElement(src, tgt); + if (src.hasSequence()) + tgt.setSequenceElement(convertPositiveInt(src.getSequenceElement())); + if (src.hasCategory()) + tgt.setCategory(convertCodeableConcept(src.getCategory())); + if (src.hasCode()) + tgt.setCode(convertCodeableConcept(src.getCode())); + if (src.hasTiming()) + tgt.setTiming(convertType(src.getTiming())); + if (src.hasValue()) + tgt.setValue(convertType(src.getValue())); + if (src.hasReason()) + tgt.setReason(convertCodeableConcept(src.getReason())); + return tgt; + } + + public static org.hl7.fhir.r5.model.Claim.DiagnosisComponent convertDiagnosisComponent(org.hl7.fhir.r4.model.Claim.DiagnosisComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Claim.DiagnosisComponent tgt = new org.hl7.fhir.r5.model.Claim.DiagnosisComponent(); + copyElement(src, tgt); + if (src.hasSequence()) + tgt.setSequenceElement(convertPositiveInt(src.getSequenceElement())); + if (src.hasDiagnosis()) + tgt.setDiagnosis(convertType(src.getDiagnosis())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getType()) + tgt.addType(convertCodeableConcept(t)); + if (src.hasOnAdmission()) + tgt.setOnAdmission(convertCodeableConcept(src.getOnAdmission())); + if (src.hasPackageCode()) + tgt.setPackageCode(convertCodeableConcept(src.getPackageCode())); + return tgt; + } + + public static org.hl7.fhir.r4.model.Claim.DiagnosisComponent convertDiagnosisComponent(org.hl7.fhir.r5.model.Claim.DiagnosisComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Claim.DiagnosisComponent tgt = new org.hl7.fhir.r4.model.Claim.DiagnosisComponent(); + copyElement(src, tgt); + if (src.hasSequence()) + tgt.setSequenceElement(convertPositiveInt(src.getSequenceElement())); + if (src.hasDiagnosis()) + tgt.setDiagnosis(convertType(src.getDiagnosis())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getType()) + tgt.addType(convertCodeableConcept(t)); + if (src.hasOnAdmission()) + tgt.setOnAdmission(convertCodeableConcept(src.getOnAdmission())); + if (src.hasPackageCode()) + tgt.setPackageCode(convertCodeableConcept(src.getPackageCode())); + return tgt; + } + + public static org.hl7.fhir.r5.model.Claim.ProcedureComponent convertProcedureComponent(org.hl7.fhir.r4.model.Claim.ProcedureComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Claim.ProcedureComponent tgt = new org.hl7.fhir.r5.model.Claim.ProcedureComponent(); + copyElement(src, tgt); + if (src.hasSequence()) + tgt.setSequenceElement(convertPositiveInt(src.getSequenceElement())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getType()) + tgt.addType(convertCodeableConcept(t)); + if (src.hasDate()) + tgt.setDateElement(convertDateTime(src.getDateElement())); + if (src.hasProcedure()) + tgt.setProcedure(convertType(src.getProcedure())); + for (org.hl7.fhir.r4.model.Reference t : src.getUdi()) + tgt.addUdi(convertReference(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.Claim.ProcedureComponent convertProcedureComponent(org.hl7.fhir.r5.model.Claim.ProcedureComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Claim.ProcedureComponent tgt = new org.hl7.fhir.r4.model.Claim.ProcedureComponent(); + copyElement(src, tgt); + if (src.hasSequence()) + tgt.setSequenceElement(convertPositiveInt(src.getSequenceElement())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getType()) + tgt.addType(convertCodeableConcept(t)); + if (src.hasDate()) + tgt.setDateElement(convertDateTime(src.getDateElement())); + if (src.hasProcedure()) + tgt.setProcedure(convertType(src.getProcedure())); + for (org.hl7.fhir.r5.model.Reference t : src.getUdi()) + tgt.addUdi(convertReference(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.Claim.InsuranceComponent convertInsuranceComponent(org.hl7.fhir.r4.model.Claim.InsuranceComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Claim.InsuranceComponent tgt = new org.hl7.fhir.r5.model.Claim.InsuranceComponent(); + copyElement(src, tgt); + if (src.hasSequence()) + tgt.setSequenceElement(convertPositiveInt(src.getSequenceElement())); + if (src.hasFocal()) + tgt.setFocalElement(convertBoolean(src.getFocalElement())); + if (src.hasIdentifier()) + tgt.setIdentifier(convertIdentifier(src.getIdentifier())); + if (src.hasCoverage()) + tgt.setCoverage(convertReference(src.getCoverage())); + if (src.hasBusinessArrangement()) + tgt.setBusinessArrangementElement(convertString(src.getBusinessArrangementElement())); + for (org.hl7.fhir.r4.model.StringType t : src.getPreAuthRef()) + tgt.getPreAuthRef().add(convertString(t)); + if (src.hasClaimResponse()) + tgt.setClaimResponse(convertReference(src.getClaimResponse())); + return tgt; + } + + public static org.hl7.fhir.r4.model.Claim.InsuranceComponent convertInsuranceComponent(org.hl7.fhir.r5.model.Claim.InsuranceComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Claim.InsuranceComponent tgt = new org.hl7.fhir.r4.model.Claim.InsuranceComponent(); + copyElement(src, tgt); + if (src.hasSequence()) + tgt.setSequenceElement(convertPositiveInt(src.getSequenceElement())); + if (src.hasFocal()) + tgt.setFocalElement(convertBoolean(src.getFocalElement())); + if (src.hasIdentifier()) + tgt.setIdentifier(convertIdentifier(src.getIdentifier())); + if (src.hasCoverage()) + tgt.setCoverage(convertReference(src.getCoverage())); + if (src.hasBusinessArrangement()) + tgt.setBusinessArrangementElement(convertString(src.getBusinessArrangementElement())); + for (org.hl7.fhir.r5.model.StringType t : src.getPreAuthRef()) + tgt.getPreAuthRef().add(convertString(t)); + if (src.hasClaimResponse()) + tgt.setClaimResponse(convertReference(src.getClaimResponse())); + return tgt; + } + + public static org.hl7.fhir.r5.model.Claim.AccidentComponent convertAccidentComponent(org.hl7.fhir.r4.model.Claim.AccidentComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Claim.AccidentComponent tgt = new org.hl7.fhir.r5.model.Claim.AccidentComponent(); + copyElement(src, tgt); + if (src.hasDate()) + tgt.setDateElement(convertDate(src.getDateElement())); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + if (src.hasLocation()) + tgt.setLocation(convertType(src.getLocation())); + return tgt; + } + + public static org.hl7.fhir.r4.model.Claim.AccidentComponent convertAccidentComponent(org.hl7.fhir.r5.model.Claim.AccidentComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Claim.AccidentComponent tgt = new org.hl7.fhir.r4.model.Claim.AccidentComponent(); + copyElement(src, tgt); + if (src.hasDate()) + tgt.setDateElement(convertDate(src.getDateElement())); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + if (src.hasLocation()) + tgt.setLocation(convertType(src.getLocation())); + return tgt; + } + + public static org.hl7.fhir.r5.model.Claim.ItemComponent convertItemComponent(org.hl7.fhir.r4.model.Claim.ItemComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Claim.ItemComponent tgt = new org.hl7.fhir.r5.model.Claim.ItemComponent(); + copyElement(src, tgt); + if (src.hasSequence()) + tgt.setSequenceElement(convertPositiveInt(src.getSequenceElement())); + for (org.hl7.fhir.r4.model.PositiveIntType t : src.getCareTeamSequence()) + tgt.getCareTeamSequence().add(convertPositiveInt(t)); + for (org.hl7.fhir.r4.model.PositiveIntType t : src.getDiagnosisSequence()) + tgt.getDiagnosisSequence().add(convertPositiveInt(t)); + for (org.hl7.fhir.r4.model.PositiveIntType t : src.getProcedureSequence()) + tgt.getProcedureSequence().add(convertPositiveInt(t)); + for (org.hl7.fhir.r4.model.PositiveIntType t : src.getInformationSequence()) + tgt.getInformationSequence().add(convertPositiveInt(t)); + if (src.hasRevenue()) + tgt.setRevenue(convertCodeableConcept(src.getRevenue())); + if (src.hasCategory()) + tgt.setCategory(convertCodeableConcept(src.getCategory())); + if (src.hasProductOrService()) + tgt.setProductOrService(convertCodeableConcept(src.getProductOrService())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getModifier()) + tgt.addModifier(convertCodeableConcept(t)); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getProgramCode()) + tgt.addProgramCode(convertCodeableConcept(t)); + if (src.hasServiced()) + tgt.setServiced(convertType(src.getServiced())); + if (src.hasLocation()) + tgt.setLocation(convertType(src.getLocation())); + if (src.hasQuantity()) + tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); + if (src.hasUnitPrice()) + tgt.setUnitPrice(convertMoney(src.getUnitPrice())); + if (src.hasFactor()) + tgt.setFactorElement(convertDecimal(src.getFactorElement())); + if (src.hasNet()) + tgt.setNet(convertMoney(src.getNet())); + for (org.hl7.fhir.r4.model.Reference t : src.getUdi()) + tgt.addUdi(convertReference(t)); + if (src.hasBodySite()) + tgt.setBodySite(convertCodeableConcept(src.getBodySite())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getSubSite()) + tgt.addSubSite(convertCodeableConcept(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getEncounter()) + tgt.addEncounter(convertReference(t)); + for (org.hl7.fhir.r4.model.Claim.DetailComponent t : src.getDetail()) + tgt.addDetail(convertDetailComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.Claim.ItemComponent convertItemComponent(org.hl7.fhir.r5.model.Claim.ItemComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Claim.ItemComponent tgt = new org.hl7.fhir.r4.model.Claim.ItemComponent(); + copyElement(src, tgt); + if (src.hasSequence()) + tgt.setSequenceElement(convertPositiveInt(src.getSequenceElement())); + for (org.hl7.fhir.r5.model.PositiveIntType t : src.getCareTeamSequence()) + tgt.getCareTeamSequence().add(convertPositiveInt(t)); + for (org.hl7.fhir.r5.model.PositiveIntType t : src.getDiagnosisSequence()) + tgt.getDiagnosisSequence().add(convertPositiveInt(t)); + for (org.hl7.fhir.r5.model.PositiveIntType t : src.getProcedureSequence()) + tgt.getProcedureSequence().add(convertPositiveInt(t)); + for (org.hl7.fhir.r5.model.PositiveIntType t : src.getInformationSequence()) + tgt.getInformationSequence().add(convertPositiveInt(t)); + if (src.hasRevenue()) + tgt.setRevenue(convertCodeableConcept(src.getRevenue())); + if (src.hasCategory()) + tgt.setCategory(convertCodeableConcept(src.getCategory())); + if (src.hasProductOrService()) + tgt.setProductOrService(convertCodeableConcept(src.getProductOrService())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getModifier()) + tgt.addModifier(convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getProgramCode()) + tgt.addProgramCode(convertCodeableConcept(t)); + if (src.hasServiced()) + tgt.setServiced(convertType(src.getServiced())); + if (src.hasLocation()) + tgt.setLocation(convertType(src.getLocation())); + if (src.hasQuantity()) + tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); + if (src.hasUnitPrice()) + tgt.setUnitPrice(convertMoney(src.getUnitPrice())); + if (src.hasFactor()) + tgt.setFactorElement(convertDecimal(src.getFactorElement())); + if (src.hasNet()) + tgt.setNet(convertMoney(src.getNet())); + for (org.hl7.fhir.r5.model.Reference t : src.getUdi()) + tgt.addUdi(convertReference(t)); + if (src.hasBodySite()) + tgt.setBodySite(convertCodeableConcept(src.getBodySite())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getSubSite()) + tgt.addSubSite(convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getEncounter()) + tgt.addEncounter(convertReference(t)); + for (org.hl7.fhir.r5.model.Claim.DetailComponent t : src.getDetail()) + tgt.addDetail(convertDetailComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.Claim.DetailComponent convertDetailComponent(org.hl7.fhir.r4.model.Claim.DetailComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Claim.DetailComponent tgt = new org.hl7.fhir.r5.model.Claim.DetailComponent(); + copyElement(src, tgt); + if (src.hasSequence()) + tgt.setSequenceElement(convertPositiveInt(src.getSequenceElement())); + if (src.hasRevenue()) + tgt.setRevenue(convertCodeableConcept(src.getRevenue())); + if (src.hasCategory()) + tgt.setCategory(convertCodeableConcept(src.getCategory())); + if (src.hasProductOrService()) + tgt.setProductOrService(convertCodeableConcept(src.getProductOrService())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getModifier()) + tgt.addModifier(convertCodeableConcept(t)); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getProgramCode()) + tgt.addProgramCode(convertCodeableConcept(t)); + if (src.hasQuantity()) + tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); + if (src.hasUnitPrice()) + tgt.setUnitPrice(convertMoney(src.getUnitPrice())); + if (src.hasFactor()) + tgt.setFactorElement(convertDecimal(src.getFactorElement())); + if (src.hasNet()) + tgt.setNet(convertMoney(src.getNet())); + for (org.hl7.fhir.r4.model.Reference t : src.getUdi()) + tgt.addUdi(convertReference(t)); + for (org.hl7.fhir.r4.model.Claim.SubDetailComponent t : src.getSubDetail()) + tgt.addSubDetail(convertSubDetailComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.Claim.DetailComponent convertDetailComponent(org.hl7.fhir.r5.model.Claim.DetailComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Claim.DetailComponent tgt = new org.hl7.fhir.r4.model.Claim.DetailComponent(); + copyElement(src, tgt); + if (src.hasSequence()) + tgt.setSequenceElement(convertPositiveInt(src.getSequenceElement())); + if (src.hasRevenue()) + tgt.setRevenue(convertCodeableConcept(src.getRevenue())); + if (src.hasCategory()) + tgt.setCategory(convertCodeableConcept(src.getCategory())); + if (src.hasProductOrService()) + tgt.setProductOrService(convertCodeableConcept(src.getProductOrService())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getModifier()) + tgt.addModifier(convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getProgramCode()) + tgt.addProgramCode(convertCodeableConcept(t)); + if (src.hasQuantity()) + tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); + if (src.hasUnitPrice()) + tgt.setUnitPrice(convertMoney(src.getUnitPrice())); + if (src.hasFactor()) + tgt.setFactorElement(convertDecimal(src.getFactorElement())); + if (src.hasNet()) + tgt.setNet(convertMoney(src.getNet())); + for (org.hl7.fhir.r5.model.Reference t : src.getUdi()) + tgt.addUdi(convertReference(t)); + for (org.hl7.fhir.r5.model.Claim.SubDetailComponent t : src.getSubDetail()) + tgt.addSubDetail(convertSubDetailComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.Claim.SubDetailComponent convertSubDetailComponent(org.hl7.fhir.r4.model.Claim.SubDetailComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Claim.SubDetailComponent tgt = new org.hl7.fhir.r5.model.Claim.SubDetailComponent(); + copyElement(src, tgt); + if (src.hasSequence()) + tgt.setSequenceElement(convertPositiveInt(src.getSequenceElement())); + if (src.hasRevenue()) + tgt.setRevenue(convertCodeableConcept(src.getRevenue())); + if (src.hasCategory()) + tgt.setCategory(convertCodeableConcept(src.getCategory())); + if (src.hasProductOrService()) + tgt.setProductOrService(convertCodeableConcept(src.getProductOrService())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getModifier()) + tgt.addModifier(convertCodeableConcept(t)); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getProgramCode()) + tgt.addProgramCode(convertCodeableConcept(t)); + if (src.hasQuantity()) + tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); + if (src.hasUnitPrice()) + tgt.setUnitPrice(convertMoney(src.getUnitPrice())); + if (src.hasFactor()) + tgt.setFactorElement(convertDecimal(src.getFactorElement())); + if (src.hasNet()) + tgt.setNet(convertMoney(src.getNet())); + for (org.hl7.fhir.r4.model.Reference t : src.getUdi()) + tgt.addUdi(convertReference(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.Claim.SubDetailComponent convertSubDetailComponent(org.hl7.fhir.r5.model.Claim.SubDetailComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Claim.SubDetailComponent tgt = new org.hl7.fhir.r4.model.Claim.SubDetailComponent(); + copyElement(src, tgt); + if (src.hasSequence()) + tgt.setSequenceElement(convertPositiveInt(src.getSequenceElement())); + if (src.hasRevenue()) + tgt.setRevenue(convertCodeableConcept(src.getRevenue())); + if (src.hasCategory()) + tgt.setCategory(convertCodeableConcept(src.getCategory())); + if (src.hasProductOrService()) + tgt.setProductOrService(convertCodeableConcept(src.getProductOrService())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getModifier()) + tgt.addModifier(convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getProgramCode()) + tgt.addProgramCode(convertCodeableConcept(t)); + if (src.hasQuantity()) + tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); + if (src.hasUnitPrice()) + tgt.setUnitPrice(convertMoney(src.getUnitPrice())); + if (src.hasFactor()) + tgt.setFactorElement(convertDecimal(src.getFactorElement())); + if (src.hasNet()) + tgt.setNet(convertMoney(src.getNet())); + for (org.hl7.fhir.r5.model.Reference t : src.getUdi()) + tgt.addUdi(convertReference(t)); + return tgt; + } + + +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/ClaimResponse.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/ClaimResponse.java new file mode 100644 index 000000000..333809ca6 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/ClaimResponse.java @@ -0,0 +1,713 @@ +package org.hl7.fhir.convertors.conv40_50; + +import org.hl7.fhir.exceptions.FHIRException; + +import org.hl7.fhir.convertors.VersionConvertor_40_50; + + +/* + Copyright (c) 2011+, HL7, Inc. + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of HL7 nor the names of its contributors may be used to + endorse or promote products derived from this software without specific + prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + +*/ + +// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0 + + +public class ClaimResponse extends VersionConvertor_40_50 { + + public static org.hl7.fhir.r5.model.ClaimResponse convertClaimResponse(org.hl7.fhir.r4.model.ClaimResponse src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ClaimResponse tgt = new org.hl7.fhir.r5.model.ClaimResponse(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasStatus()) + tgt.setStatus(convertClaimResponseStatus(src.getStatus())); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + if (src.hasSubType()) + tgt.setSubType(convertCodeableConcept(src.getSubType())); + if (src.hasUse()) + tgt.setUse(convertUse(src.getUse())); + if (src.hasPatient()) + tgt.setPatient(convertReference(src.getPatient())); + if (src.hasCreated()) + tgt.setCreatedElement(convertDateTime(src.getCreatedElement())); + if (src.hasInsurer()) + tgt.setInsurer(convertReference(src.getInsurer())); + if (src.hasRequestor()) + tgt.setRequestor(convertReference(src.getRequestor())); + if (src.hasRequest()) + tgt.setRequest(convertReference(src.getRequest())); + if (src.hasOutcome()) + tgt.setOutcome(convertRemittanceOutcome(src.getOutcome())); + if (src.hasDisposition()) + tgt.setDispositionElement(convertString(src.getDispositionElement())); + if (src.hasPreAuthRef()) + tgt.setPreAuthRefElement(convertString(src.getPreAuthRefElement())); + if (src.hasPreAuthPeriod()) + tgt.setPreAuthPeriod(convertPeriod(src.getPreAuthPeriod())); + if (src.hasPayeeType()) + tgt.setPayeeType(convertCodeableConcept(src.getPayeeType())); + for (org.hl7.fhir.r4.model.ClaimResponse.ItemComponent t : src.getItem()) + tgt.addItem(convertItemComponent(t)); + for (org.hl7.fhir.r4.model.ClaimResponse.AddedItemComponent t : src.getAddItem()) + tgt.addAddItem(convertAddedItemComponent(t)); + for (org.hl7.fhir.r4.model.ClaimResponse.AdjudicationComponent t : src.getAdjudication()) + tgt.addAdjudication(convertAdjudicationComponent(t)); + for (org.hl7.fhir.r4.model.ClaimResponse.TotalComponent t : src.getTotal()) + tgt.addTotal(convertTotalComponent(t)); + if (src.hasPayment()) + tgt.setPayment(convertPaymentComponent(src.getPayment())); + if (src.hasFundsReserve()) + tgt.setFundsReserve(convertCodeableConcept(src.getFundsReserve())); + if (src.hasFormCode()) + tgt.setFormCode(convertCodeableConcept(src.getFormCode())); + if (src.hasForm()) + tgt.setForm(convertAttachment(src.getForm())); + for (org.hl7.fhir.r4.model.ClaimResponse.NoteComponent t : src.getProcessNote()) + tgt.addProcessNote(convertNoteComponent(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getCommunicationRequest()) + tgt.addCommunicationRequest(convertReference(t)); + for (org.hl7.fhir.r4.model.ClaimResponse.InsuranceComponent t : src.getInsurance()) + tgt.addInsurance(convertInsuranceComponent(t)); + for (org.hl7.fhir.r4.model.ClaimResponse.ErrorComponent t : src.getError()) + tgt.addError(convertErrorComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.ClaimResponse convertClaimResponse(org.hl7.fhir.r5.model.ClaimResponse src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.ClaimResponse tgt = new org.hl7.fhir.r4.model.ClaimResponse(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasStatus()) + tgt.setStatus(convertClaimResponseStatus(src.getStatus())); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + if (src.hasSubType()) + tgt.setSubType(convertCodeableConcept(src.getSubType())); + if (src.hasUse()) + tgt.setUse(convertUse(src.getUse())); + if (src.hasPatient()) + tgt.setPatient(convertReference(src.getPatient())); + if (src.hasCreated()) + tgt.setCreatedElement(convertDateTime(src.getCreatedElement())); + if (src.hasInsurer()) + tgt.setInsurer(convertReference(src.getInsurer())); + if (src.hasRequestor()) + tgt.setRequestor(convertReference(src.getRequestor())); + if (src.hasRequest()) + tgt.setRequest(convertReference(src.getRequest())); + if (src.hasOutcome()) + tgt.setOutcome(convertRemittanceOutcome(src.getOutcome())); + if (src.hasDisposition()) + tgt.setDispositionElement(convertString(src.getDispositionElement())); + if (src.hasPreAuthRef()) + tgt.setPreAuthRefElement(convertString(src.getPreAuthRefElement())); + if (src.hasPreAuthPeriod()) + tgt.setPreAuthPeriod(convertPeriod(src.getPreAuthPeriod())); + if (src.hasPayeeType()) + tgt.setPayeeType(convertCodeableConcept(src.getPayeeType())); + for (org.hl7.fhir.r5.model.ClaimResponse.ItemComponent t : src.getItem()) + tgt.addItem(convertItemComponent(t)); + for (org.hl7.fhir.r5.model.ClaimResponse.AddedItemComponent t : src.getAddItem()) + tgt.addAddItem(convertAddedItemComponent(t)); + for (org.hl7.fhir.r5.model.ClaimResponse.AdjudicationComponent t : src.getAdjudication()) + tgt.addAdjudication(convertAdjudicationComponent(t)); + for (org.hl7.fhir.r5.model.ClaimResponse.TotalComponent t : src.getTotal()) + tgt.addTotal(convertTotalComponent(t)); + if (src.hasPayment()) + tgt.setPayment(convertPaymentComponent(src.getPayment())); + if (src.hasFundsReserve()) + tgt.setFundsReserve(convertCodeableConcept(src.getFundsReserve())); + if (src.hasFormCode()) + tgt.setFormCode(convertCodeableConcept(src.getFormCode())); + if (src.hasForm()) + tgt.setForm(convertAttachment(src.getForm())); + for (org.hl7.fhir.r5.model.ClaimResponse.NoteComponent t : src.getProcessNote()) + tgt.addProcessNote(convertNoteComponent(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getCommunicationRequest()) + tgt.addCommunicationRequest(convertReference(t)); + for (org.hl7.fhir.r5.model.ClaimResponse.InsuranceComponent t : src.getInsurance()) + tgt.addInsurance(convertInsuranceComponent(t)); + for (org.hl7.fhir.r5.model.ClaimResponse.ErrorComponent t : src.getError()) + tgt.addError(convertErrorComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.ClaimResponse.ClaimResponseStatus convertClaimResponseStatus(org.hl7.fhir.r4.model.ClaimResponse.ClaimResponseStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case ACTIVE: return org.hl7.fhir.r5.model.ClaimResponse.ClaimResponseStatus.ACTIVE; + case CANCELLED: return org.hl7.fhir.r5.model.ClaimResponse.ClaimResponseStatus.CANCELLED; + case DRAFT: return org.hl7.fhir.r5.model.ClaimResponse.ClaimResponseStatus.DRAFT; + case ENTEREDINERROR: return org.hl7.fhir.r5.model.ClaimResponse.ClaimResponseStatus.ENTEREDINERROR; + default: return org.hl7.fhir.r5.model.ClaimResponse.ClaimResponseStatus.NULL; + } +} + + public static org.hl7.fhir.r4.model.ClaimResponse.ClaimResponseStatus convertClaimResponseStatus(org.hl7.fhir.r5.model.ClaimResponse.ClaimResponseStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case ACTIVE: return org.hl7.fhir.r4.model.ClaimResponse.ClaimResponseStatus.ACTIVE; + case CANCELLED: return org.hl7.fhir.r4.model.ClaimResponse.ClaimResponseStatus.CANCELLED; + case DRAFT: return org.hl7.fhir.r4.model.ClaimResponse.ClaimResponseStatus.DRAFT; + case ENTEREDINERROR: return org.hl7.fhir.r4.model.ClaimResponse.ClaimResponseStatus.ENTEREDINERROR; + default: return org.hl7.fhir.r4.model.ClaimResponse.ClaimResponseStatus.NULL; + } +} + + public static org.hl7.fhir.r5.model.ClaimResponse.Use convertUse(org.hl7.fhir.r4.model.ClaimResponse.Use src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case CLAIM: return org.hl7.fhir.r5.model.ClaimResponse.Use.CLAIM; + case PREAUTHORIZATION: return org.hl7.fhir.r5.model.ClaimResponse.Use.PREAUTHORIZATION; + case PREDETERMINATION: return org.hl7.fhir.r5.model.ClaimResponse.Use.PREDETERMINATION; + default: return org.hl7.fhir.r5.model.ClaimResponse.Use.NULL; + } +} + + public static org.hl7.fhir.r4.model.ClaimResponse.Use convertUse(org.hl7.fhir.r5.model.ClaimResponse.Use src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case CLAIM: return org.hl7.fhir.r4.model.ClaimResponse.Use.CLAIM; + case PREAUTHORIZATION: return org.hl7.fhir.r4.model.ClaimResponse.Use.PREAUTHORIZATION; + case PREDETERMINATION: return org.hl7.fhir.r4.model.ClaimResponse.Use.PREDETERMINATION; + default: return org.hl7.fhir.r4.model.ClaimResponse.Use.NULL; + } +} + + public static org.hl7.fhir.r5.model.ClaimResponse.RemittanceOutcome convertRemittanceOutcome(org.hl7.fhir.r4.model.ClaimResponse.RemittanceOutcome src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case QUEUED: return org.hl7.fhir.r5.model.ClaimResponse.RemittanceOutcome.QUEUED; + case COMPLETE: return org.hl7.fhir.r5.model.ClaimResponse.RemittanceOutcome.COMPLETE; + case ERROR: return org.hl7.fhir.r5.model.ClaimResponse.RemittanceOutcome.ERROR; + case PARTIAL: return org.hl7.fhir.r5.model.ClaimResponse.RemittanceOutcome.PARTIAL; + default: return org.hl7.fhir.r5.model.ClaimResponse.RemittanceOutcome.NULL; + } +} + + public static org.hl7.fhir.r4.model.ClaimResponse.RemittanceOutcome convertRemittanceOutcome(org.hl7.fhir.r5.model.ClaimResponse.RemittanceOutcome src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case QUEUED: return org.hl7.fhir.r4.model.ClaimResponse.RemittanceOutcome.QUEUED; + case COMPLETE: return org.hl7.fhir.r4.model.ClaimResponse.RemittanceOutcome.COMPLETE; + case ERROR: return org.hl7.fhir.r4.model.ClaimResponse.RemittanceOutcome.ERROR; + case PARTIAL: return org.hl7.fhir.r4.model.ClaimResponse.RemittanceOutcome.PARTIAL; + default: return org.hl7.fhir.r4.model.ClaimResponse.RemittanceOutcome.NULL; + } +} + + public static org.hl7.fhir.r5.model.ClaimResponse.ItemComponent convertItemComponent(org.hl7.fhir.r4.model.ClaimResponse.ItemComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ClaimResponse.ItemComponent tgt = new org.hl7.fhir.r5.model.ClaimResponse.ItemComponent(); + copyElement(src, tgt); + if (src.hasItemSequence()) + tgt.setItemSequenceElement(convertPositiveInt(src.getItemSequenceElement())); + for (org.hl7.fhir.r4.model.PositiveIntType t : src.getNoteNumber()) + tgt.getNoteNumber().add(convertPositiveInt(t)); + for (org.hl7.fhir.r4.model.ClaimResponse.AdjudicationComponent t : src.getAdjudication()) + tgt.addAdjudication(convertAdjudicationComponent(t)); + for (org.hl7.fhir.r4.model.ClaimResponse.ItemDetailComponent t : src.getDetail()) + tgt.addDetail(convertItemDetailComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.ClaimResponse.ItemComponent convertItemComponent(org.hl7.fhir.r5.model.ClaimResponse.ItemComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.ClaimResponse.ItemComponent tgt = new org.hl7.fhir.r4.model.ClaimResponse.ItemComponent(); + copyElement(src, tgt); + if (src.hasItemSequence()) + tgt.setItemSequenceElement(convertPositiveInt(src.getItemSequenceElement())); + for (org.hl7.fhir.r5.model.PositiveIntType t : src.getNoteNumber()) + tgt.getNoteNumber().add(convertPositiveInt(t)); + for (org.hl7.fhir.r5.model.ClaimResponse.AdjudicationComponent t : src.getAdjudication()) + tgt.addAdjudication(convertAdjudicationComponent(t)); + for (org.hl7.fhir.r5.model.ClaimResponse.ItemDetailComponent t : src.getDetail()) + tgt.addDetail(convertItemDetailComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.ClaimResponse.AdjudicationComponent convertAdjudicationComponent(org.hl7.fhir.r4.model.ClaimResponse.AdjudicationComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ClaimResponse.AdjudicationComponent tgt = new org.hl7.fhir.r5.model.ClaimResponse.AdjudicationComponent(); + copyElement(src, tgt); + if (src.hasCategory()) + tgt.setCategory(convertCodeableConcept(src.getCategory())); + if (src.hasReason()) + tgt.setReason(convertCodeableConcept(src.getReason())); + if (src.hasAmount()) + tgt.setAmount(convertMoney(src.getAmount())); + if (src.hasValue()) + tgt.setValueElement(convertDecimal(src.getValueElement())); + return tgt; + } + + public static org.hl7.fhir.r4.model.ClaimResponse.AdjudicationComponent convertAdjudicationComponent(org.hl7.fhir.r5.model.ClaimResponse.AdjudicationComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.ClaimResponse.AdjudicationComponent tgt = new org.hl7.fhir.r4.model.ClaimResponse.AdjudicationComponent(); + copyElement(src, tgt); + if (src.hasCategory()) + tgt.setCategory(convertCodeableConcept(src.getCategory())); + if (src.hasReason()) + tgt.setReason(convertCodeableConcept(src.getReason())); + if (src.hasAmount()) + tgt.setAmount(convertMoney(src.getAmount())); + if (src.hasValue()) + tgt.setValueElement(convertDecimal(src.getValueElement())); + return tgt; + } + + public static org.hl7.fhir.r5.model.ClaimResponse.ItemDetailComponent convertItemDetailComponent(org.hl7.fhir.r4.model.ClaimResponse.ItemDetailComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ClaimResponse.ItemDetailComponent tgt = new org.hl7.fhir.r5.model.ClaimResponse.ItemDetailComponent(); + copyElement(src, tgt); + if (src.hasDetailSequence()) + tgt.setDetailSequenceElement(convertPositiveInt(src.getDetailSequenceElement())); + for (org.hl7.fhir.r4.model.PositiveIntType t : src.getNoteNumber()) + tgt.getNoteNumber().add(convertPositiveInt(t)); + for (org.hl7.fhir.r4.model.ClaimResponse.AdjudicationComponent t : src.getAdjudication()) + tgt.addAdjudication(convertAdjudicationComponent(t)); + for (org.hl7.fhir.r4.model.ClaimResponse.SubDetailComponent t : src.getSubDetail()) + tgt.addSubDetail(convertSubDetailComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.ClaimResponse.ItemDetailComponent convertItemDetailComponent(org.hl7.fhir.r5.model.ClaimResponse.ItemDetailComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.ClaimResponse.ItemDetailComponent tgt = new org.hl7.fhir.r4.model.ClaimResponse.ItemDetailComponent(); + copyElement(src, tgt); + if (src.hasDetailSequence()) + tgt.setDetailSequenceElement(convertPositiveInt(src.getDetailSequenceElement())); + for (org.hl7.fhir.r5.model.PositiveIntType t : src.getNoteNumber()) + tgt.getNoteNumber().add(convertPositiveInt(t)); + for (org.hl7.fhir.r5.model.ClaimResponse.AdjudicationComponent t : src.getAdjudication()) + tgt.addAdjudication(convertAdjudicationComponent(t)); + for (org.hl7.fhir.r5.model.ClaimResponse.SubDetailComponent t : src.getSubDetail()) + tgt.addSubDetail(convertSubDetailComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.ClaimResponse.SubDetailComponent convertSubDetailComponent(org.hl7.fhir.r4.model.ClaimResponse.SubDetailComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ClaimResponse.SubDetailComponent tgt = new org.hl7.fhir.r5.model.ClaimResponse.SubDetailComponent(); + copyElement(src, tgt); + if (src.hasSubDetailSequence()) + tgt.setSubDetailSequenceElement(convertPositiveInt(src.getSubDetailSequenceElement())); + for (org.hl7.fhir.r4.model.PositiveIntType t : src.getNoteNumber()) + tgt.getNoteNumber().add(convertPositiveInt(t)); + for (org.hl7.fhir.r4.model.ClaimResponse.AdjudicationComponent t : src.getAdjudication()) + tgt.addAdjudication(convertAdjudicationComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.ClaimResponse.SubDetailComponent convertSubDetailComponent(org.hl7.fhir.r5.model.ClaimResponse.SubDetailComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.ClaimResponse.SubDetailComponent tgt = new org.hl7.fhir.r4.model.ClaimResponse.SubDetailComponent(); + copyElement(src, tgt); + if (src.hasSubDetailSequence()) + tgt.setSubDetailSequenceElement(convertPositiveInt(src.getSubDetailSequenceElement())); + for (org.hl7.fhir.r5.model.PositiveIntType t : src.getNoteNumber()) + tgt.getNoteNumber().add(convertPositiveInt(t)); + for (org.hl7.fhir.r5.model.ClaimResponse.AdjudicationComponent t : src.getAdjudication()) + tgt.addAdjudication(convertAdjudicationComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.ClaimResponse.AddedItemComponent convertAddedItemComponent(org.hl7.fhir.r4.model.ClaimResponse.AddedItemComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ClaimResponse.AddedItemComponent tgt = new org.hl7.fhir.r5.model.ClaimResponse.AddedItemComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.r4.model.PositiveIntType t : src.getItemSequence()) + tgt.getItemSequence().add(convertPositiveInt(t)); + for (org.hl7.fhir.r4.model.PositiveIntType t : src.getDetailSequence()) + tgt.getDetailSequence().add(convertPositiveInt(t)); + for (org.hl7.fhir.r4.model.PositiveIntType t : src.getSubdetailSequence()) + tgt.getSubdetailSequence().add(convertPositiveInt(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getProvider()) + tgt.addProvider(convertReference(t)); + if (src.hasProductOrService()) + tgt.setProductOrService(convertCodeableConcept(src.getProductOrService())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getModifier()) + tgt.addModifier(convertCodeableConcept(t)); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getProgramCode()) + tgt.addProgramCode(convertCodeableConcept(t)); + if (src.hasServiced()) + tgt.setServiced(convertType(src.getServiced())); + if (src.hasLocation()) + tgt.setLocation(convertType(src.getLocation())); + if (src.hasQuantity()) + tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); + if (src.hasUnitPrice()) + tgt.setUnitPrice(convertMoney(src.getUnitPrice())); + if (src.hasFactor()) + tgt.setFactorElement(convertDecimal(src.getFactorElement())); + if (src.hasNet()) + tgt.setNet(convertMoney(src.getNet())); + if (src.hasBodySite()) + tgt.setBodySite(convertCodeableConcept(src.getBodySite())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getSubSite()) + tgt.addSubSite(convertCodeableConcept(t)); + for (org.hl7.fhir.r4.model.PositiveIntType t : src.getNoteNumber()) + tgt.getNoteNumber().add(convertPositiveInt(t)); + for (org.hl7.fhir.r4.model.ClaimResponse.AdjudicationComponent t : src.getAdjudication()) + tgt.addAdjudication(convertAdjudicationComponent(t)); + for (org.hl7.fhir.r4.model.ClaimResponse.AddedItemDetailComponent t : src.getDetail()) + tgt.addDetail(convertAddedItemDetailComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.ClaimResponse.AddedItemComponent convertAddedItemComponent(org.hl7.fhir.r5.model.ClaimResponse.AddedItemComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.ClaimResponse.AddedItemComponent tgt = new org.hl7.fhir.r4.model.ClaimResponse.AddedItemComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.r5.model.PositiveIntType t : src.getItemSequence()) + tgt.getItemSequence().add(convertPositiveInt(t)); + for (org.hl7.fhir.r5.model.PositiveIntType t : src.getDetailSequence()) + tgt.getDetailSequence().add(convertPositiveInt(t)); + for (org.hl7.fhir.r5.model.PositiveIntType t : src.getSubdetailSequence()) + tgt.getSubdetailSequence().add(convertPositiveInt(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getProvider()) + tgt.addProvider(convertReference(t)); + if (src.hasProductOrService()) + tgt.setProductOrService(convertCodeableConcept(src.getProductOrService())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getModifier()) + tgt.addModifier(convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getProgramCode()) + tgt.addProgramCode(convertCodeableConcept(t)); + if (src.hasServiced()) + tgt.setServiced(convertType(src.getServiced())); + if (src.hasLocation()) + tgt.setLocation(convertType(src.getLocation())); + if (src.hasQuantity()) + tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); + if (src.hasUnitPrice()) + tgt.setUnitPrice(convertMoney(src.getUnitPrice())); + if (src.hasFactor()) + tgt.setFactorElement(convertDecimal(src.getFactorElement())); + if (src.hasNet()) + tgt.setNet(convertMoney(src.getNet())); + if (src.hasBodySite()) + tgt.setBodySite(convertCodeableConcept(src.getBodySite())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getSubSite()) + tgt.addSubSite(convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.PositiveIntType t : src.getNoteNumber()) + tgt.getNoteNumber().add(convertPositiveInt(t)); + for (org.hl7.fhir.r5.model.ClaimResponse.AdjudicationComponent t : src.getAdjudication()) + tgt.addAdjudication(convertAdjudicationComponent(t)); + for (org.hl7.fhir.r5.model.ClaimResponse.AddedItemDetailComponent t : src.getDetail()) + tgt.addDetail(convertAddedItemDetailComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.ClaimResponse.AddedItemDetailComponent convertAddedItemDetailComponent(org.hl7.fhir.r4.model.ClaimResponse.AddedItemDetailComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ClaimResponse.AddedItemDetailComponent tgt = new org.hl7.fhir.r5.model.ClaimResponse.AddedItemDetailComponent(); + copyElement(src, tgt); + if (src.hasProductOrService()) + tgt.setProductOrService(convertCodeableConcept(src.getProductOrService())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getModifier()) + tgt.addModifier(convertCodeableConcept(t)); + if (src.hasQuantity()) + tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); + if (src.hasUnitPrice()) + tgt.setUnitPrice(convertMoney(src.getUnitPrice())); + if (src.hasFactor()) + tgt.setFactorElement(convertDecimal(src.getFactorElement())); + if (src.hasNet()) + tgt.setNet(convertMoney(src.getNet())); + for (org.hl7.fhir.r4.model.PositiveIntType t : src.getNoteNumber()) + tgt.getNoteNumber().add(convertPositiveInt(t)); + for (org.hl7.fhir.r4.model.ClaimResponse.AdjudicationComponent t : src.getAdjudication()) + tgt.addAdjudication(convertAdjudicationComponent(t)); + for (org.hl7.fhir.r4.model.ClaimResponse.AddedItemSubDetailComponent t : src.getSubDetail()) + tgt.addSubDetail(convertAddedItemSubDetailComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.ClaimResponse.AddedItemDetailComponent convertAddedItemDetailComponent(org.hl7.fhir.r5.model.ClaimResponse.AddedItemDetailComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.ClaimResponse.AddedItemDetailComponent tgt = new org.hl7.fhir.r4.model.ClaimResponse.AddedItemDetailComponent(); + copyElement(src, tgt); + if (src.hasProductOrService()) + tgt.setProductOrService(convertCodeableConcept(src.getProductOrService())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getModifier()) + tgt.addModifier(convertCodeableConcept(t)); + if (src.hasQuantity()) + tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); + if (src.hasUnitPrice()) + tgt.setUnitPrice(convertMoney(src.getUnitPrice())); + if (src.hasFactor()) + tgt.setFactorElement(convertDecimal(src.getFactorElement())); + if (src.hasNet()) + tgt.setNet(convertMoney(src.getNet())); + for (org.hl7.fhir.r5.model.PositiveIntType t : src.getNoteNumber()) + tgt.getNoteNumber().add(convertPositiveInt(t)); + for (org.hl7.fhir.r5.model.ClaimResponse.AdjudicationComponent t : src.getAdjudication()) + tgt.addAdjudication(convertAdjudicationComponent(t)); + for (org.hl7.fhir.r5.model.ClaimResponse.AddedItemSubDetailComponent t : src.getSubDetail()) + tgt.addSubDetail(convertAddedItemSubDetailComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.ClaimResponse.AddedItemSubDetailComponent convertAddedItemSubDetailComponent(org.hl7.fhir.r4.model.ClaimResponse.AddedItemSubDetailComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ClaimResponse.AddedItemSubDetailComponent tgt = new org.hl7.fhir.r5.model.ClaimResponse.AddedItemSubDetailComponent(); + copyElement(src, tgt); + if (src.hasProductOrService()) + tgt.setProductOrService(convertCodeableConcept(src.getProductOrService())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getModifier()) + tgt.addModifier(convertCodeableConcept(t)); + if (src.hasQuantity()) + tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); + if (src.hasUnitPrice()) + tgt.setUnitPrice(convertMoney(src.getUnitPrice())); + if (src.hasFactor()) + tgt.setFactorElement(convertDecimal(src.getFactorElement())); + if (src.hasNet()) + tgt.setNet(convertMoney(src.getNet())); + for (org.hl7.fhir.r4.model.PositiveIntType t : src.getNoteNumber()) + tgt.getNoteNumber().add(convertPositiveInt(t)); + for (org.hl7.fhir.r4.model.ClaimResponse.AdjudicationComponent t : src.getAdjudication()) + tgt.addAdjudication(convertAdjudicationComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.ClaimResponse.AddedItemSubDetailComponent convertAddedItemSubDetailComponent(org.hl7.fhir.r5.model.ClaimResponse.AddedItemSubDetailComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.ClaimResponse.AddedItemSubDetailComponent tgt = new org.hl7.fhir.r4.model.ClaimResponse.AddedItemSubDetailComponent(); + copyElement(src, tgt); + if (src.hasProductOrService()) + tgt.setProductOrService(convertCodeableConcept(src.getProductOrService())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getModifier()) + tgt.addModifier(convertCodeableConcept(t)); + if (src.hasQuantity()) + tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); + if (src.hasUnitPrice()) + tgt.setUnitPrice(convertMoney(src.getUnitPrice())); + if (src.hasFactor()) + tgt.setFactorElement(convertDecimal(src.getFactorElement())); + if (src.hasNet()) + tgt.setNet(convertMoney(src.getNet())); + for (org.hl7.fhir.r5.model.PositiveIntType t : src.getNoteNumber()) + tgt.getNoteNumber().add(convertPositiveInt(t)); + for (org.hl7.fhir.r5.model.ClaimResponse.AdjudicationComponent t : src.getAdjudication()) + tgt.addAdjudication(convertAdjudicationComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.ClaimResponse.TotalComponent convertTotalComponent(org.hl7.fhir.r4.model.ClaimResponse.TotalComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ClaimResponse.TotalComponent tgt = new org.hl7.fhir.r5.model.ClaimResponse.TotalComponent(); + copyElement(src, tgt); + if (src.hasCategory()) + tgt.setCategory(convertCodeableConcept(src.getCategory())); + if (src.hasAmount()) + tgt.setAmount(convertMoney(src.getAmount())); + return tgt; + } + + public static org.hl7.fhir.r4.model.ClaimResponse.TotalComponent convertTotalComponent(org.hl7.fhir.r5.model.ClaimResponse.TotalComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.ClaimResponse.TotalComponent tgt = new org.hl7.fhir.r4.model.ClaimResponse.TotalComponent(); + copyElement(src, tgt); + if (src.hasCategory()) + tgt.setCategory(convertCodeableConcept(src.getCategory())); + if (src.hasAmount()) + tgt.setAmount(convertMoney(src.getAmount())); + return tgt; + } + + public static org.hl7.fhir.r5.model.ClaimResponse.PaymentComponent convertPaymentComponent(org.hl7.fhir.r4.model.ClaimResponse.PaymentComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ClaimResponse.PaymentComponent tgt = new org.hl7.fhir.r5.model.ClaimResponse.PaymentComponent(); + copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + if (src.hasAdjustment()) + tgt.setAdjustment(convertMoney(src.getAdjustment())); + if (src.hasAdjustmentReason()) + tgt.setAdjustmentReason(convertCodeableConcept(src.getAdjustmentReason())); + if (src.hasDate()) + tgt.setDateElement(convertDate(src.getDateElement())); + if (src.hasAmount()) + tgt.setAmount(convertMoney(src.getAmount())); + if (src.hasIdentifier()) + tgt.setIdentifier(convertIdentifier(src.getIdentifier())); + return tgt; + } + + public static org.hl7.fhir.r4.model.ClaimResponse.PaymentComponent convertPaymentComponent(org.hl7.fhir.r5.model.ClaimResponse.PaymentComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.ClaimResponse.PaymentComponent tgt = new org.hl7.fhir.r4.model.ClaimResponse.PaymentComponent(); + copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + if (src.hasAdjustment()) + tgt.setAdjustment(convertMoney(src.getAdjustment())); + if (src.hasAdjustmentReason()) + tgt.setAdjustmentReason(convertCodeableConcept(src.getAdjustmentReason())); + if (src.hasDate()) + tgt.setDateElement(convertDate(src.getDateElement())); + if (src.hasAmount()) + tgt.setAmount(convertMoney(src.getAmount())); + if (src.hasIdentifier()) + tgt.setIdentifier(convertIdentifier(src.getIdentifier())); + return tgt; + } + + public static org.hl7.fhir.r5.model.ClaimResponse.NoteComponent convertNoteComponent(org.hl7.fhir.r4.model.ClaimResponse.NoteComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ClaimResponse.NoteComponent tgt = new org.hl7.fhir.r5.model.ClaimResponse.NoteComponent(); + copyElement(src, tgt); + if (src.hasNumber()) + tgt.setNumberElement(convertPositiveInt(src.getNumberElement())); + if (src.hasType()) + tgt.setType(Enumerations.convertNoteType(src.getType())); + if (src.hasText()) + tgt.setTextElement(convertString(src.getTextElement())); + if (src.hasLanguage()) + tgt.setLanguage(convertCodeableConcept(src.getLanguage())); + return tgt; + } + + public static org.hl7.fhir.r4.model.ClaimResponse.NoteComponent convertNoteComponent(org.hl7.fhir.r5.model.ClaimResponse.NoteComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.ClaimResponse.NoteComponent tgt = new org.hl7.fhir.r4.model.ClaimResponse.NoteComponent(); + copyElement(src, tgt); + if (src.hasNumber()) + tgt.setNumberElement(convertPositiveInt(src.getNumberElement())); + if (src.hasType()) + tgt.setType(Enumerations.convertNoteType(src.getType())); + if (src.hasText()) + tgt.setTextElement(convertString(src.getTextElement())); + if (src.hasLanguage()) + tgt.setLanguage(convertCodeableConcept(src.getLanguage())); + return tgt; + } + + public static org.hl7.fhir.r5.model.ClaimResponse.InsuranceComponent convertInsuranceComponent(org.hl7.fhir.r4.model.ClaimResponse.InsuranceComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ClaimResponse.InsuranceComponent tgt = new org.hl7.fhir.r5.model.ClaimResponse.InsuranceComponent(); + copyElement(src, tgt); + if (src.hasSequence()) + tgt.setSequenceElement(convertPositiveInt(src.getSequenceElement())); + if (src.hasFocal()) + tgt.setFocalElement(convertBoolean(src.getFocalElement())); + if (src.hasCoverage()) + tgt.setCoverage(convertReference(src.getCoverage())); + if (src.hasBusinessArrangement()) + tgt.setBusinessArrangementElement(convertString(src.getBusinessArrangementElement())); + if (src.hasClaimResponse()) + tgt.setClaimResponse(convertReference(src.getClaimResponse())); + return tgt; + } + + public static org.hl7.fhir.r4.model.ClaimResponse.InsuranceComponent convertInsuranceComponent(org.hl7.fhir.r5.model.ClaimResponse.InsuranceComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.ClaimResponse.InsuranceComponent tgt = new org.hl7.fhir.r4.model.ClaimResponse.InsuranceComponent(); + copyElement(src, tgt); + if (src.hasSequence()) + tgt.setSequenceElement(convertPositiveInt(src.getSequenceElement())); + if (src.hasFocal()) + tgt.setFocalElement(convertBoolean(src.getFocalElement())); + if (src.hasCoverage()) + tgt.setCoverage(convertReference(src.getCoverage())); + if (src.hasBusinessArrangement()) + tgt.setBusinessArrangementElement(convertString(src.getBusinessArrangementElement())); + if (src.hasClaimResponse()) + tgt.setClaimResponse(convertReference(src.getClaimResponse())); + return tgt; + } + + public static org.hl7.fhir.r5.model.ClaimResponse.ErrorComponent convertErrorComponent(org.hl7.fhir.r4.model.ClaimResponse.ErrorComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ClaimResponse.ErrorComponent tgt = new org.hl7.fhir.r5.model.ClaimResponse.ErrorComponent(); + copyElement(src, tgt); + if (src.hasItemSequence()) + tgt.setItemSequenceElement(convertPositiveInt(src.getItemSequenceElement())); + if (src.hasDetailSequence()) + tgt.setDetailSequenceElement(convertPositiveInt(src.getDetailSequenceElement())); + if (src.hasSubDetailSequence()) + tgt.setSubDetailSequenceElement(convertPositiveInt(src.getSubDetailSequenceElement())); + if (src.hasCode()) + tgt.setCode(convertCodeableConcept(src.getCode())); + return tgt; + } + + public static org.hl7.fhir.r4.model.ClaimResponse.ErrorComponent convertErrorComponent(org.hl7.fhir.r5.model.ClaimResponse.ErrorComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.ClaimResponse.ErrorComponent tgt = new org.hl7.fhir.r4.model.ClaimResponse.ErrorComponent(); + copyElement(src, tgt); + if (src.hasItemSequence()) + tgt.setItemSequenceElement(convertPositiveInt(src.getItemSequenceElement())); + if (src.hasDetailSequence()) + tgt.setDetailSequenceElement(convertPositiveInt(src.getDetailSequenceElement())); + if (src.hasSubDetailSequence()) + tgt.setSubDetailSequenceElement(convertPositiveInt(src.getSubDetailSequenceElement())); + if (src.hasCode()) + tgt.setCode(convertCodeableConcept(src.getCode())); + return tgt; + } + + +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/ClinicalImpression.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/ClinicalImpression.java new file mode 100644 index 000000000..362a1bea6 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/ClinicalImpression.java @@ -0,0 +1,213 @@ +package org.hl7.fhir.convertors.conv40_50; + +import org.hl7.fhir.exceptions.FHIRException; + +import org.hl7.fhir.convertors.VersionConvertor_40_50; + + +/* + Copyright (c) 2011+, HL7, Inc. + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of HL7 nor the names of its contributors may be used to + endorse or promote products derived from this software without specific + prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + +*/ + +// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0 + + +public class ClinicalImpression extends VersionConvertor_40_50 { + + public static org.hl7.fhir.r5.model.ClinicalImpression convertClinicalImpression(org.hl7.fhir.r4.model.ClinicalImpression src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ClinicalImpression tgt = new org.hl7.fhir.r5.model.ClinicalImpression(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasStatus()) + tgt.setStatus(convertClinicalImpressionStatus(src.getStatus())); + if (src.hasStatusReason()) + tgt.setStatusReason(convertCodeableConcept(src.getStatusReason())); + if (src.hasCode()) + tgt.setCode(convertCodeableConcept(src.getCode())); + if (src.hasDescription()) + tgt.setDescriptionElement(convertString(src.getDescriptionElement())); + if (src.hasSubject()) + tgt.setSubject(convertReference(src.getSubject())); + if (src.hasEncounter()) + tgt.setEncounter(convertReference(src.getEncounter())); + if (src.hasEffective()) + tgt.setEffective(convertType(src.getEffective())); + if (src.hasDate()) + tgt.setDateElement(convertDateTime(src.getDateElement())); + if (src.hasAssessor()) + tgt.setAssessor(convertReference(src.getAssessor())); + if (src.hasPrevious()) + tgt.setPrevious(convertReference(src.getPrevious())); + for (org.hl7.fhir.r4.model.Reference t : src.getProblem()) + tgt.addProblem(convertReference(t)); + for (org.hl7.fhir.r4.model.ClinicalImpression.ClinicalImpressionInvestigationComponent t : src.getInvestigation()) + tgt.addInvestigation(convertClinicalImpressionInvestigationComponent(t)); + for (org.hl7.fhir.r4.model.UriType t : src.getProtocol()) + tgt.getProtocol().add(convertUri(t)); + if (src.hasSummary()) + tgt.setSummaryElement(convertString(src.getSummaryElement())); + for (org.hl7.fhir.r4.model.ClinicalImpression.ClinicalImpressionFindingComponent t : src.getFinding()) + tgt.addFinding(convertClinicalImpressionFindingComponent(t)); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getPrognosisCodeableConcept()) + tgt.addPrognosisCodeableConcept(convertCodeableConcept(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getPrognosisReference()) + tgt.addPrognosisReference(convertReference(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getSupportingInfo()) + tgt.addSupportingInfo(convertReference(t)); + for (org.hl7.fhir.r4.model.Annotation t : src.getNote()) + tgt.addNote(convertAnnotation(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.ClinicalImpression convertClinicalImpression(org.hl7.fhir.r5.model.ClinicalImpression src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.ClinicalImpression tgt = new org.hl7.fhir.r4.model.ClinicalImpression(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasStatus()) + tgt.setStatus(convertClinicalImpressionStatus(src.getStatus())); + if (src.hasStatusReason()) + tgt.setStatusReason(convertCodeableConcept(src.getStatusReason())); + if (src.hasCode()) + tgt.setCode(convertCodeableConcept(src.getCode())); + if (src.hasDescription()) + tgt.setDescriptionElement(convertString(src.getDescriptionElement())); + if (src.hasSubject()) + tgt.setSubject(convertReference(src.getSubject())); + if (src.hasEncounter()) + tgt.setEncounter(convertReference(src.getEncounter())); + if (src.hasEffective()) + tgt.setEffective(convertType(src.getEffective())); + if (src.hasDate()) + tgt.setDateElement(convertDateTime(src.getDateElement())); + if (src.hasAssessor()) + tgt.setAssessor(convertReference(src.getAssessor())); + if (src.hasPrevious()) + tgt.setPrevious(convertReference(src.getPrevious())); + for (org.hl7.fhir.r5.model.Reference t : src.getProblem()) + tgt.addProblem(convertReference(t)); + for (org.hl7.fhir.r5.model.ClinicalImpression.ClinicalImpressionInvestigationComponent t : src.getInvestigation()) + tgt.addInvestigation(convertClinicalImpressionInvestigationComponent(t)); + for (org.hl7.fhir.r5.model.UriType t : src.getProtocol()) + tgt.getProtocol().add(convertUri(t)); + if (src.hasSummary()) + tgt.setSummaryElement(convertString(src.getSummaryElement())); + for (org.hl7.fhir.r5.model.ClinicalImpression.ClinicalImpressionFindingComponent t : src.getFinding()) + tgt.addFinding(convertClinicalImpressionFindingComponent(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getPrognosisCodeableConcept()) + tgt.addPrognosisCodeableConcept(convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getPrognosisReference()) + tgt.addPrognosisReference(convertReference(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getSupportingInfo()) + tgt.addSupportingInfo(convertReference(t)); + for (org.hl7.fhir.r5.model.Annotation t : src.getNote()) + tgt.addNote(convertAnnotation(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.ClinicalImpression.ClinicalImpressionStatus convertClinicalImpressionStatus(org.hl7.fhir.r4.model.ClinicalImpression.ClinicalImpressionStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case INPROGRESS: return org.hl7.fhir.r5.model.ClinicalImpression.ClinicalImpressionStatus.INPROGRESS; + case COMPLETED: return org.hl7.fhir.r5.model.ClinicalImpression.ClinicalImpressionStatus.COMPLETED; + case ENTEREDINERROR: return org.hl7.fhir.r5.model.ClinicalImpression.ClinicalImpressionStatus.ENTEREDINERROR; + default: return org.hl7.fhir.r5.model.ClinicalImpression.ClinicalImpressionStatus.NULL; + } +} + + public static org.hl7.fhir.r4.model.ClinicalImpression.ClinicalImpressionStatus convertClinicalImpressionStatus(org.hl7.fhir.r5.model.ClinicalImpression.ClinicalImpressionStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case INPROGRESS: return org.hl7.fhir.r4.model.ClinicalImpression.ClinicalImpressionStatus.INPROGRESS; + case COMPLETED: return org.hl7.fhir.r4.model.ClinicalImpression.ClinicalImpressionStatus.COMPLETED; + case ENTEREDINERROR: return org.hl7.fhir.r4.model.ClinicalImpression.ClinicalImpressionStatus.ENTEREDINERROR; + default: return org.hl7.fhir.r4.model.ClinicalImpression.ClinicalImpressionStatus.NULL; + } +} + + public static org.hl7.fhir.r5.model.ClinicalImpression.ClinicalImpressionInvestigationComponent convertClinicalImpressionInvestigationComponent(org.hl7.fhir.r4.model.ClinicalImpression.ClinicalImpressionInvestigationComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ClinicalImpression.ClinicalImpressionInvestigationComponent tgt = new org.hl7.fhir.r5.model.ClinicalImpression.ClinicalImpressionInvestigationComponent(); + copyElement(src, tgt); + if (src.hasCode()) + tgt.setCode(convertCodeableConcept(src.getCode())); + for (org.hl7.fhir.r4.model.Reference t : src.getItem()) + tgt.addItem(convertReference(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.ClinicalImpression.ClinicalImpressionInvestigationComponent convertClinicalImpressionInvestigationComponent(org.hl7.fhir.r5.model.ClinicalImpression.ClinicalImpressionInvestigationComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.ClinicalImpression.ClinicalImpressionInvestigationComponent tgt = new org.hl7.fhir.r4.model.ClinicalImpression.ClinicalImpressionInvestigationComponent(); + copyElement(src, tgt); + if (src.hasCode()) + tgt.setCode(convertCodeableConcept(src.getCode())); + for (org.hl7.fhir.r5.model.Reference t : src.getItem()) + tgt.addItem(convertReference(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.ClinicalImpression.ClinicalImpressionFindingComponent convertClinicalImpressionFindingComponent(org.hl7.fhir.r4.model.ClinicalImpression.ClinicalImpressionFindingComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ClinicalImpression.ClinicalImpressionFindingComponent tgt = new org.hl7.fhir.r5.model.ClinicalImpression.ClinicalImpressionFindingComponent(); + copyElement(src, tgt); + if (src.hasItemCodeableConcept()) + tgt.setItemCodeableConcept(convertCodeableConcept(src.getItemCodeableConcept())); + if (src.hasItemReference()) + tgt.setItemReference(convertReference(src.getItemReference())); + if (src.hasBasis()) + tgt.setBasisElement(convertString(src.getBasisElement())); + return tgt; + } + + public static org.hl7.fhir.r4.model.ClinicalImpression.ClinicalImpressionFindingComponent convertClinicalImpressionFindingComponent(org.hl7.fhir.r5.model.ClinicalImpression.ClinicalImpressionFindingComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.ClinicalImpression.ClinicalImpressionFindingComponent tgt = new org.hl7.fhir.r4.model.ClinicalImpression.ClinicalImpressionFindingComponent(); + copyElement(src, tgt); + if (src.hasItemCodeableConcept()) + tgt.setItemCodeableConcept(convertCodeableConcept(src.getItemCodeableConcept())); + if (src.hasItemReference()) + tgt.setItemReference(convertReference(src.getItemReference())); + if (src.hasBasis()) + tgt.setBasisElement(convertString(src.getBasisElement())); + return tgt; + } + + +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/CodeSystem.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/CodeSystem.java new file mode 100644 index 000000000..4011af10d --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/CodeSystem.java @@ -0,0 +1,433 @@ +package org.hl7.fhir.convertors.conv40_50; + +import org.hl7.fhir.exceptions.FHIRException; + +import org.hl7.fhir.convertors.VersionConvertor_40_50; + + +/* + Copyright (c) 2011+, HL7, Inc. + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of HL7 nor the names of its contributors may be used to + endorse or promote products derived from this software without specific + prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + +*/ + +// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0 + + +public class CodeSystem extends VersionConvertor_40_50 { + + public static org.hl7.fhir.r5.model.CodeSystem convertCodeSystem(org.hl7.fhir.r4.model.CodeSystem src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.CodeSystem tgt = new org.hl7.fhir.r5.model.CodeSystem(); + copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrlElement(convertUri(src.getUrlElement())); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasVersion()) + tgt.setVersionElement(convertString(src.getVersionElement())); + if (src.hasName()) + tgt.setNameElement(convertString(src.getNameElement())); + if (src.hasTitle()) + tgt.setTitleElement(convertString(src.getTitleElement())); + if (src.hasStatus()) + tgt.setStatus(Enumerations.convertPublicationStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimentalElement(convertBoolean(src.getExperimentalElement())); + if (src.hasDate()) + tgt.setDateElement(convertDateTime(src.getDateElement())); + if (src.hasPublisher()) + tgt.setPublisherElement(convertString(src.getPublisherElement())); + for (org.hl7.fhir.r4.model.ContactDetail t : src.getContact()) + tgt.addContact(convertContactDetail(t)); + if (src.hasDescription()) + tgt.setDescriptionElement(convertMarkdown(src.getDescriptionElement())); + for (org.hl7.fhir.r4.model.UsageContext t : src.getUseContext()) + tgt.addUseContext(convertUsageContext(t)); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getJurisdiction()) + tgt.addJurisdiction(convertCodeableConcept(t)); + if (src.hasPurpose()) + tgt.setPurposeElement(convertMarkdown(src.getPurposeElement())); + if (src.hasCopyright()) + tgt.setCopyrightElement(convertMarkdown(src.getCopyrightElement())); + if (src.hasCaseSensitive()) + tgt.setCaseSensitiveElement(convertBoolean(src.getCaseSensitiveElement())); + if (src.hasValueSet()) + tgt.setValueSetElement(convertCanonical(src.getValueSetElement())); + if (src.hasHierarchyMeaning()) + tgt.setHierarchyMeaning(convertCodeSystemHierarchyMeaning(src.getHierarchyMeaning())); + if (src.hasCompositional()) + tgt.setCompositionalElement(convertBoolean(src.getCompositionalElement())); + if (src.hasVersionNeeded()) + tgt.setVersionNeededElement(convertBoolean(src.getVersionNeededElement())); + if (src.hasContent()) + tgt.setContent(convertCodeSystemContentMode(src.getContent())); + if (src.hasSupplements()) + tgt.setSupplementsElement(convertCanonical(src.getSupplementsElement())); + if (src.hasCount()) + tgt.setCountElement(convertUnsignedInt(src.getCountElement())); + for (org.hl7.fhir.r4.model.CodeSystem.CodeSystemFilterComponent t : src.getFilter()) + tgt.addFilter(convertCodeSystemFilterComponent(t)); + for (org.hl7.fhir.r4.model.CodeSystem.PropertyComponent t : src.getProperty()) + tgt.addProperty(convertPropertyComponent(t)); + for (org.hl7.fhir.r4.model.CodeSystem.ConceptDefinitionComponent t : src.getConcept()) + tgt.addConcept(convertConceptDefinitionComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.CodeSystem convertCodeSystem(org.hl7.fhir.r5.model.CodeSystem src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.CodeSystem tgt = new org.hl7.fhir.r4.model.CodeSystem(); + copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrlElement(convertUri(src.getUrlElement())); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasVersion()) + tgt.setVersionElement(convertString(src.getVersionElement())); + if (src.hasName()) + tgt.setNameElement(convertString(src.getNameElement())); + if (src.hasTitle()) + tgt.setTitleElement(convertString(src.getTitleElement())); + if (src.hasStatus()) + tgt.setStatus(Enumerations.convertPublicationStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimentalElement(convertBoolean(src.getExperimentalElement())); + if (src.hasDate()) + tgt.setDateElement(convertDateTime(src.getDateElement())); + if (src.hasPublisher()) + tgt.setPublisherElement(convertString(src.getPublisherElement())); + for (org.hl7.fhir.r5.model.ContactDetail t : src.getContact()) + tgt.addContact(convertContactDetail(t)); + if (src.hasDescription()) + tgt.setDescriptionElement(convertMarkdown(src.getDescriptionElement())); + for (org.hl7.fhir.r5.model.UsageContext t : src.getUseContext()) + tgt.addUseContext(convertUsageContext(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getJurisdiction()) + tgt.addJurisdiction(convertCodeableConcept(t)); + if (src.hasPurpose()) + tgt.setPurposeElement(convertMarkdown(src.getPurposeElement())); + if (src.hasCopyright()) + tgt.setCopyrightElement(convertMarkdown(src.getCopyrightElement())); + if (src.hasCaseSensitive()) + tgt.setCaseSensitiveElement(convertBoolean(src.getCaseSensitiveElement())); + if (src.hasValueSet()) + tgt.setValueSetElement(convertCanonical(src.getValueSetElement())); + if (src.hasHierarchyMeaning()) + tgt.setHierarchyMeaning(convertCodeSystemHierarchyMeaning(src.getHierarchyMeaning())); + if (src.hasCompositional()) + tgt.setCompositionalElement(convertBoolean(src.getCompositionalElement())); + if (src.hasVersionNeeded()) + tgt.setVersionNeededElement(convertBoolean(src.getVersionNeededElement())); + if (src.hasContent()) + tgt.setContent(convertCodeSystemContentMode(src.getContent())); + if (src.hasSupplements()) + tgt.setSupplementsElement(convertCanonical(src.getSupplementsElement())); + if (src.hasCount()) + tgt.setCountElement(convertUnsignedInt(src.getCountElement())); + for (org.hl7.fhir.r5.model.CodeSystem.CodeSystemFilterComponent t : src.getFilter()) + tgt.addFilter(convertCodeSystemFilterComponent(t)); + for (org.hl7.fhir.r5.model.CodeSystem.PropertyComponent t : src.getProperty()) + tgt.addProperty(convertPropertyComponent(t)); + for (org.hl7.fhir.r5.model.CodeSystem.ConceptDefinitionComponent t : src.getConcept()) + tgt.addConcept(convertConceptDefinitionComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.CodeSystem.CodeSystemHierarchyMeaning convertCodeSystemHierarchyMeaning(org.hl7.fhir.r4.model.CodeSystem.CodeSystemHierarchyMeaning src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case GROUPEDBY: return org.hl7.fhir.r5.model.CodeSystem.CodeSystemHierarchyMeaning.GROUPEDBY; + case ISA: return org.hl7.fhir.r5.model.CodeSystem.CodeSystemHierarchyMeaning.ISA; + case PARTOF: return org.hl7.fhir.r5.model.CodeSystem.CodeSystemHierarchyMeaning.PARTOF; + case CLASSIFIEDWITH: return org.hl7.fhir.r5.model.CodeSystem.CodeSystemHierarchyMeaning.CLASSIFIEDWITH; + default: return org.hl7.fhir.r5.model.CodeSystem.CodeSystemHierarchyMeaning.NULL; + } +} + + public static org.hl7.fhir.r4.model.CodeSystem.CodeSystemHierarchyMeaning convertCodeSystemHierarchyMeaning(org.hl7.fhir.r5.model.CodeSystem.CodeSystemHierarchyMeaning src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case GROUPEDBY: return org.hl7.fhir.r4.model.CodeSystem.CodeSystemHierarchyMeaning.GROUPEDBY; + case ISA: return org.hl7.fhir.r4.model.CodeSystem.CodeSystemHierarchyMeaning.ISA; + case PARTOF: return org.hl7.fhir.r4.model.CodeSystem.CodeSystemHierarchyMeaning.PARTOF; + case CLASSIFIEDWITH: return org.hl7.fhir.r4.model.CodeSystem.CodeSystemHierarchyMeaning.CLASSIFIEDWITH; + default: return org.hl7.fhir.r4.model.CodeSystem.CodeSystemHierarchyMeaning.NULL; + } +} + + public static org.hl7.fhir.r5.model.CodeSystem.CodeSystemContentMode convertCodeSystemContentMode(org.hl7.fhir.r4.model.CodeSystem.CodeSystemContentMode src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case NOTPRESENT: return org.hl7.fhir.r5.model.CodeSystem.CodeSystemContentMode.NOTPRESENT; + case EXAMPLE: return org.hl7.fhir.r5.model.CodeSystem.CodeSystemContentMode.EXAMPLE; + case FRAGMENT: return org.hl7.fhir.r5.model.CodeSystem.CodeSystemContentMode.FRAGMENT; + case COMPLETE: return org.hl7.fhir.r5.model.CodeSystem.CodeSystemContentMode.COMPLETE; + case SUPPLEMENT: return org.hl7.fhir.r5.model.CodeSystem.CodeSystemContentMode.SUPPLEMENT; + default: return org.hl7.fhir.r5.model.CodeSystem.CodeSystemContentMode.NULL; + } +} + + public static org.hl7.fhir.r4.model.CodeSystem.CodeSystemContentMode convertCodeSystemContentMode(org.hl7.fhir.r5.model.CodeSystem.CodeSystemContentMode src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case NOTPRESENT: return org.hl7.fhir.r4.model.CodeSystem.CodeSystemContentMode.NOTPRESENT; + case EXAMPLE: return org.hl7.fhir.r4.model.CodeSystem.CodeSystemContentMode.EXAMPLE; + case FRAGMENT: return org.hl7.fhir.r4.model.CodeSystem.CodeSystemContentMode.FRAGMENT; + case COMPLETE: return org.hl7.fhir.r4.model.CodeSystem.CodeSystemContentMode.COMPLETE; + case SUPPLEMENT: return org.hl7.fhir.r4.model.CodeSystem.CodeSystemContentMode.SUPPLEMENT; + default: return org.hl7.fhir.r4.model.CodeSystem.CodeSystemContentMode.NULL; + } +} + + public static org.hl7.fhir.r5.model.CodeSystem.CodeSystemFilterComponent convertCodeSystemFilterComponent(org.hl7.fhir.r4.model.CodeSystem.CodeSystemFilterComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.CodeSystem.CodeSystemFilterComponent tgt = new org.hl7.fhir.r5.model.CodeSystem.CodeSystemFilterComponent(); + copyElement(src, tgt); + if (src.hasCode()) + tgt.setCodeElement(convertCode(src.getCodeElement())); + if (src.hasDescription()) + tgt.setDescriptionElement(convertString(src.getDescriptionElement())); + for (org.hl7.fhir.r4.model.Enumeration t : src.getOperator()) + tgt.addOperator(convertFilterOperator(t.getValue())); + if (src.hasValue()) + tgt.setValueElement(convertString(src.getValueElement())); + return tgt; + } + + public static org.hl7.fhir.r4.model.CodeSystem.CodeSystemFilterComponent convertCodeSystemFilterComponent(org.hl7.fhir.r5.model.CodeSystem.CodeSystemFilterComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.CodeSystem.CodeSystemFilterComponent tgt = new org.hl7.fhir.r4.model.CodeSystem.CodeSystemFilterComponent(); + copyElement(src, tgt); + if (src.hasCode()) + tgt.setCodeElement(convertCode(src.getCodeElement())); + if (src.hasDescription()) + tgt.setDescriptionElement(convertString(src.getDescriptionElement())); + for (org.hl7.fhir.r5.model.Enumeration t : src.getOperator()) + tgt.addOperator(convertFilterOperator(t.getValue())); + if (src.hasValue()) + tgt.setValueElement(convertString(src.getValueElement())); + return tgt; + } + + public static org.hl7.fhir.r5.model.CodeSystem.FilterOperator convertFilterOperator(org.hl7.fhir.r4.model.CodeSystem.FilterOperator src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case EQUAL: return org.hl7.fhir.r5.model.CodeSystem.FilterOperator.EQUAL; + case ISA: return org.hl7.fhir.r5.model.CodeSystem.FilterOperator.ISA; + case DESCENDENTOF: return org.hl7.fhir.r5.model.CodeSystem.FilterOperator.DESCENDENTOF; + case ISNOTA: return org.hl7.fhir.r5.model.CodeSystem.FilterOperator.ISNOTA; + case REGEX: return org.hl7.fhir.r5.model.CodeSystem.FilterOperator.REGEX; + case IN: return org.hl7.fhir.r5.model.CodeSystem.FilterOperator.IN; + case NOTIN: return org.hl7.fhir.r5.model.CodeSystem.FilterOperator.NOTIN; + case GENERALIZES: return org.hl7.fhir.r5.model.CodeSystem.FilterOperator.GENERALIZES; + case EXISTS: return org.hl7.fhir.r5.model.CodeSystem.FilterOperator.EXISTS; + default: return org.hl7.fhir.r5.model.CodeSystem.FilterOperator.NULL; + } +} + + public static org.hl7.fhir.r4.model.CodeSystem.FilterOperator convertFilterOperator(org.hl7.fhir.r5.model.CodeSystem.FilterOperator src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case EQUAL: return org.hl7.fhir.r4.model.CodeSystem.FilterOperator.EQUAL; + case ISA: return org.hl7.fhir.r4.model.CodeSystem.FilterOperator.ISA; + case DESCENDENTOF: return org.hl7.fhir.r4.model.CodeSystem.FilterOperator.DESCENDENTOF; + case ISNOTA: return org.hl7.fhir.r4.model.CodeSystem.FilterOperator.ISNOTA; + case REGEX: return org.hl7.fhir.r4.model.CodeSystem.FilterOperator.REGEX; + case IN: return org.hl7.fhir.r4.model.CodeSystem.FilterOperator.IN; + case NOTIN: return org.hl7.fhir.r4.model.CodeSystem.FilterOperator.NOTIN; + case GENERALIZES: return org.hl7.fhir.r4.model.CodeSystem.FilterOperator.GENERALIZES; + case EXISTS: return org.hl7.fhir.r4.model.CodeSystem.FilterOperator.EXISTS; + default: return org.hl7.fhir.r4.model.CodeSystem.FilterOperator.NULL; + } +} + + public static org.hl7.fhir.r5.model.CodeSystem.PropertyComponent convertPropertyComponent(org.hl7.fhir.r4.model.CodeSystem.PropertyComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.CodeSystem.PropertyComponent tgt = new org.hl7.fhir.r5.model.CodeSystem.PropertyComponent(); + copyElement(src, tgt); + if (src.hasCode()) + tgt.setCodeElement(convertCode(src.getCodeElement())); + if (src.hasUri()) + tgt.setUriElement(convertUri(src.getUriElement())); + if (src.hasDescription()) + tgt.setDescriptionElement(convertString(src.getDescriptionElement())); + if (src.hasType()) + tgt.setType(convertPropertyType(src.getType())); + return tgt; + } + + public static org.hl7.fhir.r4.model.CodeSystem.PropertyComponent convertPropertyComponent(org.hl7.fhir.r5.model.CodeSystem.PropertyComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.CodeSystem.PropertyComponent tgt = new org.hl7.fhir.r4.model.CodeSystem.PropertyComponent(); + copyElement(src, tgt); + if (src.hasCode()) + tgt.setCodeElement(convertCode(src.getCodeElement())); + if (src.hasUri()) + tgt.setUriElement(convertUri(src.getUriElement())); + if (src.hasDescription()) + tgt.setDescriptionElement(convertString(src.getDescriptionElement())); + if (src.hasType()) + tgt.setType(convertPropertyType(src.getType())); + return tgt; + } + + public static org.hl7.fhir.r5.model.CodeSystem.PropertyType convertPropertyType(org.hl7.fhir.r4.model.CodeSystem.PropertyType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case CODE: return org.hl7.fhir.r5.model.CodeSystem.PropertyType.CODE; + case CODING: return org.hl7.fhir.r5.model.CodeSystem.PropertyType.CODING; + case STRING: return org.hl7.fhir.r5.model.CodeSystem.PropertyType.STRING; + case INTEGER: return org.hl7.fhir.r5.model.CodeSystem.PropertyType.INTEGER; + case BOOLEAN: return org.hl7.fhir.r5.model.CodeSystem.PropertyType.BOOLEAN; + case DATETIME: return org.hl7.fhir.r5.model.CodeSystem.PropertyType.DATETIME; + case DECIMAL: return org.hl7.fhir.r5.model.CodeSystem.PropertyType.DECIMAL; + default: return org.hl7.fhir.r5.model.CodeSystem.PropertyType.NULL; + } +} + + public static org.hl7.fhir.r4.model.CodeSystem.PropertyType convertPropertyType(org.hl7.fhir.r5.model.CodeSystem.PropertyType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case CODE: return org.hl7.fhir.r4.model.CodeSystem.PropertyType.CODE; + case CODING: return org.hl7.fhir.r4.model.CodeSystem.PropertyType.CODING; + case STRING: return org.hl7.fhir.r4.model.CodeSystem.PropertyType.STRING; + case INTEGER: return org.hl7.fhir.r4.model.CodeSystem.PropertyType.INTEGER; + case BOOLEAN: return org.hl7.fhir.r4.model.CodeSystem.PropertyType.BOOLEAN; + case DATETIME: return org.hl7.fhir.r4.model.CodeSystem.PropertyType.DATETIME; + case DECIMAL: return org.hl7.fhir.r4.model.CodeSystem.PropertyType.DECIMAL; + default: return org.hl7.fhir.r4.model.CodeSystem.PropertyType.NULL; + } +} + + public static org.hl7.fhir.r5.model.CodeSystem.ConceptDefinitionComponent convertConceptDefinitionComponent(org.hl7.fhir.r4.model.CodeSystem.ConceptDefinitionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.CodeSystem.ConceptDefinitionComponent tgt = new org.hl7.fhir.r5.model.CodeSystem.ConceptDefinitionComponent(); + copyElement(src, tgt); + if (src.hasCode()) + tgt.setCodeElement(convertCode(src.getCodeElement())); + if (src.hasDisplay()) + tgt.setDisplayElement(convertString(src.getDisplayElement())); + if (src.hasDefinition()) + tgt.setDefinitionElement(convertString(src.getDefinitionElement())); + for (org.hl7.fhir.r4.model.CodeSystem.ConceptDefinitionDesignationComponent t : src.getDesignation()) + tgt.addDesignation(convertConceptDefinitionDesignationComponent(t)); + for (org.hl7.fhir.r4.model.CodeSystem.ConceptPropertyComponent t : src.getProperty()) + tgt.addProperty(convertConceptPropertyComponent(t)); + for (org.hl7.fhir.r4.model.CodeSystem.ConceptDefinitionComponent t : src.getConcept()) + tgt.addConcept(convertConceptDefinitionComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.CodeSystem.ConceptDefinitionComponent convertConceptDefinitionComponent(org.hl7.fhir.r5.model.CodeSystem.ConceptDefinitionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.CodeSystem.ConceptDefinitionComponent tgt = new org.hl7.fhir.r4.model.CodeSystem.ConceptDefinitionComponent(); + copyElement(src, tgt); + if (src.hasCode()) + tgt.setCodeElement(convertCode(src.getCodeElement())); + if (src.hasDisplay()) + tgt.setDisplayElement(convertString(src.getDisplayElement())); + if (src.hasDefinition()) + tgt.setDefinitionElement(convertString(src.getDefinitionElement())); + for (org.hl7.fhir.r5.model.CodeSystem.ConceptDefinitionDesignationComponent t : src.getDesignation()) + tgt.addDesignation(convertConceptDefinitionDesignationComponent(t)); + for (org.hl7.fhir.r5.model.CodeSystem.ConceptPropertyComponent t : src.getProperty()) + tgt.addProperty(convertConceptPropertyComponent(t)); + for (org.hl7.fhir.r5.model.CodeSystem.ConceptDefinitionComponent t : src.getConcept()) + tgt.addConcept(convertConceptDefinitionComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.CodeSystem.ConceptDefinitionDesignationComponent convertConceptDefinitionDesignationComponent(org.hl7.fhir.r4.model.CodeSystem.ConceptDefinitionDesignationComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.CodeSystem.ConceptDefinitionDesignationComponent tgt = new org.hl7.fhir.r5.model.CodeSystem.ConceptDefinitionDesignationComponent(); + copyElement(src, tgt); + if (src.hasLanguage()) + tgt.setLanguageElement(convertCode(src.getLanguageElement())); + if (src.hasUse()) + tgt.setUse(convertCoding(src.getUse())); + if (src.hasValue()) + tgt.setValueElement(convertString(src.getValueElement())); + return tgt; + } + + public static org.hl7.fhir.r4.model.CodeSystem.ConceptDefinitionDesignationComponent convertConceptDefinitionDesignationComponent(org.hl7.fhir.r5.model.CodeSystem.ConceptDefinitionDesignationComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.CodeSystem.ConceptDefinitionDesignationComponent tgt = new org.hl7.fhir.r4.model.CodeSystem.ConceptDefinitionDesignationComponent(); + copyElement(src, tgt); + if (src.hasLanguage()) + tgt.setLanguageElement(convertCode(src.getLanguageElement())); + if (src.hasUse()) + tgt.setUse(convertCoding(src.getUse())); + if (src.hasValue()) + tgt.setValueElement(convertString(src.getValueElement())); + return tgt; + } + + public static org.hl7.fhir.r5.model.CodeSystem.ConceptPropertyComponent convertConceptPropertyComponent(org.hl7.fhir.r4.model.CodeSystem.ConceptPropertyComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.CodeSystem.ConceptPropertyComponent tgt = new org.hl7.fhir.r5.model.CodeSystem.ConceptPropertyComponent(); + copyElement(src, tgt); + if (src.hasCode()) + tgt.setCodeElement(convertCode(src.getCodeElement())); + if (src.hasValue()) + tgt.setValue(convertType(src.getValue())); + return tgt; + } + + public static org.hl7.fhir.r4.model.CodeSystem.ConceptPropertyComponent convertConceptPropertyComponent(org.hl7.fhir.r5.model.CodeSystem.ConceptPropertyComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.CodeSystem.ConceptPropertyComponent tgt = new org.hl7.fhir.r4.model.CodeSystem.ConceptPropertyComponent(); + copyElement(src, tgt); + if (src.hasCode()) + tgt.setCodeElement(convertCode(src.getCodeElement())); + if (src.hasValue()) + tgt.setValue(convertType(src.getValue())); + return tgt; + } + + +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Communication.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Communication.java new file mode 100644 index 000000000..4efe82a6f --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Communication.java @@ -0,0 +1,227 @@ +package org.hl7.fhir.convertors.conv40_50; + +import org.hl7.fhir.exceptions.FHIRException; + +import org.hl7.fhir.convertors.VersionConvertor_40_50; + + +/* + Copyright (c) 2011+, HL7, Inc. + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of HL7 nor the names of its contributors may be used to + endorse or promote products derived from this software without specific + prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + +*/ + +// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0 + + +public class Communication extends VersionConvertor_40_50 { + + public static org.hl7.fhir.r5.model.Communication convertCommunication(org.hl7.fhir.r4.model.Communication src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Communication tgt = new org.hl7.fhir.r5.model.Communication(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + for (org.hl7.fhir.r4.model.CanonicalType t : src.getInstantiatesCanonical()) + tgt.getInstantiatesCanonical().add(convertCanonical(t)); + for (org.hl7.fhir.r4.model.UriType t : src.getInstantiatesUri()) + tgt.getInstantiatesUri().add(convertUri(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getBasedOn()) + tgt.addBasedOn(convertReference(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getPartOf()) + tgt.addPartOf(convertReference(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getInResponseTo()) + tgt.addInResponseTo(convertReference(t)); + if (src.hasStatus()) + tgt.setStatus(convertCommunicationStatus(src.getStatus())); + if (src.hasStatusReason()) + tgt.setStatusReason(convertCodeableConcept(src.getStatusReason())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getCategory()) + tgt.addCategory(convertCodeableConcept(t)); + if (src.hasPriority()) + tgt.setPriority(convertCommunicationPriority(src.getPriority())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getMedium()) + tgt.addMedium(convertCodeableConcept(t)); + if (src.hasSubject()) + tgt.setSubject(convertReference(src.getSubject())); + if (src.hasTopic()) + tgt.setTopic(convertCodeableConcept(src.getTopic())); + for (org.hl7.fhir.r4.model.Reference t : src.getAbout()) + tgt.addAbout(convertReference(t)); + if (src.hasEncounter()) + tgt.setEncounter(convertReference(src.getEncounter())); + if (src.hasSent()) + tgt.setSentElement(convertDateTime(src.getSentElement())); + if (src.hasReceived()) + tgt.setReceivedElement(convertDateTime(src.getReceivedElement())); + for (org.hl7.fhir.r4.model.Reference t : src.getRecipient()) + tgt.addRecipient(convertReference(t)); + if (src.hasSender()) + tgt.setSender(convertReference(src.getSender())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getReasonCode()) + tgt.addReasonCode(convertCodeableConcept(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getReasonReference()) + tgt.addReasonReference(convertReference(t)); + for (org.hl7.fhir.r4.model.Communication.CommunicationPayloadComponent t : src.getPayload()) + tgt.addPayload(convertCommunicationPayloadComponent(t)); + for (org.hl7.fhir.r4.model.Annotation t : src.getNote()) + tgt.addNote(convertAnnotation(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.Communication convertCommunication(org.hl7.fhir.r5.model.Communication src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Communication tgt = new org.hl7.fhir.r4.model.Communication(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + for (org.hl7.fhir.r5.model.CanonicalType t : src.getInstantiatesCanonical()) + tgt.getInstantiatesCanonical().add(convertCanonical(t)); + for (org.hl7.fhir.r5.model.UriType t : src.getInstantiatesUri()) + tgt.getInstantiatesUri().add(convertUri(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getBasedOn()) + tgt.addBasedOn(convertReference(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getPartOf()) + tgt.addPartOf(convertReference(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getInResponseTo()) + tgt.addInResponseTo(convertReference(t)); + if (src.hasStatus()) + tgt.setStatus(convertCommunicationStatus(src.getStatus())); + if (src.hasStatusReason()) + tgt.setStatusReason(convertCodeableConcept(src.getStatusReason())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getCategory()) + tgt.addCategory(convertCodeableConcept(t)); + if (src.hasPriority()) + tgt.setPriority(convertCommunicationPriority(src.getPriority())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getMedium()) + tgt.addMedium(convertCodeableConcept(t)); + if (src.hasSubject()) + tgt.setSubject(convertReference(src.getSubject())); + if (src.hasTopic()) + tgt.setTopic(convertCodeableConcept(src.getTopic())); + for (org.hl7.fhir.r5.model.Reference t : src.getAbout()) + tgt.addAbout(convertReference(t)); + if (src.hasEncounter()) + tgt.setEncounter(convertReference(src.getEncounter())); + if (src.hasSent()) + tgt.setSentElement(convertDateTime(src.getSentElement())); + if (src.hasReceived()) + tgt.setReceivedElement(convertDateTime(src.getReceivedElement())); + for (org.hl7.fhir.r5.model.Reference t : src.getRecipient()) + tgt.addRecipient(convertReference(t)); + if (src.hasSender()) + tgt.setSender(convertReference(src.getSender())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getReasonCode()) + tgt.addReasonCode(convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getReasonReference()) + tgt.addReasonReference(convertReference(t)); + for (org.hl7.fhir.r5.model.Communication.CommunicationPayloadComponent t : src.getPayload()) + tgt.addPayload(convertCommunicationPayloadComponent(t)); + for (org.hl7.fhir.r5.model.Annotation t : src.getNote()) + tgt.addNote(convertAnnotation(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.Communication.CommunicationStatus convertCommunicationStatus(org.hl7.fhir.r4.model.Communication.CommunicationStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PREPARATION: return org.hl7.fhir.r5.model.Communication.CommunicationStatus.PREPARATION; + case INPROGRESS: return org.hl7.fhir.r5.model.Communication.CommunicationStatus.INPROGRESS; + case NOTDONE: return org.hl7.fhir.r5.model.Communication.CommunicationStatus.NOTDONE; + case ONHOLD: return org.hl7.fhir.r5.model.Communication.CommunicationStatus.ONHOLD; + case STOPPED: return org.hl7.fhir.r5.model.Communication.CommunicationStatus.STOPPED; + case COMPLETED: return org.hl7.fhir.r5.model.Communication.CommunicationStatus.COMPLETED; + case ENTEREDINERROR: return org.hl7.fhir.r5.model.Communication.CommunicationStatus.ENTEREDINERROR; + case UNKNOWN: return org.hl7.fhir.r5.model.Communication.CommunicationStatus.UNKNOWN; + default: return org.hl7.fhir.r5.model.Communication.CommunicationStatus.NULL; + } +} + + public static org.hl7.fhir.r4.model.Communication.CommunicationStatus convertCommunicationStatus(org.hl7.fhir.r5.model.Communication.CommunicationStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PREPARATION: return org.hl7.fhir.r4.model.Communication.CommunicationStatus.PREPARATION; + case INPROGRESS: return org.hl7.fhir.r4.model.Communication.CommunicationStatus.INPROGRESS; + case NOTDONE: return org.hl7.fhir.r4.model.Communication.CommunicationStatus.NOTDONE; + case ONHOLD: return org.hl7.fhir.r4.model.Communication.CommunicationStatus.ONHOLD; + case STOPPED: return org.hl7.fhir.r4.model.Communication.CommunicationStatus.STOPPED; + case COMPLETED: return org.hl7.fhir.r4.model.Communication.CommunicationStatus.COMPLETED; + case ENTEREDINERROR: return org.hl7.fhir.r4.model.Communication.CommunicationStatus.ENTEREDINERROR; + case UNKNOWN: return org.hl7.fhir.r4.model.Communication.CommunicationStatus.UNKNOWN; + default: return org.hl7.fhir.r4.model.Communication.CommunicationStatus.NULL; + } +} + + public static org.hl7.fhir.r5.model.Communication.CommunicationPriority convertCommunicationPriority(org.hl7.fhir.r4.model.Communication.CommunicationPriority src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case ROUTINE: return org.hl7.fhir.r5.model.Communication.CommunicationPriority.ROUTINE; + case URGENT: return org.hl7.fhir.r5.model.Communication.CommunicationPriority.URGENT; + case ASAP: return org.hl7.fhir.r5.model.Communication.CommunicationPriority.ASAP; + case STAT: return org.hl7.fhir.r5.model.Communication.CommunicationPriority.STAT; + default: return org.hl7.fhir.r5.model.Communication.CommunicationPriority.NULL; + } +} + + public static org.hl7.fhir.r4.model.Communication.CommunicationPriority convertCommunicationPriority(org.hl7.fhir.r5.model.Communication.CommunicationPriority src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case ROUTINE: return org.hl7.fhir.r4.model.Communication.CommunicationPriority.ROUTINE; + case URGENT: return org.hl7.fhir.r4.model.Communication.CommunicationPriority.URGENT; + case ASAP: return org.hl7.fhir.r4.model.Communication.CommunicationPriority.ASAP; + case STAT: return org.hl7.fhir.r4.model.Communication.CommunicationPriority.STAT; + default: return org.hl7.fhir.r4.model.Communication.CommunicationPriority.NULL; + } +} + + public static org.hl7.fhir.r5.model.Communication.CommunicationPayloadComponent convertCommunicationPayloadComponent(org.hl7.fhir.r4.model.Communication.CommunicationPayloadComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Communication.CommunicationPayloadComponent tgt = new org.hl7.fhir.r5.model.Communication.CommunicationPayloadComponent(); + copyElement(src, tgt); + if (src.hasContent()) + tgt.setContent(convertType(src.getContent())); + return tgt; + } + + public static org.hl7.fhir.r4.model.Communication.CommunicationPayloadComponent convertCommunicationPayloadComponent(org.hl7.fhir.r5.model.Communication.CommunicationPayloadComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Communication.CommunicationPayloadComponent tgt = new org.hl7.fhir.r4.model.Communication.CommunicationPayloadComponent(); + copyElement(src, tgt); + if (src.hasContent()) + tgt.setContent(convertType(src.getContent())); + return tgt; + } + + +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/CommunicationRequest.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/CommunicationRequest.java new file mode 100644 index 000000000..9d3e961d4 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/CommunicationRequest.java @@ -0,0 +1,221 @@ +package org.hl7.fhir.convertors.conv40_50; + +import org.hl7.fhir.exceptions.FHIRException; + +import org.hl7.fhir.convertors.VersionConvertor_40_50; + + +/* + Copyright (c) 2011+, HL7, Inc. + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of HL7 nor the names of its contributors may be used to + endorse or promote products derived from this software without specific + prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + +*/ + +// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0 + + +public class CommunicationRequest extends VersionConvertor_40_50 { + + public static org.hl7.fhir.r5.model.CommunicationRequest convertCommunicationRequest(org.hl7.fhir.r4.model.CommunicationRequest src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.CommunicationRequest tgt = new org.hl7.fhir.r5.model.CommunicationRequest(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getBasedOn()) + tgt.addBasedOn(convertReference(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getReplaces()) + tgt.addReplaces(convertReference(t)); + if (src.hasGroupIdentifier()) + tgt.setGroupIdentifier(convertIdentifier(src.getGroupIdentifier())); + if (src.hasStatus()) + tgt.setStatus(convertCommunicationRequestStatus(src.getStatus())); + if (src.hasStatusReason()) + tgt.setStatusReason(convertCodeableConcept(src.getStatusReason())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getCategory()) + tgt.addCategory(convertCodeableConcept(t)); + if (src.hasPriority()) + tgt.setPriority(convertCommunicationPriority(src.getPriority())); + if (src.hasDoNotPerform()) + tgt.setDoNotPerformElement(convertBoolean(src.getDoNotPerformElement())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getMedium()) + tgt.addMedium(convertCodeableConcept(t)); + if (src.hasSubject()) + tgt.setSubject(convertReference(src.getSubject())); + for (org.hl7.fhir.r4.model.Reference t : src.getAbout()) + tgt.addAbout(convertReference(t)); + if (src.hasEncounter()) + tgt.setEncounter(convertReference(src.getEncounter())); + for (org.hl7.fhir.r4.model.CommunicationRequest.CommunicationRequestPayloadComponent t : src.getPayload()) + tgt.addPayload(convertCommunicationRequestPayloadComponent(t)); + if (src.hasOccurrence()) + tgt.setOccurrence(convertType(src.getOccurrence())); + if (src.hasAuthoredOn()) + tgt.setAuthoredOnElement(convertDateTime(src.getAuthoredOnElement())); + if (src.hasRequester()) + tgt.setRequester(convertReference(src.getRequester())); + for (org.hl7.fhir.r4.model.Reference t : src.getRecipient()) + tgt.addRecipient(convertReference(t)); + if (src.hasSender()) + tgt.setSender(convertReference(src.getSender())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getReasonCode()) + tgt.addReasonCode(convertCodeableConcept(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getReasonReference()) + tgt.addReasonReference(convertReference(t)); + for (org.hl7.fhir.r4.model.Annotation t : src.getNote()) + tgt.addNote(convertAnnotation(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.CommunicationRequest convertCommunicationRequest(org.hl7.fhir.r5.model.CommunicationRequest src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.CommunicationRequest tgt = new org.hl7.fhir.r4.model.CommunicationRequest(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getBasedOn()) + tgt.addBasedOn(convertReference(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getReplaces()) + tgt.addReplaces(convertReference(t)); + if (src.hasGroupIdentifier()) + tgt.setGroupIdentifier(convertIdentifier(src.getGroupIdentifier())); + if (src.hasStatus()) + tgt.setStatus(convertCommunicationRequestStatus(src.getStatus())); + if (src.hasStatusReason()) + tgt.setStatusReason(convertCodeableConcept(src.getStatusReason())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getCategory()) + tgt.addCategory(convertCodeableConcept(t)); + if (src.hasPriority()) + tgt.setPriority(convertCommunicationPriority(src.getPriority())); + if (src.hasDoNotPerform()) + tgt.setDoNotPerformElement(convertBoolean(src.getDoNotPerformElement())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getMedium()) + tgt.addMedium(convertCodeableConcept(t)); + if (src.hasSubject()) + tgt.setSubject(convertReference(src.getSubject())); + for (org.hl7.fhir.r5.model.Reference t : src.getAbout()) + tgt.addAbout(convertReference(t)); + if (src.hasEncounter()) + tgt.setEncounter(convertReference(src.getEncounter())); + for (org.hl7.fhir.r5.model.CommunicationRequest.CommunicationRequestPayloadComponent t : src.getPayload()) + tgt.addPayload(convertCommunicationRequestPayloadComponent(t)); + if (src.hasOccurrence()) + tgt.setOccurrence(convertType(src.getOccurrence())); + if (src.hasAuthoredOn()) + tgt.setAuthoredOnElement(convertDateTime(src.getAuthoredOnElement())); + if (src.hasRequester()) + tgt.setRequester(convertReference(src.getRequester())); + for (org.hl7.fhir.r5.model.Reference t : src.getRecipient()) + tgt.addRecipient(convertReference(t)); + if (src.hasSender()) + tgt.setSender(convertReference(src.getSender())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getReasonCode()) + tgt.addReasonCode(convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getReasonReference()) + tgt.addReasonReference(convertReference(t)); + for (org.hl7.fhir.r5.model.Annotation t : src.getNote()) + tgt.addNote(convertAnnotation(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.CommunicationRequest.CommunicationRequestStatus convertCommunicationRequestStatus(org.hl7.fhir.r4.model.CommunicationRequest.CommunicationRequestStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case DRAFT: return org.hl7.fhir.r5.model.CommunicationRequest.CommunicationRequestStatus.DRAFT; + case ACTIVE: return org.hl7.fhir.r5.model.CommunicationRequest.CommunicationRequestStatus.ACTIVE; + case ONHOLD: return org.hl7.fhir.r5.model.CommunicationRequest.CommunicationRequestStatus.ONHOLD; + case REVOKED: return org.hl7.fhir.r5.model.CommunicationRequest.CommunicationRequestStatus.REVOKED; + case COMPLETED: return org.hl7.fhir.r5.model.CommunicationRequest.CommunicationRequestStatus.COMPLETED; + case ENTEREDINERROR: return org.hl7.fhir.r5.model.CommunicationRequest.CommunicationRequestStatus.ENTEREDINERROR; + case UNKNOWN: return org.hl7.fhir.r5.model.CommunicationRequest.CommunicationRequestStatus.UNKNOWN; + default: return org.hl7.fhir.r5.model.CommunicationRequest.CommunicationRequestStatus.NULL; + } +} + + public static org.hl7.fhir.r4.model.CommunicationRequest.CommunicationRequestStatus convertCommunicationRequestStatus(org.hl7.fhir.r5.model.CommunicationRequest.CommunicationRequestStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case DRAFT: return org.hl7.fhir.r4.model.CommunicationRequest.CommunicationRequestStatus.DRAFT; + case ACTIVE: return org.hl7.fhir.r4.model.CommunicationRequest.CommunicationRequestStatus.ACTIVE; + case ONHOLD: return org.hl7.fhir.r4.model.CommunicationRequest.CommunicationRequestStatus.ONHOLD; + case REVOKED: return org.hl7.fhir.r4.model.CommunicationRequest.CommunicationRequestStatus.REVOKED; + case COMPLETED: return org.hl7.fhir.r4.model.CommunicationRequest.CommunicationRequestStatus.COMPLETED; + case ENTEREDINERROR: return org.hl7.fhir.r4.model.CommunicationRequest.CommunicationRequestStatus.ENTEREDINERROR; + case UNKNOWN: return org.hl7.fhir.r4.model.CommunicationRequest.CommunicationRequestStatus.UNKNOWN; + default: return org.hl7.fhir.r4.model.CommunicationRequest.CommunicationRequestStatus.NULL; + } +} + + public static org.hl7.fhir.r5.model.CommunicationRequest.CommunicationPriority convertCommunicationPriority(org.hl7.fhir.r4.model.CommunicationRequest.CommunicationPriority src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case ROUTINE: return org.hl7.fhir.r5.model.CommunicationRequest.CommunicationPriority.ROUTINE; + case URGENT: return org.hl7.fhir.r5.model.CommunicationRequest.CommunicationPriority.URGENT; + case ASAP: return org.hl7.fhir.r5.model.CommunicationRequest.CommunicationPriority.ASAP; + case STAT: return org.hl7.fhir.r5.model.CommunicationRequest.CommunicationPriority.STAT; + default: return org.hl7.fhir.r5.model.CommunicationRequest.CommunicationPriority.NULL; + } +} + + public static org.hl7.fhir.r4.model.CommunicationRequest.CommunicationPriority convertCommunicationPriority(org.hl7.fhir.r5.model.CommunicationRequest.CommunicationPriority src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case ROUTINE: return org.hl7.fhir.r4.model.CommunicationRequest.CommunicationPriority.ROUTINE; + case URGENT: return org.hl7.fhir.r4.model.CommunicationRequest.CommunicationPriority.URGENT; + case ASAP: return org.hl7.fhir.r4.model.CommunicationRequest.CommunicationPriority.ASAP; + case STAT: return org.hl7.fhir.r4.model.CommunicationRequest.CommunicationPriority.STAT; + default: return org.hl7.fhir.r4.model.CommunicationRequest.CommunicationPriority.NULL; + } +} + + public static org.hl7.fhir.r5.model.CommunicationRequest.CommunicationRequestPayloadComponent convertCommunicationRequestPayloadComponent(org.hl7.fhir.r4.model.CommunicationRequest.CommunicationRequestPayloadComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.CommunicationRequest.CommunicationRequestPayloadComponent tgt = new org.hl7.fhir.r5.model.CommunicationRequest.CommunicationRequestPayloadComponent(); + copyElement(src, tgt); + if (src.hasContent()) + tgt.setContent(convertType(src.getContent())); + return tgt; + } + + public static org.hl7.fhir.r4.model.CommunicationRequest.CommunicationRequestPayloadComponent convertCommunicationRequestPayloadComponent(org.hl7.fhir.r5.model.CommunicationRequest.CommunicationRequestPayloadComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.CommunicationRequest.CommunicationRequestPayloadComponent tgt = new org.hl7.fhir.r4.model.CommunicationRequest.CommunicationRequestPayloadComponent(); + copyElement(src, tgt); + if (src.hasContent()) + tgt.setContent(convertType(src.getContent())); + return tgt; + } + + +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/CompartmentDefinition.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/CompartmentDefinition.java new file mode 100644 index 000000000..cbf68a945 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/CompartmentDefinition.java @@ -0,0 +1,169 @@ +package org.hl7.fhir.convertors.conv40_50; + +import org.hl7.fhir.exceptions.FHIRException; + +import org.hl7.fhir.convertors.VersionConvertor_40_50; + + +/* + Copyright (c) 2011+, HL7, Inc. + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of HL7 nor the names of its contributors may be used to + endorse or promote products derived from this software without specific + prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + +*/ + +// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0 + + +public class CompartmentDefinition extends VersionConvertor_40_50 { + + public static org.hl7.fhir.r5.model.CompartmentDefinition convertCompartmentDefinition(org.hl7.fhir.r4.model.CompartmentDefinition src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.CompartmentDefinition tgt = new org.hl7.fhir.r5.model.CompartmentDefinition(); + copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrlElement(convertUri(src.getUrlElement())); + if (src.hasVersion()) + tgt.setVersionElement(convertString(src.getVersionElement())); + if (src.hasName()) + tgt.setNameElement(convertString(src.getNameElement())); + if (src.hasStatus()) + tgt.setStatus(Enumerations.convertPublicationStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimentalElement(convertBoolean(src.getExperimentalElement())); + if (src.hasDate()) + tgt.setDateElement(convertDateTime(src.getDateElement())); + if (src.hasPublisher()) + tgt.setPublisherElement(convertString(src.getPublisherElement())); + for (org.hl7.fhir.r4.model.ContactDetail t : src.getContact()) + tgt.addContact(convertContactDetail(t)); + if (src.hasDescription()) + tgt.setDescriptionElement(convertMarkdown(src.getDescriptionElement())); + for (org.hl7.fhir.r4.model.UsageContext t : src.getUseContext()) + tgt.addUseContext(convertUsageContext(t)); + if (src.hasPurpose()) + tgt.setPurposeElement(convertMarkdown(src.getPurposeElement())); + if (src.hasCode()) + tgt.setCode(convertCompartmentType(src.getCode())); + if (src.hasSearch()) + tgt.setSearchElement(convertBoolean(src.getSearchElement())); + for (org.hl7.fhir.r4.model.CompartmentDefinition.CompartmentDefinitionResourceComponent t : src.getResource()) + tgt.addResource(convertCompartmentDefinitionResourceComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.CompartmentDefinition convertCompartmentDefinition(org.hl7.fhir.r5.model.CompartmentDefinition src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.CompartmentDefinition tgt = new org.hl7.fhir.r4.model.CompartmentDefinition(); + copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrlElement(convertUri(src.getUrlElement())); + if (src.hasVersion()) + tgt.setVersionElement(convertString(src.getVersionElement())); + if (src.hasName()) + tgt.setNameElement(convertString(src.getNameElement())); + if (src.hasStatus()) + tgt.setStatus(Enumerations.convertPublicationStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimentalElement(convertBoolean(src.getExperimentalElement())); + if (src.hasDate()) + tgt.setDateElement(convertDateTime(src.getDateElement())); + if (src.hasPublisher()) + tgt.setPublisherElement(convertString(src.getPublisherElement())); + for (org.hl7.fhir.r5.model.ContactDetail t : src.getContact()) + tgt.addContact(convertContactDetail(t)); + if (src.hasDescription()) + tgt.setDescriptionElement(convertMarkdown(src.getDescriptionElement())); + for (org.hl7.fhir.r5.model.UsageContext t : src.getUseContext()) + tgt.addUseContext(convertUsageContext(t)); + if (src.hasPurpose()) + tgt.setPurposeElement(convertMarkdown(src.getPurposeElement())); + if (src.hasCode()) + tgt.setCode(convertCompartmentType(src.getCode())); + if (src.hasSearch()) + tgt.setSearchElement(convertBoolean(src.getSearchElement())); + for (org.hl7.fhir.r5.model.CompartmentDefinition.CompartmentDefinitionResourceComponent t : src.getResource()) + tgt.addResource(convertCompartmentDefinitionResourceComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.CompartmentDefinition.CompartmentType convertCompartmentType(org.hl7.fhir.r4.model.CompartmentDefinition.CompartmentType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PATIENT: return org.hl7.fhir.r5.model.CompartmentDefinition.CompartmentType.PATIENT; + case ENCOUNTER: return org.hl7.fhir.r5.model.CompartmentDefinition.CompartmentType.ENCOUNTER; + case RELATEDPERSON: return org.hl7.fhir.r5.model.CompartmentDefinition.CompartmentType.RELATEDPERSON; + case PRACTITIONER: return org.hl7.fhir.r5.model.CompartmentDefinition.CompartmentType.PRACTITIONER; + case DEVICE: return org.hl7.fhir.r5.model.CompartmentDefinition.CompartmentType.DEVICE; + default: return org.hl7.fhir.r5.model.CompartmentDefinition.CompartmentType.NULL; + } +} + + public static org.hl7.fhir.r4.model.CompartmentDefinition.CompartmentType convertCompartmentType(org.hl7.fhir.r5.model.CompartmentDefinition.CompartmentType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PATIENT: return org.hl7.fhir.r4.model.CompartmentDefinition.CompartmentType.PATIENT; + case ENCOUNTER: return org.hl7.fhir.r4.model.CompartmentDefinition.CompartmentType.ENCOUNTER; + case RELATEDPERSON: return org.hl7.fhir.r4.model.CompartmentDefinition.CompartmentType.RELATEDPERSON; + case PRACTITIONER: return org.hl7.fhir.r4.model.CompartmentDefinition.CompartmentType.PRACTITIONER; + case DEVICE: return org.hl7.fhir.r4.model.CompartmentDefinition.CompartmentType.DEVICE; + default: return org.hl7.fhir.r4.model.CompartmentDefinition.CompartmentType.NULL; + } +} + + public static org.hl7.fhir.r5.model.CompartmentDefinition.CompartmentDefinitionResourceComponent convertCompartmentDefinitionResourceComponent(org.hl7.fhir.r4.model.CompartmentDefinition.CompartmentDefinitionResourceComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.CompartmentDefinition.CompartmentDefinitionResourceComponent tgt = new org.hl7.fhir.r5.model.CompartmentDefinition.CompartmentDefinitionResourceComponent(); + copyElement(src, tgt); + if (src.hasCode()) + tgt.setCodeElement(convertCode(src.getCodeElement())); + for (org.hl7.fhir.r4.model.StringType t : src.getParam()) + tgt.getParam().add(convertString(t)); + if (src.hasDocumentation()) + tgt.setDocumentationElement(convertString(src.getDocumentationElement())); + return tgt; + } + + public static org.hl7.fhir.r4.model.CompartmentDefinition.CompartmentDefinitionResourceComponent convertCompartmentDefinitionResourceComponent(org.hl7.fhir.r5.model.CompartmentDefinition.CompartmentDefinitionResourceComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.CompartmentDefinition.CompartmentDefinitionResourceComponent tgt = new org.hl7.fhir.r4.model.CompartmentDefinition.CompartmentDefinitionResourceComponent(); + copyElement(src, tgt); + if (src.hasCode()) + tgt.setCodeElement(convertCode(src.getCodeElement())); + for (org.hl7.fhir.r5.model.StringType t : src.getParam()) + tgt.getParam().add(convertString(t)); + if (src.hasDocumentation()) + tgt.setDocumentationElement(convertString(src.getDocumentationElement())); + return tgt; + } + + +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Composition.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Composition.java new file mode 100644 index 000000000..6b046f612 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Composition.java @@ -0,0 +1,377 @@ +package org.hl7.fhir.convertors.conv40_50; + +import org.hl7.fhir.exceptions.FHIRException; + +import org.hl7.fhir.convertors.VersionConvertor_40_50; + + +/* + Copyright (c) 2011+, HL7, Inc. + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of HL7 nor the names of its contributors may be used to + endorse or promote products derived from this software without specific + prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + +*/ + +// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0 + + +public class Composition extends VersionConvertor_40_50 { + + public static org.hl7.fhir.r5.model.Composition convertComposition(org.hl7.fhir.r4.model.Composition src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Composition tgt = new org.hl7.fhir.r5.model.Composition(); + copyDomainResource(src, tgt); + if (src.hasIdentifier()) + tgt.setIdentifier(convertIdentifier(src.getIdentifier())); + if (src.hasStatus()) + tgt.setStatus(convertCompositionStatus(src.getStatus())); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getCategory()) + tgt.addCategory(convertCodeableConcept(t)); + if (src.hasSubject()) + tgt.setSubject(convertReference(src.getSubject())); + if (src.hasEncounter()) + tgt.setEncounter(convertReference(src.getEncounter())); + if (src.hasDate()) + tgt.setDateElement(convertDateTime(src.getDateElement())); + for (org.hl7.fhir.r4.model.Reference t : src.getAuthor()) + tgt.addAuthor(convertReference(t)); + if (src.hasTitle()) + tgt.setTitleElement(convertString(src.getTitleElement())); + if (src.hasConfidentiality()) + tgt.setConfidentiality(convertDocumentConfidentiality(src.getConfidentiality())); + for (org.hl7.fhir.r4.model.Composition.CompositionAttesterComponent t : src.getAttester()) + tgt.addAttester(convertCompositionAttesterComponent(t)); + if (src.hasCustodian()) + tgt.setCustodian(convertReference(src.getCustodian())); + for (org.hl7.fhir.r4.model.Composition.CompositionRelatesToComponent t : src.getRelatesTo()) + tgt.addRelatesTo(convertCompositionRelatesToComponent(t)); + for (org.hl7.fhir.r4.model.Composition.CompositionEventComponent t : src.getEvent()) + tgt.addEvent(convertCompositionEventComponent(t)); + for (org.hl7.fhir.r4.model.Composition.SectionComponent t : src.getSection()) + tgt.addSection(convertSectionComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.Composition convertComposition(org.hl7.fhir.r5.model.Composition src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Composition tgt = new org.hl7.fhir.r4.model.Composition(); + copyDomainResource(src, tgt); + if (src.hasIdentifier()) + tgt.setIdentifier(convertIdentifier(src.getIdentifier())); + if (src.hasStatus()) + tgt.setStatus(convertCompositionStatus(src.getStatus())); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getCategory()) + tgt.addCategory(convertCodeableConcept(t)); + if (src.hasSubject()) + tgt.setSubject(convertReference(src.getSubject())); + if (src.hasEncounter()) + tgt.setEncounter(convertReference(src.getEncounter())); + if (src.hasDate()) + tgt.setDateElement(convertDateTime(src.getDateElement())); + for (org.hl7.fhir.r5.model.Reference t : src.getAuthor()) + tgt.addAuthor(convertReference(t)); + if (src.hasTitle()) + tgt.setTitleElement(convertString(src.getTitleElement())); + if (src.hasConfidentiality()) + tgt.setConfidentiality(convertDocumentConfidentiality(src.getConfidentiality())); + for (org.hl7.fhir.r5.model.Composition.CompositionAttesterComponent t : src.getAttester()) + tgt.addAttester(convertCompositionAttesterComponent(t)); + if (src.hasCustodian()) + tgt.setCustodian(convertReference(src.getCustodian())); + for (org.hl7.fhir.r5.model.Composition.CompositionRelatesToComponent t : src.getRelatesTo()) + tgt.addRelatesTo(convertCompositionRelatesToComponent(t)); + for (org.hl7.fhir.r5.model.Composition.CompositionEventComponent t : src.getEvent()) + tgt.addEvent(convertCompositionEventComponent(t)); + for (org.hl7.fhir.r5.model.Composition.SectionComponent t : src.getSection()) + tgt.addSection(convertSectionComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.Composition.CompositionStatus convertCompositionStatus(org.hl7.fhir.r4.model.Composition.CompositionStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PRELIMINARY: return org.hl7.fhir.r5.model.Composition.CompositionStatus.PRELIMINARY; + case FINAL: return org.hl7.fhir.r5.model.Composition.CompositionStatus.FINAL; + case AMENDED: return org.hl7.fhir.r5.model.Composition.CompositionStatus.AMENDED; + case ENTEREDINERROR: return org.hl7.fhir.r5.model.Composition.CompositionStatus.ENTEREDINERROR; + default: return org.hl7.fhir.r5.model.Composition.CompositionStatus.NULL; + } +} + + public static org.hl7.fhir.r4.model.Composition.CompositionStatus convertCompositionStatus(org.hl7.fhir.r5.model.Composition.CompositionStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PRELIMINARY: return org.hl7.fhir.r4.model.Composition.CompositionStatus.PRELIMINARY; + case FINAL: return org.hl7.fhir.r4.model.Composition.CompositionStatus.FINAL; + case AMENDED: return org.hl7.fhir.r4.model.Composition.CompositionStatus.AMENDED; + case ENTEREDINERROR: return org.hl7.fhir.r4.model.Composition.CompositionStatus.ENTEREDINERROR; + default: return org.hl7.fhir.r4.model.Composition.CompositionStatus.NULL; + } +} + + public static org.hl7.fhir.r5.model.Composition.DocumentConfidentiality convertDocumentConfidentiality(org.hl7.fhir.r4.model.Composition.DocumentConfidentiality src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case U: return org.hl7.fhir.r5.model.Composition.DocumentConfidentiality.U; + case L: return org.hl7.fhir.r5.model.Composition.DocumentConfidentiality.L; + case M: return org.hl7.fhir.r5.model.Composition.DocumentConfidentiality.M; + case N: return org.hl7.fhir.r5.model.Composition.DocumentConfidentiality.N; + case R: return org.hl7.fhir.r5.model.Composition.DocumentConfidentiality.R; + case V: return org.hl7.fhir.r5.model.Composition.DocumentConfidentiality.V; + default: return org.hl7.fhir.r5.model.Composition.DocumentConfidentiality.NULL; + } +} + + public static org.hl7.fhir.r4.model.Composition.DocumentConfidentiality convertDocumentConfidentiality(org.hl7.fhir.r5.model.Composition.DocumentConfidentiality src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case U: return org.hl7.fhir.r4.model.Composition.DocumentConfidentiality.U; + case L: return org.hl7.fhir.r4.model.Composition.DocumentConfidentiality.L; + case M: return org.hl7.fhir.r4.model.Composition.DocumentConfidentiality.M; + case N: return org.hl7.fhir.r4.model.Composition.DocumentConfidentiality.N; + case R: return org.hl7.fhir.r4.model.Composition.DocumentConfidentiality.R; + case V: return org.hl7.fhir.r4.model.Composition.DocumentConfidentiality.V; + default: return org.hl7.fhir.r4.model.Composition.DocumentConfidentiality.NULL; + } +} + + public static org.hl7.fhir.r5.model.Composition.CompositionAttesterComponent convertCompositionAttesterComponent(org.hl7.fhir.r4.model.Composition.CompositionAttesterComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Composition.CompositionAttesterComponent tgt = new org.hl7.fhir.r5.model.Composition.CompositionAttesterComponent(); + copyElement(src, tgt); + if (src.hasMode()) + tgt.setMode(convertCompositionAttestationMode(src.getMode())); + if (src.hasTime()) + tgt.setTimeElement(convertDateTime(src.getTimeElement())); + if (src.hasParty()) + tgt.setParty(convertReference(src.getParty())); + return tgt; + } + + public static org.hl7.fhir.r4.model.Composition.CompositionAttesterComponent convertCompositionAttesterComponent(org.hl7.fhir.r5.model.Composition.CompositionAttesterComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Composition.CompositionAttesterComponent tgt = new org.hl7.fhir.r4.model.Composition.CompositionAttesterComponent(); + copyElement(src, tgt); + if (src.hasMode()) + tgt.setMode(convertCompositionAttestationMode(src.getMode())); + if (src.hasTime()) + tgt.setTimeElement(convertDateTime(src.getTimeElement())); + if (src.hasParty()) + tgt.setParty(convertReference(src.getParty())); + return tgt; + } + + public static org.hl7.fhir.r5.model.Composition.CompositionAttestationMode convertCompositionAttestationMode(org.hl7.fhir.r4.model.Composition.CompositionAttestationMode src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PERSONAL: return org.hl7.fhir.r5.model.Composition.CompositionAttestationMode.PERSONAL; + case PROFESSIONAL: return org.hl7.fhir.r5.model.Composition.CompositionAttestationMode.PROFESSIONAL; + case LEGAL: return org.hl7.fhir.r5.model.Composition.CompositionAttestationMode.LEGAL; + case OFFICIAL: return org.hl7.fhir.r5.model.Composition.CompositionAttestationMode.OFFICIAL; + default: return org.hl7.fhir.r5.model.Composition.CompositionAttestationMode.NULL; + } +} + + public static org.hl7.fhir.r4.model.Composition.CompositionAttestationMode convertCompositionAttestationMode(org.hl7.fhir.r5.model.Composition.CompositionAttestationMode src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PERSONAL: return org.hl7.fhir.r4.model.Composition.CompositionAttestationMode.PERSONAL; + case PROFESSIONAL: return org.hl7.fhir.r4.model.Composition.CompositionAttestationMode.PROFESSIONAL; + case LEGAL: return org.hl7.fhir.r4.model.Composition.CompositionAttestationMode.LEGAL; + case OFFICIAL: return org.hl7.fhir.r4.model.Composition.CompositionAttestationMode.OFFICIAL; + default: return org.hl7.fhir.r4.model.Composition.CompositionAttestationMode.NULL; + } +} + + public static org.hl7.fhir.r5.model.Composition.CompositionRelatesToComponent convertCompositionRelatesToComponent(org.hl7.fhir.r4.model.Composition.CompositionRelatesToComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Composition.CompositionRelatesToComponent tgt = new org.hl7.fhir.r5.model.Composition.CompositionRelatesToComponent(); + copyElement(src, tgt); + if (src.hasCode()) + tgt.setCode(convertDocumentRelationshipType(src.getCode())); + if (src.hasTarget()) + tgt.setTarget(convertType(src.getTarget())); + return tgt; + } + + public static org.hl7.fhir.r4.model.Composition.CompositionRelatesToComponent convertCompositionRelatesToComponent(org.hl7.fhir.r5.model.Composition.CompositionRelatesToComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Composition.CompositionRelatesToComponent tgt = new org.hl7.fhir.r4.model.Composition.CompositionRelatesToComponent(); + copyElement(src, tgt); + if (src.hasCode()) + tgt.setCode(convertDocumentRelationshipType(src.getCode())); + if (src.hasTarget()) + tgt.setTarget(convertType(src.getTarget())); + return tgt; + } + + public static org.hl7.fhir.r5.model.Composition.DocumentRelationshipType convertDocumentRelationshipType(org.hl7.fhir.r4.model.Composition.DocumentRelationshipType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case REPLACES: return org.hl7.fhir.r5.model.Composition.DocumentRelationshipType.REPLACES; + case TRANSFORMS: return org.hl7.fhir.r5.model.Composition.DocumentRelationshipType.TRANSFORMS; + case SIGNS: return org.hl7.fhir.r5.model.Composition.DocumentRelationshipType.SIGNS; + case APPENDS: return org.hl7.fhir.r5.model.Composition.DocumentRelationshipType.APPENDS; + default: return org.hl7.fhir.r5.model.Composition.DocumentRelationshipType.NULL; + } +} + + public static org.hl7.fhir.r4.model.Composition.DocumentRelationshipType convertDocumentRelationshipType(org.hl7.fhir.r5.model.Composition.DocumentRelationshipType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case REPLACES: return org.hl7.fhir.r4.model.Composition.DocumentRelationshipType.REPLACES; + case TRANSFORMS: return org.hl7.fhir.r4.model.Composition.DocumentRelationshipType.TRANSFORMS; + case SIGNS: return org.hl7.fhir.r4.model.Composition.DocumentRelationshipType.SIGNS; + case APPENDS: return org.hl7.fhir.r4.model.Composition.DocumentRelationshipType.APPENDS; + default: return org.hl7.fhir.r4.model.Composition.DocumentRelationshipType.NULL; + } +} + + public static org.hl7.fhir.r5.model.Composition.CompositionEventComponent convertCompositionEventComponent(org.hl7.fhir.r4.model.Composition.CompositionEventComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Composition.CompositionEventComponent tgt = new org.hl7.fhir.r5.model.Composition.CompositionEventComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getCode()) + tgt.addCode(convertCodeableConcept(t)); + if (src.hasPeriod()) + tgt.setPeriod(convertPeriod(src.getPeriod())); + for (org.hl7.fhir.r4.model.Reference t : src.getDetail()) + tgt.addDetail(convertReference(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.Composition.CompositionEventComponent convertCompositionEventComponent(org.hl7.fhir.r5.model.Composition.CompositionEventComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Composition.CompositionEventComponent tgt = new org.hl7.fhir.r4.model.Composition.CompositionEventComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getCode()) + tgt.addCode(convertCodeableConcept(t)); + if (src.hasPeriod()) + tgt.setPeriod(convertPeriod(src.getPeriod())); + for (org.hl7.fhir.r5.model.Reference t : src.getDetail()) + tgt.addDetail(convertReference(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.Composition.SectionComponent convertSectionComponent(org.hl7.fhir.r4.model.Composition.SectionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Composition.SectionComponent tgt = new org.hl7.fhir.r5.model.Composition.SectionComponent(); + copyElement(src, tgt); + if (src.hasTitle()) + tgt.setTitleElement(convertString(src.getTitleElement())); + if (src.hasCode()) + tgt.setCode(convertCodeableConcept(src.getCode())); + for (org.hl7.fhir.r4.model.Reference t : src.getAuthor()) + tgt.addAuthor(convertReference(t)); + if (src.hasFocus()) + tgt.setFocus(convertReference(src.getFocus())); + if (src.hasText()) + tgt.setText(convertNarrative(src.getText())); + if (src.hasMode()) + tgt.setMode(convertSectionMode(src.getMode())); + if (src.hasOrderedBy()) + tgt.setOrderedBy(convertCodeableConcept(src.getOrderedBy())); + for (org.hl7.fhir.r4.model.Reference t : src.getEntry()) + tgt.addEntry(convertReference(t)); + if (src.hasEmptyReason()) + tgt.setEmptyReason(convertCodeableConcept(src.getEmptyReason())); + for (org.hl7.fhir.r4.model.Composition.SectionComponent t : src.getSection()) + tgt.addSection(convertSectionComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.Composition.SectionComponent convertSectionComponent(org.hl7.fhir.r5.model.Composition.SectionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Composition.SectionComponent tgt = new org.hl7.fhir.r4.model.Composition.SectionComponent(); + copyElement(src, tgt); + if (src.hasTitle()) + tgt.setTitleElement(convertString(src.getTitleElement())); + if (src.hasCode()) + tgt.setCode(convertCodeableConcept(src.getCode())); + for (org.hl7.fhir.r5.model.Reference t : src.getAuthor()) + tgt.addAuthor(convertReference(t)); + if (src.hasFocus()) + tgt.setFocus(convertReference(src.getFocus())); + if (src.hasText()) + tgt.setText(convertNarrative(src.getText())); + if (src.hasMode()) + tgt.setMode(convertSectionMode(src.getMode())); + if (src.hasOrderedBy()) + tgt.setOrderedBy(convertCodeableConcept(src.getOrderedBy())); + for (org.hl7.fhir.r5.model.Reference t : src.getEntry()) + tgt.addEntry(convertReference(t)); + if (src.hasEmptyReason()) + tgt.setEmptyReason(convertCodeableConcept(src.getEmptyReason())); + for (org.hl7.fhir.r5.model.Composition.SectionComponent t : src.getSection()) + tgt.addSection(convertSectionComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.Composition.SectionMode convertSectionMode(org.hl7.fhir.r4.model.Composition.SectionMode src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case WORKING: return org.hl7.fhir.r5.model.Composition.SectionMode.WORKING; + case SNAPSHOT: return org.hl7.fhir.r5.model.Composition.SectionMode.SNAPSHOT; + case CHANGES: return org.hl7.fhir.r5.model.Composition.SectionMode.CHANGES; + default: return org.hl7.fhir.r5.model.Composition.SectionMode.NULL; + } +} + + public static org.hl7.fhir.r4.model.Composition.SectionMode convertSectionMode(org.hl7.fhir.r5.model.Composition.SectionMode src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case WORKING: return org.hl7.fhir.r4.model.Composition.SectionMode.WORKING; + case SNAPSHOT: return org.hl7.fhir.r4.model.Composition.SectionMode.SNAPSHOT; + case CHANGES: return org.hl7.fhir.r4.model.Composition.SectionMode.CHANGES; + default: return org.hl7.fhir.r4.model.Composition.SectionMode.NULL; + } +} + + +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/ConceptMap.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/ConceptMap.java new file mode 100644 index 000000000..ae10eb902 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/ConceptMap.java @@ -0,0 +1,325 @@ +package org.hl7.fhir.convertors.conv40_50; + +import org.hl7.fhir.exceptions.FHIRException; + +import org.hl7.fhir.convertors.VersionConvertor_40_50; + + +/* + Copyright (c) 2011+, HL7, Inc. + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of HL7 nor the names of its contributors may be used to + endorse or promote products derived from this software without specific + prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + +*/ + +// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0 + + +public class ConceptMap extends VersionConvertor_40_50 { + + public static org.hl7.fhir.r5.model.ConceptMap convertConceptMap(org.hl7.fhir.r4.model.ConceptMap src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ConceptMap tgt = new org.hl7.fhir.r5.model.ConceptMap(); + copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrlElement(convertUri(src.getUrlElement())); + if (src.hasIdentifier()) + tgt.setIdentifier(convertIdentifier(src.getIdentifier())); + if (src.hasVersion()) + tgt.setVersionElement(convertString(src.getVersionElement())); + if (src.hasName()) + tgt.setNameElement(convertString(src.getNameElement())); + if (src.hasTitle()) + tgt.setTitleElement(convertString(src.getTitleElement())); + if (src.hasStatus()) + tgt.setStatus(Enumerations.convertPublicationStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimentalElement(convertBoolean(src.getExperimentalElement())); + if (src.hasDate()) + tgt.setDateElement(convertDateTime(src.getDateElement())); + if (src.hasPublisher()) + tgt.setPublisherElement(convertString(src.getPublisherElement())); + for (org.hl7.fhir.r4.model.ContactDetail t : src.getContact()) + tgt.addContact(convertContactDetail(t)); + if (src.hasDescription()) + tgt.setDescriptionElement(convertMarkdown(src.getDescriptionElement())); + for (org.hl7.fhir.r4.model.UsageContext t : src.getUseContext()) + tgt.addUseContext(convertUsageContext(t)); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getJurisdiction()) + tgt.addJurisdiction(convertCodeableConcept(t)); + if (src.hasPurpose()) + tgt.setPurposeElement(convertMarkdown(src.getPurposeElement())); + if (src.hasCopyright()) + tgt.setCopyrightElement(convertMarkdown(src.getCopyrightElement())); + if (src.hasSource()) + tgt.setSource(convertType(src.getSource())); + if (src.hasTarget()) + tgt.setTarget(convertType(src.getTarget())); + for (org.hl7.fhir.r4.model.ConceptMap.ConceptMapGroupComponent t : src.getGroup()) + tgt.addGroup(convertConceptMapGroupComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.ConceptMap convertConceptMap(org.hl7.fhir.r5.model.ConceptMap src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.ConceptMap tgt = new org.hl7.fhir.r4.model.ConceptMap(); + copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrlElement(convertUri(src.getUrlElement())); + if (src.hasIdentifier()) + tgt.setIdentifier(convertIdentifier(src.getIdentifier())); + if (src.hasVersion()) + tgt.setVersionElement(convertString(src.getVersionElement())); + if (src.hasName()) + tgt.setNameElement(convertString(src.getNameElement())); + if (src.hasTitle()) + tgt.setTitleElement(convertString(src.getTitleElement())); + if (src.hasStatus()) + tgt.setStatus(Enumerations.convertPublicationStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimentalElement(convertBoolean(src.getExperimentalElement())); + if (src.hasDate()) + tgt.setDateElement(convertDateTime(src.getDateElement())); + if (src.hasPublisher()) + tgt.setPublisherElement(convertString(src.getPublisherElement())); + for (org.hl7.fhir.r5.model.ContactDetail t : src.getContact()) + tgt.addContact(convertContactDetail(t)); + if (src.hasDescription()) + tgt.setDescriptionElement(convertMarkdown(src.getDescriptionElement())); + for (org.hl7.fhir.r5.model.UsageContext t : src.getUseContext()) + tgt.addUseContext(convertUsageContext(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getJurisdiction()) + tgt.addJurisdiction(convertCodeableConcept(t)); + if (src.hasPurpose()) + tgt.setPurposeElement(convertMarkdown(src.getPurposeElement())); + if (src.hasCopyright()) + tgt.setCopyrightElement(convertMarkdown(src.getCopyrightElement())); + if (src.hasSource()) + tgt.setSource(convertType(src.getSource())); + if (src.hasTarget()) + tgt.setTarget(convertType(src.getTarget())); + for (org.hl7.fhir.r5.model.ConceptMap.ConceptMapGroupComponent t : src.getGroup()) + tgt.addGroup(convertConceptMapGroupComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.ConceptMap.ConceptMapGroupComponent convertConceptMapGroupComponent(org.hl7.fhir.r4.model.ConceptMap.ConceptMapGroupComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ConceptMap.ConceptMapGroupComponent tgt = new org.hl7.fhir.r5.model.ConceptMap.ConceptMapGroupComponent(); + copyElement(src, tgt); + if (src.hasSource()) + tgt.setSourceElement(convertUri(src.getSourceElement())); + if (src.hasSourceVersion()) + tgt.setSourceVersionElement(convertString(src.getSourceVersionElement())); + if (src.hasTarget()) + tgt.setTargetElement(convertUri(src.getTargetElement())); + if (src.hasTargetVersion()) + tgt.setTargetVersionElement(convertString(src.getTargetVersionElement())); + for (org.hl7.fhir.r4.model.ConceptMap.SourceElementComponent t : src.getElement()) + tgt.addElement(convertSourceElementComponent(t)); + if (src.hasUnmapped()) + tgt.setUnmapped(convertConceptMapGroupUnmappedComponent(src.getUnmapped())); + return tgt; + } + + public static org.hl7.fhir.r4.model.ConceptMap.ConceptMapGroupComponent convertConceptMapGroupComponent(org.hl7.fhir.r5.model.ConceptMap.ConceptMapGroupComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.ConceptMap.ConceptMapGroupComponent tgt = new org.hl7.fhir.r4.model.ConceptMap.ConceptMapGroupComponent(); + copyElement(src, tgt); + if (src.hasSource()) + tgt.setSourceElement(convertUri(src.getSourceElement())); + if (src.hasSourceVersion()) + tgt.setSourceVersionElement(convertString(src.getSourceVersionElement())); + if (src.hasTarget()) + tgt.setTargetElement(convertUri(src.getTargetElement())); + if (src.hasTargetVersion()) + tgt.setTargetVersionElement(convertString(src.getTargetVersionElement())); + for (org.hl7.fhir.r5.model.ConceptMap.SourceElementComponent t : src.getElement()) + tgt.addElement(convertSourceElementComponent(t)); + if (src.hasUnmapped()) + tgt.setUnmapped(convertConceptMapGroupUnmappedComponent(src.getUnmapped())); + return tgt; + } + + public static org.hl7.fhir.r5.model.ConceptMap.SourceElementComponent convertSourceElementComponent(org.hl7.fhir.r4.model.ConceptMap.SourceElementComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ConceptMap.SourceElementComponent tgt = new org.hl7.fhir.r5.model.ConceptMap.SourceElementComponent(); + copyElement(src, tgt); + if (src.hasCode()) + tgt.setCodeElement(convertCode(src.getCodeElement())); + if (src.hasDisplay()) + tgt.setDisplayElement(convertString(src.getDisplayElement())); + for (org.hl7.fhir.r4.model.ConceptMap.TargetElementComponent t : src.getTarget()) + tgt.addTarget(convertTargetElementComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.ConceptMap.SourceElementComponent convertSourceElementComponent(org.hl7.fhir.r5.model.ConceptMap.SourceElementComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.ConceptMap.SourceElementComponent tgt = new org.hl7.fhir.r4.model.ConceptMap.SourceElementComponent(); + copyElement(src, tgt); + if (src.hasCode()) + tgt.setCodeElement(convertCode(src.getCodeElement())); + if (src.hasDisplay()) + tgt.setDisplayElement(convertString(src.getDisplayElement())); + for (org.hl7.fhir.r5.model.ConceptMap.TargetElementComponent t : src.getTarget()) + tgt.addTarget(convertTargetElementComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.ConceptMap.TargetElementComponent convertTargetElementComponent(org.hl7.fhir.r4.model.ConceptMap.TargetElementComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ConceptMap.TargetElementComponent tgt = new org.hl7.fhir.r5.model.ConceptMap.TargetElementComponent(); + copyElement(src, tgt); + if (src.hasCode()) + tgt.setCodeElement(convertCode(src.getCodeElement())); + if (src.hasDisplay()) + tgt.setDisplayElement(convertString(src.getDisplayElement())); + if (src.hasEquivalence()) + tgt.setEquivalence(Enumerations.convertConceptMapEquivalence(src.getEquivalence())); + if (src.hasComment()) + tgt.setCommentElement(convertString(src.getCommentElement())); + for (org.hl7.fhir.r4.model.ConceptMap.OtherElementComponent t : src.getDependsOn()) + tgt.addDependsOn(convertOtherElementComponent(t)); + for (org.hl7.fhir.r4.model.ConceptMap.OtherElementComponent t : src.getProduct()) + tgt.addProduct(convertOtherElementComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.ConceptMap.TargetElementComponent convertTargetElementComponent(org.hl7.fhir.r5.model.ConceptMap.TargetElementComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.ConceptMap.TargetElementComponent tgt = new org.hl7.fhir.r4.model.ConceptMap.TargetElementComponent(); + copyElement(src, tgt); + if (src.hasCode()) + tgt.setCodeElement(convertCode(src.getCodeElement())); + if (src.hasDisplay()) + tgt.setDisplayElement(convertString(src.getDisplayElement())); + if (src.hasEquivalence()) + tgt.setEquivalence(Enumerations.convertConceptMapEquivalence(src.getEquivalence())); + if (src.hasComment()) + tgt.setCommentElement(convertString(src.getCommentElement())); + for (org.hl7.fhir.r5.model.ConceptMap.OtherElementComponent t : src.getDependsOn()) + tgt.addDependsOn(convertOtherElementComponent(t)); + for (org.hl7.fhir.r5.model.ConceptMap.OtherElementComponent t : src.getProduct()) + tgt.addProduct(convertOtherElementComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.ConceptMap.OtherElementComponent convertOtherElementComponent(org.hl7.fhir.r4.model.ConceptMap.OtherElementComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ConceptMap.OtherElementComponent tgt = new org.hl7.fhir.r5.model.ConceptMap.OtherElementComponent(); + copyElement(src, tgt); + if (src.hasProperty()) + tgt.setPropertyElement(convertUri(src.getPropertyElement())); + if (src.hasSystem()) + tgt.setSystemElement(convertCanonical(src.getSystemElement())); + if (src.hasValue()) + tgt.setValueElement(convertString(src.getValueElement())); + if (src.hasDisplay()) + tgt.setDisplayElement(convertString(src.getDisplayElement())); + return tgt; + } + + public static org.hl7.fhir.r4.model.ConceptMap.OtherElementComponent convertOtherElementComponent(org.hl7.fhir.r5.model.ConceptMap.OtherElementComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.ConceptMap.OtherElementComponent tgt = new org.hl7.fhir.r4.model.ConceptMap.OtherElementComponent(); + copyElement(src, tgt); + if (src.hasProperty()) + tgt.setPropertyElement(convertUri(src.getPropertyElement())); + if (src.hasSystem()) + tgt.setSystemElement(convertCanonical(src.getSystemElement())); + if (src.hasValue()) + tgt.setValueElement(convertString(src.getValueElement())); + if (src.hasDisplay()) + tgt.setDisplayElement(convertString(src.getDisplayElement())); + return tgt; + } + + public static org.hl7.fhir.r5.model.ConceptMap.ConceptMapGroupUnmappedComponent convertConceptMapGroupUnmappedComponent(org.hl7.fhir.r4.model.ConceptMap.ConceptMapGroupUnmappedComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ConceptMap.ConceptMapGroupUnmappedComponent tgt = new org.hl7.fhir.r5.model.ConceptMap.ConceptMapGroupUnmappedComponent(); + copyElement(src, tgt); + if (src.hasMode()) + tgt.setMode(convertConceptMapGroupUnmappedMode(src.getMode())); + if (src.hasCode()) + tgt.setCodeElement(convertCode(src.getCodeElement())); + if (src.hasDisplay()) + tgt.setDisplayElement(convertString(src.getDisplayElement())); + if (src.hasUrl()) + tgt.setUrlElement(convertCanonical(src.getUrlElement())); + return tgt; + } + + public static org.hl7.fhir.r4.model.ConceptMap.ConceptMapGroupUnmappedComponent convertConceptMapGroupUnmappedComponent(org.hl7.fhir.r5.model.ConceptMap.ConceptMapGroupUnmappedComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.ConceptMap.ConceptMapGroupUnmappedComponent tgt = new org.hl7.fhir.r4.model.ConceptMap.ConceptMapGroupUnmappedComponent(); + copyElement(src, tgt); + if (src.hasMode()) + tgt.setMode(convertConceptMapGroupUnmappedMode(src.getMode())); + if (src.hasCode()) + tgt.setCodeElement(convertCode(src.getCodeElement())); + if (src.hasDisplay()) + tgt.setDisplayElement(convertString(src.getDisplayElement())); + if (src.hasUrl()) + tgt.setUrlElement(convertCanonical(src.getUrlElement())); + return tgt; + } + + public static org.hl7.fhir.r5.model.ConceptMap.ConceptMapGroupUnmappedMode convertConceptMapGroupUnmappedMode(org.hl7.fhir.r4.model.ConceptMap.ConceptMapGroupUnmappedMode src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PROVIDED: return org.hl7.fhir.r5.model.ConceptMap.ConceptMapGroupUnmappedMode.PROVIDED; + case FIXED: return org.hl7.fhir.r5.model.ConceptMap.ConceptMapGroupUnmappedMode.FIXED; + case OTHERMAP: return org.hl7.fhir.r5.model.ConceptMap.ConceptMapGroupUnmappedMode.OTHERMAP; + default: return org.hl7.fhir.r5.model.ConceptMap.ConceptMapGroupUnmappedMode.NULL; + } +} + + public static org.hl7.fhir.r4.model.ConceptMap.ConceptMapGroupUnmappedMode convertConceptMapGroupUnmappedMode(org.hl7.fhir.r5.model.ConceptMap.ConceptMapGroupUnmappedMode src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PROVIDED: return org.hl7.fhir.r4.model.ConceptMap.ConceptMapGroupUnmappedMode.PROVIDED; + case FIXED: return org.hl7.fhir.r4.model.ConceptMap.ConceptMapGroupUnmappedMode.FIXED; + case OTHERMAP: return org.hl7.fhir.r4.model.ConceptMap.ConceptMapGroupUnmappedMode.OTHERMAP; + default: return org.hl7.fhir.r4.model.ConceptMap.ConceptMapGroupUnmappedMode.NULL; + } +} + + +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Condition.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Condition.java new file mode 100644 index 000000000..043fdef83 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Condition.java @@ -0,0 +1,179 @@ +package org.hl7.fhir.convertors.conv40_50; + +import org.hl7.fhir.exceptions.FHIRException; + +import org.hl7.fhir.convertors.VersionConvertor_40_50; + + +/* + Copyright (c) 2011+, HL7, Inc. + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of HL7 nor the names of its contributors may be used to + endorse or promote products derived from this software without specific + prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + +*/ + +// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0 + + +public class Condition extends VersionConvertor_40_50 { + + public static org.hl7.fhir.r5.model.Condition convertCondition(org.hl7.fhir.r4.model.Condition src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Condition tgt = new org.hl7.fhir.r5.model.Condition(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasClinicalStatus()) + tgt.setClinicalStatus(convertCodeableConcept(src.getClinicalStatus())); + if (src.hasVerificationStatus()) + tgt.setVerificationStatus(convertCodeableConcept(src.getVerificationStatus())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getCategory()) + tgt.addCategory(convertCodeableConcept(t)); + if (src.hasSeverity()) + tgt.setSeverity(convertCodeableConcept(src.getSeverity())); + if (src.hasCode()) + tgt.setCode(convertCodeableConcept(src.getCode())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getBodySite()) + tgt.addBodySite(convertCodeableConcept(t)); + if (src.hasSubject()) + tgt.setSubject(convertReference(src.getSubject())); + if (src.hasEncounter()) + tgt.setEncounter(convertReference(src.getEncounter())); + if (src.hasOnset()) + tgt.setOnset(convertType(src.getOnset())); + if (src.hasAbatement()) + tgt.setAbatement(convertType(src.getAbatement())); + if (src.hasRecordedDate()) + tgt.setRecordedDateElement(convertDateTime(src.getRecordedDateElement())); + if (src.hasRecorder()) + tgt.setRecorder(convertReference(src.getRecorder())); + if (src.hasAsserter()) + tgt.setAsserter(convertReference(src.getAsserter())); + for (org.hl7.fhir.r4.model.Condition.ConditionStageComponent t : src.getStage()) + tgt.addStage(convertConditionStageComponent(t)); + for (org.hl7.fhir.r4.model.Condition.ConditionEvidenceComponent t : src.getEvidence()) + tgt.addEvidence(convertConditionEvidenceComponent(t)); + for (org.hl7.fhir.r4.model.Annotation t : src.getNote()) + tgt.addNote(convertAnnotation(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.Condition convertCondition(org.hl7.fhir.r5.model.Condition src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Condition tgt = new org.hl7.fhir.r4.model.Condition(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasClinicalStatus()) + tgt.setClinicalStatus(convertCodeableConcept(src.getClinicalStatus())); + if (src.hasVerificationStatus()) + tgt.setVerificationStatus(convertCodeableConcept(src.getVerificationStatus())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getCategory()) + tgt.addCategory(convertCodeableConcept(t)); + if (src.hasSeverity()) + tgt.setSeverity(convertCodeableConcept(src.getSeverity())); + if (src.hasCode()) + tgt.setCode(convertCodeableConcept(src.getCode())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getBodySite()) + tgt.addBodySite(convertCodeableConcept(t)); + if (src.hasSubject()) + tgt.setSubject(convertReference(src.getSubject())); + if (src.hasEncounter()) + tgt.setEncounter(convertReference(src.getEncounter())); + if (src.hasOnset()) + tgt.setOnset(convertType(src.getOnset())); + if (src.hasAbatement()) + tgt.setAbatement(convertType(src.getAbatement())); + if (src.hasRecordedDate()) + tgt.setRecordedDateElement(convertDateTime(src.getRecordedDateElement())); + if (src.hasRecorder()) + tgt.setRecorder(convertReference(src.getRecorder())); + if (src.hasAsserter()) + tgt.setAsserter(convertReference(src.getAsserter())); + for (org.hl7.fhir.r5.model.Condition.ConditionStageComponent t : src.getStage()) + tgt.addStage(convertConditionStageComponent(t)); + for (org.hl7.fhir.r5.model.Condition.ConditionEvidenceComponent t : src.getEvidence()) + tgt.addEvidence(convertConditionEvidenceComponent(t)); + for (org.hl7.fhir.r5.model.Annotation t : src.getNote()) + tgt.addNote(convertAnnotation(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.Condition.ConditionStageComponent convertConditionStageComponent(org.hl7.fhir.r4.model.Condition.ConditionStageComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Condition.ConditionStageComponent tgt = new org.hl7.fhir.r5.model.Condition.ConditionStageComponent(); + copyElement(src, tgt); + if (src.hasSummary()) + tgt.setSummary(convertCodeableConcept(src.getSummary())); + for (org.hl7.fhir.r4.model.Reference t : src.getAssessment()) + tgt.addAssessment(convertReference(t)); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + return tgt; + } + + public static org.hl7.fhir.r4.model.Condition.ConditionStageComponent convertConditionStageComponent(org.hl7.fhir.r5.model.Condition.ConditionStageComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Condition.ConditionStageComponent tgt = new org.hl7.fhir.r4.model.Condition.ConditionStageComponent(); + copyElement(src, tgt); + if (src.hasSummary()) + tgt.setSummary(convertCodeableConcept(src.getSummary())); + for (org.hl7.fhir.r5.model.Reference t : src.getAssessment()) + tgt.addAssessment(convertReference(t)); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + return tgt; + } + + public static org.hl7.fhir.r5.model.Condition.ConditionEvidenceComponent convertConditionEvidenceComponent(org.hl7.fhir.r4.model.Condition.ConditionEvidenceComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Condition.ConditionEvidenceComponent tgt = new org.hl7.fhir.r5.model.Condition.ConditionEvidenceComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getCode()) + tgt.addCode(convertCodeableConcept(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getDetail()) + tgt.addDetail(convertReference(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.Condition.ConditionEvidenceComponent convertConditionEvidenceComponent(org.hl7.fhir.r5.model.Condition.ConditionEvidenceComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Condition.ConditionEvidenceComponent tgt = new org.hl7.fhir.r4.model.Condition.ConditionEvidenceComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getCode()) + tgt.addCode(convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getDetail()) + tgt.addDetail(convertReference(t)); + return tgt; + } + + +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Consent.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Consent.java new file mode 100644 index 000000000..04a7d2544 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Consent.java @@ -0,0 +1,343 @@ +package org.hl7.fhir.convertors.conv40_50; + +import org.hl7.fhir.exceptions.FHIRException; + +import org.hl7.fhir.convertors.VersionConvertor_40_50; + + +/* + Copyright (c) 2011+, HL7, Inc. + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of HL7 nor the names of its contributors may be used to + endorse or promote products derived from this software without specific + prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + +*/ + +// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0 + + +public class Consent extends VersionConvertor_40_50 { + + public static org.hl7.fhir.r5.model.Consent convertConsent(org.hl7.fhir.r4.model.Consent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Consent tgt = new org.hl7.fhir.r5.model.Consent(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasStatus()) + tgt.setStatus(convertConsentState(src.getStatus())); + if (src.hasScope()) + tgt.setScope(convertCodeableConcept(src.getScope())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getCategory()) + tgt.addCategory(convertCodeableConcept(t)); + if (src.hasPatient()) + tgt.setPatient(convertReference(src.getPatient())); + if (src.hasDateTime()) + tgt.setDateTimeElement(convertDateTime(src.getDateTimeElement())); + for (org.hl7.fhir.r4.model.Reference t : src.getPerformer()) + tgt.addPerformer(convertReference(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getOrganization()) + tgt.addOrganization(convertReference(t)); + if (src.hasSource()) + tgt.setSource(convertType(src.getSource())); + for (org.hl7.fhir.r4.model.Consent.ConsentPolicyComponent t : src.getPolicy()) + tgt.addPolicy(convertConsentPolicyComponent(t)); + if (src.hasPolicyRule()) + tgt.setPolicyRule(convertCodeableConcept(src.getPolicyRule())); + for (org.hl7.fhir.r4.model.Consent.ConsentVerificationComponent t : src.getVerification()) + tgt.addVerification(convertConsentVerificationComponent(t)); + if (src.hasProvision()) + tgt.setProvision(convertprovisionComponent(src.getProvision())); + return tgt; + } + + public static org.hl7.fhir.r4.model.Consent convertConsent(org.hl7.fhir.r5.model.Consent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Consent tgt = new org.hl7.fhir.r4.model.Consent(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasStatus()) + tgt.setStatus(convertConsentState(src.getStatus())); + if (src.hasScope()) + tgt.setScope(convertCodeableConcept(src.getScope())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getCategory()) + tgt.addCategory(convertCodeableConcept(t)); + if (src.hasPatient()) + tgt.setPatient(convertReference(src.getPatient())); + if (src.hasDateTime()) + tgt.setDateTimeElement(convertDateTime(src.getDateTimeElement())); + for (org.hl7.fhir.r5.model.Reference t : src.getPerformer()) + tgt.addPerformer(convertReference(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getOrganization()) + tgt.addOrganization(convertReference(t)); + if (src.hasSource()) + tgt.setSource(convertType(src.getSource())); + for (org.hl7.fhir.r5.model.Consent.ConsentPolicyComponent t : src.getPolicy()) + tgt.addPolicy(convertConsentPolicyComponent(t)); + if (src.hasPolicyRule()) + tgt.setPolicyRule(convertCodeableConcept(src.getPolicyRule())); + for (org.hl7.fhir.r5.model.Consent.ConsentVerificationComponent t : src.getVerification()) + tgt.addVerification(convertConsentVerificationComponent(t)); + if (src.hasProvision()) + tgt.setProvision(convertprovisionComponent(src.getProvision())); + return tgt; + } + + public static org.hl7.fhir.r5.model.Consent.ConsentState convertConsentState(org.hl7.fhir.r4.model.Consent.ConsentState src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case DRAFT: return org.hl7.fhir.r5.model.Consent.ConsentState.DRAFT; + case PROPOSED: return org.hl7.fhir.r5.model.Consent.ConsentState.PROPOSED; + case ACTIVE: return org.hl7.fhir.r5.model.Consent.ConsentState.ACTIVE; + case REJECTED: return org.hl7.fhir.r5.model.Consent.ConsentState.REJECTED; + case INACTIVE: return org.hl7.fhir.r5.model.Consent.ConsentState.INACTIVE; + case ENTEREDINERROR: return org.hl7.fhir.r5.model.Consent.ConsentState.ENTEREDINERROR; + default: return org.hl7.fhir.r5.model.Consent.ConsentState.NULL; + } +} + + public static org.hl7.fhir.r4.model.Consent.ConsentState convertConsentState(org.hl7.fhir.r5.model.Consent.ConsentState src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case DRAFT: return org.hl7.fhir.r4.model.Consent.ConsentState.DRAFT; + case PROPOSED: return org.hl7.fhir.r4.model.Consent.ConsentState.PROPOSED; + case ACTIVE: return org.hl7.fhir.r4.model.Consent.ConsentState.ACTIVE; + case REJECTED: return org.hl7.fhir.r4.model.Consent.ConsentState.REJECTED; + case INACTIVE: return org.hl7.fhir.r4.model.Consent.ConsentState.INACTIVE; + case ENTEREDINERROR: return org.hl7.fhir.r4.model.Consent.ConsentState.ENTEREDINERROR; + default: return org.hl7.fhir.r4.model.Consent.ConsentState.NULL; + } +} + + public static org.hl7.fhir.r5.model.Consent.ConsentPolicyComponent convertConsentPolicyComponent(org.hl7.fhir.r4.model.Consent.ConsentPolicyComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Consent.ConsentPolicyComponent tgt = new org.hl7.fhir.r5.model.Consent.ConsentPolicyComponent(); + copyElement(src, tgt); + if (src.hasAuthority()) + tgt.setAuthorityElement(convertUri(src.getAuthorityElement())); + if (src.hasUri()) + tgt.setUriElement(convertUri(src.getUriElement())); + return tgt; + } + + public static org.hl7.fhir.r4.model.Consent.ConsentPolicyComponent convertConsentPolicyComponent(org.hl7.fhir.r5.model.Consent.ConsentPolicyComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Consent.ConsentPolicyComponent tgt = new org.hl7.fhir.r4.model.Consent.ConsentPolicyComponent(); + copyElement(src, tgt); + if (src.hasAuthority()) + tgt.setAuthorityElement(convertUri(src.getAuthorityElement())); + if (src.hasUri()) + tgt.setUriElement(convertUri(src.getUriElement())); + return tgt; + } + + public static org.hl7.fhir.r5.model.Consent.ConsentVerificationComponent convertConsentVerificationComponent(org.hl7.fhir.r4.model.Consent.ConsentVerificationComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Consent.ConsentVerificationComponent tgt = new org.hl7.fhir.r5.model.Consent.ConsentVerificationComponent(); + copyElement(src, tgt); + if (src.hasVerified()) + tgt.setVerifiedElement(convertBoolean(src.getVerifiedElement())); + if (src.hasVerifiedWith()) + tgt.setVerifiedWith(convertReference(src.getVerifiedWith())); + if (src.hasVerificationDate()) + tgt.setVerificationDateElement(convertDateTime(src.getVerificationDateElement())); + return tgt; + } + + public static org.hl7.fhir.r4.model.Consent.ConsentVerificationComponent convertConsentVerificationComponent(org.hl7.fhir.r5.model.Consent.ConsentVerificationComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Consent.ConsentVerificationComponent tgt = new org.hl7.fhir.r4.model.Consent.ConsentVerificationComponent(); + copyElement(src, tgt); + if (src.hasVerified()) + tgt.setVerifiedElement(convertBoolean(src.getVerifiedElement())); + if (src.hasVerifiedWith()) + tgt.setVerifiedWith(convertReference(src.getVerifiedWith())); + if (src.hasVerificationDate()) + tgt.setVerificationDateElement(convertDateTime(src.getVerificationDateElement())); + return tgt; + } + + public static org.hl7.fhir.r5.model.Consent.provisionComponent convertprovisionComponent(org.hl7.fhir.r4.model.Consent.provisionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Consent.provisionComponent tgt = new org.hl7.fhir.r5.model.Consent.provisionComponent(); + copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertConsentProvisionType(src.getType())); + if (src.hasPeriod()) + tgt.setPeriod(convertPeriod(src.getPeriod())); + for (org.hl7.fhir.r4.model.Consent.provisionActorComponent t : src.getActor()) + tgt.addActor(convertprovisionActorComponent(t)); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getAction()) + tgt.addAction(convertCodeableConcept(t)); + for (org.hl7.fhir.r4.model.Coding t : src.getSecurityLabel()) + tgt.addSecurityLabel(convertCoding(t)); + for (org.hl7.fhir.r4.model.Coding t : src.getPurpose()) + tgt.addPurpose(convertCoding(t)); + for (org.hl7.fhir.r4.model.Coding t : src.getClass_()) + tgt.addClass_(convertCoding(t)); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getCode()) + tgt.addCode(convertCodeableConcept(t)); + if (src.hasDataPeriod()) + tgt.setDataPeriod(convertPeriod(src.getDataPeriod())); + for (org.hl7.fhir.r4.model.Consent.provisionDataComponent t : src.getData()) + tgt.addData(convertprovisionDataComponent(t)); + for (org.hl7.fhir.r4.model.Consent.provisionComponent t : src.getProvision()) + tgt.addProvision(convertprovisionComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.Consent.provisionComponent convertprovisionComponent(org.hl7.fhir.r5.model.Consent.provisionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Consent.provisionComponent tgt = new org.hl7.fhir.r4.model.Consent.provisionComponent(); + copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertConsentProvisionType(src.getType())); + if (src.hasPeriod()) + tgt.setPeriod(convertPeriod(src.getPeriod())); + for (org.hl7.fhir.r5.model.Consent.provisionActorComponent t : src.getActor()) + tgt.addActor(convertprovisionActorComponent(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getAction()) + tgt.addAction(convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.Coding t : src.getSecurityLabel()) + tgt.addSecurityLabel(convertCoding(t)); + for (org.hl7.fhir.r5.model.Coding t : src.getPurpose()) + tgt.addPurpose(convertCoding(t)); + for (org.hl7.fhir.r5.model.Coding t : src.getClass_()) + tgt.addClass_(convertCoding(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getCode()) + tgt.addCode(convertCodeableConcept(t)); + if (src.hasDataPeriod()) + tgt.setDataPeriod(convertPeriod(src.getDataPeriod())); + for (org.hl7.fhir.r5.model.Consent.provisionDataComponent t : src.getData()) + tgt.addData(convertprovisionDataComponent(t)); + for (org.hl7.fhir.r5.model.Consent.provisionComponent t : src.getProvision()) + tgt.addProvision(convertprovisionComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.Consent.ConsentProvisionType convertConsentProvisionType(org.hl7.fhir.r4.model.Consent.ConsentProvisionType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case DENY: return org.hl7.fhir.r5.model.Consent.ConsentProvisionType.DENY; + case PERMIT: return org.hl7.fhir.r5.model.Consent.ConsentProvisionType.PERMIT; + default: return org.hl7.fhir.r5.model.Consent.ConsentProvisionType.NULL; + } +} + + public static org.hl7.fhir.r4.model.Consent.ConsentProvisionType convertConsentProvisionType(org.hl7.fhir.r5.model.Consent.ConsentProvisionType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case DENY: return org.hl7.fhir.r4.model.Consent.ConsentProvisionType.DENY; + case PERMIT: return org.hl7.fhir.r4.model.Consent.ConsentProvisionType.PERMIT; + default: return org.hl7.fhir.r4.model.Consent.ConsentProvisionType.NULL; + } +} + + public static org.hl7.fhir.r5.model.Consent.provisionActorComponent convertprovisionActorComponent(org.hl7.fhir.r4.model.Consent.provisionActorComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Consent.provisionActorComponent tgt = new org.hl7.fhir.r5.model.Consent.provisionActorComponent(); + copyElement(src, tgt); + if (src.hasRole()) + tgt.setRole(convertCodeableConcept(src.getRole())); + if (src.hasReference()) + tgt.setReference(convertReference(src.getReference())); + return tgt; + } + + public static org.hl7.fhir.r4.model.Consent.provisionActorComponent convertprovisionActorComponent(org.hl7.fhir.r5.model.Consent.provisionActorComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Consent.provisionActorComponent tgt = new org.hl7.fhir.r4.model.Consent.provisionActorComponent(); + copyElement(src, tgt); + if (src.hasRole()) + tgt.setRole(convertCodeableConcept(src.getRole())); + if (src.hasReference()) + tgt.setReference(convertReference(src.getReference())); + return tgt; + } + + public static org.hl7.fhir.r5.model.Consent.provisionDataComponent convertprovisionDataComponent(org.hl7.fhir.r4.model.Consent.provisionDataComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Consent.provisionDataComponent tgt = new org.hl7.fhir.r5.model.Consent.provisionDataComponent(); + copyElement(src, tgt); + if (src.hasMeaning()) + tgt.setMeaning(convertConsentDataMeaning(src.getMeaning())); + if (src.hasReference()) + tgt.setReference(convertReference(src.getReference())); + return tgt; + } + + public static org.hl7.fhir.r4.model.Consent.provisionDataComponent convertprovisionDataComponent(org.hl7.fhir.r5.model.Consent.provisionDataComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Consent.provisionDataComponent tgt = new org.hl7.fhir.r4.model.Consent.provisionDataComponent(); + copyElement(src, tgt); + if (src.hasMeaning()) + tgt.setMeaning(convertConsentDataMeaning(src.getMeaning())); + if (src.hasReference()) + tgt.setReference(convertReference(src.getReference())); + return tgt; + } + + public static org.hl7.fhir.r5.model.Consent.ConsentDataMeaning convertConsentDataMeaning(org.hl7.fhir.r4.model.Consent.ConsentDataMeaning src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case INSTANCE: return org.hl7.fhir.r5.model.Consent.ConsentDataMeaning.INSTANCE; + case RELATED: return org.hl7.fhir.r5.model.Consent.ConsentDataMeaning.RELATED; + case DEPENDENTS: return org.hl7.fhir.r5.model.Consent.ConsentDataMeaning.DEPENDENTS; + case AUTHOREDBY: return org.hl7.fhir.r5.model.Consent.ConsentDataMeaning.AUTHOREDBY; + default: return org.hl7.fhir.r5.model.Consent.ConsentDataMeaning.NULL; + } +} + + public static org.hl7.fhir.r4.model.Consent.ConsentDataMeaning convertConsentDataMeaning(org.hl7.fhir.r5.model.Consent.ConsentDataMeaning src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case INSTANCE: return org.hl7.fhir.r4.model.Consent.ConsentDataMeaning.INSTANCE; + case RELATED: return org.hl7.fhir.r4.model.Consent.ConsentDataMeaning.RELATED; + case DEPENDENTS: return org.hl7.fhir.r4.model.Consent.ConsentDataMeaning.DEPENDENTS; + case AUTHOREDBY: return org.hl7.fhir.r4.model.Consent.ConsentDataMeaning.AUTHOREDBY; + default: return org.hl7.fhir.r4.model.Consent.ConsentDataMeaning.NULL; + } +} + + +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Contract.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Contract.java new file mode 100644 index 000000000..d01035854 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Contract.java @@ -0,0 +1,907 @@ +package org.hl7.fhir.convertors.conv40_50; + +import org.hl7.fhir.exceptions.FHIRException; + +import org.hl7.fhir.convertors.VersionConvertor_40_50; + + +/* + Copyright (c) 2011+, HL7, Inc. + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of HL7 nor the names of its contributors may be used to + endorse or promote products derived from this software without specific + prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + +*/ + +// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0 + + +public class Contract extends VersionConvertor_40_50 { + + public static org.hl7.fhir.r5.model.Contract convertContract(org.hl7.fhir.r4.model.Contract src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Contract tgt = new org.hl7.fhir.r5.model.Contract(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasUrl()) + tgt.setUrlElement(convertUri(src.getUrlElement())); + if (src.hasVersion()) + tgt.setVersionElement(convertString(src.getVersionElement())); + if (src.hasStatus()) + tgt.setStatus(convertContractStatus(src.getStatus())); + if (src.hasLegalState()) + tgt.setLegalState(convertCodeableConcept(src.getLegalState())); + if (src.hasInstantiatesCanonical()) + tgt.setInstantiatesCanonical(convertReference(src.getInstantiatesCanonical())); + if (src.hasInstantiatesUri()) + tgt.setInstantiatesUriElement(convertUri(src.getInstantiatesUriElement())); + if (src.hasContentDerivative()) + tgt.setContentDerivative(convertCodeableConcept(src.getContentDerivative())); + if (src.hasIssued()) + tgt.setIssuedElement(convertDateTime(src.getIssuedElement())); + if (src.hasApplies()) + tgt.setApplies(convertPeriod(src.getApplies())); + if (src.hasExpirationType()) + tgt.setExpirationType(convertCodeableConcept(src.getExpirationType())); + for (org.hl7.fhir.r4.model.Reference t : src.getSubject()) + tgt.addSubject(convertReference(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getAuthority()) + tgt.addAuthority(convertReference(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getDomain()) + tgt.addDomain(convertReference(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getSite()) + tgt.addSite(convertReference(t)); + if (src.hasName()) + tgt.setNameElement(convertString(src.getNameElement())); + if (src.hasTitle()) + tgt.setTitleElement(convertString(src.getTitleElement())); + if (src.hasSubtitle()) + tgt.setSubtitleElement(convertString(src.getSubtitleElement())); + for (org.hl7.fhir.r4.model.StringType t : src.getAlias()) + tgt.getAlias().add(convertString(t)); + if (src.hasAuthor()) + tgt.setAuthor(convertReference(src.getAuthor())); + if (src.hasScope()) + tgt.setScope(convertCodeableConcept(src.getScope())); + if (src.hasTopic()) + tgt.setTopic(convertType(src.getTopic())); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getSubType()) + tgt.addSubType(convertCodeableConcept(t)); + if (src.hasContentDefinition()) + tgt.setContentDefinition(convertContentDefinitionComponent(src.getContentDefinition())); + for (org.hl7.fhir.r4.model.Contract.TermComponent t : src.getTerm()) + tgt.addTerm(convertTermComponent(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getSupportingInfo()) + tgt.addSupportingInfo(convertReference(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getRelevantHistory()) + tgt.addRelevantHistory(convertReference(t)); + for (org.hl7.fhir.r4.model.Contract.SignatoryComponent t : src.getSigner()) + tgt.addSigner(convertSignatoryComponent(t)); + for (org.hl7.fhir.r4.model.Contract.FriendlyLanguageComponent t : src.getFriendly()) + tgt.addFriendly(convertFriendlyLanguageComponent(t)); + for (org.hl7.fhir.r4.model.Contract.LegalLanguageComponent t : src.getLegal()) + tgt.addLegal(convertLegalLanguageComponent(t)); + for (org.hl7.fhir.r4.model.Contract.ComputableLanguageComponent t : src.getRule()) + tgt.addRule(convertComputableLanguageComponent(t)); + if (src.hasLegallyBinding()) + tgt.setLegallyBinding(convertType(src.getLegallyBinding())); + return tgt; + } + + public static org.hl7.fhir.r4.model.Contract convertContract(org.hl7.fhir.r5.model.Contract src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Contract tgt = new org.hl7.fhir.r4.model.Contract(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasUrl()) + tgt.setUrlElement(convertUri(src.getUrlElement())); + if (src.hasVersion()) + tgt.setVersionElement(convertString(src.getVersionElement())); + if (src.hasStatus()) + tgt.setStatus(convertContractStatus(src.getStatus())); + if (src.hasLegalState()) + tgt.setLegalState(convertCodeableConcept(src.getLegalState())); + if (src.hasInstantiatesCanonical()) + tgt.setInstantiatesCanonical(convertReference(src.getInstantiatesCanonical())); + if (src.hasInstantiatesUri()) + tgt.setInstantiatesUriElement(convertUri(src.getInstantiatesUriElement())); + if (src.hasContentDerivative()) + tgt.setContentDerivative(convertCodeableConcept(src.getContentDerivative())); + if (src.hasIssued()) + tgt.setIssuedElement(convertDateTime(src.getIssuedElement())); + if (src.hasApplies()) + tgt.setApplies(convertPeriod(src.getApplies())); + if (src.hasExpirationType()) + tgt.setExpirationType(convertCodeableConcept(src.getExpirationType())); + for (org.hl7.fhir.r5.model.Reference t : src.getSubject()) + tgt.addSubject(convertReference(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getAuthority()) + tgt.addAuthority(convertReference(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getDomain()) + tgt.addDomain(convertReference(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getSite()) + tgt.addSite(convertReference(t)); + if (src.hasName()) + tgt.setNameElement(convertString(src.getNameElement())); + if (src.hasTitle()) + tgt.setTitleElement(convertString(src.getTitleElement())); + if (src.hasSubtitle()) + tgt.setSubtitleElement(convertString(src.getSubtitleElement())); + for (org.hl7.fhir.r5.model.StringType t : src.getAlias()) + tgt.getAlias().add(convertString(t)); + if (src.hasAuthor()) + tgt.setAuthor(convertReference(src.getAuthor())); + if (src.hasScope()) + tgt.setScope(convertCodeableConcept(src.getScope())); + if (src.hasTopic()) + tgt.setTopic(convertType(src.getTopic())); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getSubType()) + tgt.addSubType(convertCodeableConcept(t)); + if (src.hasContentDefinition()) + tgt.setContentDefinition(convertContentDefinitionComponent(src.getContentDefinition())); + for (org.hl7.fhir.r5.model.Contract.TermComponent t : src.getTerm()) + tgt.addTerm(convertTermComponent(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getSupportingInfo()) + tgt.addSupportingInfo(convertReference(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getRelevantHistory()) + tgt.addRelevantHistory(convertReference(t)); + for (org.hl7.fhir.r5.model.Contract.SignatoryComponent t : src.getSigner()) + tgt.addSigner(convertSignatoryComponent(t)); + for (org.hl7.fhir.r5.model.Contract.FriendlyLanguageComponent t : src.getFriendly()) + tgt.addFriendly(convertFriendlyLanguageComponent(t)); + for (org.hl7.fhir.r5.model.Contract.LegalLanguageComponent t : src.getLegal()) + tgt.addLegal(convertLegalLanguageComponent(t)); + for (org.hl7.fhir.r5.model.Contract.ComputableLanguageComponent t : src.getRule()) + tgt.addRule(convertComputableLanguageComponent(t)); + if (src.hasLegallyBinding()) + tgt.setLegallyBinding(convertType(src.getLegallyBinding())); + return tgt; + } + + public static org.hl7.fhir.r5.model.Contract.ContractStatus convertContractStatus(org.hl7.fhir.r4.model.Contract.ContractStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case AMENDED: return org.hl7.fhir.r5.model.Contract.ContractStatus.AMENDED; + case APPENDED: return org.hl7.fhir.r5.model.Contract.ContractStatus.APPENDED; + case CANCELLED: return org.hl7.fhir.r5.model.Contract.ContractStatus.CANCELLED; + case DISPUTED: return org.hl7.fhir.r5.model.Contract.ContractStatus.DISPUTED; + case ENTEREDINERROR: return org.hl7.fhir.r5.model.Contract.ContractStatus.ENTEREDINERROR; + case EXECUTABLE: return org.hl7.fhir.r5.model.Contract.ContractStatus.EXECUTABLE; + case EXECUTED: return org.hl7.fhir.r5.model.Contract.ContractStatus.EXECUTED; + case NEGOTIABLE: return org.hl7.fhir.r5.model.Contract.ContractStatus.NEGOTIABLE; + case OFFERED: return org.hl7.fhir.r5.model.Contract.ContractStatus.OFFERED; + case POLICY: return org.hl7.fhir.r5.model.Contract.ContractStatus.POLICY; + case REJECTED: return org.hl7.fhir.r5.model.Contract.ContractStatus.REJECTED; + case RENEWED: return org.hl7.fhir.r5.model.Contract.ContractStatus.RENEWED; + case REVOKED: return org.hl7.fhir.r5.model.Contract.ContractStatus.REVOKED; + case RESOLVED: return org.hl7.fhir.r5.model.Contract.ContractStatus.RESOLVED; + case TERMINATED: return org.hl7.fhir.r5.model.Contract.ContractStatus.TERMINATED; + default: return org.hl7.fhir.r5.model.Contract.ContractStatus.NULL; + } +} + + public static org.hl7.fhir.r4.model.Contract.ContractStatus convertContractStatus(org.hl7.fhir.r5.model.Contract.ContractStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case AMENDED: return org.hl7.fhir.r4.model.Contract.ContractStatus.AMENDED; + case APPENDED: return org.hl7.fhir.r4.model.Contract.ContractStatus.APPENDED; + case CANCELLED: return org.hl7.fhir.r4.model.Contract.ContractStatus.CANCELLED; + case DISPUTED: return org.hl7.fhir.r4.model.Contract.ContractStatus.DISPUTED; + case ENTEREDINERROR: return org.hl7.fhir.r4.model.Contract.ContractStatus.ENTEREDINERROR; + case EXECUTABLE: return org.hl7.fhir.r4.model.Contract.ContractStatus.EXECUTABLE; + case EXECUTED: return org.hl7.fhir.r4.model.Contract.ContractStatus.EXECUTED; + case NEGOTIABLE: return org.hl7.fhir.r4.model.Contract.ContractStatus.NEGOTIABLE; + case OFFERED: return org.hl7.fhir.r4.model.Contract.ContractStatus.OFFERED; + case POLICY: return org.hl7.fhir.r4.model.Contract.ContractStatus.POLICY; + case REJECTED: return org.hl7.fhir.r4.model.Contract.ContractStatus.REJECTED; + case RENEWED: return org.hl7.fhir.r4.model.Contract.ContractStatus.RENEWED; + case REVOKED: return org.hl7.fhir.r4.model.Contract.ContractStatus.REVOKED; + case RESOLVED: return org.hl7.fhir.r4.model.Contract.ContractStatus.RESOLVED; + case TERMINATED: return org.hl7.fhir.r4.model.Contract.ContractStatus.TERMINATED; + default: return org.hl7.fhir.r4.model.Contract.ContractStatus.NULL; + } +} + + public static org.hl7.fhir.r5.model.Contract.ContentDefinitionComponent convertContentDefinitionComponent(org.hl7.fhir.r4.model.Contract.ContentDefinitionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Contract.ContentDefinitionComponent tgt = new org.hl7.fhir.r5.model.Contract.ContentDefinitionComponent(); + copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + if (src.hasSubType()) + tgt.setSubType(convertCodeableConcept(src.getSubType())); + if (src.hasPublisher()) + tgt.setPublisher(convertReference(src.getPublisher())); + if (src.hasPublicationDate()) + tgt.setPublicationDateElement(convertDateTime(src.getPublicationDateElement())); + if (src.hasPublicationStatus()) + tgt.setPublicationStatus(convertContractPublicationStatus(src.getPublicationStatus())); + if (src.hasCopyright()) + tgt.setCopyrightElement(convertMarkdown(src.getCopyrightElement())); + return tgt; + } + + public static org.hl7.fhir.r4.model.Contract.ContentDefinitionComponent convertContentDefinitionComponent(org.hl7.fhir.r5.model.Contract.ContentDefinitionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Contract.ContentDefinitionComponent tgt = new org.hl7.fhir.r4.model.Contract.ContentDefinitionComponent(); + copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + if (src.hasSubType()) + tgt.setSubType(convertCodeableConcept(src.getSubType())); + if (src.hasPublisher()) + tgt.setPublisher(convertReference(src.getPublisher())); + if (src.hasPublicationDate()) + tgt.setPublicationDateElement(convertDateTime(src.getPublicationDateElement())); + if (src.hasPublicationStatus()) + tgt.setPublicationStatus(convertContractPublicationStatus(src.getPublicationStatus())); + if (src.hasCopyright()) + tgt.setCopyrightElement(convertMarkdown(src.getCopyrightElement())); + return tgt; + } + + public static org.hl7.fhir.r5.model.Contract.ContractPublicationStatus convertContractPublicationStatus(org.hl7.fhir.r4.model.Contract.ContractPublicationStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case AMENDED: return org.hl7.fhir.r5.model.Contract.ContractPublicationStatus.AMENDED; + case APPENDED: return org.hl7.fhir.r5.model.Contract.ContractPublicationStatus.APPENDED; + case CANCELLED: return org.hl7.fhir.r5.model.Contract.ContractPublicationStatus.CANCELLED; + case DISPUTED: return org.hl7.fhir.r5.model.Contract.ContractPublicationStatus.DISPUTED; + case ENTEREDINERROR: return org.hl7.fhir.r5.model.Contract.ContractPublicationStatus.ENTEREDINERROR; + case EXECUTABLE: return org.hl7.fhir.r5.model.Contract.ContractPublicationStatus.EXECUTABLE; + case EXECUTED: return org.hl7.fhir.r5.model.Contract.ContractPublicationStatus.EXECUTED; + case NEGOTIABLE: return org.hl7.fhir.r5.model.Contract.ContractPublicationStatus.NEGOTIABLE; + case OFFERED: return org.hl7.fhir.r5.model.Contract.ContractPublicationStatus.OFFERED; + case POLICY: return org.hl7.fhir.r5.model.Contract.ContractPublicationStatus.POLICY; + case REJECTED: return org.hl7.fhir.r5.model.Contract.ContractPublicationStatus.REJECTED; + case RENEWED: return org.hl7.fhir.r5.model.Contract.ContractPublicationStatus.RENEWED; + case REVOKED: return org.hl7.fhir.r5.model.Contract.ContractPublicationStatus.REVOKED; + case RESOLVED: return org.hl7.fhir.r5.model.Contract.ContractPublicationStatus.RESOLVED; + case TERMINATED: return org.hl7.fhir.r5.model.Contract.ContractPublicationStatus.TERMINATED; + default: return org.hl7.fhir.r5.model.Contract.ContractPublicationStatus.NULL; + } +} + + public static org.hl7.fhir.r4.model.Contract.ContractPublicationStatus convertContractPublicationStatus(org.hl7.fhir.r5.model.Contract.ContractPublicationStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case AMENDED: return org.hl7.fhir.r4.model.Contract.ContractPublicationStatus.AMENDED; + case APPENDED: return org.hl7.fhir.r4.model.Contract.ContractPublicationStatus.APPENDED; + case CANCELLED: return org.hl7.fhir.r4.model.Contract.ContractPublicationStatus.CANCELLED; + case DISPUTED: return org.hl7.fhir.r4.model.Contract.ContractPublicationStatus.DISPUTED; + case ENTEREDINERROR: return org.hl7.fhir.r4.model.Contract.ContractPublicationStatus.ENTEREDINERROR; + case EXECUTABLE: return org.hl7.fhir.r4.model.Contract.ContractPublicationStatus.EXECUTABLE; + case EXECUTED: return org.hl7.fhir.r4.model.Contract.ContractPublicationStatus.EXECUTED; + case NEGOTIABLE: return org.hl7.fhir.r4.model.Contract.ContractPublicationStatus.NEGOTIABLE; + case OFFERED: return org.hl7.fhir.r4.model.Contract.ContractPublicationStatus.OFFERED; + case POLICY: return org.hl7.fhir.r4.model.Contract.ContractPublicationStatus.POLICY; + case REJECTED: return org.hl7.fhir.r4.model.Contract.ContractPublicationStatus.REJECTED; + case RENEWED: return org.hl7.fhir.r4.model.Contract.ContractPublicationStatus.RENEWED; + case REVOKED: return org.hl7.fhir.r4.model.Contract.ContractPublicationStatus.REVOKED; + case RESOLVED: return org.hl7.fhir.r4.model.Contract.ContractPublicationStatus.RESOLVED; + case TERMINATED: return org.hl7.fhir.r4.model.Contract.ContractPublicationStatus.TERMINATED; + default: return org.hl7.fhir.r4.model.Contract.ContractPublicationStatus.NULL; + } +} + + public static org.hl7.fhir.r5.model.Contract.TermComponent convertTermComponent(org.hl7.fhir.r4.model.Contract.TermComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Contract.TermComponent tgt = new org.hl7.fhir.r5.model.Contract.TermComponent(); + copyElement(src, tgt); + if (src.hasIdentifier()) + tgt.setIdentifier(convertIdentifier(src.getIdentifier())); + if (src.hasIssued()) + tgt.setIssuedElement(convertDateTime(src.getIssuedElement())); + if (src.hasApplies()) + tgt.setApplies(convertPeriod(src.getApplies())); + if (src.hasTopic()) + tgt.setTopic(convertType(src.getTopic())); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + if (src.hasSubType()) + tgt.setSubType(convertCodeableConcept(src.getSubType())); + if (src.hasText()) + tgt.setTextElement(convertString(src.getTextElement())); + for (org.hl7.fhir.r4.model.Contract.SecurityLabelComponent t : src.getSecurityLabel()) + tgt.addSecurityLabel(convertSecurityLabelComponent(t)); + if (src.hasOffer()) + tgt.setOffer(convertContractOfferComponent(src.getOffer())); + for (org.hl7.fhir.r4.model.Contract.ContractAssetComponent t : src.getAsset()) + tgt.addAsset(convertContractAssetComponent(t)); + for (org.hl7.fhir.r4.model.Contract.ActionComponent t : src.getAction()) + tgt.addAction(convertActionComponent(t)); + for (org.hl7.fhir.r4.model.Contract.TermComponent t : src.getGroup()) + tgt.addGroup(convertTermComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.Contract.TermComponent convertTermComponent(org.hl7.fhir.r5.model.Contract.TermComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Contract.TermComponent tgt = new org.hl7.fhir.r4.model.Contract.TermComponent(); + copyElement(src, tgt); + if (src.hasIdentifier()) + tgt.setIdentifier(convertIdentifier(src.getIdentifier())); + if (src.hasIssued()) + tgt.setIssuedElement(convertDateTime(src.getIssuedElement())); + if (src.hasApplies()) + tgt.setApplies(convertPeriod(src.getApplies())); + if (src.hasTopic()) + tgt.setTopic(convertType(src.getTopic())); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + if (src.hasSubType()) + tgt.setSubType(convertCodeableConcept(src.getSubType())); + if (src.hasText()) + tgt.setTextElement(convertString(src.getTextElement())); + for (org.hl7.fhir.r5.model.Contract.SecurityLabelComponent t : src.getSecurityLabel()) + tgt.addSecurityLabel(convertSecurityLabelComponent(t)); + if (src.hasOffer()) + tgt.setOffer(convertContractOfferComponent(src.getOffer())); + for (org.hl7.fhir.r5.model.Contract.ContractAssetComponent t : src.getAsset()) + tgt.addAsset(convertContractAssetComponent(t)); + for (org.hl7.fhir.r5.model.Contract.ActionComponent t : src.getAction()) + tgt.addAction(convertActionComponent(t)); + for (org.hl7.fhir.r5.model.Contract.TermComponent t : src.getGroup()) + tgt.addGroup(convertTermComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.Contract.SecurityLabelComponent convertSecurityLabelComponent(org.hl7.fhir.r4.model.Contract.SecurityLabelComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Contract.SecurityLabelComponent tgt = new org.hl7.fhir.r5.model.Contract.SecurityLabelComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.r4.model.UnsignedIntType t : src.getNumber()) + tgt.getNumber().add(convertUnsignedInt(t)); + if (src.hasClassification()) + tgt.setClassification(convertCoding(src.getClassification())); + for (org.hl7.fhir.r4.model.Coding t : src.getCategory()) + tgt.addCategory(convertCoding(t)); + for (org.hl7.fhir.r4.model.Coding t : src.getControl()) + tgt.addControl(convertCoding(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.Contract.SecurityLabelComponent convertSecurityLabelComponent(org.hl7.fhir.r5.model.Contract.SecurityLabelComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Contract.SecurityLabelComponent tgt = new org.hl7.fhir.r4.model.Contract.SecurityLabelComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.r5.model.UnsignedIntType t : src.getNumber()) + tgt.getNumber().add(convertUnsignedInt(t)); + if (src.hasClassification()) + tgt.setClassification(convertCoding(src.getClassification())); + for (org.hl7.fhir.r5.model.Coding t : src.getCategory()) + tgt.addCategory(convertCoding(t)); + for (org.hl7.fhir.r5.model.Coding t : src.getControl()) + tgt.addControl(convertCoding(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.Contract.ContractOfferComponent convertContractOfferComponent(org.hl7.fhir.r4.model.Contract.ContractOfferComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Contract.ContractOfferComponent tgt = new org.hl7.fhir.r5.model.Contract.ContractOfferComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + for (org.hl7.fhir.r4.model.Contract.ContractPartyComponent t : src.getParty()) + tgt.addParty(convertContractPartyComponent(t)); + if (src.hasTopic()) + tgt.setTopic(convertReference(src.getTopic())); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + if (src.hasDecision()) + tgt.setDecision(convertCodeableConcept(src.getDecision())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getDecisionMode()) + tgt.addDecisionMode(convertCodeableConcept(t)); + for (org.hl7.fhir.r4.model.Contract.AnswerComponent t : src.getAnswer()) + tgt.addAnswer(convertAnswerComponent(t)); + if (src.hasText()) + tgt.setTextElement(convertString(src.getTextElement())); + for (org.hl7.fhir.r4.model.StringType t : src.getLinkId()) + tgt.getLinkId().add(convertString(t)); + for (org.hl7.fhir.r4.model.UnsignedIntType t : src.getSecurityLabelNumber()) + tgt.getSecurityLabelNumber().add(convertUnsignedInt(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.Contract.ContractOfferComponent convertContractOfferComponent(org.hl7.fhir.r5.model.Contract.ContractOfferComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Contract.ContractOfferComponent tgt = new org.hl7.fhir.r4.model.Contract.ContractOfferComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + for (org.hl7.fhir.r5.model.Contract.ContractPartyComponent t : src.getParty()) + tgt.addParty(convertContractPartyComponent(t)); + if (src.hasTopic()) + tgt.setTopic(convertReference(src.getTopic())); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + if (src.hasDecision()) + tgt.setDecision(convertCodeableConcept(src.getDecision())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getDecisionMode()) + tgt.addDecisionMode(convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.Contract.AnswerComponent t : src.getAnswer()) + tgt.addAnswer(convertAnswerComponent(t)); + if (src.hasText()) + tgt.setTextElement(convertString(src.getTextElement())); + for (org.hl7.fhir.r5.model.StringType t : src.getLinkId()) + tgt.getLinkId().add(convertString(t)); + for (org.hl7.fhir.r5.model.UnsignedIntType t : src.getSecurityLabelNumber()) + tgt.getSecurityLabelNumber().add(convertUnsignedInt(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.Contract.ContractPartyComponent convertContractPartyComponent(org.hl7.fhir.r4.model.Contract.ContractPartyComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Contract.ContractPartyComponent tgt = new org.hl7.fhir.r5.model.Contract.ContractPartyComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.r4.model.Reference t : src.getReference()) + tgt.addReference(convertReference(t)); + if (src.hasRole()) + tgt.setRole(convertCodeableConcept(src.getRole())); + return tgt; + } + + public static org.hl7.fhir.r4.model.Contract.ContractPartyComponent convertContractPartyComponent(org.hl7.fhir.r5.model.Contract.ContractPartyComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Contract.ContractPartyComponent tgt = new org.hl7.fhir.r4.model.Contract.ContractPartyComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.r5.model.Reference t : src.getReference()) + tgt.addReference(convertReference(t)); + if (src.hasRole()) + tgt.setRole(convertCodeableConcept(src.getRole())); + return tgt; + } + + public static org.hl7.fhir.r5.model.Contract.AnswerComponent convertAnswerComponent(org.hl7.fhir.r4.model.Contract.AnswerComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Contract.AnswerComponent tgt = new org.hl7.fhir.r5.model.Contract.AnswerComponent(); + copyElement(src, tgt); + if (src.hasValue()) + tgt.setValue(convertType(src.getValue())); + return tgt; + } + + public static org.hl7.fhir.r4.model.Contract.AnswerComponent convertAnswerComponent(org.hl7.fhir.r5.model.Contract.AnswerComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Contract.AnswerComponent tgt = new org.hl7.fhir.r4.model.Contract.AnswerComponent(); + copyElement(src, tgt); + if (src.hasValue()) + tgt.setValue(convertType(src.getValue())); + return tgt; + } + + public static org.hl7.fhir.r5.model.Contract.ContractAssetComponent convertContractAssetComponent(org.hl7.fhir.r4.model.Contract.ContractAssetComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Contract.ContractAssetComponent tgt = new org.hl7.fhir.r5.model.Contract.ContractAssetComponent(); + copyElement(src, tgt); + if (src.hasScope()) + tgt.setScope(convertCodeableConcept(src.getScope())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getType()) + tgt.addType(convertCodeableConcept(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getTypeReference()) + tgt.addTypeReference(convertReference(t)); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getSubtype()) + tgt.addSubtype(convertCodeableConcept(t)); + if (src.hasRelationship()) + tgt.setRelationship(convertCoding(src.getRelationship())); + for (org.hl7.fhir.r4.model.Contract.AssetContextComponent t : src.getContext()) + tgt.addContext(convertAssetContextComponent(t)); + if (src.hasCondition()) + tgt.setConditionElement(convertString(src.getConditionElement())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getPeriodType()) + tgt.addPeriodType(convertCodeableConcept(t)); + for (org.hl7.fhir.r4.model.Period t : src.getPeriod()) + tgt.addPeriod(convertPeriod(t)); + for (org.hl7.fhir.r4.model.Period t : src.getUsePeriod()) + tgt.addUsePeriod(convertPeriod(t)); + if (src.hasText()) + tgt.setTextElement(convertString(src.getTextElement())); + for (org.hl7.fhir.r4.model.StringType t : src.getLinkId()) + tgt.getLinkId().add(convertString(t)); + for (org.hl7.fhir.r4.model.Contract.AnswerComponent t : src.getAnswer()) + tgt.addAnswer(convertAnswerComponent(t)); + for (org.hl7.fhir.r4.model.UnsignedIntType t : src.getSecurityLabelNumber()) + tgt.getSecurityLabelNumber().add(convertUnsignedInt(t)); + for (org.hl7.fhir.r4.model.Contract.ValuedItemComponent t : src.getValuedItem()) + tgt.addValuedItem(convertValuedItemComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.Contract.ContractAssetComponent convertContractAssetComponent(org.hl7.fhir.r5.model.Contract.ContractAssetComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Contract.ContractAssetComponent tgt = new org.hl7.fhir.r4.model.Contract.ContractAssetComponent(); + copyElement(src, tgt); + if (src.hasScope()) + tgt.setScope(convertCodeableConcept(src.getScope())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getType()) + tgt.addType(convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getTypeReference()) + tgt.addTypeReference(convertReference(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getSubtype()) + tgt.addSubtype(convertCodeableConcept(t)); + if (src.hasRelationship()) + tgt.setRelationship(convertCoding(src.getRelationship())); + for (org.hl7.fhir.r5.model.Contract.AssetContextComponent t : src.getContext()) + tgt.addContext(convertAssetContextComponent(t)); + if (src.hasCondition()) + tgt.setConditionElement(convertString(src.getConditionElement())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getPeriodType()) + tgt.addPeriodType(convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.Period t : src.getPeriod()) + tgt.addPeriod(convertPeriod(t)); + for (org.hl7.fhir.r5.model.Period t : src.getUsePeriod()) + tgt.addUsePeriod(convertPeriod(t)); + if (src.hasText()) + tgt.setTextElement(convertString(src.getTextElement())); + for (org.hl7.fhir.r5.model.StringType t : src.getLinkId()) + tgt.getLinkId().add(convertString(t)); + for (org.hl7.fhir.r5.model.Contract.AnswerComponent t : src.getAnswer()) + tgt.addAnswer(convertAnswerComponent(t)); + for (org.hl7.fhir.r5.model.UnsignedIntType t : src.getSecurityLabelNumber()) + tgt.getSecurityLabelNumber().add(convertUnsignedInt(t)); + for (org.hl7.fhir.r5.model.Contract.ValuedItemComponent t : src.getValuedItem()) + tgt.addValuedItem(convertValuedItemComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.Contract.AssetContextComponent convertAssetContextComponent(org.hl7.fhir.r4.model.Contract.AssetContextComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Contract.AssetContextComponent tgt = new org.hl7.fhir.r5.model.Contract.AssetContextComponent(); + copyElement(src, tgt); + if (src.hasReference()) + tgt.setReference(convertReference(src.getReference())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getCode()) + tgt.addCode(convertCodeableConcept(t)); + if (src.hasText()) + tgt.setTextElement(convertString(src.getTextElement())); + return tgt; + } + + public static org.hl7.fhir.r4.model.Contract.AssetContextComponent convertAssetContextComponent(org.hl7.fhir.r5.model.Contract.AssetContextComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Contract.AssetContextComponent tgt = new org.hl7.fhir.r4.model.Contract.AssetContextComponent(); + copyElement(src, tgt); + if (src.hasReference()) + tgt.setReference(convertReference(src.getReference())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getCode()) + tgt.addCode(convertCodeableConcept(t)); + if (src.hasText()) + tgt.setTextElement(convertString(src.getTextElement())); + return tgt; + } + + public static org.hl7.fhir.r5.model.Contract.ValuedItemComponent convertValuedItemComponent(org.hl7.fhir.r4.model.Contract.ValuedItemComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Contract.ValuedItemComponent tgt = new org.hl7.fhir.r5.model.Contract.ValuedItemComponent(); + copyElement(src, tgt); + if (src.hasEntity()) + tgt.setEntity(convertType(src.getEntity())); + if (src.hasIdentifier()) + tgt.setIdentifier(convertIdentifier(src.getIdentifier())); + if (src.hasEffectiveTime()) + tgt.setEffectiveTimeElement(convertDateTime(src.getEffectiveTimeElement())); + if (src.hasQuantity()) + tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); + if (src.hasUnitPrice()) + tgt.setUnitPrice(convertMoney(src.getUnitPrice())); + if (src.hasFactor()) + tgt.setFactorElement(convertDecimal(src.getFactorElement())); + if (src.hasPoints()) + tgt.setPointsElement(convertDecimal(src.getPointsElement())); + if (src.hasNet()) + tgt.setNet(convertMoney(src.getNet())); + if (src.hasPayment()) + tgt.setPaymentElement(convertString(src.getPaymentElement())); + if (src.hasPaymentDate()) + tgt.setPaymentDateElement(convertDateTime(src.getPaymentDateElement())); + if (src.hasResponsible()) + tgt.setResponsible(convertReference(src.getResponsible())); + if (src.hasRecipient()) + tgt.setRecipient(convertReference(src.getRecipient())); + for (org.hl7.fhir.r4.model.StringType t : src.getLinkId()) + tgt.getLinkId().add(convertString(t)); + for (org.hl7.fhir.r4.model.UnsignedIntType t : src.getSecurityLabelNumber()) + tgt.getSecurityLabelNumber().add(convertUnsignedInt(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.Contract.ValuedItemComponent convertValuedItemComponent(org.hl7.fhir.r5.model.Contract.ValuedItemComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Contract.ValuedItemComponent tgt = new org.hl7.fhir.r4.model.Contract.ValuedItemComponent(); + copyElement(src, tgt); + if (src.hasEntity()) + tgt.setEntity(convertType(src.getEntity())); + if (src.hasIdentifier()) + tgt.setIdentifier(convertIdentifier(src.getIdentifier())); + if (src.hasEffectiveTime()) + tgt.setEffectiveTimeElement(convertDateTime(src.getEffectiveTimeElement())); + if (src.hasQuantity()) + tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); + if (src.hasUnitPrice()) + tgt.setUnitPrice(convertMoney(src.getUnitPrice())); + if (src.hasFactor()) + tgt.setFactorElement(convertDecimal(src.getFactorElement())); + if (src.hasPoints()) + tgt.setPointsElement(convertDecimal(src.getPointsElement())); + if (src.hasNet()) + tgt.setNet(convertMoney(src.getNet())); + if (src.hasPayment()) + tgt.setPaymentElement(convertString(src.getPaymentElement())); + if (src.hasPaymentDate()) + tgt.setPaymentDateElement(convertDateTime(src.getPaymentDateElement())); + if (src.hasResponsible()) + tgt.setResponsible(convertReference(src.getResponsible())); + if (src.hasRecipient()) + tgt.setRecipient(convertReference(src.getRecipient())); + for (org.hl7.fhir.r5.model.StringType t : src.getLinkId()) + tgt.getLinkId().add(convertString(t)); + for (org.hl7.fhir.r5.model.UnsignedIntType t : src.getSecurityLabelNumber()) + tgt.getSecurityLabelNumber().add(convertUnsignedInt(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.Contract.ActionComponent convertActionComponent(org.hl7.fhir.r4.model.Contract.ActionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Contract.ActionComponent tgt = new org.hl7.fhir.r5.model.Contract.ActionComponent(); + copyElement(src, tgt); + if (src.hasDoNotPerform()) + tgt.setDoNotPerformElement(convertBoolean(src.getDoNotPerformElement())); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + for (org.hl7.fhir.r4.model.Contract.ActionSubjectComponent t : src.getSubject()) + tgt.addSubject(convertActionSubjectComponent(t)); + if (src.hasIntent()) + tgt.setIntent(convertCodeableConcept(src.getIntent())); + for (org.hl7.fhir.r4.model.StringType t : src.getLinkId()) + tgt.getLinkId().add(convertString(t)); + if (src.hasStatus()) + tgt.setStatus(convertCodeableConcept(src.getStatus())); + if (src.hasContext()) + tgt.setContext(convertReference(src.getContext())); + for (org.hl7.fhir.r4.model.StringType t : src.getContextLinkId()) + tgt.getContextLinkId().add(convertString(t)); + if (src.hasOccurrence()) + tgt.setOccurrence(convertType(src.getOccurrence())); + for (org.hl7.fhir.r4.model.Reference t : src.getRequester()) + tgt.addRequester(convertReference(t)); + for (org.hl7.fhir.r4.model.StringType t : src.getRequesterLinkId()) + tgt.getRequesterLinkId().add(convertString(t)); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getPerformerType()) + tgt.addPerformerType(convertCodeableConcept(t)); + if (src.hasPerformerRole()) + tgt.setPerformerRole(convertCodeableConcept(src.getPerformerRole())); + if (src.hasPerformer()) + tgt.setPerformer(convertReference(src.getPerformer())); + for (org.hl7.fhir.r4.model.StringType t : src.getPerformerLinkId()) + tgt.getPerformerLinkId().add(convertString(t)); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getReasonCode()) + tgt.addReasonCode(convertCodeableConcept(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getReasonReference()) + tgt.addReasonReference(convertReference(t)); + for (org.hl7.fhir.r4.model.StringType t : src.getReason()) + tgt.getReason().add(convertString(t)); + for (org.hl7.fhir.r4.model.StringType t : src.getReasonLinkId()) + tgt.getReasonLinkId().add(convertString(t)); + for (org.hl7.fhir.r4.model.Annotation t : src.getNote()) + tgt.addNote(convertAnnotation(t)); + for (org.hl7.fhir.r4.model.UnsignedIntType t : src.getSecurityLabelNumber()) + tgt.getSecurityLabelNumber().add(convertUnsignedInt(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.Contract.ActionComponent convertActionComponent(org.hl7.fhir.r5.model.Contract.ActionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Contract.ActionComponent tgt = new org.hl7.fhir.r4.model.Contract.ActionComponent(); + copyElement(src, tgt); + if (src.hasDoNotPerform()) + tgt.setDoNotPerformElement(convertBoolean(src.getDoNotPerformElement())); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + for (org.hl7.fhir.r5.model.Contract.ActionSubjectComponent t : src.getSubject()) + tgt.addSubject(convertActionSubjectComponent(t)); + if (src.hasIntent()) + tgt.setIntent(convertCodeableConcept(src.getIntent())); + for (org.hl7.fhir.r5.model.StringType t : src.getLinkId()) + tgt.getLinkId().add(convertString(t)); + if (src.hasStatus()) + tgt.setStatus(convertCodeableConcept(src.getStatus())); + if (src.hasContext()) + tgt.setContext(convertReference(src.getContext())); + for (org.hl7.fhir.r5.model.StringType t : src.getContextLinkId()) + tgt.getContextLinkId().add(convertString(t)); + if (src.hasOccurrence()) + tgt.setOccurrence(convertType(src.getOccurrence())); + for (org.hl7.fhir.r5.model.Reference t : src.getRequester()) + tgt.addRequester(convertReference(t)); + for (org.hl7.fhir.r5.model.StringType t : src.getRequesterLinkId()) + tgt.getRequesterLinkId().add(convertString(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getPerformerType()) + tgt.addPerformerType(convertCodeableConcept(t)); + if (src.hasPerformerRole()) + tgt.setPerformerRole(convertCodeableConcept(src.getPerformerRole())); + if (src.hasPerformer()) + tgt.setPerformer(convertReference(src.getPerformer())); + for (org.hl7.fhir.r5.model.StringType t : src.getPerformerLinkId()) + tgt.getPerformerLinkId().add(convertString(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getReasonCode()) + tgt.addReasonCode(convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getReasonReference()) + tgt.addReasonReference(convertReference(t)); + for (org.hl7.fhir.r5.model.StringType t : src.getReason()) + tgt.getReason().add(convertString(t)); + for (org.hl7.fhir.r5.model.StringType t : src.getReasonLinkId()) + tgt.getReasonLinkId().add(convertString(t)); + for (org.hl7.fhir.r5.model.Annotation t : src.getNote()) + tgt.addNote(convertAnnotation(t)); + for (org.hl7.fhir.r5.model.UnsignedIntType t : src.getSecurityLabelNumber()) + tgt.getSecurityLabelNumber().add(convertUnsignedInt(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.Contract.ActionSubjectComponent convertActionSubjectComponent(org.hl7.fhir.r4.model.Contract.ActionSubjectComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Contract.ActionSubjectComponent tgt = new org.hl7.fhir.r5.model.Contract.ActionSubjectComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.r4.model.Reference t : src.getReference()) + tgt.addReference(convertReference(t)); + if (src.hasRole()) + tgt.setRole(convertCodeableConcept(src.getRole())); + return tgt; + } + + public static org.hl7.fhir.r4.model.Contract.ActionSubjectComponent convertActionSubjectComponent(org.hl7.fhir.r5.model.Contract.ActionSubjectComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Contract.ActionSubjectComponent tgt = new org.hl7.fhir.r4.model.Contract.ActionSubjectComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.r5.model.Reference t : src.getReference()) + tgt.addReference(convertReference(t)); + if (src.hasRole()) + tgt.setRole(convertCodeableConcept(src.getRole())); + return tgt; + } + + public static org.hl7.fhir.r5.model.Contract.SignatoryComponent convertSignatoryComponent(org.hl7.fhir.r4.model.Contract.SignatoryComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Contract.SignatoryComponent tgt = new org.hl7.fhir.r5.model.Contract.SignatoryComponent(); + copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertCoding(src.getType())); + if (src.hasParty()) + tgt.setParty(convertReference(src.getParty())); + for (org.hl7.fhir.r4.model.Signature t : src.getSignature()) + tgt.addSignature(convertSignature(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.Contract.SignatoryComponent convertSignatoryComponent(org.hl7.fhir.r5.model.Contract.SignatoryComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Contract.SignatoryComponent tgt = new org.hl7.fhir.r4.model.Contract.SignatoryComponent(); + copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertCoding(src.getType())); + if (src.hasParty()) + tgt.setParty(convertReference(src.getParty())); + for (org.hl7.fhir.r5.model.Signature t : src.getSignature()) + tgt.addSignature(convertSignature(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.Contract.FriendlyLanguageComponent convertFriendlyLanguageComponent(org.hl7.fhir.r4.model.Contract.FriendlyLanguageComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Contract.FriendlyLanguageComponent tgt = new org.hl7.fhir.r5.model.Contract.FriendlyLanguageComponent(); + copyElement(src, tgt); + if (src.hasContent()) + tgt.setContent(convertType(src.getContent())); + return tgt; + } + + public static org.hl7.fhir.r4.model.Contract.FriendlyLanguageComponent convertFriendlyLanguageComponent(org.hl7.fhir.r5.model.Contract.FriendlyLanguageComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Contract.FriendlyLanguageComponent tgt = new org.hl7.fhir.r4.model.Contract.FriendlyLanguageComponent(); + copyElement(src, tgt); + if (src.hasContent()) + tgt.setContent(convertType(src.getContent())); + return tgt; + } + + public static org.hl7.fhir.r5.model.Contract.LegalLanguageComponent convertLegalLanguageComponent(org.hl7.fhir.r4.model.Contract.LegalLanguageComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Contract.LegalLanguageComponent tgt = new org.hl7.fhir.r5.model.Contract.LegalLanguageComponent(); + copyElement(src, tgt); + if (src.hasContent()) + tgt.setContent(convertType(src.getContent())); + return tgt; + } + + public static org.hl7.fhir.r4.model.Contract.LegalLanguageComponent convertLegalLanguageComponent(org.hl7.fhir.r5.model.Contract.LegalLanguageComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Contract.LegalLanguageComponent tgt = new org.hl7.fhir.r4.model.Contract.LegalLanguageComponent(); + copyElement(src, tgt); + if (src.hasContent()) + tgt.setContent(convertType(src.getContent())); + return tgt; + } + + public static org.hl7.fhir.r5.model.Contract.ComputableLanguageComponent convertComputableLanguageComponent(org.hl7.fhir.r4.model.Contract.ComputableLanguageComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Contract.ComputableLanguageComponent tgt = new org.hl7.fhir.r5.model.Contract.ComputableLanguageComponent(); + copyElement(src, tgt); + if (src.hasContent()) + tgt.setContent(convertType(src.getContent())); + return tgt; + } + + public static org.hl7.fhir.r4.model.Contract.ComputableLanguageComponent convertComputableLanguageComponent(org.hl7.fhir.r5.model.Contract.ComputableLanguageComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Contract.ComputableLanguageComponent tgt = new org.hl7.fhir.r4.model.Contract.ComputableLanguageComponent(); + copyElement(src, tgt); + if (src.hasContent()) + tgt.setContent(convertType(src.getContent())); + return tgt; + } + + +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Coverage.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Coverage.java new file mode 100644 index 000000000..1b31c2344 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Coverage.java @@ -0,0 +1,231 @@ +package org.hl7.fhir.convertors.conv40_50; + +import org.hl7.fhir.exceptions.FHIRException; + +import org.hl7.fhir.convertors.VersionConvertor_40_50; + + +/* + Copyright (c) 2011+, HL7, Inc. + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of HL7 nor the names of its contributors may be used to + endorse or promote products derived from this software without specific + prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + +*/ + +// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0 + + +public class Coverage extends VersionConvertor_40_50 { + + public static org.hl7.fhir.r5.model.Coverage convertCoverage(org.hl7.fhir.r4.model.Coverage src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Coverage tgt = new org.hl7.fhir.r5.model.Coverage(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasStatus()) + tgt.setStatus(convertCoverageStatus(src.getStatus())); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + if (src.hasPolicyHolder()) + tgt.setPolicyHolder(convertReference(src.getPolicyHolder())); + if (src.hasSubscriber()) + tgt.setSubscriber(convertReference(src.getSubscriber())); + if (src.hasSubscriberId()) + tgt.setSubscriberIdElement(convertString(src.getSubscriberIdElement())); + if (src.hasBeneficiary()) + tgt.setBeneficiary(convertReference(src.getBeneficiary())); + if (src.hasDependent()) + tgt.setDependentElement(convertString(src.getDependentElement())); + if (src.hasRelationship()) + tgt.setRelationship(convertCodeableConcept(src.getRelationship())); + if (src.hasPeriod()) + tgt.setPeriod(convertPeriod(src.getPeriod())); + for (org.hl7.fhir.r4.model.Reference t : src.getPayor()) + tgt.addPayor(convertReference(t)); + for (org.hl7.fhir.r4.model.Coverage.ClassComponent t : src.getClass_()) + tgt.addClass_(convertClassComponent(t)); + if (src.hasOrder()) + tgt.setOrderElement(convertPositiveInt(src.getOrderElement())); + if (src.hasNetwork()) + tgt.setNetworkElement(convertString(src.getNetworkElement())); + for (org.hl7.fhir.r4.model.Coverage.CostToBeneficiaryComponent t : src.getCostToBeneficiary()) + tgt.addCostToBeneficiary(convertCostToBeneficiaryComponent(t)); + if (src.hasSubrogation()) + tgt.setSubrogationElement(convertBoolean(src.getSubrogationElement())); + for (org.hl7.fhir.r4.model.Reference t : src.getContract()) + tgt.addContract(convertReference(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.Coverage convertCoverage(org.hl7.fhir.r5.model.Coverage src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Coverage tgt = new org.hl7.fhir.r4.model.Coverage(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasStatus()) + tgt.setStatus(convertCoverageStatus(src.getStatus())); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + if (src.hasPolicyHolder()) + tgt.setPolicyHolder(convertReference(src.getPolicyHolder())); + if (src.hasSubscriber()) + tgt.setSubscriber(convertReference(src.getSubscriber())); + if (src.hasSubscriberId()) + tgt.setSubscriberIdElement(convertString(src.getSubscriberIdElement())); + if (src.hasBeneficiary()) + tgt.setBeneficiary(convertReference(src.getBeneficiary())); + if (src.hasDependent()) + tgt.setDependentElement(convertString(src.getDependentElement())); + if (src.hasRelationship()) + tgt.setRelationship(convertCodeableConcept(src.getRelationship())); + if (src.hasPeriod()) + tgt.setPeriod(convertPeriod(src.getPeriod())); + for (org.hl7.fhir.r5.model.Reference t : src.getPayor()) + tgt.addPayor(convertReference(t)); + for (org.hl7.fhir.r5.model.Coverage.ClassComponent t : src.getClass_()) + tgt.addClass_(convertClassComponent(t)); + if (src.hasOrder()) + tgt.setOrderElement(convertPositiveInt(src.getOrderElement())); + if (src.hasNetwork()) + tgt.setNetworkElement(convertString(src.getNetworkElement())); + for (org.hl7.fhir.r5.model.Coverage.CostToBeneficiaryComponent t : src.getCostToBeneficiary()) + tgt.addCostToBeneficiary(convertCostToBeneficiaryComponent(t)); + if (src.hasSubrogation()) + tgt.setSubrogationElement(convertBoolean(src.getSubrogationElement())); + for (org.hl7.fhir.r5.model.Reference t : src.getContract()) + tgt.addContract(convertReference(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.Coverage.CoverageStatus convertCoverageStatus(org.hl7.fhir.r4.model.Coverage.CoverageStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case ACTIVE: return org.hl7.fhir.r5.model.Coverage.CoverageStatus.ACTIVE; + case CANCELLED: return org.hl7.fhir.r5.model.Coverage.CoverageStatus.CANCELLED; + case DRAFT: return org.hl7.fhir.r5.model.Coverage.CoverageStatus.DRAFT; + case ENTEREDINERROR: return org.hl7.fhir.r5.model.Coverage.CoverageStatus.ENTEREDINERROR; + default: return org.hl7.fhir.r5.model.Coverage.CoverageStatus.NULL; + } +} + + public static org.hl7.fhir.r4.model.Coverage.CoverageStatus convertCoverageStatus(org.hl7.fhir.r5.model.Coverage.CoverageStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case ACTIVE: return org.hl7.fhir.r4.model.Coverage.CoverageStatus.ACTIVE; + case CANCELLED: return org.hl7.fhir.r4.model.Coverage.CoverageStatus.CANCELLED; + case DRAFT: return org.hl7.fhir.r4.model.Coverage.CoverageStatus.DRAFT; + case ENTEREDINERROR: return org.hl7.fhir.r4.model.Coverage.CoverageStatus.ENTEREDINERROR; + default: return org.hl7.fhir.r4.model.Coverage.CoverageStatus.NULL; + } +} + + public static org.hl7.fhir.r5.model.Coverage.ClassComponent convertClassComponent(org.hl7.fhir.r4.model.Coverage.ClassComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Coverage.ClassComponent tgt = new org.hl7.fhir.r5.model.Coverage.ClassComponent(); + copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + if (src.hasValue()) + tgt.setValueElement(convertString(src.getValueElement())); + if (src.hasName()) + tgt.setNameElement(convertString(src.getNameElement())); + return tgt; + } + + public static org.hl7.fhir.r4.model.Coverage.ClassComponent convertClassComponent(org.hl7.fhir.r5.model.Coverage.ClassComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Coverage.ClassComponent tgt = new org.hl7.fhir.r4.model.Coverage.ClassComponent(); + copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + if (src.hasValue()) + tgt.setValueElement(convertString(src.getValueElement())); + if (src.hasName()) + tgt.setNameElement(convertString(src.getNameElement())); + return tgt; + } + + public static org.hl7.fhir.r5.model.Coverage.CostToBeneficiaryComponent convertCostToBeneficiaryComponent(org.hl7.fhir.r4.model.Coverage.CostToBeneficiaryComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Coverage.CostToBeneficiaryComponent tgt = new org.hl7.fhir.r5.model.Coverage.CostToBeneficiaryComponent(); + copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + if (src.hasValue()) + tgt.setValue(convertType(src.getValue())); + for (org.hl7.fhir.r4.model.Coverage.ExemptionComponent t : src.getException()) + tgt.addException(convertExemptionComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.Coverage.CostToBeneficiaryComponent convertCostToBeneficiaryComponent(org.hl7.fhir.r5.model.Coverage.CostToBeneficiaryComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Coverage.CostToBeneficiaryComponent tgt = new org.hl7.fhir.r4.model.Coverage.CostToBeneficiaryComponent(); + copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + if (src.hasValue()) + tgt.setValue(convertType(src.getValue())); + for (org.hl7.fhir.r5.model.Coverage.ExemptionComponent t : src.getException()) + tgt.addException(convertExemptionComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.Coverage.ExemptionComponent convertExemptionComponent(org.hl7.fhir.r4.model.Coverage.ExemptionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Coverage.ExemptionComponent tgt = new org.hl7.fhir.r5.model.Coverage.ExemptionComponent(); + copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + if (src.hasPeriod()) + tgt.setPeriod(convertPeriod(src.getPeriod())); + return tgt; + } + + public static org.hl7.fhir.r4.model.Coverage.ExemptionComponent convertExemptionComponent(org.hl7.fhir.r5.model.Coverage.ExemptionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Coverage.ExemptionComponent tgt = new org.hl7.fhir.r4.model.Coverage.ExemptionComponent(); + copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + if (src.hasPeriod()) + tgt.setPeriod(convertPeriod(src.getPeriod())); + return tgt; + } + + +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/CoverageEligibilityRequest.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/CoverageEligibilityRequest.java new file mode 100644 index 000000000..ee2c48b3e --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/CoverageEligibilityRequest.java @@ -0,0 +1,295 @@ +package org.hl7.fhir.convertors.conv40_50; + +import org.hl7.fhir.exceptions.FHIRException; + +import org.hl7.fhir.convertors.VersionConvertor_40_50; + + +/* + Copyright (c) 2011+, HL7, Inc. + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of HL7 nor the names of its contributors may be used to + endorse or promote products derived from this software without specific + prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + +*/ + +// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0 + + +public class CoverageEligibilityRequest extends VersionConvertor_40_50 { + + public static org.hl7.fhir.r5.model.CoverageEligibilityRequest convertCoverageEligibilityRequest(org.hl7.fhir.r4.model.CoverageEligibilityRequest src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.CoverageEligibilityRequest tgt = new org.hl7.fhir.r5.model.CoverageEligibilityRequest(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasStatus()) + tgt.setStatus(convertEligibilityRequestStatus(src.getStatus())); + if (src.hasPriority()) + tgt.setPriority(convertCodeableConcept(src.getPriority())); + for (org.hl7.fhir.r4.model.Enumeration t : src.getPurpose()) + tgt.addPurpose(convertEligibilityRequestPurpose(t.getValue())); + if (src.hasPatient()) + tgt.setPatient(convertReference(src.getPatient())); + if (src.hasServiced()) + tgt.setServiced(convertType(src.getServiced())); + if (src.hasCreated()) + tgt.setCreatedElement(convertDateTime(src.getCreatedElement())); + if (src.hasEnterer()) + tgt.setEnterer(convertReference(src.getEnterer())); + if (src.hasProvider()) + tgt.setProvider(convertReference(src.getProvider())); + if (src.hasInsurer()) + tgt.setInsurer(convertReference(src.getInsurer())); + if (src.hasFacility()) + tgt.setFacility(convertReference(src.getFacility())); + for (org.hl7.fhir.r4.model.CoverageEligibilityRequest.SupportingInformationComponent t : src.getSupportingInfo()) + tgt.addSupportingInfo(convertSupportingInformationComponent(t)); + for (org.hl7.fhir.r4.model.CoverageEligibilityRequest.InsuranceComponent t : src.getInsurance()) + tgt.addInsurance(convertInsuranceComponent(t)); + for (org.hl7.fhir.r4.model.CoverageEligibilityRequest.DetailsComponent t : src.getItem()) + tgt.addItem(convertDetailsComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.CoverageEligibilityRequest convertCoverageEligibilityRequest(org.hl7.fhir.r5.model.CoverageEligibilityRequest src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.CoverageEligibilityRequest tgt = new org.hl7.fhir.r4.model.CoverageEligibilityRequest(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasStatus()) + tgt.setStatus(convertEligibilityRequestStatus(src.getStatus())); + if (src.hasPriority()) + tgt.setPriority(convertCodeableConcept(src.getPriority())); + for (org.hl7.fhir.r5.model.Enumeration t : src.getPurpose()) + tgt.addPurpose(convertEligibilityRequestPurpose(t.getValue())); + if (src.hasPatient()) + tgt.setPatient(convertReference(src.getPatient())); + if (src.hasServiced()) + tgt.setServiced(convertType(src.getServiced())); + if (src.hasCreated()) + tgt.setCreatedElement(convertDateTime(src.getCreatedElement())); + if (src.hasEnterer()) + tgt.setEnterer(convertReference(src.getEnterer())); + if (src.hasProvider()) + tgt.setProvider(convertReference(src.getProvider())); + if (src.hasInsurer()) + tgt.setInsurer(convertReference(src.getInsurer())); + if (src.hasFacility()) + tgt.setFacility(convertReference(src.getFacility())); + for (org.hl7.fhir.r5.model.CoverageEligibilityRequest.SupportingInformationComponent t : src.getSupportingInfo()) + tgt.addSupportingInfo(convertSupportingInformationComponent(t)); + for (org.hl7.fhir.r5.model.CoverageEligibilityRequest.InsuranceComponent t : src.getInsurance()) + tgt.addInsurance(convertInsuranceComponent(t)); + for (org.hl7.fhir.r5.model.CoverageEligibilityRequest.DetailsComponent t : src.getItem()) + tgt.addItem(convertDetailsComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.CoverageEligibilityRequest.EligibilityRequestStatus convertEligibilityRequestStatus(org.hl7.fhir.r4.model.CoverageEligibilityRequest.EligibilityRequestStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case ACTIVE: return org.hl7.fhir.r5.model.CoverageEligibilityRequest.EligibilityRequestStatus.ACTIVE; + case CANCELLED: return org.hl7.fhir.r5.model.CoverageEligibilityRequest.EligibilityRequestStatus.CANCELLED; + case DRAFT: return org.hl7.fhir.r5.model.CoverageEligibilityRequest.EligibilityRequestStatus.DRAFT; + case ENTEREDINERROR: return org.hl7.fhir.r5.model.CoverageEligibilityRequest.EligibilityRequestStatus.ENTEREDINERROR; + default: return org.hl7.fhir.r5.model.CoverageEligibilityRequest.EligibilityRequestStatus.NULL; + } +} + + public static org.hl7.fhir.r4.model.CoverageEligibilityRequest.EligibilityRequestStatus convertEligibilityRequestStatus(org.hl7.fhir.r5.model.CoverageEligibilityRequest.EligibilityRequestStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case ACTIVE: return org.hl7.fhir.r4.model.CoverageEligibilityRequest.EligibilityRequestStatus.ACTIVE; + case CANCELLED: return org.hl7.fhir.r4.model.CoverageEligibilityRequest.EligibilityRequestStatus.CANCELLED; + case DRAFT: return org.hl7.fhir.r4.model.CoverageEligibilityRequest.EligibilityRequestStatus.DRAFT; + case ENTEREDINERROR: return org.hl7.fhir.r4.model.CoverageEligibilityRequest.EligibilityRequestStatus.ENTEREDINERROR; + default: return org.hl7.fhir.r4.model.CoverageEligibilityRequest.EligibilityRequestStatus.NULL; + } +} + + public static org.hl7.fhir.r5.model.CoverageEligibilityRequest.EligibilityRequestPurpose convertEligibilityRequestPurpose(org.hl7.fhir.r4.model.CoverageEligibilityRequest.EligibilityRequestPurpose src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case AUTHREQUIREMENTS: return org.hl7.fhir.r5.model.CoverageEligibilityRequest.EligibilityRequestPurpose.AUTHREQUIREMENTS; + case BENEFITS: return org.hl7.fhir.r5.model.CoverageEligibilityRequest.EligibilityRequestPurpose.BENEFITS; + case DISCOVERY: return org.hl7.fhir.r5.model.CoverageEligibilityRequest.EligibilityRequestPurpose.DISCOVERY; + case VALIDATION: return org.hl7.fhir.r5.model.CoverageEligibilityRequest.EligibilityRequestPurpose.VALIDATION; + default: return org.hl7.fhir.r5.model.CoverageEligibilityRequest.EligibilityRequestPurpose.NULL; + } +} + + public static org.hl7.fhir.r4.model.CoverageEligibilityRequest.EligibilityRequestPurpose convertEligibilityRequestPurpose(org.hl7.fhir.r5.model.CoverageEligibilityRequest.EligibilityRequestPurpose src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case AUTHREQUIREMENTS: return org.hl7.fhir.r4.model.CoverageEligibilityRequest.EligibilityRequestPurpose.AUTHREQUIREMENTS; + case BENEFITS: return org.hl7.fhir.r4.model.CoverageEligibilityRequest.EligibilityRequestPurpose.BENEFITS; + case DISCOVERY: return org.hl7.fhir.r4.model.CoverageEligibilityRequest.EligibilityRequestPurpose.DISCOVERY; + case VALIDATION: return org.hl7.fhir.r4.model.CoverageEligibilityRequest.EligibilityRequestPurpose.VALIDATION; + default: return org.hl7.fhir.r4.model.CoverageEligibilityRequest.EligibilityRequestPurpose.NULL; + } +} + + public static org.hl7.fhir.r5.model.CoverageEligibilityRequest.SupportingInformationComponent convertSupportingInformationComponent(org.hl7.fhir.r4.model.CoverageEligibilityRequest.SupportingInformationComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.CoverageEligibilityRequest.SupportingInformationComponent tgt = new org.hl7.fhir.r5.model.CoverageEligibilityRequest.SupportingInformationComponent(); + copyElement(src, tgt); + if (src.hasSequence()) + tgt.setSequenceElement(convertPositiveInt(src.getSequenceElement())); + if (src.hasInformation()) + tgt.setInformation(convertReference(src.getInformation())); + if (src.hasAppliesToAll()) + tgt.setAppliesToAllElement(convertBoolean(src.getAppliesToAllElement())); + return tgt; + } + + public static org.hl7.fhir.r4.model.CoverageEligibilityRequest.SupportingInformationComponent convertSupportingInformationComponent(org.hl7.fhir.r5.model.CoverageEligibilityRequest.SupportingInformationComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.CoverageEligibilityRequest.SupportingInformationComponent tgt = new org.hl7.fhir.r4.model.CoverageEligibilityRequest.SupportingInformationComponent(); + copyElement(src, tgt); + if (src.hasSequence()) + tgt.setSequenceElement(convertPositiveInt(src.getSequenceElement())); + if (src.hasInformation()) + tgt.setInformation(convertReference(src.getInformation())); + if (src.hasAppliesToAll()) + tgt.setAppliesToAllElement(convertBoolean(src.getAppliesToAllElement())); + return tgt; + } + + public static org.hl7.fhir.r5.model.CoverageEligibilityRequest.InsuranceComponent convertInsuranceComponent(org.hl7.fhir.r4.model.CoverageEligibilityRequest.InsuranceComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.CoverageEligibilityRequest.InsuranceComponent tgt = new org.hl7.fhir.r5.model.CoverageEligibilityRequest.InsuranceComponent(); + copyElement(src, tgt); + if (src.hasFocal()) + tgt.setFocalElement(convertBoolean(src.getFocalElement())); + if (src.hasCoverage()) + tgt.setCoverage(convertReference(src.getCoverage())); + if (src.hasBusinessArrangement()) + tgt.setBusinessArrangementElement(convertString(src.getBusinessArrangementElement())); + return tgt; + } + + public static org.hl7.fhir.r4.model.CoverageEligibilityRequest.InsuranceComponent convertInsuranceComponent(org.hl7.fhir.r5.model.CoverageEligibilityRequest.InsuranceComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.CoverageEligibilityRequest.InsuranceComponent tgt = new org.hl7.fhir.r4.model.CoverageEligibilityRequest.InsuranceComponent(); + copyElement(src, tgt); + if (src.hasFocal()) + tgt.setFocalElement(convertBoolean(src.getFocalElement())); + if (src.hasCoverage()) + tgt.setCoverage(convertReference(src.getCoverage())); + if (src.hasBusinessArrangement()) + tgt.setBusinessArrangementElement(convertString(src.getBusinessArrangementElement())); + return tgt; + } + + public static org.hl7.fhir.r5.model.CoverageEligibilityRequest.DetailsComponent convertDetailsComponent(org.hl7.fhir.r4.model.CoverageEligibilityRequest.DetailsComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.CoverageEligibilityRequest.DetailsComponent tgt = new org.hl7.fhir.r5.model.CoverageEligibilityRequest.DetailsComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.r4.model.PositiveIntType t : src.getSupportingInfoSequence()) + tgt.getSupportingInfoSequence().add(convertPositiveInt(t)); + if (src.hasCategory()) + tgt.setCategory(convertCodeableConcept(src.getCategory())); + if (src.hasProductOrService()) + tgt.setProductOrService(convertCodeableConcept(src.getProductOrService())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getModifier()) + tgt.addModifier(convertCodeableConcept(t)); + if (src.hasProvider()) + tgt.setProvider(convertReference(src.getProvider())); + if (src.hasQuantity()) + tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); + if (src.hasUnitPrice()) + tgt.setUnitPrice(convertMoney(src.getUnitPrice())); + if (src.hasFacility()) + tgt.setFacility(convertReference(src.getFacility())); + for (org.hl7.fhir.r4.model.CoverageEligibilityRequest.DiagnosisComponent t : src.getDiagnosis()) + tgt.addDiagnosis(convertDiagnosisComponent(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getDetail()) + tgt.addDetail(convertReference(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.CoverageEligibilityRequest.DetailsComponent convertDetailsComponent(org.hl7.fhir.r5.model.CoverageEligibilityRequest.DetailsComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.CoverageEligibilityRequest.DetailsComponent tgt = new org.hl7.fhir.r4.model.CoverageEligibilityRequest.DetailsComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.r5.model.PositiveIntType t : src.getSupportingInfoSequence()) + tgt.getSupportingInfoSequence().add(convertPositiveInt(t)); + if (src.hasCategory()) + tgt.setCategory(convertCodeableConcept(src.getCategory())); + if (src.hasProductOrService()) + tgt.setProductOrService(convertCodeableConcept(src.getProductOrService())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getModifier()) + tgt.addModifier(convertCodeableConcept(t)); + if (src.hasProvider()) + tgt.setProvider(convertReference(src.getProvider())); + if (src.hasQuantity()) + tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); + if (src.hasUnitPrice()) + tgt.setUnitPrice(convertMoney(src.getUnitPrice())); + if (src.hasFacility()) + tgt.setFacility(convertReference(src.getFacility())); + for (org.hl7.fhir.r5.model.CoverageEligibilityRequest.DiagnosisComponent t : src.getDiagnosis()) + tgt.addDiagnosis(convertDiagnosisComponent(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getDetail()) + tgt.addDetail(convertReference(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.CoverageEligibilityRequest.DiagnosisComponent convertDiagnosisComponent(org.hl7.fhir.r4.model.CoverageEligibilityRequest.DiagnosisComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.CoverageEligibilityRequest.DiagnosisComponent tgt = new org.hl7.fhir.r5.model.CoverageEligibilityRequest.DiagnosisComponent(); + copyElement(src, tgt); + if (src.hasDiagnosis()) + tgt.setDiagnosis(convertType(src.getDiagnosis())); + return tgt; + } + + public static org.hl7.fhir.r4.model.CoverageEligibilityRequest.DiagnosisComponent convertDiagnosisComponent(org.hl7.fhir.r5.model.CoverageEligibilityRequest.DiagnosisComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.CoverageEligibilityRequest.DiagnosisComponent tgt = new org.hl7.fhir.r4.model.CoverageEligibilityRequest.DiagnosisComponent(); + copyElement(src, tgt); + if (src.hasDiagnosis()) + tgt.setDiagnosis(convertType(src.getDiagnosis())); + return tgt; + } + + +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/CoverageEligibilityResponse.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/CoverageEligibilityResponse.java new file mode 100644 index 000000000..ba376df0a --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/CoverageEligibilityResponse.java @@ -0,0 +1,343 @@ +package org.hl7.fhir.convertors.conv40_50; + +import org.hl7.fhir.exceptions.FHIRException; + +import org.hl7.fhir.convertors.VersionConvertor_40_50; + + +/* + Copyright (c) 2011+, HL7, Inc. + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of HL7 nor the names of its contributors may be used to + endorse or promote products derived from this software without specific + prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + +*/ + +// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0 + + +public class CoverageEligibilityResponse extends VersionConvertor_40_50 { + + public static org.hl7.fhir.r5.model.CoverageEligibilityResponse convertCoverageEligibilityResponse(org.hl7.fhir.r4.model.CoverageEligibilityResponse src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.CoverageEligibilityResponse tgt = new org.hl7.fhir.r5.model.CoverageEligibilityResponse(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasStatus()) + tgt.setStatus(convertEligibilityResponseStatus(src.getStatus())); + for (org.hl7.fhir.r4.model.Enumeration t : src.getPurpose()) + tgt.addPurpose(convertEligibilityResponsePurpose(t.getValue())); + if (src.hasPatient()) + tgt.setPatient(convertReference(src.getPatient())); + if (src.hasServiced()) + tgt.setServiced(convertType(src.getServiced())); + if (src.hasCreated()) + tgt.setCreatedElement(convertDateTime(src.getCreatedElement())); + if (src.hasRequestor()) + tgt.setRequestor(convertReference(src.getRequestor())); + if (src.hasRequest()) + tgt.setRequest(convertReference(src.getRequest())); + if (src.hasOutcome()) + tgt.setOutcome(convertRemittanceOutcome(src.getOutcome())); + if (src.hasDisposition()) + tgt.setDispositionElement(convertString(src.getDispositionElement())); + if (src.hasInsurer()) + tgt.setInsurer(convertReference(src.getInsurer())); + for (org.hl7.fhir.r4.model.CoverageEligibilityResponse.InsuranceComponent t : src.getInsurance()) + tgt.addInsurance(convertInsuranceComponent(t)); + if (src.hasPreAuthRef()) + tgt.setPreAuthRefElement(convertString(src.getPreAuthRefElement())); + if (src.hasForm()) + tgt.setForm(convertCodeableConcept(src.getForm())); + for (org.hl7.fhir.r4.model.CoverageEligibilityResponse.ErrorsComponent t : src.getError()) + tgt.addError(convertErrorsComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.CoverageEligibilityResponse convertCoverageEligibilityResponse(org.hl7.fhir.r5.model.CoverageEligibilityResponse src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.CoverageEligibilityResponse tgt = new org.hl7.fhir.r4.model.CoverageEligibilityResponse(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasStatus()) + tgt.setStatus(convertEligibilityResponseStatus(src.getStatus())); + for (org.hl7.fhir.r5.model.Enumeration t : src.getPurpose()) + tgt.addPurpose(convertEligibilityResponsePurpose(t.getValue())); + if (src.hasPatient()) + tgt.setPatient(convertReference(src.getPatient())); + if (src.hasServiced()) + tgt.setServiced(convertType(src.getServiced())); + if (src.hasCreated()) + tgt.setCreatedElement(convertDateTime(src.getCreatedElement())); + if (src.hasRequestor()) + tgt.setRequestor(convertReference(src.getRequestor())); + if (src.hasRequest()) + tgt.setRequest(convertReference(src.getRequest())); + if (src.hasOutcome()) + tgt.setOutcome(convertRemittanceOutcome(src.getOutcome())); + if (src.hasDisposition()) + tgt.setDispositionElement(convertString(src.getDispositionElement())); + if (src.hasInsurer()) + tgt.setInsurer(convertReference(src.getInsurer())); + for (org.hl7.fhir.r5.model.CoverageEligibilityResponse.InsuranceComponent t : src.getInsurance()) + tgt.addInsurance(convertInsuranceComponent(t)); + if (src.hasPreAuthRef()) + tgt.setPreAuthRefElement(convertString(src.getPreAuthRefElement())); + if (src.hasForm()) + tgt.setForm(convertCodeableConcept(src.getForm())); + for (org.hl7.fhir.r5.model.CoverageEligibilityResponse.ErrorsComponent t : src.getError()) + tgt.addError(convertErrorsComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.CoverageEligibilityResponse.EligibilityResponseStatus convertEligibilityResponseStatus(org.hl7.fhir.r4.model.CoverageEligibilityResponse.EligibilityResponseStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case ACTIVE: return org.hl7.fhir.r5.model.CoverageEligibilityResponse.EligibilityResponseStatus.ACTIVE; + case CANCELLED: return org.hl7.fhir.r5.model.CoverageEligibilityResponse.EligibilityResponseStatus.CANCELLED; + case DRAFT: return org.hl7.fhir.r5.model.CoverageEligibilityResponse.EligibilityResponseStatus.DRAFT; + case ENTEREDINERROR: return org.hl7.fhir.r5.model.CoverageEligibilityResponse.EligibilityResponseStatus.ENTEREDINERROR; + default: return org.hl7.fhir.r5.model.CoverageEligibilityResponse.EligibilityResponseStatus.NULL; + } +} + + public static org.hl7.fhir.r4.model.CoverageEligibilityResponse.EligibilityResponseStatus convertEligibilityResponseStatus(org.hl7.fhir.r5.model.CoverageEligibilityResponse.EligibilityResponseStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case ACTIVE: return org.hl7.fhir.r4.model.CoverageEligibilityResponse.EligibilityResponseStatus.ACTIVE; + case CANCELLED: return org.hl7.fhir.r4.model.CoverageEligibilityResponse.EligibilityResponseStatus.CANCELLED; + case DRAFT: return org.hl7.fhir.r4.model.CoverageEligibilityResponse.EligibilityResponseStatus.DRAFT; + case ENTEREDINERROR: return org.hl7.fhir.r4.model.CoverageEligibilityResponse.EligibilityResponseStatus.ENTEREDINERROR; + default: return org.hl7.fhir.r4.model.CoverageEligibilityResponse.EligibilityResponseStatus.NULL; + } +} + + public static org.hl7.fhir.r5.model.CoverageEligibilityResponse.EligibilityResponsePurpose convertEligibilityResponsePurpose(org.hl7.fhir.r4.model.CoverageEligibilityResponse.EligibilityResponsePurpose src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case AUTHREQUIREMENTS: return org.hl7.fhir.r5.model.CoverageEligibilityResponse.EligibilityResponsePurpose.AUTHREQUIREMENTS; + case BENEFITS: return org.hl7.fhir.r5.model.CoverageEligibilityResponse.EligibilityResponsePurpose.BENEFITS; + case DISCOVERY: return org.hl7.fhir.r5.model.CoverageEligibilityResponse.EligibilityResponsePurpose.DISCOVERY; + case VALIDATION: return org.hl7.fhir.r5.model.CoverageEligibilityResponse.EligibilityResponsePurpose.VALIDATION; + default: return org.hl7.fhir.r5.model.CoverageEligibilityResponse.EligibilityResponsePurpose.NULL; + } +} + + public static org.hl7.fhir.r4.model.CoverageEligibilityResponse.EligibilityResponsePurpose convertEligibilityResponsePurpose(org.hl7.fhir.r5.model.CoverageEligibilityResponse.EligibilityResponsePurpose src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case AUTHREQUIREMENTS: return org.hl7.fhir.r4.model.CoverageEligibilityResponse.EligibilityResponsePurpose.AUTHREQUIREMENTS; + case BENEFITS: return org.hl7.fhir.r4.model.CoverageEligibilityResponse.EligibilityResponsePurpose.BENEFITS; + case DISCOVERY: return org.hl7.fhir.r4.model.CoverageEligibilityResponse.EligibilityResponsePurpose.DISCOVERY; + case VALIDATION: return org.hl7.fhir.r4.model.CoverageEligibilityResponse.EligibilityResponsePurpose.VALIDATION; + default: return org.hl7.fhir.r4.model.CoverageEligibilityResponse.EligibilityResponsePurpose.NULL; + } +} + + public static org.hl7.fhir.r5.model.Enumerations.RemittanceOutcome convertRemittanceOutcome(org.hl7.fhir.r4.model.Enumerations.RemittanceOutcome src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case QUEUED: return org.hl7.fhir.r5.model.Enumerations.RemittanceOutcome.QUEUED; + case COMPLETE: return org.hl7.fhir.r5.model.Enumerations.RemittanceOutcome.COMPLETE; + case ERROR: return org.hl7.fhir.r5.model.Enumerations.RemittanceOutcome.ERROR; + case PARTIAL: return org.hl7.fhir.r5.model.Enumerations.RemittanceOutcome.PARTIAL; + default: return org.hl7.fhir.r5.model.Enumerations.RemittanceOutcome.NULL; + } +} + + public static org.hl7.fhir.r4.model.Enumerations.RemittanceOutcome convertRemittanceOutcome(org.hl7.fhir.r5.model.Enumerations.RemittanceOutcome src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case QUEUED: return org.hl7.fhir.r4.model.Enumerations.RemittanceOutcome.QUEUED; + case COMPLETE: return org.hl7.fhir.r4.model.Enumerations.RemittanceOutcome.COMPLETE; + case ERROR: return org.hl7.fhir.r4.model.Enumerations.RemittanceOutcome.ERROR; + case PARTIAL: return org.hl7.fhir.r4.model.Enumerations.RemittanceOutcome.PARTIAL; + default: return org.hl7.fhir.r4.model.Enumerations.RemittanceOutcome.NULL; + } +} + + public static org.hl7.fhir.r5.model.CoverageEligibilityResponse.InsuranceComponent convertInsuranceComponent(org.hl7.fhir.r4.model.CoverageEligibilityResponse.InsuranceComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.CoverageEligibilityResponse.InsuranceComponent tgt = new org.hl7.fhir.r5.model.CoverageEligibilityResponse.InsuranceComponent(); + copyElement(src, tgt); + if (src.hasCoverage()) + tgt.setCoverage(convertReference(src.getCoverage())); + if (src.hasInforce()) + tgt.setInforceElement(convertBoolean(src.getInforceElement())); + if (src.hasBenefitPeriod()) + tgt.setBenefitPeriod(convertPeriod(src.getBenefitPeriod())); + for (org.hl7.fhir.r4.model.CoverageEligibilityResponse.ItemsComponent t : src.getItem()) + tgt.addItem(convertItemsComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.CoverageEligibilityResponse.InsuranceComponent convertInsuranceComponent(org.hl7.fhir.r5.model.CoverageEligibilityResponse.InsuranceComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.CoverageEligibilityResponse.InsuranceComponent tgt = new org.hl7.fhir.r4.model.CoverageEligibilityResponse.InsuranceComponent(); + copyElement(src, tgt); + if (src.hasCoverage()) + tgt.setCoverage(convertReference(src.getCoverage())); + if (src.hasInforce()) + tgt.setInforceElement(convertBoolean(src.getInforceElement())); + if (src.hasBenefitPeriod()) + tgt.setBenefitPeriod(convertPeriod(src.getBenefitPeriod())); + for (org.hl7.fhir.r5.model.CoverageEligibilityResponse.ItemsComponent t : src.getItem()) + tgt.addItem(convertItemsComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.CoverageEligibilityResponse.ItemsComponent convertItemsComponent(org.hl7.fhir.r4.model.CoverageEligibilityResponse.ItemsComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.CoverageEligibilityResponse.ItemsComponent tgt = new org.hl7.fhir.r5.model.CoverageEligibilityResponse.ItemsComponent(); + copyElement(src, tgt); + if (src.hasCategory()) + tgt.setCategory(convertCodeableConcept(src.getCategory())); + if (src.hasProductOrService()) + tgt.setProductOrService(convertCodeableConcept(src.getProductOrService())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getModifier()) + tgt.addModifier(convertCodeableConcept(t)); + if (src.hasProvider()) + tgt.setProvider(convertReference(src.getProvider())); + if (src.hasExcluded()) + tgt.setExcludedElement(convertBoolean(src.getExcludedElement())); + if (src.hasName()) + tgt.setNameElement(convertString(src.getNameElement())); + if (src.hasDescription()) + tgt.setDescriptionElement(convertString(src.getDescriptionElement())); + if (src.hasNetwork()) + tgt.setNetwork(convertCodeableConcept(src.getNetwork())); + if (src.hasUnit()) + tgt.setUnit(convertCodeableConcept(src.getUnit())); + if (src.hasTerm()) + tgt.setTerm(convertCodeableConcept(src.getTerm())); + for (org.hl7.fhir.r4.model.CoverageEligibilityResponse.BenefitComponent t : src.getBenefit()) + tgt.addBenefit(convertBenefitComponent(t)); + if (src.hasAuthorizationRequired()) + tgt.setAuthorizationRequiredElement(convertBoolean(src.getAuthorizationRequiredElement())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getAuthorizationSupporting()) + tgt.addAuthorizationSupporting(convertCodeableConcept(t)); + if (src.hasAuthorizationUrl()) + tgt.setAuthorizationUrlElement(convertUri(src.getAuthorizationUrlElement())); + return tgt; + } + + public static org.hl7.fhir.r4.model.CoverageEligibilityResponse.ItemsComponent convertItemsComponent(org.hl7.fhir.r5.model.CoverageEligibilityResponse.ItemsComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.CoverageEligibilityResponse.ItemsComponent tgt = new org.hl7.fhir.r4.model.CoverageEligibilityResponse.ItemsComponent(); + copyElement(src, tgt); + if (src.hasCategory()) + tgt.setCategory(convertCodeableConcept(src.getCategory())); + if (src.hasProductOrService()) + tgt.setProductOrService(convertCodeableConcept(src.getProductOrService())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getModifier()) + tgt.addModifier(convertCodeableConcept(t)); + if (src.hasProvider()) + tgt.setProvider(convertReference(src.getProvider())); + if (src.hasExcluded()) + tgt.setExcludedElement(convertBoolean(src.getExcludedElement())); + if (src.hasName()) + tgt.setNameElement(convertString(src.getNameElement())); + if (src.hasDescription()) + tgt.setDescriptionElement(convertString(src.getDescriptionElement())); + if (src.hasNetwork()) + tgt.setNetwork(convertCodeableConcept(src.getNetwork())); + if (src.hasUnit()) + tgt.setUnit(convertCodeableConcept(src.getUnit())); + if (src.hasTerm()) + tgt.setTerm(convertCodeableConcept(src.getTerm())); + for (org.hl7.fhir.r5.model.CoverageEligibilityResponse.BenefitComponent t : src.getBenefit()) + tgt.addBenefit(convertBenefitComponent(t)); + if (src.hasAuthorizationRequired()) + tgt.setAuthorizationRequiredElement(convertBoolean(src.getAuthorizationRequiredElement())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getAuthorizationSupporting()) + tgt.addAuthorizationSupporting(convertCodeableConcept(t)); + if (src.hasAuthorizationUrl()) + tgt.setAuthorizationUrlElement(convertUri(src.getAuthorizationUrlElement())); + return tgt; + } + + public static org.hl7.fhir.r5.model.CoverageEligibilityResponse.BenefitComponent convertBenefitComponent(org.hl7.fhir.r4.model.CoverageEligibilityResponse.BenefitComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.CoverageEligibilityResponse.BenefitComponent tgt = new org.hl7.fhir.r5.model.CoverageEligibilityResponse.BenefitComponent(); + copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + if (src.hasAllowed()) + tgt.setAllowed(convertType(src.getAllowed())); + if (src.hasUsed()) + tgt.setUsed(convertType(src.getUsed())); + return tgt; + } + + public static org.hl7.fhir.r4.model.CoverageEligibilityResponse.BenefitComponent convertBenefitComponent(org.hl7.fhir.r5.model.CoverageEligibilityResponse.BenefitComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.CoverageEligibilityResponse.BenefitComponent tgt = new org.hl7.fhir.r4.model.CoverageEligibilityResponse.BenefitComponent(); + copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + if (src.hasAllowed()) + tgt.setAllowed(convertType(src.getAllowed())); + if (src.hasUsed()) + tgt.setUsed(convertType(src.getUsed())); + return tgt; + } + + public static org.hl7.fhir.r5.model.CoverageEligibilityResponse.ErrorsComponent convertErrorsComponent(org.hl7.fhir.r4.model.CoverageEligibilityResponse.ErrorsComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.CoverageEligibilityResponse.ErrorsComponent tgt = new org.hl7.fhir.r5.model.CoverageEligibilityResponse.ErrorsComponent(); + copyElement(src, tgt); + if (src.hasCode()) + tgt.setCode(convertCodeableConcept(src.getCode())); + return tgt; + } + + public static org.hl7.fhir.r4.model.CoverageEligibilityResponse.ErrorsComponent convertErrorsComponent(org.hl7.fhir.r5.model.CoverageEligibilityResponse.ErrorsComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.CoverageEligibilityResponse.ErrorsComponent tgt = new org.hl7.fhir.r4.model.CoverageEligibilityResponse.ErrorsComponent(); + copyElement(src, tgt); + if (src.hasCode()) + tgt.setCode(convertCodeableConcept(src.getCode())); + return tgt; + } + + +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/DetectedIssue.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/DetectedIssue.java new file mode 100644 index 000000000..c75769e7c --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/DetectedIssue.java @@ -0,0 +1,213 @@ +package org.hl7.fhir.convertors.conv40_50; + +import org.hl7.fhir.exceptions.FHIRException; + +import org.hl7.fhir.convertors.VersionConvertor_40_50; + + +/* + Copyright (c) 2011+, HL7, Inc. + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of HL7 nor the names of its contributors may be used to + endorse or promote products derived from this software without specific + prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + +*/ + +// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0 + + +public class DetectedIssue extends VersionConvertor_40_50 { + + public static org.hl7.fhir.r5.model.DetectedIssue convertDetectedIssue(org.hl7.fhir.r4.model.DetectedIssue src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.DetectedIssue tgt = new org.hl7.fhir.r5.model.DetectedIssue(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasStatus()) + tgt.setStatus(convertDetectedIssueStatus(src.getStatus())); + if (src.hasCode()) + tgt.setCode(convertCodeableConcept(src.getCode())); + if (src.hasSeverity()) + tgt.setSeverity(convertDetectedIssueSeverity(src.getSeverity())); + if (src.hasPatient()) + tgt.setPatient(convertReference(src.getPatient())); + if (src.hasIdentified()) + tgt.setIdentified(convertType(src.getIdentified())); + if (src.hasAuthor()) + tgt.setAuthor(convertReference(src.getAuthor())); + for (org.hl7.fhir.r4.model.Reference t : src.getImplicated()) + tgt.addImplicated(convertReference(t)); + for (org.hl7.fhir.r4.model.DetectedIssue.DetectedIssueEvidenceComponent t : src.getEvidence()) + tgt.addEvidence(convertDetectedIssueEvidenceComponent(t)); + if (src.hasDetail()) + tgt.setDetailElement(convertString(src.getDetailElement())); + if (src.hasReference()) + tgt.setReferenceElement(convertUri(src.getReferenceElement())); + for (org.hl7.fhir.r4.model.DetectedIssue.DetectedIssueMitigationComponent t : src.getMitigation()) + tgt.addMitigation(convertDetectedIssueMitigationComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.DetectedIssue convertDetectedIssue(org.hl7.fhir.r5.model.DetectedIssue src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.DetectedIssue tgt = new org.hl7.fhir.r4.model.DetectedIssue(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasStatus()) + tgt.setStatus(convertDetectedIssueStatus(src.getStatus())); + if (src.hasCode()) + tgt.setCode(convertCodeableConcept(src.getCode())); + if (src.hasSeverity()) + tgt.setSeverity(convertDetectedIssueSeverity(src.getSeverity())); + if (src.hasPatient()) + tgt.setPatient(convertReference(src.getPatient())); + if (src.hasIdentified()) + tgt.setIdentified(convertType(src.getIdentified())); + if (src.hasAuthor()) + tgt.setAuthor(convertReference(src.getAuthor())); + for (org.hl7.fhir.r5.model.Reference t : src.getImplicated()) + tgt.addImplicated(convertReference(t)); + for (org.hl7.fhir.r5.model.DetectedIssue.DetectedIssueEvidenceComponent t : src.getEvidence()) + tgt.addEvidence(convertDetectedIssueEvidenceComponent(t)); + if (src.hasDetail()) + tgt.setDetailElement(convertString(src.getDetailElement())); + if (src.hasReference()) + tgt.setReferenceElement(convertUri(src.getReferenceElement())); + for (org.hl7.fhir.r5.model.DetectedIssue.DetectedIssueMitigationComponent t : src.getMitigation()) + tgt.addMitigation(convertDetectedIssueMitigationComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.DetectedIssue.DetectedIssueStatus convertDetectedIssueStatus(org.hl7.fhir.r4.model.DetectedIssue.DetectedIssueStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case REGISTERED: return org.hl7.fhir.r5.model.DetectedIssue.DetectedIssueStatus.REGISTERED; + case PRELIMINARY: return org.hl7.fhir.r5.model.DetectedIssue.DetectedIssueStatus.PRELIMINARY; + case FINAL: return org.hl7.fhir.r5.model.DetectedIssue.DetectedIssueStatus.FINAL; + case AMENDED: return org.hl7.fhir.r5.model.DetectedIssue.DetectedIssueStatus.AMENDED; + case CORRECTED: return org.hl7.fhir.r5.model.DetectedIssue.DetectedIssueStatus.CORRECTED; + case CANCELLED: return org.hl7.fhir.r5.model.DetectedIssue.DetectedIssueStatus.CANCELLED; + case ENTEREDINERROR: return org.hl7.fhir.r5.model.DetectedIssue.DetectedIssueStatus.ENTEREDINERROR; + case UNKNOWN: return org.hl7.fhir.r5.model.DetectedIssue.DetectedIssueStatus.UNKNOWN; + default: return org.hl7.fhir.r5.model.DetectedIssue.DetectedIssueStatus.NULL; + } +} + + public static org.hl7.fhir.r4.model.DetectedIssue.DetectedIssueStatus convertDetectedIssueStatus(org.hl7.fhir.r5.model.DetectedIssue.DetectedIssueStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case REGISTERED: return org.hl7.fhir.r4.model.DetectedIssue.DetectedIssueStatus.REGISTERED; + case PRELIMINARY: return org.hl7.fhir.r4.model.DetectedIssue.DetectedIssueStatus.PRELIMINARY; + case FINAL: return org.hl7.fhir.r4.model.DetectedIssue.DetectedIssueStatus.FINAL; + case AMENDED: return org.hl7.fhir.r4.model.DetectedIssue.DetectedIssueStatus.AMENDED; + case CORRECTED: return org.hl7.fhir.r4.model.DetectedIssue.DetectedIssueStatus.CORRECTED; + case CANCELLED: return org.hl7.fhir.r4.model.DetectedIssue.DetectedIssueStatus.CANCELLED; + case ENTEREDINERROR: return org.hl7.fhir.r4.model.DetectedIssue.DetectedIssueStatus.ENTEREDINERROR; + case UNKNOWN: return org.hl7.fhir.r4.model.DetectedIssue.DetectedIssueStatus.UNKNOWN; + default: return org.hl7.fhir.r4.model.DetectedIssue.DetectedIssueStatus.NULL; + } +} + + public static org.hl7.fhir.r5.model.DetectedIssue.DetectedIssueSeverity convertDetectedIssueSeverity(org.hl7.fhir.r4.model.DetectedIssue.DetectedIssueSeverity src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case HIGH: return org.hl7.fhir.r5.model.DetectedIssue.DetectedIssueSeverity.HIGH; + case MODERATE: return org.hl7.fhir.r5.model.DetectedIssue.DetectedIssueSeverity.MODERATE; + case LOW: return org.hl7.fhir.r5.model.DetectedIssue.DetectedIssueSeverity.LOW; + default: return org.hl7.fhir.r5.model.DetectedIssue.DetectedIssueSeverity.NULL; + } +} + + public static org.hl7.fhir.r4.model.DetectedIssue.DetectedIssueSeverity convertDetectedIssueSeverity(org.hl7.fhir.r5.model.DetectedIssue.DetectedIssueSeverity src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case HIGH: return org.hl7.fhir.r4.model.DetectedIssue.DetectedIssueSeverity.HIGH; + case MODERATE: return org.hl7.fhir.r4.model.DetectedIssue.DetectedIssueSeverity.MODERATE; + case LOW: return org.hl7.fhir.r4.model.DetectedIssue.DetectedIssueSeverity.LOW; + default: return org.hl7.fhir.r4.model.DetectedIssue.DetectedIssueSeverity.NULL; + } +} + + public static org.hl7.fhir.r5.model.DetectedIssue.DetectedIssueEvidenceComponent convertDetectedIssueEvidenceComponent(org.hl7.fhir.r4.model.DetectedIssue.DetectedIssueEvidenceComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.DetectedIssue.DetectedIssueEvidenceComponent tgt = new org.hl7.fhir.r5.model.DetectedIssue.DetectedIssueEvidenceComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getCode()) + tgt.addCode(convertCodeableConcept(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getDetail()) + tgt.addDetail(convertReference(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.DetectedIssue.DetectedIssueEvidenceComponent convertDetectedIssueEvidenceComponent(org.hl7.fhir.r5.model.DetectedIssue.DetectedIssueEvidenceComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.DetectedIssue.DetectedIssueEvidenceComponent tgt = new org.hl7.fhir.r4.model.DetectedIssue.DetectedIssueEvidenceComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getCode()) + tgt.addCode(convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getDetail()) + tgt.addDetail(convertReference(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.DetectedIssue.DetectedIssueMitigationComponent convertDetectedIssueMitigationComponent(org.hl7.fhir.r4.model.DetectedIssue.DetectedIssueMitigationComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.DetectedIssue.DetectedIssueMitigationComponent tgt = new org.hl7.fhir.r5.model.DetectedIssue.DetectedIssueMitigationComponent(); + copyElement(src, tgt); + if (src.hasAction()) + tgt.setAction(convertCodeableConcept(src.getAction())); + if (src.hasDate()) + tgt.setDateElement(convertDateTime(src.getDateElement())); + if (src.hasAuthor()) + tgt.setAuthor(convertReference(src.getAuthor())); + return tgt; + } + + public static org.hl7.fhir.r4.model.DetectedIssue.DetectedIssueMitigationComponent convertDetectedIssueMitigationComponent(org.hl7.fhir.r5.model.DetectedIssue.DetectedIssueMitigationComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.DetectedIssue.DetectedIssueMitigationComponent tgt = new org.hl7.fhir.r4.model.DetectedIssue.DetectedIssueMitigationComponent(); + copyElement(src, tgt); + if (src.hasAction()) + tgt.setAction(convertCodeableConcept(src.getAction())); + if (src.hasDate()) + tgt.setDateElement(convertDateTime(src.getDateElement())); + if (src.hasAuthor()) + tgt.setAuthor(convertReference(src.getAuthor())); + return tgt; + } + + +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Device.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Device.java new file mode 100644 index 000000000..159afe4fe --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Device.java @@ -0,0 +1,387 @@ +package org.hl7.fhir.convertors.conv40_50; + +import org.hl7.fhir.exceptions.FHIRException; + +import org.hl7.fhir.convertors.VersionConvertor_40_50; + + +/* + Copyright (c) 2011+, HL7, Inc. + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of HL7 nor the names of its contributors may be used to + endorse or promote products derived from this software without specific + prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + +*/ + +// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0 + + +public class Device extends VersionConvertor_40_50 { + + public static org.hl7.fhir.r5.model.Device convertDevice(org.hl7.fhir.r4.model.Device src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Device tgt = new org.hl7.fhir.r5.model.Device(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasDefinition()) + tgt.setDefinition(convertReference(src.getDefinition())); + for (org.hl7.fhir.r4.model.Device.DeviceUdiCarrierComponent t : src.getUdiCarrier()) + tgt.addUdiCarrier(convertDeviceUdiCarrierComponent(t)); + if (src.hasStatus()) + tgt.setStatus(convertFHIRDeviceStatus(src.getStatus())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getStatusReason()) + tgt.addStatusReason(convertCodeableConcept(t)); + if (src.hasDistinctIdentifier()) + tgt.setDistinctIdentifierElement(convertString(src.getDistinctIdentifierElement())); + if (src.hasManufacturer()) + tgt.setManufacturerElement(convertString(src.getManufacturerElement())); + if (src.hasManufactureDate()) + tgt.setManufactureDateElement(convertDateTime(src.getManufactureDateElement())); + if (src.hasExpirationDate()) + tgt.setExpirationDateElement(convertDateTime(src.getExpirationDateElement())); + if (src.hasLotNumber()) + tgt.setLotNumberElement(convertString(src.getLotNumberElement())); + if (src.hasSerialNumber()) + tgt.setSerialNumberElement(convertString(src.getSerialNumberElement())); + for (org.hl7.fhir.r4.model.Device.DeviceDeviceNameComponent t : src.getDeviceName()) + tgt.addDeviceName(convertDeviceDeviceNameComponent(t)); + if (src.hasModelNumber()) + tgt.setModelNumberElement(convertString(src.getModelNumberElement())); + if (src.hasPartNumber()) + tgt.setPartNumberElement(convertString(src.getPartNumberElement())); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + for (org.hl7.fhir.r4.model.Device.DeviceSpecializationComponent t : src.getSpecialization()) + tgt.addSpecialization(convertDeviceSpecializationComponent(t)); + for (org.hl7.fhir.r4.model.Device.DeviceVersionComponent t : src.getVersion()) + tgt.addVersion(convertDeviceVersionComponent(t)); + for (org.hl7.fhir.r4.model.Device.DevicePropertyComponent t : src.getProperty()) + tgt.addProperty(convertDevicePropertyComponent(t)); + if (src.hasPatient()) + tgt.setPatient(convertReference(src.getPatient())); + if (src.hasOwner()) + tgt.setOwner(convertReference(src.getOwner())); + for (org.hl7.fhir.r4.model.ContactPoint t : src.getContact()) + tgt.addContact(convertContactPoint(t)); + if (src.hasLocation()) + tgt.setLocation(convertReference(src.getLocation())); + if (src.hasUrl()) + tgt.setUrlElement(convertUri(src.getUrlElement())); + for (org.hl7.fhir.r4.model.Annotation t : src.getNote()) + tgt.addNote(convertAnnotation(t)); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getSafety()) + tgt.addSafety(convertCodeableConcept(t)); + if (src.hasParent()) + tgt.setParent(convertReference(src.getParent())); + return tgt; + } + + public static org.hl7.fhir.r4.model.Device convertDevice(org.hl7.fhir.r5.model.Device src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Device tgt = new org.hl7.fhir.r4.model.Device(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasDefinition()) + tgt.setDefinition(convertReference(src.getDefinition())); + for (org.hl7.fhir.r5.model.Device.DeviceUdiCarrierComponent t : src.getUdiCarrier()) + tgt.addUdiCarrier(convertDeviceUdiCarrierComponent(t)); + if (src.hasStatus()) + tgt.setStatus(convertFHIRDeviceStatus(src.getStatus())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getStatusReason()) + tgt.addStatusReason(convertCodeableConcept(t)); + if (src.hasDistinctIdentifier()) + tgt.setDistinctIdentifierElement(convertString(src.getDistinctIdentifierElement())); + if (src.hasManufacturer()) + tgt.setManufacturerElement(convertString(src.getManufacturerElement())); + if (src.hasManufactureDate()) + tgt.setManufactureDateElement(convertDateTime(src.getManufactureDateElement())); + if (src.hasExpirationDate()) + tgt.setExpirationDateElement(convertDateTime(src.getExpirationDateElement())); + if (src.hasLotNumber()) + tgt.setLotNumberElement(convertString(src.getLotNumberElement())); + if (src.hasSerialNumber()) + tgt.setSerialNumberElement(convertString(src.getSerialNumberElement())); + for (org.hl7.fhir.r5.model.Device.DeviceDeviceNameComponent t : src.getDeviceName()) + tgt.addDeviceName(convertDeviceDeviceNameComponent(t)); + if (src.hasModelNumber()) + tgt.setModelNumberElement(convertString(src.getModelNumberElement())); + if (src.hasPartNumber()) + tgt.setPartNumberElement(convertString(src.getPartNumberElement())); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + for (org.hl7.fhir.r5.model.Device.DeviceSpecializationComponent t : src.getSpecialization()) + tgt.addSpecialization(convertDeviceSpecializationComponent(t)); + for (org.hl7.fhir.r5.model.Device.DeviceVersionComponent t : src.getVersion()) + tgt.addVersion(convertDeviceVersionComponent(t)); + for (org.hl7.fhir.r5.model.Device.DevicePropertyComponent t : src.getProperty()) + tgt.addProperty(convertDevicePropertyComponent(t)); + if (src.hasPatient()) + tgt.setPatient(convertReference(src.getPatient())); + if (src.hasOwner()) + tgt.setOwner(convertReference(src.getOwner())); + for (org.hl7.fhir.r5.model.ContactPoint t : src.getContact()) + tgt.addContact(convertContactPoint(t)); + if (src.hasLocation()) + tgt.setLocation(convertReference(src.getLocation())); + if (src.hasUrl()) + tgt.setUrlElement(convertUri(src.getUrlElement())); + for (org.hl7.fhir.r5.model.Annotation t : src.getNote()) + tgt.addNote(convertAnnotation(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getSafety()) + tgt.addSafety(convertCodeableConcept(t)); + if (src.hasParent()) + tgt.setParent(convertReference(src.getParent())); + return tgt; + } + + public static org.hl7.fhir.r5.model.Device.FHIRDeviceStatus convertFHIRDeviceStatus(org.hl7.fhir.r4.model.Device.FHIRDeviceStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case ACTIVE: return org.hl7.fhir.r5.model.Device.FHIRDeviceStatus.ACTIVE; + case INACTIVE: return org.hl7.fhir.r5.model.Device.FHIRDeviceStatus.INACTIVE; + case ENTEREDINERROR: return org.hl7.fhir.r5.model.Device.FHIRDeviceStatus.ENTEREDINERROR; + case UNKNOWN: return org.hl7.fhir.r5.model.Device.FHIRDeviceStatus.UNKNOWN; + default: return org.hl7.fhir.r5.model.Device.FHIRDeviceStatus.NULL; + } +} + + public static org.hl7.fhir.r4.model.Device.FHIRDeviceStatus convertFHIRDeviceStatus(org.hl7.fhir.r5.model.Device.FHIRDeviceStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case ACTIVE: return org.hl7.fhir.r4.model.Device.FHIRDeviceStatus.ACTIVE; + case INACTIVE: return org.hl7.fhir.r4.model.Device.FHIRDeviceStatus.INACTIVE; + case ENTEREDINERROR: return org.hl7.fhir.r4.model.Device.FHIRDeviceStatus.ENTEREDINERROR; + case UNKNOWN: return org.hl7.fhir.r4.model.Device.FHIRDeviceStatus.UNKNOWN; + default: return org.hl7.fhir.r4.model.Device.FHIRDeviceStatus.NULL; + } +} + + public static org.hl7.fhir.r5.model.Device.DeviceUdiCarrierComponent convertDeviceUdiCarrierComponent(org.hl7.fhir.r4.model.Device.DeviceUdiCarrierComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Device.DeviceUdiCarrierComponent tgt = new org.hl7.fhir.r5.model.Device.DeviceUdiCarrierComponent(); + copyElement(src, tgt); + if (src.hasDeviceIdentifier()) + tgt.setDeviceIdentifierElement(convertString(src.getDeviceIdentifierElement())); + if (src.hasIssuer()) + tgt.setIssuerElement(convertUri(src.getIssuerElement())); + if (src.hasJurisdiction()) + tgt.setJurisdictionElement(convertUri(src.getJurisdictionElement())); + if (src.hasCarrierAIDC()) + tgt.setCarrierAIDCElement(convertBase64Binary(src.getCarrierAIDCElement())); + if (src.hasCarrierHRF()) + tgt.setCarrierHRFElement(convertString(src.getCarrierHRFElement())); + if (src.hasEntryType()) + tgt.setEntryType(convertUDIEntryType(src.getEntryType())); + return tgt; + } + + public static org.hl7.fhir.r4.model.Device.DeviceUdiCarrierComponent convertDeviceUdiCarrierComponent(org.hl7.fhir.r5.model.Device.DeviceUdiCarrierComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Device.DeviceUdiCarrierComponent tgt = new org.hl7.fhir.r4.model.Device.DeviceUdiCarrierComponent(); + copyElement(src, tgt); + if (src.hasDeviceIdentifier()) + tgt.setDeviceIdentifierElement(convertString(src.getDeviceIdentifierElement())); + if (src.hasIssuer()) + tgt.setIssuerElement(convertUri(src.getIssuerElement())); + if (src.hasJurisdiction()) + tgt.setJurisdictionElement(convertUri(src.getJurisdictionElement())); + if (src.hasCarrierAIDC()) + tgt.setCarrierAIDCElement(convertBase64Binary(src.getCarrierAIDCElement())); + if (src.hasCarrierHRF()) + tgt.setCarrierHRFElement(convertString(src.getCarrierHRFElement())); + if (src.hasEntryType()) + tgt.setEntryType(convertUDIEntryType(src.getEntryType())); + return tgt; + } + + public static org.hl7.fhir.r5.model.Device.UDIEntryType convertUDIEntryType(org.hl7.fhir.r4.model.Device.UDIEntryType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case BARCODE: return org.hl7.fhir.r5.model.Device.UDIEntryType.BARCODE; + case RFID: return org.hl7.fhir.r5.model.Device.UDIEntryType.RFID; + case MANUAL: return org.hl7.fhir.r5.model.Device.UDIEntryType.MANUAL; + case CARD: return org.hl7.fhir.r5.model.Device.UDIEntryType.CARD; + case SELFREPORTED: return org.hl7.fhir.r5.model.Device.UDIEntryType.SELFREPORTED; + case UNKNOWN: return org.hl7.fhir.r5.model.Device.UDIEntryType.UNKNOWN; + default: return org.hl7.fhir.r5.model.Device.UDIEntryType.NULL; + } +} + + public static org.hl7.fhir.r4.model.Device.UDIEntryType convertUDIEntryType(org.hl7.fhir.r5.model.Device.UDIEntryType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case BARCODE: return org.hl7.fhir.r4.model.Device.UDIEntryType.BARCODE; + case RFID: return org.hl7.fhir.r4.model.Device.UDIEntryType.RFID; + case MANUAL: return org.hl7.fhir.r4.model.Device.UDIEntryType.MANUAL; + case CARD: return org.hl7.fhir.r4.model.Device.UDIEntryType.CARD; + case SELFREPORTED: return org.hl7.fhir.r4.model.Device.UDIEntryType.SELFREPORTED; + case UNKNOWN: return org.hl7.fhir.r4.model.Device.UDIEntryType.UNKNOWN; + default: return org.hl7.fhir.r4.model.Device.UDIEntryType.NULL; + } +} + + public static org.hl7.fhir.r5.model.Device.DeviceDeviceNameComponent convertDeviceDeviceNameComponent(org.hl7.fhir.r4.model.Device.DeviceDeviceNameComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Device.DeviceDeviceNameComponent tgt = new org.hl7.fhir.r5.model.Device.DeviceDeviceNameComponent(); + copyElement(src, tgt); + if (src.hasName()) + tgt.setNameElement(convertString(src.getNameElement())); + if (src.hasType()) + tgt.setType(convertDeviceNameType(src.getType())); + return tgt; + } + + public static org.hl7.fhir.r4.model.Device.DeviceDeviceNameComponent convertDeviceDeviceNameComponent(org.hl7.fhir.r5.model.Device.DeviceDeviceNameComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Device.DeviceDeviceNameComponent tgt = new org.hl7.fhir.r4.model.Device.DeviceDeviceNameComponent(); + copyElement(src, tgt); + if (src.hasName()) + tgt.setNameElement(convertString(src.getNameElement())); + if (src.hasType()) + tgt.setType(convertDeviceNameType(src.getType())); + return tgt; + } + + public static org.hl7.fhir.r5.model.Device.DeviceNameType convertDeviceNameType(org.hl7.fhir.r4.model.Device.DeviceNameType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case UDILABELNAME: return org.hl7.fhir.r5.model.Device.DeviceNameType.UDILABELNAME; + case USERFRIENDLYNAME: return org.hl7.fhir.r5.model.Device.DeviceNameType.USERFRIENDLYNAME; + case PATIENTREPORTEDNAME: return org.hl7.fhir.r5.model.Device.DeviceNameType.PATIENTREPORTEDNAME; + case MANUFACTURERNAME: return org.hl7.fhir.r5.model.Device.DeviceNameType.MANUFACTURERNAME; + case MODELNAME: return org.hl7.fhir.r5.model.Device.DeviceNameType.MODELNAME; + case OTHER: return org.hl7.fhir.r5.model.Device.DeviceNameType.OTHER; + default: return org.hl7.fhir.r5.model.Device.DeviceNameType.NULL; + } +} + + public static org.hl7.fhir.r4.model.Device.DeviceNameType convertDeviceNameType(org.hl7.fhir.r5.model.Device.DeviceNameType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case UDILABELNAME: return org.hl7.fhir.r4.model.Device.DeviceNameType.UDILABELNAME; + case USERFRIENDLYNAME: return org.hl7.fhir.r4.model.Device.DeviceNameType.USERFRIENDLYNAME; + case PATIENTREPORTEDNAME: return org.hl7.fhir.r4.model.Device.DeviceNameType.PATIENTREPORTEDNAME; + case MANUFACTURERNAME: return org.hl7.fhir.r4.model.Device.DeviceNameType.MANUFACTURERNAME; + case MODELNAME: return org.hl7.fhir.r4.model.Device.DeviceNameType.MODELNAME; + case OTHER: return org.hl7.fhir.r4.model.Device.DeviceNameType.OTHER; + default: return org.hl7.fhir.r4.model.Device.DeviceNameType.NULL; + } +} + + public static org.hl7.fhir.r5.model.Device.DeviceSpecializationComponent convertDeviceSpecializationComponent(org.hl7.fhir.r4.model.Device.DeviceSpecializationComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Device.DeviceSpecializationComponent tgt = new org.hl7.fhir.r5.model.Device.DeviceSpecializationComponent(); + copyElement(src, tgt); + if (src.hasSystemType()) + tgt.setSystemType(convertCodeableConcept(src.getSystemType())); + if (src.hasVersion()) + tgt.setVersionElement(convertString(src.getVersionElement())); + return tgt; + } + + public static org.hl7.fhir.r4.model.Device.DeviceSpecializationComponent convertDeviceSpecializationComponent(org.hl7.fhir.r5.model.Device.DeviceSpecializationComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Device.DeviceSpecializationComponent tgt = new org.hl7.fhir.r4.model.Device.DeviceSpecializationComponent(); + copyElement(src, tgt); + if (src.hasSystemType()) + tgt.setSystemType(convertCodeableConcept(src.getSystemType())); + if (src.hasVersion()) + tgt.setVersionElement(convertString(src.getVersionElement())); + return tgt; + } + + public static org.hl7.fhir.r5.model.Device.DeviceVersionComponent convertDeviceVersionComponent(org.hl7.fhir.r4.model.Device.DeviceVersionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Device.DeviceVersionComponent tgt = new org.hl7.fhir.r5.model.Device.DeviceVersionComponent(); + copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + if (src.hasComponent()) + tgt.setComponent(convertIdentifier(src.getComponent())); + if (src.hasValue()) + tgt.setValueElement(convertString(src.getValueElement())); + return tgt; + } + + public static org.hl7.fhir.r4.model.Device.DeviceVersionComponent convertDeviceVersionComponent(org.hl7.fhir.r5.model.Device.DeviceVersionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Device.DeviceVersionComponent tgt = new org.hl7.fhir.r4.model.Device.DeviceVersionComponent(); + copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + if (src.hasComponent()) + tgt.setComponent(convertIdentifier(src.getComponent())); + if (src.hasValue()) + tgt.setValueElement(convertString(src.getValueElement())); + return tgt; + } + + public static org.hl7.fhir.r5.model.Device.DevicePropertyComponent convertDevicePropertyComponent(org.hl7.fhir.r4.model.Device.DevicePropertyComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Device.DevicePropertyComponent tgt = new org.hl7.fhir.r5.model.Device.DevicePropertyComponent(); + copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + for (org.hl7.fhir.r4.model.Quantity t : src.getValueQuantity()) + tgt.addValueQuantity(convertQuantity(t)); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getValueCode()) + tgt.addValueCode(convertCodeableConcept(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.Device.DevicePropertyComponent convertDevicePropertyComponent(org.hl7.fhir.r5.model.Device.DevicePropertyComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Device.DevicePropertyComponent tgt = new org.hl7.fhir.r4.model.Device.DevicePropertyComponent(); + copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + for (org.hl7.fhir.r5.model.Quantity t : src.getValueQuantity()) + tgt.addValueQuantity(convertQuantity(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getValueCode()) + tgt.addValueCode(convertCodeableConcept(t)); + return tgt; + } + + +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/DeviceDefinition.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/DeviceDefinition.java new file mode 100644 index 000000000..83cd07d21 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/DeviceDefinition.java @@ -0,0 +1,331 @@ +package org.hl7.fhir.convertors.conv40_50; + +import org.hl7.fhir.exceptions.FHIRException; + +import org.hl7.fhir.convertors.VersionConvertor_40_50; + + +/* + Copyright (c) 2011+, HL7, Inc. + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of HL7 nor the names of its contributors may be used to + endorse or promote products derived from this software without specific + prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + +*/ + +// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0 + + +public class DeviceDefinition extends VersionConvertor_40_50 { + + public static org.hl7.fhir.r5.model.DeviceDefinition convertDeviceDefinition(org.hl7.fhir.r4.model.DeviceDefinition src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.DeviceDefinition tgt = new org.hl7.fhir.r5.model.DeviceDefinition(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + for (org.hl7.fhir.r4.model.DeviceDefinition.DeviceDefinitionUdiDeviceIdentifierComponent t : src.getUdiDeviceIdentifier()) + tgt.addUdiDeviceIdentifier(convertDeviceDefinitionUdiDeviceIdentifierComponent(t)); + if (src.hasManufacturer()) + tgt.setManufacturer(convertType(src.getManufacturer())); + for (org.hl7.fhir.r4.model.DeviceDefinition.DeviceDefinitionDeviceNameComponent t : src.getDeviceName()) + tgt.addDeviceName(convertDeviceDefinitionDeviceNameComponent(t)); + if (src.hasModelNumber()) + tgt.setModelNumberElement(convertString(src.getModelNumberElement())); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + for (org.hl7.fhir.r4.model.DeviceDefinition.DeviceDefinitionSpecializationComponent t : src.getSpecialization()) + tgt.addSpecialization(convertDeviceDefinitionSpecializationComponent(t)); + for (org.hl7.fhir.r4.model.StringType t : src.getVersion()) + tgt.getVersion().add(convertString(t)); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getSafety()) + tgt.addSafety(convertCodeableConcept(t)); + for (org.hl7.fhir.r4.model.ProductShelfLife t : src.getShelfLifeStorage()) + tgt.addShelfLifeStorage(convertProductShelfLife(t)); + if (src.hasPhysicalCharacteristics()) + tgt.setPhysicalCharacteristics(convertProdCharacteristic(src.getPhysicalCharacteristics())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getLanguageCode()) + tgt.addLanguageCode(convertCodeableConcept(t)); + for (org.hl7.fhir.r4.model.DeviceDefinition.DeviceDefinitionCapabilityComponent t : src.getCapability()) + tgt.addCapability(convertDeviceDefinitionCapabilityComponent(t)); + for (org.hl7.fhir.r4.model.DeviceDefinition.DeviceDefinitionPropertyComponent t : src.getProperty()) + tgt.addProperty(convertDeviceDefinitionPropertyComponent(t)); + if (src.hasOwner()) + tgt.setOwner(convertReference(src.getOwner())); + for (org.hl7.fhir.r4.model.ContactPoint t : src.getContact()) + tgt.addContact(convertContactPoint(t)); + if (src.hasUrl()) + tgt.setUrlElement(convertUri(src.getUrlElement())); + if (src.hasOnlineInformation()) + tgt.setOnlineInformationElement(convertUri(src.getOnlineInformationElement())); + for (org.hl7.fhir.r4.model.Annotation t : src.getNote()) + tgt.addNote(convertAnnotation(t)); + if (src.hasQuantity()) + tgt.setQuantity(convertQuantity(src.getQuantity())); + if (src.hasParentDevice()) + tgt.setParentDevice(convertReference(src.getParentDevice())); + for (org.hl7.fhir.r4.model.DeviceDefinition.DeviceDefinitionMaterialComponent t : src.getMaterial()) + tgt.addMaterial(convertDeviceDefinitionMaterialComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.DeviceDefinition convertDeviceDefinition(org.hl7.fhir.r5.model.DeviceDefinition src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.DeviceDefinition tgt = new org.hl7.fhir.r4.model.DeviceDefinition(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + for (org.hl7.fhir.r5.model.DeviceDefinition.DeviceDefinitionUdiDeviceIdentifierComponent t : src.getUdiDeviceIdentifier()) + tgt.addUdiDeviceIdentifier(convertDeviceDefinitionUdiDeviceIdentifierComponent(t)); + if (src.hasManufacturer()) + tgt.setManufacturer(convertType(src.getManufacturer())); + for (org.hl7.fhir.r5.model.DeviceDefinition.DeviceDefinitionDeviceNameComponent t : src.getDeviceName()) + tgt.addDeviceName(convertDeviceDefinitionDeviceNameComponent(t)); + if (src.hasModelNumber()) + tgt.setModelNumberElement(convertString(src.getModelNumberElement())); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + for (org.hl7.fhir.r5.model.DeviceDefinition.DeviceDefinitionSpecializationComponent t : src.getSpecialization()) + tgt.addSpecialization(convertDeviceDefinitionSpecializationComponent(t)); + for (org.hl7.fhir.r5.model.StringType t : src.getVersion()) + tgt.getVersion().add(convertString(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getSafety()) + tgt.addSafety(convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.ProductShelfLife t : src.getShelfLifeStorage()) + tgt.addShelfLifeStorage(convertProductShelfLife(t)); + if (src.hasPhysicalCharacteristics()) + tgt.setPhysicalCharacteristics(convertProdCharacteristic(src.getPhysicalCharacteristics())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getLanguageCode()) + tgt.addLanguageCode(convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.DeviceDefinition.DeviceDefinitionCapabilityComponent t : src.getCapability()) + tgt.addCapability(convertDeviceDefinitionCapabilityComponent(t)); + for (org.hl7.fhir.r5.model.DeviceDefinition.DeviceDefinitionPropertyComponent t : src.getProperty()) + tgt.addProperty(convertDeviceDefinitionPropertyComponent(t)); + if (src.hasOwner()) + tgt.setOwner(convertReference(src.getOwner())); + for (org.hl7.fhir.r5.model.ContactPoint t : src.getContact()) + tgt.addContact(convertContactPoint(t)); + if (src.hasUrl()) + tgt.setUrlElement(convertUri(src.getUrlElement())); + if (src.hasOnlineInformation()) + tgt.setOnlineInformationElement(convertUri(src.getOnlineInformationElement())); + for (org.hl7.fhir.r5.model.Annotation t : src.getNote()) + tgt.addNote(convertAnnotation(t)); + if (src.hasQuantity()) + tgt.setQuantity(convertQuantity(src.getQuantity())); + if (src.hasParentDevice()) + tgt.setParentDevice(convertReference(src.getParentDevice())); + for (org.hl7.fhir.r5.model.DeviceDefinition.DeviceDefinitionMaterialComponent t : src.getMaterial()) + tgt.addMaterial(convertDeviceDefinitionMaterialComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.DeviceDefinition.DeviceDefinitionUdiDeviceIdentifierComponent convertDeviceDefinitionUdiDeviceIdentifierComponent(org.hl7.fhir.r4.model.DeviceDefinition.DeviceDefinitionUdiDeviceIdentifierComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.DeviceDefinition.DeviceDefinitionUdiDeviceIdentifierComponent tgt = new org.hl7.fhir.r5.model.DeviceDefinition.DeviceDefinitionUdiDeviceIdentifierComponent(); + copyElement(src, tgt); + if (src.hasDeviceIdentifier()) + tgt.setDeviceIdentifierElement(convertString(src.getDeviceIdentifierElement())); + if (src.hasIssuer()) + tgt.setIssuerElement(convertUri(src.getIssuerElement())); + if (src.hasJurisdiction()) + tgt.setJurisdictionElement(convertUri(src.getJurisdictionElement())); + return tgt; + } + + public static org.hl7.fhir.r4.model.DeviceDefinition.DeviceDefinitionUdiDeviceIdentifierComponent convertDeviceDefinitionUdiDeviceIdentifierComponent(org.hl7.fhir.r5.model.DeviceDefinition.DeviceDefinitionUdiDeviceIdentifierComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.DeviceDefinition.DeviceDefinitionUdiDeviceIdentifierComponent tgt = new org.hl7.fhir.r4.model.DeviceDefinition.DeviceDefinitionUdiDeviceIdentifierComponent(); + copyElement(src, tgt); + if (src.hasDeviceIdentifier()) + tgt.setDeviceIdentifierElement(convertString(src.getDeviceIdentifierElement())); + if (src.hasIssuer()) + tgt.setIssuerElement(convertUri(src.getIssuerElement())); + if (src.hasJurisdiction()) + tgt.setJurisdictionElement(convertUri(src.getJurisdictionElement())); + return tgt; + } + + public static org.hl7.fhir.r5.model.DeviceDefinition.DeviceDefinitionDeviceNameComponent convertDeviceDefinitionDeviceNameComponent(org.hl7.fhir.r4.model.DeviceDefinition.DeviceDefinitionDeviceNameComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.DeviceDefinition.DeviceDefinitionDeviceNameComponent tgt = new org.hl7.fhir.r5.model.DeviceDefinition.DeviceDefinitionDeviceNameComponent(); + copyElement(src, tgt); + if (src.hasName()) + tgt.setNameElement(convertString(src.getNameElement())); + if (src.hasType()) + tgt.setType(convertDeviceNameType(src.getType())); + return tgt; + } + + public static org.hl7.fhir.r4.model.DeviceDefinition.DeviceDefinitionDeviceNameComponent convertDeviceDefinitionDeviceNameComponent(org.hl7.fhir.r5.model.DeviceDefinition.DeviceDefinitionDeviceNameComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.DeviceDefinition.DeviceDefinitionDeviceNameComponent tgt = new org.hl7.fhir.r4.model.DeviceDefinition.DeviceDefinitionDeviceNameComponent(); + copyElement(src, tgt); + if (src.hasName()) + tgt.setNameElement(convertString(src.getNameElement())); + if (src.hasType()) + tgt.setType(convertDeviceNameType(src.getType())); + return tgt; + } + + public static org.hl7.fhir.r5.model.DeviceDefinition.DeviceNameType convertDeviceNameType(org.hl7.fhir.r4.model.DeviceDefinition.DeviceNameType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case UDILABELNAME: return org.hl7.fhir.r5.model.DeviceDefinition.DeviceNameType.UDILABELNAME; + case USERFRIENDLYNAME: return org.hl7.fhir.r5.model.DeviceDefinition.DeviceNameType.USERFRIENDLYNAME; + case PATIENTREPORTEDNAME: return org.hl7.fhir.r5.model.DeviceDefinition.DeviceNameType.PATIENTREPORTEDNAME; + case MANUFACTURERNAME: return org.hl7.fhir.r5.model.DeviceDefinition.DeviceNameType.MANUFACTURERNAME; + case MODELNAME: return org.hl7.fhir.r5.model.DeviceDefinition.DeviceNameType.MODELNAME; + case OTHER: return org.hl7.fhir.r5.model.DeviceDefinition.DeviceNameType.OTHER; + default: return org.hl7.fhir.r5.model.DeviceDefinition.DeviceNameType.NULL; + } +} + + public static org.hl7.fhir.r4.model.DeviceDefinition.DeviceNameType convertDeviceNameType(org.hl7.fhir.r5.model.DeviceDefinition.DeviceNameType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case UDILABELNAME: return org.hl7.fhir.r4.model.DeviceDefinition.DeviceNameType.UDILABELNAME; + case USERFRIENDLYNAME: return org.hl7.fhir.r4.model.DeviceDefinition.DeviceNameType.USERFRIENDLYNAME; + case PATIENTREPORTEDNAME: return org.hl7.fhir.r4.model.DeviceDefinition.DeviceNameType.PATIENTREPORTEDNAME; + case MANUFACTURERNAME: return org.hl7.fhir.r4.model.DeviceDefinition.DeviceNameType.MANUFACTURERNAME; + case MODELNAME: return org.hl7.fhir.r4.model.DeviceDefinition.DeviceNameType.MODELNAME; + case OTHER: return org.hl7.fhir.r4.model.DeviceDefinition.DeviceNameType.OTHER; + default: return org.hl7.fhir.r4.model.DeviceDefinition.DeviceNameType.NULL; + } +} + + public static org.hl7.fhir.r5.model.DeviceDefinition.DeviceDefinitionSpecializationComponent convertDeviceDefinitionSpecializationComponent(org.hl7.fhir.r4.model.DeviceDefinition.DeviceDefinitionSpecializationComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.DeviceDefinition.DeviceDefinitionSpecializationComponent tgt = new org.hl7.fhir.r5.model.DeviceDefinition.DeviceDefinitionSpecializationComponent(); + copyElement(src, tgt); + if (src.hasSystemType()) + tgt.setSystemTypeElement(convertString(src.getSystemTypeElement())); + if (src.hasVersion()) + tgt.setVersionElement(convertString(src.getVersionElement())); + return tgt; + } + + public static org.hl7.fhir.r4.model.DeviceDefinition.DeviceDefinitionSpecializationComponent convertDeviceDefinitionSpecializationComponent(org.hl7.fhir.r5.model.DeviceDefinition.DeviceDefinitionSpecializationComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.DeviceDefinition.DeviceDefinitionSpecializationComponent tgt = new org.hl7.fhir.r4.model.DeviceDefinition.DeviceDefinitionSpecializationComponent(); + copyElement(src, tgt); + if (src.hasSystemType()) + tgt.setSystemTypeElement(convertString(src.getSystemTypeElement())); + if (src.hasVersion()) + tgt.setVersionElement(convertString(src.getVersionElement())); + return tgt; + } + + public static org.hl7.fhir.r5.model.DeviceDefinition.DeviceDefinitionCapabilityComponent convertDeviceDefinitionCapabilityComponent(org.hl7.fhir.r4.model.DeviceDefinition.DeviceDefinitionCapabilityComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.DeviceDefinition.DeviceDefinitionCapabilityComponent tgt = new org.hl7.fhir.r5.model.DeviceDefinition.DeviceDefinitionCapabilityComponent(); + copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getDescription()) + tgt.addDescription(convertCodeableConcept(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.DeviceDefinition.DeviceDefinitionCapabilityComponent convertDeviceDefinitionCapabilityComponent(org.hl7.fhir.r5.model.DeviceDefinition.DeviceDefinitionCapabilityComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.DeviceDefinition.DeviceDefinitionCapabilityComponent tgt = new org.hl7.fhir.r4.model.DeviceDefinition.DeviceDefinitionCapabilityComponent(); + copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getDescription()) + tgt.addDescription(convertCodeableConcept(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.DeviceDefinition.DeviceDefinitionPropertyComponent convertDeviceDefinitionPropertyComponent(org.hl7.fhir.r4.model.DeviceDefinition.DeviceDefinitionPropertyComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.DeviceDefinition.DeviceDefinitionPropertyComponent tgt = new org.hl7.fhir.r5.model.DeviceDefinition.DeviceDefinitionPropertyComponent(); + copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + for (org.hl7.fhir.r4.model.Quantity t : src.getValueQuantity()) + tgt.addValueQuantity(convertQuantity(t)); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getValueCode()) + tgt.addValueCode(convertCodeableConcept(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.DeviceDefinition.DeviceDefinitionPropertyComponent convertDeviceDefinitionPropertyComponent(org.hl7.fhir.r5.model.DeviceDefinition.DeviceDefinitionPropertyComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.DeviceDefinition.DeviceDefinitionPropertyComponent tgt = new org.hl7.fhir.r4.model.DeviceDefinition.DeviceDefinitionPropertyComponent(); + copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + for (org.hl7.fhir.r5.model.Quantity t : src.getValueQuantity()) + tgt.addValueQuantity(convertQuantity(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getValueCode()) + tgt.addValueCode(convertCodeableConcept(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.DeviceDefinition.DeviceDefinitionMaterialComponent convertDeviceDefinitionMaterialComponent(org.hl7.fhir.r4.model.DeviceDefinition.DeviceDefinitionMaterialComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.DeviceDefinition.DeviceDefinitionMaterialComponent tgt = new org.hl7.fhir.r5.model.DeviceDefinition.DeviceDefinitionMaterialComponent(); + copyElement(src, tgt); + if (src.hasSubstance()) + tgt.setSubstance(convertCodeableConcept(src.getSubstance())); + if (src.hasAlternate()) + tgt.setAlternateElement(convertBoolean(src.getAlternateElement())); + if (src.hasAllergenicIndicator()) + tgt.setAllergenicIndicatorElement(convertBoolean(src.getAllergenicIndicatorElement())); + return tgt; + } + + public static org.hl7.fhir.r4.model.DeviceDefinition.DeviceDefinitionMaterialComponent convertDeviceDefinitionMaterialComponent(org.hl7.fhir.r5.model.DeviceDefinition.DeviceDefinitionMaterialComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.DeviceDefinition.DeviceDefinitionMaterialComponent tgt = new org.hl7.fhir.r4.model.DeviceDefinition.DeviceDefinitionMaterialComponent(); + copyElement(src, tgt); + if (src.hasSubstance()) + tgt.setSubstance(convertCodeableConcept(src.getSubstance())); + if (src.hasAlternate()) + tgt.setAlternateElement(convertBoolean(src.getAlternateElement())); + if (src.hasAllergenicIndicator()) + tgt.setAllergenicIndicatorElement(convertBoolean(src.getAllergenicIndicatorElement())); + return tgt; + } + + +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/DeviceMetric.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/DeviceMetric.java new file mode 100644 index 000000000..38ee6a789 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/DeviceMetric.java @@ -0,0 +1,255 @@ +package org.hl7.fhir.convertors.conv40_50; + +import org.hl7.fhir.exceptions.FHIRException; + +import org.hl7.fhir.convertors.VersionConvertor_40_50; + + +/* + Copyright (c) 2011+, HL7, Inc. + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of HL7 nor the names of its contributors may be used to + endorse or promote products derived from this software without specific + prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + +*/ + +// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0 + + +public class DeviceMetric extends VersionConvertor_40_50 { + + public static org.hl7.fhir.r5.model.DeviceMetric convertDeviceMetric(org.hl7.fhir.r4.model.DeviceMetric src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.DeviceMetric tgt = new org.hl7.fhir.r5.model.DeviceMetric(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + if (src.hasUnit()) + tgt.setUnit(convertCodeableConcept(src.getUnit())); + if (src.hasSource()) + tgt.setSource(convertReference(src.getSource())); + if (src.hasParent()) + tgt.setParent(convertReference(src.getParent())); + if (src.hasOperationalStatus()) + tgt.setOperationalStatus(convertDeviceMetricOperationalStatus(src.getOperationalStatus())); + if (src.hasColor()) + tgt.setColor(convertDeviceMetricColor(src.getColor())); + if (src.hasCategory()) + tgt.setCategory(convertDeviceMetricCategory(src.getCategory())); + if (src.hasMeasurementPeriod()) + tgt.setMeasurementPeriod(convertTiming(src.getMeasurementPeriod())); + for (org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCalibrationComponent t : src.getCalibration()) + tgt.addCalibration(convertDeviceMetricCalibrationComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.DeviceMetric convertDeviceMetric(org.hl7.fhir.r5.model.DeviceMetric src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.DeviceMetric tgt = new org.hl7.fhir.r4.model.DeviceMetric(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + if (src.hasUnit()) + tgt.setUnit(convertCodeableConcept(src.getUnit())); + if (src.hasSource()) + tgt.setSource(convertReference(src.getSource())); + if (src.hasParent()) + tgt.setParent(convertReference(src.getParent())); + if (src.hasOperationalStatus()) + tgt.setOperationalStatus(convertDeviceMetricOperationalStatus(src.getOperationalStatus())); + if (src.hasColor()) + tgt.setColor(convertDeviceMetricColor(src.getColor())); + if (src.hasCategory()) + tgt.setCategory(convertDeviceMetricCategory(src.getCategory())); + if (src.hasMeasurementPeriod()) + tgt.setMeasurementPeriod(convertTiming(src.getMeasurementPeriod())); + for (org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricCalibrationComponent t : src.getCalibration()) + tgt.addCalibration(convertDeviceMetricCalibrationComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricOperationalStatus convertDeviceMetricOperationalStatus(org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricOperationalStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case ON: return org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricOperationalStatus.ON; + case OFF: return org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricOperationalStatus.OFF; + case STANDBY: return org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricOperationalStatus.STANDBY; + case ENTEREDINERROR: return org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricOperationalStatus.ENTEREDINERROR; + default: return org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricOperationalStatus.NULL; + } +} + + public static org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricOperationalStatus convertDeviceMetricOperationalStatus(org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricOperationalStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case ON: return org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricOperationalStatus.ON; + case OFF: return org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricOperationalStatus.OFF; + case STANDBY: return org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricOperationalStatus.STANDBY; + case ENTEREDINERROR: return org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricOperationalStatus.ENTEREDINERROR; + default: return org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricOperationalStatus.NULL; + } +} + + public static org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricColor convertDeviceMetricColor(org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricColor src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case BLACK: return org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricColor.BLACK; + case RED: return org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricColor.RED; + case GREEN: return org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricColor.GREEN; + case YELLOW: return org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricColor.YELLOW; + case BLUE: return org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricColor.BLUE; + case MAGENTA: return org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricColor.MAGENTA; + case CYAN: return org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricColor.CYAN; + case WHITE: return org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricColor.WHITE; + default: return org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricColor.NULL; + } +} + + public static org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricColor convertDeviceMetricColor(org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricColor src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case BLACK: return org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricColor.BLACK; + case RED: return org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricColor.RED; + case GREEN: return org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricColor.GREEN; + case YELLOW: return org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricColor.YELLOW; + case BLUE: return org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricColor.BLUE; + case MAGENTA: return org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricColor.MAGENTA; + case CYAN: return org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricColor.CYAN; + case WHITE: return org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricColor.WHITE; + default: return org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricColor.NULL; + } +} + + public static org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricCategory convertDeviceMetricCategory(org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCategory src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case MEASUREMENT: return org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricCategory.MEASUREMENT; + case SETTING: return org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricCategory.SETTING; + case CALCULATION: return org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricCategory.CALCULATION; + case UNSPECIFIED: return org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricCategory.UNSPECIFIED; + default: return org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricCategory.NULL; + } +} + + public static org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCategory convertDeviceMetricCategory(org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricCategory src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case MEASUREMENT: return org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCategory.MEASUREMENT; + case SETTING: return org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCategory.SETTING; + case CALCULATION: return org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCategory.CALCULATION; + case UNSPECIFIED: return org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCategory.UNSPECIFIED; + default: return org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCategory.NULL; + } +} + + public static org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricCalibrationComponent convertDeviceMetricCalibrationComponent(org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCalibrationComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricCalibrationComponent tgt = new org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricCalibrationComponent(); + copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertDeviceMetricCalibrationType(src.getType())); + if (src.hasState()) + tgt.setState(convertDeviceMetricCalibrationState(src.getState())); + if (src.hasTime()) + tgt.setTimeElement(convertInstant(src.getTimeElement())); + return tgt; + } + + public static org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCalibrationComponent convertDeviceMetricCalibrationComponent(org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricCalibrationComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCalibrationComponent tgt = new org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCalibrationComponent(); + copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertDeviceMetricCalibrationType(src.getType())); + if (src.hasState()) + tgt.setState(convertDeviceMetricCalibrationState(src.getState())); + if (src.hasTime()) + tgt.setTimeElement(convertInstant(src.getTimeElement())); + return tgt; + } + + public static org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricCalibrationType convertDeviceMetricCalibrationType(org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCalibrationType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case UNSPECIFIED: return org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricCalibrationType.UNSPECIFIED; + case OFFSET: return org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricCalibrationType.OFFSET; + case GAIN: return org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricCalibrationType.GAIN; + case TWOPOINT: return org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricCalibrationType.TWOPOINT; + default: return org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricCalibrationType.NULL; + } +} + + public static org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCalibrationType convertDeviceMetricCalibrationType(org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricCalibrationType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case UNSPECIFIED: return org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCalibrationType.UNSPECIFIED; + case OFFSET: return org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCalibrationType.OFFSET; + case GAIN: return org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCalibrationType.GAIN; + case TWOPOINT: return org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCalibrationType.TWOPOINT; + default: return org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCalibrationType.NULL; + } +} + + public static org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricCalibrationState convertDeviceMetricCalibrationState(org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCalibrationState src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case NOTCALIBRATED: return org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricCalibrationState.NOTCALIBRATED; + case CALIBRATIONREQUIRED: return org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricCalibrationState.CALIBRATIONREQUIRED; + case CALIBRATED: return org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricCalibrationState.CALIBRATED; + case UNSPECIFIED: return org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricCalibrationState.UNSPECIFIED; + default: return org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricCalibrationState.NULL; + } +} + + public static org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCalibrationState convertDeviceMetricCalibrationState(org.hl7.fhir.r5.model.DeviceMetric.DeviceMetricCalibrationState src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case NOTCALIBRATED: return org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCalibrationState.NOTCALIBRATED; + case CALIBRATIONREQUIRED: return org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCalibrationState.CALIBRATIONREQUIRED; + case CALIBRATED: return org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCalibrationState.CALIBRATED; + case UNSPECIFIED: return org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCalibrationState.UNSPECIFIED; + default: return org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCalibrationState.NULL; + } +} + + +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/DeviceRequest.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/DeviceRequest.java new file mode 100644 index 000000000..17f1a6269 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/DeviceRequest.java @@ -0,0 +1,267 @@ +package org.hl7.fhir.convertors.conv40_50; + +import org.hl7.fhir.exceptions.FHIRException; + +import org.hl7.fhir.convertors.VersionConvertor_40_50; + + +/* + Copyright (c) 2011+, HL7, Inc. + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of HL7 nor the names of its contributors may be used to + endorse or promote products derived from this software without specific + prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + +*/ + +// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0 + + +public class DeviceRequest extends VersionConvertor_40_50 { + + public static org.hl7.fhir.r5.model.DeviceRequest convertDeviceRequest(org.hl7.fhir.r4.model.DeviceRequest src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.DeviceRequest tgt = new org.hl7.fhir.r5.model.DeviceRequest(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + for (org.hl7.fhir.r4.model.CanonicalType t : src.getInstantiatesCanonical()) + tgt.getInstantiatesCanonical().add(convertCanonical(t)); + for (org.hl7.fhir.r4.model.UriType t : src.getInstantiatesUri()) + tgt.getInstantiatesUri().add(convertUri(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getBasedOn()) + tgt.addBasedOn(convertReference(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getPriorRequest()) + tgt.addPriorRequest(convertReference(t)); + if (src.hasGroupIdentifier()) + tgt.setGroupIdentifier(convertIdentifier(src.getGroupIdentifier())); + if (src.hasStatus()) + tgt.setStatus(convertDeviceRequestStatus(src.getStatus())); + if (src.hasIntent()) + tgt.setIntent(convertRequestIntent(src.getIntent())); + if (src.hasPriority()) + tgt.setPriority(convertRequestPriority(src.getPriority())); + if (src.hasCode()) + tgt.setCode(convertType(src.getCode())); + for (org.hl7.fhir.r4.model.DeviceRequest.DeviceRequestParameterComponent t : src.getParameter()) + tgt.addParameter(convertDeviceRequestParameterComponent(t)); + if (src.hasSubject()) + tgt.setSubject(convertReference(src.getSubject())); + if (src.hasEncounter()) + tgt.setEncounter(convertReference(src.getEncounter())); + if (src.hasOccurrence()) + tgt.setOccurrence(convertType(src.getOccurrence())); + if (src.hasAuthoredOn()) + tgt.setAuthoredOnElement(convertDateTime(src.getAuthoredOnElement())); + if (src.hasRequester()) + tgt.setRequester(convertReference(src.getRequester())); + if (src.hasPerformerType()) + tgt.setPerformerType(convertCodeableConcept(src.getPerformerType())); + if (src.hasPerformer()) + tgt.setPerformer(convertReference(src.getPerformer())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getReasonCode()) + tgt.addReasonCode(convertCodeableConcept(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getReasonReference()) + tgt.addReasonReference(convertReference(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getInsurance()) + tgt.addInsurance(convertReference(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getSupportingInfo()) + tgt.addSupportingInfo(convertReference(t)); + for (org.hl7.fhir.r4.model.Annotation t : src.getNote()) + tgt.addNote(convertAnnotation(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getRelevantHistory()) + tgt.addRelevantHistory(convertReference(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.DeviceRequest convertDeviceRequest(org.hl7.fhir.r5.model.DeviceRequest src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.DeviceRequest tgt = new org.hl7.fhir.r4.model.DeviceRequest(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + for (org.hl7.fhir.r5.model.CanonicalType t : src.getInstantiatesCanonical()) + tgt.getInstantiatesCanonical().add(convertCanonical(t)); + for (org.hl7.fhir.r5.model.UriType t : src.getInstantiatesUri()) + tgt.getInstantiatesUri().add(convertUri(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getBasedOn()) + tgt.addBasedOn(convertReference(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getPriorRequest()) + tgt.addPriorRequest(convertReference(t)); + if (src.hasGroupIdentifier()) + tgt.setGroupIdentifier(convertIdentifier(src.getGroupIdentifier())); + if (src.hasStatus()) + tgt.setStatus(convertDeviceRequestStatus(src.getStatus())); + if (src.hasIntent()) + tgt.setIntent(convertRequestIntent(src.getIntent())); + if (src.hasPriority()) + tgt.setPriority(convertRequestPriority(src.getPriority())); + if (src.hasCode()) + tgt.setCode(convertType(src.getCode())); + for (org.hl7.fhir.r5.model.DeviceRequest.DeviceRequestParameterComponent t : src.getParameter()) + tgt.addParameter(convertDeviceRequestParameterComponent(t)); + if (src.hasSubject()) + tgt.setSubject(convertReference(src.getSubject())); + if (src.hasEncounter()) + tgt.setEncounter(convertReference(src.getEncounter())); + if (src.hasOccurrence()) + tgt.setOccurrence(convertType(src.getOccurrence())); + if (src.hasAuthoredOn()) + tgt.setAuthoredOnElement(convertDateTime(src.getAuthoredOnElement())); + if (src.hasRequester()) + tgt.setRequester(convertReference(src.getRequester())); + if (src.hasPerformerType()) + tgt.setPerformerType(convertCodeableConcept(src.getPerformerType())); + if (src.hasPerformer()) + tgt.setPerformer(convertReference(src.getPerformer())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getReasonCode()) + tgt.addReasonCode(convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getReasonReference()) + tgt.addReasonReference(convertReference(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getInsurance()) + tgt.addInsurance(convertReference(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getSupportingInfo()) + tgt.addSupportingInfo(convertReference(t)); + for (org.hl7.fhir.r5.model.Annotation t : src.getNote()) + tgt.addNote(convertAnnotation(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getRelevantHistory()) + tgt.addRelevantHistory(convertReference(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.DeviceRequest.DeviceRequestStatus convertDeviceRequestStatus(org.hl7.fhir.r4.model.DeviceRequest.DeviceRequestStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case DRAFT: return org.hl7.fhir.r5.model.DeviceRequest.DeviceRequestStatus.DRAFT; + case ACTIVE: return org.hl7.fhir.r5.model.DeviceRequest.DeviceRequestStatus.ACTIVE; + case ONHOLD: return org.hl7.fhir.r5.model.DeviceRequest.DeviceRequestStatus.ONHOLD; + case REVOKED: return org.hl7.fhir.r5.model.DeviceRequest.DeviceRequestStatus.REVOKED; + case COMPLETED: return org.hl7.fhir.r5.model.DeviceRequest.DeviceRequestStatus.COMPLETED; + case ENTEREDINERROR: return org.hl7.fhir.r5.model.DeviceRequest.DeviceRequestStatus.ENTEREDINERROR; + case UNKNOWN: return org.hl7.fhir.r5.model.DeviceRequest.DeviceRequestStatus.UNKNOWN; + default: return org.hl7.fhir.r5.model.DeviceRequest.DeviceRequestStatus.NULL; + } +} + + public static org.hl7.fhir.r4.model.DeviceRequest.DeviceRequestStatus convertDeviceRequestStatus(org.hl7.fhir.r5.model.DeviceRequest.DeviceRequestStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case DRAFT: return org.hl7.fhir.r4.model.DeviceRequest.DeviceRequestStatus.DRAFT; + case ACTIVE: return org.hl7.fhir.r4.model.DeviceRequest.DeviceRequestStatus.ACTIVE; + case ONHOLD: return org.hl7.fhir.r4.model.DeviceRequest.DeviceRequestStatus.ONHOLD; + case REVOKED: return org.hl7.fhir.r4.model.DeviceRequest.DeviceRequestStatus.REVOKED; + case COMPLETED: return org.hl7.fhir.r4.model.DeviceRequest.DeviceRequestStatus.COMPLETED; + case ENTEREDINERROR: return org.hl7.fhir.r4.model.DeviceRequest.DeviceRequestStatus.ENTEREDINERROR; + case UNKNOWN: return org.hl7.fhir.r4.model.DeviceRequest.DeviceRequestStatus.UNKNOWN; + default: return org.hl7.fhir.r4.model.DeviceRequest.DeviceRequestStatus.NULL; + } +} + + public static org.hl7.fhir.r5.model.DeviceRequest.RequestIntent convertRequestIntent(org.hl7.fhir.r4.model.DeviceRequest.RequestIntent src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PROPOSAL: return org.hl7.fhir.r5.model.DeviceRequest.RequestIntent.PROPOSAL; + case PLAN: return org.hl7.fhir.r5.model.DeviceRequest.RequestIntent.PLAN; + case DIRECTIVE: return org.hl7.fhir.r5.model.DeviceRequest.RequestIntent.DIRECTIVE; + case ORDER: return org.hl7.fhir.r5.model.DeviceRequest.RequestIntent.ORDER; + case ORIGINALORDER: return org.hl7.fhir.r5.model.DeviceRequest.RequestIntent.ORIGINALORDER; + case REFLEXORDER: return org.hl7.fhir.r5.model.DeviceRequest.RequestIntent.REFLEXORDER; + case FILLERORDER: return org.hl7.fhir.r5.model.DeviceRequest.RequestIntent.FILLERORDER; + case INSTANCEORDER: return org.hl7.fhir.r5.model.DeviceRequest.RequestIntent.INSTANCEORDER; + case OPTION: return org.hl7.fhir.r5.model.DeviceRequest.RequestIntent.OPTION; + default: return org.hl7.fhir.r5.model.DeviceRequest.RequestIntent.NULL; + } +} + + public static org.hl7.fhir.r4.model.DeviceRequest.RequestIntent convertRequestIntent(org.hl7.fhir.r5.model.DeviceRequest.RequestIntent src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PROPOSAL: return org.hl7.fhir.r4.model.DeviceRequest.RequestIntent.PROPOSAL; + case PLAN: return org.hl7.fhir.r4.model.DeviceRequest.RequestIntent.PLAN; + case DIRECTIVE: return org.hl7.fhir.r4.model.DeviceRequest.RequestIntent.DIRECTIVE; + case ORDER: return org.hl7.fhir.r4.model.DeviceRequest.RequestIntent.ORDER; + case ORIGINALORDER: return org.hl7.fhir.r4.model.DeviceRequest.RequestIntent.ORIGINALORDER; + case REFLEXORDER: return org.hl7.fhir.r4.model.DeviceRequest.RequestIntent.REFLEXORDER; + case FILLERORDER: return org.hl7.fhir.r4.model.DeviceRequest.RequestIntent.FILLERORDER; + case INSTANCEORDER: return org.hl7.fhir.r4.model.DeviceRequest.RequestIntent.INSTANCEORDER; + case OPTION: return org.hl7.fhir.r4.model.DeviceRequest.RequestIntent.OPTION; + default: return org.hl7.fhir.r4.model.DeviceRequest.RequestIntent.NULL; + } +} + + public static org.hl7.fhir.r5.model.DeviceRequest.RequestPriority convertRequestPriority(org.hl7.fhir.r4.model.DeviceRequest.RequestPriority src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case ROUTINE: return org.hl7.fhir.r5.model.DeviceRequest.RequestPriority.ROUTINE; + case URGENT: return org.hl7.fhir.r5.model.DeviceRequest.RequestPriority.URGENT; + case ASAP: return org.hl7.fhir.r5.model.DeviceRequest.RequestPriority.ASAP; + case STAT: return org.hl7.fhir.r5.model.DeviceRequest.RequestPriority.STAT; + default: return org.hl7.fhir.r5.model.DeviceRequest.RequestPriority.NULL; + } +} + + public static org.hl7.fhir.r4.model.DeviceRequest.RequestPriority convertRequestPriority(org.hl7.fhir.r5.model.DeviceRequest.RequestPriority src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case ROUTINE: return org.hl7.fhir.r4.model.DeviceRequest.RequestPriority.ROUTINE; + case URGENT: return org.hl7.fhir.r4.model.DeviceRequest.RequestPriority.URGENT; + case ASAP: return org.hl7.fhir.r4.model.DeviceRequest.RequestPriority.ASAP; + case STAT: return org.hl7.fhir.r4.model.DeviceRequest.RequestPriority.STAT; + default: return org.hl7.fhir.r4.model.DeviceRequest.RequestPriority.NULL; + } +} + + public static org.hl7.fhir.r5.model.DeviceRequest.DeviceRequestParameterComponent convertDeviceRequestParameterComponent(org.hl7.fhir.r4.model.DeviceRequest.DeviceRequestParameterComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.DeviceRequest.DeviceRequestParameterComponent tgt = new org.hl7.fhir.r5.model.DeviceRequest.DeviceRequestParameterComponent(); + copyElement(src, tgt); + if (src.hasCode()) + tgt.setCode(convertCodeableConcept(src.getCode())); + if (src.hasValue()) + tgt.setValue(convertType(src.getValue())); + return tgt; + } + + public static org.hl7.fhir.r4.model.DeviceRequest.DeviceRequestParameterComponent convertDeviceRequestParameterComponent(org.hl7.fhir.r5.model.DeviceRequest.DeviceRequestParameterComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.DeviceRequest.DeviceRequestParameterComponent tgt = new org.hl7.fhir.r4.model.DeviceRequest.DeviceRequestParameterComponent(); + copyElement(src, tgt); + if (src.hasCode()) + tgt.setCode(convertCodeableConcept(src.getCode())); + if (src.hasValue()) + tgt.setValue(convertType(src.getValue())); + return tgt; + } + + +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/DeviceUseStatement.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/DeviceUseStatement.java new file mode 100644 index 000000000..b2a3b6ef2 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/DeviceUseStatement.java @@ -0,0 +1,139 @@ +package org.hl7.fhir.convertors.conv40_50; + +import org.hl7.fhir.exceptions.FHIRException; + +import org.hl7.fhir.convertors.VersionConvertor_40_50; + + +/* + Copyright (c) 2011+, HL7, Inc. + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of HL7 nor the names of its contributors may be used to + endorse or promote products derived from this software without specific + prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + +*/ + +// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0 + + +public class DeviceUseStatement extends VersionConvertor_40_50 { + + public static org.hl7.fhir.r5.model.DeviceUseStatement convertDeviceUseStatement(org.hl7.fhir.r4.model.DeviceUseStatement src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.DeviceUseStatement tgt = new org.hl7.fhir.r5.model.DeviceUseStatement(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getBasedOn()) + tgt.addBasedOn(convertReference(t)); + if (src.hasStatus()) + tgt.setStatus(convertDeviceUseStatementStatus(src.getStatus())); + if (src.hasSubject()) + tgt.setSubject(convertReference(src.getSubject())); + for (org.hl7.fhir.r4.model.Reference t : src.getDerivedFrom()) + tgt.addDerivedFrom(convertReference(t)); + if (src.hasTiming()) + tgt.setTiming(convertType(src.getTiming())); + if (src.hasRecordedOn()) + tgt.setRecordedOnElement(convertDateTime(src.getRecordedOnElement())); + if (src.hasSource()) + tgt.setSource(convertReference(src.getSource())); + if (src.hasDevice()) + tgt.setDevice(convertReference(src.getDevice())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getReasonCode()) + tgt.addReasonCode(convertCodeableConcept(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getReasonReference()) + tgt.addReasonReference(convertReference(t)); + if (src.hasBodySite()) + tgt.setBodySite(convertCodeableConcept(src.getBodySite())); + for (org.hl7.fhir.r4.model.Annotation t : src.getNote()) + tgt.addNote(convertAnnotation(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.DeviceUseStatement convertDeviceUseStatement(org.hl7.fhir.r5.model.DeviceUseStatement src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.DeviceUseStatement tgt = new org.hl7.fhir.r4.model.DeviceUseStatement(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getBasedOn()) + tgt.addBasedOn(convertReference(t)); + if (src.hasStatus()) + tgt.setStatus(convertDeviceUseStatementStatus(src.getStatus())); + if (src.hasSubject()) + tgt.setSubject(convertReference(src.getSubject())); + for (org.hl7.fhir.r5.model.Reference t : src.getDerivedFrom()) + tgt.addDerivedFrom(convertReference(t)); + if (src.hasTiming()) + tgt.setTiming(convertType(src.getTiming())); + if (src.hasRecordedOn()) + tgt.setRecordedOnElement(convertDateTime(src.getRecordedOnElement())); + if (src.hasSource()) + tgt.setSource(convertReference(src.getSource())); + if (src.hasDevice()) + tgt.setDevice(convertReference(src.getDevice())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getReasonCode()) + tgt.addReasonCode(convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getReasonReference()) + tgt.addReasonReference(convertReference(t)); + if (src.hasBodySite()) + tgt.setBodySite(convertCodeableConcept(src.getBodySite())); + for (org.hl7.fhir.r5.model.Annotation t : src.getNote()) + tgt.addNote(convertAnnotation(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.DeviceUseStatement.DeviceUseStatementStatus convertDeviceUseStatementStatus(org.hl7.fhir.r4.model.DeviceUseStatement.DeviceUseStatementStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case ACTIVE: return org.hl7.fhir.r5.model.DeviceUseStatement.DeviceUseStatementStatus.ACTIVE; + case COMPLETED: return org.hl7.fhir.r5.model.DeviceUseStatement.DeviceUseStatementStatus.COMPLETED; + case ENTEREDINERROR: return org.hl7.fhir.r5.model.DeviceUseStatement.DeviceUseStatementStatus.ENTEREDINERROR; + case INTENDED: return org.hl7.fhir.r5.model.DeviceUseStatement.DeviceUseStatementStatus.INTENDED; + case STOPPED: return org.hl7.fhir.r5.model.DeviceUseStatement.DeviceUseStatementStatus.STOPPED; + case ONHOLD: return org.hl7.fhir.r5.model.DeviceUseStatement.DeviceUseStatementStatus.ONHOLD; + default: return org.hl7.fhir.r5.model.DeviceUseStatement.DeviceUseStatementStatus.NULL; + } +} + + public static org.hl7.fhir.r4.model.DeviceUseStatement.DeviceUseStatementStatus convertDeviceUseStatementStatus(org.hl7.fhir.r5.model.DeviceUseStatement.DeviceUseStatementStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case ACTIVE: return org.hl7.fhir.r4.model.DeviceUseStatement.DeviceUseStatementStatus.ACTIVE; + case COMPLETED: return org.hl7.fhir.r4.model.DeviceUseStatement.DeviceUseStatementStatus.COMPLETED; + case ENTEREDINERROR: return org.hl7.fhir.r4.model.DeviceUseStatement.DeviceUseStatementStatus.ENTEREDINERROR; + case INTENDED: return org.hl7.fhir.r4.model.DeviceUseStatement.DeviceUseStatementStatus.INTENDED; + case STOPPED: return org.hl7.fhir.r4.model.DeviceUseStatement.DeviceUseStatementStatus.STOPPED; + case ONHOLD: return org.hl7.fhir.r4.model.DeviceUseStatement.DeviceUseStatementStatus.ONHOLD; + default: return org.hl7.fhir.r4.model.DeviceUseStatement.DeviceUseStatementStatus.NULL; + } +} + + +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/DiagnosticReport.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/DiagnosticReport.java new file mode 100644 index 000000000..b893cf125 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/DiagnosticReport.java @@ -0,0 +1,191 @@ +package org.hl7.fhir.convertors.conv40_50; + +import org.hl7.fhir.exceptions.FHIRException; + +import org.hl7.fhir.convertors.VersionConvertor_40_50; + + +/* + Copyright (c) 2011+, HL7, Inc. + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of HL7 nor the names of its contributors may be used to + endorse or promote products derived from this software without specific + prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + +*/ + +// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0 + + +public class DiagnosticReport extends VersionConvertor_40_50 { + + public static org.hl7.fhir.r5.model.DiagnosticReport convertDiagnosticReport(org.hl7.fhir.r4.model.DiagnosticReport src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.DiagnosticReport tgt = new org.hl7.fhir.r5.model.DiagnosticReport(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getBasedOn()) + tgt.addBasedOn(convertReference(t)); + if (src.hasStatus()) + tgt.setStatus(convertDiagnosticReportStatus(src.getStatus())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getCategory()) + tgt.addCategory(convertCodeableConcept(t)); + if (src.hasCode()) + tgt.setCode(convertCodeableConcept(src.getCode())); + if (src.hasSubject()) + tgt.setSubject(convertReference(src.getSubject())); + if (src.hasEncounter()) + tgt.setEncounter(convertReference(src.getEncounter())); + if (src.hasEffective()) + tgt.setEffective(convertType(src.getEffective())); + if (src.hasIssued()) + tgt.setIssuedElement(convertInstant(src.getIssuedElement())); + for (org.hl7.fhir.r4.model.Reference t : src.getPerformer()) + tgt.addPerformer(convertReference(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getResultsInterpreter()) + tgt.addResultsInterpreter(convertReference(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getSpecimen()) + tgt.addSpecimen(convertReference(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getResult()) + tgt.addResult(convertReference(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getImagingStudy()) + tgt.addImagingStudy(convertReference(t)); + for (org.hl7.fhir.r4.model.DiagnosticReport.DiagnosticReportMediaComponent t : src.getMedia()) + tgt.addMedia(convertDiagnosticReportMediaComponent(t)); + if (src.hasConclusion()) + tgt.setConclusionElement(convertString(src.getConclusionElement())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getConclusionCode()) + tgt.addConclusionCode(convertCodeableConcept(t)); + for (org.hl7.fhir.r4.model.Attachment t : src.getPresentedForm()) + tgt.addPresentedForm(convertAttachment(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.DiagnosticReport convertDiagnosticReport(org.hl7.fhir.r5.model.DiagnosticReport src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.DiagnosticReport tgt = new org.hl7.fhir.r4.model.DiagnosticReport(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getBasedOn()) + tgt.addBasedOn(convertReference(t)); + if (src.hasStatus()) + tgt.setStatus(convertDiagnosticReportStatus(src.getStatus())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getCategory()) + tgt.addCategory(convertCodeableConcept(t)); + if (src.hasCode()) + tgt.setCode(convertCodeableConcept(src.getCode())); + if (src.hasSubject()) + tgt.setSubject(convertReference(src.getSubject())); + if (src.hasEncounter()) + tgt.setEncounter(convertReference(src.getEncounter())); + if (src.hasEffective()) + tgt.setEffective(convertType(src.getEffective())); + if (src.hasIssued()) + tgt.setIssuedElement(convertInstant(src.getIssuedElement())); + for (org.hl7.fhir.r5.model.Reference t : src.getPerformer()) + tgt.addPerformer(convertReference(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getResultsInterpreter()) + tgt.addResultsInterpreter(convertReference(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getSpecimen()) + tgt.addSpecimen(convertReference(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getResult()) + tgt.addResult(convertReference(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getImagingStudy()) + tgt.addImagingStudy(convertReference(t)); + for (org.hl7.fhir.r5.model.DiagnosticReport.DiagnosticReportMediaComponent t : src.getMedia()) + tgt.addMedia(convertDiagnosticReportMediaComponent(t)); + if (src.hasConclusion()) + tgt.setConclusionElement(convertString(src.getConclusionElement())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getConclusionCode()) + tgt.addConclusionCode(convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.Attachment t : src.getPresentedForm()) + tgt.addPresentedForm(convertAttachment(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.DiagnosticReport.DiagnosticReportStatus convertDiagnosticReportStatus(org.hl7.fhir.r4.model.DiagnosticReport.DiagnosticReportStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case REGISTERED: return org.hl7.fhir.r5.model.DiagnosticReport.DiagnosticReportStatus.REGISTERED; + case PARTIAL: return org.hl7.fhir.r5.model.DiagnosticReport.DiagnosticReportStatus.PARTIAL; + case PRELIMINARY: return org.hl7.fhir.r5.model.DiagnosticReport.DiagnosticReportStatus.PRELIMINARY; + case FINAL: return org.hl7.fhir.r5.model.DiagnosticReport.DiagnosticReportStatus.FINAL; + case AMENDED: return org.hl7.fhir.r5.model.DiagnosticReport.DiagnosticReportStatus.AMENDED; + case CORRECTED: return org.hl7.fhir.r5.model.DiagnosticReport.DiagnosticReportStatus.CORRECTED; + case APPENDED: return org.hl7.fhir.r5.model.DiagnosticReport.DiagnosticReportStatus.APPENDED; + case CANCELLED: return org.hl7.fhir.r5.model.DiagnosticReport.DiagnosticReportStatus.CANCELLED; + case ENTEREDINERROR: return org.hl7.fhir.r5.model.DiagnosticReport.DiagnosticReportStatus.ENTEREDINERROR; + case UNKNOWN: return org.hl7.fhir.r5.model.DiagnosticReport.DiagnosticReportStatus.UNKNOWN; + default: return org.hl7.fhir.r5.model.DiagnosticReport.DiagnosticReportStatus.NULL; + } +} + + public static org.hl7.fhir.r4.model.DiagnosticReport.DiagnosticReportStatus convertDiagnosticReportStatus(org.hl7.fhir.r5.model.DiagnosticReport.DiagnosticReportStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case REGISTERED: return org.hl7.fhir.r4.model.DiagnosticReport.DiagnosticReportStatus.REGISTERED; + case PARTIAL: return org.hl7.fhir.r4.model.DiagnosticReport.DiagnosticReportStatus.PARTIAL; + case PRELIMINARY: return org.hl7.fhir.r4.model.DiagnosticReport.DiagnosticReportStatus.PRELIMINARY; + case FINAL: return org.hl7.fhir.r4.model.DiagnosticReport.DiagnosticReportStatus.FINAL; + case AMENDED: return org.hl7.fhir.r4.model.DiagnosticReport.DiagnosticReportStatus.AMENDED; + case CORRECTED: return org.hl7.fhir.r4.model.DiagnosticReport.DiagnosticReportStatus.CORRECTED; + case APPENDED: return org.hl7.fhir.r4.model.DiagnosticReport.DiagnosticReportStatus.APPENDED; + case CANCELLED: return org.hl7.fhir.r4.model.DiagnosticReport.DiagnosticReportStatus.CANCELLED; + case ENTEREDINERROR: return org.hl7.fhir.r4.model.DiagnosticReport.DiagnosticReportStatus.ENTEREDINERROR; + case UNKNOWN: return org.hl7.fhir.r4.model.DiagnosticReport.DiagnosticReportStatus.UNKNOWN; + default: return org.hl7.fhir.r4.model.DiagnosticReport.DiagnosticReportStatus.NULL; + } +} + + public static org.hl7.fhir.r5.model.DiagnosticReport.DiagnosticReportMediaComponent convertDiagnosticReportMediaComponent(org.hl7.fhir.r4.model.DiagnosticReport.DiagnosticReportMediaComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.DiagnosticReport.DiagnosticReportMediaComponent tgt = new org.hl7.fhir.r5.model.DiagnosticReport.DiagnosticReportMediaComponent(); + copyElement(src, tgt); + if (src.hasComment()) + tgt.setCommentElement(convertString(src.getCommentElement())); + if (src.hasLink()) + tgt.setLink(convertReference(src.getLink())); + return tgt; + } + + public static org.hl7.fhir.r4.model.DiagnosticReport.DiagnosticReportMediaComponent convertDiagnosticReportMediaComponent(org.hl7.fhir.r5.model.DiagnosticReport.DiagnosticReportMediaComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.DiagnosticReport.DiagnosticReportMediaComponent tgt = new org.hl7.fhir.r4.model.DiagnosticReport.DiagnosticReportMediaComponent(); + copyElement(src, tgt); + if (src.hasComment()) + tgt.setCommentElement(convertString(src.getCommentElement())); + if (src.hasLink()) + tgt.setLink(convertReference(src.getLink())); + return tgt; + } + + +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/DocumentManifest.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/DocumentManifest.java new file mode 100644 index 000000000..8b97c12bd --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/DocumentManifest.java @@ -0,0 +1,131 @@ +package org.hl7.fhir.convertors.conv40_50; + +import org.hl7.fhir.exceptions.FHIRException; + +import org.hl7.fhir.convertors.VersionConvertor_40_50; + + +/* + Copyright (c) 2011+, HL7, Inc. + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of HL7 nor the names of its contributors may be used to + endorse or promote products derived from this software without specific + prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + +*/ + +// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0 + + +public class DocumentManifest extends VersionConvertor_40_50 { + + public static org.hl7.fhir.r5.model.DocumentManifest convertDocumentManifest(org.hl7.fhir.r4.model.DocumentManifest src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.DocumentManifest tgt = new org.hl7.fhir.r5.model.DocumentManifest(); + copyDomainResource(src, tgt); + if (src.hasMasterIdentifier()) + tgt.setMasterIdentifier(convertIdentifier(src.getMasterIdentifier())); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasStatus()) + tgt.setStatus(Enumerations.convertDocumentReferenceStatus(src.getStatus())); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + if (src.hasSubject()) + tgt.setSubject(convertReference(src.getSubject())); + if (src.hasCreated()) + tgt.setCreatedElement(convertDateTime(src.getCreatedElement())); + for (org.hl7.fhir.r4.model.Reference t : src.getAuthor()) + tgt.addAuthor(convertReference(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getRecipient()) + tgt.addRecipient(convertReference(t)); + if (src.hasSource()) + tgt.setSourceElement(convertUri(src.getSourceElement())); + if (src.hasDescription()) + tgt.setDescriptionElement(convertString(src.getDescriptionElement())); + for (org.hl7.fhir.r4.model.Reference t : src.getContent()) + tgt.addContent(convertReference(t)); + for (org.hl7.fhir.r4.model.DocumentManifest.DocumentManifestRelatedComponent t : src.getRelated()) + tgt.addRelated(convertDocumentManifestRelatedComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.DocumentManifest convertDocumentManifest(org.hl7.fhir.r5.model.DocumentManifest src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.DocumentManifest tgt = new org.hl7.fhir.r4.model.DocumentManifest(); + copyDomainResource(src, tgt); + if (src.hasMasterIdentifier()) + tgt.setMasterIdentifier(convertIdentifier(src.getMasterIdentifier())); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasStatus()) + tgt.setStatus(Enumerations.convertDocumentReferenceStatus(src.getStatus())); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + if (src.hasSubject()) + tgt.setSubject(convertReference(src.getSubject())); + if (src.hasCreated()) + tgt.setCreatedElement(convertDateTime(src.getCreatedElement())); + for (org.hl7.fhir.r5.model.Reference t : src.getAuthor()) + tgt.addAuthor(convertReference(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getRecipient()) + tgt.addRecipient(convertReference(t)); + if (src.hasSource()) + tgt.setSourceElement(convertUri(src.getSourceElement())); + if (src.hasDescription()) + tgt.setDescriptionElement(convertString(src.getDescriptionElement())); + for (org.hl7.fhir.r5.model.Reference t : src.getContent()) + tgt.addContent(convertReference(t)); + for (org.hl7.fhir.r5.model.DocumentManifest.DocumentManifestRelatedComponent t : src.getRelated()) + tgt.addRelated(convertDocumentManifestRelatedComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.DocumentManifest.DocumentManifestRelatedComponent convertDocumentManifestRelatedComponent(org.hl7.fhir.r4.model.DocumentManifest.DocumentManifestRelatedComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.DocumentManifest.DocumentManifestRelatedComponent tgt = new org.hl7.fhir.r5.model.DocumentManifest.DocumentManifestRelatedComponent(); + copyElement(src, tgt); + if (src.hasIdentifier()) + tgt.setIdentifier(convertIdentifier(src.getIdentifier())); + if (src.hasRef()) + tgt.setRef(convertReference(src.getRef())); + return tgt; + } + + public static org.hl7.fhir.r4.model.DocumentManifest.DocumentManifestRelatedComponent convertDocumentManifestRelatedComponent(org.hl7.fhir.r5.model.DocumentManifest.DocumentManifestRelatedComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.DocumentManifest.DocumentManifestRelatedComponent tgt = new org.hl7.fhir.r4.model.DocumentManifest.DocumentManifestRelatedComponent(); + copyElement(src, tgt); + if (src.hasIdentifier()) + tgt.setIdentifier(convertIdentifier(src.getIdentifier())); + if (src.hasRef()) + tgt.setRef(convertReference(src.getRef())); + return tgt; + } + + +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/DocumentReference.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/DocumentReference.java new file mode 100644 index 000000000..ccd60483e --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/DocumentReference.java @@ -0,0 +1,263 @@ +package org.hl7.fhir.convertors.conv40_50; + +import org.hl7.fhir.exceptions.FHIRException; + +import org.hl7.fhir.convertors.VersionConvertor_40_50; + + +/* + Copyright (c) 2011+, HL7, Inc. + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of HL7 nor the names of its contributors may be used to + endorse or promote products derived from this software without specific + prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + +*/ + +// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0 + + +public class DocumentReference extends VersionConvertor_40_50 { + + public static org.hl7.fhir.r5.model.DocumentReference convertDocumentReference(org.hl7.fhir.r4.model.DocumentReference src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.DocumentReference tgt = new org.hl7.fhir.r5.model.DocumentReference(); + copyDomainResource(src, tgt); + if (src.hasMasterIdentifier()) + tgt.setMasterIdentifier(convertIdentifier(src.getMasterIdentifier())); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasStatus()) + tgt.setStatus(Enumerations.convertDocumentReferenceStatus(src.getStatus())); + if (src.hasDocStatus()) + tgt.setDocStatus(convertReferredDocumentStatus(src.getDocStatus())); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getCategory()) + tgt.addCategory(convertCodeableConcept(t)); + if (src.hasSubject()) + tgt.setSubject(convertReference(src.getSubject())); + if (src.hasDate()) + tgt.setDateElement(convertInstant(src.getDateElement())); + for (org.hl7.fhir.r4.model.Reference t : src.getAuthor()) + tgt.addAuthor(convertReference(t)); + if (src.hasAuthenticator()) + tgt.setAuthenticator(convertReference(src.getAuthenticator())); + if (src.hasCustodian()) + tgt.setCustodian(convertReference(src.getCustodian())); + for (org.hl7.fhir.r4.model.DocumentReference.DocumentReferenceRelatesToComponent t : src.getRelatesTo()) + tgt.addRelatesTo(convertDocumentReferenceRelatesToComponent(t)); + if (src.hasDescription()) + tgt.setDescriptionElement(convertString(src.getDescriptionElement())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getSecurityLabel()) + tgt.addSecurityLabel(convertCodeableConcept(t)); + for (org.hl7.fhir.r4.model.DocumentReference.DocumentReferenceContentComponent t : src.getContent()) + tgt.addContent(convertDocumentReferenceContentComponent(t)); + if (src.hasContext()) + tgt.setContext(convertDocumentReferenceContextComponent(src.getContext())); + return tgt; + } + + public static org.hl7.fhir.r4.model.DocumentReference convertDocumentReference(org.hl7.fhir.r5.model.DocumentReference src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.DocumentReference tgt = new org.hl7.fhir.r4.model.DocumentReference(); + copyDomainResource(src, tgt); + if (src.hasMasterIdentifier()) + tgt.setMasterIdentifier(convertIdentifier(src.getMasterIdentifier())); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasStatus()) + tgt.setStatus(Enumerations.convertDocumentReferenceStatus(src.getStatus())); + if (src.hasDocStatus()) + tgt.setDocStatus(convertReferredDocumentStatus(src.getDocStatus())); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getCategory()) + tgt.addCategory(convertCodeableConcept(t)); + if (src.hasSubject()) + tgt.setSubject(convertReference(src.getSubject())); + if (src.hasDate()) + tgt.setDateElement(convertInstant(src.getDateElement())); + for (org.hl7.fhir.r5.model.Reference t : src.getAuthor()) + tgt.addAuthor(convertReference(t)); + if (src.hasAuthenticator()) + tgt.setAuthenticator(convertReference(src.getAuthenticator())); + if (src.hasCustodian()) + tgt.setCustodian(convertReference(src.getCustodian())); + for (org.hl7.fhir.r5.model.DocumentReference.DocumentReferenceRelatesToComponent t : src.getRelatesTo()) + tgt.addRelatesTo(convertDocumentReferenceRelatesToComponent(t)); + if (src.hasDescription()) + tgt.setDescriptionElement(convertString(src.getDescriptionElement())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getSecurityLabel()) + tgt.addSecurityLabel(convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.DocumentReference.DocumentReferenceContentComponent t : src.getContent()) + tgt.addContent(convertDocumentReferenceContentComponent(t)); + if (src.hasContext()) + tgt.setContext(convertDocumentReferenceContextComponent(src.getContext())); + return tgt; + } + + public static org.hl7.fhir.r5.model.DocumentReference.ReferredDocumentStatus convertReferredDocumentStatus(org.hl7.fhir.r4.model.DocumentReference.ReferredDocumentStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PRELIMINARY: return org.hl7.fhir.r5.model.DocumentReference.ReferredDocumentStatus.PRELIMINARY; + case FINAL: return org.hl7.fhir.r5.model.DocumentReference.ReferredDocumentStatus.FINAL; + case AMENDED: return org.hl7.fhir.r5.model.DocumentReference.ReferredDocumentStatus.AMENDED; + case ENTEREDINERROR: return org.hl7.fhir.r5.model.DocumentReference.ReferredDocumentStatus.ENTEREDINERROR; + default: return org.hl7.fhir.r5.model.DocumentReference.ReferredDocumentStatus.NULL; + } +} + + public static org.hl7.fhir.r4.model.DocumentReference.ReferredDocumentStatus convertReferredDocumentStatus(org.hl7.fhir.r5.model.DocumentReference.ReferredDocumentStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PRELIMINARY: return org.hl7.fhir.r4.model.DocumentReference.ReferredDocumentStatus.PRELIMINARY; + case FINAL: return org.hl7.fhir.r4.model.DocumentReference.ReferredDocumentStatus.FINAL; + case AMENDED: return org.hl7.fhir.r4.model.DocumentReference.ReferredDocumentStatus.AMENDED; + case ENTEREDINERROR: return org.hl7.fhir.r4.model.DocumentReference.ReferredDocumentStatus.ENTEREDINERROR; + default: return org.hl7.fhir.r4.model.DocumentReference.ReferredDocumentStatus.NULL; + } +} + + public static org.hl7.fhir.r5.model.DocumentReference.DocumentReferenceRelatesToComponent convertDocumentReferenceRelatesToComponent(org.hl7.fhir.r4.model.DocumentReference.DocumentReferenceRelatesToComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.DocumentReference.DocumentReferenceRelatesToComponent tgt = new org.hl7.fhir.r5.model.DocumentReference.DocumentReferenceRelatesToComponent(); + copyElement(src, tgt); + if (src.hasCode()) + tgt.setCode(convertDocumentRelationshipType(src.getCode())); + if (src.hasTarget()) + tgt.setTarget(convertReference(src.getTarget())); + return tgt; + } + + public static org.hl7.fhir.r4.model.DocumentReference.DocumentReferenceRelatesToComponent convertDocumentReferenceRelatesToComponent(org.hl7.fhir.r5.model.DocumentReference.DocumentReferenceRelatesToComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.DocumentReference.DocumentReferenceRelatesToComponent tgt = new org.hl7.fhir.r4.model.DocumentReference.DocumentReferenceRelatesToComponent(); + copyElement(src, tgt); + if (src.hasCode()) + tgt.setCode(convertDocumentRelationshipType(src.getCode())); + if (src.hasTarget()) + tgt.setTarget(convertReference(src.getTarget())); + return tgt; + } + + public static org.hl7.fhir.r5.model.DocumentReference.DocumentRelationshipType convertDocumentRelationshipType(org.hl7.fhir.r4.model.DocumentReference.DocumentRelationshipType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case REPLACES: return org.hl7.fhir.r5.model.DocumentReference.DocumentRelationshipType.REPLACES; + case TRANSFORMS: return org.hl7.fhir.r5.model.DocumentReference.DocumentRelationshipType.TRANSFORMS; + case SIGNS: return org.hl7.fhir.r5.model.DocumentReference.DocumentRelationshipType.SIGNS; + case APPENDS: return org.hl7.fhir.r5.model.DocumentReference.DocumentRelationshipType.APPENDS; + default: return org.hl7.fhir.r5.model.DocumentReference.DocumentRelationshipType.NULL; + } +} + + public static org.hl7.fhir.r4.model.DocumentReference.DocumentRelationshipType convertDocumentRelationshipType(org.hl7.fhir.r5.model.DocumentReference.DocumentRelationshipType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case REPLACES: return org.hl7.fhir.r4.model.DocumentReference.DocumentRelationshipType.REPLACES; + case TRANSFORMS: return org.hl7.fhir.r4.model.DocumentReference.DocumentRelationshipType.TRANSFORMS; + case SIGNS: return org.hl7.fhir.r4.model.DocumentReference.DocumentRelationshipType.SIGNS; + case APPENDS: return org.hl7.fhir.r4.model.DocumentReference.DocumentRelationshipType.APPENDS; + default: return org.hl7.fhir.r4.model.DocumentReference.DocumentRelationshipType.NULL; + } +} + + public static org.hl7.fhir.r5.model.DocumentReference.DocumentReferenceContentComponent convertDocumentReferenceContentComponent(org.hl7.fhir.r4.model.DocumentReference.DocumentReferenceContentComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.DocumentReference.DocumentReferenceContentComponent tgt = new org.hl7.fhir.r5.model.DocumentReference.DocumentReferenceContentComponent(); + copyElement(src, tgt); + if (src.hasAttachment()) + tgt.setAttachment(convertAttachment(src.getAttachment())); + if (src.hasFormat()) + tgt.setFormat(convertCoding(src.getFormat())); + return tgt; + } + + public static org.hl7.fhir.r4.model.DocumentReference.DocumentReferenceContentComponent convertDocumentReferenceContentComponent(org.hl7.fhir.r5.model.DocumentReference.DocumentReferenceContentComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.DocumentReference.DocumentReferenceContentComponent tgt = new org.hl7.fhir.r4.model.DocumentReference.DocumentReferenceContentComponent(); + copyElement(src, tgt); + if (src.hasAttachment()) + tgt.setAttachment(convertAttachment(src.getAttachment())); + if (src.hasFormat()) + tgt.setFormat(convertCoding(src.getFormat())); + return tgt; + } + + public static org.hl7.fhir.r5.model.DocumentReference.DocumentReferenceContextComponent convertDocumentReferenceContextComponent(org.hl7.fhir.r4.model.DocumentReference.DocumentReferenceContextComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.DocumentReference.DocumentReferenceContextComponent tgt = new org.hl7.fhir.r5.model.DocumentReference.DocumentReferenceContextComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.r4.model.Reference t : src.getEncounter()) + tgt.addEncounter(convertReference(t)); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getEvent()) + tgt.addEvent(convertCodeableConcept(t)); + if (src.hasPeriod()) + tgt.setPeriod(convertPeriod(src.getPeriod())); + if (src.hasFacilityType()) + tgt.setFacilityType(convertCodeableConcept(src.getFacilityType())); + if (src.hasPracticeSetting()) + tgt.setPracticeSetting(convertCodeableConcept(src.getPracticeSetting())); + if (src.hasSourcePatientInfo()) + tgt.setSourcePatientInfo(convertReference(src.getSourcePatientInfo())); + for (org.hl7.fhir.r4.model.Reference t : src.getRelated()) + tgt.addRelated(convertReference(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.DocumentReference.DocumentReferenceContextComponent convertDocumentReferenceContextComponent(org.hl7.fhir.r5.model.DocumentReference.DocumentReferenceContextComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.DocumentReference.DocumentReferenceContextComponent tgt = new org.hl7.fhir.r4.model.DocumentReference.DocumentReferenceContextComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.r5.model.Reference t : src.getEncounter()) + tgt.addEncounter(convertReference(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getEvent()) + tgt.addEvent(convertCodeableConcept(t)); + if (src.hasPeriod()) + tgt.setPeriod(convertPeriod(src.getPeriod())); + if (src.hasFacilityType()) + tgt.setFacilityType(convertCodeableConcept(src.getFacilityType())); + if (src.hasPracticeSetting()) + tgt.setPracticeSetting(convertCodeableConcept(src.getPracticeSetting())); + if (src.hasSourcePatientInfo()) + tgt.setSourcePatientInfo(convertReference(src.getSourcePatientInfo())); + for (org.hl7.fhir.r5.model.Reference t : src.getRelated()) + tgt.addRelated(convertReference(t)); + return tgt; + } + + +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/EffectEvidenceSynthesis.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/EffectEvidenceSynthesis.java new file mode 100644 index 000000000..c2c32f46c --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/EffectEvidenceSynthesis.java @@ -0,0 +1,399 @@ +package org.hl7.fhir.convertors.conv40_50; + +import org.hl7.fhir.exceptions.FHIRException; + +import org.hl7.fhir.convertors.VersionConvertor_40_50; + + +/* + Copyright (c) 2011+, HL7, Inc. + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of HL7 nor the names of its contributors may be used to + endorse or promote products derived from this software without specific + prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + +*/ + +// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0 + + +public class EffectEvidenceSynthesis extends VersionConvertor_40_50 { + + public static org.hl7.fhir.r5.model.EffectEvidenceSynthesis convertEffectEvidenceSynthesis(org.hl7.fhir.r4.model.EffectEvidenceSynthesis src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.EffectEvidenceSynthesis tgt = new org.hl7.fhir.r5.model.EffectEvidenceSynthesis(); + copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrlElement(convertUri(src.getUrlElement())); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasVersion()) + tgt.setVersionElement(convertString(src.getVersionElement())); + if (src.hasName()) + tgt.setNameElement(convertString(src.getNameElement())); + if (src.hasTitle()) + tgt.setTitleElement(convertString(src.getTitleElement())); + if (src.hasStatus()) + tgt.setStatus(Enumerations.convertPublicationStatus(src.getStatus())); + if (src.hasDate()) + tgt.setDateElement(convertDateTime(src.getDateElement())); + if (src.hasPublisher()) + tgt.setPublisherElement(convertString(src.getPublisherElement())); + for (org.hl7.fhir.r4.model.ContactDetail t : src.getContact()) + tgt.addContact(convertContactDetail(t)); + if (src.hasDescription()) + tgt.setDescriptionElement(convertMarkdown(src.getDescriptionElement())); + for (org.hl7.fhir.r4.model.Annotation t : src.getNote()) + tgt.addNote(convertAnnotation(t)); + for (org.hl7.fhir.r4.model.UsageContext t : src.getUseContext()) + tgt.addUseContext(convertUsageContext(t)); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getJurisdiction()) + tgt.addJurisdiction(convertCodeableConcept(t)); + if (src.hasCopyright()) + tgt.setCopyrightElement(convertMarkdown(src.getCopyrightElement())); + if (src.hasApprovalDate()) + tgt.setApprovalDateElement(convertDate(src.getApprovalDateElement())); + if (src.hasLastReviewDate()) + tgt.setLastReviewDateElement(convertDate(src.getLastReviewDateElement())); + if (src.hasEffectivePeriod()) + tgt.setEffectivePeriod(convertPeriod(src.getEffectivePeriod())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getTopic()) + tgt.addTopic(convertCodeableConcept(t)); + for (org.hl7.fhir.r4.model.ContactDetail t : src.getAuthor()) + tgt.addAuthor(convertContactDetail(t)); + for (org.hl7.fhir.r4.model.ContactDetail t : src.getEditor()) + tgt.addEditor(convertContactDetail(t)); + for (org.hl7.fhir.r4.model.ContactDetail t : src.getReviewer()) + tgt.addReviewer(convertContactDetail(t)); + for (org.hl7.fhir.r4.model.ContactDetail t : src.getEndorser()) + tgt.addEndorser(convertContactDetail(t)); + for (org.hl7.fhir.r4.model.RelatedArtifact t : src.getRelatedArtifact()) + tgt.addRelatedArtifact(convertRelatedArtifact(t)); + if (src.hasSynthesisType()) + tgt.setSynthesisType(convertCodeableConcept(src.getSynthesisType())); + if (src.hasStudyType()) + tgt.setStudyType(convertCodeableConcept(src.getStudyType())); + if (src.hasPopulation()) + tgt.setPopulation(convertReference(src.getPopulation())); + if (src.hasExposure()) + tgt.setExposure(convertReference(src.getExposure())); + if (src.hasExposureAlternative()) + tgt.setExposureAlternative(convertReference(src.getExposureAlternative())); + if (src.hasOutcome()) + tgt.setOutcome(convertReference(src.getOutcome())); + if (src.hasSampleSize()) + tgt.setSampleSize(convertEffectEvidenceSynthesisSampleSizeComponent(src.getSampleSize())); + for (org.hl7.fhir.r4.model.EffectEvidenceSynthesis.EffectEvidenceSynthesisResultsByExposureComponent t : src.getResultsByExposure()) + tgt.addResultsByExposure(convertEffectEvidenceSynthesisResultsByExposureComponent(t)); + for (org.hl7.fhir.r4.model.EffectEvidenceSynthesis.EffectEvidenceSynthesisEffectEstimateComponent t : src.getEffectEstimate()) + tgt.addEffectEstimate(convertEffectEvidenceSynthesisEffectEstimateComponent(t)); + for (org.hl7.fhir.r4.model.EffectEvidenceSynthesis.EffectEvidenceSynthesisCertaintyComponent t : src.getCertainty()) + tgt.addCertainty(convertEffectEvidenceSynthesisCertaintyComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.EffectEvidenceSynthesis convertEffectEvidenceSynthesis(org.hl7.fhir.r5.model.EffectEvidenceSynthesis src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.EffectEvidenceSynthesis tgt = new org.hl7.fhir.r4.model.EffectEvidenceSynthesis(); + copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrlElement(convertUri(src.getUrlElement())); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasVersion()) + tgt.setVersionElement(convertString(src.getVersionElement())); + if (src.hasName()) + tgt.setNameElement(convertString(src.getNameElement())); + if (src.hasTitle()) + tgt.setTitleElement(convertString(src.getTitleElement())); + if (src.hasStatus()) + tgt.setStatus(Enumerations.convertPublicationStatus(src.getStatus())); + if (src.hasDate()) + tgt.setDateElement(convertDateTime(src.getDateElement())); + if (src.hasPublisher()) + tgt.setPublisherElement(convertString(src.getPublisherElement())); + for (org.hl7.fhir.r5.model.ContactDetail t : src.getContact()) + tgt.addContact(convertContactDetail(t)); + if (src.hasDescription()) + tgt.setDescriptionElement(convertMarkdown(src.getDescriptionElement())); + for (org.hl7.fhir.r5.model.Annotation t : src.getNote()) + tgt.addNote(convertAnnotation(t)); + for (org.hl7.fhir.r5.model.UsageContext t : src.getUseContext()) + tgt.addUseContext(convertUsageContext(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getJurisdiction()) + tgt.addJurisdiction(convertCodeableConcept(t)); + if (src.hasCopyright()) + tgt.setCopyrightElement(convertMarkdown(src.getCopyrightElement())); + if (src.hasApprovalDate()) + tgt.setApprovalDateElement(convertDate(src.getApprovalDateElement())); + if (src.hasLastReviewDate()) + tgt.setLastReviewDateElement(convertDate(src.getLastReviewDateElement())); + if (src.hasEffectivePeriod()) + tgt.setEffectivePeriod(convertPeriod(src.getEffectivePeriod())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getTopic()) + tgt.addTopic(convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.ContactDetail t : src.getAuthor()) + tgt.addAuthor(convertContactDetail(t)); + for (org.hl7.fhir.r5.model.ContactDetail t : src.getEditor()) + tgt.addEditor(convertContactDetail(t)); + for (org.hl7.fhir.r5.model.ContactDetail t : src.getReviewer()) + tgt.addReviewer(convertContactDetail(t)); + for (org.hl7.fhir.r5.model.ContactDetail t : src.getEndorser()) + tgt.addEndorser(convertContactDetail(t)); + for (org.hl7.fhir.r5.model.RelatedArtifact t : src.getRelatedArtifact()) + tgt.addRelatedArtifact(convertRelatedArtifact(t)); + if (src.hasSynthesisType()) + tgt.setSynthesisType(convertCodeableConcept(src.getSynthesisType())); + if (src.hasStudyType()) + tgt.setStudyType(convertCodeableConcept(src.getStudyType())); + if (src.hasPopulation()) + tgt.setPopulation(convertReference(src.getPopulation())); + if (src.hasExposure()) + tgt.setExposure(convertReference(src.getExposure())); + if (src.hasExposureAlternative()) + tgt.setExposureAlternative(convertReference(src.getExposureAlternative())); + if (src.hasOutcome()) + tgt.setOutcome(convertReference(src.getOutcome())); + if (src.hasSampleSize()) + tgt.setSampleSize(convertEffectEvidenceSynthesisSampleSizeComponent(src.getSampleSize())); + for (org.hl7.fhir.r5.model.EffectEvidenceSynthesis.EffectEvidenceSynthesisResultsByExposureComponent t : src.getResultsByExposure()) + tgt.addResultsByExposure(convertEffectEvidenceSynthesisResultsByExposureComponent(t)); + for (org.hl7.fhir.r5.model.EffectEvidenceSynthesis.EffectEvidenceSynthesisEffectEstimateComponent t : src.getEffectEstimate()) + tgt.addEffectEstimate(convertEffectEvidenceSynthesisEffectEstimateComponent(t)); + for (org.hl7.fhir.r5.model.EffectEvidenceSynthesis.EffectEvidenceSynthesisCertaintyComponent t : src.getCertainty()) + tgt.addCertainty(convertEffectEvidenceSynthesisCertaintyComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.EffectEvidenceSynthesis.EffectEvidenceSynthesisSampleSizeComponent convertEffectEvidenceSynthesisSampleSizeComponent(org.hl7.fhir.r4.model.EffectEvidenceSynthesis.EffectEvidenceSynthesisSampleSizeComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.EffectEvidenceSynthesis.EffectEvidenceSynthesisSampleSizeComponent tgt = new org.hl7.fhir.r5.model.EffectEvidenceSynthesis.EffectEvidenceSynthesisSampleSizeComponent(); + copyElement(src, tgt); + if (src.hasDescription()) + tgt.setDescriptionElement(convertString(src.getDescriptionElement())); + if (src.hasNumberOfStudies()) + tgt.setNumberOfStudiesElement(convertInteger(src.getNumberOfStudiesElement())); + if (src.hasNumberOfParticipants()) + tgt.setNumberOfParticipantsElement(convertInteger(src.getNumberOfParticipantsElement())); + return tgt; + } + + public static org.hl7.fhir.r4.model.EffectEvidenceSynthesis.EffectEvidenceSynthesisSampleSizeComponent convertEffectEvidenceSynthesisSampleSizeComponent(org.hl7.fhir.r5.model.EffectEvidenceSynthesis.EffectEvidenceSynthesisSampleSizeComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.EffectEvidenceSynthesis.EffectEvidenceSynthesisSampleSizeComponent tgt = new org.hl7.fhir.r4.model.EffectEvidenceSynthesis.EffectEvidenceSynthesisSampleSizeComponent(); + copyElement(src, tgt); + if (src.hasDescription()) + tgt.setDescriptionElement(convertString(src.getDescriptionElement())); + if (src.hasNumberOfStudies()) + tgt.setNumberOfStudiesElement(convertInteger(src.getNumberOfStudiesElement())); + if (src.hasNumberOfParticipants()) + tgt.setNumberOfParticipantsElement(convertInteger(src.getNumberOfParticipantsElement())); + return tgt; + } + + public static org.hl7.fhir.r5.model.EffectEvidenceSynthesis.EffectEvidenceSynthesisResultsByExposureComponent convertEffectEvidenceSynthesisResultsByExposureComponent(org.hl7.fhir.r4.model.EffectEvidenceSynthesis.EffectEvidenceSynthesisResultsByExposureComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.EffectEvidenceSynthesis.EffectEvidenceSynthesisResultsByExposureComponent tgt = new org.hl7.fhir.r5.model.EffectEvidenceSynthesis.EffectEvidenceSynthesisResultsByExposureComponent(); + copyElement(src, tgt); + if (src.hasDescription()) + tgt.setDescriptionElement(convertString(src.getDescriptionElement())); + if (src.hasExposureState()) + tgt.setExposureState(convertExposureState(src.getExposureState())); + if (src.hasVariantState()) + tgt.setVariantState(convertCodeableConcept(src.getVariantState())); + if (src.hasRiskEvidenceSynthesis()) + tgt.setRiskEvidenceSynthesis(convertReference(src.getRiskEvidenceSynthesis())); + return tgt; + } + + public static org.hl7.fhir.r4.model.EffectEvidenceSynthesis.EffectEvidenceSynthesisResultsByExposureComponent convertEffectEvidenceSynthesisResultsByExposureComponent(org.hl7.fhir.r5.model.EffectEvidenceSynthesis.EffectEvidenceSynthesisResultsByExposureComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.EffectEvidenceSynthesis.EffectEvidenceSynthesisResultsByExposureComponent tgt = new org.hl7.fhir.r4.model.EffectEvidenceSynthesis.EffectEvidenceSynthesisResultsByExposureComponent(); + copyElement(src, tgt); + if (src.hasDescription()) + tgt.setDescriptionElement(convertString(src.getDescriptionElement())); + if (src.hasExposureState()) + tgt.setExposureState(convertExposureState(src.getExposureState())); + if (src.hasVariantState()) + tgt.setVariantState(convertCodeableConcept(src.getVariantState())); + if (src.hasRiskEvidenceSynthesis()) + tgt.setRiskEvidenceSynthesis(convertReference(src.getRiskEvidenceSynthesis())); + return tgt; + } + + public static org.hl7.fhir.r5.model.EffectEvidenceSynthesis.ExposureState convertExposureState(org.hl7.fhir.r4.model.EffectEvidenceSynthesis.ExposureState src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case EXPOSURE: return org.hl7.fhir.r5.model.EffectEvidenceSynthesis.ExposureState.EXPOSURE; + case EXPOSUREALTERNATIVE: return org.hl7.fhir.r5.model.EffectEvidenceSynthesis.ExposureState.EXPOSUREALTERNATIVE; + default: return org.hl7.fhir.r5.model.EffectEvidenceSynthesis.ExposureState.NULL; + } +} + + public static org.hl7.fhir.r4.model.EffectEvidenceSynthesis.ExposureState convertExposureState(org.hl7.fhir.r5.model.EffectEvidenceSynthesis.ExposureState src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case EXPOSURE: return org.hl7.fhir.r4.model.EffectEvidenceSynthesis.ExposureState.EXPOSURE; + case EXPOSUREALTERNATIVE: return org.hl7.fhir.r4.model.EffectEvidenceSynthesis.ExposureState.EXPOSUREALTERNATIVE; + default: return org.hl7.fhir.r4.model.EffectEvidenceSynthesis.ExposureState.NULL; + } +} + + public static org.hl7.fhir.r5.model.EffectEvidenceSynthesis.EffectEvidenceSynthesisEffectEstimateComponent convertEffectEvidenceSynthesisEffectEstimateComponent(org.hl7.fhir.r4.model.EffectEvidenceSynthesis.EffectEvidenceSynthesisEffectEstimateComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.EffectEvidenceSynthesis.EffectEvidenceSynthesisEffectEstimateComponent tgt = new org.hl7.fhir.r5.model.EffectEvidenceSynthesis.EffectEvidenceSynthesisEffectEstimateComponent(); + copyElement(src, tgt); + if (src.hasDescription()) + tgt.setDescriptionElement(convertString(src.getDescriptionElement())); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + if (src.hasVariantState()) + tgt.setVariantState(convertCodeableConcept(src.getVariantState())); + if (src.hasValue()) + tgt.setValueElement(convertDecimal(src.getValueElement())); + if (src.hasUnitOfMeasure()) + tgt.setUnitOfMeasure(convertCodeableConcept(src.getUnitOfMeasure())); + for (org.hl7.fhir.r4.model.EffectEvidenceSynthesis.EffectEvidenceSynthesisEffectEstimatePrecisionEstimateComponent t : src.getPrecisionEstimate()) + tgt.addPrecisionEstimate(convertEffectEvidenceSynthesisEffectEstimatePrecisionEstimateComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.EffectEvidenceSynthesis.EffectEvidenceSynthesisEffectEstimateComponent convertEffectEvidenceSynthesisEffectEstimateComponent(org.hl7.fhir.r5.model.EffectEvidenceSynthesis.EffectEvidenceSynthesisEffectEstimateComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.EffectEvidenceSynthesis.EffectEvidenceSynthesisEffectEstimateComponent tgt = new org.hl7.fhir.r4.model.EffectEvidenceSynthesis.EffectEvidenceSynthesisEffectEstimateComponent(); + copyElement(src, tgt); + if (src.hasDescription()) + tgt.setDescriptionElement(convertString(src.getDescriptionElement())); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + if (src.hasVariantState()) + tgt.setVariantState(convertCodeableConcept(src.getVariantState())); + if (src.hasValue()) + tgt.setValueElement(convertDecimal(src.getValueElement())); + if (src.hasUnitOfMeasure()) + tgt.setUnitOfMeasure(convertCodeableConcept(src.getUnitOfMeasure())); + for (org.hl7.fhir.r5.model.EffectEvidenceSynthesis.EffectEvidenceSynthesisEffectEstimatePrecisionEstimateComponent t : src.getPrecisionEstimate()) + tgt.addPrecisionEstimate(convertEffectEvidenceSynthesisEffectEstimatePrecisionEstimateComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.EffectEvidenceSynthesis.EffectEvidenceSynthesisEffectEstimatePrecisionEstimateComponent convertEffectEvidenceSynthesisEffectEstimatePrecisionEstimateComponent(org.hl7.fhir.r4.model.EffectEvidenceSynthesis.EffectEvidenceSynthesisEffectEstimatePrecisionEstimateComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.EffectEvidenceSynthesis.EffectEvidenceSynthesisEffectEstimatePrecisionEstimateComponent tgt = new org.hl7.fhir.r5.model.EffectEvidenceSynthesis.EffectEvidenceSynthesisEffectEstimatePrecisionEstimateComponent(); + copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + if (src.hasLevel()) + tgt.setLevelElement(convertDecimal(src.getLevelElement())); + if (src.hasFrom()) + tgt.setFromElement(convertDecimal(src.getFromElement())); + if (src.hasTo()) + tgt.setToElement(convertDecimal(src.getToElement())); + return tgt; + } + + public static org.hl7.fhir.r4.model.EffectEvidenceSynthesis.EffectEvidenceSynthesisEffectEstimatePrecisionEstimateComponent convertEffectEvidenceSynthesisEffectEstimatePrecisionEstimateComponent(org.hl7.fhir.r5.model.EffectEvidenceSynthesis.EffectEvidenceSynthesisEffectEstimatePrecisionEstimateComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.EffectEvidenceSynthesis.EffectEvidenceSynthesisEffectEstimatePrecisionEstimateComponent tgt = new org.hl7.fhir.r4.model.EffectEvidenceSynthesis.EffectEvidenceSynthesisEffectEstimatePrecisionEstimateComponent(); + copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + if (src.hasLevel()) + tgt.setLevelElement(convertDecimal(src.getLevelElement())); + if (src.hasFrom()) + tgt.setFromElement(convertDecimal(src.getFromElement())); + if (src.hasTo()) + tgt.setToElement(convertDecimal(src.getToElement())); + return tgt; + } + + public static org.hl7.fhir.r5.model.EffectEvidenceSynthesis.EffectEvidenceSynthesisCertaintyComponent convertEffectEvidenceSynthesisCertaintyComponent(org.hl7.fhir.r4.model.EffectEvidenceSynthesis.EffectEvidenceSynthesisCertaintyComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.EffectEvidenceSynthesis.EffectEvidenceSynthesisCertaintyComponent tgt = new org.hl7.fhir.r5.model.EffectEvidenceSynthesis.EffectEvidenceSynthesisCertaintyComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getRating()) + tgt.addRating(convertCodeableConcept(t)); + for (org.hl7.fhir.r4.model.Annotation t : src.getNote()) + tgt.addNote(convertAnnotation(t)); + for (org.hl7.fhir.r4.model.EffectEvidenceSynthesis.EffectEvidenceSynthesisCertaintyCertaintySubcomponentComponent t : src.getCertaintySubcomponent()) + tgt.addCertaintySubcomponent(convertEffectEvidenceSynthesisCertaintyCertaintySubcomponentComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.EffectEvidenceSynthesis.EffectEvidenceSynthesisCertaintyComponent convertEffectEvidenceSynthesisCertaintyComponent(org.hl7.fhir.r5.model.EffectEvidenceSynthesis.EffectEvidenceSynthesisCertaintyComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.EffectEvidenceSynthesis.EffectEvidenceSynthesisCertaintyComponent tgt = new org.hl7.fhir.r4.model.EffectEvidenceSynthesis.EffectEvidenceSynthesisCertaintyComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getRating()) + tgt.addRating(convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.Annotation t : src.getNote()) + tgt.addNote(convertAnnotation(t)); + for (org.hl7.fhir.r5.model.EffectEvidenceSynthesis.EffectEvidenceSynthesisCertaintyCertaintySubcomponentComponent t : src.getCertaintySubcomponent()) + tgt.addCertaintySubcomponent(convertEffectEvidenceSynthesisCertaintyCertaintySubcomponentComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.EffectEvidenceSynthesis.EffectEvidenceSynthesisCertaintyCertaintySubcomponentComponent convertEffectEvidenceSynthesisCertaintyCertaintySubcomponentComponent(org.hl7.fhir.r4.model.EffectEvidenceSynthesis.EffectEvidenceSynthesisCertaintyCertaintySubcomponentComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.EffectEvidenceSynthesis.EffectEvidenceSynthesisCertaintyCertaintySubcomponentComponent tgt = new org.hl7.fhir.r5.model.EffectEvidenceSynthesis.EffectEvidenceSynthesisCertaintyCertaintySubcomponentComponent(); + copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getRating()) + tgt.addRating(convertCodeableConcept(t)); + for (org.hl7.fhir.r4.model.Annotation t : src.getNote()) + tgt.addNote(convertAnnotation(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.EffectEvidenceSynthesis.EffectEvidenceSynthesisCertaintyCertaintySubcomponentComponent convertEffectEvidenceSynthesisCertaintyCertaintySubcomponentComponent(org.hl7.fhir.r5.model.EffectEvidenceSynthesis.EffectEvidenceSynthesisCertaintyCertaintySubcomponentComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.EffectEvidenceSynthesis.EffectEvidenceSynthesisCertaintyCertaintySubcomponentComponent tgt = new org.hl7.fhir.r4.model.EffectEvidenceSynthesis.EffectEvidenceSynthesisCertaintyCertaintySubcomponentComponent(); + copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getRating()) + tgt.addRating(convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.Annotation t : src.getNote()) + tgt.addNote(convertAnnotation(t)); + return tgt; + } + + +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Encounter.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Encounter.java new file mode 100644 index 000000000..b301f3cf6 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Encounter.java @@ -0,0 +1,397 @@ +package org.hl7.fhir.convertors.conv40_50; + +import org.hl7.fhir.exceptions.FHIRException; + +import org.hl7.fhir.convertors.VersionConvertor_40_50; + + +/* + Copyright (c) 2011+, HL7, Inc. + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of HL7 nor the names of its contributors may be used to + endorse or promote products derived from this software without specific + prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + +*/ + +// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0 + + +public class Encounter extends VersionConvertor_40_50 { + + public static org.hl7.fhir.r5.model.Encounter convertEncounter(org.hl7.fhir.r4.model.Encounter src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Encounter tgt = new org.hl7.fhir.r5.model.Encounter(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasStatus()) + tgt.setStatus(convertEncounterStatus(src.getStatus())); + for (org.hl7.fhir.r4.model.Encounter.StatusHistoryComponent t : src.getStatusHistory()) + tgt.addStatusHistory(convertStatusHistoryComponent(t)); + if (src.hasClass_()) + tgt.setClass_(convertCoding(src.getClass_())); + for (org.hl7.fhir.r4.model.Encounter.ClassHistoryComponent t : src.getClassHistory()) + tgt.addClassHistory(convertClassHistoryComponent(t)); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getType()) + tgt.addType(convertCodeableConcept(t)); + if (src.hasServiceType()) + tgt.setServiceType(convertCodeableConcept(src.getServiceType())); + if (src.hasPriority()) + tgt.setPriority(convertCodeableConcept(src.getPriority())); + if (src.hasSubject()) + tgt.setSubject(convertReference(src.getSubject())); + for (org.hl7.fhir.r4.model.Reference t : src.getEpisodeOfCare()) + tgt.addEpisodeOfCare(convertReference(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getBasedOn()) + tgt.addBasedOn(convertReference(t)); + for (org.hl7.fhir.r4.model.Encounter.EncounterParticipantComponent t : src.getParticipant()) + tgt.addParticipant(convertEncounterParticipantComponent(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getAppointment()) + tgt.addAppointment(convertReference(t)); + if (src.hasPeriod()) + tgt.setPeriod(convertPeriod(src.getPeriod())); + if (src.hasLength()) + tgt.setLength(convertDuration(src.getLength())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getReasonCode()) + tgt.addReasonCode(convertCodeableConcept(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getReasonReference()) + tgt.addReasonReference(convertReference(t)); + for (org.hl7.fhir.r4.model.Encounter.DiagnosisComponent t : src.getDiagnosis()) + tgt.addDiagnosis(convertDiagnosisComponent(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getAccount()) + tgt.addAccount(convertReference(t)); + if (src.hasHospitalization()) + tgt.setHospitalization(convertEncounterHospitalizationComponent(src.getHospitalization())); + for (org.hl7.fhir.r4.model.Encounter.EncounterLocationComponent t : src.getLocation()) + tgt.addLocation(convertEncounterLocationComponent(t)); + if (src.hasServiceProvider()) + tgt.setServiceProvider(convertReference(src.getServiceProvider())); + if (src.hasPartOf()) + tgt.setPartOf(convertReference(src.getPartOf())); + return tgt; + } + + public static org.hl7.fhir.r4.model.Encounter convertEncounter(org.hl7.fhir.r5.model.Encounter src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Encounter tgt = new org.hl7.fhir.r4.model.Encounter(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasStatus()) + tgt.setStatus(convertEncounterStatus(src.getStatus())); + for (org.hl7.fhir.r5.model.Encounter.StatusHistoryComponent t : src.getStatusHistory()) + tgt.addStatusHistory(convertStatusHistoryComponent(t)); + if (src.hasClass_()) + tgt.setClass_(convertCoding(src.getClass_())); + for (org.hl7.fhir.r5.model.Encounter.ClassHistoryComponent t : src.getClassHistory()) + tgt.addClassHistory(convertClassHistoryComponent(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getType()) + tgt.addType(convertCodeableConcept(t)); + if (src.hasServiceType()) + tgt.setServiceType(convertCodeableConcept(src.getServiceType())); + if (src.hasPriority()) + tgt.setPriority(convertCodeableConcept(src.getPriority())); + if (src.hasSubject()) + tgt.setSubject(convertReference(src.getSubject())); + for (org.hl7.fhir.r5.model.Reference t : src.getEpisodeOfCare()) + tgt.addEpisodeOfCare(convertReference(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getBasedOn()) + tgt.addBasedOn(convertReference(t)); + for (org.hl7.fhir.r5.model.Encounter.EncounterParticipantComponent t : src.getParticipant()) + tgt.addParticipant(convertEncounterParticipantComponent(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getAppointment()) + tgt.addAppointment(convertReference(t)); + if (src.hasPeriod()) + tgt.setPeriod(convertPeriod(src.getPeriod())); + if (src.hasLength()) + tgt.setLength(convertDuration(src.getLength())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getReasonCode()) + tgt.addReasonCode(convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getReasonReference()) + tgt.addReasonReference(convertReference(t)); + for (org.hl7.fhir.r5.model.Encounter.DiagnosisComponent t : src.getDiagnosis()) + tgt.addDiagnosis(convertDiagnosisComponent(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getAccount()) + tgt.addAccount(convertReference(t)); + if (src.hasHospitalization()) + tgt.setHospitalization(convertEncounterHospitalizationComponent(src.getHospitalization())); + for (org.hl7.fhir.r5.model.Encounter.EncounterLocationComponent t : src.getLocation()) + tgt.addLocation(convertEncounterLocationComponent(t)); + if (src.hasServiceProvider()) + tgt.setServiceProvider(convertReference(src.getServiceProvider())); + if (src.hasPartOf()) + tgt.setPartOf(convertReference(src.getPartOf())); + return tgt; + } + + public static org.hl7.fhir.r5.model.Encounter.EncounterStatus convertEncounterStatus(org.hl7.fhir.r4.model.Encounter.EncounterStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PLANNED: return org.hl7.fhir.r5.model.Encounter.EncounterStatus.PLANNED; + case ARRIVED: return org.hl7.fhir.r5.model.Encounter.EncounterStatus.ARRIVED; + case TRIAGED: return org.hl7.fhir.r5.model.Encounter.EncounterStatus.TRIAGED; + case INPROGRESS: return org.hl7.fhir.r5.model.Encounter.EncounterStatus.INPROGRESS; + case ONLEAVE: return org.hl7.fhir.r5.model.Encounter.EncounterStatus.ONLEAVE; + case FINISHED: return org.hl7.fhir.r5.model.Encounter.EncounterStatus.FINISHED; + case CANCELLED: return org.hl7.fhir.r5.model.Encounter.EncounterStatus.CANCELLED; + case ENTEREDINERROR: return org.hl7.fhir.r5.model.Encounter.EncounterStatus.ENTEREDINERROR; + case UNKNOWN: return org.hl7.fhir.r5.model.Encounter.EncounterStatus.UNKNOWN; + default: return org.hl7.fhir.r5.model.Encounter.EncounterStatus.NULL; + } +} + + public static org.hl7.fhir.r4.model.Encounter.EncounterStatus convertEncounterStatus(org.hl7.fhir.r5.model.Encounter.EncounterStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PLANNED: return org.hl7.fhir.r4.model.Encounter.EncounterStatus.PLANNED; + case ARRIVED: return org.hl7.fhir.r4.model.Encounter.EncounterStatus.ARRIVED; + case TRIAGED: return org.hl7.fhir.r4.model.Encounter.EncounterStatus.TRIAGED; + case INPROGRESS: return org.hl7.fhir.r4.model.Encounter.EncounterStatus.INPROGRESS; + case ONLEAVE: return org.hl7.fhir.r4.model.Encounter.EncounterStatus.ONLEAVE; + case FINISHED: return org.hl7.fhir.r4.model.Encounter.EncounterStatus.FINISHED; + case CANCELLED: return org.hl7.fhir.r4.model.Encounter.EncounterStatus.CANCELLED; + case ENTEREDINERROR: return org.hl7.fhir.r4.model.Encounter.EncounterStatus.ENTEREDINERROR; + case UNKNOWN: return org.hl7.fhir.r4.model.Encounter.EncounterStatus.UNKNOWN; + default: return org.hl7.fhir.r4.model.Encounter.EncounterStatus.NULL; + } +} + + public static org.hl7.fhir.r5.model.Encounter.StatusHistoryComponent convertStatusHistoryComponent(org.hl7.fhir.r4.model.Encounter.StatusHistoryComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Encounter.StatusHistoryComponent tgt = new org.hl7.fhir.r5.model.Encounter.StatusHistoryComponent(); + copyElement(src, tgt); + if (src.hasStatus()) + tgt.setStatus(convertEncounterStatus(src.getStatus())); + if (src.hasPeriod()) + tgt.setPeriod(convertPeriod(src.getPeriod())); + return tgt; + } + + public static org.hl7.fhir.r4.model.Encounter.StatusHistoryComponent convertStatusHistoryComponent(org.hl7.fhir.r5.model.Encounter.StatusHistoryComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Encounter.StatusHistoryComponent tgt = new org.hl7.fhir.r4.model.Encounter.StatusHistoryComponent(); + copyElement(src, tgt); + if (src.hasStatus()) + tgt.setStatus(convertEncounterStatus(src.getStatus())); + if (src.hasPeriod()) + tgt.setPeriod(convertPeriod(src.getPeriod())); + return tgt; + } + + public static org.hl7.fhir.r5.model.Encounter.ClassHistoryComponent convertClassHistoryComponent(org.hl7.fhir.r4.model.Encounter.ClassHistoryComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Encounter.ClassHistoryComponent tgt = new org.hl7.fhir.r5.model.Encounter.ClassHistoryComponent(); + copyElement(src, tgt); + if (src.hasClass_()) + tgt.setClass_(convertCoding(src.getClass_())); + if (src.hasPeriod()) + tgt.setPeriod(convertPeriod(src.getPeriod())); + return tgt; + } + + public static org.hl7.fhir.r4.model.Encounter.ClassHistoryComponent convertClassHistoryComponent(org.hl7.fhir.r5.model.Encounter.ClassHistoryComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Encounter.ClassHistoryComponent tgt = new org.hl7.fhir.r4.model.Encounter.ClassHistoryComponent(); + copyElement(src, tgt); + if (src.hasClass_()) + tgt.setClass_(convertCoding(src.getClass_())); + if (src.hasPeriod()) + tgt.setPeriod(convertPeriod(src.getPeriod())); + return tgt; + } + + public static org.hl7.fhir.r5.model.Encounter.EncounterParticipantComponent convertEncounterParticipantComponent(org.hl7.fhir.r4.model.Encounter.EncounterParticipantComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Encounter.EncounterParticipantComponent tgt = new org.hl7.fhir.r5.model.Encounter.EncounterParticipantComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getType()) + tgt.addType(convertCodeableConcept(t)); + if (src.hasPeriod()) + tgt.setPeriod(convertPeriod(src.getPeriod())); + if (src.hasIndividual()) + tgt.setIndividual(convertReference(src.getIndividual())); + return tgt; + } + + public static org.hl7.fhir.r4.model.Encounter.EncounterParticipantComponent convertEncounterParticipantComponent(org.hl7.fhir.r5.model.Encounter.EncounterParticipantComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Encounter.EncounterParticipantComponent tgt = new org.hl7.fhir.r4.model.Encounter.EncounterParticipantComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getType()) + tgt.addType(convertCodeableConcept(t)); + if (src.hasPeriod()) + tgt.setPeriod(convertPeriod(src.getPeriod())); + if (src.hasIndividual()) + tgt.setIndividual(convertReference(src.getIndividual())); + return tgt; + } + + public static org.hl7.fhir.r5.model.Encounter.DiagnosisComponent convertDiagnosisComponent(org.hl7.fhir.r4.model.Encounter.DiagnosisComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Encounter.DiagnosisComponent tgt = new org.hl7.fhir.r5.model.Encounter.DiagnosisComponent(); + copyElement(src, tgt); + if (src.hasCondition()) + tgt.setCondition(convertReference(src.getCondition())); + if (src.hasUse()) + tgt.setUse(convertCodeableConcept(src.getUse())); + if (src.hasRank()) + tgt.setRankElement(convertPositiveInt(src.getRankElement())); + return tgt; + } + + public static org.hl7.fhir.r4.model.Encounter.DiagnosisComponent convertDiagnosisComponent(org.hl7.fhir.r5.model.Encounter.DiagnosisComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Encounter.DiagnosisComponent tgt = new org.hl7.fhir.r4.model.Encounter.DiagnosisComponent(); + copyElement(src, tgt); + if (src.hasCondition()) + tgt.setCondition(convertReference(src.getCondition())); + if (src.hasUse()) + tgt.setUse(convertCodeableConcept(src.getUse())); + if (src.hasRank()) + tgt.setRankElement(convertPositiveInt(src.getRankElement())); + return tgt; + } + + public static org.hl7.fhir.r5.model.Encounter.EncounterHospitalizationComponent convertEncounterHospitalizationComponent(org.hl7.fhir.r4.model.Encounter.EncounterHospitalizationComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Encounter.EncounterHospitalizationComponent tgt = new org.hl7.fhir.r5.model.Encounter.EncounterHospitalizationComponent(); + copyElement(src, tgt); + if (src.hasPreAdmissionIdentifier()) + tgt.setPreAdmissionIdentifier(convertIdentifier(src.getPreAdmissionIdentifier())); + if (src.hasOrigin()) + tgt.setOrigin(convertReference(src.getOrigin())); + if (src.hasAdmitSource()) + tgt.setAdmitSource(convertCodeableConcept(src.getAdmitSource())); + if (src.hasReAdmission()) + tgt.setReAdmission(convertCodeableConcept(src.getReAdmission())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getDietPreference()) + tgt.addDietPreference(convertCodeableConcept(t)); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getSpecialCourtesy()) + tgt.addSpecialCourtesy(convertCodeableConcept(t)); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getSpecialArrangement()) + tgt.addSpecialArrangement(convertCodeableConcept(t)); + if (src.hasDestination()) + tgt.setDestination(convertReference(src.getDestination())); + if (src.hasDischargeDisposition()) + tgt.setDischargeDisposition(convertCodeableConcept(src.getDischargeDisposition())); + return tgt; + } + + public static org.hl7.fhir.r4.model.Encounter.EncounterHospitalizationComponent convertEncounterHospitalizationComponent(org.hl7.fhir.r5.model.Encounter.EncounterHospitalizationComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Encounter.EncounterHospitalizationComponent tgt = new org.hl7.fhir.r4.model.Encounter.EncounterHospitalizationComponent(); + copyElement(src, tgt); + if (src.hasPreAdmissionIdentifier()) + tgt.setPreAdmissionIdentifier(convertIdentifier(src.getPreAdmissionIdentifier())); + if (src.hasOrigin()) + tgt.setOrigin(convertReference(src.getOrigin())); + if (src.hasAdmitSource()) + tgt.setAdmitSource(convertCodeableConcept(src.getAdmitSource())); + if (src.hasReAdmission()) + tgt.setReAdmission(convertCodeableConcept(src.getReAdmission())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getDietPreference()) + tgt.addDietPreference(convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getSpecialCourtesy()) + tgt.addSpecialCourtesy(convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getSpecialArrangement()) + tgt.addSpecialArrangement(convertCodeableConcept(t)); + if (src.hasDestination()) + tgt.setDestination(convertReference(src.getDestination())); + if (src.hasDischargeDisposition()) + tgt.setDischargeDisposition(convertCodeableConcept(src.getDischargeDisposition())); + return tgt; + } + + public static org.hl7.fhir.r5.model.Encounter.EncounterLocationComponent convertEncounterLocationComponent(org.hl7.fhir.r4.model.Encounter.EncounterLocationComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Encounter.EncounterLocationComponent tgt = new org.hl7.fhir.r5.model.Encounter.EncounterLocationComponent(); + copyElement(src, tgt); + if (src.hasLocation()) + tgt.setLocation(convertReference(src.getLocation())); + if (src.hasStatus()) + tgt.setStatus(convertEncounterLocationStatus(src.getStatus())); + if (src.hasPhysicalType()) + tgt.setPhysicalType(convertCodeableConcept(src.getPhysicalType())); + if (src.hasPeriod()) + tgt.setPeriod(convertPeriod(src.getPeriod())); + return tgt; + } + + public static org.hl7.fhir.r4.model.Encounter.EncounterLocationComponent convertEncounterLocationComponent(org.hl7.fhir.r5.model.Encounter.EncounterLocationComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Encounter.EncounterLocationComponent tgt = new org.hl7.fhir.r4.model.Encounter.EncounterLocationComponent(); + copyElement(src, tgt); + if (src.hasLocation()) + tgt.setLocation(convertReference(src.getLocation())); + if (src.hasStatus()) + tgt.setStatus(convertEncounterLocationStatus(src.getStatus())); + if (src.hasPhysicalType()) + tgt.setPhysicalType(convertCodeableConcept(src.getPhysicalType())); + if (src.hasPeriod()) + tgt.setPeriod(convertPeriod(src.getPeriod())); + return tgt; + } + + public static org.hl7.fhir.r5.model.Encounter.EncounterLocationStatus convertEncounterLocationStatus(org.hl7.fhir.r4.model.Encounter.EncounterLocationStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PLANNED: return org.hl7.fhir.r5.model.Encounter.EncounterLocationStatus.PLANNED; + case ACTIVE: return org.hl7.fhir.r5.model.Encounter.EncounterLocationStatus.ACTIVE; + case RESERVED: return org.hl7.fhir.r5.model.Encounter.EncounterLocationStatus.RESERVED; + case COMPLETED: return org.hl7.fhir.r5.model.Encounter.EncounterLocationStatus.COMPLETED; + default: return org.hl7.fhir.r5.model.Encounter.EncounterLocationStatus.NULL; + } +} + + public static org.hl7.fhir.r4.model.Encounter.EncounterLocationStatus convertEncounterLocationStatus(org.hl7.fhir.r5.model.Encounter.EncounterLocationStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PLANNED: return org.hl7.fhir.r4.model.Encounter.EncounterLocationStatus.PLANNED; + case ACTIVE: return org.hl7.fhir.r4.model.Encounter.EncounterLocationStatus.ACTIVE; + case RESERVED: return org.hl7.fhir.r4.model.Encounter.EncounterLocationStatus.RESERVED; + case COMPLETED: return org.hl7.fhir.r4.model.Encounter.EncounterLocationStatus.COMPLETED; + default: return org.hl7.fhir.r4.model.Encounter.EncounterLocationStatus.NULL; + } +} + + +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Endpoint.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Endpoint.java new file mode 100644 index 000000000..b039b8f3b --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Endpoint.java @@ -0,0 +1,131 @@ +package org.hl7.fhir.convertors.conv40_50; + +import org.hl7.fhir.exceptions.FHIRException; + +import org.hl7.fhir.convertors.VersionConvertor_40_50; + + +/* + Copyright (c) 2011+, HL7, Inc. + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of HL7 nor the names of its contributors may be used to + endorse or promote products derived from this software without specific + prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + +*/ + +// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0 + + +public class Endpoint extends VersionConvertor_40_50 { + + public static org.hl7.fhir.r5.model.Endpoint convertEndpoint(org.hl7.fhir.r4.model.Endpoint src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Endpoint tgt = new org.hl7.fhir.r5.model.Endpoint(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasStatus()) + tgt.setStatus(convertEndpointStatus(src.getStatus())); + if (src.hasConnectionType()) + tgt.setConnectionType(convertCoding(src.getConnectionType())); + if (src.hasName()) + tgt.setNameElement(convertString(src.getNameElement())); + if (src.hasManagingOrganization()) + tgt.setManagingOrganization(convertReference(src.getManagingOrganization())); + for (org.hl7.fhir.r4.model.ContactPoint t : src.getContact()) + tgt.addContact(convertContactPoint(t)); + if (src.hasPeriod()) + tgt.setPeriod(convertPeriod(src.getPeriod())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getPayloadType()) + tgt.addPayloadType(convertCodeableConcept(t)); + for (org.hl7.fhir.r4.model.CodeType t : src.getPayloadMimeType()) + tgt.getPayloadMimeType().add(convertCode(t)); + if (src.hasAddress()) + tgt.setAddressElement(convertUrl(src.getAddressElement())); + for (org.hl7.fhir.r4.model.StringType t : src.getHeader()) + tgt.getHeader().add(convertString(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.Endpoint convertEndpoint(org.hl7.fhir.r5.model.Endpoint src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Endpoint tgt = new org.hl7.fhir.r4.model.Endpoint(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasStatus()) + tgt.setStatus(convertEndpointStatus(src.getStatus())); + if (src.hasConnectionType()) + tgt.setConnectionType(convertCoding(src.getConnectionType())); + if (src.hasName()) + tgt.setNameElement(convertString(src.getNameElement())); + if (src.hasManagingOrganization()) + tgt.setManagingOrganization(convertReference(src.getManagingOrganization())); + for (org.hl7.fhir.r5.model.ContactPoint t : src.getContact()) + tgt.addContact(convertContactPoint(t)); + if (src.hasPeriod()) + tgt.setPeriod(convertPeriod(src.getPeriod())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getPayloadType()) + tgt.addPayloadType(convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.CodeType t : src.getPayloadMimeType()) + tgt.getPayloadMimeType().add(convertCode(t)); + if (src.hasAddress()) + tgt.setAddressElement(convertUrl(src.getAddressElement())); + for (org.hl7.fhir.r5.model.StringType t : src.getHeader()) + tgt.getHeader().add(convertString(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.Endpoint.EndpointStatus convertEndpointStatus(org.hl7.fhir.r4.model.Endpoint.EndpointStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case ACTIVE: return org.hl7.fhir.r5.model.Endpoint.EndpointStatus.ACTIVE; + case SUSPENDED: return org.hl7.fhir.r5.model.Endpoint.EndpointStatus.SUSPENDED; + case ERROR: return org.hl7.fhir.r5.model.Endpoint.EndpointStatus.ERROR; + case OFF: return org.hl7.fhir.r5.model.Endpoint.EndpointStatus.OFF; + case ENTEREDINERROR: return org.hl7.fhir.r5.model.Endpoint.EndpointStatus.ENTEREDINERROR; + case TEST: return org.hl7.fhir.r5.model.Endpoint.EndpointStatus.TEST; + default: return org.hl7.fhir.r5.model.Endpoint.EndpointStatus.NULL; + } +} + + public static org.hl7.fhir.r4.model.Endpoint.EndpointStatus convertEndpointStatus(org.hl7.fhir.r5.model.Endpoint.EndpointStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case ACTIVE: return org.hl7.fhir.r4.model.Endpoint.EndpointStatus.ACTIVE; + case SUSPENDED: return org.hl7.fhir.r4.model.Endpoint.EndpointStatus.SUSPENDED; + case ERROR: return org.hl7.fhir.r4.model.Endpoint.EndpointStatus.ERROR; + case OFF: return org.hl7.fhir.r4.model.Endpoint.EndpointStatus.OFF; + case ENTEREDINERROR: return org.hl7.fhir.r4.model.Endpoint.EndpointStatus.ENTEREDINERROR; + case TEST: return org.hl7.fhir.r4.model.Endpoint.EndpointStatus.TEST; + default: return org.hl7.fhir.r4.model.Endpoint.EndpointStatus.NULL; + } +} + + +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/EnrollmentRequest.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/EnrollmentRequest.java new file mode 100644 index 000000000..a926b7f7d --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/EnrollmentRequest.java @@ -0,0 +1,111 @@ +package org.hl7.fhir.convertors.conv40_50; + +import org.hl7.fhir.exceptions.FHIRException; + +import org.hl7.fhir.convertors.VersionConvertor_40_50; + + +/* + Copyright (c) 2011+, HL7, Inc. + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of HL7 nor the names of its contributors may be used to + endorse or promote products derived from this software without specific + prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + +*/ + +// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0 + + +public class EnrollmentRequest extends VersionConvertor_40_50 { + + public static org.hl7.fhir.r5.model.EnrollmentRequest convertEnrollmentRequest(org.hl7.fhir.r4.model.EnrollmentRequest src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.EnrollmentRequest tgt = new org.hl7.fhir.r5.model.EnrollmentRequest(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasStatus()) + tgt.setStatus(convertEnrollmentRequestStatus(src.getStatus())); + if (src.hasCreated()) + tgt.setCreatedElement(convertDateTime(src.getCreatedElement())); + if (src.hasInsurer()) + tgt.setInsurer(convertReference(src.getInsurer())); + if (src.hasProvider()) + tgt.setProvider(convertReference(src.getProvider())); + if (src.hasCandidate()) + tgt.setCandidate(convertReference(src.getCandidate())); + if (src.hasCoverage()) + tgt.setCoverage(convertReference(src.getCoverage())); + return tgt; + } + + public static org.hl7.fhir.r4.model.EnrollmentRequest convertEnrollmentRequest(org.hl7.fhir.r5.model.EnrollmentRequest src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.EnrollmentRequest tgt = new org.hl7.fhir.r4.model.EnrollmentRequest(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasStatus()) + tgt.setStatus(convertEnrollmentRequestStatus(src.getStatus())); + if (src.hasCreated()) + tgt.setCreatedElement(convertDateTime(src.getCreatedElement())); + if (src.hasInsurer()) + tgt.setInsurer(convertReference(src.getInsurer())); + if (src.hasProvider()) + tgt.setProvider(convertReference(src.getProvider())); + if (src.hasCandidate()) + tgt.setCandidate(convertReference(src.getCandidate())); + if (src.hasCoverage()) + tgt.setCoverage(convertReference(src.getCoverage())); + return tgt; + } + + public static org.hl7.fhir.r5.model.EnrollmentRequest.EnrollmentRequestStatus convertEnrollmentRequestStatus(org.hl7.fhir.r4.model.EnrollmentRequest.EnrollmentRequestStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case ACTIVE: return org.hl7.fhir.r5.model.EnrollmentRequest.EnrollmentRequestStatus.ACTIVE; + case CANCELLED: return org.hl7.fhir.r5.model.EnrollmentRequest.EnrollmentRequestStatus.CANCELLED; + case DRAFT: return org.hl7.fhir.r5.model.EnrollmentRequest.EnrollmentRequestStatus.DRAFT; + case ENTEREDINERROR: return org.hl7.fhir.r5.model.EnrollmentRequest.EnrollmentRequestStatus.ENTEREDINERROR; + default: return org.hl7.fhir.r5.model.EnrollmentRequest.EnrollmentRequestStatus.NULL; + } +} + + public static org.hl7.fhir.r4.model.EnrollmentRequest.EnrollmentRequestStatus convertEnrollmentRequestStatus(org.hl7.fhir.r5.model.EnrollmentRequest.EnrollmentRequestStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case ACTIVE: return org.hl7.fhir.r4.model.EnrollmentRequest.EnrollmentRequestStatus.ACTIVE; + case CANCELLED: return org.hl7.fhir.r4.model.EnrollmentRequest.EnrollmentRequestStatus.CANCELLED; + case DRAFT: return org.hl7.fhir.r4.model.EnrollmentRequest.EnrollmentRequestStatus.DRAFT; + case ENTEREDINERROR: return org.hl7.fhir.r4.model.EnrollmentRequest.EnrollmentRequestStatus.ENTEREDINERROR; + default: return org.hl7.fhir.r4.model.EnrollmentRequest.EnrollmentRequestStatus.NULL; + } +} + + +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/EnrollmentResponse.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/EnrollmentResponse.java new file mode 100644 index 000000000..f0a480314 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/EnrollmentResponse.java @@ -0,0 +1,139 @@ +package org.hl7.fhir.convertors.conv40_50; + +import org.hl7.fhir.exceptions.FHIRException; + +import org.hl7.fhir.convertors.VersionConvertor_40_50; + + +/* + Copyright (c) 2011+, HL7, Inc. + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of HL7 nor the names of its contributors may be used to + endorse or promote products derived from this software without specific + prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + +*/ + +// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0 + + +public class EnrollmentResponse extends VersionConvertor_40_50 { + + public static org.hl7.fhir.r5.model.EnrollmentResponse convertEnrollmentResponse(org.hl7.fhir.r4.model.EnrollmentResponse src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.EnrollmentResponse tgt = new org.hl7.fhir.r5.model.EnrollmentResponse(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasStatus()) + tgt.setStatus(convertEnrollmentResponseStatus(src.getStatus())); + if (src.hasRequest()) + tgt.setRequest(convertReference(src.getRequest())); + if (src.hasOutcome()) + tgt.setOutcome(convertRemittanceOutcome(src.getOutcome())); + if (src.hasDisposition()) + tgt.setDispositionElement(convertString(src.getDispositionElement())); + if (src.hasCreated()) + tgt.setCreatedElement(convertDateTime(src.getCreatedElement())); + if (src.hasOrganization()) + tgt.setOrganization(convertReference(src.getOrganization())); + if (src.hasRequestProvider()) + tgt.setRequestProvider(convertReference(src.getRequestProvider())); + return tgt; + } + + public static org.hl7.fhir.r4.model.EnrollmentResponse convertEnrollmentResponse(org.hl7.fhir.r5.model.EnrollmentResponse src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.EnrollmentResponse tgt = new org.hl7.fhir.r4.model.EnrollmentResponse(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasStatus()) + tgt.setStatus(convertEnrollmentResponseStatus(src.getStatus())); + if (src.hasRequest()) + tgt.setRequest(convertReference(src.getRequest())); + if (src.hasOutcome()) + tgt.setOutcome(convertRemittanceOutcome(src.getOutcome())); + if (src.hasDisposition()) + tgt.setDispositionElement(convertString(src.getDispositionElement())); + if (src.hasCreated()) + tgt.setCreatedElement(convertDateTime(src.getCreatedElement())); + if (src.hasOrganization()) + tgt.setOrganization(convertReference(src.getOrganization())); + if (src.hasRequestProvider()) + tgt.setRequestProvider(convertReference(src.getRequestProvider())); + return tgt; + } + + public static org.hl7.fhir.r5.model.EnrollmentResponse.EnrollmentResponseStatus convertEnrollmentResponseStatus(org.hl7.fhir.r4.model.EnrollmentResponse.EnrollmentResponseStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case ACTIVE: return org.hl7.fhir.r5.model.EnrollmentResponse.EnrollmentResponseStatus.ACTIVE; + case CANCELLED: return org.hl7.fhir.r5.model.EnrollmentResponse.EnrollmentResponseStatus.CANCELLED; + case DRAFT: return org.hl7.fhir.r5.model.EnrollmentResponse.EnrollmentResponseStatus.DRAFT; + case ENTEREDINERROR: return org.hl7.fhir.r5.model.EnrollmentResponse.EnrollmentResponseStatus.ENTEREDINERROR; + default: return org.hl7.fhir.r5.model.EnrollmentResponse.EnrollmentResponseStatus.NULL; + } +} + + public static org.hl7.fhir.r4.model.EnrollmentResponse.EnrollmentResponseStatus convertEnrollmentResponseStatus(org.hl7.fhir.r5.model.EnrollmentResponse.EnrollmentResponseStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case ACTIVE: return org.hl7.fhir.r4.model.EnrollmentResponse.EnrollmentResponseStatus.ACTIVE; + case CANCELLED: return org.hl7.fhir.r4.model.EnrollmentResponse.EnrollmentResponseStatus.CANCELLED; + case DRAFT: return org.hl7.fhir.r4.model.EnrollmentResponse.EnrollmentResponseStatus.DRAFT; + case ENTEREDINERROR: return org.hl7.fhir.r4.model.EnrollmentResponse.EnrollmentResponseStatus.ENTEREDINERROR; + default: return org.hl7.fhir.r4.model.EnrollmentResponse.EnrollmentResponseStatus.NULL; + } +} + + public static org.hl7.fhir.r5.model.Enumerations.RemittanceOutcome convertRemittanceOutcome(org.hl7.fhir.r4.model.Enumerations.RemittanceOutcome src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case QUEUED: return org.hl7.fhir.r5.model.Enumerations.RemittanceOutcome.QUEUED; + case COMPLETE: return org.hl7.fhir.r5.model.Enumerations.RemittanceOutcome.COMPLETE; + case ERROR: return org.hl7.fhir.r5.model.Enumerations.RemittanceOutcome.ERROR; + case PARTIAL: return org.hl7.fhir.r5.model.Enumerations.RemittanceOutcome.PARTIAL; + default: return org.hl7.fhir.r5.model.Enumerations.RemittanceOutcome.NULL; + } +} + + public static org.hl7.fhir.r4.model.Enumerations.RemittanceOutcome convertRemittanceOutcome(org.hl7.fhir.r5.model.Enumerations.RemittanceOutcome src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case QUEUED: return org.hl7.fhir.r4.model.Enumerations.RemittanceOutcome.QUEUED; + case COMPLETE: return org.hl7.fhir.r4.model.Enumerations.RemittanceOutcome.COMPLETE; + case ERROR: return org.hl7.fhir.r4.model.Enumerations.RemittanceOutcome.ERROR; + case PARTIAL: return org.hl7.fhir.r4.model.Enumerations.RemittanceOutcome.PARTIAL; + default: return org.hl7.fhir.r4.model.Enumerations.RemittanceOutcome.NULL; + } +} + + +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Enumerations.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Enumerations.java new file mode 100644 index 000000000..d63bbc705 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Enumerations.java @@ -0,0 +1,287 @@ +package org.hl7.fhir.convertors.conv40_50; + +import org.hl7.fhir.exceptions.FHIRException; + +import org.hl7.fhir.convertors.VersionConvertor_40_50; + + +/* + Copyright (c) 2011+, HL7, Inc. + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of HL7 nor the names of its contributors may be used to + endorse or promote products derived from this software without specific + prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + +*/ + +// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0 + + +public class Enumerations extends VersionConvertor_40_50 { + + public static org.hl7.fhir.r5.model.Enumerations.BindingStrength convertBindingStrength(org.hl7.fhir.r4.model.Enumerations.BindingStrength src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case REQUIRED: return org.hl7.fhir.r5.model.Enumerations.BindingStrength.REQUIRED; + case EXTENSIBLE: return org.hl7.fhir.r5.model.Enumerations.BindingStrength.EXTENSIBLE; + case PREFERRED: return org.hl7.fhir.r5.model.Enumerations.BindingStrength.PREFERRED; + case EXAMPLE: return org.hl7.fhir.r5.model.Enumerations.BindingStrength.EXAMPLE; + default: return org.hl7.fhir.r5.model.Enumerations.BindingStrength.NULL; + } +} + + public static org.hl7.fhir.r4.model.Enumerations.BindingStrength convertBindingStrength(org.hl7.fhir.r5.model.Enumerations.BindingStrength src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case REQUIRED: return org.hl7.fhir.r4.model.Enumerations.BindingStrength.REQUIRED; + case EXTENSIBLE: return org.hl7.fhir.r4.model.Enumerations.BindingStrength.EXTENSIBLE; + case PREFERRED: return org.hl7.fhir.r4.model.Enumerations.BindingStrength.PREFERRED; + case EXAMPLE: return org.hl7.fhir.r4.model.Enumerations.BindingStrength.EXAMPLE; + default: return org.hl7.fhir.r4.model.Enumerations.BindingStrength.NULL; + } +} + + public static org.hl7.fhir.r5.model.Enumerations.PublicationStatus convertPublicationStatus(org.hl7.fhir.r4.model.Enumerations.PublicationStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case DRAFT: return org.hl7.fhir.r5.model.Enumerations.PublicationStatus.DRAFT; + case ACTIVE: return org.hl7.fhir.r5.model.Enumerations.PublicationStatus.ACTIVE; + case RETIRED: return org.hl7.fhir.r5.model.Enumerations.PublicationStatus.RETIRED; + case UNKNOWN: return org.hl7.fhir.r5.model.Enumerations.PublicationStatus.UNKNOWN; + default: return org.hl7.fhir.r5.model.Enumerations.PublicationStatus.NULL; + } +} + + public static org.hl7.fhir.r4.model.Enumerations.PublicationStatus convertPublicationStatus(org.hl7.fhir.r5.model.Enumerations.PublicationStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case DRAFT: return org.hl7.fhir.r4.model.Enumerations.PublicationStatus.DRAFT; + case ACTIVE: return org.hl7.fhir.r4.model.Enumerations.PublicationStatus.ACTIVE; + case RETIRED: return org.hl7.fhir.r4.model.Enumerations.PublicationStatus.RETIRED; + case UNKNOWN: return org.hl7.fhir.r4.model.Enumerations.PublicationStatus.UNKNOWN; + default: return org.hl7.fhir.r4.model.Enumerations.PublicationStatus.NULL; + } +} + + public static org.hl7.fhir.r5.model.Enumerations.FHIRVersion convertFHIRVersion(org.hl7.fhir.r4.model.Enumerations.FHIRVersion src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case _0_01: return org.hl7.fhir.r5.model.Enumerations.FHIRVersion._0_01; + case _0_05: return org.hl7.fhir.r5.model.Enumerations.FHIRVersion._0_05; + case _0_06: return org.hl7.fhir.r5.model.Enumerations.FHIRVersion._0_06; + case _0_11: return org.hl7.fhir.r5.model.Enumerations.FHIRVersion._0_11; + case _0_0_80: return org.hl7.fhir.r5.model.Enumerations.FHIRVersion._0_0_80; + case _0_0_81: return org.hl7.fhir.r5.model.Enumerations.FHIRVersion._0_0_81; + case _0_0_82: return org.hl7.fhir.r5.model.Enumerations.FHIRVersion._0_0_82; + case _0_4_0: return org.hl7.fhir.r5.model.Enumerations.FHIRVersion._0_4_0; + case _0_5_0: return org.hl7.fhir.r5.model.Enumerations.FHIRVersion._0_5_0; + case _1_0_0: return org.hl7.fhir.r5.model.Enumerations.FHIRVersion._1_0_0; + case _1_0_1: return org.hl7.fhir.r5.model.Enumerations.FHIRVersion._1_0_1; + case _1_0_2: return org.hl7.fhir.r5.model.Enumerations.FHIRVersion._1_0_2; + case _1_1_0: return org.hl7.fhir.r5.model.Enumerations.FHIRVersion._1_1_0; + case _1_4_0: return org.hl7.fhir.r5.model.Enumerations.FHIRVersion._1_4_0; + case _1_6_0: return org.hl7.fhir.r5.model.Enumerations.FHIRVersion._1_6_0; + case _1_8_0: return org.hl7.fhir.r5.model.Enumerations.FHIRVersion._1_8_0; + case _3_0_0: return org.hl7.fhir.r5.model.Enumerations.FHIRVersion._3_0_0; + case _3_0_1: return org.hl7.fhir.r5.model.Enumerations.FHIRVersion._3_0_1; + case _3_3_0: return org.hl7.fhir.r5.model.Enumerations.FHIRVersion._3_3_0; + case _3_5_0: return org.hl7.fhir.r5.model.Enumerations.FHIRVersion._3_5_0; + case _4_0_0: return org.hl7.fhir.r5.model.Enumerations.FHIRVersion._4_0_0; + default: return org.hl7.fhir.r5.model.Enumerations.FHIRVersion.NULL; + } +} + + public static org.hl7.fhir.r4.model.Enumerations.FHIRVersion convertFHIRVersion(org.hl7.fhir.r5.model.Enumerations.FHIRVersion src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case _0_01: return org.hl7.fhir.r4.model.Enumerations.FHIRVersion._0_01; + case _0_05: return org.hl7.fhir.r4.model.Enumerations.FHIRVersion._0_05; + case _0_06: return org.hl7.fhir.r4.model.Enumerations.FHIRVersion._0_06; + case _0_11: return org.hl7.fhir.r4.model.Enumerations.FHIRVersion._0_11; + case _0_0_80: return org.hl7.fhir.r4.model.Enumerations.FHIRVersion._0_0_80; + case _0_0_81: return org.hl7.fhir.r4.model.Enumerations.FHIRVersion._0_0_81; + case _0_0_82: return org.hl7.fhir.r4.model.Enumerations.FHIRVersion._0_0_82; + case _0_4_0: return org.hl7.fhir.r4.model.Enumerations.FHIRVersion._0_4_0; + case _0_5_0: return org.hl7.fhir.r4.model.Enumerations.FHIRVersion._0_5_0; + case _1_0_0: return org.hl7.fhir.r4.model.Enumerations.FHIRVersion._1_0_0; + case _1_0_1: return org.hl7.fhir.r4.model.Enumerations.FHIRVersion._1_0_1; + case _1_0_2: return org.hl7.fhir.r4.model.Enumerations.FHIRVersion._1_0_2; + case _1_1_0: return org.hl7.fhir.r4.model.Enumerations.FHIRVersion._1_1_0; + case _1_4_0: return org.hl7.fhir.r4.model.Enumerations.FHIRVersion._1_4_0; + case _1_6_0: return org.hl7.fhir.r4.model.Enumerations.FHIRVersion._1_6_0; + case _1_8_0: return org.hl7.fhir.r4.model.Enumerations.FHIRVersion._1_8_0; + case _3_0_0: return org.hl7.fhir.r4.model.Enumerations.FHIRVersion._3_0_0; + case _3_0_1: return org.hl7.fhir.r4.model.Enumerations.FHIRVersion._3_0_1; + case _3_3_0: return org.hl7.fhir.r4.model.Enumerations.FHIRVersion._3_3_0; + case _3_5_0: return org.hl7.fhir.r4.model.Enumerations.FHIRVersion._3_5_0; + case _4_0_0: return org.hl7.fhir.r4.model.Enumerations.FHIRVersion._4_0_0; + default: return org.hl7.fhir.r4.model.Enumerations.FHIRVersion.NULL; + } +} + + public static org.hl7.fhir.r5.model.Enumerations.SearchParamType convertSearchParamType(org.hl7.fhir.r4.model.Enumerations.SearchParamType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case NUMBER: return org.hl7.fhir.r5.model.Enumerations.SearchParamType.NUMBER; + case DATE: return org.hl7.fhir.r5.model.Enumerations.SearchParamType.DATE; + case STRING: return org.hl7.fhir.r5.model.Enumerations.SearchParamType.STRING; + case TOKEN: return org.hl7.fhir.r5.model.Enumerations.SearchParamType.TOKEN; + case REFERENCE: return org.hl7.fhir.r5.model.Enumerations.SearchParamType.REFERENCE; + case COMPOSITE: return org.hl7.fhir.r5.model.Enumerations.SearchParamType.COMPOSITE; + case QUANTITY: return org.hl7.fhir.r5.model.Enumerations.SearchParamType.QUANTITY; + case URI: return org.hl7.fhir.r5.model.Enumerations.SearchParamType.URI; + case SPECIAL: return org.hl7.fhir.r5.model.Enumerations.SearchParamType.SPECIAL; + default: return org.hl7.fhir.r5.model.Enumerations.SearchParamType.NULL; + } +} + + public static org.hl7.fhir.r4.model.Enumerations.SearchParamType convertSearchParamType(org.hl7.fhir.r5.model.Enumerations.SearchParamType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case NUMBER: return org.hl7.fhir.r4.model.Enumerations.SearchParamType.NUMBER; + case DATE: return org.hl7.fhir.r4.model.Enumerations.SearchParamType.DATE; + case STRING: return org.hl7.fhir.r4.model.Enumerations.SearchParamType.STRING; + case TOKEN: return org.hl7.fhir.r4.model.Enumerations.SearchParamType.TOKEN; + case REFERENCE: return org.hl7.fhir.r4.model.Enumerations.SearchParamType.REFERENCE; + case COMPOSITE: return org.hl7.fhir.r4.model.Enumerations.SearchParamType.COMPOSITE; + case QUANTITY: return org.hl7.fhir.r4.model.Enumerations.SearchParamType.QUANTITY; + case URI: return org.hl7.fhir.r4.model.Enumerations.SearchParamType.URI; + case SPECIAL: return org.hl7.fhir.r4.model.Enumerations.SearchParamType.SPECIAL; + default: return org.hl7.fhir.r4.model.Enumerations.SearchParamType.NULL; + } +} + + public static org.hl7.fhir.r5.model.Enumerations.NoteType convertNoteType(org.hl7.fhir.r4.model.Enumerations.NoteType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case DISPLAY: return org.hl7.fhir.r5.model.Enumerations.NoteType.DISPLAY; + case PRINT: return org.hl7.fhir.r5.model.Enumerations.NoteType.PRINT; + case PRINTOPER: return org.hl7.fhir.r5.model.Enumerations.NoteType.PRINTOPER; + default: return org.hl7.fhir.r5.model.Enumerations.NoteType.NULL; + } +} + + public static org.hl7.fhir.r4.model.Enumerations.NoteType convertNoteType(org.hl7.fhir.r5.model.Enumerations.NoteType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case DISPLAY: return org.hl7.fhir.r4.model.Enumerations.NoteType.DISPLAY; + case PRINT: return org.hl7.fhir.r4.model.Enumerations.NoteType.PRINT; + case PRINTOPER: return org.hl7.fhir.r4.model.Enumerations.NoteType.PRINTOPER; + default: return org.hl7.fhir.r4.model.Enumerations.NoteType.NULL; + } +} + + public static org.hl7.fhir.r5.model.Enumerations.ConceptMapEquivalence convertConceptMapEquivalence(org.hl7.fhir.r4.model.Enumerations.ConceptMapEquivalence src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case RELATEDTO: return org.hl7.fhir.r5.model.Enumerations.ConceptMapEquivalence.RELATEDTO; + case EQUIVALENT: return org.hl7.fhir.r5.model.Enumerations.ConceptMapEquivalence.EQUIVALENT; + case EQUAL: return org.hl7.fhir.r5.model.Enumerations.ConceptMapEquivalence.EQUAL; + case WIDER: return org.hl7.fhir.r5.model.Enumerations.ConceptMapEquivalence.WIDER; + case SUBSUMES: return org.hl7.fhir.r5.model.Enumerations.ConceptMapEquivalence.SUBSUMES; + case NARROWER: return org.hl7.fhir.r5.model.Enumerations.ConceptMapEquivalence.NARROWER; + case SPECIALIZES: return org.hl7.fhir.r5.model.Enumerations.ConceptMapEquivalence.SPECIALIZES; + case INEXACT: return org.hl7.fhir.r5.model.Enumerations.ConceptMapEquivalence.INEXACT; + case UNMATCHED: return org.hl7.fhir.r5.model.Enumerations.ConceptMapEquivalence.UNMATCHED; + case DISJOINT: return org.hl7.fhir.r5.model.Enumerations.ConceptMapEquivalence.DISJOINT; + default: return org.hl7.fhir.r5.model.Enumerations.ConceptMapEquivalence.NULL; + } +} + + public static org.hl7.fhir.r4.model.Enumerations.ConceptMapEquivalence convertConceptMapEquivalence(org.hl7.fhir.r5.model.Enumerations.ConceptMapEquivalence src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case RELATEDTO: return org.hl7.fhir.r4.model.Enumerations.ConceptMapEquivalence.RELATEDTO; + case EQUIVALENT: return org.hl7.fhir.r4.model.Enumerations.ConceptMapEquivalence.EQUIVALENT; + case EQUAL: return org.hl7.fhir.r4.model.Enumerations.ConceptMapEquivalence.EQUAL; + case WIDER: return org.hl7.fhir.r4.model.Enumerations.ConceptMapEquivalence.WIDER; + case SUBSUMES: return org.hl7.fhir.r4.model.Enumerations.ConceptMapEquivalence.SUBSUMES; + case NARROWER: return org.hl7.fhir.r4.model.Enumerations.ConceptMapEquivalence.NARROWER; + case SPECIALIZES: return org.hl7.fhir.r4.model.Enumerations.ConceptMapEquivalence.SPECIALIZES; + case INEXACT: return org.hl7.fhir.r4.model.Enumerations.ConceptMapEquivalence.INEXACT; + case UNMATCHED: return org.hl7.fhir.r4.model.Enumerations.ConceptMapEquivalence.UNMATCHED; + case DISJOINT: return org.hl7.fhir.r4.model.Enumerations.ConceptMapEquivalence.DISJOINT; + default: return org.hl7.fhir.r4.model.Enumerations.ConceptMapEquivalence.NULL; + } +} + + public static org.hl7.fhir.r5.model.Enumerations.DocumentReferenceStatus convertDocumentReferenceStatus(org.hl7.fhir.r4.model.Enumerations.DocumentReferenceStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case CURRENT: return org.hl7.fhir.r5.model.Enumerations.DocumentReferenceStatus.CURRENT; + case SUPERSEDED: return org.hl7.fhir.r5.model.Enumerations.DocumentReferenceStatus.SUPERSEDED; + case ENTEREDINERROR: return org.hl7.fhir.r5.model.Enumerations.DocumentReferenceStatus.ENTEREDINERROR; + default: return org.hl7.fhir.r5.model.Enumerations.DocumentReferenceStatus.NULL; + } +} + + public static org.hl7.fhir.r4.model.Enumerations.DocumentReferenceStatus convertDocumentReferenceStatus(org.hl7.fhir.r5.model.Enumerations.DocumentReferenceStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case CURRENT: return org.hl7.fhir.r4.model.Enumerations.DocumentReferenceStatus.CURRENT; + case SUPERSEDED: return org.hl7.fhir.r4.model.Enumerations.DocumentReferenceStatus.SUPERSEDED; + case ENTEREDINERROR: return org.hl7.fhir.r4.model.Enumerations.DocumentReferenceStatus.ENTEREDINERROR; + default: return org.hl7.fhir.r4.model.Enumerations.DocumentReferenceStatus.NULL; + } +} + + public static org.hl7.fhir.r5.model.Enumerations.AdministrativeGender convertAdministrativeGender(org.hl7.fhir.r4.model.Enumerations.AdministrativeGender src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case MALE: return org.hl7.fhir.r5.model.Enumerations.AdministrativeGender.MALE; + case FEMALE: return org.hl7.fhir.r5.model.Enumerations.AdministrativeGender.FEMALE; + case OTHER: return org.hl7.fhir.r5.model.Enumerations.AdministrativeGender.OTHER; + case UNKNOWN: return org.hl7.fhir.r5.model.Enumerations.AdministrativeGender.UNKNOWN; + default: return org.hl7.fhir.r5.model.Enumerations.AdministrativeGender.NULL; + } +} + + public static org.hl7.fhir.r4.model.Enumerations.AdministrativeGender convertAdministrativeGender(org.hl7.fhir.r5.model.Enumerations.AdministrativeGender src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case MALE: return org.hl7.fhir.r4.model.Enumerations.AdministrativeGender.MALE; + case FEMALE: return org.hl7.fhir.r4.model.Enumerations.AdministrativeGender.FEMALE; + case OTHER: return org.hl7.fhir.r4.model.Enumerations.AdministrativeGender.OTHER; + case UNKNOWN: return org.hl7.fhir.r4.model.Enumerations.AdministrativeGender.UNKNOWN; + default: return org.hl7.fhir.r4.model.Enumerations.AdministrativeGender.NULL; + } +} + + +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/EpisodeOfCare.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/EpisodeOfCare.java new file mode 100644 index 000000000..712dcf8f3 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/EpisodeOfCare.java @@ -0,0 +1,189 @@ +package org.hl7.fhir.convertors.conv40_50; + +import org.hl7.fhir.exceptions.FHIRException; + +import org.hl7.fhir.convertors.VersionConvertor_40_50; + + +/* + Copyright (c) 2011+, HL7, Inc. + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of HL7 nor the names of its contributors may be used to + endorse or promote products derived from this software without specific + prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + +*/ + +// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0 + + +public class EpisodeOfCare extends VersionConvertor_40_50 { + + public static org.hl7.fhir.r5.model.EpisodeOfCare convertEpisodeOfCare(org.hl7.fhir.r4.model.EpisodeOfCare src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.EpisodeOfCare tgt = new org.hl7.fhir.r5.model.EpisodeOfCare(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasStatus()) + tgt.setStatus(convertEpisodeOfCareStatus(src.getStatus())); + for (org.hl7.fhir.r4.model.EpisodeOfCare.EpisodeOfCareStatusHistoryComponent t : src.getStatusHistory()) + tgt.addStatusHistory(convertEpisodeOfCareStatusHistoryComponent(t)); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getType()) + tgt.addType(convertCodeableConcept(t)); + for (org.hl7.fhir.r4.model.EpisodeOfCare.DiagnosisComponent t : src.getDiagnosis()) + tgt.addDiagnosis(convertDiagnosisComponent(t)); + if (src.hasPatient()) + tgt.setPatient(convertReference(src.getPatient())); + if (src.hasManagingOrganization()) + tgt.setManagingOrganization(convertReference(src.getManagingOrganization())); + if (src.hasPeriod()) + tgt.setPeriod(convertPeriod(src.getPeriod())); + for (org.hl7.fhir.r4.model.Reference t : src.getReferralRequest()) + tgt.addReferralRequest(convertReference(t)); + if (src.hasCareManager()) + tgt.setCareManager(convertReference(src.getCareManager())); + for (org.hl7.fhir.r4.model.Reference t : src.getTeam()) + tgt.addTeam(convertReference(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getAccount()) + tgt.addAccount(convertReference(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.EpisodeOfCare convertEpisodeOfCare(org.hl7.fhir.r5.model.EpisodeOfCare src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.EpisodeOfCare tgt = new org.hl7.fhir.r4.model.EpisodeOfCare(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasStatus()) + tgt.setStatus(convertEpisodeOfCareStatus(src.getStatus())); + for (org.hl7.fhir.r5.model.EpisodeOfCare.EpisodeOfCareStatusHistoryComponent t : src.getStatusHistory()) + tgt.addStatusHistory(convertEpisodeOfCareStatusHistoryComponent(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getType()) + tgt.addType(convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.EpisodeOfCare.DiagnosisComponent t : src.getDiagnosis()) + tgt.addDiagnosis(convertDiagnosisComponent(t)); + if (src.hasPatient()) + tgt.setPatient(convertReference(src.getPatient())); + if (src.hasManagingOrganization()) + tgt.setManagingOrganization(convertReference(src.getManagingOrganization())); + if (src.hasPeriod()) + tgt.setPeriod(convertPeriod(src.getPeriod())); + for (org.hl7.fhir.r5.model.Reference t : src.getReferralRequest()) + tgt.addReferralRequest(convertReference(t)); + if (src.hasCareManager()) + tgt.setCareManager(convertReference(src.getCareManager())); + for (org.hl7.fhir.r5.model.Reference t : src.getTeam()) + tgt.addTeam(convertReference(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getAccount()) + tgt.addAccount(convertReference(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.EpisodeOfCare.EpisodeOfCareStatus convertEpisodeOfCareStatus(org.hl7.fhir.r4.model.EpisodeOfCare.EpisodeOfCareStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PLANNED: return org.hl7.fhir.r5.model.EpisodeOfCare.EpisodeOfCareStatus.PLANNED; + case WAITLIST: return org.hl7.fhir.r5.model.EpisodeOfCare.EpisodeOfCareStatus.WAITLIST; + case ACTIVE: return org.hl7.fhir.r5.model.EpisodeOfCare.EpisodeOfCareStatus.ACTIVE; + case ONHOLD: return org.hl7.fhir.r5.model.EpisodeOfCare.EpisodeOfCareStatus.ONHOLD; + case FINISHED: return org.hl7.fhir.r5.model.EpisodeOfCare.EpisodeOfCareStatus.FINISHED; + case CANCELLED: return org.hl7.fhir.r5.model.EpisodeOfCare.EpisodeOfCareStatus.CANCELLED; + case ENTEREDINERROR: return org.hl7.fhir.r5.model.EpisodeOfCare.EpisodeOfCareStatus.ENTEREDINERROR; + default: return org.hl7.fhir.r5.model.EpisodeOfCare.EpisodeOfCareStatus.NULL; + } +} + + public static org.hl7.fhir.r4.model.EpisodeOfCare.EpisodeOfCareStatus convertEpisodeOfCareStatus(org.hl7.fhir.r5.model.EpisodeOfCare.EpisodeOfCareStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PLANNED: return org.hl7.fhir.r4.model.EpisodeOfCare.EpisodeOfCareStatus.PLANNED; + case WAITLIST: return org.hl7.fhir.r4.model.EpisodeOfCare.EpisodeOfCareStatus.WAITLIST; + case ACTIVE: return org.hl7.fhir.r4.model.EpisodeOfCare.EpisodeOfCareStatus.ACTIVE; + case ONHOLD: return org.hl7.fhir.r4.model.EpisodeOfCare.EpisodeOfCareStatus.ONHOLD; + case FINISHED: return org.hl7.fhir.r4.model.EpisodeOfCare.EpisodeOfCareStatus.FINISHED; + case CANCELLED: return org.hl7.fhir.r4.model.EpisodeOfCare.EpisodeOfCareStatus.CANCELLED; + case ENTEREDINERROR: return org.hl7.fhir.r4.model.EpisodeOfCare.EpisodeOfCareStatus.ENTEREDINERROR; + default: return org.hl7.fhir.r4.model.EpisodeOfCare.EpisodeOfCareStatus.NULL; + } +} + + public static org.hl7.fhir.r5.model.EpisodeOfCare.EpisodeOfCareStatusHistoryComponent convertEpisodeOfCareStatusHistoryComponent(org.hl7.fhir.r4.model.EpisodeOfCare.EpisodeOfCareStatusHistoryComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.EpisodeOfCare.EpisodeOfCareStatusHistoryComponent tgt = new org.hl7.fhir.r5.model.EpisodeOfCare.EpisodeOfCareStatusHistoryComponent(); + copyElement(src, tgt); + if (src.hasStatus()) + tgt.setStatus(convertEpisodeOfCareStatus(src.getStatus())); + if (src.hasPeriod()) + tgt.setPeriod(convertPeriod(src.getPeriod())); + return tgt; + } + + public static org.hl7.fhir.r4.model.EpisodeOfCare.EpisodeOfCareStatusHistoryComponent convertEpisodeOfCareStatusHistoryComponent(org.hl7.fhir.r5.model.EpisodeOfCare.EpisodeOfCareStatusHistoryComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.EpisodeOfCare.EpisodeOfCareStatusHistoryComponent tgt = new org.hl7.fhir.r4.model.EpisodeOfCare.EpisodeOfCareStatusHistoryComponent(); + copyElement(src, tgt); + if (src.hasStatus()) + tgt.setStatus(convertEpisodeOfCareStatus(src.getStatus())); + if (src.hasPeriod()) + tgt.setPeriod(convertPeriod(src.getPeriod())); + return tgt; + } + + public static org.hl7.fhir.r5.model.EpisodeOfCare.DiagnosisComponent convertDiagnosisComponent(org.hl7.fhir.r4.model.EpisodeOfCare.DiagnosisComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.EpisodeOfCare.DiagnosisComponent tgt = new org.hl7.fhir.r5.model.EpisodeOfCare.DiagnosisComponent(); + copyElement(src, tgt); + if (src.hasCondition()) + tgt.setCondition(convertReference(src.getCondition())); + if (src.hasRole()) + tgt.setRole(convertCodeableConcept(src.getRole())); + if (src.hasRank()) + tgt.setRankElement(convertPositiveInt(src.getRankElement())); + return tgt; + } + + public static org.hl7.fhir.r4.model.EpisodeOfCare.DiagnosisComponent convertDiagnosisComponent(org.hl7.fhir.r5.model.EpisodeOfCare.DiagnosisComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.EpisodeOfCare.DiagnosisComponent tgt = new org.hl7.fhir.r4.model.EpisodeOfCare.DiagnosisComponent(); + copyElement(src, tgt); + if (src.hasCondition()) + tgt.setCondition(convertReference(src.getCondition())); + if (src.hasRole()) + tgt.setRole(convertCodeableConcept(src.getRole())); + if (src.hasRank()) + tgt.setRankElement(convertPositiveInt(src.getRankElement())); + return tgt; + } + + +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/EventDefinition.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/EventDefinition.java new file mode 100644 index 000000000..fe81952e4 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/EventDefinition.java @@ -0,0 +1,171 @@ +package org.hl7.fhir.convertors.conv40_50; + +import org.hl7.fhir.exceptions.FHIRException; + +import org.hl7.fhir.convertors.VersionConvertor_40_50; + + +/* + Copyright (c) 2011+, HL7, Inc. + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of HL7 nor the names of its contributors may be used to + endorse or promote products derived from this software without specific + prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + +*/ + +// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0 + + +public class EventDefinition extends VersionConvertor_40_50 { + + public static org.hl7.fhir.r5.model.EventDefinition convertEventDefinition(org.hl7.fhir.r4.model.EventDefinition src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.EventDefinition tgt = new org.hl7.fhir.r5.model.EventDefinition(); + copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrlElement(convertUri(src.getUrlElement())); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasVersion()) + tgt.setVersionElement(convertString(src.getVersionElement())); + if (src.hasName()) + tgt.setNameElement(convertString(src.getNameElement())); + if (src.hasTitle()) + tgt.setTitleElement(convertString(src.getTitleElement())); + if (src.hasSubtitle()) + tgt.setSubtitleElement(convertString(src.getSubtitleElement())); + if (src.hasStatus()) + tgt.setStatus(Enumerations.convertPublicationStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimentalElement(convertBoolean(src.getExperimentalElement())); + if (src.hasSubject()) + tgt.setSubject(convertType(src.getSubject())); + if (src.hasDate()) + tgt.setDateElement(convertDateTime(src.getDateElement())); + if (src.hasPublisher()) + tgt.setPublisherElement(convertString(src.getPublisherElement())); + for (org.hl7.fhir.r4.model.ContactDetail t : src.getContact()) + tgt.addContact(convertContactDetail(t)); + if (src.hasDescription()) + tgt.setDescriptionElement(convertMarkdown(src.getDescriptionElement())); + for (org.hl7.fhir.r4.model.UsageContext t : src.getUseContext()) + tgt.addUseContext(convertUsageContext(t)); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getJurisdiction()) + tgt.addJurisdiction(convertCodeableConcept(t)); + if (src.hasPurpose()) + tgt.setPurposeElement(convertMarkdown(src.getPurposeElement())); + if (src.hasUsage()) + tgt.setUsageElement(convertString(src.getUsageElement())); + if (src.hasCopyright()) + tgt.setCopyrightElement(convertMarkdown(src.getCopyrightElement())); + if (src.hasApprovalDate()) + tgt.setApprovalDateElement(convertDate(src.getApprovalDateElement())); + if (src.hasLastReviewDate()) + tgt.setLastReviewDateElement(convertDate(src.getLastReviewDateElement())); + if (src.hasEffectivePeriod()) + tgt.setEffectivePeriod(convertPeriod(src.getEffectivePeriod())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getTopic()) + tgt.addTopic(convertCodeableConcept(t)); + for (org.hl7.fhir.r4.model.ContactDetail t : src.getAuthor()) + tgt.addAuthor(convertContactDetail(t)); + for (org.hl7.fhir.r4.model.ContactDetail t : src.getEditor()) + tgt.addEditor(convertContactDetail(t)); + for (org.hl7.fhir.r4.model.ContactDetail t : src.getReviewer()) + tgt.addReviewer(convertContactDetail(t)); + for (org.hl7.fhir.r4.model.ContactDetail t : src.getEndorser()) + tgt.addEndorser(convertContactDetail(t)); + for (org.hl7.fhir.r4.model.RelatedArtifact t : src.getRelatedArtifact()) + tgt.addRelatedArtifact(convertRelatedArtifact(t)); + for (org.hl7.fhir.r4.model.TriggerDefinition t : src.getTrigger()) + tgt.addTrigger(convertTriggerDefinition(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.EventDefinition convertEventDefinition(org.hl7.fhir.r5.model.EventDefinition src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.EventDefinition tgt = new org.hl7.fhir.r4.model.EventDefinition(); + copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrlElement(convertUri(src.getUrlElement())); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasVersion()) + tgt.setVersionElement(convertString(src.getVersionElement())); + if (src.hasName()) + tgt.setNameElement(convertString(src.getNameElement())); + if (src.hasTitle()) + tgt.setTitleElement(convertString(src.getTitleElement())); + if (src.hasSubtitle()) + tgt.setSubtitleElement(convertString(src.getSubtitleElement())); + if (src.hasStatus()) + tgt.setStatus(Enumerations.convertPublicationStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimentalElement(convertBoolean(src.getExperimentalElement())); + if (src.hasSubject()) + tgt.setSubject(convertType(src.getSubject())); + if (src.hasDate()) + tgt.setDateElement(convertDateTime(src.getDateElement())); + if (src.hasPublisher()) + tgt.setPublisherElement(convertString(src.getPublisherElement())); + for (org.hl7.fhir.r5.model.ContactDetail t : src.getContact()) + tgt.addContact(convertContactDetail(t)); + if (src.hasDescription()) + tgt.setDescriptionElement(convertMarkdown(src.getDescriptionElement())); + for (org.hl7.fhir.r5.model.UsageContext t : src.getUseContext()) + tgt.addUseContext(convertUsageContext(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getJurisdiction()) + tgt.addJurisdiction(convertCodeableConcept(t)); + if (src.hasPurpose()) + tgt.setPurposeElement(convertMarkdown(src.getPurposeElement())); + if (src.hasUsage()) + tgt.setUsageElement(convertString(src.getUsageElement())); + if (src.hasCopyright()) + tgt.setCopyrightElement(convertMarkdown(src.getCopyrightElement())); + if (src.hasApprovalDate()) + tgt.setApprovalDateElement(convertDate(src.getApprovalDateElement())); + if (src.hasLastReviewDate()) + tgt.setLastReviewDateElement(convertDate(src.getLastReviewDateElement())); + if (src.hasEffectivePeriod()) + tgt.setEffectivePeriod(convertPeriod(src.getEffectivePeriod())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getTopic()) + tgt.addTopic(convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.ContactDetail t : src.getAuthor()) + tgt.addAuthor(convertContactDetail(t)); + for (org.hl7.fhir.r5.model.ContactDetail t : src.getEditor()) + tgt.addEditor(convertContactDetail(t)); + for (org.hl7.fhir.r5.model.ContactDetail t : src.getReviewer()) + tgt.addReviewer(convertContactDetail(t)); + for (org.hl7.fhir.r5.model.ContactDetail t : src.getEndorser()) + tgt.addEndorser(convertContactDetail(t)); + for (org.hl7.fhir.r5.model.RelatedArtifact t : src.getRelatedArtifact()) + tgt.addRelatedArtifact(convertRelatedArtifact(t)); + for (org.hl7.fhir.r5.model.TriggerDefinition t : src.getTrigger()) + tgt.addTrigger(convertTriggerDefinition(t)); + return tgt; + } + + +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Evidence.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Evidence.java new file mode 100644 index 000000000..cd2d8c7e4 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Evidence.java @@ -0,0 +1,171 @@ +package org.hl7.fhir.convertors.conv40_50; + +import org.hl7.fhir.exceptions.FHIRException; + +import org.hl7.fhir.convertors.VersionConvertor_40_50; + + +/* + Copyright (c) 2011+, HL7, Inc. + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of HL7 nor the names of its contributors may be used to + endorse or promote products derived from this software without specific + prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + +*/ + +// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0 + + +public class Evidence extends VersionConvertor_40_50 { + + public static org.hl7.fhir.r5.model.Evidence convertEvidence(org.hl7.fhir.r4.model.Evidence src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Evidence tgt = new org.hl7.fhir.r5.model.Evidence(); + copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrlElement(convertUri(src.getUrlElement())); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasVersion()) + tgt.setVersionElement(convertString(src.getVersionElement())); + if (src.hasName()) + tgt.setNameElement(convertString(src.getNameElement())); + if (src.hasTitle()) + tgt.setTitleElement(convertString(src.getTitleElement())); + if (src.hasShortTitle()) + tgt.setShortTitleElement(convertString(src.getShortTitleElement())); + if (src.hasSubtitle()) + tgt.setSubtitleElement(convertString(src.getSubtitleElement())); + if (src.hasStatus()) + tgt.setStatus(Enumerations.convertPublicationStatus(src.getStatus())); + if (src.hasDate()) + tgt.setDateElement(convertDateTime(src.getDateElement())); + if (src.hasPublisher()) + tgt.setPublisherElement(convertString(src.getPublisherElement())); + for (org.hl7.fhir.r4.model.ContactDetail t : src.getContact()) + tgt.addContact(convertContactDetail(t)); + if (src.hasDescription()) + tgt.setDescriptionElement(convertMarkdown(src.getDescriptionElement())); + for (org.hl7.fhir.r4.model.Annotation t : src.getNote()) + tgt.addNote(convertAnnotation(t)); + for (org.hl7.fhir.r4.model.UsageContext t : src.getUseContext()) + tgt.addUseContext(convertUsageContext(t)); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getJurisdiction()) + tgt.addJurisdiction(convertCodeableConcept(t)); + if (src.hasCopyright()) + tgt.setCopyrightElement(convertMarkdown(src.getCopyrightElement())); + if (src.hasApprovalDate()) + tgt.setApprovalDateElement(convertDate(src.getApprovalDateElement())); + if (src.hasLastReviewDate()) + tgt.setLastReviewDateElement(convertDate(src.getLastReviewDateElement())); + if (src.hasEffectivePeriod()) + tgt.setEffectivePeriod(convertPeriod(src.getEffectivePeriod())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getTopic()) + tgt.addTopic(convertCodeableConcept(t)); + for (org.hl7.fhir.r4.model.ContactDetail t : src.getAuthor()) + tgt.addAuthor(convertContactDetail(t)); + for (org.hl7.fhir.r4.model.ContactDetail t : src.getEditor()) + tgt.addEditor(convertContactDetail(t)); + for (org.hl7.fhir.r4.model.ContactDetail t : src.getReviewer()) + tgt.addReviewer(convertContactDetail(t)); + for (org.hl7.fhir.r4.model.ContactDetail t : src.getEndorser()) + tgt.addEndorser(convertContactDetail(t)); + for (org.hl7.fhir.r4.model.RelatedArtifact t : src.getRelatedArtifact()) + tgt.addRelatedArtifact(convertRelatedArtifact(t)); + if (src.hasExposureBackground()) + tgt.setExposureBackground(convertReference(src.getExposureBackground())); + for (org.hl7.fhir.r4.model.Reference t : src.getExposureVariant()) + tgt.addExposureVariant(convertReference(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getOutcome()) + tgt.addOutcome(convertReference(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.Evidence convertEvidence(org.hl7.fhir.r5.model.Evidence src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Evidence tgt = new org.hl7.fhir.r4.model.Evidence(); + copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrlElement(convertUri(src.getUrlElement())); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasVersion()) + tgt.setVersionElement(convertString(src.getVersionElement())); + if (src.hasName()) + tgt.setNameElement(convertString(src.getNameElement())); + if (src.hasTitle()) + tgt.setTitleElement(convertString(src.getTitleElement())); + if (src.hasShortTitle()) + tgt.setShortTitleElement(convertString(src.getShortTitleElement())); + if (src.hasSubtitle()) + tgt.setSubtitleElement(convertString(src.getSubtitleElement())); + if (src.hasStatus()) + tgt.setStatus(Enumerations.convertPublicationStatus(src.getStatus())); + if (src.hasDate()) + tgt.setDateElement(convertDateTime(src.getDateElement())); + if (src.hasPublisher()) + tgt.setPublisherElement(convertString(src.getPublisherElement())); + for (org.hl7.fhir.r5.model.ContactDetail t : src.getContact()) + tgt.addContact(convertContactDetail(t)); + if (src.hasDescription()) + tgt.setDescriptionElement(convertMarkdown(src.getDescriptionElement())); + for (org.hl7.fhir.r5.model.Annotation t : src.getNote()) + tgt.addNote(convertAnnotation(t)); + for (org.hl7.fhir.r5.model.UsageContext t : src.getUseContext()) + tgt.addUseContext(convertUsageContext(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getJurisdiction()) + tgt.addJurisdiction(convertCodeableConcept(t)); + if (src.hasCopyright()) + tgt.setCopyrightElement(convertMarkdown(src.getCopyrightElement())); + if (src.hasApprovalDate()) + tgt.setApprovalDateElement(convertDate(src.getApprovalDateElement())); + if (src.hasLastReviewDate()) + tgt.setLastReviewDateElement(convertDate(src.getLastReviewDateElement())); + if (src.hasEffectivePeriod()) + tgt.setEffectivePeriod(convertPeriod(src.getEffectivePeriod())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getTopic()) + tgt.addTopic(convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.ContactDetail t : src.getAuthor()) + tgt.addAuthor(convertContactDetail(t)); + for (org.hl7.fhir.r5.model.ContactDetail t : src.getEditor()) + tgt.addEditor(convertContactDetail(t)); + for (org.hl7.fhir.r5.model.ContactDetail t : src.getReviewer()) + tgt.addReviewer(convertContactDetail(t)); + for (org.hl7.fhir.r5.model.ContactDetail t : src.getEndorser()) + tgt.addEndorser(convertContactDetail(t)); + for (org.hl7.fhir.r5.model.RelatedArtifact t : src.getRelatedArtifact()) + tgt.addRelatedArtifact(convertRelatedArtifact(t)); + if (src.hasExposureBackground()) + tgt.setExposureBackground(convertReference(src.getExposureBackground())); + for (org.hl7.fhir.r5.model.Reference t : src.getExposureVariant()) + tgt.addExposureVariant(convertReference(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getOutcome()) + tgt.addOutcome(convertReference(t)); + return tgt; + } + + +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/EvidenceVariable.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/EvidenceVariable.java new file mode 100644 index 000000000..3e66a7812 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/EvidenceVariable.java @@ -0,0 +1,261 @@ +package org.hl7.fhir.convertors.conv40_50; + +import org.hl7.fhir.exceptions.FHIRException; + +import org.hl7.fhir.convertors.VersionConvertor_40_50; + + +/* + Copyright (c) 2011+, HL7, Inc. + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of HL7 nor the names of its contributors may be used to + endorse or promote products derived from this software without specific + prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + +*/ + +// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0 + + +public class EvidenceVariable extends VersionConvertor_40_50 { + + public static org.hl7.fhir.r5.model.EvidenceVariable convertEvidenceVariable(org.hl7.fhir.r4.model.EvidenceVariable src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.EvidenceVariable tgt = new org.hl7.fhir.r5.model.EvidenceVariable(); + copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrlElement(convertUri(src.getUrlElement())); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasVersion()) + tgt.setVersionElement(convertString(src.getVersionElement())); + if (src.hasName()) + tgt.setNameElement(convertString(src.getNameElement())); + if (src.hasTitle()) + tgt.setTitleElement(convertString(src.getTitleElement())); + if (src.hasShortTitle()) + tgt.setShortTitleElement(convertString(src.getShortTitleElement())); + if (src.hasSubtitle()) + tgt.setSubtitleElement(convertString(src.getSubtitleElement())); + if (src.hasStatus()) + tgt.setStatus(Enumerations.convertPublicationStatus(src.getStatus())); + if (src.hasDate()) + tgt.setDateElement(convertDateTime(src.getDateElement())); + if (src.hasPublisher()) + tgt.setPublisherElement(convertString(src.getPublisherElement())); + for (org.hl7.fhir.r4.model.ContactDetail t : src.getContact()) + tgt.addContact(convertContactDetail(t)); + if (src.hasDescription()) + tgt.setDescriptionElement(convertMarkdown(src.getDescriptionElement())); + for (org.hl7.fhir.r4.model.Annotation t : src.getNote()) + tgt.addNote(convertAnnotation(t)); + for (org.hl7.fhir.r4.model.UsageContext t : src.getUseContext()) + tgt.addUseContext(convertUsageContext(t)); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getJurisdiction()) + tgt.addJurisdiction(convertCodeableConcept(t)); + if (src.hasCopyright()) + tgt.setCopyrightElement(convertMarkdown(src.getCopyrightElement())); + if (src.hasApprovalDate()) + tgt.setApprovalDateElement(convertDate(src.getApprovalDateElement())); + if (src.hasLastReviewDate()) + tgt.setLastReviewDateElement(convertDate(src.getLastReviewDateElement())); + if (src.hasEffectivePeriod()) + tgt.setEffectivePeriod(convertPeriod(src.getEffectivePeriod())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getTopic()) + tgt.addTopic(convertCodeableConcept(t)); + for (org.hl7.fhir.r4.model.ContactDetail t : src.getAuthor()) + tgt.addAuthor(convertContactDetail(t)); + for (org.hl7.fhir.r4.model.ContactDetail t : src.getEditor()) + tgt.addEditor(convertContactDetail(t)); + for (org.hl7.fhir.r4.model.ContactDetail t : src.getReviewer()) + tgt.addReviewer(convertContactDetail(t)); + for (org.hl7.fhir.r4.model.ContactDetail t : src.getEndorser()) + tgt.addEndorser(convertContactDetail(t)); + for (org.hl7.fhir.r4.model.RelatedArtifact t : src.getRelatedArtifact()) + tgt.addRelatedArtifact(convertRelatedArtifact(t)); + if (src.hasType()) + tgt.setType(convertEvidenceVariableType(src.getType())); + for (org.hl7.fhir.r4.model.EvidenceVariable.EvidenceVariableCharacteristicComponent t : src.getCharacteristic()) + tgt.addCharacteristic(convertEvidenceVariableCharacteristicComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.EvidenceVariable convertEvidenceVariable(org.hl7.fhir.r5.model.EvidenceVariable src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.EvidenceVariable tgt = new org.hl7.fhir.r4.model.EvidenceVariable(); + copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrlElement(convertUri(src.getUrlElement())); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasVersion()) + tgt.setVersionElement(convertString(src.getVersionElement())); + if (src.hasName()) + tgt.setNameElement(convertString(src.getNameElement())); + if (src.hasTitle()) + tgt.setTitleElement(convertString(src.getTitleElement())); + if (src.hasShortTitle()) + tgt.setShortTitleElement(convertString(src.getShortTitleElement())); + if (src.hasSubtitle()) + tgt.setSubtitleElement(convertString(src.getSubtitleElement())); + if (src.hasStatus()) + tgt.setStatus(Enumerations.convertPublicationStatus(src.getStatus())); + if (src.hasDate()) + tgt.setDateElement(convertDateTime(src.getDateElement())); + if (src.hasPublisher()) + tgt.setPublisherElement(convertString(src.getPublisherElement())); + for (org.hl7.fhir.r5.model.ContactDetail t : src.getContact()) + tgt.addContact(convertContactDetail(t)); + if (src.hasDescription()) + tgt.setDescriptionElement(convertMarkdown(src.getDescriptionElement())); + for (org.hl7.fhir.r5.model.Annotation t : src.getNote()) + tgt.addNote(convertAnnotation(t)); + for (org.hl7.fhir.r5.model.UsageContext t : src.getUseContext()) + tgt.addUseContext(convertUsageContext(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getJurisdiction()) + tgt.addJurisdiction(convertCodeableConcept(t)); + if (src.hasCopyright()) + tgt.setCopyrightElement(convertMarkdown(src.getCopyrightElement())); + if (src.hasApprovalDate()) + tgt.setApprovalDateElement(convertDate(src.getApprovalDateElement())); + if (src.hasLastReviewDate()) + tgt.setLastReviewDateElement(convertDate(src.getLastReviewDateElement())); + if (src.hasEffectivePeriod()) + tgt.setEffectivePeriod(convertPeriod(src.getEffectivePeriod())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getTopic()) + tgt.addTopic(convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.ContactDetail t : src.getAuthor()) + tgt.addAuthor(convertContactDetail(t)); + for (org.hl7.fhir.r5.model.ContactDetail t : src.getEditor()) + tgt.addEditor(convertContactDetail(t)); + for (org.hl7.fhir.r5.model.ContactDetail t : src.getReviewer()) + tgt.addReviewer(convertContactDetail(t)); + for (org.hl7.fhir.r5.model.ContactDetail t : src.getEndorser()) + tgt.addEndorser(convertContactDetail(t)); + for (org.hl7.fhir.r5.model.RelatedArtifact t : src.getRelatedArtifact()) + tgt.addRelatedArtifact(convertRelatedArtifact(t)); + if (src.hasType()) + tgt.setType(convertEvidenceVariableType(src.getType())); + for (org.hl7.fhir.r5.model.EvidenceVariable.EvidenceVariableCharacteristicComponent t : src.getCharacteristic()) + tgt.addCharacteristic(convertEvidenceVariableCharacteristicComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.EvidenceVariable.EvidenceVariableType convertEvidenceVariableType(org.hl7.fhir.r4.model.EvidenceVariable.EvidenceVariableType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case DICHOTOMOUS: return org.hl7.fhir.r5.model.EvidenceVariable.EvidenceVariableType.DICHOTOMOUS; + case CONTINUOUS: return org.hl7.fhir.r5.model.EvidenceVariable.EvidenceVariableType.CONTINUOUS; + case DESCRIPTIVE: return org.hl7.fhir.r5.model.EvidenceVariable.EvidenceVariableType.DESCRIPTIVE; + default: return org.hl7.fhir.r5.model.EvidenceVariable.EvidenceVariableType.NULL; + } +} + + public static org.hl7.fhir.r4.model.EvidenceVariable.EvidenceVariableType convertEvidenceVariableType(org.hl7.fhir.r5.model.EvidenceVariable.EvidenceVariableType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case DICHOTOMOUS: return org.hl7.fhir.r4.model.EvidenceVariable.EvidenceVariableType.DICHOTOMOUS; + case CONTINUOUS: return org.hl7.fhir.r4.model.EvidenceVariable.EvidenceVariableType.CONTINUOUS; + case DESCRIPTIVE: return org.hl7.fhir.r4.model.EvidenceVariable.EvidenceVariableType.DESCRIPTIVE; + default: return org.hl7.fhir.r4.model.EvidenceVariable.EvidenceVariableType.NULL; + } +} + + public static org.hl7.fhir.r5.model.EvidenceVariable.EvidenceVariableCharacteristicComponent convertEvidenceVariableCharacteristicComponent(org.hl7.fhir.r4.model.EvidenceVariable.EvidenceVariableCharacteristicComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.EvidenceVariable.EvidenceVariableCharacteristicComponent tgt = new org.hl7.fhir.r5.model.EvidenceVariable.EvidenceVariableCharacteristicComponent(); + copyElement(src, tgt); + if (src.hasDescription()) + tgt.setDescriptionElement(convertString(src.getDescriptionElement())); + if (src.hasDefinition()) + tgt.setDefinition(convertType(src.getDefinition())); + for (org.hl7.fhir.r4.model.UsageContext t : src.getUsageContext()) + tgt.addUsageContext(convertUsageContext(t)); + if (src.hasExclude()) + tgt.setExcludeElement(convertBoolean(src.getExcludeElement())); + if (src.hasParticipantEffective()) + tgt.setParticipantEffective(convertType(src.getParticipantEffective())); + if (src.hasTimeFromStart()) + tgt.setTimeFromStart(convertDuration(src.getTimeFromStart())); + if (src.hasGroupMeasure()) + tgt.setGroupMeasure(convertGroupMeasure(src.getGroupMeasure())); + return tgt; + } + + public static org.hl7.fhir.r4.model.EvidenceVariable.EvidenceVariableCharacteristicComponent convertEvidenceVariableCharacteristicComponent(org.hl7.fhir.r5.model.EvidenceVariable.EvidenceVariableCharacteristicComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.EvidenceVariable.EvidenceVariableCharacteristicComponent tgt = new org.hl7.fhir.r4.model.EvidenceVariable.EvidenceVariableCharacteristicComponent(); + copyElement(src, tgt); + if (src.hasDescription()) + tgt.setDescriptionElement(convertString(src.getDescriptionElement())); + if (src.hasDefinition()) + tgt.setDefinition(convertType(src.getDefinition())); + for (org.hl7.fhir.r5.model.UsageContext t : src.getUsageContext()) + tgt.addUsageContext(convertUsageContext(t)); + if (src.hasExclude()) + tgt.setExcludeElement(convertBoolean(src.getExcludeElement())); + if (src.hasParticipantEffective()) + tgt.setParticipantEffective(convertType(src.getParticipantEffective())); + if (src.hasTimeFromStart()) + tgt.setTimeFromStart(convertDuration(src.getTimeFromStart())); + if (src.hasGroupMeasure()) + tgt.setGroupMeasure(convertGroupMeasure(src.getGroupMeasure())); + return tgt; + } + + public static org.hl7.fhir.r5.model.EvidenceVariable.GroupMeasure convertGroupMeasure(org.hl7.fhir.r4.model.EvidenceVariable.GroupMeasure src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case MEAN: return org.hl7.fhir.r5.model.EvidenceVariable.GroupMeasure.MEAN; + case MEDIAN: return org.hl7.fhir.r5.model.EvidenceVariable.GroupMeasure.MEDIAN; + case MEANOFMEAN: return org.hl7.fhir.r5.model.EvidenceVariable.GroupMeasure.MEANOFMEAN; + case MEANOFMEDIAN: return org.hl7.fhir.r5.model.EvidenceVariable.GroupMeasure.MEANOFMEDIAN; + case MEDIANOFMEAN: return org.hl7.fhir.r5.model.EvidenceVariable.GroupMeasure.MEDIANOFMEAN; + case MEDIANOFMEDIAN: return org.hl7.fhir.r5.model.EvidenceVariable.GroupMeasure.MEDIANOFMEDIAN; + default: return org.hl7.fhir.r5.model.EvidenceVariable.GroupMeasure.NULL; + } +} + + public static org.hl7.fhir.r4.model.EvidenceVariable.GroupMeasure convertGroupMeasure(org.hl7.fhir.r5.model.EvidenceVariable.GroupMeasure src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case MEAN: return org.hl7.fhir.r4.model.EvidenceVariable.GroupMeasure.MEAN; + case MEDIAN: return org.hl7.fhir.r4.model.EvidenceVariable.GroupMeasure.MEDIAN; + case MEANOFMEAN: return org.hl7.fhir.r4.model.EvidenceVariable.GroupMeasure.MEANOFMEAN; + case MEANOFMEDIAN: return org.hl7.fhir.r4.model.EvidenceVariable.GroupMeasure.MEANOFMEDIAN; + case MEDIANOFMEAN: return org.hl7.fhir.r4.model.EvidenceVariable.GroupMeasure.MEDIANOFMEAN; + case MEDIANOFMEDIAN: return org.hl7.fhir.r4.model.EvidenceVariable.GroupMeasure.MEDIANOFMEDIAN; + default: return org.hl7.fhir.r4.model.EvidenceVariable.GroupMeasure.NULL; + } +} + + +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/ExampleScenario.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/ExampleScenario.java new file mode 100644 index 000000000..d1e1b5b63 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/ExampleScenario.java @@ -0,0 +1,731 @@ +package org.hl7.fhir.convertors.conv40_50; + +import org.hl7.fhir.exceptions.FHIRException; + +import org.hl7.fhir.convertors.VersionConvertor_40_50; + + +/* + Copyright (c) 2011+, HL7, Inc. + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of HL7 nor the names of its contributors may be used to + endorse or promote products derived from this software without specific + prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + +*/ + +// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0 + + +public class ExampleScenario extends VersionConvertor_40_50 { + + public static org.hl7.fhir.r5.model.ExampleScenario convertExampleScenario(org.hl7.fhir.r4.model.ExampleScenario src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ExampleScenario tgt = new org.hl7.fhir.r5.model.ExampleScenario(); + copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrlElement(convertUri(src.getUrlElement())); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasVersion()) + tgt.setVersionElement(convertString(src.getVersionElement())); + if (src.hasName()) + tgt.setNameElement(convertString(src.getNameElement())); + if (src.hasStatus()) + tgt.setStatus(Enumerations.convertPublicationStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimentalElement(convertBoolean(src.getExperimentalElement())); + if (src.hasDate()) + tgt.setDateElement(convertDateTime(src.getDateElement())); + if (src.hasPublisher()) + tgt.setPublisherElement(convertString(src.getPublisherElement())); + for (org.hl7.fhir.r4.model.ContactDetail t : src.getContact()) + tgt.addContact(convertContactDetail(t)); + for (org.hl7.fhir.r4.model.UsageContext t : src.getUseContext()) + tgt.addUseContext(convertUsageContext(t)); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getJurisdiction()) + tgt.addJurisdiction(convertCodeableConcept(t)); + if (src.hasCopyright()) + tgt.setCopyrightElement(convertMarkdown(src.getCopyrightElement())); + if (src.hasPurpose()) + tgt.setPurposeElement(convertMarkdown(src.getPurposeElement())); + for (org.hl7.fhir.r4.model.ExampleScenario.ExampleScenarioActorComponent t : src.getActor()) + tgt.addActor(convertExampleScenarioActorComponent(t)); + for (org.hl7.fhir.r4.model.ExampleScenario.ExampleScenarioInstanceComponent t : src.getInstance()) + tgt.addInstance(convertExampleScenarioInstanceComponent(t)); + for (org.hl7.fhir.r4.model.ExampleScenario.ExampleScenarioProcessComponent t : src.getProcess()) + tgt.addProcess(convertExampleScenarioProcessComponent(t)); + for (org.hl7.fhir.r4.model.CanonicalType t : src.getWorkflow()) + tgt.getWorkflow().add(convertCanonical(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.ExampleScenario convertExampleScenario(org.hl7.fhir.r5.model.ExampleScenario src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.ExampleScenario tgt = new org.hl7.fhir.r4.model.ExampleScenario(); + copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrlElement(convertUri(src.getUrlElement())); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasVersion()) + tgt.setVersionElement(convertString(src.getVersionElement())); + if (src.hasName()) + tgt.setNameElement(convertString(src.getNameElement())); + if (src.hasStatus()) + tgt.setStatus(Enumerations.convertPublicationStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimentalElement(convertBoolean(src.getExperimentalElement())); + if (src.hasDate()) + tgt.setDateElement(convertDateTime(src.getDateElement())); + if (src.hasPublisher()) + tgt.setPublisherElement(convertString(src.getPublisherElement())); + for (org.hl7.fhir.r5.model.ContactDetail t : src.getContact()) + tgt.addContact(convertContactDetail(t)); + for (org.hl7.fhir.r5.model.UsageContext t : src.getUseContext()) + tgt.addUseContext(convertUsageContext(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getJurisdiction()) + tgt.addJurisdiction(convertCodeableConcept(t)); + if (src.hasCopyright()) + tgt.setCopyrightElement(convertMarkdown(src.getCopyrightElement())); + if (src.hasPurpose()) + tgt.setPurposeElement(convertMarkdown(src.getPurposeElement())); + for (org.hl7.fhir.r5.model.ExampleScenario.ExampleScenarioActorComponent t : src.getActor()) + tgt.addActor(convertExampleScenarioActorComponent(t)); + for (org.hl7.fhir.r5.model.ExampleScenario.ExampleScenarioInstanceComponent t : src.getInstance()) + tgt.addInstance(convertExampleScenarioInstanceComponent(t)); + for (org.hl7.fhir.r5.model.ExampleScenario.ExampleScenarioProcessComponent t : src.getProcess()) + tgt.addProcess(convertExampleScenarioProcessComponent(t)); + for (org.hl7.fhir.r5.model.CanonicalType t : src.getWorkflow()) + tgt.getWorkflow().add(convertCanonical(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.ExampleScenario.ExampleScenarioActorComponent convertExampleScenarioActorComponent(org.hl7.fhir.r4.model.ExampleScenario.ExampleScenarioActorComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ExampleScenario.ExampleScenarioActorComponent tgt = new org.hl7.fhir.r5.model.ExampleScenario.ExampleScenarioActorComponent(); + copyElement(src, tgt); + if (src.hasActorId()) + tgt.setActorIdElement(convertString(src.getActorIdElement())); + if (src.hasType()) + tgt.setType(convertExampleScenarioActorType(src.getType())); + if (src.hasName()) + tgt.setNameElement(convertString(src.getNameElement())); + if (src.hasDescription()) + tgt.setDescriptionElement(convertMarkdown(src.getDescriptionElement())); + return tgt; + } + + public static org.hl7.fhir.r4.model.ExampleScenario.ExampleScenarioActorComponent convertExampleScenarioActorComponent(org.hl7.fhir.r5.model.ExampleScenario.ExampleScenarioActorComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.ExampleScenario.ExampleScenarioActorComponent tgt = new org.hl7.fhir.r4.model.ExampleScenario.ExampleScenarioActorComponent(); + copyElement(src, tgt); + if (src.hasActorId()) + tgt.setActorIdElement(convertString(src.getActorIdElement())); + if (src.hasType()) + tgt.setType(convertExampleScenarioActorType(src.getType())); + if (src.hasName()) + tgt.setNameElement(convertString(src.getNameElement())); + if (src.hasDescription()) + tgt.setDescriptionElement(convertMarkdown(src.getDescriptionElement())); + return tgt; + } + + public static org.hl7.fhir.r5.model.ExampleScenario.ExampleScenarioActorType convertExampleScenarioActorType(org.hl7.fhir.r4.model.ExampleScenario.ExampleScenarioActorType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PERSON: return org.hl7.fhir.r5.model.ExampleScenario.ExampleScenarioActorType.PERSON; + case ENTITY: return org.hl7.fhir.r5.model.ExampleScenario.ExampleScenarioActorType.ENTITY; + default: return org.hl7.fhir.r5.model.ExampleScenario.ExampleScenarioActorType.NULL; + } +} + + public static org.hl7.fhir.r4.model.ExampleScenario.ExampleScenarioActorType convertExampleScenarioActorType(org.hl7.fhir.r5.model.ExampleScenario.ExampleScenarioActorType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PERSON: return org.hl7.fhir.r4.model.ExampleScenario.ExampleScenarioActorType.PERSON; + case ENTITY: return org.hl7.fhir.r4.model.ExampleScenario.ExampleScenarioActorType.ENTITY; + default: return org.hl7.fhir.r4.model.ExampleScenario.ExampleScenarioActorType.NULL; + } +} + + public static org.hl7.fhir.r5.model.ExampleScenario.ExampleScenarioInstanceComponent convertExampleScenarioInstanceComponent(org.hl7.fhir.r4.model.ExampleScenario.ExampleScenarioInstanceComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ExampleScenario.ExampleScenarioInstanceComponent tgt = new org.hl7.fhir.r5.model.ExampleScenario.ExampleScenarioInstanceComponent(); + copyElement(src, tgt); + if (src.hasResourceId()) + tgt.setResourceIdElement(convertString(src.getResourceIdElement())); + if (src.hasResourceType()) + tgt.setResourceType(convertFHIRResourceType(src.getResourceType())); + if (src.hasName()) + tgt.setNameElement(convertString(src.getNameElement())); + if (src.hasDescription()) + tgt.setDescriptionElement(convertMarkdown(src.getDescriptionElement())); + for (org.hl7.fhir.r4.model.ExampleScenario.ExampleScenarioInstanceVersionComponent t : src.getVersion()) + tgt.addVersion(convertExampleScenarioInstanceVersionComponent(t)); + for (org.hl7.fhir.r4.model.ExampleScenario.ExampleScenarioInstanceContainedInstanceComponent t : src.getContainedInstance()) + tgt.addContainedInstance(convertExampleScenarioInstanceContainedInstanceComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.ExampleScenario.ExampleScenarioInstanceComponent convertExampleScenarioInstanceComponent(org.hl7.fhir.r5.model.ExampleScenario.ExampleScenarioInstanceComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.ExampleScenario.ExampleScenarioInstanceComponent tgt = new org.hl7.fhir.r4.model.ExampleScenario.ExampleScenarioInstanceComponent(); + copyElement(src, tgt); + if (src.hasResourceId()) + tgt.setResourceIdElement(convertString(src.getResourceIdElement())); + if (src.hasResourceType()) + tgt.setResourceType(convertFHIRResourceType(src.getResourceType())); + if (src.hasName()) + tgt.setNameElement(convertString(src.getNameElement())); + if (src.hasDescription()) + tgt.setDescriptionElement(convertMarkdown(src.getDescriptionElement())); + for (org.hl7.fhir.r5.model.ExampleScenario.ExampleScenarioInstanceVersionComponent t : src.getVersion()) + tgt.addVersion(convertExampleScenarioInstanceVersionComponent(t)); + for (org.hl7.fhir.r5.model.ExampleScenario.ExampleScenarioInstanceContainedInstanceComponent t : src.getContainedInstance()) + tgt.addContainedInstance(convertExampleScenarioInstanceContainedInstanceComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.ExampleScenario.FHIRResourceType convertFHIRResourceType(org.hl7.fhir.r4.model.ExampleScenario.FHIRResourceType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case ACCOUNT: return org.hl7.fhir.r5.model.ExampleScenario.FHIRResourceType.ACCOUNT; + case ACTIVITYDEFINITION: return org.hl7.fhir.r5.model.ExampleScenario.FHIRResourceType.ACTIVITYDEFINITION; + case ADVERSEEVENT: return org.hl7.fhir.r5.model.ExampleScenario.FHIRResourceType.ADVERSEEVENT; + case ALLERGYINTOLERANCE: return org.hl7.fhir.r5.model.ExampleScenario.FHIRResourceType.ALLERGYINTOLERANCE; + case APPOINTMENT: return org.hl7.fhir.r5.model.ExampleScenario.FHIRResourceType.APPOINTMENT; + case APPOINTMENTRESPONSE: return org.hl7.fhir.r5.model.ExampleScenario.FHIRResourceType.APPOINTMENTRESPONSE; + case AUDITEVENT: return org.hl7.fhir.r5.model.ExampleScenario.FHIRResourceType.AUDITEVENT; + case BASIC: return org.hl7.fhir.r5.model.ExampleScenario.FHIRResourceType.BASIC; + case BINARY: return org.hl7.fhir.r5.model.ExampleScenario.FHIRResourceType.BINARY; + case BIOLOGICALLYDERIVEDPRODUCT: return org.hl7.fhir.r5.model.ExampleScenario.FHIRResourceType.BIOLOGICALLYDERIVEDPRODUCT; + case BODYSTRUCTURE: return org.hl7.fhir.r5.model.ExampleScenario.FHIRResourceType.BODYSTRUCTURE; + case BUNDLE: return org.hl7.fhir.r5.model.ExampleScenario.FHIRResourceType.BUNDLE; + case CAPABILITYSTATEMENT: return org.hl7.fhir.r5.model.ExampleScenario.FHIRResourceType.CAPABILITYSTATEMENT; + case CAREPLAN: return org.hl7.fhir.r5.model.ExampleScenario.FHIRResourceType.CAREPLAN; + case CARETEAM: return org.hl7.fhir.r5.model.ExampleScenario.FHIRResourceType.CARETEAM; + case CATALOGENTRY: return org.hl7.fhir.r5.model.ExampleScenario.FHIRResourceType.CATALOGENTRY; + case CHARGEITEM: return org.hl7.fhir.r5.model.ExampleScenario.FHIRResourceType.CHARGEITEM; + case CHARGEITEMDEFINITION: return org.hl7.fhir.r5.model.ExampleScenario.FHIRResourceType.CHARGEITEMDEFINITION; + case CLAIM: return org.hl7.fhir.r5.model.ExampleScenario.FHIRResourceType.CLAIM; + case CLAIMRESPONSE: return org.hl7.fhir.r5.model.ExampleScenario.FHIRResourceType.CLAIMRESPONSE; + case CLINICALIMPRESSION: return org.hl7.fhir.r5.model.ExampleScenario.FHIRResourceType.CLINICALIMPRESSION; + case CODESYSTEM: return org.hl7.fhir.r5.model.ExampleScenario.FHIRResourceType.CODESYSTEM; + case COMMUNICATION: return org.hl7.fhir.r5.model.ExampleScenario.FHIRResourceType.COMMUNICATION; + case COMMUNICATIONREQUEST: return org.hl7.fhir.r5.model.ExampleScenario.FHIRResourceType.COMMUNICATIONREQUEST; + case COMPARTMENTDEFINITION: return org.hl7.fhir.r5.model.ExampleScenario.FHIRResourceType.COMPARTMENTDEFINITION; + case COMPOSITION: return org.hl7.fhir.r5.model.ExampleScenario.FHIRResourceType.COMPOSITION; + case CONCEPTMAP: return org.hl7.fhir.r5.model.ExampleScenario.FHIRResourceType.CONCEPTMAP; + case CONDITION: return org.hl7.fhir.r5.model.ExampleScenario.FHIRResourceType.CONDITION; + case CONSENT: return org.hl7.fhir.r5.model.ExampleScenario.FHIRResourceType.CONSENT; + case CONTRACT: return org.hl7.fhir.r5.model.ExampleScenario.FHIRResourceType.CONTRACT; + case COVERAGE: return org.hl7.fhir.r5.model.ExampleScenario.FHIRResourceType.COVERAGE; + case COVERAGEELIGIBILITYREQUEST: return org.hl7.fhir.r5.model.ExampleScenario.FHIRResourceType.COVERAGEELIGIBILITYREQUEST; + case COVERAGEELIGIBILITYRESPONSE: return org.hl7.fhir.r5.model.ExampleScenario.FHIRResourceType.COVERAGEELIGIBILITYRESPONSE; + case DETECTEDISSUE: return org.hl7.fhir.r5.model.ExampleScenario.FHIRResourceType.DETECTEDISSUE; + case DEVICE: return org.hl7.fhir.r5.model.ExampleScenario.FHIRResourceType.DEVICE; + case DEVICEDEFINITION: return org.hl7.fhir.r5.model.ExampleScenario.FHIRResourceType.DEVICEDEFINITION; + case DEVICEMETRIC: return org.hl7.fhir.r5.model.ExampleScenario.FHIRResourceType.DEVICEMETRIC; + case DEVICEREQUEST: return org.hl7.fhir.r5.model.ExampleScenario.FHIRResourceType.DEVICEREQUEST; + case DEVICEUSESTATEMENT: return org.hl7.fhir.r5.model.ExampleScenario.FHIRResourceType.DEVICEUSESTATEMENT; + case DIAGNOSTICREPORT: return org.hl7.fhir.r5.model.ExampleScenario.FHIRResourceType.DIAGNOSTICREPORT; + case DOCUMENTMANIFEST: return org.hl7.fhir.r5.model.ExampleScenario.FHIRResourceType.DOCUMENTMANIFEST; + case DOCUMENTREFERENCE: return org.hl7.fhir.r5.model.ExampleScenario.FHIRResourceType.DOCUMENTREFERENCE; + case DOMAINRESOURCE: return org.hl7.fhir.r5.model.ExampleScenario.FHIRResourceType.DOMAINRESOURCE; + case EFFECTEVIDENCESYNTHESIS: return org.hl7.fhir.r5.model.ExampleScenario.FHIRResourceType.EFFECTEVIDENCESYNTHESIS; + case ENCOUNTER: return org.hl7.fhir.r5.model.ExampleScenario.FHIRResourceType.ENCOUNTER; + case ENDPOINT: return org.hl7.fhir.r5.model.ExampleScenario.FHIRResourceType.ENDPOINT; + case ENROLLMENTREQUEST: return org.hl7.fhir.r5.model.ExampleScenario.FHIRResourceType.ENROLLMENTREQUEST; + case ENROLLMENTRESPONSE: return org.hl7.fhir.r5.model.ExampleScenario.FHIRResourceType.ENROLLMENTRESPONSE; + case EPISODEOFCARE: return org.hl7.fhir.r5.model.ExampleScenario.FHIRResourceType.EPISODEOFCARE; + case EVENTDEFINITION: return org.hl7.fhir.r5.model.ExampleScenario.FHIRResourceType.EVENTDEFINITION; + case EVIDENCE: return org.hl7.fhir.r5.model.ExampleScenario.FHIRResourceType.EVIDENCE; + case EVIDENCEVARIABLE: return org.hl7.fhir.r5.model.ExampleScenario.FHIRResourceType.EVIDENCEVARIABLE; + case EXAMPLESCENARIO: return org.hl7.fhir.r5.model.ExampleScenario.FHIRResourceType.EXAMPLESCENARIO; + case EXPLANATIONOFBENEFIT: return org.hl7.fhir.r5.model.ExampleScenario.FHIRResourceType.EXPLANATIONOFBENEFIT; + case FAMILYMEMBERHISTORY: return org.hl7.fhir.r5.model.ExampleScenario.FHIRResourceType.FAMILYMEMBERHISTORY; + case FLAG: return org.hl7.fhir.r5.model.ExampleScenario.FHIRResourceType.FLAG; + case GOAL: return org.hl7.fhir.r5.model.ExampleScenario.FHIRResourceType.GOAL; + case GRAPHDEFINITION: return org.hl7.fhir.r5.model.ExampleScenario.FHIRResourceType.GRAPHDEFINITION; + case GROUP: return org.hl7.fhir.r5.model.ExampleScenario.FHIRResourceType.GROUP; + case GUIDANCERESPONSE: return org.hl7.fhir.r5.model.ExampleScenario.FHIRResourceType.GUIDANCERESPONSE; + case HEALTHCARESERVICE: return org.hl7.fhir.r5.model.ExampleScenario.FHIRResourceType.HEALTHCARESERVICE; + case IMAGINGSTUDY: return org.hl7.fhir.r5.model.ExampleScenario.FHIRResourceType.IMAGINGSTUDY; + case IMMUNIZATION: return org.hl7.fhir.r5.model.ExampleScenario.FHIRResourceType.IMMUNIZATION; + case IMMUNIZATIONEVALUATION: return org.hl7.fhir.r5.model.ExampleScenario.FHIRResourceType.IMMUNIZATIONEVALUATION; + case IMMUNIZATIONRECOMMENDATION: return org.hl7.fhir.r5.model.ExampleScenario.FHIRResourceType.IMMUNIZATIONRECOMMENDATION; + case IMPLEMENTATIONGUIDE: return org.hl7.fhir.r5.model.ExampleScenario.FHIRResourceType.IMPLEMENTATIONGUIDE; + case INSURANCEPLAN: return org.hl7.fhir.r5.model.ExampleScenario.FHIRResourceType.INSURANCEPLAN; + case INVOICE: return org.hl7.fhir.r5.model.ExampleScenario.FHIRResourceType.INVOICE; + case LIBRARY: return org.hl7.fhir.r5.model.ExampleScenario.FHIRResourceType.LIBRARY; + case LINKAGE: return org.hl7.fhir.r5.model.ExampleScenario.FHIRResourceType.LINKAGE; + case LIST: return org.hl7.fhir.r5.model.ExampleScenario.FHIRResourceType.LIST; + case LOCATION: return org.hl7.fhir.r5.model.ExampleScenario.FHIRResourceType.LOCATION; + case MEASURE: return org.hl7.fhir.r5.model.ExampleScenario.FHIRResourceType.MEASURE; + case MEASUREREPORT: return org.hl7.fhir.r5.model.ExampleScenario.FHIRResourceType.MEASUREREPORT; + case MEDIA: return org.hl7.fhir.r5.model.ExampleScenario.FHIRResourceType.MEDIA; + case MEDICATION: return org.hl7.fhir.r5.model.ExampleScenario.FHIRResourceType.MEDICATION; + case MEDICATIONADMINISTRATION: return org.hl7.fhir.r5.model.ExampleScenario.FHIRResourceType.MEDICATIONADMINISTRATION; + case MEDICATIONDISPENSE: return org.hl7.fhir.r5.model.ExampleScenario.FHIRResourceType.MEDICATIONDISPENSE; + case MEDICATIONKNOWLEDGE: return org.hl7.fhir.r5.model.ExampleScenario.FHIRResourceType.MEDICATIONKNOWLEDGE; + case MEDICATIONREQUEST: return org.hl7.fhir.r5.model.ExampleScenario.FHIRResourceType.MEDICATIONREQUEST; + case MEDICATIONSTATEMENT: return org.hl7.fhir.r5.model.ExampleScenario.FHIRResourceType.MEDICATIONSTATEMENT; + case MEDICINALPRODUCT: return org.hl7.fhir.r5.model.ExampleScenario.FHIRResourceType.MEDICINALPRODUCT; + case MEDICINALPRODUCTAUTHORIZATION: return org.hl7.fhir.r5.model.ExampleScenario.FHIRResourceType.MEDICINALPRODUCTAUTHORIZATION; + case MEDICINALPRODUCTCONTRAINDICATION: return org.hl7.fhir.r5.model.ExampleScenario.FHIRResourceType.MEDICINALPRODUCTCONTRAINDICATION; + case MEDICINALPRODUCTINDICATION: return org.hl7.fhir.r5.model.ExampleScenario.FHIRResourceType.MEDICINALPRODUCTINDICATION; + case MEDICINALPRODUCTINGREDIENT: return org.hl7.fhir.r5.model.ExampleScenario.FHIRResourceType.MEDICINALPRODUCTINGREDIENT; + case MEDICINALPRODUCTINTERACTION: return org.hl7.fhir.r5.model.ExampleScenario.FHIRResourceType.MEDICINALPRODUCTINTERACTION; + case MEDICINALPRODUCTMANUFACTURED: return org.hl7.fhir.r5.model.ExampleScenario.FHIRResourceType.MEDICINALPRODUCTMANUFACTURED; + case MEDICINALPRODUCTPACKAGED: return org.hl7.fhir.r5.model.ExampleScenario.FHIRResourceType.MEDICINALPRODUCTPACKAGED; + case MEDICINALPRODUCTPHARMACEUTICAL: return org.hl7.fhir.r5.model.ExampleScenario.FHIRResourceType.MEDICINALPRODUCTPHARMACEUTICAL; + case MEDICINALPRODUCTUNDESIRABLEEFFECT: return org.hl7.fhir.r5.model.ExampleScenario.FHIRResourceType.MEDICINALPRODUCTUNDESIRABLEEFFECT; + case MESSAGEDEFINITION: return org.hl7.fhir.r5.model.ExampleScenario.FHIRResourceType.MESSAGEDEFINITION; + case MESSAGEHEADER: return org.hl7.fhir.r5.model.ExampleScenario.FHIRResourceType.MESSAGEHEADER; + case MOLECULARSEQUENCE: return org.hl7.fhir.r5.model.ExampleScenario.FHIRResourceType.MOLECULARSEQUENCE; + case NAMINGSYSTEM: return org.hl7.fhir.r5.model.ExampleScenario.FHIRResourceType.NAMINGSYSTEM; + case NUTRITIONORDER: return org.hl7.fhir.r5.model.ExampleScenario.FHIRResourceType.NUTRITIONORDER; + case OBSERVATION: return org.hl7.fhir.r5.model.ExampleScenario.FHIRResourceType.OBSERVATION; + case OBSERVATIONDEFINITION: return org.hl7.fhir.r5.model.ExampleScenario.FHIRResourceType.OBSERVATIONDEFINITION; + case OPERATIONDEFINITION: return org.hl7.fhir.r5.model.ExampleScenario.FHIRResourceType.OPERATIONDEFINITION; + case OPERATIONOUTCOME: return org.hl7.fhir.r5.model.ExampleScenario.FHIRResourceType.OPERATIONOUTCOME; + case ORGANIZATION: return org.hl7.fhir.r5.model.ExampleScenario.FHIRResourceType.ORGANIZATION; + case ORGANIZATIONAFFILIATION: return org.hl7.fhir.r5.model.ExampleScenario.FHIRResourceType.ORGANIZATIONAFFILIATION; + case PARAMETERS: return org.hl7.fhir.r5.model.ExampleScenario.FHIRResourceType.PARAMETERS; + case PATIENT: return org.hl7.fhir.r5.model.ExampleScenario.FHIRResourceType.PATIENT; + case PAYMENTNOTICE: return org.hl7.fhir.r5.model.ExampleScenario.FHIRResourceType.PAYMENTNOTICE; + case PAYMENTRECONCILIATION: return org.hl7.fhir.r5.model.ExampleScenario.FHIRResourceType.PAYMENTRECONCILIATION; + case PERSON: return org.hl7.fhir.r5.model.ExampleScenario.FHIRResourceType.PERSON; + case PLANDEFINITION: return org.hl7.fhir.r5.model.ExampleScenario.FHIRResourceType.PLANDEFINITION; + case PRACTITIONER: return org.hl7.fhir.r5.model.ExampleScenario.FHIRResourceType.PRACTITIONER; + case PRACTITIONERROLE: return org.hl7.fhir.r5.model.ExampleScenario.FHIRResourceType.PRACTITIONERROLE; + case PROCEDURE: return org.hl7.fhir.r5.model.ExampleScenario.FHIRResourceType.PROCEDURE; + case PROVENANCE: return org.hl7.fhir.r5.model.ExampleScenario.FHIRResourceType.PROVENANCE; + case QUESTIONNAIRE: return org.hl7.fhir.r5.model.ExampleScenario.FHIRResourceType.QUESTIONNAIRE; + case QUESTIONNAIRERESPONSE: return org.hl7.fhir.r5.model.ExampleScenario.FHIRResourceType.QUESTIONNAIRERESPONSE; + case RELATEDPERSON: return org.hl7.fhir.r5.model.ExampleScenario.FHIRResourceType.RELATEDPERSON; + case REQUESTGROUP: return org.hl7.fhir.r5.model.ExampleScenario.FHIRResourceType.REQUESTGROUP; + case RESEARCHDEFINITION: return org.hl7.fhir.r5.model.ExampleScenario.FHIRResourceType.RESEARCHDEFINITION; + case RESEARCHELEMENTDEFINITION: return org.hl7.fhir.r5.model.ExampleScenario.FHIRResourceType.RESEARCHELEMENTDEFINITION; + case RESEARCHSTUDY: return org.hl7.fhir.r5.model.ExampleScenario.FHIRResourceType.RESEARCHSTUDY; + case RESEARCHSUBJECT: return org.hl7.fhir.r5.model.ExampleScenario.FHIRResourceType.RESEARCHSUBJECT; + case RESOURCE: return org.hl7.fhir.r5.model.ExampleScenario.FHIRResourceType.RESOURCE; + case RISKASSESSMENT: return org.hl7.fhir.r5.model.ExampleScenario.FHIRResourceType.RISKASSESSMENT; + case RISKEVIDENCESYNTHESIS: return org.hl7.fhir.r5.model.ExampleScenario.FHIRResourceType.RISKEVIDENCESYNTHESIS; + case SCHEDULE: return org.hl7.fhir.r5.model.ExampleScenario.FHIRResourceType.SCHEDULE; + case SEARCHPARAMETER: return org.hl7.fhir.r5.model.ExampleScenario.FHIRResourceType.SEARCHPARAMETER; + case SERVICEREQUEST: return org.hl7.fhir.r5.model.ExampleScenario.FHIRResourceType.SERVICEREQUEST; + case SLOT: return org.hl7.fhir.r5.model.ExampleScenario.FHIRResourceType.SLOT; + case SPECIMEN: return org.hl7.fhir.r5.model.ExampleScenario.FHIRResourceType.SPECIMEN; + case SPECIMENDEFINITION: return org.hl7.fhir.r5.model.ExampleScenario.FHIRResourceType.SPECIMENDEFINITION; + case STRUCTUREDEFINITION: return org.hl7.fhir.r5.model.ExampleScenario.FHIRResourceType.STRUCTUREDEFINITION; + case STRUCTUREMAP: return org.hl7.fhir.r5.model.ExampleScenario.FHIRResourceType.STRUCTUREMAP; + case SUBSCRIPTION: return org.hl7.fhir.r5.model.ExampleScenario.FHIRResourceType.SUBSCRIPTION; + case SUBSTANCE: return org.hl7.fhir.r5.model.ExampleScenario.FHIRResourceType.SUBSTANCE; + case SUBSTANCENUCLEICACID: return org.hl7.fhir.r5.model.ExampleScenario.FHIRResourceType.SUBSTANCENUCLEICACID; + case SUBSTANCEPOLYMER: return org.hl7.fhir.r5.model.ExampleScenario.FHIRResourceType.SUBSTANCEPOLYMER; + case SUBSTANCEPROTEIN: return org.hl7.fhir.r5.model.ExampleScenario.FHIRResourceType.SUBSTANCEPROTEIN; + case SUBSTANCEREFERENCEINFORMATION: return org.hl7.fhir.r5.model.ExampleScenario.FHIRResourceType.SUBSTANCEREFERENCEINFORMATION; + case SUBSTANCESOURCEMATERIAL: return org.hl7.fhir.r5.model.ExampleScenario.FHIRResourceType.SUBSTANCESOURCEMATERIAL; + case SUBSTANCESPECIFICATION: return org.hl7.fhir.r5.model.ExampleScenario.FHIRResourceType.SUBSTANCESPECIFICATION; + case SUPPLYDELIVERY: return org.hl7.fhir.r5.model.ExampleScenario.FHIRResourceType.SUPPLYDELIVERY; + case SUPPLYREQUEST: return org.hl7.fhir.r5.model.ExampleScenario.FHIRResourceType.SUPPLYREQUEST; + case TASK: return org.hl7.fhir.r5.model.ExampleScenario.FHIRResourceType.TASK; + case TERMINOLOGYCAPABILITIES: return org.hl7.fhir.r5.model.ExampleScenario.FHIRResourceType.TERMINOLOGYCAPABILITIES; + case TESTREPORT: return org.hl7.fhir.r5.model.ExampleScenario.FHIRResourceType.TESTREPORT; + case TESTSCRIPT: return org.hl7.fhir.r5.model.ExampleScenario.FHIRResourceType.TESTSCRIPT; + case VALUESET: return org.hl7.fhir.r5.model.ExampleScenario.FHIRResourceType.VALUESET; + case VERIFICATIONRESULT: return org.hl7.fhir.r5.model.ExampleScenario.FHIRResourceType.VERIFICATIONRESULT; + case VISIONPRESCRIPTION: return org.hl7.fhir.r5.model.ExampleScenario.FHIRResourceType.VISIONPRESCRIPTION; + default: return org.hl7.fhir.r5.model.ExampleScenario.FHIRResourceType.NULL; + } +} + + public static org.hl7.fhir.r4.model.ExampleScenario.FHIRResourceType convertFHIRResourceType(org.hl7.fhir.r5.model.ExampleScenario.FHIRResourceType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case ACCOUNT: return org.hl7.fhir.r4.model.ExampleScenario.FHIRResourceType.ACCOUNT; + case ACTIVITYDEFINITION: return org.hl7.fhir.r4.model.ExampleScenario.FHIRResourceType.ACTIVITYDEFINITION; + case ADVERSEEVENT: return org.hl7.fhir.r4.model.ExampleScenario.FHIRResourceType.ADVERSEEVENT; + case ALLERGYINTOLERANCE: return org.hl7.fhir.r4.model.ExampleScenario.FHIRResourceType.ALLERGYINTOLERANCE; + case APPOINTMENT: return org.hl7.fhir.r4.model.ExampleScenario.FHIRResourceType.APPOINTMENT; + case APPOINTMENTRESPONSE: return org.hl7.fhir.r4.model.ExampleScenario.FHIRResourceType.APPOINTMENTRESPONSE; + case AUDITEVENT: return org.hl7.fhir.r4.model.ExampleScenario.FHIRResourceType.AUDITEVENT; + case BASIC: return org.hl7.fhir.r4.model.ExampleScenario.FHIRResourceType.BASIC; + case BINARY: return org.hl7.fhir.r4.model.ExampleScenario.FHIRResourceType.BINARY; + case BIOLOGICALLYDERIVEDPRODUCT: return org.hl7.fhir.r4.model.ExampleScenario.FHIRResourceType.BIOLOGICALLYDERIVEDPRODUCT; + case BODYSTRUCTURE: return org.hl7.fhir.r4.model.ExampleScenario.FHIRResourceType.BODYSTRUCTURE; + case BUNDLE: return org.hl7.fhir.r4.model.ExampleScenario.FHIRResourceType.BUNDLE; + case CAPABILITYSTATEMENT: return org.hl7.fhir.r4.model.ExampleScenario.FHIRResourceType.CAPABILITYSTATEMENT; + case CAREPLAN: return org.hl7.fhir.r4.model.ExampleScenario.FHIRResourceType.CAREPLAN; + case CARETEAM: return org.hl7.fhir.r4.model.ExampleScenario.FHIRResourceType.CARETEAM; + case CATALOGENTRY: return org.hl7.fhir.r4.model.ExampleScenario.FHIRResourceType.CATALOGENTRY; + case CHARGEITEM: return org.hl7.fhir.r4.model.ExampleScenario.FHIRResourceType.CHARGEITEM; + case CHARGEITEMDEFINITION: return org.hl7.fhir.r4.model.ExampleScenario.FHIRResourceType.CHARGEITEMDEFINITION; + case CLAIM: return org.hl7.fhir.r4.model.ExampleScenario.FHIRResourceType.CLAIM; + case CLAIMRESPONSE: return org.hl7.fhir.r4.model.ExampleScenario.FHIRResourceType.CLAIMRESPONSE; + case CLINICALIMPRESSION: return org.hl7.fhir.r4.model.ExampleScenario.FHIRResourceType.CLINICALIMPRESSION; + case CODESYSTEM: return org.hl7.fhir.r4.model.ExampleScenario.FHIRResourceType.CODESYSTEM; + case COMMUNICATION: return org.hl7.fhir.r4.model.ExampleScenario.FHIRResourceType.COMMUNICATION; + case COMMUNICATIONREQUEST: return org.hl7.fhir.r4.model.ExampleScenario.FHIRResourceType.COMMUNICATIONREQUEST; + case COMPARTMENTDEFINITION: return org.hl7.fhir.r4.model.ExampleScenario.FHIRResourceType.COMPARTMENTDEFINITION; + case COMPOSITION: return org.hl7.fhir.r4.model.ExampleScenario.FHIRResourceType.COMPOSITION; + case CONCEPTMAP: return org.hl7.fhir.r4.model.ExampleScenario.FHIRResourceType.CONCEPTMAP; + case CONDITION: return org.hl7.fhir.r4.model.ExampleScenario.FHIRResourceType.CONDITION; + case CONSENT: return org.hl7.fhir.r4.model.ExampleScenario.FHIRResourceType.CONSENT; + case CONTRACT: return org.hl7.fhir.r4.model.ExampleScenario.FHIRResourceType.CONTRACT; + case COVERAGE: return org.hl7.fhir.r4.model.ExampleScenario.FHIRResourceType.COVERAGE; + case COVERAGEELIGIBILITYREQUEST: return org.hl7.fhir.r4.model.ExampleScenario.FHIRResourceType.COVERAGEELIGIBILITYREQUEST; + case COVERAGEELIGIBILITYRESPONSE: return org.hl7.fhir.r4.model.ExampleScenario.FHIRResourceType.COVERAGEELIGIBILITYRESPONSE; + case DETECTEDISSUE: return org.hl7.fhir.r4.model.ExampleScenario.FHIRResourceType.DETECTEDISSUE; + case DEVICE: return org.hl7.fhir.r4.model.ExampleScenario.FHIRResourceType.DEVICE; + case DEVICEDEFINITION: return org.hl7.fhir.r4.model.ExampleScenario.FHIRResourceType.DEVICEDEFINITION; + case DEVICEMETRIC: return org.hl7.fhir.r4.model.ExampleScenario.FHIRResourceType.DEVICEMETRIC; + case DEVICEREQUEST: return org.hl7.fhir.r4.model.ExampleScenario.FHIRResourceType.DEVICEREQUEST; + case DEVICEUSESTATEMENT: return org.hl7.fhir.r4.model.ExampleScenario.FHIRResourceType.DEVICEUSESTATEMENT; + case DIAGNOSTICREPORT: return org.hl7.fhir.r4.model.ExampleScenario.FHIRResourceType.DIAGNOSTICREPORT; + case DOCUMENTMANIFEST: return org.hl7.fhir.r4.model.ExampleScenario.FHIRResourceType.DOCUMENTMANIFEST; + case DOCUMENTREFERENCE: return org.hl7.fhir.r4.model.ExampleScenario.FHIRResourceType.DOCUMENTREFERENCE; + case DOMAINRESOURCE: return org.hl7.fhir.r4.model.ExampleScenario.FHIRResourceType.DOMAINRESOURCE; + case EFFECTEVIDENCESYNTHESIS: return org.hl7.fhir.r4.model.ExampleScenario.FHIRResourceType.EFFECTEVIDENCESYNTHESIS; + case ENCOUNTER: return org.hl7.fhir.r4.model.ExampleScenario.FHIRResourceType.ENCOUNTER; + case ENDPOINT: return org.hl7.fhir.r4.model.ExampleScenario.FHIRResourceType.ENDPOINT; + case ENROLLMENTREQUEST: return org.hl7.fhir.r4.model.ExampleScenario.FHIRResourceType.ENROLLMENTREQUEST; + case ENROLLMENTRESPONSE: return org.hl7.fhir.r4.model.ExampleScenario.FHIRResourceType.ENROLLMENTRESPONSE; + case EPISODEOFCARE: return org.hl7.fhir.r4.model.ExampleScenario.FHIRResourceType.EPISODEOFCARE; + case EVENTDEFINITION: return org.hl7.fhir.r4.model.ExampleScenario.FHIRResourceType.EVENTDEFINITION; + case EVIDENCE: return org.hl7.fhir.r4.model.ExampleScenario.FHIRResourceType.EVIDENCE; + case EVIDENCEVARIABLE: return org.hl7.fhir.r4.model.ExampleScenario.FHIRResourceType.EVIDENCEVARIABLE; + case EXAMPLESCENARIO: return org.hl7.fhir.r4.model.ExampleScenario.FHIRResourceType.EXAMPLESCENARIO; + case EXPLANATIONOFBENEFIT: return org.hl7.fhir.r4.model.ExampleScenario.FHIRResourceType.EXPLANATIONOFBENEFIT; + case FAMILYMEMBERHISTORY: return org.hl7.fhir.r4.model.ExampleScenario.FHIRResourceType.FAMILYMEMBERHISTORY; + case FLAG: return org.hl7.fhir.r4.model.ExampleScenario.FHIRResourceType.FLAG; + case GOAL: return org.hl7.fhir.r4.model.ExampleScenario.FHIRResourceType.GOAL; + case GRAPHDEFINITION: return org.hl7.fhir.r4.model.ExampleScenario.FHIRResourceType.GRAPHDEFINITION; + case GROUP: return org.hl7.fhir.r4.model.ExampleScenario.FHIRResourceType.GROUP; + case GUIDANCERESPONSE: return org.hl7.fhir.r4.model.ExampleScenario.FHIRResourceType.GUIDANCERESPONSE; + case HEALTHCARESERVICE: return org.hl7.fhir.r4.model.ExampleScenario.FHIRResourceType.HEALTHCARESERVICE; + case IMAGINGSTUDY: return org.hl7.fhir.r4.model.ExampleScenario.FHIRResourceType.IMAGINGSTUDY; + case IMMUNIZATION: return org.hl7.fhir.r4.model.ExampleScenario.FHIRResourceType.IMMUNIZATION; + case IMMUNIZATIONEVALUATION: return org.hl7.fhir.r4.model.ExampleScenario.FHIRResourceType.IMMUNIZATIONEVALUATION; + case IMMUNIZATIONRECOMMENDATION: return org.hl7.fhir.r4.model.ExampleScenario.FHIRResourceType.IMMUNIZATIONRECOMMENDATION; + case IMPLEMENTATIONGUIDE: return org.hl7.fhir.r4.model.ExampleScenario.FHIRResourceType.IMPLEMENTATIONGUIDE; + case INSURANCEPLAN: return org.hl7.fhir.r4.model.ExampleScenario.FHIRResourceType.INSURANCEPLAN; + case INVOICE: return org.hl7.fhir.r4.model.ExampleScenario.FHIRResourceType.INVOICE; + case LIBRARY: return org.hl7.fhir.r4.model.ExampleScenario.FHIRResourceType.LIBRARY; + case LINKAGE: return org.hl7.fhir.r4.model.ExampleScenario.FHIRResourceType.LINKAGE; + case LIST: return org.hl7.fhir.r4.model.ExampleScenario.FHIRResourceType.LIST; + case LOCATION: return org.hl7.fhir.r4.model.ExampleScenario.FHIRResourceType.LOCATION; + case MEASURE: return org.hl7.fhir.r4.model.ExampleScenario.FHIRResourceType.MEASURE; + case MEASUREREPORT: return org.hl7.fhir.r4.model.ExampleScenario.FHIRResourceType.MEASUREREPORT; + case MEDIA: return org.hl7.fhir.r4.model.ExampleScenario.FHIRResourceType.MEDIA; + case MEDICATION: return org.hl7.fhir.r4.model.ExampleScenario.FHIRResourceType.MEDICATION; + case MEDICATIONADMINISTRATION: return org.hl7.fhir.r4.model.ExampleScenario.FHIRResourceType.MEDICATIONADMINISTRATION; + case MEDICATIONDISPENSE: return org.hl7.fhir.r4.model.ExampleScenario.FHIRResourceType.MEDICATIONDISPENSE; + case MEDICATIONKNOWLEDGE: return org.hl7.fhir.r4.model.ExampleScenario.FHIRResourceType.MEDICATIONKNOWLEDGE; + case MEDICATIONREQUEST: return org.hl7.fhir.r4.model.ExampleScenario.FHIRResourceType.MEDICATIONREQUEST; + case MEDICATIONSTATEMENT: return org.hl7.fhir.r4.model.ExampleScenario.FHIRResourceType.MEDICATIONSTATEMENT; + case MEDICINALPRODUCT: return org.hl7.fhir.r4.model.ExampleScenario.FHIRResourceType.MEDICINALPRODUCT; + case MEDICINALPRODUCTAUTHORIZATION: return org.hl7.fhir.r4.model.ExampleScenario.FHIRResourceType.MEDICINALPRODUCTAUTHORIZATION; + case MEDICINALPRODUCTCONTRAINDICATION: return org.hl7.fhir.r4.model.ExampleScenario.FHIRResourceType.MEDICINALPRODUCTCONTRAINDICATION; + case MEDICINALPRODUCTINDICATION: return org.hl7.fhir.r4.model.ExampleScenario.FHIRResourceType.MEDICINALPRODUCTINDICATION; + case MEDICINALPRODUCTINGREDIENT: return org.hl7.fhir.r4.model.ExampleScenario.FHIRResourceType.MEDICINALPRODUCTINGREDIENT; + case MEDICINALPRODUCTINTERACTION: return org.hl7.fhir.r4.model.ExampleScenario.FHIRResourceType.MEDICINALPRODUCTINTERACTION; + case MEDICINALPRODUCTMANUFACTURED: return org.hl7.fhir.r4.model.ExampleScenario.FHIRResourceType.MEDICINALPRODUCTMANUFACTURED; + case MEDICINALPRODUCTPACKAGED: return org.hl7.fhir.r4.model.ExampleScenario.FHIRResourceType.MEDICINALPRODUCTPACKAGED; + case MEDICINALPRODUCTPHARMACEUTICAL: return org.hl7.fhir.r4.model.ExampleScenario.FHIRResourceType.MEDICINALPRODUCTPHARMACEUTICAL; + case MEDICINALPRODUCTUNDESIRABLEEFFECT: return org.hl7.fhir.r4.model.ExampleScenario.FHIRResourceType.MEDICINALPRODUCTUNDESIRABLEEFFECT; + case MESSAGEDEFINITION: return org.hl7.fhir.r4.model.ExampleScenario.FHIRResourceType.MESSAGEDEFINITION; + case MESSAGEHEADER: return org.hl7.fhir.r4.model.ExampleScenario.FHIRResourceType.MESSAGEHEADER; + case MOLECULARSEQUENCE: return org.hl7.fhir.r4.model.ExampleScenario.FHIRResourceType.MOLECULARSEQUENCE; + case NAMINGSYSTEM: return org.hl7.fhir.r4.model.ExampleScenario.FHIRResourceType.NAMINGSYSTEM; + case NUTRITIONORDER: return org.hl7.fhir.r4.model.ExampleScenario.FHIRResourceType.NUTRITIONORDER; + case OBSERVATION: return org.hl7.fhir.r4.model.ExampleScenario.FHIRResourceType.OBSERVATION; + case OBSERVATIONDEFINITION: return org.hl7.fhir.r4.model.ExampleScenario.FHIRResourceType.OBSERVATIONDEFINITION; + case OPERATIONDEFINITION: return org.hl7.fhir.r4.model.ExampleScenario.FHIRResourceType.OPERATIONDEFINITION; + case OPERATIONOUTCOME: return org.hl7.fhir.r4.model.ExampleScenario.FHIRResourceType.OPERATIONOUTCOME; + case ORGANIZATION: return org.hl7.fhir.r4.model.ExampleScenario.FHIRResourceType.ORGANIZATION; + case ORGANIZATIONAFFILIATION: return org.hl7.fhir.r4.model.ExampleScenario.FHIRResourceType.ORGANIZATIONAFFILIATION; + case PARAMETERS: return org.hl7.fhir.r4.model.ExampleScenario.FHIRResourceType.PARAMETERS; + case PATIENT: return org.hl7.fhir.r4.model.ExampleScenario.FHIRResourceType.PATIENT; + case PAYMENTNOTICE: return org.hl7.fhir.r4.model.ExampleScenario.FHIRResourceType.PAYMENTNOTICE; + case PAYMENTRECONCILIATION: return org.hl7.fhir.r4.model.ExampleScenario.FHIRResourceType.PAYMENTRECONCILIATION; + case PERSON: return org.hl7.fhir.r4.model.ExampleScenario.FHIRResourceType.PERSON; + case PLANDEFINITION: return org.hl7.fhir.r4.model.ExampleScenario.FHIRResourceType.PLANDEFINITION; + case PRACTITIONER: return org.hl7.fhir.r4.model.ExampleScenario.FHIRResourceType.PRACTITIONER; + case PRACTITIONERROLE: return org.hl7.fhir.r4.model.ExampleScenario.FHIRResourceType.PRACTITIONERROLE; + case PROCEDURE: return org.hl7.fhir.r4.model.ExampleScenario.FHIRResourceType.PROCEDURE; + case PROVENANCE: return org.hl7.fhir.r4.model.ExampleScenario.FHIRResourceType.PROVENANCE; + case QUESTIONNAIRE: return org.hl7.fhir.r4.model.ExampleScenario.FHIRResourceType.QUESTIONNAIRE; + case QUESTIONNAIRERESPONSE: return org.hl7.fhir.r4.model.ExampleScenario.FHIRResourceType.QUESTIONNAIRERESPONSE; + case RELATEDPERSON: return org.hl7.fhir.r4.model.ExampleScenario.FHIRResourceType.RELATEDPERSON; + case REQUESTGROUP: return org.hl7.fhir.r4.model.ExampleScenario.FHIRResourceType.REQUESTGROUP; + case RESEARCHDEFINITION: return org.hl7.fhir.r4.model.ExampleScenario.FHIRResourceType.RESEARCHDEFINITION; + case RESEARCHELEMENTDEFINITION: return org.hl7.fhir.r4.model.ExampleScenario.FHIRResourceType.RESEARCHELEMENTDEFINITION; + case RESEARCHSTUDY: return org.hl7.fhir.r4.model.ExampleScenario.FHIRResourceType.RESEARCHSTUDY; + case RESEARCHSUBJECT: return org.hl7.fhir.r4.model.ExampleScenario.FHIRResourceType.RESEARCHSUBJECT; + case RESOURCE: return org.hl7.fhir.r4.model.ExampleScenario.FHIRResourceType.RESOURCE; + case RISKASSESSMENT: return org.hl7.fhir.r4.model.ExampleScenario.FHIRResourceType.RISKASSESSMENT; + case RISKEVIDENCESYNTHESIS: return org.hl7.fhir.r4.model.ExampleScenario.FHIRResourceType.RISKEVIDENCESYNTHESIS; + case SCHEDULE: return org.hl7.fhir.r4.model.ExampleScenario.FHIRResourceType.SCHEDULE; + case SEARCHPARAMETER: return org.hl7.fhir.r4.model.ExampleScenario.FHIRResourceType.SEARCHPARAMETER; + case SERVICEREQUEST: return org.hl7.fhir.r4.model.ExampleScenario.FHIRResourceType.SERVICEREQUEST; + case SLOT: return org.hl7.fhir.r4.model.ExampleScenario.FHIRResourceType.SLOT; + case SPECIMEN: return org.hl7.fhir.r4.model.ExampleScenario.FHIRResourceType.SPECIMEN; + case SPECIMENDEFINITION: return org.hl7.fhir.r4.model.ExampleScenario.FHIRResourceType.SPECIMENDEFINITION; + case STRUCTUREDEFINITION: return org.hl7.fhir.r4.model.ExampleScenario.FHIRResourceType.STRUCTUREDEFINITION; + case STRUCTUREMAP: return org.hl7.fhir.r4.model.ExampleScenario.FHIRResourceType.STRUCTUREMAP; + case SUBSCRIPTION: return org.hl7.fhir.r4.model.ExampleScenario.FHIRResourceType.SUBSCRIPTION; + case SUBSTANCE: return org.hl7.fhir.r4.model.ExampleScenario.FHIRResourceType.SUBSTANCE; + case SUBSTANCENUCLEICACID: return org.hl7.fhir.r4.model.ExampleScenario.FHIRResourceType.SUBSTANCENUCLEICACID; + case SUBSTANCEPOLYMER: return org.hl7.fhir.r4.model.ExampleScenario.FHIRResourceType.SUBSTANCEPOLYMER; + case SUBSTANCEPROTEIN: return org.hl7.fhir.r4.model.ExampleScenario.FHIRResourceType.SUBSTANCEPROTEIN; + case SUBSTANCEREFERENCEINFORMATION: return org.hl7.fhir.r4.model.ExampleScenario.FHIRResourceType.SUBSTANCEREFERENCEINFORMATION; + case SUBSTANCESOURCEMATERIAL: return org.hl7.fhir.r4.model.ExampleScenario.FHIRResourceType.SUBSTANCESOURCEMATERIAL; + case SUBSTANCESPECIFICATION: return org.hl7.fhir.r4.model.ExampleScenario.FHIRResourceType.SUBSTANCESPECIFICATION; + case SUPPLYDELIVERY: return org.hl7.fhir.r4.model.ExampleScenario.FHIRResourceType.SUPPLYDELIVERY; + case SUPPLYREQUEST: return org.hl7.fhir.r4.model.ExampleScenario.FHIRResourceType.SUPPLYREQUEST; + case TASK: return org.hl7.fhir.r4.model.ExampleScenario.FHIRResourceType.TASK; + case TERMINOLOGYCAPABILITIES: return org.hl7.fhir.r4.model.ExampleScenario.FHIRResourceType.TERMINOLOGYCAPABILITIES; + case TESTREPORT: return org.hl7.fhir.r4.model.ExampleScenario.FHIRResourceType.TESTREPORT; + case TESTSCRIPT: return org.hl7.fhir.r4.model.ExampleScenario.FHIRResourceType.TESTSCRIPT; + case VALUESET: return org.hl7.fhir.r4.model.ExampleScenario.FHIRResourceType.VALUESET; + case VERIFICATIONRESULT: return org.hl7.fhir.r4.model.ExampleScenario.FHIRResourceType.VERIFICATIONRESULT; + case VISIONPRESCRIPTION: return org.hl7.fhir.r4.model.ExampleScenario.FHIRResourceType.VISIONPRESCRIPTION; + default: return org.hl7.fhir.r4.model.ExampleScenario.FHIRResourceType.NULL; + } +} + + public static org.hl7.fhir.r5.model.ExampleScenario.ExampleScenarioInstanceVersionComponent convertExampleScenarioInstanceVersionComponent(org.hl7.fhir.r4.model.ExampleScenario.ExampleScenarioInstanceVersionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ExampleScenario.ExampleScenarioInstanceVersionComponent tgt = new org.hl7.fhir.r5.model.ExampleScenario.ExampleScenarioInstanceVersionComponent(); + copyElement(src, tgt); + if (src.hasVersionId()) + tgt.setVersionIdElement(convertString(src.getVersionIdElement())); + if (src.hasDescription()) + tgt.setDescriptionElement(convertMarkdown(src.getDescriptionElement())); + return tgt; + } + + public static org.hl7.fhir.r4.model.ExampleScenario.ExampleScenarioInstanceVersionComponent convertExampleScenarioInstanceVersionComponent(org.hl7.fhir.r5.model.ExampleScenario.ExampleScenarioInstanceVersionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.ExampleScenario.ExampleScenarioInstanceVersionComponent tgt = new org.hl7.fhir.r4.model.ExampleScenario.ExampleScenarioInstanceVersionComponent(); + copyElement(src, tgt); + if (src.hasVersionId()) + tgt.setVersionIdElement(convertString(src.getVersionIdElement())); + if (src.hasDescription()) + tgt.setDescriptionElement(convertMarkdown(src.getDescriptionElement())); + return tgt; + } + + public static org.hl7.fhir.r5.model.ExampleScenario.ExampleScenarioInstanceContainedInstanceComponent convertExampleScenarioInstanceContainedInstanceComponent(org.hl7.fhir.r4.model.ExampleScenario.ExampleScenarioInstanceContainedInstanceComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ExampleScenario.ExampleScenarioInstanceContainedInstanceComponent tgt = new org.hl7.fhir.r5.model.ExampleScenario.ExampleScenarioInstanceContainedInstanceComponent(); + copyElement(src, tgt); + if (src.hasResourceId()) + tgt.setResourceIdElement(convertString(src.getResourceIdElement())); + if (src.hasVersionId()) + tgt.setVersionIdElement(convertString(src.getVersionIdElement())); + return tgt; + } + + public static org.hl7.fhir.r4.model.ExampleScenario.ExampleScenarioInstanceContainedInstanceComponent convertExampleScenarioInstanceContainedInstanceComponent(org.hl7.fhir.r5.model.ExampleScenario.ExampleScenarioInstanceContainedInstanceComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.ExampleScenario.ExampleScenarioInstanceContainedInstanceComponent tgt = new org.hl7.fhir.r4.model.ExampleScenario.ExampleScenarioInstanceContainedInstanceComponent(); + copyElement(src, tgt); + if (src.hasResourceId()) + tgt.setResourceIdElement(convertString(src.getResourceIdElement())); + if (src.hasVersionId()) + tgt.setVersionIdElement(convertString(src.getVersionIdElement())); + return tgt; + } + + public static org.hl7.fhir.r5.model.ExampleScenario.ExampleScenarioProcessComponent convertExampleScenarioProcessComponent(org.hl7.fhir.r4.model.ExampleScenario.ExampleScenarioProcessComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ExampleScenario.ExampleScenarioProcessComponent tgt = new org.hl7.fhir.r5.model.ExampleScenario.ExampleScenarioProcessComponent(); + copyElement(src, tgt); + if (src.hasTitle()) + tgt.setTitleElement(convertString(src.getTitleElement())); + if (src.hasDescription()) + tgt.setDescriptionElement(convertMarkdown(src.getDescriptionElement())); + if (src.hasPreConditions()) + tgt.setPreConditionsElement(convertMarkdown(src.getPreConditionsElement())); + if (src.hasPostConditions()) + tgt.setPostConditionsElement(convertMarkdown(src.getPostConditionsElement())); + for (org.hl7.fhir.r4.model.ExampleScenario.ExampleScenarioProcessStepComponent t : src.getStep()) + tgt.addStep(convertExampleScenarioProcessStepComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.ExampleScenario.ExampleScenarioProcessComponent convertExampleScenarioProcessComponent(org.hl7.fhir.r5.model.ExampleScenario.ExampleScenarioProcessComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.ExampleScenario.ExampleScenarioProcessComponent tgt = new org.hl7.fhir.r4.model.ExampleScenario.ExampleScenarioProcessComponent(); + copyElement(src, tgt); + if (src.hasTitle()) + tgt.setTitleElement(convertString(src.getTitleElement())); + if (src.hasDescription()) + tgt.setDescriptionElement(convertMarkdown(src.getDescriptionElement())); + if (src.hasPreConditions()) + tgt.setPreConditionsElement(convertMarkdown(src.getPreConditionsElement())); + if (src.hasPostConditions()) + tgt.setPostConditionsElement(convertMarkdown(src.getPostConditionsElement())); + for (org.hl7.fhir.r5.model.ExampleScenario.ExampleScenarioProcessStepComponent t : src.getStep()) + tgt.addStep(convertExampleScenarioProcessStepComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.ExampleScenario.ExampleScenarioProcessStepComponent convertExampleScenarioProcessStepComponent(org.hl7.fhir.r4.model.ExampleScenario.ExampleScenarioProcessStepComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ExampleScenario.ExampleScenarioProcessStepComponent tgt = new org.hl7.fhir.r5.model.ExampleScenario.ExampleScenarioProcessStepComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.r4.model.ExampleScenario.ExampleScenarioProcessComponent t : src.getProcess()) + tgt.addProcess(convertExampleScenarioProcessComponent(t)); + if (src.hasPause()) + tgt.setPauseElement(convertBoolean(src.getPauseElement())); + if (src.hasOperation()) + tgt.setOperation(convertExampleScenarioProcessStepOperationComponent(src.getOperation())); + for (org.hl7.fhir.r4.model.ExampleScenario.ExampleScenarioProcessStepAlternativeComponent t : src.getAlternative()) + tgt.addAlternative(convertExampleScenarioProcessStepAlternativeComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.ExampleScenario.ExampleScenarioProcessStepComponent convertExampleScenarioProcessStepComponent(org.hl7.fhir.r5.model.ExampleScenario.ExampleScenarioProcessStepComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.ExampleScenario.ExampleScenarioProcessStepComponent tgt = new org.hl7.fhir.r4.model.ExampleScenario.ExampleScenarioProcessStepComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.r5.model.ExampleScenario.ExampleScenarioProcessComponent t : src.getProcess()) + tgt.addProcess(convertExampleScenarioProcessComponent(t)); + if (src.hasPause()) + tgt.setPauseElement(convertBoolean(src.getPauseElement())); + if (src.hasOperation()) + tgt.setOperation(convertExampleScenarioProcessStepOperationComponent(src.getOperation())); + for (org.hl7.fhir.r5.model.ExampleScenario.ExampleScenarioProcessStepAlternativeComponent t : src.getAlternative()) + tgt.addAlternative(convertExampleScenarioProcessStepAlternativeComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.ExampleScenario.ExampleScenarioProcessStepOperationComponent convertExampleScenarioProcessStepOperationComponent(org.hl7.fhir.r4.model.ExampleScenario.ExampleScenarioProcessStepOperationComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ExampleScenario.ExampleScenarioProcessStepOperationComponent tgt = new org.hl7.fhir.r5.model.ExampleScenario.ExampleScenarioProcessStepOperationComponent(); + copyElement(src, tgt); + if (src.hasNumber()) + tgt.setNumberElement(convertString(src.getNumberElement())); + if (src.hasType()) + tgt.setTypeElement(convertString(src.getTypeElement())); + if (src.hasName()) + tgt.setNameElement(convertString(src.getNameElement())); + if (src.hasInitiator()) + tgt.setInitiatorElement(convertString(src.getInitiatorElement())); + if (src.hasReceiver()) + tgt.setReceiverElement(convertString(src.getReceiverElement())); + if (src.hasDescription()) + tgt.setDescriptionElement(convertMarkdown(src.getDescriptionElement())); + if (src.hasInitiatorActive()) + tgt.setInitiatorActiveElement(convertBoolean(src.getInitiatorActiveElement())); + if (src.hasReceiverActive()) + tgt.setReceiverActiveElement(convertBoolean(src.getReceiverActiveElement())); + if (src.hasRequest()) + tgt.setRequest(convertExampleScenarioInstanceContainedInstanceComponent(src.getRequest())); + if (src.hasResponse()) + tgt.setResponse(convertExampleScenarioInstanceContainedInstanceComponent(src.getResponse())); + return tgt; + } + + public static org.hl7.fhir.r4.model.ExampleScenario.ExampleScenarioProcessStepOperationComponent convertExampleScenarioProcessStepOperationComponent(org.hl7.fhir.r5.model.ExampleScenario.ExampleScenarioProcessStepOperationComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.ExampleScenario.ExampleScenarioProcessStepOperationComponent tgt = new org.hl7.fhir.r4.model.ExampleScenario.ExampleScenarioProcessStepOperationComponent(); + copyElement(src, tgt); + if (src.hasNumber()) + tgt.setNumberElement(convertString(src.getNumberElement())); + if (src.hasType()) + tgt.setTypeElement(convertString(src.getTypeElement())); + if (src.hasName()) + tgt.setNameElement(convertString(src.getNameElement())); + if (src.hasInitiator()) + tgt.setInitiatorElement(convertString(src.getInitiatorElement())); + if (src.hasReceiver()) + tgt.setReceiverElement(convertString(src.getReceiverElement())); + if (src.hasDescription()) + tgt.setDescriptionElement(convertMarkdown(src.getDescriptionElement())); + if (src.hasInitiatorActive()) + tgt.setInitiatorActiveElement(convertBoolean(src.getInitiatorActiveElement())); + if (src.hasReceiverActive()) + tgt.setReceiverActiveElement(convertBoolean(src.getReceiverActiveElement())); + if (src.hasRequest()) + tgt.setRequest(convertExampleScenarioInstanceContainedInstanceComponent(src.getRequest())); + if (src.hasResponse()) + tgt.setResponse(convertExampleScenarioInstanceContainedInstanceComponent(src.getResponse())); + return tgt; + } + + public static org.hl7.fhir.r5.model.ExampleScenario.ExampleScenarioProcessStepAlternativeComponent convertExampleScenarioProcessStepAlternativeComponent(org.hl7.fhir.r4.model.ExampleScenario.ExampleScenarioProcessStepAlternativeComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ExampleScenario.ExampleScenarioProcessStepAlternativeComponent tgt = new org.hl7.fhir.r5.model.ExampleScenario.ExampleScenarioProcessStepAlternativeComponent(); + copyElement(src, tgt); + if (src.hasTitle()) + tgt.setTitleElement(convertString(src.getTitleElement())); + if (src.hasDescription()) + tgt.setDescriptionElement(convertMarkdown(src.getDescriptionElement())); + for (org.hl7.fhir.r4.model.ExampleScenario.ExampleScenarioProcessStepComponent t : src.getStep()) + tgt.addStep(convertExampleScenarioProcessStepComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.ExampleScenario.ExampleScenarioProcessStepAlternativeComponent convertExampleScenarioProcessStepAlternativeComponent(org.hl7.fhir.r5.model.ExampleScenario.ExampleScenarioProcessStepAlternativeComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.ExampleScenario.ExampleScenarioProcessStepAlternativeComponent tgt = new org.hl7.fhir.r4.model.ExampleScenario.ExampleScenarioProcessStepAlternativeComponent(); + copyElement(src, tgt); + if (src.hasTitle()) + tgt.setTitleElement(convertString(src.getTitleElement())); + if (src.hasDescription()) + tgt.setDescriptionElement(convertMarkdown(src.getDescriptionElement())); + for (org.hl7.fhir.r5.model.ExampleScenario.ExampleScenarioProcessStepComponent t : src.getStep()) + tgt.addStep(convertExampleScenarioProcessStepComponent(t)); + return tgt; + } + + +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/ExplanationOfBenefit.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/ExplanationOfBenefit.java new file mode 100644 index 000000000..2b633b6f1 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/ExplanationOfBenefit.java @@ -0,0 +1,1197 @@ +package org.hl7.fhir.convertors.conv40_50; + +import org.hl7.fhir.exceptions.FHIRException; + +import org.hl7.fhir.convertors.VersionConvertor_40_50; + + +/* + Copyright (c) 2011+, HL7, Inc. + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of HL7 nor the names of its contributors may be used to + endorse or promote products derived from this software without specific + prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + +*/ + +// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0 + + +public class ExplanationOfBenefit extends VersionConvertor_40_50 { + + public static org.hl7.fhir.r5.model.ExplanationOfBenefit convertExplanationOfBenefit(org.hl7.fhir.r4.model.ExplanationOfBenefit src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ExplanationOfBenefit tgt = new org.hl7.fhir.r5.model.ExplanationOfBenefit(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasStatus()) + tgt.setStatus(convertExplanationOfBenefitStatus(src.getStatus())); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + if (src.hasSubType()) + tgt.setSubType(convertCodeableConcept(src.getSubType())); + if (src.hasUse()) + tgt.setUse(convertUse(src.getUse())); + if (src.hasPatient()) + tgt.setPatient(convertReference(src.getPatient())); + if (src.hasBillablePeriod()) + tgt.setBillablePeriod(convertPeriod(src.getBillablePeriod())); + if (src.hasCreated()) + tgt.setCreatedElement(convertDateTime(src.getCreatedElement())); + if (src.hasEnterer()) + tgt.setEnterer(convertReference(src.getEnterer())); + if (src.hasInsurer()) + tgt.setInsurer(convertReference(src.getInsurer())); + if (src.hasProvider()) + tgt.setProvider(convertReference(src.getProvider())); + if (src.hasPriority()) + tgt.setPriority(convertCodeableConcept(src.getPriority())); + if (src.hasFundsReserveRequested()) + tgt.setFundsReserveRequested(convertCodeableConcept(src.getFundsReserveRequested())); + if (src.hasFundsReserve()) + tgt.setFundsReserve(convertCodeableConcept(src.getFundsReserve())); + for (org.hl7.fhir.r4.model.ExplanationOfBenefit.RelatedClaimComponent t : src.getRelated()) + tgt.addRelated(convertRelatedClaimComponent(t)); + if (src.hasPrescription()) + tgt.setPrescription(convertReference(src.getPrescription())); + if (src.hasOriginalPrescription()) + tgt.setOriginalPrescription(convertReference(src.getOriginalPrescription())); + if (src.hasPayee()) + tgt.setPayee(convertPayeeComponent(src.getPayee())); + if (src.hasReferral()) + tgt.setReferral(convertReference(src.getReferral())); + if (src.hasFacility()) + tgt.setFacility(convertReference(src.getFacility())); + if (src.hasClaim()) + tgt.setClaim(convertReference(src.getClaim())); + if (src.hasClaimResponse()) + tgt.setClaimResponse(convertReference(src.getClaimResponse())); + if (src.hasOutcome()) + tgt.setOutcome(convertRemittanceOutcome(src.getOutcome())); + if (src.hasDisposition()) + tgt.setDispositionElement(convertString(src.getDispositionElement())); + for (org.hl7.fhir.r4.model.StringType t : src.getPreAuthRef()) + tgt.getPreAuthRef().add(convertString(t)); + for (org.hl7.fhir.r4.model.Period t : src.getPreAuthRefPeriod()) + tgt.addPreAuthRefPeriod(convertPeriod(t)); + for (org.hl7.fhir.r4.model.ExplanationOfBenefit.CareTeamComponent t : src.getCareTeam()) + tgt.addCareTeam(convertCareTeamComponent(t)); + for (org.hl7.fhir.r4.model.ExplanationOfBenefit.SupportingInformationComponent t : src.getSupportingInfo()) + tgt.addSupportingInfo(convertSupportingInformationComponent(t)); + for (org.hl7.fhir.r4.model.ExplanationOfBenefit.DiagnosisComponent t : src.getDiagnosis()) + tgt.addDiagnosis(convertDiagnosisComponent(t)); + for (org.hl7.fhir.r4.model.ExplanationOfBenefit.ProcedureComponent t : src.getProcedure()) + tgt.addProcedure(convertProcedureComponent(t)); + if (src.hasPrecedence()) + tgt.setPrecedenceElement(convertPositiveInt(src.getPrecedenceElement())); + for (org.hl7.fhir.r4.model.ExplanationOfBenefit.InsuranceComponent t : src.getInsurance()) + tgt.addInsurance(convertInsuranceComponent(t)); + if (src.hasAccident()) + tgt.setAccident(convertAccidentComponent(src.getAccident())); + for (org.hl7.fhir.r4.model.ExplanationOfBenefit.ItemComponent t : src.getItem()) + tgt.addItem(convertItemComponent(t)); + for (org.hl7.fhir.r4.model.ExplanationOfBenefit.AddedItemComponent t : src.getAddItem()) + tgt.addAddItem(convertAddedItemComponent(t)); + for (org.hl7.fhir.r4.model.ExplanationOfBenefit.AdjudicationComponent t : src.getAdjudication()) + tgt.addAdjudication(convertAdjudicationComponent(t)); + for (org.hl7.fhir.r4.model.ExplanationOfBenefit.TotalComponent t : src.getTotal()) + tgt.addTotal(convertTotalComponent(t)); + if (src.hasPayment()) + tgt.setPayment(convertPaymentComponent(src.getPayment())); + if (src.hasFormCode()) + tgt.setFormCode(convertCodeableConcept(src.getFormCode())); + if (src.hasForm()) + tgt.setForm(convertAttachment(src.getForm())); + for (org.hl7.fhir.r4.model.ExplanationOfBenefit.NoteComponent t : src.getProcessNote()) + tgt.addProcessNote(convertNoteComponent(t)); + if (src.hasBenefitPeriod()) + tgt.setBenefitPeriod(convertPeriod(src.getBenefitPeriod())); + for (org.hl7.fhir.r4.model.ExplanationOfBenefit.BenefitBalanceComponent t : src.getBenefitBalance()) + tgt.addBenefitBalance(convertBenefitBalanceComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.ExplanationOfBenefit convertExplanationOfBenefit(org.hl7.fhir.r5.model.ExplanationOfBenefit src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.ExplanationOfBenefit tgt = new org.hl7.fhir.r4.model.ExplanationOfBenefit(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasStatus()) + tgt.setStatus(convertExplanationOfBenefitStatus(src.getStatus())); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + if (src.hasSubType()) + tgt.setSubType(convertCodeableConcept(src.getSubType())); + if (src.hasUse()) + tgt.setUse(convertUse(src.getUse())); + if (src.hasPatient()) + tgt.setPatient(convertReference(src.getPatient())); + if (src.hasBillablePeriod()) + tgt.setBillablePeriod(convertPeriod(src.getBillablePeriod())); + if (src.hasCreated()) + tgt.setCreatedElement(convertDateTime(src.getCreatedElement())); + if (src.hasEnterer()) + tgt.setEnterer(convertReference(src.getEnterer())); + if (src.hasInsurer()) + tgt.setInsurer(convertReference(src.getInsurer())); + if (src.hasProvider()) + tgt.setProvider(convertReference(src.getProvider())); + if (src.hasPriority()) + tgt.setPriority(convertCodeableConcept(src.getPriority())); + if (src.hasFundsReserveRequested()) + tgt.setFundsReserveRequested(convertCodeableConcept(src.getFundsReserveRequested())); + if (src.hasFundsReserve()) + tgt.setFundsReserve(convertCodeableConcept(src.getFundsReserve())); + for (org.hl7.fhir.r5.model.ExplanationOfBenefit.RelatedClaimComponent t : src.getRelated()) + tgt.addRelated(convertRelatedClaimComponent(t)); + if (src.hasPrescription()) + tgt.setPrescription(convertReference(src.getPrescription())); + if (src.hasOriginalPrescription()) + tgt.setOriginalPrescription(convertReference(src.getOriginalPrescription())); + if (src.hasPayee()) + tgt.setPayee(convertPayeeComponent(src.getPayee())); + if (src.hasReferral()) + tgt.setReferral(convertReference(src.getReferral())); + if (src.hasFacility()) + tgt.setFacility(convertReference(src.getFacility())); + if (src.hasClaim()) + tgt.setClaim(convertReference(src.getClaim())); + if (src.hasClaimResponse()) + tgt.setClaimResponse(convertReference(src.getClaimResponse())); + if (src.hasOutcome()) + tgt.setOutcome(convertRemittanceOutcome(src.getOutcome())); + if (src.hasDisposition()) + tgt.setDispositionElement(convertString(src.getDispositionElement())); + for (org.hl7.fhir.r5.model.StringType t : src.getPreAuthRef()) + tgt.getPreAuthRef().add(convertString(t)); + for (org.hl7.fhir.r5.model.Period t : src.getPreAuthRefPeriod()) + tgt.addPreAuthRefPeriod(convertPeriod(t)); + for (org.hl7.fhir.r5.model.ExplanationOfBenefit.CareTeamComponent t : src.getCareTeam()) + tgt.addCareTeam(convertCareTeamComponent(t)); + for (org.hl7.fhir.r5.model.ExplanationOfBenefit.SupportingInformationComponent t : src.getSupportingInfo()) + tgt.addSupportingInfo(convertSupportingInformationComponent(t)); + for (org.hl7.fhir.r5.model.ExplanationOfBenefit.DiagnosisComponent t : src.getDiagnosis()) + tgt.addDiagnosis(convertDiagnosisComponent(t)); + for (org.hl7.fhir.r5.model.ExplanationOfBenefit.ProcedureComponent t : src.getProcedure()) + tgt.addProcedure(convertProcedureComponent(t)); + if (src.hasPrecedence()) + tgt.setPrecedenceElement(convertPositiveInt(src.getPrecedenceElement())); + for (org.hl7.fhir.r5.model.ExplanationOfBenefit.InsuranceComponent t : src.getInsurance()) + tgt.addInsurance(convertInsuranceComponent(t)); + if (src.hasAccident()) + tgt.setAccident(convertAccidentComponent(src.getAccident())); + for (org.hl7.fhir.r5.model.ExplanationOfBenefit.ItemComponent t : src.getItem()) + tgt.addItem(convertItemComponent(t)); + for (org.hl7.fhir.r5.model.ExplanationOfBenefit.AddedItemComponent t : src.getAddItem()) + tgt.addAddItem(convertAddedItemComponent(t)); + for (org.hl7.fhir.r5.model.ExplanationOfBenefit.AdjudicationComponent t : src.getAdjudication()) + tgt.addAdjudication(convertAdjudicationComponent(t)); + for (org.hl7.fhir.r5.model.ExplanationOfBenefit.TotalComponent t : src.getTotal()) + tgt.addTotal(convertTotalComponent(t)); + if (src.hasPayment()) + tgt.setPayment(convertPaymentComponent(src.getPayment())); + if (src.hasFormCode()) + tgt.setFormCode(convertCodeableConcept(src.getFormCode())); + if (src.hasForm()) + tgt.setForm(convertAttachment(src.getForm())); + for (org.hl7.fhir.r5.model.ExplanationOfBenefit.NoteComponent t : src.getProcessNote()) + tgt.addProcessNote(convertNoteComponent(t)); + if (src.hasBenefitPeriod()) + tgt.setBenefitPeriod(convertPeriod(src.getBenefitPeriod())); + for (org.hl7.fhir.r5.model.ExplanationOfBenefit.BenefitBalanceComponent t : src.getBenefitBalance()) + tgt.addBenefitBalance(convertBenefitBalanceComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.ExplanationOfBenefit.ExplanationOfBenefitStatus convertExplanationOfBenefitStatus(org.hl7.fhir.r4.model.ExplanationOfBenefit.ExplanationOfBenefitStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case ACTIVE: return org.hl7.fhir.r5.model.ExplanationOfBenefit.ExplanationOfBenefitStatus.ACTIVE; + case CANCELLED: return org.hl7.fhir.r5.model.ExplanationOfBenefit.ExplanationOfBenefitStatus.CANCELLED; + case DRAFT: return org.hl7.fhir.r5.model.ExplanationOfBenefit.ExplanationOfBenefitStatus.DRAFT; + case ENTEREDINERROR: return org.hl7.fhir.r5.model.ExplanationOfBenefit.ExplanationOfBenefitStatus.ENTEREDINERROR; + default: return org.hl7.fhir.r5.model.ExplanationOfBenefit.ExplanationOfBenefitStatus.NULL; + } +} + + public static org.hl7.fhir.r4.model.ExplanationOfBenefit.ExplanationOfBenefitStatus convertExplanationOfBenefitStatus(org.hl7.fhir.r5.model.ExplanationOfBenefit.ExplanationOfBenefitStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case ACTIVE: return org.hl7.fhir.r4.model.ExplanationOfBenefit.ExplanationOfBenefitStatus.ACTIVE; + case CANCELLED: return org.hl7.fhir.r4.model.ExplanationOfBenefit.ExplanationOfBenefitStatus.CANCELLED; + case DRAFT: return org.hl7.fhir.r4.model.ExplanationOfBenefit.ExplanationOfBenefitStatus.DRAFT; + case ENTEREDINERROR: return org.hl7.fhir.r4.model.ExplanationOfBenefit.ExplanationOfBenefitStatus.ENTEREDINERROR; + default: return org.hl7.fhir.r4.model.ExplanationOfBenefit.ExplanationOfBenefitStatus.NULL; + } +} + + public static org.hl7.fhir.r5.model.ExplanationOfBenefit.Use convertUse(org.hl7.fhir.r4.model.ExplanationOfBenefit.Use src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case CLAIM: return org.hl7.fhir.r5.model.ExplanationOfBenefit.Use.CLAIM; + case PREAUTHORIZATION: return org.hl7.fhir.r5.model.ExplanationOfBenefit.Use.PREAUTHORIZATION; + case PREDETERMINATION: return org.hl7.fhir.r5.model.ExplanationOfBenefit.Use.PREDETERMINATION; + default: return org.hl7.fhir.r5.model.ExplanationOfBenefit.Use.NULL; + } +} + + public static org.hl7.fhir.r4.model.ExplanationOfBenefit.Use convertUse(org.hl7.fhir.r5.model.ExplanationOfBenefit.Use src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case CLAIM: return org.hl7.fhir.r4.model.ExplanationOfBenefit.Use.CLAIM; + case PREAUTHORIZATION: return org.hl7.fhir.r4.model.ExplanationOfBenefit.Use.PREAUTHORIZATION; + case PREDETERMINATION: return org.hl7.fhir.r4.model.ExplanationOfBenefit.Use.PREDETERMINATION; + default: return org.hl7.fhir.r4.model.ExplanationOfBenefit.Use.NULL; + } +} + + public static org.hl7.fhir.r5.model.ExplanationOfBenefit.RemittanceOutcome convertRemittanceOutcome(org.hl7.fhir.r4.model.ExplanationOfBenefit.RemittanceOutcome src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case QUEUED: return org.hl7.fhir.r5.model.ExplanationOfBenefit.RemittanceOutcome.QUEUED; + case COMPLETE: return org.hl7.fhir.r5.model.ExplanationOfBenefit.RemittanceOutcome.COMPLETE; + case ERROR: return org.hl7.fhir.r5.model.ExplanationOfBenefit.RemittanceOutcome.ERROR; + case PARTIAL: return org.hl7.fhir.r5.model.ExplanationOfBenefit.RemittanceOutcome.PARTIAL; + default: return org.hl7.fhir.r5.model.ExplanationOfBenefit.RemittanceOutcome.NULL; + } +} + + public static org.hl7.fhir.r4.model.ExplanationOfBenefit.RemittanceOutcome convertRemittanceOutcome(org.hl7.fhir.r5.model.ExplanationOfBenefit.RemittanceOutcome src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case QUEUED: return org.hl7.fhir.r4.model.ExplanationOfBenefit.RemittanceOutcome.QUEUED; + case COMPLETE: return org.hl7.fhir.r4.model.ExplanationOfBenefit.RemittanceOutcome.COMPLETE; + case ERROR: return org.hl7.fhir.r4.model.ExplanationOfBenefit.RemittanceOutcome.ERROR; + case PARTIAL: return org.hl7.fhir.r4.model.ExplanationOfBenefit.RemittanceOutcome.PARTIAL; + default: return org.hl7.fhir.r4.model.ExplanationOfBenefit.RemittanceOutcome.NULL; + } +} + + public static org.hl7.fhir.r5.model.ExplanationOfBenefit.RelatedClaimComponent convertRelatedClaimComponent(org.hl7.fhir.r4.model.ExplanationOfBenefit.RelatedClaimComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ExplanationOfBenefit.RelatedClaimComponent tgt = new org.hl7.fhir.r5.model.ExplanationOfBenefit.RelatedClaimComponent(); + copyElement(src, tgt); + if (src.hasClaim()) + tgt.setClaim(convertReference(src.getClaim())); + if (src.hasRelationship()) + tgt.setRelationship(convertCodeableConcept(src.getRelationship())); + if (src.hasReference()) + tgt.setReference(convertIdentifier(src.getReference())); + return tgt; + } + + public static org.hl7.fhir.r4.model.ExplanationOfBenefit.RelatedClaimComponent convertRelatedClaimComponent(org.hl7.fhir.r5.model.ExplanationOfBenefit.RelatedClaimComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.ExplanationOfBenefit.RelatedClaimComponent tgt = new org.hl7.fhir.r4.model.ExplanationOfBenefit.RelatedClaimComponent(); + copyElement(src, tgt); + if (src.hasClaim()) + tgt.setClaim(convertReference(src.getClaim())); + if (src.hasRelationship()) + tgt.setRelationship(convertCodeableConcept(src.getRelationship())); + if (src.hasReference()) + tgt.setReference(convertIdentifier(src.getReference())); + return tgt; + } + + public static org.hl7.fhir.r5.model.ExplanationOfBenefit.PayeeComponent convertPayeeComponent(org.hl7.fhir.r4.model.ExplanationOfBenefit.PayeeComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ExplanationOfBenefit.PayeeComponent tgt = new org.hl7.fhir.r5.model.ExplanationOfBenefit.PayeeComponent(); + copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + if (src.hasParty()) + tgt.setParty(convertReference(src.getParty())); + return tgt; + } + + public static org.hl7.fhir.r4.model.ExplanationOfBenefit.PayeeComponent convertPayeeComponent(org.hl7.fhir.r5.model.ExplanationOfBenefit.PayeeComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.ExplanationOfBenefit.PayeeComponent tgt = new org.hl7.fhir.r4.model.ExplanationOfBenefit.PayeeComponent(); + copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + if (src.hasParty()) + tgt.setParty(convertReference(src.getParty())); + return tgt; + } + + public static org.hl7.fhir.r5.model.ExplanationOfBenefit.CareTeamComponent convertCareTeamComponent(org.hl7.fhir.r4.model.ExplanationOfBenefit.CareTeamComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ExplanationOfBenefit.CareTeamComponent tgt = new org.hl7.fhir.r5.model.ExplanationOfBenefit.CareTeamComponent(); + copyElement(src, tgt); + if (src.hasSequence()) + tgt.setSequenceElement(convertPositiveInt(src.getSequenceElement())); + if (src.hasProvider()) + tgt.setProvider(convertReference(src.getProvider())); + if (src.hasResponsible()) + tgt.setResponsibleElement(convertBoolean(src.getResponsibleElement())); + if (src.hasRole()) + tgt.setRole(convertCodeableConcept(src.getRole())); + if (src.hasQualification()) + tgt.setQualification(convertCodeableConcept(src.getQualification())); + return tgt; + } + + public static org.hl7.fhir.r4.model.ExplanationOfBenefit.CareTeamComponent convertCareTeamComponent(org.hl7.fhir.r5.model.ExplanationOfBenefit.CareTeamComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.ExplanationOfBenefit.CareTeamComponent tgt = new org.hl7.fhir.r4.model.ExplanationOfBenefit.CareTeamComponent(); + copyElement(src, tgt); + if (src.hasSequence()) + tgt.setSequenceElement(convertPositiveInt(src.getSequenceElement())); + if (src.hasProvider()) + tgt.setProvider(convertReference(src.getProvider())); + if (src.hasResponsible()) + tgt.setResponsibleElement(convertBoolean(src.getResponsibleElement())); + if (src.hasRole()) + tgt.setRole(convertCodeableConcept(src.getRole())); + if (src.hasQualification()) + tgt.setQualification(convertCodeableConcept(src.getQualification())); + return tgt; + } + + public static org.hl7.fhir.r5.model.ExplanationOfBenefit.SupportingInformationComponent convertSupportingInformationComponent(org.hl7.fhir.r4.model.ExplanationOfBenefit.SupportingInformationComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ExplanationOfBenefit.SupportingInformationComponent tgt = new org.hl7.fhir.r5.model.ExplanationOfBenefit.SupportingInformationComponent(); + copyElement(src, tgt); + if (src.hasSequence()) + tgt.setSequenceElement(convertPositiveInt(src.getSequenceElement())); + if (src.hasCategory()) + tgt.setCategory(convertCodeableConcept(src.getCategory())); + if (src.hasCode()) + tgt.setCode(convertCodeableConcept(src.getCode())); + if (src.hasTiming()) + tgt.setTiming(convertType(src.getTiming())); + if (src.hasValue()) + tgt.setValue(convertType(src.getValue())); + if (src.hasReason()) + tgt.setReason(convertCoding(src.getReason())); + return tgt; + } + + public static org.hl7.fhir.r4.model.ExplanationOfBenefit.SupportingInformationComponent convertSupportingInformationComponent(org.hl7.fhir.r5.model.ExplanationOfBenefit.SupportingInformationComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.ExplanationOfBenefit.SupportingInformationComponent tgt = new org.hl7.fhir.r4.model.ExplanationOfBenefit.SupportingInformationComponent(); + copyElement(src, tgt); + if (src.hasSequence()) + tgt.setSequenceElement(convertPositiveInt(src.getSequenceElement())); + if (src.hasCategory()) + tgt.setCategory(convertCodeableConcept(src.getCategory())); + if (src.hasCode()) + tgt.setCode(convertCodeableConcept(src.getCode())); + if (src.hasTiming()) + tgt.setTiming(convertType(src.getTiming())); + if (src.hasValue()) + tgt.setValue(convertType(src.getValue())); + if (src.hasReason()) + tgt.setReason(convertCoding(src.getReason())); + return tgt; + } + + public static org.hl7.fhir.r5.model.ExplanationOfBenefit.DiagnosisComponent convertDiagnosisComponent(org.hl7.fhir.r4.model.ExplanationOfBenefit.DiagnosisComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ExplanationOfBenefit.DiagnosisComponent tgt = new org.hl7.fhir.r5.model.ExplanationOfBenefit.DiagnosisComponent(); + copyElement(src, tgt); + if (src.hasSequence()) + tgt.setSequenceElement(convertPositiveInt(src.getSequenceElement())); + if (src.hasDiagnosis()) + tgt.setDiagnosis(convertType(src.getDiagnosis())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getType()) + tgt.addType(convertCodeableConcept(t)); + if (src.hasOnAdmission()) + tgt.setOnAdmission(convertCodeableConcept(src.getOnAdmission())); + if (src.hasPackageCode()) + tgt.setPackageCode(convertCodeableConcept(src.getPackageCode())); + return tgt; + } + + public static org.hl7.fhir.r4.model.ExplanationOfBenefit.DiagnosisComponent convertDiagnosisComponent(org.hl7.fhir.r5.model.ExplanationOfBenefit.DiagnosisComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.ExplanationOfBenefit.DiagnosisComponent tgt = new org.hl7.fhir.r4.model.ExplanationOfBenefit.DiagnosisComponent(); + copyElement(src, tgt); + if (src.hasSequence()) + tgt.setSequenceElement(convertPositiveInt(src.getSequenceElement())); + if (src.hasDiagnosis()) + tgt.setDiagnosis(convertType(src.getDiagnosis())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getType()) + tgt.addType(convertCodeableConcept(t)); + if (src.hasOnAdmission()) + tgt.setOnAdmission(convertCodeableConcept(src.getOnAdmission())); + if (src.hasPackageCode()) + tgt.setPackageCode(convertCodeableConcept(src.getPackageCode())); + return tgt; + } + + public static org.hl7.fhir.r5.model.ExplanationOfBenefit.ProcedureComponent convertProcedureComponent(org.hl7.fhir.r4.model.ExplanationOfBenefit.ProcedureComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ExplanationOfBenefit.ProcedureComponent tgt = new org.hl7.fhir.r5.model.ExplanationOfBenefit.ProcedureComponent(); + copyElement(src, tgt); + if (src.hasSequence()) + tgt.setSequenceElement(convertPositiveInt(src.getSequenceElement())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getType()) + tgt.addType(convertCodeableConcept(t)); + if (src.hasDate()) + tgt.setDateElement(convertDateTime(src.getDateElement())); + if (src.hasProcedure()) + tgt.setProcedure(convertType(src.getProcedure())); + for (org.hl7.fhir.r4.model.Reference t : src.getUdi()) + tgt.addUdi(convertReference(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.ExplanationOfBenefit.ProcedureComponent convertProcedureComponent(org.hl7.fhir.r5.model.ExplanationOfBenefit.ProcedureComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.ExplanationOfBenefit.ProcedureComponent tgt = new org.hl7.fhir.r4.model.ExplanationOfBenefit.ProcedureComponent(); + copyElement(src, tgt); + if (src.hasSequence()) + tgt.setSequenceElement(convertPositiveInt(src.getSequenceElement())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getType()) + tgt.addType(convertCodeableConcept(t)); + if (src.hasDate()) + tgt.setDateElement(convertDateTime(src.getDateElement())); + if (src.hasProcedure()) + tgt.setProcedure(convertType(src.getProcedure())); + for (org.hl7.fhir.r5.model.Reference t : src.getUdi()) + tgt.addUdi(convertReference(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.ExplanationOfBenefit.InsuranceComponent convertInsuranceComponent(org.hl7.fhir.r4.model.ExplanationOfBenefit.InsuranceComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ExplanationOfBenefit.InsuranceComponent tgt = new org.hl7.fhir.r5.model.ExplanationOfBenefit.InsuranceComponent(); + copyElement(src, tgt); + if (src.hasFocal()) + tgt.setFocalElement(convertBoolean(src.getFocalElement())); + if (src.hasCoverage()) + tgt.setCoverage(convertReference(src.getCoverage())); + for (org.hl7.fhir.r4.model.StringType t : src.getPreAuthRef()) + tgt.getPreAuthRef().add(convertString(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.ExplanationOfBenefit.InsuranceComponent convertInsuranceComponent(org.hl7.fhir.r5.model.ExplanationOfBenefit.InsuranceComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.ExplanationOfBenefit.InsuranceComponent tgt = new org.hl7.fhir.r4.model.ExplanationOfBenefit.InsuranceComponent(); + copyElement(src, tgt); + if (src.hasFocal()) + tgt.setFocalElement(convertBoolean(src.getFocalElement())); + if (src.hasCoverage()) + tgt.setCoverage(convertReference(src.getCoverage())); + for (org.hl7.fhir.r5.model.StringType t : src.getPreAuthRef()) + tgt.getPreAuthRef().add(convertString(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.ExplanationOfBenefit.AccidentComponent convertAccidentComponent(org.hl7.fhir.r4.model.ExplanationOfBenefit.AccidentComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ExplanationOfBenefit.AccidentComponent tgt = new org.hl7.fhir.r5.model.ExplanationOfBenefit.AccidentComponent(); + copyElement(src, tgt); + if (src.hasDate()) + tgt.setDateElement(convertDate(src.getDateElement())); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + if (src.hasLocation()) + tgt.setLocation(convertType(src.getLocation())); + return tgt; + } + + public static org.hl7.fhir.r4.model.ExplanationOfBenefit.AccidentComponent convertAccidentComponent(org.hl7.fhir.r5.model.ExplanationOfBenefit.AccidentComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.ExplanationOfBenefit.AccidentComponent tgt = new org.hl7.fhir.r4.model.ExplanationOfBenefit.AccidentComponent(); + copyElement(src, tgt); + if (src.hasDate()) + tgt.setDateElement(convertDate(src.getDateElement())); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + if (src.hasLocation()) + tgt.setLocation(convertType(src.getLocation())); + return tgt; + } + + public static org.hl7.fhir.r5.model.ExplanationOfBenefit.ItemComponent convertItemComponent(org.hl7.fhir.r4.model.ExplanationOfBenefit.ItemComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ExplanationOfBenefit.ItemComponent tgt = new org.hl7.fhir.r5.model.ExplanationOfBenefit.ItemComponent(); + copyElement(src, tgt); + if (src.hasSequence()) + tgt.setSequenceElement(convertPositiveInt(src.getSequenceElement())); + for (org.hl7.fhir.r4.model.PositiveIntType t : src.getCareTeamSequence()) + tgt.getCareTeamSequence().add(convertPositiveInt(t)); + for (org.hl7.fhir.r4.model.PositiveIntType t : src.getDiagnosisSequence()) + tgt.getDiagnosisSequence().add(convertPositiveInt(t)); + for (org.hl7.fhir.r4.model.PositiveIntType t : src.getProcedureSequence()) + tgt.getProcedureSequence().add(convertPositiveInt(t)); + for (org.hl7.fhir.r4.model.PositiveIntType t : src.getInformationSequence()) + tgt.getInformationSequence().add(convertPositiveInt(t)); + if (src.hasRevenue()) + tgt.setRevenue(convertCodeableConcept(src.getRevenue())); + if (src.hasCategory()) + tgt.setCategory(convertCodeableConcept(src.getCategory())); + if (src.hasProductOrService()) + tgt.setProductOrService(convertCodeableConcept(src.getProductOrService())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getModifier()) + tgt.addModifier(convertCodeableConcept(t)); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getProgramCode()) + tgt.addProgramCode(convertCodeableConcept(t)); + if (src.hasServiced()) + tgt.setServiced(convertType(src.getServiced())); + if (src.hasLocation()) + tgt.setLocation(convertType(src.getLocation())); + if (src.hasQuantity()) + tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); + if (src.hasUnitPrice()) + tgt.setUnitPrice(convertMoney(src.getUnitPrice())); + if (src.hasFactor()) + tgt.setFactorElement(convertDecimal(src.getFactorElement())); + if (src.hasNet()) + tgt.setNet(convertMoney(src.getNet())); + for (org.hl7.fhir.r4.model.Reference t : src.getUdi()) + tgt.addUdi(convertReference(t)); + if (src.hasBodySite()) + tgt.setBodySite(convertCodeableConcept(src.getBodySite())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getSubSite()) + tgt.addSubSite(convertCodeableConcept(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getEncounter()) + tgt.addEncounter(convertReference(t)); + for (org.hl7.fhir.r4.model.PositiveIntType t : src.getNoteNumber()) + tgt.getNoteNumber().add(convertPositiveInt(t)); + for (org.hl7.fhir.r4.model.ExplanationOfBenefit.AdjudicationComponent t : src.getAdjudication()) + tgt.addAdjudication(convertAdjudicationComponent(t)); + for (org.hl7.fhir.r4.model.ExplanationOfBenefit.DetailComponent t : src.getDetail()) + tgt.addDetail(convertDetailComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.ExplanationOfBenefit.ItemComponent convertItemComponent(org.hl7.fhir.r5.model.ExplanationOfBenefit.ItemComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.ExplanationOfBenefit.ItemComponent tgt = new org.hl7.fhir.r4.model.ExplanationOfBenefit.ItemComponent(); + copyElement(src, tgt); + if (src.hasSequence()) + tgt.setSequenceElement(convertPositiveInt(src.getSequenceElement())); + for (org.hl7.fhir.r5.model.PositiveIntType t : src.getCareTeamSequence()) + tgt.getCareTeamSequence().add(convertPositiveInt(t)); + for (org.hl7.fhir.r5.model.PositiveIntType t : src.getDiagnosisSequence()) + tgt.getDiagnosisSequence().add(convertPositiveInt(t)); + for (org.hl7.fhir.r5.model.PositiveIntType t : src.getProcedureSequence()) + tgt.getProcedureSequence().add(convertPositiveInt(t)); + for (org.hl7.fhir.r5.model.PositiveIntType t : src.getInformationSequence()) + tgt.getInformationSequence().add(convertPositiveInt(t)); + if (src.hasRevenue()) + tgt.setRevenue(convertCodeableConcept(src.getRevenue())); + if (src.hasCategory()) + tgt.setCategory(convertCodeableConcept(src.getCategory())); + if (src.hasProductOrService()) + tgt.setProductOrService(convertCodeableConcept(src.getProductOrService())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getModifier()) + tgt.addModifier(convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getProgramCode()) + tgt.addProgramCode(convertCodeableConcept(t)); + if (src.hasServiced()) + tgt.setServiced(convertType(src.getServiced())); + if (src.hasLocation()) + tgt.setLocation(convertType(src.getLocation())); + if (src.hasQuantity()) + tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); + if (src.hasUnitPrice()) + tgt.setUnitPrice(convertMoney(src.getUnitPrice())); + if (src.hasFactor()) + tgt.setFactorElement(convertDecimal(src.getFactorElement())); + if (src.hasNet()) + tgt.setNet(convertMoney(src.getNet())); + for (org.hl7.fhir.r5.model.Reference t : src.getUdi()) + tgt.addUdi(convertReference(t)); + if (src.hasBodySite()) + tgt.setBodySite(convertCodeableConcept(src.getBodySite())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getSubSite()) + tgt.addSubSite(convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getEncounter()) + tgt.addEncounter(convertReference(t)); + for (org.hl7.fhir.r5.model.PositiveIntType t : src.getNoteNumber()) + tgt.getNoteNumber().add(convertPositiveInt(t)); + for (org.hl7.fhir.r5.model.ExplanationOfBenefit.AdjudicationComponent t : src.getAdjudication()) + tgt.addAdjudication(convertAdjudicationComponent(t)); + for (org.hl7.fhir.r5.model.ExplanationOfBenefit.DetailComponent t : src.getDetail()) + tgt.addDetail(convertDetailComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.ExplanationOfBenefit.AdjudicationComponent convertAdjudicationComponent(org.hl7.fhir.r4.model.ExplanationOfBenefit.AdjudicationComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ExplanationOfBenefit.AdjudicationComponent tgt = new org.hl7.fhir.r5.model.ExplanationOfBenefit.AdjudicationComponent(); + copyElement(src, tgt); + if (src.hasCategory()) + tgt.setCategory(convertCodeableConcept(src.getCategory())); + if (src.hasReason()) + tgt.setReason(convertCodeableConcept(src.getReason())); + if (src.hasAmount()) + tgt.setAmount(convertMoney(src.getAmount())); + if (src.hasValue()) + tgt.setValueElement(convertDecimal(src.getValueElement())); + return tgt; + } + + public static org.hl7.fhir.r4.model.ExplanationOfBenefit.AdjudicationComponent convertAdjudicationComponent(org.hl7.fhir.r5.model.ExplanationOfBenefit.AdjudicationComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.ExplanationOfBenefit.AdjudicationComponent tgt = new org.hl7.fhir.r4.model.ExplanationOfBenefit.AdjudicationComponent(); + copyElement(src, tgt); + if (src.hasCategory()) + tgt.setCategory(convertCodeableConcept(src.getCategory())); + if (src.hasReason()) + tgt.setReason(convertCodeableConcept(src.getReason())); + if (src.hasAmount()) + tgt.setAmount(convertMoney(src.getAmount())); + if (src.hasValue()) + tgt.setValueElement(convertDecimal(src.getValueElement())); + return tgt; + } + + public static org.hl7.fhir.r5.model.ExplanationOfBenefit.DetailComponent convertDetailComponent(org.hl7.fhir.r4.model.ExplanationOfBenefit.DetailComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ExplanationOfBenefit.DetailComponent tgt = new org.hl7.fhir.r5.model.ExplanationOfBenefit.DetailComponent(); + copyElement(src, tgt); + if (src.hasSequence()) + tgt.setSequenceElement(convertPositiveInt(src.getSequenceElement())); + if (src.hasRevenue()) + tgt.setRevenue(convertCodeableConcept(src.getRevenue())); + if (src.hasCategory()) + tgt.setCategory(convertCodeableConcept(src.getCategory())); + if (src.hasProductOrService()) + tgt.setProductOrService(convertCodeableConcept(src.getProductOrService())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getModifier()) + tgt.addModifier(convertCodeableConcept(t)); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getProgramCode()) + tgt.addProgramCode(convertCodeableConcept(t)); + if (src.hasQuantity()) + tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); + if (src.hasUnitPrice()) + tgt.setUnitPrice(convertMoney(src.getUnitPrice())); + if (src.hasFactor()) + tgt.setFactorElement(convertDecimal(src.getFactorElement())); + if (src.hasNet()) + tgt.setNet(convertMoney(src.getNet())); + for (org.hl7.fhir.r4.model.Reference t : src.getUdi()) + tgt.addUdi(convertReference(t)); + for (org.hl7.fhir.r4.model.PositiveIntType t : src.getNoteNumber()) + tgt.getNoteNumber().add(convertPositiveInt(t)); + for (org.hl7.fhir.r4.model.ExplanationOfBenefit.AdjudicationComponent t : src.getAdjudication()) + tgt.addAdjudication(convertAdjudicationComponent(t)); + for (org.hl7.fhir.r4.model.ExplanationOfBenefit.SubDetailComponent t : src.getSubDetail()) + tgt.addSubDetail(convertSubDetailComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.ExplanationOfBenefit.DetailComponent convertDetailComponent(org.hl7.fhir.r5.model.ExplanationOfBenefit.DetailComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.ExplanationOfBenefit.DetailComponent tgt = new org.hl7.fhir.r4.model.ExplanationOfBenefit.DetailComponent(); + copyElement(src, tgt); + if (src.hasSequence()) + tgt.setSequenceElement(convertPositiveInt(src.getSequenceElement())); + if (src.hasRevenue()) + tgt.setRevenue(convertCodeableConcept(src.getRevenue())); + if (src.hasCategory()) + tgt.setCategory(convertCodeableConcept(src.getCategory())); + if (src.hasProductOrService()) + tgt.setProductOrService(convertCodeableConcept(src.getProductOrService())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getModifier()) + tgt.addModifier(convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getProgramCode()) + tgt.addProgramCode(convertCodeableConcept(t)); + if (src.hasQuantity()) + tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); + if (src.hasUnitPrice()) + tgt.setUnitPrice(convertMoney(src.getUnitPrice())); + if (src.hasFactor()) + tgt.setFactorElement(convertDecimal(src.getFactorElement())); + if (src.hasNet()) + tgt.setNet(convertMoney(src.getNet())); + for (org.hl7.fhir.r5.model.Reference t : src.getUdi()) + tgt.addUdi(convertReference(t)); + for (org.hl7.fhir.r5.model.PositiveIntType t : src.getNoteNumber()) + tgt.getNoteNumber().add(convertPositiveInt(t)); + for (org.hl7.fhir.r5.model.ExplanationOfBenefit.AdjudicationComponent t : src.getAdjudication()) + tgt.addAdjudication(convertAdjudicationComponent(t)); + for (org.hl7.fhir.r5.model.ExplanationOfBenefit.SubDetailComponent t : src.getSubDetail()) + tgt.addSubDetail(convertSubDetailComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.ExplanationOfBenefit.SubDetailComponent convertSubDetailComponent(org.hl7.fhir.r4.model.ExplanationOfBenefit.SubDetailComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ExplanationOfBenefit.SubDetailComponent tgt = new org.hl7.fhir.r5.model.ExplanationOfBenefit.SubDetailComponent(); + copyElement(src, tgt); + if (src.hasSequence()) + tgt.setSequenceElement(convertPositiveInt(src.getSequenceElement())); + if (src.hasRevenue()) + tgt.setRevenue(convertCodeableConcept(src.getRevenue())); + if (src.hasCategory()) + tgt.setCategory(convertCodeableConcept(src.getCategory())); + if (src.hasProductOrService()) + tgt.setProductOrService(convertCodeableConcept(src.getProductOrService())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getModifier()) + tgt.addModifier(convertCodeableConcept(t)); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getProgramCode()) + tgt.addProgramCode(convertCodeableConcept(t)); + if (src.hasQuantity()) + tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); + if (src.hasUnitPrice()) + tgt.setUnitPrice(convertMoney(src.getUnitPrice())); + if (src.hasFactor()) + tgt.setFactorElement(convertDecimal(src.getFactorElement())); + if (src.hasNet()) + tgt.setNet(convertMoney(src.getNet())); + for (org.hl7.fhir.r4.model.Reference t : src.getUdi()) + tgt.addUdi(convertReference(t)); + for (org.hl7.fhir.r4.model.PositiveIntType t : src.getNoteNumber()) + tgt.getNoteNumber().add(convertPositiveInt(t)); + for (org.hl7.fhir.r4.model.ExplanationOfBenefit.AdjudicationComponent t : src.getAdjudication()) + tgt.addAdjudication(convertAdjudicationComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.ExplanationOfBenefit.SubDetailComponent convertSubDetailComponent(org.hl7.fhir.r5.model.ExplanationOfBenefit.SubDetailComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.ExplanationOfBenefit.SubDetailComponent tgt = new org.hl7.fhir.r4.model.ExplanationOfBenefit.SubDetailComponent(); + copyElement(src, tgt); + if (src.hasSequence()) + tgt.setSequenceElement(convertPositiveInt(src.getSequenceElement())); + if (src.hasRevenue()) + tgt.setRevenue(convertCodeableConcept(src.getRevenue())); + if (src.hasCategory()) + tgt.setCategory(convertCodeableConcept(src.getCategory())); + if (src.hasProductOrService()) + tgt.setProductOrService(convertCodeableConcept(src.getProductOrService())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getModifier()) + tgt.addModifier(convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getProgramCode()) + tgt.addProgramCode(convertCodeableConcept(t)); + if (src.hasQuantity()) + tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); + if (src.hasUnitPrice()) + tgt.setUnitPrice(convertMoney(src.getUnitPrice())); + if (src.hasFactor()) + tgt.setFactorElement(convertDecimal(src.getFactorElement())); + if (src.hasNet()) + tgt.setNet(convertMoney(src.getNet())); + for (org.hl7.fhir.r5.model.Reference t : src.getUdi()) + tgt.addUdi(convertReference(t)); + for (org.hl7.fhir.r5.model.PositiveIntType t : src.getNoteNumber()) + tgt.getNoteNumber().add(convertPositiveInt(t)); + for (org.hl7.fhir.r5.model.ExplanationOfBenefit.AdjudicationComponent t : src.getAdjudication()) + tgt.addAdjudication(convertAdjudicationComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.ExplanationOfBenefit.AddedItemComponent convertAddedItemComponent(org.hl7.fhir.r4.model.ExplanationOfBenefit.AddedItemComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ExplanationOfBenefit.AddedItemComponent tgt = new org.hl7.fhir.r5.model.ExplanationOfBenefit.AddedItemComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.r4.model.PositiveIntType t : src.getItemSequence()) + tgt.getItemSequence().add(convertPositiveInt(t)); + for (org.hl7.fhir.r4.model.PositiveIntType t : src.getDetailSequence()) + tgt.getDetailSequence().add(convertPositiveInt(t)); + for (org.hl7.fhir.r4.model.PositiveIntType t : src.getSubDetailSequence()) + tgt.getSubDetailSequence().add(convertPositiveInt(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getProvider()) + tgt.addProvider(convertReference(t)); + if (src.hasProductOrService()) + tgt.setProductOrService(convertCodeableConcept(src.getProductOrService())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getModifier()) + tgt.addModifier(convertCodeableConcept(t)); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getProgramCode()) + tgt.addProgramCode(convertCodeableConcept(t)); + if (src.hasServiced()) + tgt.setServiced(convertType(src.getServiced())); + if (src.hasLocation()) + tgt.setLocation(convertType(src.getLocation())); + if (src.hasQuantity()) + tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); + if (src.hasUnitPrice()) + tgt.setUnitPrice(convertMoney(src.getUnitPrice())); + if (src.hasFactor()) + tgt.setFactorElement(convertDecimal(src.getFactorElement())); + if (src.hasNet()) + tgt.setNet(convertMoney(src.getNet())); + if (src.hasBodySite()) + tgt.setBodySite(convertCodeableConcept(src.getBodySite())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getSubSite()) + tgt.addSubSite(convertCodeableConcept(t)); + for (org.hl7.fhir.r4.model.PositiveIntType t : src.getNoteNumber()) + tgt.getNoteNumber().add(convertPositiveInt(t)); + for (org.hl7.fhir.r4.model.ExplanationOfBenefit.AdjudicationComponent t : src.getAdjudication()) + tgt.addAdjudication(convertAdjudicationComponent(t)); + for (org.hl7.fhir.r4.model.ExplanationOfBenefit.AddedItemDetailComponent t : src.getDetail()) + tgt.addDetail(convertAddedItemDetailComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.ExplanationOfBenefit.AddedItemComponent convertAddedItemComponent(org.hl7.fhir.r5.model.ExplanationOfBenefit.AddedItemComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.ExplanationOfBenefit.AddedItemComponent tgt = new org.hl7.fhir.r4.model.ExplanationOfBenefit.AddedItemComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.r5.model.PositiveIntType t : src.getItemSequence()) + tgt.getItemSequence().add(convertPositiveInt(t)); + for (org.hl7.fhir.r5.model.PositiveIntType t : src.getDetailSequence()) + tgt.getDetailSequence().add(convertPositiveInt(t)); + for (org.hl7.fhir.r5.model.PositiveIntType t : src.getSubDetailSequence()) + tgt.getSubDetailSequence().add(convertPositiveInt(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getProvider()) + tgt.addProvider(convertReference(t)); + if (src.hasProductOrService()) + tgt.setProductOrService(convertCodeableConcept(src.getProductOrService())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getModifier()) + tgt.addModifier(convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getProgramCode()) + tgt.addProgramCode(convertCodeableConcept(t)); + if (src.hasServiced()) + tgt.setServiced(convertType(src.getServiced())); + if (src.hasLocation()) + tgt.setLocation(convertType(src.getLocation())); + if (src.hasQuantity()) + tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); + if (src.hasUnitPrice()) + tgt.setUnitPrice(convertMoney(src.getUnitPrice())); + if (src.hasFactor()) + tgt.setFactorElement(convertDecimal(src.getFactorElement())); + if (src.hasNet()) + tgt.setNet(convertMoney(src.getNet())); + if (src.hasBodySite()) + tgt.setBodySite(convertCodeableConcept(src.getBodySite())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getSubSite()) + tgt.addSubSite(convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.PositiveIntType t : src.getNoteNumber()) + tgt.getNoteNumber().add(convertPositiveInt(t)); + for (org.hl7.fhir.r5.model.ExplanationOfBenefit.AdjudicationComponent t : src.getAdjudication()) + tgt.addAdjudication(convertAdjudicationComponent(t)); + for (org.hl7.fhir.r5.model.ExplanationOfBenefit.AddedItemDetailComponent t : src.getDetail()) + tgt.addDetail(convertAddedItemDetailComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.ExplanationOfBenefit.AddedItemDetailComponent convertAddedItemDetailComponent(org.hl7.fhir.r4.model.ExplanationOfBenefit.AddedItemDetailComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ExplanationOfBenefit.AddedItemDetailComponent tgt = new org.hl7.fhir.r5.model.ExplanationOfBenefit.AddedItemDetailComponent(); + copyElement(src, tgt); + if (src.hasProductOrService()) + tgt.setProductOrService(convertCodeableConcept(src.getProductOrService())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getModifier()) + tgt.addModifier(convertCodeableConcept(t)); + if (src.hasQuantity()) + tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); + if (src.hasUnitPrice()) + tgt.setUnitPrice(convertMoney(src.getUnitPrice())); + if (src.hasFactor()) + tgt.setFactorElement(convertDecimal(src.getFactorElement())); + if (src.hasNet()) + tgt.setNet(convertMoney(src.getNet())); + for (org.hl7.fhir.r4.model.PositiveIntType t : src.getNoteNumber()) + tgt.getNoteNumber().add(convertPositiveInt(t)); + for (org.hl7.fhir.r4.model.ExplanationOfBenefit.AdjudicationComponent t : src.getAdjudication()) + tgt.addAdjudication(convertAdjudicationComponent(t)); + for (org.hl7.fhir.r4.model.ExplanationOfBenefit.AddedItemDetailSubDetailComponent t : src.getSubDetail()) + tgt.addSubDetail(convertAddedItemDetailSubDetailComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.ExplanationOfBenefit.AddedItemDetailComponent convertAddedItemDetailComponent(org.hl7.fhir.r5.model.ExplanationOfBenefit.AddedItemDetailComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.ExplanationOfBenefit.AddedItemDetailComponent tgt = new org.hl7.fhir.r4.model.ExplanationOfBenefit.AddedItemDetailComponent(); + copyElement(src, tgt); + if (src.hasProductOrService()) + tgt.setProductOrService(convertCodeableConcept(src.getProductOrService())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getModifier()) + tgt.addModifier(convertCodeableConcept(t)); + if (src.hasQuantity()) + tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); + if (src.hasUnitPrice()) + tgt.setUnitPrice(convertMoney(src.getUnitPrice())); + if (src.hasFactor()) + tgt.setFactorElement(convertDecimal(src.getFactorElement())); + if (src.hasNet()) + tgt.setNet(convertMoney(src.getNet())); + for (org.hl7.fhir.r5.model.PositiveIntType t : src.getNoteNumber()) + tgt.getNoteNumber().add(convertPositiveInt(t)); + for (org.hl7.fhir.r5.model.ExplanationOfBenefit.AdjudicationComponent t : src.getAdjudication()) + tgt.addAdjudication(convertAdjudicationComponent(t)); + for (org.hl7.fhir.r5.model.ExplanationOfBenefit.AddedItemDetailSubDetailComponent t : src.getSubDetail()) + tgt.addSubDetail(convertAddedItemDetailSubDetailComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.ExplanationOfBenefit.AddedItemDetailSubDetailComponent convertAddedItemDetailSubDetailComponent(org.hl7.fhir.r4.model.ExplanationOfBenefit.AddedItemDetailSubDetailComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ExplanationOfBenefit.AddedItemDetailSubDetailComponent tgt = new org.hl7.fhir.r5.model.ExplanationOfBenefit.AddedItemDetailSubDetailComponent(); + copyElement(src, tgt); + if (src.hasProductOrService()) + tgt.setProductOrService(convertCodeableConcept(src.getProductOrService())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getModifier()) + tgt.addModifier(convertCodeableConcept(t)); + if (src.hasQuantity()) + tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); + if (src.hasUnitPrice()) + tgt.setUnitPrice(convertMoney(src.getUnitPrice())); + if (src.hasFactor()) + tgt.setFactorElement(convertDecimal(src.getFactorElement())); + if (src.hasNet()) + tgt.setNet(convertMoney(src.getNet())); + for (org.hl7.fhir.r4.model.PositiveIntType t : src.getNoteNumber()) + tgt.getNoteNumber().add(convertPositiveInt(t)); + for (org.hl7.fhir.r4.model.ExplanationOfBenefit.AdjudicationComponent t : src.getAdjudication()) + tgt.addAdjudication(convertAdjudicationComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.ExplanationOfBenefit.AddedItemDetailSubDetailComponent convertAddedItemDetailSubDetailComponent(org.hl7.fhir.r5.model.ExplanationOfBenefit.AddedItemDetailSubDetailComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.ExplanationOfBenefit.AddedItemDetailSubDetailComponent tgt = new org.hl7.fhir.r4.model.ExplanationOfBenefit.AddedItemDetailSubDetailComponent(); + copyElement(src, tgt); + if (src.hasProductOrService()) + tgt.setProductOrService(convertCodeableConcept(src.getProductOrService())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getModifier()) + tgt.addModifier(convertCodeableConcept(t)); + if (src.hasQuantity()) + tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); + if (src.hasUnitPrice()) + tgt.setUnitPrice(convertMoney(src.getUnitPrice())); + if (src.hasFactor()) + tgt.setFactorElement(convertDecimal(src.getFactorElement())); + if (src.hasNet()) + tgt.setNet(convertMoney(src.getNet())); + for (org.hl7.fhir.r5.model.PositiveIntType t : src.getNoteNumber()) + tgt.getNoteNumber().add(convertPositiveInt(t)); + for (org.hl7.fhir.r5.model.ExplanationOfBenefit.AdjudicationComponent t : src.getAdjudication()) + tgt.addAdjudication(convertAdjudicationComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.ExplanationOfBenefit.TotalComponent convertTotalComponent(org.hl7.fhir.r4.model.ExplanationOfBenefit.TotalComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ExplanationOfBenefit.TotalComponent tgt = new org.hl7.fhir.r5.model.ExplanationOfBenefit.TotalComponent(); + copyElement(src, tgt); + if (src.hasCategory()) + tgt.setCategory(convertCodeableConcept(src.getCategory())); + if (src.hasAmount()) + tgt.setAmount(convertMoney(src.getAmount())); + return tgt; + } + + public static org.hl7.fhir.r4.model.ExplanationOfBenefit.TotalComponent convertTotalComponent(org.hl7.fhir.r5.model.ExplanationOfBenefit.TotalComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.ExplanationOfBenefit.TotalComponent tgt = new org.hl7.fhir.r4.model.ExplanationOfBenefit.TotalComponent(); + copyElement(src, tgt); + if (src.hasCategory()) + tgt.setCategory(convertCodeableConcept(src.getCategory())); + if (src.hasAmount()) + tgt.setAmount(convertMoney(src.getAmount())); + return tgt; + } + + public static org.hl7.fhir.r5.model.ExplanationOfBenefit.PaymentComponent convertPaymentComponent(org.hl7.fhir.r4.model.ExplanationOfBenefit.PaymentComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ExplanationOfBenefit.PaymentComponent tgt = new org.hl7.fhir.r5.model.ExplanationOfBenefit.PaymentComponent(); + copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + if (src.hasAdjustment()) + tgt.setAdjustment(convertMoney(src.getAdjustment())); + if (src.hasAdjustmentReason()) + tgt.setAdjustmentReason(convertCodeableConcept(src.getAdjustmentReason())); + if (src.hasDate()) + tgt.setDateElement(convertDate(src.getDateElement())); + if (src.hasAmount()) + tgt.setAmount(convertMoney(src.getAmount())); + if (src.hasIdentifier()) + tgt.setIdentifier(convertIdentifier(src.getIdentifier())); + return tgt; + } + + public static org.hl7.fhir.r4.model.ExplanationOfBenefit.PaymentComponent convertPaymentComponent(org.hl7.fhir.r5.model.ExplanationOfBenefit.PaymentComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.ExplanationOfBenefit.PaymentComponent tgt = new org.hl7.fhir.r4.model.ExplanationOfBenefit.PaymentComponent(); + copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + if (src.hasAdjustment()) + tgt.setAdjustment(convertMoney(src.getAdjustment())); + if (src.hasAdjustmentReason()) + tgt.setAdjustmentReason(convertCodeableConcept(src.getAdjustmentReason())); + if (src.hasDate()) + tgt.setDateElement(convertDate(src.getDateElement())); + if (src.hasAmount()) + tgt.setAmount(convertMoney(src.getAmount())); + if (src.hasIdentifier()) + tgt.setIdentifier(convertIdentifier(src.getIdentifier())); + return tgt; + } + + public static org.hl7.fhir.r5.model.ExplanationOfBenefit.NoteComponent convertNoteComponent(org.hl7.fhir.r4.model.ExplanationOfBenefit.NoteComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ExplanationOfBenefit.NoteComponent tgt = new org.hl7.fhir.r5.model.ExplanationOfBenefit.NoteComponent(); + copyElement(src, tgt); + if (src.hasNumber()) + tgt.setNumberElement(convertPositiveInt(src.getNumberElement())); + if (src.hasType()) + tgt.setType(Enumerations.convertNoteType(src.getType())); + if (src.hasText()) + tgt.setTextElement(convertString(src.getTextElement())); + if (src.hasLanguage()) + tgt.setLanguage(convertCodeableConcept(src.getLanguage())); + return tgt; + } + + public static org.hl7.fhir.r4.model.ExplanationOfBenefit.NoteComponent convertNoteComponent(org.hl7.fhir.r5.model.ExplanationOfBenefit.NoteComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.ExplanationOfBenefit.NoteComponent tgt = new org.hl7.fhir.r4.model.ExplanationOfBenefit.NoteComponent(); + copyElement(src, tgt); + if (src.hasNumber()) + tgt.setNumberElement(convertPositiveInt(src.getNumberElement())); + if (src.hasType()) + tgt.setType(Enumerations.convertNoteType(src.getType())); + if (src.hasText()) + tgt.setTextElement(convertString(src.getTextElement())); + if (src.hasLanguage()) + tgt.setLanguage(convertCodeableConcept(src.getLanguage())); + return tgt; + } + + public static org.hl7.fhir.r5.model.ExplanationOfBenefit.BenefitBalanceComponent convertBenefitBalanceComponent(org.hl7.fhir.r4.model.ExplanationOfBenefit.BenefitBalanceComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ExplanationOfBenefit.BenefitBalanceComponent tgt = new org.hl7.fhir.r5.model.ExplanationOfBenefit.BenefitBalanceComponent(); + copyElement(src, tgt); + if (src.hasCategory()) + tgt.setCategory(convertCodeableConcept(src.getCategory())); + if (src.hasExcluded()) + tgt.setExcludedElement(convertBoolean(src.getExcludedElement())); + if (src.hasName()) + tgt.setNameElement(convertString(src.getNameElement())); + if (src.hasDescription()) + tgt.setDescriptionElement(convertString(src.getDescriptionElement())); + if (src.hasNetwork()) + tgt.setNetwork(convertCodeableConcept(src.getNetwork())); + if (src.hasUnit()) + tgt.setUnit(convertCodeableConcept(src.getUnit())); + if (src.hasTerm()) + tgt.setTerm(convertCodeableConcept(src.getTerm())); + for (org.hl7.fhir.r4.model.ExplanationOfBenefit.BenefitComponent t : src.getFinancial()) + tgt.addFinancial(convertBenefitComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.ExplanationOfBenefit.BenefitBalanceComponent convertBenefitBalanceComponent(org.hl7.fhir.r5.model.ExplanationOfBenefit.BenefitBalanceComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.ExplanationOfBenefit.BenefitBalanceComponent tgt = new org.hl7.fhir.r4.model.ExplanationOfBenefit.BenefitBalanceComponent(); + copyElement(src, tgt); + if (src.hasCategory()) + tgt.setCategory(convertCodeableConcept(src.getCategory())); + if (src.hasExcluded()) + tgt.setExcludedElement(convertBoolean(src.getExcludedElement())); + if (src.hasName()) + tgt.setNameElement(convertString(src.getNameElement())); + if (src.hasDescription()) + tgt.setDescriptionElement(convertString(src.getDescriptionElement())); + if (src.hasNetwork()) + tgt.setNetwork(convertCodeableConcept(src.getNetwork())); + if (src.hasUnit()) + tgt.setUnit(convertCodeableConcept(src.getUnit())); + if (src.hasTerm()) + tgt.setTerm(convertCodeableConcept(src.getTerm())); + for (org.hl7.fhir.r5.model.ExplanationOfBenefit.BenefitComponent t : src.getFinancial()) + tgt.addFinancial(convertBenefitComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.ExplanationOfBenefit.BenefitComponent convertBenefitComponent(org.hl7.fhir.r4.model.ExplanationOfBenefit.BenefitComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ExplanationOfBenefit.BenefitComponent tgt = new org.hl7.fhir.r5.model.ExplanationOfBenefit.BenefitComponent(); + copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + if (src.hasAllowed()) + tgt.setAllowed(convertType(src.getAllowed())); + if (src.hasUsed()) + tgt.setUsed(convertType(src.getUsed())); + return tgt; + } + + public static org.hl7.fhir.r4.model.ExplanationOfBenefit.BenefitComponent convertBenefitComponent(org.hl7.fhir.r5.model.ExplanationOfBenefit.BenefitComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.ExplanationOfBenefit.BenefitComponent tgt = new org.hl7.fhir.r4.model.ExplanationOfBenefit.BenefitComponent(); + copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + if (src.hasAllowed()) + tgt.setAllowed(convertType(src.getAllowed())); + if (src.hasUsed()) + tgt.setUsed(convertType(src.getUsed())); + return tgt; + } + + +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/FamilyMemberHistory.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/FamilyMemberHistory.java new file mode 100644 index 000000000..56ab2934b --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/FamilyMemberHistory.java @@ -0,0 +1,191 @@ +package org.hl7.fhir.convertors.conv40_50; + +import org.hl7.fhir.exceptions.FHIRException; + +import org.hl7.fhir.convertors.VersionConvertor_40_50; + + +/* + Copyright (c) 2011+, HL7, Inc. + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of HL7 nor the names of its contributors may be used to + endorse or promote products derived from this software without specific + prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + +*/ + +// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0 + + +public class FamilyMemberHistory extends VersionConvertor_40_50 { + + public static org.hl7.fhir.r5.model.FamilyMemberHistory convertFamilyMemberHistory(org.hl7.fhir.r4.model.FamilyMemberHistory src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.FamilyMemberHistory tgt = new org.hl7.fhir.r5.model.FamilyMemberHistory(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + for (org.hl7.fhir.r4.model.CanonicalType t : src.getInstantiatesCanonical()) + tgt.getInstantiatesCanonical().add(convertCanonical(t)); + for (org.hl7.fhir.r4.model.UriType t : src.getInstantiatesUri()) + tgt.getInstantiatesUri().add(convertUri(t)); + if (src.hasStatus()) + tgt.setStatus(convertFamilyHistoryStatus(src.getStatus())); + if (src.hasDataAbsentReason()) + tgt.setDataAbsentReason(convertCodeableConcept(src.getDataAbsentReason())); + if (src.hasPatient()) + tgt.setPatient(convertReference(src.getPatient())); + if (src.hasDate()) + tgt.setDateElement(convertDateTime(src.getDateElement())); + if (src.hasName()) + tgt.setNameElement(convertString(src.getNameElement())); + if (src.hasRelationship()) + tgt.setRelationship(convertCodeableConcept(src.getRelationship())); + if (src.hasSex()) + tgt.setSex(convertCodeableConcept(src.getSex())); + if (src.hasBorn()) + tgt.setBorn(convertType(src.getBorn())); + if (src.hasAge()) + tgt.setAge(convertType(src.getAge())); + if (src.hasEstimatedAge()) + tgt.setEstimatedAgeElement(convertBoolean(src.getEstimatedAgeElement())); + if (src.hasDeceased()) + tgt.setDeceased(convertType(src.getDeceased())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getReasonCode()) + tgt.addReasonCode(convertCodeableConcept(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getReasonReference()) + tgt.addReasonReference(convertReference(t)); + for (org.hl7.fhir.r4.model.Annotation t : src.getNote()) + tgt.addNote(convertAnnotation(t)); + for (org.hl7.fhir.r4.model.FamilyMemberHistory.FamilyMemberHistoryConditionComponent t : src.getCondition()) + tgt.addCondition(convertFamilyMemberHistoryConditionComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.FamilyMemberHistory convertFamilyMemberHistory(org.hl7.fhir.r5.model.FamilyMemberHistory src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.FamilyMemberHistory tgt = new org.hl7.fhir.r4.model.FamilyMemberHistory(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + for (org.hl7.fhir.r5.model.CanonicalType t : src.getInstantiatesCanonical()) + tgt.getInstantiatesCanonical().add(convertCanonical(t)); + for (org.hl7.fhir.r5.model.UriType t : src.getInstantiatesUri()) + tgt.getInstantiatesUri().add(convertUri(t)); + if (src.hasStatus()) + tgt.setStatus(convertFamilyHistoryStatus(src.getStatus())); + if (src.hasDataAbsentReason()) + tgt.setDataAbsentReason(convertCodeableConcept(src.getDataAbsentReason())); + if (src.hasPatient()) + tgt.setPatient(convertReference(src.getPatient())); + if (src.hasDate()) + tgt.setDateElement(convertDateTime(src.getDateElement())); + if (src.hasName()) + tgt.setNameElement(convertString(src.getNameElement())); + if (src.hasRelationship()) + tgt.setRelationship(convertCodeableConcept(src.getRelationship())); + if (src.hasSex()) + tgt.setSex(convertCodeableConcept(src.getSex())); + if (src.hasBorn()) + tgt.setBorn(convertType(src.getBorn())); + if (src.hasAge()) + tgt.setAge(convertType(src.getAge())); + if (src.hasEstimatedAge()) + tgt.setEstimatedAgeElement(convertBoolean(src.getEstimatedAgeElement())); + if (src.hasDeceased()) + tgt.setDeceased(convertType(src.getDeceased())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getReasonCode()) + tgt.addReasonCode(convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getReasonReference()) + tgt.addReasonReference(convertReference(t)); + for (org.hl7.fhir.r5.model.Annotation t : src.getNote()) + tgt.addNote(convertAnnotation(t)); + for (org.hl7.fhir.r5.model.FamilyMemberHistory.FamilyMemberHistoryConditionComponent t : src.getCondition()) + tgt.addCondition(convertFamilyMemberHistoryConditionComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.FamilyMemberHistory.FamilyHistoryStatus convertFamilyHistoryStatus(org.hl7.fhir.r4.model.FamilyMemberHistory.FamilyHistoryStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PARTIAL: return org.hl7.fhir.r5.model.FamilyMemberHistory.FamilyHistoryStatus.PARTIAL; + case COMPLETED: return org.hl7.fhir.r5.model.FamilyMemberHistory.FamilyHistoryStatus.COMPLETED; + case ENTEREDINERROR: return org.hl7.fhir.r5.model.FamilyMemberHistory.FamilyHistoryStatus.ENTEREDINERROR; + case HEALTHUNKNOWN: return org.hl7.fhir.r5.model.FamilyMemberHistory.FamilyHistoryStatus.HEALTHUNKNOWN; + default: return org.hl7.fhir.r5.model.FamilyMemberHistory.FamilyHistoryStatus.NULL; + } +} + + public static org.hl7.fhir.r4.model.FamilyMemberHistory.FamilyHistoryStatus convertFamilyHistoryStatus(org.hl7.fhir.r5.model.FamilyMemberHistory.FamilyHistoryStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PARTIAL: return org.hl7.fhir.r4.model.FamilyMemberHistory.FamilyHistoryStatus.PARTIAL; + case COMPLETED: return org.hl7.fhir.r4.model.FamilyMemberHistory.FamilyHistoryStatus.COMPLETED; + case ENTEREDINERROR: return org.hl7.fhir.r4.model.FamilyMemberHistory.FamilyHistoryStatus.ENTEREDINERROR; + case HEALTHUNKNOWN: return org.hl7.fhir.r4.model.FamilyMemberHistory.FamilyHistoryStatus.HEALTHUNKNOWN; + default: return org.hl7.fhir.r4.model.FamilyMemberHistory.FamilyHistoryStatus.NULL; + } +} + + public static org.hl7.fhir.r5.model.FamilyMemberHistory.FamilyMemberHistoryConditionComponent convertFamilyMemberHistoryConditionComponent(org.hl7.fhir.r4.model.FamilyMemberHistory.FamilyMemberHistoryConditionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.FamilyMemberHistory.FamilyMemberHistoryConditionComponent tgt = new org.hl7.fhir.r5.model.FamilyMemberHistory.FamilyMemberHistoryConditionComponent(); + copyElement(src, tgt); + if (src.hasCode()) + tgt.setCode(convertCodeableConcept(src.getCode())); + if (src.hasOutcome()) + tgt.setOutcome(convertCodeableConcept(src.getOutcome())); + if (src.hasContributedToDeath()) + tgt.setContributedToDeathElement(convertBoolean(src.getContributedToDeathElement())); + if (src.hasOnset()) + tgt.setOnset(convertType(src.getOnset())); + for (org.hl7.fhir.r4.model.Annotation t : src.getNote()) + tgt.addNote(convertAnnotation(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.FamilyMemberHistory.FamilyMemberHistoryConditionComponent convertFamilyMemberHistoryConditionComponent(org.hl7.fhir.r5.model.FamilyMemberHistory.FamilyMemberHistoryConditionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.FamilyMemberHistory.FamilyMemberHistoryConditionComponent tgt = new org.hl7.fhir.r4.model.FamilyMemberHistory.FamilyMemberHistoryConditionComponent(); + copyElement(src, tgt); + if (src.hasCode()) + tgt.setCode(convertCodeableConcept(src.getCode())); + if (src.hasOutcome()) + tgt.setOutcome(convertCodeableConcept(src.getOutcome())); + if (src.hasContributedToDeath()) + tgt.setContributedToDeathElement(convertBoolean(src.getContributedToDeathElement())); + if (src.hasOnset()) + tgt.setOnset(convertType(src.getOnset())); + for (org.hl7.fhir.r5.model.Annotation t : src.getNote()) + tgt.addNote(convertAnnotation(t)); + return tgt; + } + + +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Flag.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Flag.java new file mode 100644 index 000000000..ae856367f --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Flag.java @@ -0,0 +1,113 @@ +package org.hl7.fhir.convertors.conv40_50; + +import org.hl7.fhir.exceptions.FHIRException; + +import org.hl7.fhir.convertors.VersionConvertor_40_50; + + +/* + Copyright (c) 2011+, HL7, Inc. + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of HL7 nor the names of its contributors may be used to + endorse or promote products derived from this software without specific + prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + +*/ + +// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0 + + +public class Flag extends VersionConvertor_40_50 { + + public static org.hl7.fhir.r5.model.Flag convertFlag(org.hl7.fhir.r4.model.Flag src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Flag tgt = new org.hl7.fhir.r5.model.Flag(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasStatus()) + tgt.setStatus(convertFlagStatus(src.getStatus())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getCategory()) + tgt.addCategory(convertCodeableConcept(t)); + if (src.hasCode()) + tgt.setCode(convertCodeableConcept(src.getCode())); + if (src.hasSubject()) + tgt.setSubject(convertReference(src.getSubject())); + if (src.hasPeriod()) + tgt.setPeriod(convertPeriod(src.getPeriod())); + if (src.hasEncounter()) + tgt.setEncounter(convertReference(src.getEncounter())); + if (src.hasAuthor()) + tgt.setAuthor(convertReference(src.getAuthor())); + return tgt; + } + + public static org.hl7.fhir.r4.model.Flag convertFlag(org.hl7.fhir.r5.model.Flag src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Flag tgt = new org.hl7.fhir.r4.model.Flag(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasStatus()) + tgt.setStatus(convertFlagStatus(src.getStatus())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getCategory()) + tgt.addCategory(convertCodeableConcept(t)); + if (src.hasCode()) + tgt.setCode(convertCodeableConcept(src.getCode())); + if (src.hasSubject()) + tgt.setSubject(convertReference(src.getSubject())); + if (src.hasPeriod()) + tgt.setPeriod(convertPeriod(src.getPeriod())); + if (src.hasEncounter()) + tgt.setEncounter(convertReference(src.getEncounter())); + if (src.hasAuthor()) + tgt.setAuthor(convertReference(src.getAuthor())); + return tgt; + } + + public static org.hl7.fhir.r5.model.Flag.FlagStatus convertFlagStatus(org.hl7.fhir.r4.model.Flag.FlagStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case ACTIVE: return org.hl7.fhir.r5.model.Flag.FlagStatus.ACTIVE; + case INACTIVE: return org.hl7.fhir.r5.model.Flag.FlagStatus.INACTIVE; + case ENTEREDINERROR: return org.hl7.fhir.r5.model.Flag.FlagStatus.ENTEREDINERROR; + default: return org.hl7.fhir.r5.model.Flag.FlagStatus.NULL; + } +} + + public static org.hl7.fhir.r4.model.Flag.FlagStatus convertFlagStatus(org.hl7.fhir.r5.model.Flag.FlagStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case ACTIVE: return org.hl7.fhir.r4.model.Flag.FlagStatus.ACTIVE; + case INACTIVE: return org.hl7.fhir.r4.model.Flag.FlagStatus.INACTIVE; + case ENTEREDINERROR: return org.hl7.fhir.r4.model.Flag.FlagStatus.ENTEREDINERROR; + default: return org.hl7.fhir.r4.model.Flag.FlagStatus.NULL; + } +} + + +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Goal.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Goal.java new file mode 100644 index 000000000..bde95e2fa --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Goal.java @@ -0,0 +1,185 @@ +package org.hl7.fhir.convertors.conv40_50; + +import org.hl7.fhir.exceptions.FHIRException; + +import org.hl7.fhir.convertors.VersionConvertor_40_50; + + +/* + Copyright (c) 2011+, HL7, Inc. + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of HL7 nor the names of its contributors may be used to + endorse or promote products derived from this software without specific + prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + +*/ + +// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0 + + +public class Goal extends VersionConvertor_40_50 { + + public static org.hl7.fhir.r5.model.Goal convertGoal(org.hl7.fhir.r4.model.Goal src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Goal tgt = new org.hl7.fhir.r5.model.Goal(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasLifecycleStatus()) + tgt.setLifecycleStatus(convertGoalLifecycleStatus(src.getLifecycleStatus())); + if (src.hasAchievementStatus()) + tgt.setAchievementStatus(convertCodeableConcept(src.getAchievementStatus())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getCategory()) + tgt.addCategory(convertCodeableConcept(t)); + if (src.hasPriority()) + tgt.setPriority(convertCodeableConcept(src.getPriority())); + if (src.hasDescription()) + tgt.setDescription(convertCodeableConcept(src.getDescription())); + if (src.hasSubject()) + tgt.setSubject(convertReference(src.getSubject())); + if (src.hasStart()) + tgt.setStart(convertType(src.getStart())); + for (org.hl7.fhir.r4.model.Goal.GoalTargetComponent t : src.getTarget()) + tgt.addTarget(convertGoalTargetComponent(t)); + if (src.hasStatusDate()) + tgt.setStatusDateElement(convertDate(src.getStatusDateElement())); + if (src.hasStatusReason()) + tgt.setStatusReasonElement(convertString(src.getStatusReasonElement())); + if (src.hasExpressedBy()) + tgt.setExpressedBy(convertReference(src.getExpressedBy())); + for (org.hl7.fhir.r4.model.Reference t : src.getAddresses()) + tgt.addAddresses(convertReference(t)); + for (org.hl7.fhir.r4.model.Annotation t : src.getNote()) + tgt.addNote(convertAnnotation(t)); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getOutcomeCode()) + tgt.addOutcomeCode(convertCodeableConcept(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getOutcomeReference()) + tgt.addOutcomeReference(convertReference(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.Goal convertGoal(org.hl7.fhir.r5.model.Goal src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Goal tgt = new org.hl7.fhir.r4.model.Goal(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasLifecycleStatus()) + tgt.setLifecycleStatus(convertGoalLifecycleStatus(src.getLifecycleStatus())); + if (src.hasAchievementStatus()) + tgt.setAchievementStatus(convertCodeableConcept(src.getAchievementStatus())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getCategory()) + tgt.addCategory(convertCodeableConcept(t)); + if (src.hasPriority()) + tgt.setPriority(convertCodeableConcept(src.getPriority())); + if (src.hasDescription()) + tgt.setDescription(convertCodeableConcept(src.getDescription())); + if (src.hasSubject()) + tgt.setSubject(convertReference(src.getSubject())); + if (src.hasStart()) + tgt.setStart(convertType(src.getStart())); + for (org.hl7.fhir.r5.model.Goal.GoalTargetComponent t : src.getTarget()) + tgt.addTarget(convertGoalTargetComponent(t)); + if (src.hasStatusDate()) + tgt.setStatusDateElement(convertDate(src.getStatusDateElement())); + if (src.hasStatusReason()) + tgt.setStatusReasonElement(convertString(src.getStatusReasonElement())); + if (src.hasExpressedBy()) + tgt.setExpressedBy(convertReference(src.getExpressedBy())); + for (org.hl7.fhir.r5.model.Reference t : src.getAddresses()) + tgt.addAddresses(convertReference(t)); + for (org.hl7.fhir.r5.model.Annotation t : src.getNote()) + tgt.addNote(convertAnnotation(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getOutcomeCode()) + tgt.addOutcomeCode(convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getOutcomeReference()) + tgt.addOutcomeReference(convertReference(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.Goal.GoalLifecycleStatus convertGoalLifecycleStatus(org.hl7.fhir.r4.model.Goal.GoalLifecycleStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PROPOSED: return org.hl7.fhir.r5.model.Goal.GoalLifecycleStatus.PROPOSED; + case PLANNED: return org.hl7.fhir.r5.model.Goal.GoalLifecycleStatus.PLANNED; + case ACCEPTED: return org.hl7.fhir.r5.model.Goal.GoalLifecycleStatus.ACCEPTED; + case ACTIVE: return org.hl7.fhir.r5.model.Goal.GoalLifecycleStatus.ACTIVE; + case ONHOLD: return org.hl7.fhir.r5.model.Goal.GoalLifecycleStatus.ONHOLD; + case COMPLETED: return org.hl7.fhir.r5.model.Goal.GoalLifecycleStatus.COMPLETED; + case CANCELLED: return org.hl7.fhir.r5.model.Goal.GoalLifecycleStatus.CANCELLED; + case ENTEREDINERROR: return org.hl7.fhir.r5.model.Goal.GoalLifecycleStatus.ENTEREDINERROR; + case REJECTED: return org.hl7.fhir.r5.model.Goal.GoalLifecycleStatus.REJECTED; + default: return org.hl7.fhir.r5.model.Goal.GoalLifecycleStatus.NULL; + } +} + + public static org.hl7.fhir.r4.model.Goal.GoalLifecycleStatus convertGoalLifecycleStatus(org.hl7.fhir.r5.model.Goal.GoalLifecycleStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PROPOSED: return org.hl7.fhir.r4.model.Goal.GoalLifecycleStatus.PROPOSED; + case PLANNED: return org.hl7.fhir.r4.model.Goal.GoalLifecycleStatus.PLANNED; + case ACCEPTED: return org.hl7.fhir.r4.model.Goal.GoalLifecycleStatus.ACCEPTED; + case ACTIVE: return org.hl7.fhir.r4.model.Goal.GoalLifecycleStatus.ACTIVE; + case ONHOLD: return org.hl7.fhir.r4.model.Goal.GoalLifecycleStatus.ONHOLD; + case COMPLETED: return org.hl7.fhir.r4.model.Goal.GoalLifecycleStatus.COMPLETED; + case CANCELLED: return org.hl7.fhir.r4.model.Goal.GoalLifecycleStatus.CANCELLED; + case ENTEREDINERROR: return org.hl7.fhir.r4.model.Goal.GoalLifecycleStatus.ENTEREDINERROR; + case REJECTED: return org.hl7.fhir.r4.model.Goal.GoalLifecycleStatus.REJECTED; + default: return org.hl7.fhir.r4.model.Goal.GoalLifecycleStatus.NULL; + } +} + + public static org.hl7.fhir.r5.model.Goal.GoalTargetComponent convertGoalTargetComponent(org.hl7.fhir.r4.model.Goal.GoalTargetComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Goal.GoalTargetComponent tgt = new org.hl7.fhir.r5.model.Goal.GoalTargetComponent(); + copyElement(src, tgt); + if (src.hasMeasure()) + tgt.setMeasure(convertCodeableConcept(src.getMeasure())); + if (src.hasDetail()) + tgt.setDetail(convertType(src.getDetail())); + if (src.hasDue()) + tgt.setDue(convertType(src.getDue())); + return tgt; + } + + public static org.hl7.fhir.r4.model.Goal.GoalTargetComponent convertGoalTargetComponent(org.hl7.fhir.r5.model.Goal.GoalTargetComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Goal.GoalTargetComponent tgt = new org.hl7.fhir.r4.model.Goal.GoalTargetComponent(); + copyElement(src, tgt); + if (src.hasMeasure()) + tgt.setMeasure(convertCodeableConcept(src.getMeasure())); + if (src.hasDetail()) + tgt.setDetail(convertType(src.getDetail())); + if (src.hasDue()) + tgt.setDue(convertType(src.getDue())); + return tgt; + } + + +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/GraphDefinition.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/GraphDefinition.java new file mode 100644 index 000000000..486dff762 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/GraphDefinition.java @@ -0,0 +1,301 @@ +package org.hl7.fhir.convertors.conv40_50; + +import org.hl7.fhir.exceptions.FHIRException; + +import org.hl7.fhir.convertors.VersionConvertor_40_50; + + +/* + Copyright (c) 2011+, HL7, Inc. + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of HL7 nor the names of its contributors may be used to + endorse or promote products derived from this software without specific + prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + +*/ + +// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0 + + +public class GraphDefinition extends VersionConvertor_40_50 { + + public static org.hl7.fhir.r5.model.GraphDefinition convertGraphDefinition(org.hl7.fhir.r4.model.GraphDefinition src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.GraphDefinition tgt = new org.hl7.fhir.r5.model.GraphDefinition(); + copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrlElement(convertUri(src.getUrlElement())); + if (src.hasVersion()) + tgt.setVersionElement(convertString(src.getVersionElement())); + if (src.hasName()) + tgt.setNameElement(convertString(src.getNameElement())); + if (src.hasStatus()) + tgt.setStatus(Enumerations.convertPublicationStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimentalElement(convertBoolean(src.getExperimentalElement())); + if (src.hasDate()) + tgt.setDateElement(convertDateTime(src.getDateElement())); + if (src.hasPublisher()) + tgt.setPublisherElement(convertString(src.getPublisherElement())); + for (org.hl7.fhir.r4.model.ContactDetail t : src.getContact()) + tgt.addContact(convertContactDetail(t)); + if (src.hasDescription()) + tgt.setDescriptionElement(convertMarkdown(src.getDescriptionElement())); + for (org.hl7.fhir.r4.model.UsageContext t : src.getUseContext()) + tgt.addUseContext(convertUsageContext(t)); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getJurisdiction()) + tgt.addJurisdiction(convertCodeableConcept(t)); + if (src.hasPurpose()) + tgt.setPurposeElement(convertMarkdown(src.getPurposeElement())); + if (src.hasStart()) + tgt.setStartElement(convertCode(src.getStartElement())); + if (src.hasProfile()) + tgt.setProfileElement(convertCanonical(src.getProfileElement())); + for (org.hl7.fhir.r4.model.GraphDefinition.GraphDefinitionLinkComponent t : src.getLink()) + tgt.addLink(convertGraphDefinitionLinkComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.GraphDefinition convertGraphDefinition(org.hl7.fhir.r5.model.GraphDefinition src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.GraphDefinition tgt = new org.hl7.fhir.r4.model.GraphDefinition(); + copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrlElement(convertUri(src.getUrlElement())); + if (src.hasVersion()) + tgt.setVersionElement(convertString(src.getVersionElement())); + if (src.hasName()) + tgt.setNameElement(convertString(src.getNameElement())); + if (src.hasStatus()) + tgt.setStatus(Enumerations.convertPublicationStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimentalElement(convertBoolean(src.getExperimentalElement())); + if (src.hasDate()) + tgt.setDateElement(convertDateTime(src.getDateElement())); + if (src.hasPublisher()) + tgt.setPublisherElement(convertString(src.getPublisherElement())); + for (org.hl7.fhir.r5.model.ContactDetail t : src.getContact()) + tgt.addContact(convertContactDetail(t)); + if (src.hasDescription()) + tgt.setDescriptionElement(convertMarkdown(src.getDescriptionElement())); + for (org.hl7.fhir.r5.model.UsageContext t : src.getUseContext()) + tgt.addUseContext(convertUsageContext(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getJurisdiction()) + tgt.addJurisdiction(convertCodeableConcept(t)); + if (src.hasPurpose()) + tgt.setPurposeElement(convertMarkdown(src.getPurposeElement())); + if (src.hasStart()) + tgt.setStartElement(convertCode(src.getStartElement())); + if (src.hasProfile()) + tgt.setProfileElement(convertCanonical(src.getProfileElement())); + for (org.hl7.fhir.r5.model.GraphDefinition.GraphDefinitionLinkComponent t : src.getLink()) + tgt.addLink(convertGraphDefinitionLinkComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.GraphDefinition.GraphDefinitionLinkComponent convertGraphDefinitionLinkComponent(org.hl7.fhir.r4.model.GraphDefinition.GraphDefinitionLinkComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.GraphDefinition.GraphDefinitionLinkComponent tgt = new org.hl7.fhir.r5.model.GraphDefinition.GraphDefinitionLinkComponent(); + copyElement(src, tgt); + if (src.hasPath()) + tgt.setPathElement(convertString(src.getPathElement())); + if (src.hasSliceName()) + tgt.setSliceNameElement(convertString(src.getSliceNameElement())); + if (src.hasMin()) + tgt.setMinElement(convertInteger(src.getMinElement())); + if (src.hasMax()) + tgt.setMaxElement(convertString(src.getMaxElement())); + if (src.hasDescription()) + tgt.setDescriptionElement(convertString(src.getDescriptionElement())); + for (org.hl7.fhir.r4.model.GraphDefinition.GraphDefinitionLinkTargetComponent t : src.getTarget()) + tgt.addTarget(convertGraphDefinitionLinkTargetComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.GraphDefinition.GraphDefinitionLinkComponent convertGraphDefinitionLinkComponent(org.hl7.fhir.r5.model.GraphDefinition.GraphDefinitionLinkComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.GraphDefinition.GraphDefinitionLinkComponent tgt = new org.hl7.fhir.r4.model.GraphDefinition.GraphDefinitionLinkComponent(); + copyElement(src, tgt); + if (src.hasPath()) + tgt.setPathElement(convertString(src.getPathElement())); + if (src.hasSliceName()) + tgt.setSliceNameElement(convertString(src.getSliceNameElement())); + if (src.hasMin()) + tgt.setMinElement(convertInteger(src.getMinElement())); + if (src.hasMax()) + tgt.setMaxElement(convertString(src.getMaxElement())); + if (src.hasDescription()) + tgt.setDescriptionElement(convertString(src.getDescriptionElement())); + for (org.hl7.fhir.r5.model.GraphDefinition.GraphDefinitionLinkTargetComponent t : src.getTarget()) + tgt.addTarget(convertGraphDefinitionLinkTargetComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.GraphDefinition.GraphDefinitionLinkTargetComponent convertGraphDefinitionLinkTargetComponent(org.hl7.fhir.r4.model.GraphDefinition.GraphDefinitionLinkTargetComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.GraphDefinition.GraphDefinitionLinkTargetComponent tgt = new org.hl7.fhir.r5.model.GraphDefinition.GraphDefinitionLinkTargetComponent(); + copyElement(src, tgt); + if (src.hasType()) + tgt.setTypeElement(convertCode(src.getTypeElement())); + if (src.hasParams()) + tgt.setParamsElement(convertString(src.getParamsElement())); + if (src.hasProfile()) + tgt.setProfileElement(convertCanonical(src.getProfileElement())); + for (org.hl7.fhir.r4.model.GraphDefinition.GraphDefinitionLinkTargetCompartmentComponent t : src.getCompartment()) + tgt.addCompartment(convertGraphDefinitionLinkTargetCompartmentComponent(t)); + for (org.hl7.fhir.r4.model.GraphDefinition.GraphDefinitionLinkComponent t : src.getLink()) + tgt.addLink(convertGraphDefinitionLinkComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.GraphDefinition.GraphDefinitionLinkTargetComponent convertGraphDefinitionLinkTargetComponent(org.hl7.fhir.r5.model.GraphDefinition.GraphDefinitionLinkTargetComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.GraphDefinition.GraphDefinitionLinkTargetComponent tgt = new org.hl7.fhir.r4.model.GraphDefinition.GraphDefinitionLinkTargetComponent(); + copyElement(src, tgt); + if (src.hasType()) + tgt.setTypeElement(convertCode(src.getTypeElement())); + if (src.hasParams()) + tgt.setParamsElement(convertString(src.getParamsElement())); + if (src.hasProfile()) + tgt.setProfileElement(convertCanonical(src.getProfileElement())); + for (org.hl7.fhir.r5.model.GraphDefinition.GraphDefinitionLinkTargetCompartmentComponent t : src.getCompartment()) + tgt.addCompartment(convertGraphDefinitionLinkTargetCompartmentComponent(t)); + for (org.hl7.fhir.r5.model.GraphDefinition.GraphDefinitionLinkComponent t : src.getLink()) + tgt.addLink(convertGraphDefinitionLinkComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.GraphDefinition.GraphDefinitionLinkTargetCompartmentComponent convertGraphDefinitionLinkTargetCompartmentComponent(org.hl7.fhir.r4.model.GraphDefinition.GraphDefinitionLinkTargetCompartmentComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.GraphDefinition.GraphDefinitionLinkTargetCompartmentComponent tgt = new org.hl7.fhir.r5.model.GraphDefinition.GraphDefinitionLinkTargetCompartmentComponent(); + copyElement(src, tgt); + if (src.hasUse()) + tgt.setUse(convertGraphCompartmentUse(src.getUse())); + if (src.hasCode()) + tgt.setCode(convertCompartmentCode(src.getCode())); + if (src.hasRule()) + tgt.setRule(convertGraphCompartmentRule(src.getRule())); + if (src.hasExpression()) + tgt.setExpressionElement(convertString(src.getExpressionElement())); + if (src.hasDescription()) + tgt.setDescriptionElement(convertString(src.getDescriptionElement())); + return tgt; + } + + public static org.hl7.fhir.r4.model.GraphDefinition.GraphDefinitionLinkTargetCompartmentComponent convertGraphDefinitionLinkTargetCompartmentComponent(org.hl7.fhir.r5.model.GraphDefinition.GraphDefinitionLinkTargetCompartmentComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.GraphDefinition.GraphDefinitionLinkTargetCompartmentComponent tgt = new org.hl7.fhir.r4.model.GraphDefinition.GraphDefinitionLinkTargetCompartmentComponent(); + copyElement(src, tgt); + if (src.hasUse()) + tgt.setUse(convertGraphCompartmentUse(src.getUse())); + if (src.hasCode()) + tgt.setCode(convertCompartmentCode(src.getCode())); + if (src.hasRule()) + tgt.setRule(convertGraphCompartmentRule(src.getRule())); + if (src.hasExpression()) + tgt.setExpressionElement(convertString(src.getExpressionElement())); + if (src.hasDescription()) + tgt.setDescriptionElement(convertString(src.getDescriptionElement())); + return tgt; + } + + public static org.hl7.fhir.r5.model.GraphDefinition.GraphCompartmentUse convertGraphCompartmentUse(org.hl7.fhir.r4.model.GraphDefinition.GraphCompartmentUse src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case CONDITION: return org.hl7.fhir.r5.model.GraphDefinition.GraphCompartmentUse.CONDITION; + case REQUIREMENT: return org.hl7.fhir.r5.model.GraphDefinition.GraphCompartmentUse.REQUIREMENT; + default: return org.hl7.fhir.r5.model.GraphDefinition.GraphCompartmentUse.NULL; + } +} + + public static org.hl7.fhir.r4.model.GraphDefinition.GraphCompartmentUse convertGraphCompartmentUse(org.hl7.fhir.r5.model.GraphDefinition.GraphCompartmentUse src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case CONDITION: return org.hl7.fhir.r4.model.GraphDefinition.GraphCompartmentUse.CONDITION; + case REQUIREMENT: return org.hl7.fhir.r4.model.GraphDefinition.GraphCompartmentUse.REQUIREMENT; + default: return org.hl7.fhir.r4.model.GraphDefinition.GraphCompartmentUse.NULL; + } +} + + public static org.hl7.fhir.r5.model.GraphDefinition.CompartmentCode convertCompartmentCode(org.hl7.fhir.r4.model.GraphDefinition.CompartmentCode src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PATIENT: return org.hl7.fhir.r5.model.GraphDefinition.CompartmentCode.PATIENT; + case ENCOUNTER: return org.hl7.fhir.r5.model.GraphDefinition.CompartmentCode.ENCOUNTER; + case RELATEDPERSON: return org.hl7.fhir.r5.model.GraphDefinition.CompartmentCode.RELATEDPERSON; + case PRACTITIONER: return org.hl7.fhir.r5.model.GraphDefinition.CompartmentCode.PRACTITIONER; + case DEVICE: return org.hl7.fhir.r5.model.GraphDefinition.CompartmentCode.DEVICE; + default: return org.hl7.fhir.r5.model.GraphDefinition.CompartmentCode.NULL; + } +} + + public static org.hl7.fhir.r4.model.GraphDefinition.CompartmentCode convertCompartmentCode(org.hl7.fhir.r5.model.GraphDefinition.CompartmentCode src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PATIENT: return org.hl7.fhir.r4.model.GraphDefinition.CompartmentCode.PATIENT; + case ENCOUNTER: return org.hl7.fhir.r4.model.GraphDefinition.CompartmentCode.ENCOUNTER; + case RELATEDPERSON: return org.hl7.fhir.r4.model.GraphDefinition.CompartmentCode.RELATEDPERSON; + case PRACTITIONER: return org.hl7.fhir.r4.model.GraphDefinition.CompartmentCode.PRACTITIONER; + case DEVICE: return org.hl7.fhir.r4.model.GraphDefinition.CompartmentCode.DEVICE; + default: return org.hl7.fhir.r4.model.GraphDefinition.CompartmentCode.NULL; + } +} + + public static org.hl7.fhir.r5.model.GraphDefinition.GraphCompartmentRule convertGraphCompartmentRule(org.hl7.fhir.r4.model.GraphDefinition.GraphCompartmentRule src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case IDENTICAL: return org.hl7.fhir.r5.model.GraphDefinition.GraphCompartmentRule.IDENTICAL; + case MATCHING: return org.hl7.fhir.r5.model.GraphDefinition.GraphCompartmentRule.MATCHING; + case DIFFERENT: return org.hl7.fhir.r5.model.GraphDefinition.GraphCompartmentRule.DIFFERENT; + case CUSTOM: return org.hl7.fhir.r5.model.GraphDefinition.GraphCompartmentRule.CUSTOM; + default: return org.hl7.fhir.r5.model.GraphDefinition.GraphCompartmentRule.NULL; + } +} + + public static org.hl7.fhir.r4.model.GraphDefinition.GraphCompartmentRule convertGraphCompartmentRule(org.hl7.fhir.r5.model.GraphDefinition.GraphCompartmentRule src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case IDENTICAL: return org.hl7.fhir.r4.model.GraphDefinition.GraphCompartmentRule.IDENTICAL; + case MATCHING: return org.hl7.fhir.r4.model.GraphDefinition.GraphCompartmentRule.MATCHING; + case DIFFERENT: return org.hl7.fhir.r4.model.GraphDefinition.GraphCompartmentRule.DIFFERENT; + case CUSTOM: return org.hl7.fhir.r4.model.GraphDefinition.GraphCompartmentRule.CUSTOM; + default: return org.hl7.fhir.r4.model.GraphDefinition.GraphCompartmentRule.NULL; + } +} + + +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Group.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Group.java new file mode 100644 index 000000000..e5e1c49f7 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Group.java @@ -0,0 +1,187 @@ +package org.hl7.fhir.convertors.conv40_50; + +import org.hl7.fhir.exceptions.FHIRException; + +import org.hl7.fhir.convertors.VersionConvertor_40_50; + + +/* + Copyright (c) 2011+, HL7, Inc. + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of HL7 nor the names of its contributors may be used to + endorse or promote products derived from this software without specific + prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + +*/ + +// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0 + + +public class Group extends VersionConvertor_40_50 { + + public static org.hl7.fhir.r5.model.Group convertGroup(org.hl7.fhir.r4.model.Group src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Group tgt = new org.hl7.fhir.r5.model.Group(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasActive()) + tgt.setActiveElement(convertBoolean(src.getActiveElement())); + if (src.hasType()) + tgt.setType(convertGroupType(src.getType())); + if (src.hasActual()) + tgt.setActualElement(convertBoolean(src.getActualElement())); + if (src.hasCode()) + tgt.setCode(convertCodeableConcept(src.getCode())); + if (src.hasName()) + tgt.setNameElement(convertString(src.getNameElement())); + if (src.hasQuantity()) + tgt.setQuantityElement(convertUnsignedInt(src.getQuantityElement())); + if (src.hasManagingEntity()) + tgt.setManagingEntity(convertReference(src.getManagingEntity())); + for (org.hl7.fhir.r4.model.Group.GroupCharacteristicComponent t : src.getCharacteristic()) + tgt.addCharacteristic(convertGroupCharacteristicComponent(t)); + for (org.hl7.fhir.r4.model.Group.GroupMemberComponent t : src.getMember()) + tgt.addMember(convertGroupMemberComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.Group convertGroup(org.hl7.fhir.r5.model.Group src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Group tgt = new org.hl7.fhir.r4.model.Group(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasActive()) + tgt.setActiveElement(convertBoolean(src.getActiveElement())); + if (src.hasType()) + tgt.setType(convertGroupType(src.getType())); + if (src.hasActual()) + tgt.setActualElement(convertBoolean(src.getActualElement())); + if (src.hasCode()) + tgt.setCode(convertCodeableConcept(src.getCode())); + if (src.hasName()) + tgt.setNameElement(convertString(src.getNameElement())); + if (src.hasQuantity()) + tgt.setQuantityElement(convertUnsignedInt(src.getQuantityElement())); + if (src.hasManagingEntity()) + tgt.setManagingEntity(convertReference(src.getManagingEntity())); + for (org.hl7.fhir.r5.model.Group.GroupCharacteristicComponent t : src.getCharacteristic()) + tgt.addCharacteristic(convertGroupCharacteristicComponent(t)); + for (org.hl7.fhir.r5.model.Group.GroupMemberComponent t : src.getMember()) + tgt.addMember(convertGroupMemberComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.Group.GroupType convertGroupType(org.hl7.fhir.r4.model.Group.GroupType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PERSON: return org.hl7.fhir.r5.model.Group.GroupType.PERSON; + case ANIMAL: return org.hl7.fhir.r5.model.Group.GroupType.ANIMAL; + case PRACTITIONER: return org.hl7.fhir.r5.model.Group.GroupType.PRACTITIONER; + case DEVICE: return org.hl7.fhir.r5.model.Group.GroupType.DEVICE; + case MEDICATION: return org.hl7.fhir.r5.model.Group.GroupType.MEDICATION; + case SUBSTANCE: return org.hl7.fhir.r5.model.Group.GroupType.SUBSTANCE; + default: return org.hl7.fhir.r5.model.Group.GroupType.NULL; + } +} + + public static org.hl7.fhir.r4.model.Group.GroupType convertGroupType(org.hl7.fhir.r5.model.Group.GroupType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PERSON: return org.hl7.fhir.r4.model.Group.GroupType.PERSON; + case ANIMAL: return org.hl7.fhir.r4.model.Group.GroupType.ANIMAL; + case PRACTITIONER: return org.hl7.fhir.r4.model.Group.GroupType.PRACTITIONER; + case DEVICE: return org.hl7.fhir.r4.model.Group.GroupType.DEVICE; + case MEDICATION: return org.hl7.fhir.r4.model.Group.GroupType.MEDICATION; + case SUBSTANCE: return org.hl7.fhir.r4.model.Group.GroupType.SUBSTANCE; + default: return org.hl7.fhir.r4.model.Group.GroupType.NULL; + } +} + + public static org.hl7.fhir.r5.model.Group.GroupCharacteristicComponent convertGroupCharacteristicComponent(org.hl7.fhir.r4.model.Group.GroupCharacteristicComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Group.GroupCharacteristicComponent tgt = new org.hl7.fhir.r5.model.Group.GroupCharacteristicComponent(); + copyElement(src, tgt); + if (src.hasCode()) + tgt.setCode(convertCodeableConcept(src.getCode())); + if (src.hasValue()) + tgt.setValue(convertType(src.getValue())); + if (src.hasExclude()) + tgt.setExcludeElement(convertBoolean(src.getExcludeElement())); + if (src.hasPeriod()) + tgt.setPeriod(convertPeriod(src.getPeriod())); + return tgt; + } + + public static org.hl7.fhir.r4.model.Group.GroupCharacteristicComponent convertGroupCharacteristicComponent(org.hl7.fhir.r5.model.Group.GroupCharacteristicComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Group.GroupCharacteristicComponent tgt = new org.hl7.fhir.r4.model.Group.GroupCharacteristicComponent(); + copyElement(src, tgt); + if (src.hasCode()) + tgt.setCode(convertCodeableConcept(src.getCode())); + if (src.hasValue()) + tgt.setValue(convertType(src.getValue())); + if (src.hasExclude()) + tgt.setExcludeElement(convertBoolean(src.getExcludeElement())); + if (src.hasPeriod()) + tgt.setPeriod(convertPeriod(src.getPeriod())); + return tgt; + } + + public static org.hl7.fhir.r5.model.Group.GroupMemberComponent convertGroupMemberComponent(org.hl7.fhir.r4.model.Group.GroupMemberComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Group.GroupMemberComponent tgt = new org.hl7.fhir.r5.model.Group.GroupMemberComponent(); + copyElement(src, tgt); + if (src.hasEntity()) + tgt.setEntity(convertReference(src.getEntity())); + if (src.hasPeriod()) + tgt.setPeriod(convertPeriod(src.getPeriod())); + if (src.hasInactive()) + tgt.setInactiveElement(convertBoolean(src.getInactiveElement())); + return tgt; + } + + public static org.hl7.fhir.r4.model.Group.GroupMemberComponent convertGroupMemberComponent(org.hl7.fhir.r5.model.Group.GroupMemberComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Group.GroupMemberComponent tgt = new org.hl7.fhir.r4.model.Group.GroupMemberComponent(); + copyElement(src, tgt); + if (src.hasEntity()) + tgt.setEntity(convertReference(src.getEntity())); + if (src.hasPeriod()) + tgt.setPeriod(convertPeriod(src.getPeriod())); + if (src.hasInactive()) + tgt.setInactiveElement(convertBoolean(src.getInactiveElement())); + return tgt; + } + + +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/GuidanceResponse.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/GuidanceResponse.java new file mode 100644 index 000000000..5e6395253 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/GuidanceResponse.java @@ -0,0 +1,147 @@ +package org.hl7.fhir.convertors.conv40_50; + +import org.hl7.fhir.exceptions.FHIRException; + +import org.hl7.fhir.convertors.VersionConvertor_40_50; + + +/* + Copyright (c) 2011+, HL7, Inc. + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of HL7 nor the names of its contributors may be used to + endorse or promote products derived from this software without specific + prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + +*/ + +// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0 + + +public class GuidanceResponse extends VersionConvertor_40_50 { + + public static org.hl7.fhir.r5.model.GuidanceResponse convertGuidanceResponse(org.hl7.fhir.r4.model.GuidanceResponse src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.GuidanceResponse tgt = new org.hl7.fhir.r5.model.GuidanceResponse(); + copyDomainResource(src, tgt); + if (src.hasRequestIdentifier()) + tgt.setRequestIdentifier(convertIdentifier(src.getRequestIdentifier())); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasModule()) + tgt.setModule(convertType(src.getModule())); + if (src.hasStatus()) + tgt.setStatus(convertGuidanceResponseStatus(src.getStatus())); + if (src.hasSubject()) + tgt.setSubject(convertReference(src.getSubject())); + if (src.hasEncounter()) + tgt.setEncounter(convertReference(src.getEncounter())); + if (src.hasOccurrenceDateTime()) + tgt.setOccurrenceDateTimeElement(convertDateTime(src.getOccurrenceDateTimeElement())); + if (src.hasPerformer()) + tgt.setPerformer(convertReference(src.getPerformer())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getReasonCode()) + tgt.addReasonCode(convertCodeableConcept(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getReasonReference()) + tgt.addReasonReference(convertReference(t)); + for (org.hl7.fhir.r4.model.Annotation t : src.getNote()) + tgt.addNote(convertAnnotation(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getEvaluationMessage()) + tgt.addEvaluationMessage(convertReference(t)); + if (src.hasOutputParameters()) + tgt.setOutputParameters(convertReference(src.getOutputParameters())); + if (src.hasResult()) + tgt.setResult(convertReference(src.getResult())); + for (org.hl7.fhir.r4.model.DataRequirement t : src.getDataRequirement()) + tgt.addDataRequirement(convertDataRequirement(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.GuidanceResponse convertGuidanceResponse(org.hl7.fhir.r5.model.GuidanceResponse src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.GuidanceResponse tgt = new org.hl7.fhir.r4.model.GuidanceResponse(); + copyDomainResource(src, tgt); + if (src.hasRequestIdentifier()) + tgt.setRequestIdentifier(convertIdentifier(src.getRequestIdentifier())); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasModule()) + tgt.setModule(convertType(src.getModule())); + if (src.hasStatus()) + tgt.setStatus(convertGuidanceResponseStatus(src.getStatus())); + if (src.hasSubject()) + tgt.setSubject(convertReference(src.getSubject())); + if (src.hasEncounter()) + tgt.setEncounter(convertReference(src.getEncounter())); + if (src.hasOccurrenceDateTime()) + tgt.setOccurrenceDateTimeElement(convertDateTime(src.getOccurrenceDateTimeElement())); + if (src.hasPerformer()) + tgt.setPerformer(convertReference(src.getPerformer())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getReasonCode()) + tgt.addReasonCode(convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getReasonReference()) + tgt.addReasonReference(convertReference(t)); + for (org.hl7.fhir.r5.model.Annotation t : src.getNote()) + tgt.addNote(convertAnnotation(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getEvaluationMessage()) + tgt.addEvaluationMessage(convertReference(t)); + if (src.hasOutputParameters()) + tgt.setOutputParameters(convertReference(src.getOutputParameters())); + if (src.hasResult()) + tgt.setResult(convertReference(src.getResult())); + for (org.hl7.fhir.r5.model.DataRequirement t : src.getDataRequirement()) + tgt.addDataRequirement(convertDataRequirement(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.GuidanceResponse.GuidanceResponseStatus convertGuidanceResponseStatus(org.hl7.fhir.r4.model.GuidanceResponse.GuidanceResponseStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case SUCCESS: return org.hl7.fhir.r5.model.GuidanceResponse.GuidanceResponseStatus.SUCCESS; + case DATAREQUESTED: return org.hl7.fhir.r5.model.GuidanceResponse.GuidanceResponseStatus.DATAREQUESTED; + case DATAREQUIRED: return org.hl7.fhir.r5.model.GuidanceResponse.GuidanceResponseStatus.DATAREQUIRED; + case INPROGRESS: return org.hl7.fhir.r5.model.GuidanceResponse.GuidanceResponseStatus.INPROGRESS; + case FAILURE: return org.hl7.fhir.r5.model.GuidanceResponse.GuidanceResponseStatus.FAILURE; + case ENTEREDINERROR: return org.hl7.fhir.r5.model.GuidanceResponse.GuidanceResponseStatus.ENTEREDINERROR; + default: return org.hl7.fhir.r5.model.GuidanceResponse.GuidanceResponseStatus.NULL; + } +} + + public static org.hl7.fhir.r4.model.GuidanceResponse.GuidanceResponseStatus convertGuidanceResponseStatus(org.hl7.fhir.r5.model.GuidanceResponse.GuidanceResponseStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case SUCCESS: return org.hl7.fhir.r4.model.GuidanceResponse.GuidanceResponseStatus.SUCCESS; + case DATAREQUESTED: return org.hl7.fhir.r4.model.GuidanceResponse.GuidanceResponseStatus.DATAREQUESTED; + case DATAREQUIRED: return org.hl7.fhir.r4.model.GuidanceResponse.GuidanceResponseStatus.DATAREQUIRED; + case INPROGRESS: return org.hl7.fhir.r4.model.GuidanceResponse.GuidanceResponseStatus.INPROGRESS; + case FAILURE: return org.hl7.fhir.r4.model.GuidanceResponse.GuidanceResponseStatus.FAILURE; + case ENTEREDINERROR: return org.hl7.fhir.r4.model.GuidanceResponse.GuidanceResponseStatus.ENTEREDINERROR; + default: return org.hl7.fhir.r4.model.GuidanceResponse.GuidanceResponseStatus.NULL; + } +} + + +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/HealthcareService.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/HealthcareService.java new file mode 100644 index 000000000..b0979413d --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/HealthcareService.java @@ -0,0 +1,265 @@ +package org.hl7.fhir.convertors.conv40_50; + +import org.hl7.fhir.exceptions.FHIRException; + +import org.hl7.fhir.convertors.VersionConvertor_40_50; + + +/* + Copyright (c) 2011+, HL7, Inc. + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of HL7 nor the names of its contributors may be used to + endorse or promote products derived from this software without specific + prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + +*/ + +// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0 + + +public class HealthcareService extends VersionConvertor_40_50 { + + public static org.hl7.fhir.r5.model.HealthcareService convertHealthcareService(org.hl7.fhir.r4.model.HealthcareService src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.HealthcareService tgt = new org.hl7.fhir.r5.model.HealthcareService(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasActive()) + tgt.setActiveElement(convertBoolean(src.getActiveElement())); + if (src.hasProvidedBy()) + tgt.setProvidedBy(convertReference(src.getProvidedBy())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getCategory()) + tgt.addCategory(convertCodeableConcept(t)); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getType()) + tgt.addType(convertCodeableConcept(t)); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getSpecialty()) + tgt.addSpecialty(convertCodeableConcept(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getLocation()) + tgt.addLocation(convertReference(t)); + if (src.hasName()) + tgt.setNameElement(convertString(src.getNameElement())); + if (src.hasComment()) + tgt.setCommentElement(convertString(src.getCommentElement())); + if (src.hasExtraDetails()) + tgt.setExtraDetailsElement(convertMarkdown(src.getExtraDetailsElement())); + if (src.hasPhoto()) + tgt.setPhoto(convertAttachment(src.getPhoto())); + for (org.hl7.fhir.r4.model.ContactPoint t : src.getTelecom()) + tgt.addTelecom(convertContactPoint(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getCoverageArea()) + tgt.addCoverageArea(convertReference(t)); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getServiceProvisionCode()) + tgt.addServiceProvisionCode(convertCodeableConcept(t)); + for (org.hl7.fhir.r4.model.HealthcareService.HealthcareServiceEligibilityComponent t : src.getEligibility()) + tgt.addEligibility(convertHealthcareServiceEligibilityComponent(t)); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getProgram()) + tgt.addProgram(convertCodeableConcept(t)); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getCharacteristic()) + tgt.addCharacteristic(convertCodeableConcept(t)); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getCommunication()) + tgt.addCommunication(convertCodeableConcept(t)); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getReferralMethod()) + tgt.addReferralMethod(convertCodeableConcept(t)); + if (src.hasAppointmentRequired()) + tgt.setAppointmentRequiredElement(convertBoolean(src.getAppointmentRequiredElement())); + for (org.hl7.fhir.r4.model.HealthcareService.HealthcareServiceAvailableTimeComponent t : src.getAvailableTime()) + tgt.addAvailableTime(convertHealthcareServiceAvailableTimeComponent(t)); + for (org.hl7.fhir.r4.model.HealthcareService.HealthcareServiceNotAvailableComponent t : src.getNotAvailable()) + tgt.addNotAvailable(convertHealthcareServiceNotAvailableComponent(t)); + if (src.hasAvailabilityExceptions()) + tgt.setAvailabilityExceptionsElement(convertString(src.getAvailabilityExceptionsElement())); + for (org.hl7.fhir.r4.model.Reference t : src.getEndpoint()) + tgt.addEndpoint(convertReference(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.HealthcareService convertHealthcareService(org.hl7.fhir.r5.model.HealthcareService src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.HealthcareService tgt = new org.hl7.fhir.r4.model.HealthcareService(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasActive()) + tgt.setActiveElement(convertBoolean(src.getActiveElement())); + if (src.hasProvidedBy()) + tgt.setProvidedBy(convertReference(src.getProvidedBy())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getCategory()) + tgt.addCategory(convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getType()) + tgt.addType(convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getSpecialty()) + tgt.addSpecialty(convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getLocation()) + tgt.addLocation(convertReference(t)); + if (src.hasName()) + tgt.setNameElement(convertString(src.getNameElement())); + if (src.hasComment()) + tgt.setCommentElement(convertString(src.getCommentElement())); + if (src.hasExtraDetails()) + tgt.setExtraDetailsElement(convertMarkdown(src.getExtraDetailsElement())); + if (src.hasPhoto()) + tgt.setPhoto(convertAttachment(src.getPhoto())); + for (org.hl7.fhir.r5.model.ContactPoint t : src.getTelecom()) + tgt.addTelecom(convertContactPoint(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getCoverageArea()) + tgt.addCoverageArea(convertReference(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getServiceProvisionCode()) + tgt.addServiceProvisionCode(convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.HealthcareService.HealthcareServiceEligibilityComponent t : src.getEligibility()) + tgt.addEligibility(convertHealthcareServiceEligibilityComponent(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getProgram()) + tgt.addProgram(convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getCharacteristic()) + tgt.addCharacteristic(convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getCommunication()) + tgt.addCommunication(convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getReferralMethod()) + tgt.addReferralMethod(convertCodeableConcept(t)); + if (src.hasAppointmentRequired()) + tgt.setAppointmentRequiredElement(convertBoolean(src.getAppointmentRequiredElement())); + for (org.hl7.fhir.r5.model.HealthcareService.HealthcareServiceAvailableTimeComponent t : src.getAvailableTime()) + tgt.addAvailableTime(convertHealthcareServiceAvailableTimeComponent(t)); + for (org.hl7.fhir.r5.model.HealthcareService.HealthcareServiceNotAvailableComponent t : src.getNotAvailable()) + tgt.addNotAvailable(convertHealthcareServiceNotAvailableComponent(t)); + if (src.hasAvailabilityExceptions()) + tgt.setAvailabilityExceptionsElement(convertString(src.getAvailabilityExceptionsElement())); + for (org.hl7.fhir.r5.model.Reference t : src.getEndpoint()) + tgt.addEndpoint(convertReference(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.HealthcareService.HealthcareServiceEligibilityComponent convertHealthcareServiceEligibilityComponent(org.hl7.fhir.r4.model.HealthcareService.HealthcareServiceEligibilityComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.HealthcareService.HealthcareServiceEligibilityComponent tgt = new org.hl7.fhir.r5.model.HealthcareService.HealthcareServiceEligibilityComponent(); + copyElement(src, tgt); + if (src.hasCode()) + tgt.setCode(convertCodeableConcept(src.getCode())); + if (src.hasComment()) + tgt.setCommentElement(convertMarkdown(src.getCommentElement())); + return tgt; + } + + public static org.hl7.fhir.r4.model.HealthcareService.HealthcareServiceEligibilityComponent convertHealthcareServiceEligibilityComponent(org.hl7.fhir.r5.model.HealthcareService.HealthcareServiceEligibilityComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.HealthcareService.HealthcareServiceEligibilityComponent tgt = new org.hl7.fhir.r4.model.HealthcareService.HealthcareServiceEligibilityComponent(); + copyElement(src, tgt); + if (src.hasCode()) + tgt.setCode(convertCodeableConcept(src.getCode())); + if (src.hasComment()) + tgt.setCommentElement(convertMarkdown(src.getCommentElement())); + return tgt; + } + + public static org.hl7.fhir.r5.model.HealthcareService.HealthcareServiceAvailableTimeComponent convertHealthcareServiceAvailableTimeComponent(org.hl7.fhir.r4.model.HealthcareService.HealthcareServiceAvailableTimeComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.HealthcareService.HealthcareServiceAvailableTimeComponent tgt = new org.hl7.fhir.r5.model.HealthcareService.HealthcareServiceAvailableTimeComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.r4.model.Enumeration t : src.getDaysOfWeek()) + tgt.addDaysOfWeek(convertDaysOfWeek(t.getValue())); + if (src.hasAllDay()) + tgt.setAllDayElement(convertBoolean(src.getAllDayElement())); + if (src.hasAvailableStartTime()) + tgt.setAvailableStartTimeElement(convertTime(src.getAvailableStartTimeElement())); + if (src.hasAvailableEndTime()) + tgt.setAvailableEndTimeElement(convertTime(src.getAvailableEndTimeElement())); + return tgt; + } + + public static org.hl7.fhir.r4.model.HealthcareService.HealthcareServiceAvailableTimeComponent convertHealthcareServiceAvailableTimeComponent(org.hl7.fhir.r5.model.HealthcareService.HealthcareServiceAvailableTimeComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.HealthcareService.HealthcareServiceAvailableTimeComponent tgt = new org.hl7.fhir.r4.model.HealthcareService.HealthcareServiceAvailableTimeComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.r5.model.Enumeration t : src.getDaysOfWeek()) + tgt.addDaysOfWeek(convertDaysOfWeek(t.getValue())); + if (src.hasAllDay()) + tgt.setAllDayElement(convertBoolean(src.getAllDayElement())); + if (src.hasAvailableStartTime()) + tgt.setAvailableStartTimeElement(convertTime(src.getAvailableStartTimeElement())); + if (src.hasAvailableEndTime()) + tgt.setAvailableEndTimeElement(convertTime(src.getAvailableEndTimeElement())); + return tgt; + } + + public static org.hl7.fhir.r5.model.HealthcareService.DaysOfWeek convertDaysOfWeek(org.hl7.fhir.r4.model.HealthcareService.DaysOfWeek src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case MON: return org.hl7.fhir.r5.model.HealthcareService.DaysOfWeek.MON; + case TUE: return org.hl7.fhir.r5.model.HealthcareService.DaysOfWeek.TUE; + case WED: return org.hl7.fhir.r5.model.HealthcareService.DaysOfWeek.WED; + case THU: return org.hl7.fhir.r5.model.HealthcareService.DaysOfWeek.THU; + case FRI: return org.hl7.fhir.r5.model.HealthcareService.DaysOfWeek.FRI; + case SAT: return org.hl7.fhir.r5.model.HealthcareService.DaysOfWeek.SAT; + case SUN: return org.hl7.fhir.r5.model.HealthcareService.DaysOfWeek.SUN; + default: return org.hl7.fhir.r5.model.HealthcareService.DaysOfWeek.NULL; + } +} + + public static org.hl7.fhir.r4.model.HealthcareService.DaysOfWeek convertDaysOfWeek(org.hl7.fhir.r5.model.HealthcareService.DaysOfWeek src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case MON: return org.hl7.fhir.r4.model.HealthcareService.DaysOfWeek.MON; + case TUE: return org.hl7.fhir.r4.model.HealthcareService.DaysOfWeek.TUE; + case WED: return org.hl7.fhir.r4.model.HealthcareService.DaysOfWeek.WED; + case THU: return org.hl7.fhir.r4.model.HealthcareService.DaysOfWeek.THU; + case FRI: return org.hl7.fhir.r4.model.HealthcareService.DaysOfWeek.FRI; + case SAT: return org.hl7.fhir.r4.model.HealthcareService.DaysOfWeek.SAT; + case SUN: return org.hl7.fhir.r4.model.HealthcareService.DaysOfWeek.SUN; + default: return org.hl7.fhir.r4.model.HealthcareService.DaysOfWeek.NULL; + } +} + + public static org.hl7.fhir.r5.model.HealthcareService.HealthcareServiceNotAvailableComponent convertHealthcareServiceNotAvailableComponent(org.hl7.fhir.r4.model.HealthcareService.HealthcareServiceNotAvailableComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.HealthcareService.HealthcareServiceNotAvailableComponent tgt = new org.hl7.fhir.r5.model.HealthcareService.HealthcareServiceNotAvailableComponent(); + copyElement(src, tgt); + if (src.hasDescription()) + tgt.setDescriptionElement(convertString(src.getDescriptionElement())); + if (src.hasDuring()) + tgt.setDuring(convertPeriod(src.getDuring())); + return tgt; + } + + public static org.hl7.fhir.r4.model.HealthcareService.HealthcareServiceNotAvailableComponent convertHealthcareServiceNotAvailableComponent(org.hl7.fhir.r5.model.HealthcareService.HealthcareServiceNotAvailableComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.HealthcareService.HealthcareServiceNotAvailableComponent tgt = new org.hl7.fhir.r4.model.HealthcareService.HealthcareServiceNotAvailableComponent(); + copyElement(src, tgt); + if (src.hasDescription()) + tgt.setDescriptionElement(convertString(src.getDescriptionElement())); + if (src.hasDuring()) + tgt.setDuring(convertPeriod(src.getDuring())); + return tgt; + } + + +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/ImagingStudy.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/ImagingStudy.java new file mode 100644 index 000000000..8d45034ba --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/ImagingStudy.java @@ -0,0 +1,285 @@ +package org.hl7.fhir.convertors.conv40_50; + +import org.hl7.fhir.exceptions.FHIRException; + +import org.hl7.fhir.convertors.VersionConvertor_40_50; + + +/* + Copyright (c) 2011+, HL7, Inc. + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of HL7 nor the names of its contributors may be used to + endorse or promote products derived from this software without specific + prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + +*/ + +// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0 + + +public class ImagingStudy extends VersionConvertor_40_50 { + + public static org.hl7.fhir.r5.model.ImagingStudy convertImagingStudy(org.hl7.fhir.r4.model.ImagingStudy src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ImagingStudy tgt = new org.hl7.fhir.r5.model.ImagingStudy(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasStatus()) + tgt.setStatus(convertImagingStudyStatus(src.getStatus())); + for (org.hl7.fhir.r4.model.Coding t : src.getModality()) + tgt.addModality(convertCoding(t)); + if (src.hasSubject()) + tgt.setSubject(convertReference(src.getSubject())); + if (src.hasEncounter()) + tgt.setEncounter(convertReference(src.getEncounter())); + if (src.hasStarted()) + tgt.setStartedElement(convertDateTime(src.getStartedElement())); + for (org.hl7.fhir.r4.model.Reference t : src.getBasedOn()) + tgt.addBasedOn(convertReference(t)); + if (src.hasReferrer()) + tgt.setReferrer(convertReference(src.getReferrer())); + for (org.hl7.fhir.r4.model.Reference t : src.getInterpreter()) + tgt.addInterpreter(convertReference(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getEndpoint()) + tgt.addEndpoint(convertReference(t)); + if (src.hasNumberOfSeries()) + tgt.setNumberOfSeriesElement(convertUnsignedInt(src.getNumberOfSeriesElement())); + if (src.hasNumberOfInstances()) + tgt.setNumberOfInstancesElement(convertUnsignedInt(src.getNumberOfInstancesElement())); + if (src.hasProcedureReference()) + tgt.setProcedureReference(convertReference(src.getProcedureReference())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getProcedureCode()) + tgt.addProcedureCode(convertCodeableConcept(t)); + if (src.hasLocation()) + tgt.setLocation(convertReference(src.getLocation())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getReasonCode()) + tgt.addReasonCode(convertCodeableConcept(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getReasonReference()) + tgt.addReasonReference(convertReference(t)); + for (org.hl7.fhir.r4.model.Annotation t : src.getNote()) + tgt.addNote(convertAnnotation(t)); + if (src.hasDescription()) + tgt.setDescriptionElement(convertString(src.getDescriptionElement())); + for (org.hl7.fhir.r4.model.ImagingStudy.ImagingStudySeriesComponent t : src.getSeries()) + tgt.addSeries(convertImagingStudySeriesComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.ImagingStudy convertImagingStudy(org.hl7.fhir.r5.model.ImagingStudy src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.ImagingStudy tgt = new org.hl7.fhir.r4.model.ImagingStudy(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasStatus()) + tgt.setStatus(convertImagingStudyStatus(src.getStatus())); + for (org.hl7.fhir.r5.model.Coding t : src.getModality()) + tgt.addModality(convertCoding(t)); + if (src.hasSubject()) + tgt.setSubject(convertReference(src.getSubject())); + if (src.hasEncounter()) + tgt.setEncounter(convertReference(src.getEncounter())); + if (src.hasStarted()) + tgt.setStartedElement(convertDateTime(src.getStartedElement())); + for (org.hl7.fhir.r5.model.Reference t : src.getBasedOn()) + tgt.addBasedOn(convertReference(t)); + if (src.hasReferrer()) + tgt.setReferrer(convertReference(src.getReferrer())); + for (org.hl7.fhir.r5.model.Reference t : src.getInterpreter()) + tgt.addInterpreter(convertReference(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getEndpoint()) + tgt.addEndpoint(convertReference(t)); + if (src.hasNumberOfSeries()) + tgt.setNumberOfSeriesElement(convertUnsignedInt(src.getNumberOfSeriesElement())); + if (src.hasNumberOfInstances()) + tgt.setNumberOfInstancesElement(convertUnsignedInt(src.getNumberOfInstancesElement())); + if (src.hasProcedureReference()) + tgt.setProcedureReference(convertReference(src.getProcedureReference())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getProcedureCode()) + tgt.addProcedureCode(convertCodeableConcept(t)); + if (src.hasLocation()) + tgt.setLocation(convertReference(src.getLocation())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getReasonCode()) + tgt.addReasonCode(convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getReasonReference()) + tgt.addReasonReference(convertReference(t)); + for (org.hl7.fhir.r5.model.Annotation t : src.getNote()) + tgt.addNote(convertAnnotation(t)); + if (src.hasDescription()) + tgt.setDescriptionElement(convertString(src.getDescriptionElement())); + for (org.hl7.fhir.r5.model.ImagingStudy.ImagingStudySeriesComponent t : src.getSeries()) + tgt.addSeries(convertImagingStudySeriesComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.ImagingStudy.ImagingStudyStatus convertImagingStudyStatus(org.hl7.fhir.r4.model.ImagingStudy.ImagingStudyStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case REGISTERED: return org.hl7.fhir.r5.model.ImagingStudy.ImagingStudyStatus.REGISTERED; + case AVAILABLE: return org.hl7.fhir.r5.model.ImagingStudy.ImagingStudyStatus.AVAILABLE; + case CANCELLED: return org.hl7.fhir.r5.model.ImagingStudy.ImagingStudyStatus.CANCELLED; + case ENTEREDINERROR: return org.hl7.fhir.r5.model.ImagingStudy.ImagingStudyStatus.ENTEREDINERROR; + case UNKNOWN: return org.hl7.fhir.r5.model.ImagingStudy.ImagingStudyStatus.UNKNOWN; + default: return org.hl7.fhir.r5.model.ImagingStudy.ImagingStudyStatus.NULL; + } +} + + public static org.hl7.fhir.r4.model.ImagingStudy.ImagingStudyStatus convertImagingStudyStatus(org.hl7.fhir.r5.model.ImagingStudy.ImagingStudyStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case REGISTERED: return org.hl7.fhir.r4.model.ImagingStudy.ImagingStudyStatus.REGISTERED; + case AVAILABLE: return org.hl7.fhir.r4.model.ImagingStudy.ImagingStudyStatus.AVAILABLE; + case CANCELLED: return org.hl7.fhir.r4.model.ImagingStudy.ImagingStudyStatus.CANCELLED; + case ENTEREDINERROR: return org.hl7.fhir.r4.model.ImagingStudy.ImagingStudyStatus.ENTEREDINERROR; + case UNKNOWN: return org.hl7.fhir.r4.model.ImagingStudy.ImagingStudyStatus.UNKNOWN; + default: return org.hl7.fhir.r4.model.ImagingStudy.ImagingStudyStatus.NULL; + } +} + + public static org.hl7.fhir.r5.model.ImagingStudy.ImagingStudySeriesComponent convertImagingStudySeriesComponent(org.hl7.fhir.r4.model.ImagingStudy.ImagingStudySeriesComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ImagingStudy.ImagingStudySeriesComponent tgt = new org.hl7.fhir.r5.model.ImagingStudy.ImagingStudySeriesComponent(); + copyElement(src, tgt); + if (src.hasUid()) + tgt.setUidElement(convertId(src.getUidElement())); + if (src.hasNumber()) + tgt.setNumberElement(convertUnsignedInt(src.getNumberElement())); + if (src.hasModality()) + tgt.setModality(convertCoding(src.getModality())); + if (src.hasDescription()) + tgt.setDescriptionElement(convertString(src.getDescriptionElement())); + if (src.hasNumberOfInstances()) + tgt.setNumberOfInstancesElement(convertUnsignedInt(src.getNumberOfInstancesElement())); + for (org.hl7.fhir.r4.model.Reference t : src.getEndpoint()) + tgt.addEndpoint(convertReference(t)); + if (src.hasBodySite()) + tgt.setBodySite(convertCoding(src.getBodySite())); + if (src.hasLaterality()) + tgt.setLaterality(convertCoding(src.getLaterality())); + for (org.hl7.fhir.r4.model.Reference t : src.getSpecimen()) + tgt.addSpecimen(convertReference(t)); + if (src.hasStarted()) + tgt.setStartedElement(convertDateTime(src.getStartedElement())); + for (org.hl7.fhir.r4.model.ImagingStudy.ImagingStudySeriesPerformerComponent t : src.getPerformer()) + tgt.addPerformer(convertImagingStudySeriesPerformerComponent(t)); + for (org.hl7.fhir.r4.model.ImagingStudy.ImagingStudySeriesInstanceComponent t : src.getInstance()) + tgt.addInstance(convertImagingStudySeriesInstanceComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.ImagingStudy.ImagingStudySeriesComponent convertImagingStudySeriesComponent(org.hl7.fhir.r5.model.ImagingStudy.ImagingStudySeriesComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.ImagingStudy.ImagingStudySeriesComponent tgt = new org.hl7.fhir.r4.model.ImagingStudy.ImagingStudySeriesComponent(); + copyElement(src, tgt); + if (src.hasUid()) + tgt.setUidElement(convertId(src.getUidElement())); + if (src.hasNumber()) + tgt.setNumberElement(convertUnsignedInt(src.getNumberElement())); + if (src.hasModality()) + tgt.setModality(convertCoding(src.getModality())); + if (src.hasDescription()) + tgt.setDescriptionElement(convertString(src.getDescriptionElement())); + if (src.hasNumberOfInstances()) + tgt.setNumberOfInstancesElement(convertUnsignedInt(src.getNumberOfInstancesElement())); + for (org.hl7.fhir.r5.model.Reference t : src.getEndpoint()) + tgt.addEndpoint(convertReference(t)); + if (src.hasBodySite()) + tgt.setBodySite(convertCoding(src.getBodySite())); + if (src.hasLaterality()) + tgt.setLaterality(convertCoding(src.getLaterality())); + for (org.hl7.fhir.r5.model.Reference t : src.getSpecimen()) + tgt.addSpecimen(convertReference(t)); + if (src.hasStarted()) + tgt.setStartedElement(convertDateTime(src.getStartedElement())); + for (org.hl7.fhir.r5.model.ImagingStudy.ImagingStudySeriesPerformerComponent t : src.getPerformer()) + tgt.addPerformer(convertImagingStudySeriesPerformerComponent(t)); + for (org.hl7.fhir.r5.model.ImagingStudy.ImagingStudySeriesInstanceComponent t : src.getInstance()) + tgt.addInstance(convertImagingStudySeriesInstanceComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.ImagingStudy.ImagingStudySeriesPerformerComponent convertImagingStudySeriesPerformerComponent(org.hl7.fhir.r4.model.ImagingStudy.ImagingStudySeriesPerformerComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ImagingStudy.ImagingStudySeriesPerformerComponent tgt = new org.hl7.fhir.r5.model.ImagingStudy.ImagingStudySeriesPerformerComponent(); + copyElement(src, tgt); + if (src.hasFunction()) + tgt.setFunction(convertCodeableConcept(src.getFunction())); + if (src.hasActor()) + tgt.setActor(convertReference(src.getActor())); + return tgt; + } + + public static org.hl7.fhir.r4.model.ImagingStudy.ImagingStudySeriesPerformerComponent convertImagingStudySeriesPerformerComponent(org.hl7.fhir.r5.model.ImagingStudy.ImagingStudySeriesPerformerComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.ImagingStudy.ImagingStudySeriesPerformerComponent tgt = new org.hl7.fhir.r4.model.ImagingStudy.ImagingStudySeriesPerformerComponent(); + copyElement(src, tgt); + if (src.hasFunction()) + tgt.setFunction(convertCodeableConcept(src.getFunction())); + if (src.hasActor()) + tgt.setActor(convertReference(src.getActor())); + return tgt; + } + + public static org.hl7.fhir.r5.model.ImagingStudy.ImagingStudySeriesInstanceComponent convertImagingStudySeriesInstanceComponent(org.hl7.fhir.r4.model.ImagingStudy.ImagingStudySeriesInstanceComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ImagingStudy.ImagingStudySeriesInstanceComponent tgt = new org.hl7.fhir.r5.model.ImagingStudy.ImagingStudySeriesInstanceComponent(); + copyElement(src, tgt); + if (src.hasUid()) + tgt.setUidElement(convertId(src.getUidElement())); + if (src.hasSopClass()) + tgt.setSopClass(convertCoding(src.getSopClass())); + if (src.hasNumber()) + tgt.setNumberElement(convertUnsignedInt(src.getNumberElement())); + if (src.hasTitle()) + tgt.setTitleElement(convertString(src.getTitleElement())); + return tgt; + } + + public static org.hl7.fhir.r4.model.ImagingStudy.ImagingStudySeriesInstanceComponent convertImagingStudySeriesInstanceComponent(org.hl7.fhir.r5.model.ImagingStudy.ImagingStudySeriesInstanceComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.ImagingStudy.ImagingStudySeriesInstanceComponent tgt = new org.hl7.fhir.r4.model.ImagingStudy.ImagingStudySeriesInstanceComponent(); + copyElement(src, tgt); + if (src.hasUid()) + tgt.setUidElement(convertId(src.getUidElement())); + if (src.hasSopClass()) + tgt.setSopClass(convertCoding(src.getSopClass())); + if (src.hasNumber()) + tgt.setNumberElement(convertUnsignedInt(src.getNumberElement())); + if (src.hasTitle()) + tgt.setTitleElement(convertString(src.getTitleElement())); + return tgt; + } + + +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Immunization.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Immunization.java new file mode 100644 index 000000000..eaf4993df --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Immunization.java @@ -0,0 +1,313 @@ +package org.hl7.fhir.convertors.conv40_50; + +import org.hl7.fhir.exceptions.FHIRException; + +import org.hl7.fhir.convertors.VersionConvertor_40_50; + + +/* + Copyright (c) 2011+, HL7, Inc. + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of HL7 nor the names of its contributors may be used to + endorse or promote products derived from this software without specific + prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + +*/ + +// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0 + + +public class Immunization extends VersionConvertor_40_50 { + + public static org.hl7.fhir.r5.model.Immunization convertImmunization(org.hl7.fhir.r4.model.Immunization src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Immunization tgt = new org.hl7.fhir.r5.model.Immunization(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasStatus()) + tgt.setStatus(convertImmunizationStatus(src.getStatus())); + if (src.hasStatusReason()) + tgt.setStatusReason(convertCodeableConcept(src.getStatusReason())); + if (src.hasVaccineCode()) + tgt.setVaccineCode(convertCodeableConcept(src.getVaccineCode())); + if (src.hasPatient()) + tgt.setPatient(convertReference(src.getPatient())); + if (src.hasEncounter()) + tgt.setEncounter(convertReference(src.getEncounter())); + if (src.hasOccurrence()) + tgt.setOccurrence(convertType(src.getOccurrence())); + if (src.hasRecorded()) + tgt.setRecordedElement(convertDateTime(src.getRecordedElement())); + if (src.hasPrimarySource()) + tgt.setPrimarySourceElement(convertBoolean(src.getPrimarySourceElement())); + if (src.hasReportOrigin()) + tgt.setReportOrigin(convertCodeableConcept(src.getReportOrigin())); + if (src.hasLocation()) + tgt.setLocation(convertReference(src.getLocation())); + if (src.hasManufacturer()) + tgt.setManufacturer(convertReference(src.getManufacturer())); + if (src.hasLotNumber()) + tgt.setLotNumberElement(convertString(src.getLotNumberElement())); + if (src.hasExpirationDate()) + tgt.setExpirationDateElement(convertDate(src.getExpirationDateElement())); + if (src.hasSite()) + tgt.setSite(convertCodeableConcept(src.getSite())); + if (src.hasRoute()) + tgt.setRoute(convertCodeableConcept(src.getRoute())); + if (src.hasDoseQuantity()) + tgt.setDoseQuantity(convertSimpleQuantity(src.getDoseQuantity())); + for (org.hl7.fhir.r4.model.Immunization.ImmunizationPerformerComponent t : src.getPerformer()) + tgt.addPerformer(convertImmunizationPerformerComponent(t)); + for (org.hl7.fhir.r4.model.Annotation t : src.getNote()) + tgt.addNote(convertAnnotation(t)); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getReasonCode()) + tgt.addReasonCode(convertCodeableConcept(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getReasonReference()) + tgt.addReasonReference(convertReference(t)); + if (src.hasIsSubpotent()) + tgt.setIsSubpotentElement(convertBoolean(src.getIsSubpotentElement())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getSubpotentReason()) + tgt.addSubpotentReason(convertCodeableConcept(t)); + for (org.hl7.fhir.r4.model.Immunization.ImmunizationEducationComponent t : src.getEducation()) + tgt.addEducation(convertImmunizationEducationComponent(t)); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getProgramEligibility()) + tgt.addProgramEligibility(convertCodeableConcept(t)); + if (src.hasFundingSource()) + tgt.setFundingSource(convertCodeableConcept(src.getFundingSource())); + for (org.hl7.fhir.r4.model.Immunization.ImmunizationReactionComponent t : src.getReaction()) + tgt.addReaction(convertImmunizationReactionComponent(t)); + for (org.hl7.fhir.r4.model.Immunization.ImmunizationProtocolAppliedComponent t : src.getProtocolApplied()) + tgt.addProtocolApplied(convertImmunizationProtocolAppliedComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.Immunization convertImmunization(org.hl7.fhir.r5.model.Immunization src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Immunization tgt = new org.hl7.fhir.r4.model.Immunization(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasStatus()) + tgt.setStatus(convertImmunizationStatus(src.getStatus())); + if (src.hasStatusReason()) + tgt.setStatusReason(convertCodeableConcept(src.getStatusReason())); + if (src.hasVaccineCode()) + tgt.setVaccineCode(convertCodeableConcept(src.getVaccineCode())); + if (src.hasPatient()) + tgt.setPatient(convertReference(src.getPatient())); + if (src.hasEncounter()) + tgt.setEncounter(convertReference(src.getEncounter())); + if (src.hasOccurrence()) + tgt.setOccurrence(convertType(src.getOccurrence())); + if (src.hasRecorded()) + tgt.setRecordedElement(convertDateTime(src.getRecordedElement())); + if (src.hasPrimarySource()) + tgt.setPrimarySourceElement(convertBoolean(src.getPrimarySourceElement())); + if (src.hasReportOrigin()) + tgt.setReportOrigin(convertCodeableConcept(src.getReportOrigin())); + if (src.hasLocation()) + tgt.setLocation(convertReference(src.getLocation())); + if (src.hasManufacturer()) + tgt.setManufacturer(convertReference(src.getManufacturer())); + if (src.hasLotNumber()) + tgt.setLotNumberElement(convertString(src.getLotNumberElement())); + if (src.hasExpirationDate()) + tgt.setExpirationDateElement(convertDate(src.getExpirationDateElement())); + if (src.hasSite()) + tgt.setSite(convertCodeableConcept(src.getSite())); + if (src.hasRoute()) + tgt.setRoute(convertCodeableConcept(src.getRoute())); + if (src.hasDoseQuantity()) + tgt.setDoseQuantity(convertSimpleQuantity(src.getDoseQuantity())); + for (org.hl7.fhir.r5.model.Immunization.ImmunizationPerformerComponent t : src.getPerformer()) + tgt.addPerformer(convertImmunizationPerformerComponent(t)); + for (org.hl7.fhir.r5.model.Annotation t : src.getNote()) + tgt.addNote(convertAnnotation(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getReasonCode()) + tgt.addReasonCode(convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getReasonReference()) + tgt.addReasonReference(convertReference(t)); + if (src.hasIsSubpotent()) + tgt.setIsSubpotentElement(convertBoolean(src.getIsSubpotentElement())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getSubpotentReason()) + tgt.addSubpotentReason(convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.Immunization.ImmunizationEducationComponent t : src.getEducation()) + tgt.addEducation(convertImmunizationEducationComponent(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getProgramEligibility()) + tgt.addProgramEligibility(convertCodeableConcept(t)); + if (src.hasFundingSource()) + tgt.setFundingSource(convertCodeableConcept(src.getFundingSource())); + for (org.hl7.fhir.r5.model.Immunization.ImmunizationReactionComponent t : src.getReaction()) + tgt.addReaction(convertImmunizationReactionComponent(t)); + for (org.hl7.fhir.r5.model.Immunization.ImmunizationProtocolAppliedComponent t : src.getProtocolApplied()) + tgt.addProtocolApplied(convertImmunizationProtocolAppliedComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.Immunization.ImmunizationStatus convertImmunizationStatus(org.hl7.fhir.r4.model.Immunization.ImmunizationStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case COMPLETED: return org.hl7.fhir.r5.model.Immunization.ImmunizationStatus.COMPLETED; + case ENTEREDINERROR: return org.hl7.fhir.r5.model.Immunization.ImmunizationStatus.ENTEREDINERROR; + case NOTDONE: return org.hl7.fhir.r5.model.Immunization.ImmunizationStatus.NOTDONE; + default: return org.hl7.fhir.r5.model.Immunization.ImmunizationStatus.NULL; + } +} + + public static org.hl7.fhir.r4.model.Immunization.ImmunizationStatus convertImmunizationStatus(org.hl7.fhir.r5.model.Immunization.ImmunizationStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case COMPLETED: return org.hl7.fhir.r4.model.Immunization.ImmunizationStatus.COMPLETED; + case ENTEREDINERROR: return org.hl7.fhir.r4.model.Immunization.ImmunizationStatus.ENTEREDINERROR; + case NOTDONE: return org.hl7.fhir.r4.model.Immunization.ImmunizationStatus.NOTDONE; + default: return org.hl7.fhir.r4.model.Immunization.ImmunizationStatus.NULL; + } +} + + public static org.hl7.fhir.r5.model.Immunization.ImmunizationPerformerComponent convertImmunizationPerformerComponent(org.hl7.fhir.r4.model.Immunization.ImmunizationPerformerComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Immunization.ImmunizationPerformerComponent tgt = new org.hl7.fhir.r5.model.Immunization.ImmunizationPerformerComponent(); + copyElement(src, tgt); + if (src.hasFunction()) + tgt.setFunction(convertCodeableConcept(src.getFunction())); + if (src.hasActor()) + tgt.setActor(convertReference(src.getActor())); + return tgt; + } + + public static org.hl7.fhir.r4.model.Immunization.ImmunizationPerformerComponent convertImmunizationPerformerComponent(org.hl7.fhir.r5.model.Immunization.ImmunizationPerformerComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Immunization.ImmunizationPerformerComponent tgt = new org.hl7.fhir.r4.model.Immunization.ImmunizationPerformerComponent(); + copyElement(src, tgt); + if (src.hasFunction()) + tgt.setFunction(convertCodeableConcept(src.getFunction())); + if (src.hasActor()) + tgt.setActor(convertReference(src.getActor())); + return tgt; + } + + public static org.hl7.fhir.r5.model.Immunization.ImmunizationEducationComponent convertImmunizationEducationComponent(org.hl7.fhir.r4.model.Immunization.ImmunizationEducationComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Immunization.ImmunizationEducationComponent tgt = new org.hl7.fhir.r5.model.Immunization.ImmunizationEducationComponent(); + copyElement(src, tgt); + if (src.hasDocumentType()) + tgt.setDocumentTypeElement(convertString(src.getDocumentTypeElement())); + if (src.hasReference()) + tgt.setReferenceElement(convertUri(src.getReferenceElement())); + if (src.hasPublicationDate()) + tgt.setPublicationDateElement(convertDateTime(src.getPublicationDateElement())); + if (src.hasPresentationDate()) + tgt.setPresentationDateElement(convertDateTime(src.getPresentationDateElement())); + return tgt; + } + + public static org.hl7.fhir.r4.model.Immunization.ImmunizationEducationComponent convertImmunizationEducationComponent(org.hl7.fhir.r5.model.Immunization.ImmunizationEducationComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Immunization.ImmunizationEducationComponent tgt = new org.hl7.fhir.r4.model.Immunization.ImmunizationEducationComponent(); + copyElement(src, tgt); + if (src.hasDocumentType()) + tgt.setDocumentTypeElement(convertString(src.getDocumentTypeElement())); + if (src.hasReference()) + tgt.setReferenceElement(convertUri(src.getReferenceElement())); + if (src.hasPublicationDate()) + tgt.setPublicationDateElement(convertDateTime(src.getPublicationDateElement())); + if (src.hasPresentationDate()) + tgt.setPresentationDateElement(convertDateTime(src.getPresentationDateElement())); + return tgt; + } + + public static org.hl7.fhir.r5.model.Immunization.ImmunizationReactionComponent convertImmunizationReactionComponent(org.hl7.fhir.r4.model.Immunization.ImmunizationReactionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Immunization.ImmunizationReactionComponent tgt = new org.hl7.fhir.r5.model.Immunization.ImmunizationReactionComponent(); + copyElement(src, tgt); + if (src.hasDate()) + tgt.setDateElement(convertDateTime(src.getDateElement())); + if (src.hasDetail()) + tgt.setDetail(convertReference(src.getDetail())); + if (src.hasReported()) + tgt.setReportedElement(convertBoolean(src.getReportedElement())); + return tgt; + } + + public static org.hl7.fhir.r4.model.Immunization.ImmunizationReactionComponent convertImmunizationReactionComponent(org.hl7.fhir.r5.model.Immunization.ImmunizationReactionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Immunization.ImmunizationReactionComponent tgt = new org.hl7.fhir.r4.model.Immunization.ImmunizationReactionComponent(); + copyElement(src, tgt); + if (src.hasDate()) + tgt.setDateElement(convertDateTime(src.getDateElement())); + if (src.hasDetail()) + tgt.setDetail(convertReference(src.getDetail())); + if (src.hasReported()) + tgt.setReportedElement(convertBoolean(src.getReportedElement())); + return tgt; + } + + public static org.hl7.fhir.r5.model.Immunization.ImmunizationProtocolAppliedComponent convertImmunizationProtocolAppliedComponent(org.hl7.fhir.r4.model.Immunization.ImmunizationProtocolAppliedComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Immunization.ImmunizationProtocolAppliedComponent tgt = new org.hl7.fhir.r5.model.Immunization.ImmunizationProtocolAppliedComponent(); + copyElement(src, tgt); + if (src.hasSeries()) + tgt.setSeriesElement(convertString(src.getSeriesElement())); + if (src.hasAuthority()) + tgt.setAuthority(convertReference(src.getAuthority())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getTargetDisease()) + tgt.addTargetDisease(convertCodeableConcept(t)); + if (src.hasDoseNumber()) + tgt.setDoseNumber(convertType(src.getDoseNumber())); + if (src.hasSeriesDoses()) + tgt.setSeriesDoses(convertType(src.getSeriesDoses())); + return tgt; + } + + public static org.hl7.fhir.r4.model.Immunization.ImmunizationProtocolAppliedComponent convertImmunizationProtocolAppliedComponent(org.hl7.fhir.r5.model.Immunization.ImmunizationProtocolAppliedComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Immunization.ImmunizationProtocolAppliedComponent tgt = new org.hl7.fhir.r4.model.Immunization.ImmunizationProtocolAppliedComponent(); + copyElement(src, tgt); + if (src.hasSeries()) + tgt.setSeriesElement(convertString(src.getSeriesElement())); + if (src.hasAuthority()) + tgt.setAuthority(convertReference(src.getAuthority())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getTargetDisease()) + tgt.addTargetDisease(convertCodeableConcept(t)); + if (src.hasDoseNumber()) + tgt.setDoseNumber(convertType(src.getDoseNumber())); + if (src.hasSeriesDoses()) + tgt.setSeriesDoses(convertType(src.getSeriesDoses())); + return tgt; + } + + +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/ImmunizationEvaluation.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/ImmunizationEvaluation.java new file mode 100644 index 000000000..7d7950da2 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/ImmunizationEvaluation.java @@ -0,0 +1,131 @@ +package org.hl7.fhir.convertors.conv40_50; + +import org.hl7.fhir.exceptions.FHIRException; + +import org.hl7.fhir.convertors.VersionConvertor_40_50; + + +/* + Copyright (c) 2011+, HL7, Inc. + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of HL7 nor the names of its contributors may be used to + endorse or promote products derived from this software without specific + prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + +*/ + +// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0 + + +public class ImmunizationEvaluation extends VersionConvertor_40_50 { + + public static org.hl7.fhir.r5.model.ImmunizationEvaluation convertImmunizationEvaluation(org.hl7.fhir.r4.model.ImmunizationEvaluation src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ImmunizationEvaluation tgt = new org.hl7.fhir.r5.model.ImmunizationEvaluation(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasStatus()) + tgt.setStatus(convertImmunizationEvaluationStatus(src.getStatus())); + if (src.hasPatient()) + tgt.setPatient(convertReference(src.getPatient())); + if (src.hasDate()) + tgt.setDateElement(convertDateTime(src.getDateElement())); + if (src.hasAuthority()) + tgt.setAuthority(convertReference(src.getAuthority())); + if (src.hasTargetDisease()) + tgt.setTargetDisease(convertCodeableConcept(src.getTargetDisease())); + if (src.hasImmunizationEvent()) + tgt.setImmunizationEvent(convertReference(src.getImmunizationEvent())); + if (src.hasDoseStatus()) + tgt.setDoseStatus(convertCodeableConcept(src.getDoseStatus())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getDoseStatusReason()) + tgt.addDoseStatusReason(convertCodeableConcept(t)); + if (src.hasDescription()) + tgt.setDescriptionElement(convertString(src.getDescriptionElement())); + if (src.hasSeries()) + tgt.setSeriesElement(convertString(src.getSeriesElement())); + if (src.hasDoseNumber()) + tgt.setDoseNumber(convertType(src.getDoseNumber())); + if (src.hasSeriesDoses()) + tgt.setSeriesDoses(convertType(src.getSeriesDoses())); + return tgt; + } + + public static org.hl7.fhir.r4.model.ImmunizationEvaluation convertImmunizationEvaluation(org.hl7.fhir.r5.model.ImmunizationEvaluation src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.ImmunizationEvaluation tgt = new org.hl7.fhir.r4.model.ImmunizationEvaluation(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasStatus()) + tgt.setStatus(convertImmunizationEvaluationStatus(src.getStatus())); + if (src.hasPatient()) + tgt.setPatient(convertReference(src.getPatient())); + if (src.hasDate()) + tgt.setDateElement(convertDateTime(src.getDateElement())); + if (src.hasAuthority()) + tgt.setAuthority(convertReference(src.getAuthority())); + if (src.hasTargetDisease()) + tgt.setTargetDisease(convertCodeableConcept(src.getTargetDisease())); + if (src.hasImmunizationEvent()) + tgt.setImmunizationEvent(convertReference(src.getImmunizationEvent())); + if (src.hasDoseStatus()) + tgt.setDoseStatus(convertCodeableConcept(src.getDoseStatus())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getDoseStatusReason()) + tgt.addDoseStatusReason(convertCodeableConcept(t)); + if (src.hasDescription()) + tgt.setDescriptionElement(convertString(src.getDescriptionElement())); + if (src.hasSeries()) + tgt.setSeriesElement(convertString(src.getSeriesElement())); + if (src.hasDoseNumber()) + tgt.setDoseNumber(convertType(src.getDoseNumber())); + if (src.hasSeriesDoses()) + tgt.setSeriesDoses(convertType(src.getSeriesDoses())); + return tgt; + } + + public static org.hl7.fhir.r5.model.ImmunizationEvaluation.ImmunizationEvaluationStatus convertImmunizationEvaluationStatus(org.hl7.fhir.r4.model.ImmunizationEvaluation.ImmunizationEvaluationStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case COMPLETED: return org.hl7.fhir.r5.model.ImmunizationEvaluation.ImmunizationEvaluationStatus.COMPLETED; + case ENTEREDINERROR: return org.hl7.fhir.r5.model.ImmunizationEvaluation.ImmunizationEvaluationStatus.ENTEREDINERROR; + default: return org.hl7.fhir.r5.model.ImmunizationEvaluation.ImmunizationEvaluationStatus.NULL; + } +} + + public static org.hl7.fhir.r4.model.ImmunizationEvaluation.ImmunizationEvaluationStatus convertImmunizationEvaluationStatus(org.hl7.fhir.r5.model.ImmunizationEvaluation.ImmunizationEvaluationStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case COMPLETED: return org.hl7.fhir.r4.model.ImmunizationEvaluation.ImmunizationEvaluationStatus.COMPLETED; + case ENTEREDINERROR: return org.hl7.fhir.r4.model.ImmunizationEvaluation.ImmunizationEvaluationStatus.ENTEREDINERROR; + default: return org.hl7.fhir.r4.model.ImmunizationEvaluation.ImmunizationEvaluationStatus.NULL; + } +} + + +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/ImmunizationRecommendation.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/ImmunizationRecommendation.java new file mode 100644 index 000000000..4ccb054bd --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/ImmunizationRecommendation.java @@ -0,0 +1,167 @@ +package org.hl7.fhir.convertors.conv40_50; + +import org.hl7.fhir.exceptions.FHIRException; + +import org.hl7.fhir.convertors.VersionConvertor_40_50; + + +/* + Copyright (c) 2011+, HL7, Inc. + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of HL7 nor the names of its contributors may be used to + endorse or promote products derived from this software without specific + prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + +*/ + +// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0 + + +public class ImmunizationRecommendation extends VersionConvertor_40_50 { + + public static org.hl7.fhir.r5.model.ImmunizationRecommendation convertImmunizationRecommendation(org.hl7.fhir.r4.model.ImmunizationRecommendation src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ImmunizationRecommendation tgt = new org.hl7.fhir.r5.model.ImmunizationRecommendation(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasPatient()) + tgt.setPatient(convertReference(src.getPatient())); + if (src.hasDate()) + tgt.setDateElement(convertDateTime(src.getDateElement())); + if (src.hasAuthority()) + tgt.setAuthority(convertReference(src.getAuthority())); + for (org.hl7.fhir.r4.model.ImmunizationRecommendation.ImmunizationRecommendationRecommendationComponent t : src.getRecommendation()) + tgt.addRecommendation(convertImmunizationRecommendationRecommendationComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.ImmunizationRecommendation convertImmunizationRecommendation(org.hl7.fhir.r5.model.ImmunizationRecommendation src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.ImmunizationRecommendation tgt = new org.hl7.fhir.r4.model.ImmunizationRecommendation(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasPatient()) + tgt.setPatient(convertReference(src.getPatient())); + if (src.hasDate()) + tgt.setDateElement(convertDateTime(src.getDateElement())); + if (src.hasAuthority()) + tgt.setAuthority(convertReference(src.getAuthority())); + for (org.hl7.fhir.r5.model.ImmunizationRecommendation.ImmunizationRecommendationRecommendationComponent t : src.getRecommendation()) + tgt.addRecommendation(convertImmunizationRecommendationRecommendationComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.ImmunizationRecommendation.ImmunizationRecommendationRecommendationComponent convertImmunizationRecommendationRecommendationComponent(org.hl7.fhir.r4.model.ImmunizationRecommendation.ImmunizationRecommendationRecommendationComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ImmunizationRecommendation.ImmunizationRecommendationRecommendationComponent tgt = new org.hl7.fhir.r5.model.ImmunizationRecommendation.ImmunizationRecommendationRecommendationComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getVaccineCode()) + tgt.addVaccineCode(convertCodeableConcept(t)); + if (src.hasTargetDisease()) + tgt.setTargetDisease(convertCodeableConcept(src.getTargetDisease())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getContraindicatedVaccineCode()) + tgt.addContraindicatedVaccineCode(convertCodeableConcept(t)); + if (src.hasForecastStatus()) + tgt.setForecastStatus(convertCodeableConcept(src.getForecastStatus())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getForecastReason()) + tgt.addForecastReason(convertCodeableConcept(t)); + for (org.hl7.fhir.r4.model.ImmunizationRecommendation.ImmunizationRecommendationRecommendationDateCriterionComponent t : src.getDateCriterion()) + tgt.addDateCriterion(convertImmunizationRecommendationRecommendationDateCriterionComponent(t)); + if (src.hasDescription()) + tgt.setDescriptionElement(convertString(src.getDescriptionElement())); + if (src.hasSeries()) + tgt.setSeriesElement(convertString(src.getSeriesElement())); + if (src.hasDoseNumber()) + tgt.setDoseNumber(convertType(src.getDoseNumber())); + if (src.hasSeriesDoses()) + tgt.setSeriesDoses(convertType(src.getSeriesDoses())); + for (org.hl7.fhir.r4.model.Reference t : src.getSupportingImmunization()) + tgt.addSupportingImmunization(convertReference(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getSupportingPatientInformation()) + tgt.addSupportingPatientInformation(convertReference(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.ImmunizationRecommendation.ImmunizationRecommendationRecommendationComponent convertImmunizationRecommendationRecommendationComponent(org.hl7.fhir.r5.model.ImmunizationRecommendation.ImmunizationRecommendationRecommendationComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.ImmunizationRecommendation.ImmunizationRecommendationRecommendationComponent tgt = new org.hl7.fhir.r4.model.ImmunizationRecommendation.ImmunizationRecommendationRecommendationComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getVaccineCode()) + tgt.addVaccineCode(convertCodeableConcept(t)); + if (src.hasTargetDisease()) + tgt.setTargetDisease(convertCodeableConcept(src.getTargetDisease())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getContraindicatedVaccineCode()) + tgt.addContraindicatedVaccineCode(convertCodeableConcept(t)); + if (src.hasForecastStatus()) + tgt.setForecastStatus(convertCodeableConcept(src.getForecastStatus())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getForecastReason()) + tgt.addForecastReason(convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.ImmunizationRecommendation.ImmunizationRecommendationRecommendationDateCriterionComponent t : src.getDateCriterion()) + tgt.addDateCriterion(convertImmunizationRecommendationRecommendationDateCriterionComponent(t)); + if (src.hasDescription()) + tgt.setDescriptionElement(convertString(src.getDescriptionElement())); + if (src.hasSeries()) + tgt.setSeriesElement(convertString(src.getSeriesElement())); + if (src.hasDoseNumber()) + tgt.setDoseNumber(convertType(src.getDoseNumber())); + if (src.hasSeriesDoses()) + tgt.setSeriesDoses(convertType(src.getSeriesDoses())); + for (org.hl7.fhir.r5.model.Reference t : src.getSupportingImmunization()) + tgt.addSupportingImmunization(convertReference(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getSupportingPatientInformation()) + tgt.addSupportingPatientInformation(convertReference(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.ImmunizationRecommendation.ImmunizationRecommendationRecommendationDateCriterionComponent convertImmunizationRecommendationRecommendationDateCriterionComponent(org.hl7.fhir.r4.model.ImmunizationRecommendation.ImmunizationRecommendationRecommendationDateCriterionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ImmunizationRecommendation.ImmunizationRecommendationRecommendationDateCriterionComponent tgt = new org.hl7.fhir.r5.model.ImmunizationRecommendation.ImmunizationRecommendationRecommendationDateCriterionComponent(); + copyElement(src, tgt); + if (src.hasCode()) + tgt.setCode(convertCodeableConcept(src.getCode())); + if (src.hasValue()) + tgt.setValueElement(convertDateTime(src.getValueElement())); + return tgt; + } + + public static org.hl7.fhir.r4.model.ImmunizationRecommendation.ImmunizationRecommendationRecommendationDateCriterionComponent convertImmunizationRecommendationRecommendationDateCriterionComponent(org.hl7.fhir.r5.model.ImmunizationRecommendation.ImmunizationRecommendationRecommendationDateCriterionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.ImmunizationRecommendation.ImmunizationRecommendationRecommendationDateCriterionComponent tgt = new org.hl7.fhir.r4.model.ImmunizationRecommendation.ImmunizationRecommendationRecommendationDateCriterionComponent(); + copyElement(src, tgt); + if (src.hasCode()) + tgt.setCode(convertCodeableConcept(src.getCode())); + if (src.hasValue()) + tgt.setValueElement(convertDateTime(src.getValueElement())); + return tgt; + } + + +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/ImplementationGuide.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/ImplementationGuide.java new file mode 100644 index 000000000..b3e706fd7 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/ImplementationGuide.java @@ -0,0 +1,1235 @@ +package org.hl7.fhir.convertors.conv40_50; + +import org.hl7.fhir.exceptions.FHIRException; + +import org.hl7.fhir.convertors.VersionConvertor_40_50; + + +/* + Copyright (c) 2011+, HL7, Inc. + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of HL7 nor the names of its contributors may be used to + endorse or promote products derived from this software without specific + prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + +*/ + +// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0 + + +public class ImplementationGuide extends VersionConvertor_40_50 { + + public static org.hl7.fhir.r5.model.ImplementationGuide convertImplementationGuide(org.hl7.fhir.r4.model.ImplementationGuide src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ImplementationGuide tgt = new org.hl7.fhir.r5.model.ImplementationGuide(); + copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrlElement(convertUri(src.getUrlElement())); + if (src.hasVersion()) + tgt.setVersionElement(convertString(src.getVersionElement())); + if (src.hasName()) + tgt.setNameElement(convertString(src.getNameElement())); + if (src.hasTitle()) + tgt.setTitleElement(convertString(src.getTitleElement())); + if (src.hasStatus()) + tgt.setStatus(Enumerations.convertPublicationStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimentalElement(convertBoolean(src.getExperimentalElement())); + if (src.hasDate()) + tgt.setDateElement(convertDateTime(src.getDateElement())); + if (src.hasPublisher()) + tgt.setPublisherElement(convertString(src.getPublisherElement())); + for (org.hl7.fhir.r4.model.ContactDetail t : src.getContact()) + tgt.addContact(convertContactDetail(t)); + if (src.hasDescription()) + tgt.setDescriptionElement(convertMarkdown(src.getDescriptionElement())); + for (org.hl7.fhir.r4.model.UsageContext t : src.getUseContext()) + tgt.addUseContext(convertUsageContext(t)); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getJurisdiction()) + tgt.addJurisdiction(convertCodeableConcept(t)); + if (src.hasCopyright()) + tgt.setCopyrightElement(convertMarkdown(src.getCopyrightElement())); + if (src.hasPackageId()) + tgt.setPackageIdElement(convertId(src.getPackageIdElement())); + if (src.hasLicense()) + tgt.setLicense(convertSPDXLicense(src.getLicense())); + for (org.hl7.fhir.r4.model.Enumeration t : src.getFhirVersion()) + tgt.addFhirVersion(Enumerations.convertFHIRVersion(t.getValue())); + for (org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideDependsOnComponent t : src.getDependsOn()) + tgt.addDependsOn(convertImplementationGuideDependsOnComponent(t)); + for (org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideGlobalComponent t : src.getGlobal()) + tgt.addGlobal(convertImplementationGuideGlobalComponent(t)); + if (src.hasDefinition()) + tgt.setDefinition(convertImplementationGuideDefinitionComponent(src.getDefinition())); + if (src.hasManifest()) + tgt.setManifest(convertImplementationGuideManifestComponent(src.getManifest())); + return tgt; + } + + public static org.hl7.fhir.r4.model.ImplementationGuide convertImplementationGuide(org.hl7.fhir.r5.model.ImplementationGuide src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.ImplementationGuide tgt = new org.hl7.fhir.r4.model.ImplementationGuide(); + copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrlElement(convertUri(src.getUrlElement())); + if (src.hasVersion()) + tgt.setVersionElement(convertString(src.getVersionElement())); + if (src.hasName()) + tgt.setNameElement(convertString(src.getNameElement())); + if (src.hasTitle()) + tgt.setTitleElement(convertString(src.getTitleElement())); + if (src.hasStatus()) + tgt.setStatus(Enumerations.convertPublicationStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimentalElement(convertBoolean(src.getExperimentalElement())); + if (src.hasDate()) + tgt.setDateElement(convertDateTime(src.getDateElement())); + if (src.hasPublisher()) + tgt.setPublisherElement(convertString(src.getPublisherElement())); + for (org.hl7.fhir.r5.model.ContactDetail t : src.getContact()) + tgt.addContact(convertContactDetail(t)); + if (src.hasDescription()) + tgt.setDescriptionElement(convertMarkdown(src.getDescriptionElement())); + for (org.hl7.fhir.r5.model.UsageContext t : src.getUseContext()) + tgt.addUseContext(convertUsageContext(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getJurisdiction()) + tgt.addJurisdiction(convertCodeableConcept(t)); + if (src.hasCopyright()) + tgt.setCopyrightElement(convertMarkdown(src.getCopyrightElement())); + if (src.hasPackageId()) + tgt.setPackageIdElement(convertId(src.getPackageIdElement())); + if (src.hasLicense()) + tgt.setLicense(convertSPDXLicense(src.getLicense())); + for (org.hl7.fhir.r5.model.Enumeration t : src.getFhirVersion()) + tgt.addFhirVersion(Enumerations.convertFHIRVersion(t.getValue())); + for (org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDependsOnComponent t : src.getDependsOn()) + tgt.addDependsOn(convertImplementationGuideDependsOnComponent(t)); + for (org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideGlobalComponent t : src.getGlobal()) + tgt.addGlobal(convertImplementationGuideGlobalComponent(t)); + if (src.hasDefinition()) + tgt.setDefinition(convertImplementationGuideDefinitionComponent(src.getDefinition())); + if (src.hasManifest()) + tgt.setManifest(convertImplementationGuideManifestComponent(src.getManifest())); + return tgt; + } + + public static org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense convertSPDXLicense(org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case NOTOPENSOURCE: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.NOTOPENSOURCE; + case _0BSD: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense._0BSD; + case AAL: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.AAL; + case ABSTYLES: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.ABSTYLES; + case ADOBE2006: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.ADOBE2006; + case ADOBEGLYPH: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.ADOBEGLYPH; + case ADSL: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.ADSL; + case AFL1_1: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.AFL1_1; + case AFL1_2: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.AFL1_2; + case AFL2_0: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.AFL2_0; + case AFL2_1: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.AFL2_1; + case AFL3_0: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.AFL3_0; + case AFMPARSE: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.AFMPARSE; + case AGPL1_0ONLY: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.AGPL1_0ONLY; + case AGPL1_0ORLATER: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.AGPL1_0ORLATER; + case AGPL3_0ONLY: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.AGPL3_0ONLY; + case AGPL3_0ORLATER: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.AGPL3_0ORLATER; + case ALADDIN: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.ALADDIN; + case AMDPLPA: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.AMDPLPA; + case AML: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.AML; + case AMPAS: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.AMPAS; + case ANTLRPD: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.ANTLRPD; + case APACHE1_0: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.APACHE1_0; + case APACHE1_1: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.APACHE1_1; + case APACHE2_0: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.APACHE2_0; + case APAFML: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.APAFML; + case APL1_0: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.APL1_0; + case APSL1_0: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.APSL1_0; + case APSL1_1: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.APSL1_1; + case APSL1_2: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.APSL1_2; + case APSL2_0: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.APSL2_0; + case ARTISTIC1_0CL8: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.ARTISTIC1_0CL8; + case ARTISTIC1_0PERL: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.ARTISTIC1_0PERL; + case ARTISTIC1_0: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.ARTISTIC1_0; + case ARTISTIC2_0: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.ARTISTIC2_0; + case BAHYPH: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.BAHYPH; + case BARR: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.BARR; + case BEERWARE: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.BEERWARE; + case BITTORRENT1_0: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.BITTORRENT1_0; + case BITTORRENT1_1: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.BITTORRENT1_1; + case BORCEUX: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.BORCEUX; + case BSD1CLAUSE: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.BSD1CLAUSE; + case BSD2CLAUSEFREEBSD: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.BSD2CLAUSEFREEBSD; + case BSD2CLAUSENETBSD: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.BSD2CLAUSENETBSD; + case BSD2CLAUSEPATENT: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.BSD2CLAUSEPATENT; + case BSD2CLAUSE: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.BSD2CLAUSE; + case BSD3CLAUSEATTRIBUTION: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.BSD3CLAUSEATTRIBUTION; + case BSD3CLAUSECLEAR: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.BSD3CLAUSECLEAR; + case BSD3CLAUSELBNL: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.BSD3CLAUSELBNL; + case BSD3CLAUSENONUCLEARLICENSE2014: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.BSD3CLAUSENONUCLEARLICENSE2014; + case BSD3CLAUSENONUCLEARLICENSE: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.BSD3CLAUSENONUCLEARLICENSE; + case BSD3CLAUSENONUCLEARWARRANTY: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.BSD3CLAUSENONUCLEARWARRANTY; + case BSD3CLAUSE: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.BSD3CLAUSE; + case BSD4CLAUSEUC: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.BSD4CLAUSEUC; + case BSD4CLAUSE: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.BSD4CLAUSE; + case BSDPROTECTION: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.BSDPROTECTION; + case BSDSOURCECODE: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.BSDSOURCECODE; + case BSL1_0: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.BSL1_0; + case BZIP21_0_5: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.BZIP21_0_5; + case BZIP21_0_6: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.BZIP21_0_6; + case CALDERA: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.CALDERA; + case CATOSL1_1: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.CATOSL1_1; + case CCBY1_0: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.CCBY1_0; + case CCBY2_0: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.CCBY2_0; + case CCBY2_5: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.CCBY2_5; + case CCBY3_0: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.CCBY3_0; + case CCBY4_0: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.CCBY4_0; + case CCBYNC1_0: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.CCBYNC1_0; + case CCBYNC2_0: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.CCBYNC2_0; + case CCBYNC2_5: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.CCBYNC2_5; + case CCBYNC3_0: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.CCBYNC3_0; + case CCBYNC4_0: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.CCBYNC4_0; + case CCBYNCND1_0: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.CCBYNCND1_0; + case CCBYNCND2_0: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.CCBYNCND2_0; + case CCBYNCND2_5: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.CCBYNCND2_5; + case CCBYNCND3_0: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.CCBYNCND3_0; + case CCBYNCND4_0: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.CCBYNCND4_0; + case CCBYNCSA1_0: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.CCBYNCSA1_0; + case CCBYNCSA2_0: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.CCBYNCSA2_0; + case CCBYNCSA2_5: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.CCBYNCSA2_5; + case CCBYNCSA3_0: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.CCBYNCSA3_0; + case CCBYNCSA4_0: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.CCBYNCSA4_0; + case CCBYND1_0: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.CCBYND1_0; + case CCBYND2_0: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.CCBYND2_0; + case CCBYND2_5: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.CCBYND2_5; + case CCBYND3_0: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.CCBYND3_0; + case CCBYND4_0: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.CCBYND4_0; + case CCBYSA1_0: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.CCBYSA1_0; + case CCBYSA2_0: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.CCBYSA2_0; + case CCBYSA2_5: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.CCBYSA2_5; + case CCBYSA3_0: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.CCBYSA3_0; + case CCBYSA4_0: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.CCBYSA4_0; + case CC01_0: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.CC01_0; + case CDDL1_0: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.CDDL1_0; + case CDDL1_1: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.CDDL1_1; + case CDLAPERMISSIVE1_0: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.CDLAPERMISSIVE1_0; + case CDLASHARING1_0: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.CDLASHARING1_0; + case CECILL1_0: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.CECILL1_0; + case CECILL1_1: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.CECILL1_1; + case CECILL2_0: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.CECILL2_0; + case CECILL2_1: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.CECILL2_1; + case CECILLB: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.CECILLB; + case CECILLC: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.CECILLC; + case CLARTISTIC: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.CLARTISTIC; + case CNRIJYTHON: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.CNRIJYTHON; + case CNRIPYTHONGPLCOMPATIBLE: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.CNRIPYTHONGPLCOMPATIBLE; + case CNRIPYTHON: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.CNRIPYTHON; + case CONDOR1_1: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.CONDOR1_1; + case CPAL1_0: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.CPAL1_0; + case CPL1_0: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.CPL1_0; + case CPOL1_02: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.CPOL1_02; + case CROSSWORD: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.CROSSWORD; + case CRYSTALSTACKER: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.CRYSTALSTACKER; + case CUAOPL1_0: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.CUAOPL1_0; + case CUBE: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.CUBE; + case CURL: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.CURL; + case DFSL1_0: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.DFSL1_0; + case DIFFMARK: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.DIFFMARK; + case DOC: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.DOC; + case DOTSEQN: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.DOTSEQN; + case DSDP: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.DSDP; + case DVIPDFM: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.DVIPDFM; + case ECL1_0: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.ECL1_0; + case ECL2_0: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.ECL2_0; + case EFL1_0: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.EFL1_0; + case EFL2_0: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.EFL2_0; + case EGENIX: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.EGENIX; + case ENTESSA: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.ENTESSA; + case EPL1_0: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.EPL1_0; + case EPL2_0: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.EPL2_0; + case ERLPL1_1: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.ERLPL1_1; + case EUDATAGRID: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.EUDATAGRID; + case EUPL1_0: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.EUPL1_0; + case EUPL1_1: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.EUPL1_1; + case EUPL1_2: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.EUPL1_2; + case EUROSYM: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.EUROSYM; + case FAIR: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.FAIR; + case FRAMEWORX1_0: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.FRAMEWORX1_0; + case FREEIMAGE: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.FREEIMAGE; + case FSFAP: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.FSFAP; + case FSFUL: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.FSFUL; + case FSFULLR: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.FSFULLR; + case FTL: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.FTL; + case GFDL1_1ONLY: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.GFDL1_1ONLY; + case GFDL1_1ORLATER: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.GFDL1_1ORLATER; + case GFDL1_2ONLY: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.GFDL1_2ONLY; + case GFDL1_2ORLATER: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.GFDL1_2ORLATER; + case GFDL1_3ONLY: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.GFDL1_3ONLY; + case GFDL1_3ORLATER: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.GFDL1_3ORLATER; + case GIFTWARE: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.GIFTWARE; + case GL2PS: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.GL2PS; + case GLIDE: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.GLIDE; + case GLULXE: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.GLULXE; + case GNUPLOT: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.GNUPLOT; + case GPL1_0ONLY: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.GPL1_0ONLY; + case GPL1_0ORLATER: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.GPL1_0ORLATER; + case GPL2_0ONLY: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.GPL2_0ONLY; + case GPL2_0ORLATER: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.GPL2_0ORLATER; + case GPL3_0ONLY: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.GPL3_0ONLY; + case GPL3_0ORLATER: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.GPL3_0ORLATER; + case GSOAP1_3B: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.GSOAP1_3B; + case HASKELLREPORT: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.HASKELLREPORT; + case HPND: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.HPND; + case IBMPIBS: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.IBMPIBS; + case ICU: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.ICU; + case IJG: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.IJG; + case IMAGEMAGICK: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.IMAGEMAGICK; + case IMATIX: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.IMATIX; + case IMLIB2: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.IMLIB2; + case INFOZIP: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.INFOZIP; + case INTELACPI: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.INTELACPI; + case INTEL: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.INTEL; + case INTERBASE1_0: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.INTERBASE1_0; + case IPA: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.IPA; + case IPL1_0: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.IPL1_0; + case ISC: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.ISC; + case JASPER2_0: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.JASPER2_0; + case JSON: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.JSON; + case LAL1_2: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.LAL1_2; + case LAL1_3: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.LAL1_3; + case LATEX2E: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.LATEX2E; + case LEPTONICA: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.LEPTONICA; + case LGPL2_0ONLY: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.LGPL2_0ONLY; + case LGPL2_0ORLATER: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.LGPL2_0ORLATER; + case LGPL2_1ONLY: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.LGPL2_1ONLY; + case LGPL2_1ORLATER: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.LGPL2_1ORLATER; + case LGPL3_0ONLY: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.LGPL3_0ONLY; + case LGPL3_0ORLATER: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.LGPL3_0ORLATER; + case LGPLLR: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.LGPLLR; + case LIBPNG: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.LIBPNG; + case LIBTIFF: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.LIBTIFF; + case LILIQP1_1: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.LILIQP1_1; + case LILIQR1_1: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.LILIQR1_1; + case LILIQRPLUS1_1: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.LILIQRPLUS1_1; + case LINUXOPENIB: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.LINUXOPENIB; + case LPL1_0: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.LPL1_0; + case LPL1_02: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.LPL1_02; + case LPPL1_0: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.LPPL1_0; + case LPPL1_1: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.LPPL1_1; + case LPPL1_2: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.LPPL1_2; + case LPPL1_3A: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.LPPL1_3A; + case LPPL1_3C: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.LPPL1_3C; + case MAKEINDEX: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.MAKEINDEX; + case MIROS: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.MIROS; + case MIT0: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.MIT0; + case MITADVERTISING: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.MITADVERTISING; + case MITCMU: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.MITCMU; + case MITENNA: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.MITENNA; + case MITFEH: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.MITFEH; + case MIT: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.MIT; + case MITNFA: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.MITNFA; + case MOTOSOTO: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.MOTOSOTO; + case MPICH2: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.MPICH2; + case MPL1_0: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.MPL1_0; + case MPL1_1: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.MPL1_1; + case MPL2_0NOCOPYLEFTEXCEPTION: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.MPL2_0NOCOPYLEFTEXCEPTION; + case MPL2_0: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.MPL2_0; + case MSPL: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.MSPL; + case MSRL: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.MSRL; + case MTLL: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.MTLL; + case MULTICS: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.MULTICS; + case MUP: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.MUP; + case NASA1_3: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.NASA1_3; + case NAUMEN: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.NAUMEN; + case NBPL1_0: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.NBPL1_0; + case NCSA: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.NCSA; + case NETSNMP: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.NETSNMP; + case NETCDF: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.NETCDF; + case NEWSLETR: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.NEWSLETR; + case NGPL: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.NGPL; + case NLOD1_0: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.NLOD1_0; + case NLPL: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.NLPL; + case NOKIA: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.NOKIA; + case NOSL: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.NOSL; + case NOWEB: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.NOWEB; + case NPL1_0: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.NPL1_0; + case NPL1_1: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.NPL1_1; + case NPOSL3_0: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.NPOSL3_0; + case NRL: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.NRL; + case NTP: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.NTP; + case OCCTPL: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.OCCTPL; + case OCLC2_0: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.OCLC2_0; + case ODBL1_0: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.ODBL1_0; + case OFL1_0: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.OFL1_0; + case OFL1_1: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.OFL1_1; + case OGTSL: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.OGTSL; + case OLDAP1_1: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.OLDAP1_1; + case OLDAP1_2: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.OLDAP1_2; + case OLDAP1_3: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.OLDAP1_3; + case OLDAP1_4: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.OLDAP1_4; + case OLDAP2_0_1: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.OLDAP2_0_1; + case OLDAP2_0: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.OLDAP2_0; + case OLDAP2_1: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.OLDAP2_1; + case OLDAP2_2_1: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.OLDAP2_2_1; + case OLDAP2_2_2: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.OLDAP2_2_2; + case OLDAP2_2: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.OLDAP2_2; + case OLDAP2_3: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.OLDAP2_3; + case OLDAP2_4: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.OLDAP2_4; + case OLDAP2_5: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.OLDAP2_5; + case OLDAP2_6: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.OLDAP2_6; + case OLDAP2_7: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.OLDAP2_7; + case OLDAP2_8: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.OLDAP2_8; + case OML: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.OML; + case OPENSSL: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.OPENSSL; + case OPL1_0: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.OPL1_0; + case OSETPL2_1: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.OSETPL2_1; + case OSL1_0: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.OSL1_0; + case OSL1_1: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.OSL1_1; + case OSL2_0: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.OSL2_0; + case OSL2_1: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.OSL2_1; + case OSL3_0: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.OSL3_0; + case PDDL1_0: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.PDDL1_0; + case PHP3_0: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.PHP3_0; + case PHP3_01: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.PHP3_01; + case PLEXUS: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.PLEXUS; + case POSTGRESQL: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.POSTGRESQL; + case PSFRAG: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.PSFRAG; + case PSUTILS: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.PSUTILS; + case PYTHON2_0: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.PYTHON2_0; + case QHULL: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.QHULL; + case QPL1_0: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.QPL1_0; + case RDISC: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.RDISC; + case RHECOS1_1: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.RHECOS1_1; + case RPL1_1: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.RPL1_1; + case RPL1_5: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.RPL1_5; + case RPSL1_0: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.RPSL1_0; + case RSAMD: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.RSAMD; + case RSCPL: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.RSCPL; + case RUBY: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.RUBY; + case SAXPD: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.SAXPD; + case SAXPATH: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.SAXPATH; + case SCEA: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.SCEA; + case SENDMAIL: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.SENDMAIL; + case SGIB1_0: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.SGIB1_0; + case SGIB1_1: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.SGIB1_1; + case SGIB2_0: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.SGIB2_0; + case SIMPL2_0: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.SIMPL2_0; + case SISSL1_2: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.SISSL1_2; + case SISSL: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.SISSL; + case SLEEPYCAT: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.SLEEPYCAT; + case SMLNJ: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.SMLNJ; + case SMPPL: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.SMPPL; + case SNIA: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.SNIA; + case SPENCER86: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.SPENCER86; + case SPENCER94: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.SPENCER94; + case SPENCER99: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.SPENCER99; + case SPL1_0: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.SPL1_0; + case SUGARCRM1_1_3: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.SUGARCRM1_1_3; + case SWL: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.SWL; + case TCL: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.TCL; + case TCPWRAPPERS: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.TCPWRAPPERS; + case TMATE: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.TMATE; + case TORQUE1_1: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.TORQUE1_1; + case TOSL: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.TOSL; + case UNICODEDFS2015: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.UNICODEDFS2015; + case UNICODEDFS2016: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.UNICODEDFS2016; + case UNICODETOU: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.UNICODETOU; + case UNLICENSE: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.UNLICENSE; + case UPL1_0: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.UPL1_0; + case VIM: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.VIM; + case VOSTROM: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.VOSTROM; + case VSL1_0: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.VSL1_0; + case W3C19980720: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.W3C19980720; + case W3C20150513: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.W3C20150513; + case W3C: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.W3C; + case WATCOM1_0: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.WATCOM1_0; + case WSUIPA: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.WSUIPA; + case WTFPL: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.WTFPL; + case X11: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.X11; + case XEROX: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.XEROX; + case XFREE861_1: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.XFREE861_1; + case XINETD: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.XINETD; + case XNET: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.XNET; + case XPP: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.XPP; + case XSKAT: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.XSKAT; + case YPL1_0: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.YPL1_0; + case YPL1_1: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.YPL1_1; + case ZED: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.ZED; + case ZEND2_0: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.ZEND2_0; + case ZIMBRA1_3: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.ZIMBRA1_3; + case ZIMBRA1_4: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.ZIMBRA1_4; + case ZLIBACKNOWLEDGEMENT: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.ZLIBACKNOWLEDGEMENT; + case ZLIB: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.ZLIB; + case ZPL1_1: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.ZPL1_1; + case ZPL2_0: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.ZPL2_0; + case ZPL2_1: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.ZPL2_1; + default: return org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense.NULL; + } +} + + public static org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense convertSPDXLicense(org.hl7.fhir.r5.model.ImplementationGuide.SPDXLicense src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case NOTOPENSOURCE: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.NOTOPENSOURCE; + case _0BSD: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense._0BSD; + case AAL: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.AAL; + case ABSTYLES: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.ABSTYLES; + case ADOBE2006: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.ADOBE2006; + case ADOBEGLYPH: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.ADOBEGLYPH; + case ADSL: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.ADSL; + case AFL1_1: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.AFL1_1; + case AFL1_2: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.AFL1_2; + case AFL2_0: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.AFL2_0; + case AFL2_1: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.AFL2_1; + case AFL3_0: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.AFL3_0; + case AFMPARSE: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.AFMPARSE; + case AGPL1_0ONLY: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.AGPL1_0ONLY; + case AGPL1_0ORLATER: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.AGPL1_0ORLATER; + case AGPL3_0ONLY: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.AGPL3_0ONLY; + case AGPL3_0ORLATER: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.AGPL3_0ORLATER; + case ALADDIN: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.ALADDIN; + case AMDPLPA: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.AMDPLPA; + case AML: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.AML; + case AMPAS: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.AMPAS; + case ANTLRPD: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.ANTLRPD; + case APACHE1_0: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.APACHE1_0; + case APACHE1_1: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.APACHE1_1; + case APACHE2_0: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.APACHE2_0; + case APAFML: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.APAFML; + case APL1_0: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.APL1_0; + case APSL1_0: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.APSL1_0; + case APSL1_1: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.APSL1_1; + case APSL1_2: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.APSL1_2; + case APSL2_0: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.APSL2_0; + case ARTISTIC1_0CL8: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.ARTISTIC1_0CL8; + case ARTISTIC1_0PERL: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.ARTISTIC1_0PERL; + case ARTISTIC1_0: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.ARTISTIC1_0; + case ARTISTIC2_0: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.ARTISTIC2_0; + case BAHYPH: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.BAHYPH; + case BARR: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.BARR; + case BEERWARE: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.BEERWARE; + case BITTORRENT1_0: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.BITTORRENT1_0; + case BITTORRENT1_1: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.BITTORRENT1_1; + case BORCEUX: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.BORCEUX; + case BSD1CLAUSE: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.BSD1CLAUSE; + case BSD2CLAUSEFREEBSD: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.BSD2CLAUSEFREEBSD; + case BSD2CLAUSENETBSD: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.BSD2CLAUSENETBSD; + case BSD2CLAUSEPATENT: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.BSD2CLAUSEPATENT; + case BSD2CLAUSE: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.BSD2CLAUSE; + case BSD3CLAUSEATTRIBUTION: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.BSD3CLAUSEATTRIBUTION; + case BSD3CLAUSECLEAR: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.BSD3CLAUSECLEAR; + case BSD3CLAUSELBNL: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.BSD3CLAUSELBNL; + case BSD3CLAUSENONUCLEARLICENSE2014: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.BSD3CLAUSENONUCLEARLICENSE2014; + case BSD3CLAUSENONUCLEARLICENSE: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.BSD3CLAUSENONUCLEARLICENSE; + case BSD3CLAUSENONUCLEARWARRANTY: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.BSD3CLAUSENONUCLEARWARRANTY; + case BSD3CLAUSE: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.BSD3CLAUSE; + case BSD4CLAUSEUC: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.BSD4CLAUSEUC; + case BSD4CLAUSE: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.BSD4CLAUSE; + case BSDPROTECTION: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.BSDPROTECTION; + case BSDSOURCECODE: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.BSDSOURCECODE; + case BSL1_0: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.BSL1_0; + case BZIP21_0_5: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.BZIP21_0_5; + case BZIP21_0_6: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.BZIP21_0_6; + case CALDERA: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.CALDERA; + case CATOSL1_1: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.CATOSL1_1; + case CCBY1_0: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.CCBY1_0; + case CCBY2_0: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.CCBY2_0; + case CCBY2_5: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.CCBY2_5; + case CCBY3_0: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.CCBY3_0; + case CCBY4_0: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.CCBY4_0; + case CCBYNC1_0: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.CCBYNC1_0; + case CCBYNC2_0: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.CCBYNC2_0; + case CCBYNC2_5: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.CCBYNC2_5; + case CCBYNC3_0: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.CCBYNC3_0; + case CCBYNC4_0: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.CCBYNC4_0; + case CCBYNCND1_0: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.CCBYNCND1_0; + case CCBYNCND2_0: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.CCBYNCND2_0; + case CCBYNCND2_5: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.CCBYNCND2_5; + case CCBYNCND3_0: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.CCBYNCND3_0; + case CCBYNCND4_0: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.CCBYNCND4_0; + case CCBYNCSA1_0: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.CCBYNCSA1_0; + case CCBYNCSA2_0: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.CCBYNCSA2_0; + case CCBYNCSA2_5: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.CCBYNCSA2_5; + case CCBYNCSA3_0: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.CCBYNCSA3_0; + case CCBYNCSA4_0: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.CCBYNCSA4_0; + case CCBYND1_0: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.CCBYND1_0; + case CCBYND2_0: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.CCBYND2_0; + case CCBYND2_5: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.CCBYND2_5; + case CCBYND3_0: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.CCBYND3_0; + case CCBYND4_0: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.CCBYND4_0; + case CCBYSA1_0: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.CCBYSA1_0; + case CCBYSA2_0: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.CCBYSA2_0; + case CCBYSA2_5: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.CCBYSA2_5; + case CCBYSA3_0: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.CCBYSA3_0; + case CCBYSA4_0: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.CCBYSA4_0; + case CC01_0: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.CC01_0; + case CDDL1_0: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.CDDL1_0; + case CDDL1_1: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.CDDL1_1; + case CDLAPERMISSIVE1_0: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.CDLAPERMISSIVE1_0; + case CDLASHARING1_0: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.CDLASHARING1_0; + case CECILL1_0: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.CECILL1_0; + case CECILL1_1: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.CECILL1_1; + case CECILL2_0: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.CECILL2_0; + case CECILL2_1: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.CECILL2_1; + case CECILLB: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.CECILLB; + case CECILLC: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.CECILLC; + case CLARTISTIC: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.CLARTISTIC; + case CNRIJYTHON: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.CNRIJYTHON; + case CNRIPYTHONGPLCOMPATIBLE: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.CNRIPYTHONGPLCOMPATIBLE; + case CNRIPYTHON: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.CNRIPYTHON; + case CONDOR1_1: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.CONDOR1_1; + case CPAL1_0: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.CPAL1_0; + case CPL1_0: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.CPL1_0; + case CPOL1_02: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.CPOL1_02; + case CROSSWORD: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.CROSSWORD; + case CRYSTALSTACKER: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.CRYSTALSTACKER; + case CUAOPL1_0: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.CUAOPL1_0; + case CUBE: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.CUBE; + case CURL: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.CURL; + case DFSL1_0: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.DFSL1_0; + case DIFFMARK: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.DIFFMARK; + case DOC: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.DOC; + case DOTSEQN: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.DOTSEQN; + case DSDP: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.DSDP; + case DVIPDFM: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.DVIPDFM; + case ECL1_0: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.ECL1_0; + case ECL2_0: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.ECL2_0; + case EFL1_0: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.EFL1_0; + case EFL2_0: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.EFL2_0; + case EGENIX: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.EGENIX; + case ENTESSA: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.ENTESSA; + case EPL1_0: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.EPL1_0; + case EPL2_0: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.EPL2_0; + case ERLPL1_1: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.ERLPL1_1; + case EUDATAGRID: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.EUDATAGRID; + case EUPL1_0: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.EUPL1_0; + case EUPL1_1: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.EUPL1_1; + case EUPL1_2: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.EUPL1_2; + case EUROSYM: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.EUROSYM; + case FAIR: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.FAIR; + case FRAMEWORX1_0: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.FRAMEWORX1_0; + case FREEIMAGE: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.FREEIMAGE; + case FSFAP: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.FSFAP; + case FSFUL: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.FSFUL; + case FSFULLR: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.FSFULLR; + case FTL: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.FTL; + case GFDL1_1ONLY: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.GFDL1_1ONLY; + case GFDL1_1ORLATER: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.GFDL1_1ORLATER; + case GFDL1_2ONLY: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.GFDL1_2ONLY; + case GFDL1_2ORLATER: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.GFDL1_2ORLATER; + case GFDL1_3ONLY: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.GFDL1_3ONLY; + case GFDL1_3ORLATER: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.GFDL1_3ORLATER; + case GIFTWARE: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.GIFTWARE; + case GL2PS: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.GL2PS; + case GLIDE: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.GLIDE; + case GLULXE: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.GLULXE; + case GNUPLOT: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.GNUPLOT; + case GPL1_0ONLY: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.GPL1_0ONLY; + case GPL1_0ORLATER: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.GPL1_0ORLATER; + case GPL2_0ONLY: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.GPL2_0ONLY; + case GPL2_0ORLATER: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.GPL2_0ORLATER; + case GPL3_0ONLY: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.GPL3_0ONLY; + case GPL3_0ORLATER: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.GPL3_0ORLATER; + case GSOAP1_3B: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.GSOAP1_3B; + case HASKELLREPORT: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.HASKELLREPORT; + case HPND: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.HPND; + case IBMPIBS: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.IBMPIBS; + case ICU: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.ICU; + case IJG: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.IJG; + case IMAGEMAGICK: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.IMAGEMAGICK; + case IMATIX: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.IMATIX; + case IMLIB2: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.IMLIB2; + case INFOZIP: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.INFOZIP; + case INTELACPI: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.INTELACPI; + case INTEL: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.INTEL; + case INTERBASE1_0: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.INTERBASE1_0; + case IPA: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.IPA; + case IPL1_0: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.IPL1_0; + case ISC: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.ISC; + case JASPER2_0: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.JASPER2_0; + case JSON: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.JSON; + case LAL1_2: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.LAL1_2; + case LAL1_3: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.LAL1_3; + case LATEX2E: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.LATEX2E; + case LEPTONICA: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.LEPTONICA; + case LGPL2_0ONLY: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.LGPL2_0ONLY; + case LGPL2_0ORLATER: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.LGPL2_0ORLATER; + case LGPL2_1ONLY: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.LGPL2_1ONLY; + case LGPL2_1ORLATER: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.LGPL2_1ORLATER; + case LGPL3_0ONLY: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.LGPL3_0ONLY; + case LGPL3_0ORLATER: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.LGPL3_0ORLATER; + case LGPLLR: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.LGPLLR; + case LIBPNG: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.LIBPNG; + case LIBTIFF: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.LIBTIFF; + case LILIQP1_1: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.LILIQP1_1; + case LILIQR1_1: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.LILIQR1_1; + case LILIQRPLUS1_1: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.LILIQRPLUS1_1; + case LINUXOPENIB: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.LINUXOPENIB; + case LPL1_0: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.LPL1_0; + case LPL1_02: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.LPL1_02; + case LPPL1_0: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.LPPL1_0; + case LPPL1_1: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.LPPL1_1; + case LPPL1_2: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.LPPL1_2; + case LPPL1_3A: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.LPPL1_3A; + case LPPL1_3C: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.LPPL1_3C; + case MAKEINDEX: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.MAKEINDEX; + case MIROS: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.MIROS; + case MIT0: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.MIT0; + case MITADVERTISING: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.MITADVERTISING; + case MITCMU: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.MITCMU; + case MITENNA: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.MITENNA; + case MITFEH: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.MITFEH; + case MIT: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.MIT; + case MITNFA: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.MITNFA; + case MOTOSOTO: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.MOTOSOTO; + case MPICH2: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.MPICH2; + case MPL1_0: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.MPL1_0; + case MPL1_1: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.MPL1_1; + case MPL2_0NOCOPYLEFTEXCEPTION: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.MPL2_0NOCOPYLEFTEXCEPTION; + case MPL2_0: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.MPL2_0; + case MSPL: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.MSPL; + case MSRL: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.MSRL; + case MTLL: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.MTLL; + case MULTICS: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.MULTICS; + case MUP: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.MUP; + case NASA1_3: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.NASA1_3; + case NAUMEN: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.NAUMEN; + case NBPL1_0: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.NBPL1_0; + case NCSA: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.NCSA; + case NETSNMP: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.NETSNMP; + case NETCDF: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.NETCDF; + case NEWSLETR: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.NEWSLETR; + case NGPL: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.NGPL; + case NLOD1_0: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.NLOD1_0; + case NLPL: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.NLPL; + case NOKIA: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.NOKIA; + case NOSL: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.NOSL; + case NOWEB: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.NOWEB; + case NPL1_0: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.NPL1_0; + case NPL1_1: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.NPL1_1; + case NPOSL3_0: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.NPOSL3_0; + case NRL: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.NRL; + case NTP: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.NTP; + case OCCTPL: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.OCCTPL; + case OCLC2_0: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.OCLC2_0; + case ODBL1_0: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.ODBL1_0; + case OFL1_0: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.OFL1_0; + case OFL1_1: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.OFL1_1; + case OGTSL: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.OGTSL; + case OLDAP1_1: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.OLDAP1_1; + case OLDAP1_2: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.OLDAP1_2; + case OLDAP1_3: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.OLDAP1_3; + case OLDAP1_4: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.OLDAP1_4; + case OLDAP2_0_1: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.OLDAP2_0_1; + case OLDAP2_0: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.OLDAP2_0; + case OLDAP2_1: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.OLDAP2_1; + case OLDAP2_2_1: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.OLDAP2_2_1; + case OLDAP2_2_2: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.OLDAP2_2_2; + case OLDAP2_2: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.OLDAP2_2; + case OLDAP2_3: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.OLDAP2_3; + case OLDAP2_4: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.OLDAP2_4; + case OLDAP2_5: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.OLDAP2_5; + case OLDAP2_6: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.OLDAP2_6; + case OLDAP2_7: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.OLDAP2_7; + case OLDAP2_8: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.OLDAP2_8; + case OML: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.OML; + case OPENSSL: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.OPENSSL; + case OPL1_0: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.OPL1_0; + case OSETPL2_1: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.OSETPL2_1; + case OSL1_0: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.OSL1_0; + case OSL1_1: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.OSL1_1; + case OSL2_0: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.OSL2_0; + case OSL2_1: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.OSL2_1; + case OSL3_0: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.OSL3_0; + case PDDL1_0: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.PDDL1_0; + case PHP3_0: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.PHP3_0; + case PHP3_01: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.PHP3_01; + case PLEXUS: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.PLEXUS; + case POSTGRESQL: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.POSTGRESQL; + case PSFRAG: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.PSFRAG; + case PSUTILS: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.PSUTILS; + case PYTHON2_0: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.PYTHON2_0; + case QHULL: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.QHULL; + case QPL1_0: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.QPL1_0; + case RDISC: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.RDISC; + case RHECOS1_1: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.RHECOS1_1; + case RPL1_1: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.RPL1_1; + case RPL1_5: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.RPL1_5; + case RPSL1_0: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.RPSL1_0; + case RSAMD: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.RSAMD; + case RSCPL: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.RSCPL; + case RUBY: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.RUBY; + case SAXPD: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.SAXPD; + case SAXPATH: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.SAXPATH; + case SCEA: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.SCEA; + case SENDMAIL: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.SENDMAIL; + case SGIB1_0: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.SGIB1_0; + case SGIB1_1: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.SGIB1_1; + case SGIB2_0: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.SGIB2_0; + case SIMPL2_0: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.SIMPL2_0; + case SISSL1_2: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.SISSL1_2; + case SISSL: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.SISSL; + case SLEEPYCAT: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.SLEEPYCAT; + case SMLNJ: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.SMLNJ; + case SMPPL: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.SMPPL; + case SNIA: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.SNIA; + case SPENCER86: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.SPENCER86; + case SPENCER94: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.SPENCER94; + case SPENCER99: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.SPENCER99; + case SPL1_0: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.SPL1_0; + case SUGARCRM1_1_3: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.SUGARCRM1_1_3; + case SWL: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.SWL; + case TCL: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.TCL; + case TCPWRAPPERS: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.TCPWRAPPERS; + case TMATE: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.TMATE; + case TORQUE1_1: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.TORQUE1_1; + case TOSL: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.TOSL; + case UNICODEDFS2015: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.UNICODEDFS2015; + case UNICODEDFS2016: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.UNICODEDFS2016; + case UNICODETOU: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.UNICODETOU; + case UNLICENSE: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.UNLICENSE; + case UPL1_0: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.UPL1_0; + case VIM: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.VIM; + case VOSTROM: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.VOSTROM; + case VSL1_0: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.VSL1_0; + case W3C19980720: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.W3C19980720; + case W3C20150513: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.W3C20150513; + case W3C: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.W3C; + case WATCOM1_0: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.WATCOM1_0; + case WSUIPA: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.WSUIPA; + case WTFPL: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.WTFPL; + case X11: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.X11; + case XEROX: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.XEROX; + case XFREE861_1: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.XFREE861_1; + case XINETD: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.XINETD; + case XNET: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.XNET; + case XPP: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.XPP; + case XSKAT: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.XSKAT; + case YPL1_0: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.YPL1_0; + case YPL1_1: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.YPL1_1; + case ZED: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.ZED; + case ZEND2_0: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.ZEND2_0; + case ZIMBRA1_3: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.ZIMBRA1_3; + case ZIMBRA1_4: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.ZIMBRA1_4; + case ZLIBACKNOWLEDGEMENT: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.ZLIBACKNOWLEDGEMENT; + case ZLIB: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.ZLIB; + case ZPL1_1: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.ZPL1_1; + case ZPL2_0: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.ZPL2_0; + case ZPL2_1: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.ZPL2_1; + default: return org.hl7.fhir.r4.model.ImplementationGuide.SPDXLicense.NULL; + } +} + + public static org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDependsOnComponent convertImplementationGuideDependsOnComponent(org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideDependsOnComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDependsOnComponent tgt = new org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDependsOnComponent(); + copyElement(src, tgt); + if (src.hasUri()) + tgt.setUriElement(convertCanonical(src.getUriElement())); + if (src.hasPackageId()) + tgt.setPackageIdElement(convertId(src.getPackageIdElement())); + if (src.hasVersion()) + tgt.setVersionElement(convertString(src.getVersionElement())); + return tgt; + } + + public static org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideDependsOnComponent convertImplementationGuideDependsOnComponent(org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDependsOnComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideDependsOnComponent tgt = new org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideDependsOnComponent(); + copyElement(src, tgt); + if (src.hasUri()) + tgt.setUriElement(convertCanonical(src.getUriElement())); + if (src.hasPackageId()) + tgt.setPackageIdElement(convertId(src.getPackageIdElement())); + if (src.hasVersion()) + tgt.setVersionElement(convertString(src.getVersionElement())); + return tgt; + } + + public static org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideGlobalComponent convertImplementationGuideGlobalComponent(org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideGlobalComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideGlobalComponent tgt = new org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideGlobalComponent(); + copyElement(src, tgt); + if (src.hasType()) + tgt.setTypeElement(convertCode(src.getTypeElement())); + if (src.hasProfile()) + tgt.setProfileElement(convertCanonical(src.getProfileElement())); + return tgt; + } + + public static org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideGlobalComponent convertImplementationGuideGlobalComponent(org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideGlobalComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideGlobalComponent tgt = new org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideGlobalComponent(); + copyElement(src, tgt); + if (src.hasType()) + tgt.setTypeElement(convertCode(src.getTypeElement())); + if (src.hasProfile()) + tgt.setProfileElement(convertCanonical(src.getProfileElement())); + return tgt; + } + + public static org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionComponent convertImplementationGuideDefinitionComponent(org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideDefinitionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionComponent tgt = new org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideDefinitionGroupingComponent t : src.getGrouping()) + tgt.addGrouping(convertImplementationGuideDefinitionGroupingComponent(t)); + for (org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideDefinitionResourceComponent t : src.getResource()) + tgt.addResource(convertImplementationGuideDefinitionResourceComponent(t)); + if (src.hasPage()) + tgt.setPage(convertImplementationGuideDefinitionPageComponent(src.getPage())); + for (org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideDefinitionParameterComponent t : src.getParameter()) + tgt.addParameter(convertImplementationGuideDefinitionParameterComponent(t)); + for (org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideDefinitionTemplateComponent t : src.getTemplate()) + tgt.addTemplate(convertImplementationGuideDefinitionTemplateComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideDefinitionComponent convertImplementationGuideDefinitionComponent(org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideDefinitionComponent tgt = new org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideDefinitionComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionGroupingComponent t : src.getGrouping()) + tgt.addGrouping(convertImplementationGuideDefinitionGroupingComponent(t)); + for (org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionResourceComponent t : src.getResource()) + tgt.addResource(convertImplementationGuideDefinitionResourceComponent(t)); + if (src.hasPage()) + tgt.setPage(convertImplementationGuideDefinitionPageComponent(src.getPage())); + for (org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionParameterComponent t : src.getParameter()) + tgt.addParameter(convertImplementationGuideDefinitionParameterComponent(t)); + for (org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionTemplateComponent t : src.getTemplate()) + tgt.addTemplate(convertImplementationGuideDefinitionTemplateComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionGroupingComponent convertImplementationGuideDefinitionGroupingComponent(org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideDefinitionGroupingComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionGroupingComponent tgt = new org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionGroupingComponent(); + copyElement(src, tgt); + if (src.hasName()) + tgt.setNameElement(convertString(src.getNameElement())); + if (src.hasDescription()) + tgt.setDescriptionElement(convertString(src.getDescriptionElement())); + return tgt; + } + + public static org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideDefinitionGroupingComponent convertImplementationGuideDefinitionGroupingComponent(org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionGroupingComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideDefinitionGroupingComponent tgt = new org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideDefinitionGroupingComponent(); + copyElement(src, tgt); + if (src.hasName()) + tgt.setNameElement(convertString(src.getNameElement())); + if (src.hasDescription()) + tgt.setDescriptionElement(convertString(src.getDescriptionElement())); + return tgt; + } + + public static org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionResourceComponent convertImplementationGuideDefinitionResourceComponent(org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideDefinitionResourceComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionResourceComponent tgt = new org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionResourceComponent(); + copyElement(src, tgt); + if (src.hasReference()) + tgt.setReference(convertReference(src.getReference())); + for (org.hl7.fhir.r4.model.Enumeration t : src.getFhirVersion()) + tgt.addFhirVersion(Enumerations.convertFHIRVersion(t.getValue())); + if (src.hasName()) + tgt.setNameElement(convertString(src.getNameElement())); + if (src.hasDescription()) + tgt.setDescriptionElement(convertString(src.getDescriptionElement())); + if (src.hasExample()) + tgt.setExample(convertType(src.getExample())); + if (src.hasGroupingId()) + tgt.setGroupingIdElement(convertId(src.getGroupingIdElement())); + return tgt; + } + + public static org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideDefinitionResourceComponent convertImplementationGuideDefinitionResourceComponent(org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionResourceComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideDefinitionResourceComponent tgt = new org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideDefinitionResourceComponent(); + copyElement(src, tgt); + if (src.hasReference()) + tgt.setReference(convertReference(src.getReference())); + for (org.hl7.fhir.r5.model.Enumeration t : src.getFhirVersion()) + tgt.addFhirVersion(Enumerations.convertFHIRVersion(t.getValue())); + if (src.hasName()) + tgt.setNameElement(convertString(src.getNameElement())); + if (src.hasDescription()) + tgt.setDescriptionElement(convertString(src.getDescriptionElement())); + if (src.hasExample()) + tgt.setExample(convertType(src.getExample())); + if (src.hasGroupingId()) + tgt.setGroupingIdElement(convertId(src.getGroupingIdElement())); + return tgt; + } + + public static org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionPageComponent convertImplementationGuideDefinitionPageComponent(org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideDefinitionPageComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionPageComponent tgt = new org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionPageComponent(); + copyElement(src, tgt); + if (src.hasName()) + tgt.setName(convertType(src.getName())); + if (src.hasTitle()) + tgt.setTitleElement(convertString(src.getTitleElement())); + if (src.hasGeneration()) + tgt.setGeneration(convertGuidePageGeneration(src.getGeneration())); + for (org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideDefinitionPageComponent t : src.getPage()) + tgt.addPage(convertImplementationGuideDefinitionPageComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideDefinitionPageComponent convertImplementationGuideDefinitionPageComponent(org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionPageComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideDefinitionPageComponent tgt = new org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideDefinitionPageComponent(); + copyElement(src, tgt); + if (src.hasName()) + tgt.setName(convertType(src.getName())); + if (src.hasTitle()) + tgt.setTitleElement(convertString(src.getTitleElement())); + if (src.hasGeneration()) + tgt.setGeneration(convertGuidePageGeneration(src.getGeneration())); + for (org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionPageComponent t : src.getPage()) + tgt.addPage(convertImplementationGuideDefinitionPageComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.ImplementationGuide.GuidePageGeneration convertGuidePageGeneration(org.hl7.fhir.r4.model.ImplementationGuide.GuidePageGeneration src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case HTML: return org.hl7.fhir.r5.model.ImplementationGuide.GuidePageGeneration.HTML; + case MARKDOWN: return org.hl7.fhir.r5.model.ImplementationGuide.GuidePageGeneration.MARKDOWN; + case XML: return org.hl7.fhir.r5.model.ImplementationGuide.GuidePageGeneration.XML; + case GENERATED: return org.hl7.fhir.r5.model.ImplementationGuide.GuidePageGeneration.GENERATED; + default: return org.hl7.fhir.r5.model.ImplementationGuide.GuidePageGeneration.NULL; + } +} + + public static org.hl7.fhir.r4.model.ImplementationGuide.GuidePageGeneration convertGuidePageGeneration(org.hl7.fhir.r5.model.ImplementationGuide.GuidePageGeneration src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case HTML: return org.hl7.fhir.r4.model.ImplementationGuide.GuidePageGeneration.HTML; + case MARKDOWN: return org.hl7.fhir.r4.model.ImplementationGuide.GuidePageGeneration.MARKDOWN; + case XML: return org.hl7.fhir.r4.model.ImplementationGuide.GuidePageGeneration.XML; + case GENERATED: return org.hl7.fhir.r4.model.ImplementationGuide.GuidePageGeneration.GENERATED; + default: return org.hl7.fhir.r4.model.ImplementationGuide.GuidePageGeneration.NULL; + } +} + + public static org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionParameterComponent convertImplementationGuideDefinitionParameterComponent(org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideDefinitionParameterComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionParameterComponent tgt = new org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionParameterComponent(); + copyElement(src, tgt); + if (src.hasCode()) + tgt.setCode(convertGuideParameterCode(src.getCode())); + if (src.hasValue()) + tgt.setValueElement(convertString(src.getValueElement())); + return tgt; + } + + public static org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideDefinitionParameterComponent convertImplementationGuideDefinitionParameterComponent(org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionParameterComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideDefinitionParameterComponent tgt = new org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideDefinitionParameterComponent(); + copyElement(src, tgt); + if (src.hasCode()) + tgt.setCode(convertGuideParameterCode(src.getCode())); + if (src.hasValue()) + tgt.setValueElement(convertString(src.getValueElement())); + return tgt; + } + + public static org.hl7.fhir.r5.model.ImplementationGuide.GuideParameterCode convertGuideParameterCode(org.hl7.fhir.r4.model.ImplementationGuide.GuideParameterCode src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case APPLY: return org.hl7.fhir.r5.model.ImplementationGuide.GuideParameterCode.APPLY; + case PATHRESOURCE: return org.hl7.fhir.r5.model.ImplementationGuide.GuideParameterCode.PATHRESOURCE; + case PATHPAGES: return org.hl7.fhir.r5.model.ImplementationGuide.GuideParameterCode.PATHPAGES; + case PATHTXCACHE: return org.hl7.fhir.r5.model.ImplementationGuide.GuideParameterCode.PATHTXCACHE; + case EXPANSIONPARAMETER: return org.hl7.fhir.r5.model.ImplementationGuide.GuideParameterCode.EXPANSIONPARAMETER; + case RULEBROKENLINKS: return org.hl7.fhir.r5.model.ImplementationGuide.GuideParameterCode.RULEBROKENLINKS; + case GENERATEXML: return org.hl7.fhir.r5.model.ImplementationGuide.GuideParameterCode.GENERATEXML; + case GENERATEJSON: return org.hl7.fhir.r5.model.ImplementationGuide.GuideParameterCode.GENERATEJSON; + case GENERATETURTLE: return org.hl7.fhir.r5.model.ImplementationGuide.GuideParameterCode.GENERATETURTLE; + case HTMLTEMPLATE: return org.hl7.fhir.r5.model.ImplementationGuide.GuideParameterCode.HTMLTEMPLATE; + default: return org.hl7.fhir.r5.model.ImplementationGuide.GuideParameterCode.NULL; + } +} + + public static org.hl7.fhir.r4.model.ImplementationGuide.GuideParameterCode convertGuideParameterCode(org.hl7.fhir.r5.model.ImplementationGuide.GuideParameterCode src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case APPLY: return org.hl7.fhir.r4.model.ImplementationGuide.GuideParameterCode.APPLY; + case PATHRESOURCE: return org.hl7.fhir.r4.model.ImplementationGuide.GuideParameterCode.PATHRESOURCE; + case PATHPAGES: return org.hl7.fhir.r4.model.ImplementationGuide.GuideParameterCode.PATHPAGES; + case PATHTXCACHE: return org.hl7.fhir.r4.model.ImplementationGuide.GuideParameterCode.PATHTXCACHE; + case EXPANSIONPARAMETER: return org.hl7.fhir.r4.model.ImplementationGuide.GuideParameterCode.EXPANSIONPARAMETER; + case RULEBROKENLINKS: return org.hl7.fhir.r4.model.ImplementationGuide.GuideParameterCode.RULEBROKENLINKS; + case GENERATEXML: return org.hl7.fhir.r4.model.ImplementationGuide.GuideParameterCode.GENERATEXML; + case GENERATEJSON: return org.hl7.fhir.r4.model.ImplementationGuide.GuideParameterCode.GENERATEJSON; + case GENERATETURTLE: return org.hl7.fhir.r4.model.ImplementationGuide.GuideParameterCode.GENERATETURTLE; + case HTMLTEMPLATE: return org.hl7.fhir.r4.model.ImplementationGuide.GuideParameterCode.HTMLTEMPLATE; + default: return org.hl7.fhir.r4.model.ImplementationGuide.GuideParameterCode.NULL; + } +} + + public static org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionTemplateComponent convertImplementationGuideDefinitionTemplateComponent(org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideDefinitionTemplateComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionTemplateComponent tgt = new org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionTemplateComponent(); + copyElement(src, tgt); + if (src.hasCode()) + tgt.setCodeElement(convertCode(src.getCodeElement())); + if (src.hasSource()) + tgt.setSourceElement(convertString(src.getSourceElement())); + if (src.hasScope()) + tgt.setScopeElement(convertString(src.getScopeElement())); + return tgt; + } + + public static org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideDefinitionTemplateComponent convertImplementationGuideDefinitionTemplateComponent(org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionTemplateComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideDefinitionTemplateComponent tgt = new org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideDefinitionTemplateComponent(); + copyElement(src, tgt); + if (src.hasCode()) + tgt.setCodeElement(convertCode(src.getCodeElement())); + if (src.hasSource()) + tgt.setSourceElement(convertString(src.getSourceElement())); + if (src.hasScope()) + tgt.setScopeElement(convertString(src.getScopeElement())); + return tgt; + } + + public static org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideManifestComponent convertImplementationGuideManifestComponent(org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideManifestComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideManifestComponent tgt = new org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideManifestComponent(); + copyElement(src, tgt); + if (src.hasRendering()) + tgt.setRenderingElement(convertUrl(src.getRenderingElement())); + for (org.hl7.fhir.r4.model.ImplementationGuide.ManifestResourceComponent t : src.getResource()) + tgt.addResource(convertManifestResourceComponent(t)); + for (org.hl7.fhir.r4.model.ImplementationGuide.ManifestPageComponent t : src.getPage()) + tgt.addPage(convertManifestPageComponent(t)); + for (org.hl7.fhir.r4.model.StringType t : src.getImage()) + tgt.getImage().add(convertString(t)); + for (org.hl7.fhir.r4.model.StringType t : src.getOther()) + tgt.getOther().add(convertString(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideManifestComponent convertImplementationGuideManifestComponent(org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideManifestComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideManifestComponent tgt = new org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideManifestComponent(); + copyElement(src, tgt); + if (src.hasRendering()) + tgt.setRenderingElement(convertUrl(src.getRenderingElement())); + for (org.hl7.fhir.r5.model.ImplementationGuide.ManifestResourceComponent t : src.getResource()) + tgt.addResource(convertManifestResourceComponent(t)); + for (org.hl7.fhir.r5.model.ImplementationGuide.ManifestPageComponent t : src.getPage()) + tgt.addPage(convertManifestPageComponent(t)); + for (org.hl7.fhir.r5.model.StringType t : src.getImage()) + tgt.getImage().add(convertString(t)); + for (org.hl7.fhir.r5.model.StringType t : src.getOther()) + tgt.getOther().add(convertString(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.ImplementationGuide.ManifestResourceComponent convertManifestResourceComponent(org.hl7.fhir.r4.model.ImplementationGuide.ManifestResourceComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ImplementationGuide.ManifestResourceComponent tgt = new org.hl7.fhir.r5.model.ImplementationGuide.ManifestResourceComponent(); + copyElement(src, tgt); + if (src.hasReference()) + tgt.setReference(convertReference(src.getReference())); + if (src.hasExample()) + tgt.setExample(convertType(src.getExample())); + if (src.hasRelativePath()) + tgt.setRelativePathElement(convertUrl(src.getRelativePathElement())); + return tgt; + } + + public static org.hl7.fhir.r4.model.ImplementationGuide.ManifestResourceComponent convertManifestResourceComponent(org.hl7.fhir.r5.model.ImplementationGuide.ManifestResourceComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.ImplementationGuide.ManifestResourceComponent tgt = new org.hl7.fhir.r4.model.ImplementationGuide.ManifestResourceComponent(); + copyElement(src, tgt); + if (src.hasReference()) + tgt.setReference(convertReference(src.getReference())); + if (src.hasExample()) + tgt.setExample(convertType(src.getExample())); + if (src.hasRelativePath()) + tgt.setRelativePathElement(convertUrl(src.getRelativePathElement())); + return tgt; + } + + public static org.hl7.fhir.r5.model.ImplementationGuide.ManifestPageComponent convertManifestPageComponent(org.hl7.fhir.r4.model.ImplementationGuide.ManifestPageComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ImplementationGuide.ManifestPageComponent tgt = new org.hl7.fhir.r5.model.ImplementationGuide.ManifestPageComponent(); + copyElement(src, tgt); + if (src.hasName()) + tgt.setNameElement(convertString(src.getNameElement())); + if (src.hasTitle()) + tgt.setTitleElement(convertString(src.getTitleElement())); + for (org.hl7.fhir.r4.model.StringType t : src.getAnchor()) + tgt.getAnchor().add(convertString(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.ImplementationGuide.ManifestPageComponent convertManifestPageComponent(org.hl7.fhir.r5.model.ImplementationGuide.ManifestPageComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.ImplementationGuide.ManifestPageComponent tgt = new org.hl7.fhir.r4.model.ImplementationGuide.ManifestPageComponent(); + copyElement(src, tgt); + if (src.hasName()) + tgt.setNameElement(convertString(src.getNameElement())); + if (src.hasTitle()) + tgt.setTitleElement(convertString(src.getTitleElement())); + for (org.hl7.fhir.r5.model.StringType t : src.getAnchor()) + tgt.getAnchor().add(convertString(t)); + return tgt; + } + + +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/InsurancePlan.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/InsurancePlan.java new file mode 100644 index 000000000..39c2a4cbc --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/InsurancePlan.java @@ -0,0 +1,379 @@ +package org.hl7.fhir.convertors.conv40_50; + +import org.hl7.fhir.exceptions.FHIRException; + +import org.hl7.fhir.convertors.VersionConvertor_40_50; + + +/* + Copyright (c) 2011+, HL7, Inc. + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of HL7 nor the names of its contributors may be used to + endorse or promote products derived from this software without specific + prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + +*/ + +// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0 + + +public class InsurancePlan extends VersionConvertor_40_50 { + + public static org.hl7.fhir.r5.model.InsurancePlan convertInsurancePlan(org.hl7.fhir.r4.model.InsurancePlan src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.InsurancePlan tgt = new org.hl7.fhir.r5.model.InsurancePlan(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasStatus()) + tgt.setStatus(Enumerations.convertPublicationStatus(src.getStatus())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getType()) + tgt.addType(convertCodeableConcept(t)); + if (src.hasName()) + tgt.setNameElement(convertString(src.getNameElement())); + for (org.hl7.fhir.r4.model.StringType t : src.getAlias()) + tgt.getAlias().add(convertString(t)); + if (src.hasPeriod()) + tgt.setPeriod(convertPeriod(src.getPeriod())); + if (src.hasOwnedBy()) + tgt.setOwnedBy(convertReference(src.getOwnedBy())); + if (src.hasAdministeredBy()) + tgt.setAdministeredBy(convertReference(src.getAdministeredBy())); + for (org.hl7.fhir.r4.model.Reference t : src.getCoverageArea()) + tgt.addCoverageArea(convertReference(t)); + for (org.hl7.fhir.r4.model.InsurancePlan.InsurancePlanContactComponent t : src.getContact()) + tgt.addContact(convertInsurancePlanContactComponent(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getEndpoint()) + tgt.addEndpoint(convertReference(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getNetwork()) + tgt.addNetwork(convertReference(t)); + for (org.hl7.fhir.r4.model.InsurancePlan.InsurancePlanCoverageComponent t : src.getCoverage()) + tgt.addCoverage(convertInsurancePlanCoverageComponent(t)); + for (org.hl7.fhir.r4.model.InsurancePlan.InsurancePlanPlanComponent t : src.getPlan()) + tgt.addPlan(convertInsurancePlanPlanComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.InsurancePlan convertInsurancePlan(org.hl7.fhir.r5.model.InsurancePlan src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.InsurancePlan tgt = new org.hl7.fhir.r4.model.InsurancePlan(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasStatus()) + tgt.setStatus(Enumerations.convertPublicationStatus(src.getStatus())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getType()) + tgt.addType(convertCodeableConcept(t)); + if (src.hasName()) + tgt.setNameElement(convertString(src.getNameElement())); + for (org.hl7.fhir.r5.model.StringType t : src.getAlias()) + tgt.getAlias().add(convertString(t)); + if (src.hasPeriod()) + tgt.setPeriod(convertPeriod(src.getPeriod())); + if (src.hasOwnedBy()) + tgt.setOwnedBy(convertReference(src.getOwnedBy())); + if (src.hasAdministeredBy()) + tgt.setAdministeredBy(convertReference(src.getAdministeredBy())); + for (org.hl7.fhir.r5.model.Reference t : src.getCoverageArea()) + tgt.addCoverageArea(convertReference(t)); + for (org.hl7.fhir.r5.model.InsurancePlan.InsurancePlanContactComponent t : src.getContact()) + tgt.addContact(convertInsurancePlanContactComponent(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getEndpoint()) + tgt.addEndpoint(convertReference(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getNetwork()) + tgt.addNetwork(convertReference(t)); + for (org.hl7.fhir.r5.model.InsurancePlan.InsurancePlanCoverageComponent t : src.getCoverage()) + tgt.addCoverage(convertInsurancePlanCoverageComponent(t)); + for (org.hl7.fhir.r5.model.InsurancePlan.InsurancePlanPlanComponent t : src.getPlan()) + tgt.addPlan(convertInsurancePlanPlanComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.InsurancePlan.InsurancePlanContactComponent convertInsurancePlanContactComponent(org.hl7.fhir.r4.model.InsurancePlan.InsurancePlanContactComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.InsurancePlan.InsurancePlanContactComponent tgt = new org.hl7.fhir.r5.model.InsurancePlan.InsurancePlanContactComponent(); + copyElement(src, tgt); + if (src.hasPurpose()) + tgt.setPurpose(convertCodeableConcept(src.getPurpose())); + if (src.hasName()) + tgt.setName(convertHumanName(src.getName())); + for (org.hl7.fhir.r4.model.ContactPoint t : src.getTelecom()) + tgt.addTelecom(convertContactPoint(t)); + if (src.hasAddress()) + tgt.setAddress(convertAddress(src.getAddress())); + return tgt; + } + + public static org.hl7.fhir.r4.model.InsurancePlan.InsurancePlanContactComponent convertInsurancePlanContactComponent(org.hl7.fhir.r5.model.InsurancePlan.InsurancePlanContactComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.InsurancePlan.InsurancePlanContactComponent tgt = new org.hl7.fhir.r4.model.InsurancePlan.InsurancePlanContactComponent(); + copyElement(src, tgt); + if (src.hasPurpose()) + tgt.setPurpose(convertCodeableConcept(src.getPurpose())); + if (src.hasName()) + tgt.setName(convertHumanName(src.getName())); + for (org.hl7.fhir.r5.model.ContactPoint t : src.getTelecom()) + tgt.addTelecom(convertContactPoint(t)); + if (src.hasAddress()) + tgt.setAddress(convertAddress(src.getAddress())); + return tgt; + } + + public static org.hl7.fhir.r5.model.InsurancePlan.InsurancePlanCoverageComponent convertInsurancePlanCoverageComponent(org.hl7.fhir.r4.model.InsurancePlan.InsurancePlanCoverageComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.InsurancePlan.InsurancePlanCoverageComponent tgt = new org.hl7.fhir.r5.model.InsurancePlan.InsurancePlanCoverageComponent(); + copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + for (org.hl7.fhir.r4.model.Reference t : src.getNetwork()) + tgt.addNetwork(convertReference(t)); + for (org.hl7.fhir.r4.model.InsurancePlan.CoverageBenefitComponent t : src.getBenefit()) + tgt.addBenefit(convertCoverageBenefitComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.InsurancePlan.InsurancePlanCoverageComponent convertInsurancePlanCoverageComponent(org.hl7.fhir.r5.model.InsurancePlan.InsurancePlanCoverageComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.InsurancePlan.InsurancePlanCoverageComponent tgt = new org.hl7.fhir.r4.model.InsurancePlan.InsurancePlanCoverageComponent(); + copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + for (org.hl7.fhir.r5.model.Reference t : src.getNetwork()) + tgt.addNetwork(convertReference(t)); + for (org.hl7.fhir.r5.model.InsurancePlan.CoverageBenefitComponent t : src.getBenefit()) + tgt.addBenefit(convertCoverageBenefitComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.InsurancePlan.CoverageBenefitComponent convertCoverageBenefitComponent(org.hl7.fhir.r4.model.InsurancePlan.CoverageBenefitComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.InsurancePlan.CoverageBenefitComponent tgt = new org.hl7.fhir.r5.model.InsurancePlan.CoverageBenefitComponent(); + copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + if (src.hasRequirement()) + tgt.setRequirementElement(convertString(src.getRequirementElement())); + for (org.hl7.fhir.r4.model.InsurancePlan.CoverageBenefitLimitComponent t : src.getLimit()) + tgt.addLimit(convertCoverageBenefitLimitComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.InsurancePlan.CoverageBenefitComponent convertCoverageBenefitComponent(org.hl7.fhir.r5.model.InsurancePlan.CoverageBenefitComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.InsurancePlan.CoverageBenefitComponent tgt = new org.hl7.fhir.r4.model.InsurancePlan.CoverageBenefitComponent(); + copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + if (src.hasRequirement()) + tgt.setRequirementElement(convertString(src.getRequirementElement())); + for (org.hl7.fhir.r5.model.InsurancePlan.CoverageBenefitLimitComponent t : src.getLimit()) + tgt.addLimit(convertCoverageBenefitLimitComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.InsurancePlan.CoverageBenefitLimitComponent convertCoverageBenefitLimitComponent(org.hl7.fhir.r4.model.InsurancePlan.CoverageBenefitLimitComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.InsurancePlan.CoverageBenefitLimitComponent tgt = new org.hl7.fhir.r5.model.InsurancePlan.CoverageBenefitLimitComponent(); + copyElement(src, tgt); + if (src.hasValue()) + tgt.setValue(convertQuantity(src.getValue())); + if (src.hasCode()) + tgt.setCode(convertCodeableConcept(src.getCode())); + return tgt; + } + + public static org.hl7.fhir.r4.model.InsurancePlan.CoverageBenefitLimitComponent convertCoverageBenefitLimitComponent(org.hl7.fhir.r5.model.InsurancePlan.CoverageBenefitLimitComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.InsurancePlan.CoverageBenefitLimitComponent tgt = new org.hl7.fhir.r4.model.InsurancePlan.CoverageBenefitLimitComponent(); + copyElement(src, tgt); + if (src.hasValue()) + tgt.setValue(convertQuantity(src.getValue())); + if (src.hasCode()) + tgt.setCode(convertCodeableConcept(src.getCode())); + return tgt; + } + + public static org.hl7.fhir.r5.model.InsurancePlan.InsurancePlanPlanComponent convertInsurancePlanPlanComponent(org.hl7.fhir.r4.model.InsurancePlan.InsurancePlanPlanComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.InsurancePlan.InsurancePlanPlanComponent tgt = new org.hl7.fhir.r5.model.InsurancePlan.InsurancePlanPlanComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + for (org.hl7.fhir.r4.model.Reference t : src.getCoverageArea()) + tgt.addCoverageArea(convertReference(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getNetwork()) + tgt.addNetwork(convertReference(t)); + for (org.hl7.fhir.r4.model.InsurancePlan.InsurancePlanPlanGeneralCostComponent t : src.getGeneralCost()) + tgt.addGeneralCost(convertInsurancePlanPlanGeneralCostComponent(t)); + for (org.hl7.fhir.r4.model.InsurancePlan.InsurancePlanPlanSpecificCostComponent t : src.getSpecificCost()) + tgt.addSpecificCost(convertInsurancePlanPlanSpecificCostComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.InsurancePlan.InsurancePlanPlanComponent convertInsurancePlanPlanComponent(org.hl7.fhir.r5.model.InsurancePlan.InsurancePlanPlanComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.InsurancePlan.InsurancePlanPlanComponent tgt = new org.hl7.fhir.r4.model.InsurancePlan.InsurancePlanPlanComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + for (org.hl7.fhir.r5.model.Reference t : src.getCoverageArea()) + tgt.addCoverageArea(convertReference(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getNetwork()) + tgt.addNetwork(convertReference(t)); + for (org.hl7.fhir.r5.model.InsurancePlan.InsurancePlanPlanGeneralCostComponent t : src.getGeneralCost()) + tgt.addGeneralCost(convertInsurancePlanPlanGeneralCostComponent(t)); + for (org.hl7.fhir.r5.model.InsurancePlan.InsurancePlanPlanSpecificCostComponent t : src.getSpecificCost()) + tgt.addSpecificCost(convertInsurancePlanPlanSpecificCostComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.InsurancePlan.InsurancePlanPlanGeneralCostComponent convertInsurancePlanPlanGeneralCostComponent(org.hl7.fhir.r4.model.InsurancePlan.InsurancePlanPlanGeneralCostComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.InsurancePlan.InsurancePlanPlanGeneralCostComponent tgt = new org.hl7.fhir.r5.model.InsurancePlan.InsurancePlanPlanGeneralCostComponent(); + copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + if (src.hasGroupSize()) + tgt.setGroupSizeElement(convertPositiveInt(src.getGroupSizeElement())); + if (src.hasCost()) + tgt.setCost(convertMoney(src.getCost())); + if (src.hasComment()) + tgt.setCommentElement(convertString(src.getCommentElement())); + return tgt; + } + + public static org.hl7.fhir.r4.model.InsurancePlan.InsurancePlanPlanGeneralCostComponent convertInsurancePlanPlanGeneralCostComponent(org.hl7.fhir.r5.model.InsurancePlan.InsurancePlanPlanGeneralCostComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.InsurancePlan.InsurancePlanPlanGeneralCostComponent tgt = new org.hl7.fhir.r4.model.InsurancePlan.InsurancePlanPlanGeneralCostComponent(); + copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + if (src.hasGroupSize()) + tgt.setGroupSizeElement(convertPositiveInt(src.getGroupSizeElement())); + if (src.hasCost()) + tgt.setCost(convertMoney(src.getCost())); + if (src.hasComment()) + tgt.setCommentElement(convertString(src.getCommentElement())); + return tgt; + } + + public static org.hl7.fhir.r5.model.InsurancePlan.InsurancePlanPlanSpecificCostComponent convertInsurancePlanPlanSpecificCostComponent(org.hl7.fhir.r4.model.InsurancePlan.InsurancePlanPlanSpecificCostComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.InsurancePlan.InsurancePlanPlanSpecificCostComponent tgt = new org.hl7.fhir.r5.model.InsurancePlan.InsurancePlanPlanSpecificCostComponent(); + copyElement(src, tgt); + if (src.hasCategory()) + tgt.setCategory(convertCodeableConcept(src.getCategory())); + for (org.hl7.fhir.r4.model.InsurancePlan.PlanBenefitComponent t : src.getBenefit()) + tgt.addBenefit(convertPlanBenefitComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.InsurancePlan.InsurancePlanPlanSpecificCostComponent convertInsurancePlanPlanSpecificCostComponent(org.hl7.fhir.r5.model.InsurancePlan.InsurancePlanPlanSpecificCostComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.InsurancePlan.InsurancePlanPlanSpecificCostComponent tgt = new org.hl7.fhir.r4.model.InsurancePlan.InsurancePlanPlanSpecificCostComponent(); + copyElement(src, tgt); + if (src.hasCategory()) + tgt.setCategory(convertCodeableConcept(src.getCategory())); + for (org.hl7.fhir.r5.model.InsurancePlan.PlanBenefitComponent t : src.getBenefit()) + tgt.addBenefit(convertPlanBenefitComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.InsurancePlan.PlanBenefitComponent convertPlanBenefitComponent(org.hl7.fhir.r4.model.InsurancePlan.PlanBenefitComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.InsurancePlan.PlanBenefitComponent tgt = new org.hl7.fhir.r5.model.InsurancePlan.PlanBenefitComponent(); + copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + for (org.hl7.fhir.r4.model.InsurancePlan.PlanBenefitCostComponent t : src.getCost()) + tgt.addCost(convertPlanBenefitCostComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.InsurancePlan.PlanBenefitComponent convertPlanBenefitComponent(org.hl7.fhir.r5.model.InsurancePlan.PlanBenefitComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.InsurancePlan.PlanBenefitComponent tgt = new org.hl7.fhir.r4.model.InsurancePlan.PlanBenefitComponent(); + copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + for (org.hl7.fhir.r5.model.InsurancePlan.PlanBenefitCostComponent t : src.getCost()) + tgt.addCost(convertPlanBenefitCostComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.InsurancePlan.PlanBenefitCostComponent convertPlanBenefitCostComponent(org.hl7.fhir.r4.model.InsurancePlan.PlanBenefitCostComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.InsurancePlan.PlanBenefitCostComponent tgt = new org.hl7.fhir.r5.model.InsurancePlan.PlanBenefitCostComponent(); + copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + if (src.hasApplicability()) + tgt.setApplicability(convertCodeableConcept(src.getApplicability())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getQualifiers()) + tgt.addQualifiers(convertCodeableConcept(t)); + if (src.hasValue()) + tgt.setValue(convertQuantity(src.getValue())); + return tgt; + } + + public static org.hl7.fhir.r4.model.InsurancePlan.PlanBenefitCostComponent convertPlanBenefitCostComponent(org.hl7.fhir.r5.model.InsurancePlan.PlanBenefitCostComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.InsurancePlan.PlanBenefitCostComponent tgt = new org.hl7.fhir.r4.model.InsurancePlan.PlanBenefitCostComponent(); + copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + if (src.hasApplicability()) + tgt.setApplicability(convertCodeableConcept(src.getApplicability())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getQualifiers()) + tgt.addQualifiers(convertCodeableConcept(t)); + if (src.hasValue()) + tgt.setValue(convertQuantity(src.getValue())); + return tgt; + } + + +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Invoice.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Invoice.java new file mode 100644 index 000000000..8c47d5f1e --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Invoice.java @@ -0,0 +1,261 @@ +package org.hl7.fhir.convertors.conv40_50; + +import org.hl7.fhir.exceptions.FHIRException; + +import org.hl7.fhir.convertors.VersionConvertor_40_50; + + +/* + Copyright (c) 2011+, HL7, Inc. + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of HL7 nor the names of its contributors may be used to + endorse or promote products derived from this software without specific + prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + +*/ + +// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0 + + +public class Invoice extends VersionConvertor_40_50 { + + public static org.hl7.fhir.r5.model.Invoice convertInvoice(org.hl7.fhir.r4.model.Invoice src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Invoice tgt = new org.hl7.fhir.r5.model.Invoice(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasStatus()) + tgt.setStatus(convertInvoiceStatus(src.getStatus())); + if (src.hasCancelledReason()) + tgt.setCancelledReasonElement(convertString(src.getCancelledReasonElement())); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + if (src.hasSubject()) + tgt.setSubject(convertReference(src.getSubject())); + if (src.hasRecipient()) + tgt.setRecipient(convertReference(src.getRecipient())); + if (src.hasDate()) + tgt.setDateElement(convertDateTime(src.getDateElement())); + for (org.hl7.fhir.r4.model.Invoice.InvoiceParticipantComponent t : src.getParticipant()) + tgt.addParticipant(convertInvoiceParticipantComponent(t)); + if (src.hasIssuer()) + tgt.setIssuer(convertReference(src.getIssuer())); + if (src.hasAccount()) + tgt.setAccount(convertReference(src.getAccount())); + for (org.hl7.fhir.r4.model.Invoice.InvoiceLineItemComponent t : src.getLineItem()) + tgt.addLineItem(convertInvoiceLineItemComponent(t)); + for (org.hl7.fhir.r4.model.Invoice.InvoiceLineItemPriceComponentComponent t : src.getTotalPriceComponent()) + tgt.addTotalPriceComponent(convertInvoiceLineItemPriceComponentComponent(t)); + if (src.hasTotalNet()) + tgt.setTotalNet(convertMoney(src.getTotalNet())); + if (src.hasTotalGross()) + tgt.setTotalGross(convertMoney(src.getTotalGross())); + if (src.hasPaymentTerms()) + tgt.setPaymentTermsElement(convertMarkdown(src.getPaymentTermsElement())); + for (org.hl7.fhir.r4.model.Annotation t : src.getNote()) + tgt.addNote(convertAnnotation(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.Invoice convertInvoice(org.hl7.fhir.r5.model.Invoice src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Invoice tgt = new org.hl7.fhir.r4.model.Invoice(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasStatus()) + tgt.setStatus(convertInvoiceStatus(src.getStatus())); + if (src.hasCancelledReason()) + tgt.setCancelledReasonElement(convertString(src.getCancelledReasonElement())); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + if (src.hasSubject()) + tgt.setSubject(convertReference(src.getSubject())); + if (src.hasRecipient()) + tgt.setRecipient(convertReference(src.getRecipient())); + if (src.hasDate()) + tgt.setDateElement(convertDateTime(src.getDateElement())); + for (org.hl7.fhir.r5.model.Invoice.InvoiceParticipantComponent t : src.getParticipant()) + tgt.addParticipant(convertInvoiceParticipantComponent(t)); + if (src.hasIssuer()) + tgt.setIssuer(convertReference(src.getIssuer())); + if (src.hasAccount()) + tgt.setAccount(convertReference(src.getAccount())); + for (org.hl7.fhir.r5.model.Invoice.InvoiceLineItemComponent t : src.getLineItem()) + tgt.addLineItem(convertInvoiceLineItemComponent(t)); + for (org.hl7.fhir.r5.model.Invoice.InvoiceLineItemPriceComponentComponent t : src.getTotalPriceComponent()) + tgt.addTotalPriceComponent(convertInvoiceLineItemPriceComponentComponent(t)); + if (src.hasTotalNet()) + tgt.setTotalNet(convertMoney(src.getTotalNet())); + if (src.hasTotalGross()) + tgt.setTotalGross(convertMoney(src.getTotalGross())); + if (src.hasPaymentTerms()) + tgt.setPaymentTermsElement(convertMarkdown(src.getPaymentTermsElement())); + for (org.hl7.fhir.r5.model.Annotation t : src.getNote()) + tgt.addNote(convertAnnotation(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.Invoice.InvoiceStatus convertInvoiceStatus(org.hl7.fhir.r4.model.Invoice.InvoiceStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case DRAFT: return org.hl7.fhir.r5.model.Invoice.InvoiceStatus.DRAFT; + case ISSUED: return org.hl7.fhir.r5.model.Invoice.InvoiceStatus.ISSUED; + case BALANCED: return org.hl7.fhir.r5.model.Invoice.InvoiceStatus.BALANCED; + case CANCELLED: return org.hl7.fhir.r5.model.Invoice.InvoiceStatus.CANCELLED; + case ENTEREDINERROR: return org.hl7.fhir.r5.model.Invoice.InvoiceStatus.ENTEREDINERROR; + default: return org.hl7.fhir.r5.model.Invoice.InvoiceStatus.NULL; + } +} + + public static org.hl7.fhir.r4.model.Invoice.InvoiceStatus convertInvoiceStatus(org.hl7.fhir.r5.model.Invoice.InvoiceStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case DRAFT: return org.hl7.fhir.r4.model.Invoice.InvoiceStatus.DRAFT; + case ISSUED: return org.hl7.fhir.r4.model.Invoice.InvoiceStatus.ISSUED; + case BALANCED: return org.hl7.fhir.r4.model.Invoice.InvoiceStatus.BALANCED; + case CANCELLED: return org.hl7.fhir.r4.model.Invoice.InvoiceStatus.CANCELLED; + case ENTEREDINERROR: return org.hl7.fhir.r4.model.Invoice.InvoiceStatus.ENTEREDINERROR; + default: return org.hl7.fhir.r4.model.Invoice.InvoiceStatus.NULL; + } +} + + public static org.hl7.fhir.r5.model.Invoice.InvoiceParticipantComponent convertInvoiceParticipantComponent(org.hl7.fhir.r4.model.Invoice.InvoiceParticipantComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Invoice.InvoiceParticipantComponent tgt = new org.hl7.fhir.r5.model.Invoice.InvoiceParticipantComponent(); + copyElement(src, tgt); + if (src.hasRole()) + tgt.setRole(convertCodeableConcept(src.getRole())); + if (src.hasActor()) + tgt.setActor(convertReference(src.getActor())); + return tgt; + } + + public static org.hl7.fhir.r4.model.Invoice.InvoiceParticipantComponent convertInvoiceParticipantComponent(org.hl7.fhir.r5.model.Invoice.InvoiceParticipantComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Invoice.InvoiceParticipantComponent tgt = new org.hl7.fhir.r4.model.Invoice.InvoiceParticipantComponent(); + copyElement(src, tgt); + if (src.hasRole()) + tgt.setRole(convertCodeableConcept(src.getRole())); + if (src.hasActor()) + tgt.setActor(convertReference(src.getActor())); + return tgt; + } + + public static org.hl7.fhir.r5.model.Invoice.InvoiceLineItemComponent convertInvoiceLineItemComponent(org.hl7.fhir.r4.model.Invoice.InvoiceLineItemComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Invoice.InvoiceLineItemComponent tgt = new org.hl7.fhir.r5.model.Invoice.InvoiceLineItemComponent(); + copyElement(src, tgt); + if (src.hasSequence()) + tgt.setSequenceElement(convertPositiveInt(src.getSequenceElement())); + if (src.hasChargeItem()) + tgt.setChargeItem(convertType(src.getChargeItem())); + for (org.hl7.fhir.r4.model.Invoice.InvoiceLineItemPriceComponentComponent t : src.getPriceComponent()) + tgt.addPriceComponent(convertInvoiceLineItemPriceComponentComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.Invoice.InvoiceLineItemComponent convertInvoiceLineItemComponent(org.hl7.fhir.r5.model.Invoice.InvoiceLineItemComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Invoice.InvoiceLineItemComponent tgt = new org.hl7.fhir.r4.model.Invoice.InvoiceLineItemComponent(); + copyElement(src, tgt); + if (src.hasSequence()) + tgt.setSequenceElement(convertPositiveInt(src.getSequenceElement())); + if (src.hasChargeItem()) + tgt.setChargeItem(convertType(src.getChargeItem())); + for (org.hl7.fhir.r5.model.Invoice.InvoiceLineItemPriceComponentComponent t : src.getPriceComponent()) + tgt.addPriceComponent(convertInvoiceLineItemPriceComponentComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.Invoice.InvoiceLineItemPriceComponentComponent convertInvoiceLineItemPriceComponentComponent(org.hl7.fhir.r4.model.Invoice.InvoiceLineItemPriceComponentComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Invoice.InvoiceLineItemPriceComponentComponent tgt = new org.hl7.fhir.r5.model.Invoice.InvoiceLineItemPriceComponentComponent(); + copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertInvoicePriceComponentType(src.getType())); + if (src.hasCode()) + tgt.setCode(convertCodeableConcept(src.getCode())); + if (src.hasFactor()) + tgt.setFactorElement(convertDecimal(src.getFactorElement())); + if (src.hasAmount()) + tgt.setAmount(convertMoney(src.getAmount())); + return tgt; + } + + public static org.hl7.fhir.r4.model.Invoice.InvoiceLineItemPriceComponentComponent convertInvoiceLineItemPriceComponentComponent(org.hl7.fhir.r5.model.Invoice.InvoiceLineItemPriceComponentComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Invoice.InvoiceLineItemPriceComponentComponent tgt = new org.hl7.fhir.r4.model.Invoice.InvoiceLineItemPriceComponentComponent(); + copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertInvoicePriceComponentType(src.getType())); + if (src.hasCode()) + tgt.setCode(convertCodeableConcept(src.getCode())); + if (src.hasFactor()) + tgt.setFactorElement(convertDecimal(src.getFactorElement())); + if (src.hasAmount()) + tgt.setAmount(convertMoney(src.getAmount())); + return tgt; + } + + public static org.hl7.fhir.r5.model.Invoice.InvoicePriceComponentType convertInvoicePriceComponentType(org.hl7.fhir.r4.model.Invoice.InvoicePriceComponentType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case BASE: return org.hl7.fhir.r5.model.Invoice.InvoicePriceComponentType.BASE; + case SURCHARGE: return org.hl7.fhir.r5.model.Invoice.InvoicePriceComponentType.SURCHARGE; + case DEDUCTION: return org.hl7.fhir.r5.model.Invoice.InvoicePriceComponentType.DEDUCTION; + case DISCOUNT: return org.hl7.fhir.r5.model.Invoice.InvoicePriceComponentType.DISCOUNT; + case TAX: return org.hl7.fhir.r5.model.Invoice.InvoicePriceComponentType.TAX; + case INFORMATIONAL: return org.hl7.fhir.r5.model.Invoice.InvoicePriceComponentType.INFORMATIONAL; + default: return org.hl7.fhir.r5.model.Invoice.InvoicePriceComponentType.NULL; + } +} + + public static org.hl7.fhir.r4.model.Invoice.InvoicePriceComponentType convertInvoicePriceComponentType(org.hl7.fhir.r5.model.Invoice.InvoicePriceComponentType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case BASE: return org.hl7.fhir.r4.model.Invoice.InvoicePriceComponentType.BASE; + case SURCHARGE: return org.hl7.fhir.r4.model.Invoice.InvoicePriceComponentType.SURCHARGE; + case DEDUCTION: return org.hl7.fhir.r4.model.Invoice.InvoicePriceComponentType.DEDUCTION; + case DISCOUNT: return org.hl7.fhir.r4.model.Invoice.InvoicePriceComponentType.DISCOUNT; + case TAX: return org.hl7.fhir.r4.model.Invoice.InvoicePriceComponentType.TAX; + case INFORMATIONAL: return org.hl7.fhir.r4.model.Invoice.InvoicePriceComponentType.INFORMATIONAL; + default: return org.hl7.fhir.r4.model.Invoice.InvoicePriceComponentType.NULL; + } +} + + +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Library.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Library.java new file mode 100644 index 000000000..6e1054739 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Library.java @@ -0,0 +1,183 @@ +package org.hl7.fhir.convertors.conv40_50; + +import org.hl7.fhir.exceptions.FHIRException; + +import org.hl7.fhir.convertors.VersionConvertor_40_50; + + +/* + Copyright (c) 2011+, HL7, Inc. + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of HL7 nor the names of its contributors may be used to + endorse or promote products derived from this software without specific + prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + +*/ + +// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0 + + +public class Library extends VersionConvertor_40_50 { + + public static org.hl7.fhir.r5.model.Library convertLibrary(org.hl7.fhir.r4.model.Library src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Library tgt = new org.hl7.fhir.r5.model.Library(); + copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrlElement(convertUri(src.getUrlElement())); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasVersion()) + tgt.setVersionElement(convertString(src.getVersionElement())); + if (src.hasName()) + tgt.setNameElement(convertString(src.getNameElement())); + if (src.hasTitle()) + tgt.setTitleElement(convertString(src.getTitleElement())); + if (src.hasSubtitle()) + tgt.setSubtitleElement(convertString(src.getSubtitleElement())); + if (src.hasStatus()) + tgt.setStatus(Enumerations.convertPublicationStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimentalElement(convertBoolean(src.getExperimentalElement())); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + if (src.hasSubject()) + tgt.setSubject(convertType(src.getSubject())); + if (src.hasDate()) + tgt.setDateElement(convertDateTime(src.getDateElement())); + if (src.hasPublisher()) + tgt.setPublisherElement(convertString(src.getPublisherElement())); + for (org.hl7.fhir.r4.model.ContactDetail t : src.getContact()) + tgt.addContact(convertContactDetail(t)); + if (src.hasDescription()) + tgt.setDescriptionElement(convertMarkdown(src.getDescriptionElement())); + for (org.hl7.fhir.r4.model.UsageContext t : src.getUseContext()) + tgt.addUseContext(convertUsageContext(t)); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getJurisdiction()) + tgt.addJurisdiction(convertCodeableConcept(t)); + if (src.hasPurpose()) + tgt.setPurposeElement(convertMarkdown(src.getPurposeElement())); + if (src.hasUsage()) + tgt.setUsageElement(convertString(src.getUsageElement())); + if (src.hasCopyright()) + tgt.setCopyrightElement(convertMarkdown(src.getCopyrightElement())); + if (src.hasApprovalDate()) + tgt.setApprovalDateElement(convertDate(src.getApprovalDateElement())); + if (src.hasLastReviewDate()) + tgt.setLastReviewDateElement(convertDate(src.getLastReviewDateElement())); + if (src.hasEffectivePeriod()) + tgt.setEffectivePeriod(convertPeriod(src.getEffectivePeriod())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getTopic()) + tgt.addTopic(convertCodeableConcept(t)); + for (org.hl7.fhir.r4.model.ContactDetail t : src.getAuthor()) + tgt.addAuthor(convertContactDetail(t)); + for (org.hl7.fhir.r4.model.ContactDetail t : src.getEditor()) + tgt.addEditor(convertContactDetail(t)); + for (org.hl7.fhir.r4.model.ContactDetail t : src.getReviewer()) + tgt.addReviewer(convertContactDetail(t)); + for (org.hl7.fhir.r4.model.ContactDetail t : src.getEndorser()) + tgt.addEndorser(convertContactDetail(t)); + for (org.hl7.fhir.r4.model.RelatedArtifact t : src.getRelatedArtifact()) + tgt.addRelatedArtifact(convertRelatedArtifact(t)); + for (org.hl7.fhir.r4.model.ParameterDefinition t : src.getParameter()) + tgt.addParameter(convertParameterDefinition(t)); + for (org.hl7.fhir.r4.model.DataRequirement t : src.getDataRequirement()) + tgt.addDataRequirement(convertDataRequirement(t)); + for (org.hl7.fhir.r4.model.Attachment t : src.getContent()) + tgt.addContent(convertAttachment(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.Library convertLibrary(org.hl7.fhir.r5.model.Library src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Library tgt = new org.hl7.fhir.r4.model.Library(); + copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrlElement(convertUri(src.getUrlElement())); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasVersion()) + tgt.setVersionElement(convertString(src.getVersionElement())); + if (src.hasName()) + tgt.setNameElement(convertString(src.getNameElement())); + if (src.hasTitle()) + tgt.setTitleElement(convertString(src.getTitleElement())); + if (src.hasSubtitle()) + tgt.setSubtitleElement(convertString(src.getSubtitleElement())); + if (src.hasStatus()) + tgt.setStatus(Enumerations.convertPublicationStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimentalElement(convertBoolean(src.getExperimentalElement())); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + if (src.hasSubject()) + tgt.setSubject(convertType(src.getSubject())); + if (src.hasDate()) + tgt.setDateElement(convertDateTime(src.getDateElement())); + if (src.hasPublisher()) + tgt.setPublisherElement(convertString(src.getPublisherElement())); + for (org.hl7.fhir.r5.model.ContactDetail t : src.getContact()) + tgt.addContact(convertContactDetail(t)); + if (src.hasDescription()) + tgt.setDescriptionElement(convertMarkdown(src.getDescriptionElement())); + for (org.hl7.fhir.r5.model.UsageContext t : src.getUseContext()) + tgt.addUseContext(convertUsageContext(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getJurisdiction()) + tgt.addJurisdiction(convertCodeableConcept(t)); + if (src.hasPurpose()) + tgt.setPurposeElement(convertMarkdown(src.getPurposeElement())); + if (src.hasUsage()) + tgt.setUsageElement(convertString(src.getUsageElement())); + if (src.hasCopyright()) + tgt.setCopyrightElement(convertMarkdown(src.getCopyrightElement())); + if (src.hasApprovalDate()) + tgt.setApprovalDateElement(convertDate(src.getApprovalDateElement())); + if (src.hasLastReviewDate()) + tgt.setLastReviewDateElement(convertDate(src.getLastReviewDateElement())); + if (src.hasEffectivePeriod()) + tgt.setEffectivePeriod(convertPeriod(src.getEffectivePeriod())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getTopic()) + tgt.addTopic(convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.ContactDetail t : src.getAuthor()) + tgt.addAuthor(convertContactDetail(t)); + for (org.hl7.fhir.r5.model.ContactDetail t : src.getEditor()) + tgt.addEditor(convertContactDetail(t)); + for (org.hl7.fhir.r5.model.ContactDetail t : src.getReviewer()) + tgt.addReviewer(convertContactDetail(t)); + for (org.hl7.fhir.r5.model.ContactDetail t : src.getEndorser()) + tgt.addEndorser(convertContactDetail(t)); + for (org.hl7.fhir.r5.model.RelatedArtifact t : src.getRelatedArtifact()) + tgt.addRelatedArtifact(convertRelatedArtifact(t)); + for (org.hl7.fhir.r5.model.ParameterDefinition t : src.getParameter()) + tgt.addParameter(convertParameterDefinition(t)); + for (org.hl7.fhir.r5.model.DataRequirement t : src.getDataRequirement()) + tgt.addDataRequirement(convertDataRequirement(t)); + for (org.hl7.fhir.r5.model.Attachment t : src.getContent()) + tgt.addContent(convertAttachment(t)); + return tgt; + } + + +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Linkage.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Linkage.java new file mode 100644 index 000000000..ee65415d4 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Linkage.java @@ -0,0 +1,117 @@ +package org.hl7.fhir.convertors.conv40_50; + +import org.hl7.fhir.exceptions.FHIRException; + +import org.hl7.fhir.convertors.VersionConvertor_40_50; + + +/* + Copyright (c) 2011+, HL7, Inc. + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of HL7 nor the names of its contributors may be used to + endorse or promote products derived from this software without specific + prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + +*/ + +// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0 + + +public class Linkage extends VersionConvertor_40_50 { + + public static org.hl7.fhir.r5.model.Linkage convertLinkage(org.hl7.fhir.r4.model.Linkage src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Linkage tgt = new org.hl7.fhir.r5.model.Linkage(); + copyDomainResource(src, tgt); + if (src.hasActive()) + tgt.setActiveElement(convertBoolean(src.getActiveElement())); + if (src.hasAuthor()) + tgt.setAuthor(convertReference(src.getAuthor())); + for (org.hl7.fhir.r4.model.Linkage.LinkageItemComponent t : src.getItem()) + tgt.addItem(convertLinkageItemComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.Linkage convertLinkage(org.hl7.fhir.r5.model.Linkage src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Linkage tgt = new org.hl7.fhir.r4.model.Linkage(); + copyDomainResource(src, tgt); + if (src.hasActive()) + tgt.setActiveElement(convertBoolean(src.getActiveElement())); + if (src.hasAuthor()) + tgt.setAuthor(convertReference(src.getAuthor())); + for (org.hl7.fhir.r5.model.Linkage.LinkageItemComponent t : src.getItem()) + tgt.addItem(convertLinkageItemComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.Linkage.LinkageItemComponent convertLinkageItemComponent(org.hl7.fhir.r4.model.Linkage.LinkageItemComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Linkage.LinkageItemComponent tgt = new org.hl7.fhir.r5.model.Linkage.LinkageItemComponent(); + copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertLinkageType(src.getType())); + if (src.hasResource()) + tgt.setResource(convertReference(src.getResource())); + return tgt; + } + + public static org.hl7.fhir.r4.model.Linkage.LinkageItemComponent convertLinkageItemComponent(org.hl7.fhir.r5.model.Linkage.LinkageItemComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Linkage.LinkageItemComponent tgt = new org.hl7.fhir.r4.model.Linkage.LinkageItemComponent(); + copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertLinkageType(src.getType())); + if (src.hasResource()) + tgt.setResource(convertReference(src.getResource())); + return tgt; + } + + public static org.hl7.fhir.r5.model.Linkage.LinkageType convertLinkageType(org.hl7.fhir.r4.model.Linkage.LinkageType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case SOURCE: return org.hl7.fhir.r5.model.Linkage.LinkageType.SOURCE; + case ALTERNATE: return org.hl7.fhir.r5.model.Linkage.LinkageType.ALTERNATE; + case HISTORICAL: return org.hl7.fhir.r5.model.Linkage.LinkageType.HISTORICAL; + default: return org.hl7.fhir.r5.model.Linkage.LinkageType.NULL; + } +} + + public static org.hl7.fhir.r4.model.Linkage.LinkageType convertLinkageType(org.hl7.fhir.r5.model.Linkage.LinkageType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case SOURCE: return org.hl7.fhir.r4.model.Linkage.LinkageType.SOURCE; + case ALTERNATE: return org.hl7.fhir.r4.model.Linkage.LinkageType.ALTERNATE; + case HISTORICAL: return org.hl7.fhir.r4.model.Linkage.LinkageType.HISTORICAL; + default: return org.hl7.fhir.r4.model.Linkage.LinkageType.NULL; + } +} + + +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/ListResource.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/ListResource.java new file mode 100644 index 000000000..ec530d739 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/ListResource.java @@ -0,0 +1,187 @@ +package org.hl7.fhir.convertors.conv40_50; + +import org.hl7.fhir.exceptions.FHIRException; + +import org.hl7.fhir.convertors.VersionConvertor_40_50; + + +/* + Copyright (c) 2011+, HL7, Inc. + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of HL7 nor the names of its contributors may be used to + endorse or promote products derived from this software without specific + prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + +*/ + +// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0 + + +public class ListResource extends VersionConvertor_40_50 { + + public static org.hl7.fhir.r5.model.ListResource convertListResource(org.hl7.fhir.r4.model.ListResource src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ListResource tgt = new org.hl7.fhir.r5.model.ListResource(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasStatus()) + tgt.setStatus(convertListStatus(src.getStatus())); + if (src.hasMode()) + tgt.setMode(convertListMode(src.getMode())); + if (src.hasTitle()) + tgt.setTitleElement(convertString(src.getTitleElement())); + if (src.hasCode()) + tgt.setCode(convertCodeableConcept(src.getCode())); + if (src.hasSubject()) + tgt.setSubject(convertReference(src.getSubject())); + if (src.hasEncounter()) + tgt.setEncounter(convertReference(src.getEncounter())); + if (src.hasDate()) + tgt.setDateElement(convertDateTime(src.getDateElement())); + if (src.hasSource()) + tgt.setSource(convertReference(src.getSource())); + if (src.hasOrderedBy()) + tgt.setOrderedBy(convertCodeableConcept(src.getOrderedBy())); + for (org.hl7.fhir.r4.model.Annotation t : src.getNote()) + tgt.addNote(convertAnnotation(t)); + for (org.hl7.fhir.r4.model.ListResource.ListEntryComponent t : src.getEntry()) + tgt.addEntry(convertListEntryComponent(t)); + if (src.hasEmptyReason()) + tgt.setEmptyReason(convertCodeableConcept(src.getEmptyReason())); + return tgt; + } + + public static org.hl7.fhir.r4.model.ListResource convertListResource(org.hl7.fhir.r5.model.ListResource src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.ListResource tgt = new org.hl7.fhir.r4.model.ListResource(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasStatus()) + tgt.setStatus(convertListStatus(src.getStatus())); + if (src.hasMode()) + tgt.setMode(convertListMode(src.getMode())); + if (src.hasTitle()) + tgt.setTitleElement(convertString(src.getTitleElement())); + if (src.hasCode()) + tgt.setCode(convertCodeableConcept(src.getCode())); + if (src.hasSubject()) + tgt.setSubject(convertReference(src.getSubject())); + if (src.hasEncounter()) + tgt.setEncounter(convertReference(src.getEncounter())); + if (src.hasDate()) + tgt.setDateElement(convertDateTime(src.getDateElement())); + if (src.hasSource()) + tgt.setSource(convertReference(src.getSource())); + if (src.hasOrderedBy()) + tgt.setOrderedBy(convertCodeableConcept(src.getOrderedBy())); + for (org.hl7.fhir.r5.model.Annotation t : src.getNote()) + tgt.addNote(convertAnnotation(t)); + for (org.hl7.fhir.r5.model.ListResource.ListEntryComponent t : src.getEntry()) + tgt.addEntry(convertListEntryComponent(t)); + if (src.hasEmptyReason()) + tgt.setEmptyReason(convertCodeableConcept(src.getEmptyReason())); + return tgt; + } + + public static org.hl7.fhir.r5.model.ListResource.ListStatus convertListStatus(org.hl7.fhir.r4.model.ListResource.ListStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case CURRENT: return org.hl7.fhir.r5.model.ListResource.ListStatus.CURRENT; + case RETIRED: return org.hl7.fhir.r5.model.ListResource.ListStatus.RETIRED; + case ENTEREDINERROR: return org.hl7.fhir.r5.model.ListResource.ListStatus.ENTEREDINERROR; + default: return org.hl7.fhir.r5.model.ListResource.ListStatus.NULL; + } +} + + public static org.hl7.fhir.r4.model.ListResource.ListStatus convertListStatus(org.hl7.fhir.r5.model.ListResource.ListStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case CURRENT: return org.hl7.fhir.r4.model.ListResource.ListStatus.CURRENT; + case RETIRED: return org.hl7.fhir.r4.model.ListResource.ListStatus.RETIRED; + case ENTEREDINERROR: return org.hl7.fhir.r4.model.ListResource.ListStatus.ENTEREDINERROR; + default: return org.hl7.fhir.r4.model.ListResource.ListStatus.NULL; + } +} + + public static org.hl7.fhir.r5.model.ListResource.ListMode convertListMode(org.hl7.fhir.r4.model.ListResource.ListMode src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case WORKING: return org.hl7.fhir.r5.model.ListResource.ListMode.WORKING; + case SNAPSHOT: return org.hl7.fhir.r5.model.ListResource.ListMode.SNAPSHOT; + case CHANGES: return org.hl7.fhir.r5.model.ListResource.ListMode.CHANGES; + default: return org.hl7.fhir.r5.model.ListResource.ListMode.NULL; + } +} + + public static org.hl7.fhir.r4.model.ListResource.ListMode convertListMode(org.hl7.fhir.r5.model.ListResource.ListMode src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case WORKING: return org.hl7.fhir.r4.model.ListResource.ListMode.WORKING; + case SNAPSHOT: return org.hl7.fhir.r4.model.ListResource.ListMode.SNAPSHOT; + case CHANGES: return org.hl7.fhir.r4.model.ListResource.ListMode.CHANGES; + default: return org.hl7.fhir.r4.model.ListResource.ListMode.NULL; + } +} + + public static org.hl7.fhir.r5.model.ListResource.ListEntryComponent convertListEntryComponent(org.hl7.fhir.r4.model.ListResource.ListEntryComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ListResource.ListEntryComponent tgt = new org.hl7.fhir.r5.model.ListResource.ListEntryComponent(); + copyElement(src, tgt); + if (src.hasFlag()) + tgt.setFlag(convertCodeableConcept(src.getFlag())); + if (src.hasDeleted()) + tgt.setDeletedElement(convertBoolean(src.getDeletedElement())); + if (src.hasDate()) + tgt.setDateElement(convertDateTime(src.getDateElement())); + if (src.hasItem()) + tgt.setItem(convertReference(src.getItem())); + return tgt; + } + + public static org.hl7.fhir.r4.model.ListResource.ListEntryComponent convertListEntryComponent(org.hl7.fhir.r5.model.ListResource.ListEntryComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.ListResource.ListEntryComponent tgt = new org.hl7.fhir.r4.model.ListResource.ListEntryComponent(); + copyElement(src, tgt); + if (src.hasFlag()) + tgt.setFlag(convertCodeableConcept(src.getFlag())); + if (src.hasDeleted()) + tgt.setDeletedElement(convertBoolean(src.getDeletedElement())); + if (src.hasDate()) + tgt.setDateElement(convertDateTime(src.getDateElement())); + if (src.hasItem()) + tgt.setItem(convertReference(src.getItem())); + return tgt; + } + + +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Location.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Location.java new file mode 100644 index 000000000..1b54e1aa6 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Location.java @@ -0,0 +1,259 @@ +package org.hl7.fhir.convertors.conv40_50; + +import org.hl7.fhir.exceptions.FHIRException; + +import org.hl7.fhir.convertors.VersionConvertor_40_50; + + +/* + Copyright (c) 2011+, HL7, Inc. + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of HL7 nor the names of its contributors may be used to + endorse or promote products derived from this software without specific + prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + +*/ + +// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0 + + +public class Location extends VersionConvertor_40_50 { + + public static org.hl7.fhir.r5.model.Location convertLocation(org.hl7.fhir.r4.model.Location src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Location tgt = new org.hl7.fhir.r5.model.Location(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasStatus()) + tgt.setStatus(convertLocationStatus(src.getStatus())); + if (src.hasOperationalStatus()) + tgt.setOperationalStatus(convertCoding(src.getOperationalStatus())); + if (src.hasName()) + tgt.setNameElement(convertString(src.getNameElement())); + for (org.hl7.fhir.r4.model.StringType t : src.getAlias()) + tgt.getAlias().add(convertString(t)); + if (src.hasDescription()) + tgt.setDescriptionElement(convertString(src.getDescriptionElement())); + if (src.hasMode()) + tgt.setMode(convertLocationMode(src.getMode())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getType()) + tgt.addType(convertCodeableConcept(t)); + for (org.hl7.fhir.r4.model.ContactPoint t : src.getTelecom()) + tgt.addTelecom(convertContactPoint(t)); + if (src.hasAddress()) + tgt.setAddress(convertAddress(src.getAddress())); + if (src.hasPhysicalType()) + tgt.setPhysicalType(convertCodeableConcept(src.getPhysicalType())); + if (src.hasPosition()) + tgt.setPosition(convertLocationPositionComponent(src.getPosition())); + if (src.hasManagingOrganization()) + tgt.setManagingOrganization(convertReference(src.getManagingOrganization())); + if (src.hasPartOf()) + tgt.setPartOf(convertReference(src.getPartOf())); + for (org.hl7.fhir.r4.model.Location.LocationHoursOfOperationComponent t : src.getHoursOfOperation()) + tgt.addHoursOfOperation(convertLocationHoursOfOperationComponent(t)); + if (src.hasAvailabilityExceptions()) + tgt.setAvailabilityExceptionsElement(convertString(src.getAvailabilityExceptionsElement())); + for (org.hl7.fhir.r4.model.Reference t : src.getEndpoint()) + tgt.addEndpoint(convertReference(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.Location convertLocation(org.hl7.fhir.r5.model.Location src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Location tgt = new org.hl7.fhir.r4.model.Location(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasStatus()) + tgt.setStatus(convertLocationStatus(src.getStatus())); + if (src.hasOperationalStatus()) + tgt.setOperationalStatus(convertCoding(src.getOperationalStatus())); + if (src.hasName()) + tgt.setNameElement(convertString(src.getNameElement())); + for (org.hl7.fhir.r5.model.StringType t : src.getAlias()) + tgt.getAlias().add(convertString(t)); + if (src.hasDescription()) + tgt.setDescriptionElement(convertString(src.getDescriptionElement())); + if (src.hasMode()) + tgt.setMode(convertLocationMode(src.getMode())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getType()) + tgt.addType(convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.ContactPoint t : src.getTelecom()) + tgt.addTelecom(convertContactPoint(t)); + if (src.hasAddress()) + tgt.setAddress(convertAddress(src.getAddress())); + if (src.hasPhysicalType()) + tgt.setPhysicalType(convertCodeableConcept(src.getPhysicalType())); + if (src.hasPosition()) + tgt.setPosition(convertLocationPositionComponent(src.getPosition())); + if (src.hasManagingOrganization()) + tgt.setManagingOrganization(convertReference(src.getManagingOrganization())); + if (src.hasPartOf()) + tgt.setPartOf(convertReference(src.getPartOf())); + for (org.hl7.fhir.r5.model.Location.LocationHoursOfOperationComponent t : src.getHoursOfOperation()) + tgt.addHoursOfOperation(convertLocationHoursOfOperationComponent(t)); + if (src.hasAvailabilityExceptions()) + tgt.setAvailabilityExceptionsElement(convertString(src.getAvailabilityExceptionsElement())); + for (org.hl7.fhir.r5.model.Reference t : src.getEndpoint()) + tgt.addEndpoint(convertReference(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.Location.LocationStatus convertLocationStatus(org.hl7.fhir.r4.model.Location.LocationStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case ACTIVE: return org.hl7.fhir.r5.model.Location.LocationStatus.ACTIVE; + case SUSPENDED: return org.hl7.fhir.r5.model.Location.LocationStatus.SUSPENDED; + case INACTIVE: return org.hl7.fhir.r5.model.Location.LocationStatus.INACTIVE; + default: return org.hl7.fhir.r5.model.Location.LocationStatus.NULL; + } +} + + public static org.hl7.fhir.r4.model.Location.LocationStatus convertLocationStatus(org.hl7.fhir.r5.model.Location.LocationStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case ACTIVE: return org.hl7.fhir.r4.model.Location.LocationStatus.ACTIVE; + case SUSPENDED: return org.hl7.fhir.r4.model.Location.LocationStatus.SUSPENDED; + case INACTIVE: return org.hl7.fhir.r4.model.Location.LocationStatus.INACTIVE; + default: return org.hl7.fhir.r4.model.Location.LocationStatus.NULL; + } +} + + public static org.hl7.fhir.r5.model.Location.LocationMode convertLocationMode(org.hl7.fhir.r4.model.Location.LocationMode src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case INSTANCE: return org.hl7.fhir.r5.model.Location.LocationMode.INSTANCE; + case KIND: return org.hl7.fhir.r5.model.Location.LocationMode.KIND; + default: return org.hl7.fhir.r5.model.Location.LocationMode.NULL; + } +} + + public static org.hl7.fhir.r4.model.Location.LocationMode convertLocationMode(org.hl7.fhir.r5.model.Location.LocationMode src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case INSTANCE: return org.hl7.fhir.r4.model.Location.LocationMode.INSTANCE; + case KIND: return org.hl7.fhir.r4.model.Location.LocationMode.KIND; + default: return org.hl7.fhir.r4.model.Location.LocationMode.NULL; + } +} + + public static org.hl7.fhir.r5.model.Location.LocationPositionComponent convertLocationPositionComponent(org.hl7.fhir.r4.model.Location.LocationPositionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Location.LocationPositionComponent tgt = new org.hl7.fhir.r5.model.Location.LocationPositionComponent(); + copyElement(src, tgt); + if (src.hasLongitude()) + tgt.setLongitudeElement(convertDecimal(src.getLongitudeElement())); + if (src.hasLatitude()) + tgt.setLatitudeElement(convertDecimal(src.getLatitudeElement())); + if (src.hasAltitude()) + tgt.setAltitudeElement(convertDecimal(src.getAltitudeElement())); + return tgt; + } + + public static org.hl7.fhir.r4.model.Location.LocationPositionComponent convertLocationPositionComponent(org.hl7.fhir.r5.model.Location.LocationPositionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Location.LocationPositionComponent tgt = new org.hl7.fhir.r4.model.Location.LocationPositionComponent(); + copyElement(src, tgt); + if (src.hasLongitude()) + tgt.setLongitudeElement(convertDecimal(src.getLongitudeElement())); + if (src.hasLatitude()) + tgt.setLatitudeElement(convertDecimal(src.getLatitudeElement())); + if (src.hasAltitude()) + tgt.setAltitudeElement(convertDecimal(src.getAltitudeElement())); + return tgt; + } + + public static org.hl7.fhir.r5.model.Location.LocationHoursOfOperationComponent convertLocationHoursOfOperationComponent(org.hl7.fhir.r4.model.Location.LocationHoursOfOperationComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Location.LocationHoursOfOperationComponent tgt = new org.hl7.fhir.r5.model.Location.LocationHoursOfOperationComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.r4.model.Enumeration t : src.getDaysOfWeek()) + tgt.addDaysOfWeek(convertDaysOfWeek(t.getValue())); + if (src.hasAllDay()) + tgt.setAllDayElement(convertBoolean(src.getAllDayElement())); + if (src.hasOpeningTime()) + tgt.setOpeningTimeElement(convertTime(src.getOpeningTimeElement())); + if (src.hasClosingTime()) + tgt.setClosingTimeElement(convertTime(src.getClosingTimeElement())); + return tgt; + } + + public static org.hl7.fhir.r4.model.Location.LocationHoursOfOperationComponent convertLocationHoursOfOperationComponent(org.hl7.fhir.r5.model.Location.LocationHoursOfOperationComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Location.LocationHoursOfOperationComponent tgt = new org.hl7.fhir.r4.model.Location.LocationHoursOfOperationComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.r5.model.Enumeration t : src.getDaysOfWeek()) + tgt.addDaysOfWeek(convertDaysOfWeek(t.getValue())); + if (src.hasAllDay()) + tgt.setAllDayElement(convertBoolean(src.getAllDayElement())); + if (src.hasOpeningTime()) + tgt.setOpeningTimeElement(convertTime(src.getOpeningTimeElement())); + if (src.hasClosingTime()) + tgt.setClosingTimeElement(convertTime(src.getClosingTimeElement())); + return tgt; + } + + public static org.hl7.fhir.r5.model.Location.DaysOfWeek convertDaysOfWeek(org.hl7.fhir.r4.model.Location.DaysOfWeek src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case MON: return org.hl7.fhir.r5.model.Location.DaysOfWeek.MON; + case TUE: return org.hl7.fhir.r5.model.Location.DaysOfWeek.TUE; + case WED: return org.hl7.fhir.r5.model.Location.DaysOfWeek.WED; + case THU: return org.hl7.fhir.r5.model.Location.DaysOfWeek.THU; + case FRI: return org.hl7.fhir.r5.model.Location.DaysOfWeek.FRI; + case SAT: return org.hl7.fhir.r5.model.Location.DaysOfWeek.SAT; + case SUN: return org.hl7.fhir.r5.model.Location.DaysOfWeek.SUN; + default: return org.hl7.fhir.r5.model.Location.DaysOfWeek.NULL; + } +} + + public static org.hl7.fhir.r4.model.Location.DaysOfWeek convertDaysOfWeek(org.hl7.fhir.r5.model.Location.DaysOfWeek src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case MON: return org.hl7.fhir.r4.model.Location.DaysOfWeek.MON; + case TUE: return org.hl7.fhir.r4.model.Location.DaysOfWeek.TUE; + case WED: return org.hl7.fhir.r4.model.Location.DaysOfWeek.WED; + case THU: return org.hl7.fhir.r4.model.Location.DaysOfWeek.THU; + case FRI: return org.hl7.fhir.r4.model.Location.DaysOfWeek.FRI; + case SAT: return org.hl7.fhir.r4.model.Location.DaysOfWeek.SAT; + case SUN: return org.hl7.fhir.r4.model.Location.DaysOfWeek.SUN; + default: return org.hl7.fhir.r4.model.Location.DaysOfWeek.NULL; + } +} + + +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Measure.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Measure.java new file mode 100644 index 000000000..b4ba62978 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Measure.java @@ -0,0 +1,375 @@ +package org.hl7.fhir.convertors.conv40_50; + +import org.hl7.fhir.exceptions.FHIRException; + +import org.hl7.fhir.convertors.VersionConvertor_40_50; + + +/* + Copyright (c) 2011+, HL7, Inc. + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of HL7 nor the names of its contributors may be used to + endorse or promote products derived from this software without specific + prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + +*/ + +// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0 + + +public class Measure extends VersionConvertor_40_50 { + + public static org.hl7.fhir.r5.model.Measure convertMeasure(org.hl7.fhir.r4.model.Measure src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Measure tgt = new org.hl7.fhir.r5.model.Measure(); + copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrlElement(convertUri(src.getUrlElement())); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasVersion()) + tgt.setVersionElement(convertString(src.getVersionElement())); + if (src.hasName()) + tgt.setNameElement(convertString(src.getNameElement())); + if (src.hasTitle()) + tgt.setTitleElement(convertString(src.getTitleElement())); + if (src.hasSubtitle()) + tgt.setSubtitleElement(convertString(src.getSubtitleElement())); + if (src.hasStatus()) + tgt.setStatus(Enumerations.convertPublicationStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimentalElement(convertBoolean(src.getExperimentalElement())); + if (src.hasSubject()) + tgt.setSubject(convertType(src.getSubject())); + if (src.hasDate()) + tgt.setDateElement(convertDateTime(src.getDateElement())); + if (src.hasPublisher()) + tgt.setPublisherElement(convertString(src.getPublisherElement())); + for (org.hl7.fhir.r4.model.ContactDetail t : src.getContact()) + tgt.addContact(convertContactDetail(t)); + if (src.hasDescription()) + tgt.setDescriptionElement(convertMarkdown(src.getDescriptionElement())); + for (org.hl7.fhir.r4.model.UsageContext t : src.getUseContext()) + tgt.addUseContext(convertUsageContext(t)); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getJurisdiction()) + tgt.addJurisdiction(convertCodeableConcept(t)); + if (src.hasPurpose()) + tgt.setPurposeElement(convertMarkdown(src.getPurposeElement())); + if (src.hasUsage()) + tgt.setUsageElement(convertString(src.getUsageElement())); + if (src.hasCopyright()) + tgt.setCopyrightElement(convertMarkdown(src.getCopyrightElement())); + if (src.hasApprovalDate()) + tgt.setApprovalDateElement(convertDate(src.getApprovalDateElement())); + if (src.hasLastReviewDate()) + tgt.setLastReviewDateElement(convertDate(src.getLastReviewDateElement())); + if (src.hasEffectivePeriod()) + tgt.setEffectivePeriod(convertPeriod(src.getEffectivePeriod())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getTopic()) + tgt.addTopic(convertCodeableConcept(t)); + for (org.hl7.fhir.r4.model.ContactDetail t : src.getAuthor()) + tgt.addAuthor(convertContactDetail(t)); + for (org.hl7.fhir.r4.model.ContactDetail t : src.getEditor()) + tgt.addEditor(convertContactDetail(t)); + for (org.hl7.fhir.r4.model.ContactDetail t : src.getReviewer()) + tgt.addReviewer(convertContactDetail(t)); + for (org.hl7.fhir.r4.model.ContactDetail t : src.getEndorser()) + tgt.addEndorser(convertContactDetail(t)); + for (org.hl7.fhir.r4.model.RelatedArtifact t : src.getRelatedArtifact()) + tgt.addRelatedArtifact(convertRelatedArtifact(t)); + for (org.hl7.fhir.r4.model.CanonicalType t : src.getLibrary()) + tgt.getLibrary().add(convertCanonical(t)); + if (src.hasDisclaimer()) + tgt.setDisclaimerElement(convertMarkdown(src.getDisclaimerElement())); + if (src.hasScoring()) + tgt.setScoring(convertCodeableConcept(src.getScoring())); + if (src.hasCompositeScoring()) + tgt.setCompositeScoring(convertCodeableConcept(src.getCompositeScoring())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getType()) + tgt.addType(convertCodeableConcept(t)); + if (src.hasRiskAdjustment()) + tgt.setRiskAdjustmentElement(convertString(src.getRiskAdjustmentElement())); + if (src.hasRateAggregation()) + tgt.setRateAggregationElement(convertString(src.getRateAggregationElement())); + if (src.hasRationale()) + tgt.setRationaleElement(convertMarkdown(src.getRationaleElement())); + if (src.hasClinicalRecommendationStatement()) + tgt.setClinicalRecommendationStatementElement(convertMarkdown(src.getClinicalRecommendationStatementElement())); + if (src.hasImprovementNotation()) + tgt.setImprovementNotation(convertCodeableConcept(src.getImprovementNotation())); + for (org.hl7.fhir.r4.model.MarkdownType t : src.getDefinition()) + tgt.getDefinition().add(convertMarkdown(t)); + if (src.hasGuidance()) + tgt.setGuidanceElement(convertMarkdown(src.getGuidanceElement())); + for (org.hl7.fhir.r4.model.Measure.MeasureGroupComponent t : src.getGroup()) + tgt.addGroup(convertMeasureGroupComponent(t)); + for (org.hl7.fhir.r4.model.Measure.MeasureSupplementalDataComponent t : src.getSupplementalData()) + tgt.addSupplementalData(convertMeasureSupplementalDataComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.Measure convertMeasure(org.hl7.fhir.r5.model.Measure src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Measure tgt = new org.hl7.fhir.r4.model.Measure(); + copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrlElement(convertUri(src.getUrlElement())); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasVersion()) + tgt.setVersionElement(convertString(src.getVersionElement())); + if (src.hasName()) + tgt.setNameElement(convertString(src.getNameElement())); + if (src.hasTitle()) + tgt.setTitleElement(convertString(src.getTitleElement())); + if (src.hasSubtitle()) + tgt.setSubtitleElement(convertString(src.getSubtitleElement())); + if (src.hasStatus()) + tgt.setStatus(Enumerations.convertPublicationStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimentalElement(convertBoolean(src.getExperimentalElement())); + if (src.hasSubject()) + tgt.setSubject(convertType(src.getSubject())); + if (src.hasDate()) + tgt.setDateElement(convertDateTime(src.getDateElement())); + if (src.hasPublisher()) + tgt.setPublisherElement(convertString(src.getPublisherElement())); + for (org.hl7.fhir.r5.model.ContactDetail t : src.getContact()) + tgt.addContact(convertContactDetail(t)); + if (src.hasDescription()) + tgt.setDescriptionElement(convertMarkdown(src.getDescriptionElement())); + for (org.hl7.fhir.r5.model.UsageContext t : src.getUseContext()) + tgt.addUseContext(convertUsageContext(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getJurisdiction()) + tgt.addJurisdiction(convertCodeableConcept(t)); + if (src.hasPurpose()) + tgt.setPurposeElement(convertMarkdown(src.getPurposeElement())); + if (src.hasUsage()) + tgt.setUsageElement(convertString(src.getUsageElement())); + if (src.hasCopyright()) + tgt.setCopyrightElement(convertMarkdown(src.getCopyrightElement())); + if (src.hasApprovalDate()) + tgt.setApprovalDateElement(convertDate(src.getApprovalDateElement())); + if (src.hasLastReviewDate()) + tgt.setLastReviewDateElement(convertDate(src.getLastReviewDateElement())); + if (src.hasEffectivePeriod()) + tgt.setEffectivePeriod(convertPeriod(src.getEffectivePeriod())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getTopic()) + tgt.addTopic(convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.ContactDetail t : src.getAuthor()) + tgt.addAuthor(convertContactDetail(t)); + for (org.hl7.fhir.r5.model.ContactDetail t : src.getEditor()) + tgt.addEditor(convertContactDetail(t)); + for (org.hl7.fhir.r5.model.ContactDetail t : src.getReviewer()) + tgt.addReviewer(convertContactDetail(t)); + for (org.hl7.fhir.r5.model.ContactDetail t : src.getEndorser()) + tgt.addEndorser(convertContactDetail(t)); + for (org.hl7.fhir.r5.model.RelatedArtifact t : src.getRelatedArtifact()) + tgt.addRelatedArtifact(convertRelatedArtifact(t)); + for (org.hl7.fhir.r5.model.CanonicalType t : src.getLibrary()) + tgt.getLibrary().add(convertCanonical(t)); + if (src.hasDisclaimer()) + tgt.setDisclaimerElement(convertMarkdown(src.getDisclaimerElement())); + if (src.hasScoring()) + tgt.setScoring(convertCodeableConcept(src.getScoring())); + if (src.hasCompositeScoring()) + tgt.setCompositeScoring(convertCodeableConcept(src.getCompositeScoring())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getType()) + tgt.addType(convertCodeableConcept(t)); + if (src.hasRiskAdjustment()) + tgt.setRiskAdjustmentElement(convertString(src.getRiskAdjustmentElement())); + if (src.hasRateAggregation()) + tgt.setRateAggregationElement(convertString(src.getRateAggregationElement())); + if (src.hasRationale()) + tgt.setRationaleElement(convertMarkdown(src.getRationaleElement())); + if (src.hasClinicalRecommendationStatement()) + tgt.setClinicalRecommendationStatementElement(convertMarkdown(src.getClinicalRecommendationStatementElement())); + if (src.hasImprovementNotation()) + tgt.setImprovementNotation(convertCodeableConcept(src.getImprovementNotation())); + for (org.hl7.fhir.r5.model.MarkdownType t : src.getDefinition()) + tgt.getDefinition().add(convertMarkdown(t)); + if (src.hasGuidance()) + tgt.setGuidanceElement(convertMarkdown(src.getGuidanceElement())); + for (org.hl7.fhir.r5.model.Measure.MeasureGroupComponent t : src.getGroup()) + tgt.addGroup(convertMeasureGroupComponent(t)); + for (org.hl7.fhir.r5.model.Measure.MeasureSupplementalDataComponent t : src.getSupplementalData()) + tgt.addSupplementalData(convertMeasureSupplementalDataComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.Measure.MeasureGroupComponent convertMeasureGroupComponent(org.hl7.fhir.r4.model.Measure.MeasureGroupComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Measure.MeasureGroupComponent tgt = new org.hl7.fhir.r5.model.Measure.MeasureGroupComponent(); + copyElement(src, tgt); + if (src.hasCode()) + tgt.setCode(convertCodeableConcept(src.getCode())); + if (src.hasDescription()) + tgt.setDescriptionElement(convertString(src.getDescriptionElement())); + for (org.hl7.fhir.r4.model.Measure.MeasureGroupPopulationComponent t : src.getPopulation()) + tgt.addPopulation(convertMeasureGroupPopulationComponent(t)); + for (org.hl7.fhir.r4.model.Measure.MeasureGroupStratifierComponent t : src.getStratifier()) + tgt.addStratifier(convertMeasureGroupStratifierComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.Measure.MeasureGroupComponent convertMeasureGroupComponent(org.hl7.fhir.r5.model.Measure.MeasureGroupComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Measure.MeasureGroupComponent tgt = new org.hl7.fhir.r4.model.Measure.MeasureGroupComponent(); + copyElement(src, tgt); + if (src.hasCode()) + tgt.setCode(convertCodeableConcept(src.getCode())); + if (src.hasDescription()) + tgt.setDescriptionElement(convertString(src.getDescriptionElement())); + for (org.hl7.fhir.r5.model.Measure.MeasureGroupPopulationComponent t : src.getPopulation()) + tgt.addPopulation(convertMeasureGroupPopulationComponent(t)); + for (org.hl7.fhir.r5.model.Measure.MeasureGroupStratifierComponent t : src.getStratifier()) + tgt.addStratifier(convertMeasureGroupStratifierComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.Measure.MeasureGroupPopulationComponent convertMeasureGroupPopulationComponent(org.hl7.fhir.r4.model.Measure.MeasureGroupPopulationComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Measure.MeasureGroupPopulationComponent tgt = new org.hl7.fhir.r5.model.Measure.MeasureGroupPopulationComponent(); + copyElement(src, tgt); + if (src.hasCode()) + tgt.setCode(convertCodeableConcept(src.getCode())); + if (src.hasDescription()) + tgt.setDescriptionElement(convertString(src.getDescriptionElement())); + if (src.hasCriteria()) + tgt.setCriteria(convertExpression(src.getCriteria())); + return tgt; + } + + public static org.hl7.fhir.r4.model.Measure.MeasureGroupPopulationComponent convertMeasureGroupPopulationComponent(org.hl7.fhir.r5.model.Measure.MeasureGroupPopulationComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Measure.MeasureGroupPopulationComponent tgt = new org.hl7.fhir.r4.model.Measure.MeasureGroupPopulationComponent(); + copyElement(src, tgt); + if (src.hasCode()) + tgt.setCode(convertCodeableConcept(src.getCode())); + if (src.hasDescription()) + tgt.setDescriptionElement(convertString(src.getDescriptionElement())); + if (src.hasCriteria()) + tgt.setCriteria(convertExpression(src.getCriteria())); + return tgt; + } + + public static org.hl7.fhir.r5.model.Measure.MeasureGroupStratifierComponent convertMeasureGroupStratifierComponent(org.hl7.fhir.r4.model.Measure.MeasureGroupStratifierComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Measure.MeasureGroupStratifierComponent tgt = new org.hl7.fhir.r5.model.Measure.MeasureGroupStratifierComponent(); + copyElement(src, tgt); + if (src.hasCode()) + tgt.setCode(convertCodeableConcept(src.getCode())); + if (src.hasDescription()) + tgt.setDescriptionElement(convertString(src.getDescriptionElement())); + if (src.hasCriteria()) + tgt.setCriteria(convertExpression(src.getCriteria())); + for (org.hl7.fhir.r4.model.Measure.MeasureGroupStratifierComponentComponent t : src.getComponent()) + tgt.addComponent(convertMeasureGroupStratifierComponentComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.Measure.MeasureGroupStratifierComponent convertMeasureGroupStratifierComponent(org.hl7.fhir.r5.model.Measure.MeasureGroupStratifierComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Measure.MeasureGroupStratifierComponent tgt = new org.hl7.fhir.r4.model.Measure.MeasureGroupStratifierComponent(); + copyElement(src, tgt); + if (src.hasCode()) + tgt.setCode(convertCodeableConcept(src.getCode())); + if (src.hasDescription()) + tgt.setDescriptionElement(convertString(src.getDescriptionElement())); + if (src.hasCriteria()) + tgt.setCriteria(convertExpression(src.getCriteria())); + for (org.hl7.fhir.r5.model.Measure.MeasureGroupStratifierComponentComponent t : src.getComponent()) + tgt.addComponent(convertMeasureGroupStratifierComponentComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.Measure.MeasureGroupStratifierComponentComponent convertMeasureGroupStratifierComponentComponent(org.hl7.fhir.r4.model.Measure.MeasureGroupStratifierComponentComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Measure.MeasureGroupStratifierComponentComponent tgt = new org.hl7.fhir.r5.model.Measure.MeasureGroupStratifierComponentComponent(); + copyElement(src, tgt); + if (src.hasCode()) + tgt.setCode(convertCodeableConcept(src.getCode())); + if (src.hasDescription()) + tgt.setDescriptionElement(convertString(src.getDescriptionElement())); + if (src.hasCriteria()) + tgt.setCriteria(convertExpression(src.getCriteria())); + return tgt; + } + + public static org.hl7.fhir.r4.model.Measure.MeasureGroupStratifierComponentComponent convertMeasureGroupStratifierComponentComponent(org.hl7.fhir.r5.model.Measure.MeasureGroupStratifierComponentComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Measure.MeasureGroupStratifierComponentComponent tgt = new org.hl7.fhir.r4.model.Measure.MeasureGroupStratifierComponentComponent(); + copyElement(src, tgt); + if (src.hasCode()) + tgt.setCode(convertCodeableConcept(src.getCode())); + if (src.hasDescription()) + tgt.setDescriptionElement(convertString(src.getDescriptionElement())); + if (src.hasCriteria()) + tgt.setCriteria(convertExpression(src.getCriteria())); + return tgt; + } + + public static org.hl7.fhir.r5.model.Measure.MeasureSupplementalDataComponent convertMeasureSupplementalDataComponent(org.hl7.fhir.r4.model.Measure.MeasureSupplementalDataComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Measure.MeasureSupplementalDataComponent tgt = new org.hl7.fhir.r5.model.Measure.MeasureSupplementalDataComponent(); + copyElement(src, tgt); + if (src.hasCode()) + tgt.setCode(convertCodeableConcept(src.getCode())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getUsage()) + tgt.addUsage(convertCodeableConcept(t)); + if (src.hasDescription()) + tgt.setDescriptionElement(convertString(src.getDescriptionElement())); + if (src.hasCriteria()) + tgt.setCriteria(convertExpression(src.getCriteria())); + return tgt; + } + + public static org.hl7.fhir.r4.model.Measure.MeasureSupplementalDataComponent convertMeasureSupplementalDataComponent(org.hl7.fhir.r5.model.Measure.MeasureSupplementalDataComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Measure.MeasureSupplementalDataComponent tgt = new org.hl7.fhir.r4.model.Measure.MeasureSupplementalDataComponent(); + copyElement(src, tgt); + if (src.hasCode()) + tgt.setCode(convertCodeableConcept(src.getCode())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getUsage()) + tgt.addUsage(convertCodeableConcept(t)); + if (src.hasDescription()) + tgt.setDescriptionElement(convertString(src.getDescriptionElement())); + if (src.hasCriteria()) + tgt.setCriteria(convertExpression(src.getCriteria())); + return tgt; + } + + +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/MeasureReport.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/MeasureReport.java new file mode 100644 index 000000000..8c34ddf4b --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/MeasureReport.java @@ -0,0 +1,317 @@ +package org.hl7.fhir.convertors.conv40_50; + +import org.hl7.fhir.exceptions.FHIRException; + +import org.hl7.fhir.convertors.VersionConvertor_40_50; + + +/* + Copyright (c) 2011+, HL7, Inc. + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of HL7 nor the names of its contributors may be used to + endorse or promote products derived from this software without specific + prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + +*/ + +// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0 + + +public class MeasureReport extends VersionConvertor_40_50 { + + public static org.hl7.fhir.r5.model.MeasureReport convertMeasureReport(org.hl7.fhir.r4.model.MeasureReport src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.MeasureReport tgt = new org.hl7.fhir.r5.model.MeasureReport(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasStatus()) + tgt.setStatus(convertMeasureReportStatus(src.getStatus())); + if (src.hasType()) + tgt.setType(convertMeasureReportType(src.getType())); + if (src.hasMeasure()) + tgt.setMeasureElement(convertCanonical(src.getMeasureElement())); + if (src.hasSubject()) + tgt.setSubject(convertReference(src.getSubject())); + if (src.hasDate()) + tgt.setDateElement(convertDateTime(src.getDateElement())); + if (src.hasReporter()) + tgt.setReporter(convertReference(src.getReporter())); + if (src.hasPeriod()) + tgt.setPeriod(convertPeriod(src.getPeriod())); + if (src.hasImprovementNotation()) + tgt.setImprovementNotation(convertCodeableConcept(src.getImprovementNotation())); + for (org.hl7.fhir.r4.model.MeasureReport.MeasureReportGroupComponent t : src.getGroup()) + tgt.addGroup(convertMeasureReportGroupComponent(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getEvaluatedResource()) + tgt.addEvaluatedResource(convertReference(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.MeasureReport convertMeasureReport(org.hl7.fhir.r5.model.MeasureReport src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.MeasureReport tgt = new org.hl7.fhir.r4.model.MeasureReport(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasStatus()) + tgt.setStatus(convertMeasureReportStatus(src.getStatus())); + if (src.hasType()) + tgt.setType(convertMeasureReportType(src.getType())); + if (src.hasMeasure()) + tgt.setMeasureElement(convertCanonical(src.getMeasureElement())); + if (src.hasSubject()) + tgt.setSubject(convertReference(src.getSubject())); + if (src.hasDate()) + tgt.setDateElement(convertDateTime(src.getDateElement())); + if (src.hasReporter()) + tgt.setReporter(convertReference(src.getReporter())); + if (src.hasPeriod()) + tgt.setPeriod(convertPeriod(src.getPeriod())); + if (src.hasImprovementNotation()) + tgt.setImprovementNotation(convertCodeableConcept(src.getImprovementNotation())); + for (org.hl7.fhir.r5.model.MeasureReport.MeasureReportGroupComponent t : src.getGroup()) + tgt.addGroup(convertMeasureReportGroupComponent(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getEvaluatedResource()) + tgt.addEvaluatedResource(convertReference(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.MeasureReport.MeasureReportStatus convertMeasureReportStatus(org.hl7.fhir.r4.model.MeasureReport.MeasureReportStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case COMPLETE: return org.hl7.fhir.r5.model.MeasureReport.MeasureReportStatus.COMPLETE; + case PENDING: return org.hl7.fhir.r5.model.MeasureReport.MeasureReportStatus.PENDING; + case ERROR: return org.hl7.fhir.r5.model.MeasureReport.MeasureReportStatus.ERROR; + default: return org.hl7.fhir.r5.model.MeasureReport.MeasureReportStatus.NULL; + } +} + + public static org.hl7.fhir.r4.model.MeasureReport.MeasureReportStatus convertMeasureReportStatus(org.hl7.fhir.r5.model.MeasureReport.MeasureReportStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case COMPLETE: return org.hl7.fhir.r4.model.MeasureReport.MeasureReportStatus.COMPLETE; + case PENDING: return org.hl7.fhir.r4.model.MeasureReport.MeasureReportStatus.PENDING; + case ERROR: return org.hl7.fhir.r4.model.MeasureReport.MeasureReportStatus.ERROR; + default: return org.hl7.fhir.r4.model.MeasureReport.MeasureReportStatus.NULL; + } +} + + public static org.hl7.fhir.r5.model.MeasureReport.MeasureReportType convertMeasureReportType(org.hl7.fhir.r4.model.MeasureReport.MeasureReportType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case INDIVIDUAL: return org.hl7.fhir.r5.model.MeasureReport.MeasureReportType.INDIVIDUAL; + case SUBJECTLIST: return org.hl7.fhir.r5.model.MeasureReport.MeasureReportType.SUBJECTLIST; + case SUMMARY: return org.hl7.fhir.r5.model.MeasureReport.MeasureReportType.SUMMARY; + case DATACOLLECTION: return org.hl7.fhir.r5.model.MeasureReport.MeasureReportType.DATACOLLECTION; + default: return org.hl7.fhir.r5.model.MeasureReport.MeasureReportType.NULL; + } +} + + public static org.hl7.fhir.r4.model.MeasureReport.MeasureReportType convertMeasureReportType(org.hl7.fhir.r5.model.MeasureReport.MeasureReportType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case INDIVIDUAL: return org.hl7.fhir.r4.model.MeasureReport.MeasureReportType.INDIVIDUAL; + case SUBJECTLIST: return org.hl7.fhir.r4.model.MeasureReport.MeasureReportType.SUBJECTLIST; + case SUMMARY: return org.hl7.fhir.r4.model.MeasureReport.MeasureReportType.SUMMARY; + case DATACOLLECTION: return org.hl7.fhir.r4.model.MeasureReport.MeasureReportType.DATACOLLECTION; + default: return org.hl7.fhir.r4.model.MeasureReport.MeasureReportType.NULL; + } +} + + public static org.hl7.fhir.r5.model.MeasureReport.MeasureReportGroupComponent convertMeasureReportGroupComponent(org.hl7.fhir.r4.model.MeasureReport.MeasureReportGroupComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.MeasureReport.MeasureReportGroupComponent tgt = new org.hl7.fhir.r5.model.MeasureReport.MeasureReportGroupComponent(); + copyElement(src, tgt); + if (src.hasCode()) + tgt.setCode(convertCodeableConcept(src.getCode())); + for (org.hl7.fhir.r4.model.MeasureReport.MeasureReportGroupPopulationComponent t : src.getPopulation()) + tgt.addPopulation(convertMeasureReportGroupPopulationComponent(t)); + if (src.hasMeasureScore()) + tgt.setMeasureScore(convertQuantity(src.getMeasureScore())); + for (org.hl7.fhir.r4.model.MeasureReport.MeasureReportGroupStratifierComponent t : src.getStratifier()) + tgt.addStratifier(convertMeasureReportGroupStratifierComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.MeasureReport.MeasureReportGroupComponent convertMeasureReportGroupComponent(org.hl7.fhir.r5.model.MeasureReport.MeasureReportGroupComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.MeasureReport.MeasureReportGroupComponent tgt = new org.hl7.fhir.r4.model.MeasureReport.MeasureReportGroupComponent(); + copyElement(src, tgt); + if (src.hasCode()) + tgt.setCode(convertCodeableConcept(src.getCode())); + for (org.hl7.fhir.r5.model.MeasureReport.MeasureReportGroupPopulationComponent t : src.getPopulation()) + tgt.addPopulation(convertMeasureReportGroupPopulationComponent(t)); + if (src.hasMeasureScore()) + tgt.setMeasureScore(convertQuantity(src.getMeasureScore())); + for (org.hl7.fhir.r5.model.MeasureReport.MeasureReportGroupStratifierComponent t : src.getStratifier()) + tgt.addStratifier(convertMeasureReportGroupStratifierComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.MeasureReport.MeasureReportGroupPopulationComponent convertMeasureReportGroupPopulationComponent(org.hl7.fhir.r4.model.MeasureReport.MeasureReportGroupPopulationComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.MeasureReport.MeasureReportGroupPopulationComponent tgt = new org.hl7.fhir.r5.model.MeasureReport.MeasureReportGroupPopulationComponent(); + copyElement(src, tgt); + if (src.hasCode()) + tgt.setCode(convertCodeableConcept(src.getCode())); + if (src.hasCount()) + tgt.setCountElement(convertInteger(src.getCountElement())); + if (src.hasSubjectResults()) + tgt.setSubjectResults(convertReference(src.getSubjectResults())); + return tgt; + } + + public static org.hl7.fhir.r4.model.MeasureReport.MeasureReportGroupPopulationComponent convertMeasureReportGroupPopulationComponent(org.hl7.fhir.r5.model.MeasureReport.MeasureReportGroupPopulationComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.MeasureReport.MeasureReportGroupPopulationComponent tgt = new org.hl7.fhir.r4.model.MeasureReport.MeasureReportGroupPopulationComponent(); + copyElement(src, tgt); + if (src.hasCode()) + tgt.setCode(convertCodeableConcept(src.getCode())); + if (src.hasCount()) + tgt.setCountElement(convertInteger(src.getCountElement())); + if (src.hasSubjectResults()) + tgt.setSubjectResults(convertReference(src.getSubjectResults())); + return tgt; + } + + public static org.hl7.fhir.r5.model.MeasureReport.MeasureReportGroupStratifierComponent convertMeasureReportGroupStratifierComponent(org.hl7.fhir.r4.model.MeasureReport.MeasureReportGroupStratifierComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.MeasureReport.MeasureReportGroupStratifierComponent tgt = new org.hl7.fhir.r5.model.MeasureReport.MeasureReportGroupStratifierComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getCode()) + tgt.addCode(convertCodeableConcept(t)); + for (org.hl7.fhir.r4.model.MeasureReport.StratifierGroupComponent t : src.getStratum()) + tgt.addStratum(convertStratifierGroupComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.MeasureReport.MeasureReportGroupStratifierComponent convertMeasureReportGroupStratifierComponent(org.hl7.fhir.r5.model.MeasureReport.MeasureReportGroupStratifierComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.MeasureReport.MeasureReportGroupStratifierComponent tgt = new org.hl7.fhir.r4.model.MeasureReport.MeasureReportGroupStratifierComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getCode()) + tgt.addCode(convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.MeasureReport.StratifierGroupComponent t : src.getStratum()) + tgt.addStratum(convertStratifierGroupComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.MeasureReport.StratifierGroupComponent convertStratifierGroupComponent(org.hl7.fhir.r4.model.MeasureReport.StratifierGroupComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.MeasureReport.StratifierGroupComponent tgt = new org.hl7.fhir.r5.model.MeasureReport.StratifierGroupComponent(); + copyElement(src, tgt); + if (src.hasValue()) + tgt.setValue(convertCodeableConcept(src.getValue())); + for (org.hl7.fhir.r4.model.MeasureReport.StratifierGroupComponentComponent t : src.getComponent()) + tgt.addComponent(convertStratifierGroupComponentComponent(t)); + for (org.hl7.fhir.r4.model.MeasureReport.StratifierGroupPopulationComponent t : src.getPopulation()) + tgt.addPopulation(convertStratifierGroupPopulationComponent(t)); + if (src.hasMeasureScore()) + tgt.setMeasureScore(convertQuantity(src.getMeasureScore())); + return tgt; + } + + public static org.hl7.fhir.r4.model.MeasureReport.StratifierGroupComponent convertStratifierGroupComponent(org.hl7.fhir.r5.model.MeasureReport.StratifierGroupComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.MeasureReport.StratifierGroupComponent tgt = new org.hl7.fhir.r4.model.MeasureReport.StratifierGroupComponent(); + copyElement(src, tgt); + if (src.hasValue()) + tgt.setValue(convertCodeableConcept(src.getValue())); + for (org.hl7.fhir.r5.model.MeasureReport.StratifierGroupComponentComponent t : src.getComponent()) + tgt.addComponent(convertStratifierGroupComponentComponent(t)); + for (org.hl7.fhir.r5.model.MeasureReport.StratifierGroupPopulationComponent t : src.getPopulation()) + tgt.addPopulation(convertStratifierGroupPopulationComponent(t)); + if (src.hasMeasureScore()) + tgt.setMeasureScore(convertQuantity(src.getMeasureScore())); + return tgt; + } + + public static org.hl7.fhir.r5.model.MeasureReport.StratifierGroupComponentComponent convertStratifierGroupComponentComponent(org.hl7.fhir.r4.model.MeasureReport.StratifierGroupComponentComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.MeasureReport.StratifierGroupComponentComponent tgt = new org.hl7.fhir.r5.model.MeasureReport.StratifierGroupComponentComponent(); + copyElement(src, tgt); + if (src.hasCode()) + tgt.setCode(convertCodeableConcept(src.getCode())); + if (src.hasValue()) + tgt.setValue(convertCodeableConcept(src.getValue())); + return tgt; + } + + public static org.hl7.fhir.r4.model.MeasureReport.StratifierGroupComponentComponent convertStratifierGroupComponentComponent(org.hl7.fhir.r5.model.MeasureReport.StratifierGroupComponentComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.MeasureReport.StratifierGroupComponentComponent tgt = new org.hl7.fhir.r4.model.MeasureReport.StratifierGroupComponentComponent(); + copyElement(src, tgt); + if (src.hasCode()) + tgt.setCode(convertCodeableConcept(src.getCode())); + if (src.hasValue()) + tgt.setValue(convertCodeableConcept(src.getValue())); + return tgt; + } + + public static org.hl7.fhir.r5.model.MeasureReport.StratifierGroupPopulationComponent convertStratifierGroupPopulationComponent(org.hl7.fhir.r4.model.MeasureReport.StratifierGroupPopulationComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.MeasureReport.StratifierGroupPopulationComponent tgt = new org.hl7.fhir.r5.model.MeasureReport.StratifierGroupPopulationComponent(); + copyElement(src, tgt); + if (src.hasCode()) + tgt.setCode(convertCodeableConcept(src.getCode())); + if (src.hasCount()) + tgt.setCountElement(convertInteger(src.getCountElement())); + if (src.hasSubjectResults()) + tgt.setSubjectResults(convertReference(src.getSubjectResults())); + return tgt; + } + + public static org.hl7.fhir.r4.model.MeasureReport.StratifierGroupPopulationComponent convertStratifierGroupPopulationComponent(org.hl7.fhir.r5.model.MeasureReport.StratifierGroupPopulationComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.MeasureReport.StratifierGroupPopulationComponent tgt = new org.hl7.fhir.r4.model.MeasureReport.StratifierGroupPopulationComponent(); + copyElement(src, tgt); + if (src.hasCode()) + tgt.setCode(convertCodeableConcept(src.getCode())); + if (src.hasCount()) + tgt.setCountElement(convertInteger(src.getCountElement())); + if (src.hasSubjectResults()) + tgt.setSubjectResults(convertReference(src.getSubjectResults())); + return tgt; + } + + +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Media.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Media.java new file mode 100644 index 000000000..cd0924200 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Media.java @@ -0,0 +1,179 @@ +package org.hl7.fhir.convertors.conv40_50; + +import org.hl7.fhir.exceptions.FHIRException; + +import org.hl7.fhir.convertors.VersionConvertor_40_50; + + +/* + Copyright (c) 2011+, HL7, Inc. + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of HL7 nor the names of its contributors may be used to + endorse or promote products derived from this software without specific + prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + +*/ + +// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0 + + +public class Media extends VersionConvertor_40_50 { + + public static org.hl7.fhir.r5.model.Media convertMedia(org.hl7.fhir.r4.model.Media src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Media tgt = new org.hl7.fhir.r5.model.Media(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getBasedOn()) + tgt.addBasedOn(convertReference(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getPartOf()) + tgt.addPartOf(convertReference(t)); + if (src.hasStatus()) + tgt.setStatus(convertMediaStatus(src.getStatus())); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + if (src.hasModality()) + tgt.setModality(convertCodeableConcept(src.getModality())); + if (src.hasView()) + tgt.setView(convertCodeableConcept(src.getView())); + if (src.hasSubject()) + tgt.setSubject(convertReference(src.getSubject())); + if (src.hasEncounter()) + tgt.setEncounter(convertReference(src.getEncounter())); + if (src.hasCreated()) + tgt.setCreated(convertType(src.getCreated())); + if (src.hasIssued()) + tgt.setIssuedElement(convertInstant(src.getIssuedElement())); + if (src.hasOperator()) + tgt.setOperator(convertReference(src.getOperator())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getReasonCode()) + tgt.addReasonCode(convertCodeableConcept(t)); + if (src.hasBodySite()) + tgt.setBodySite(convertCodeableConcept(src.getBodySite())); + if (src.hasDeviceName()) + tgt.setDeviceNameElement(convertString(src.getDeviceNameElement())); + if (src.hasDevice()) + tgt.setDevice(convertReference(src.getDevice())); + if (src.hasHeight()) + tgt.setHeightElement(convertPositiveInt(src.getHeightElement())); + if (src.hasWidth()) + tgt.setWidthElement(convertPositiveInt(src.getWidthElement())); + if (src.hasFrames()) + tgt.setFramesElement(convertPositiveInt(src.getFramesElement())); + if (src.hasDuration()) + tgt.setDurationElement(convertDecimal(src.getDurationElement())); + if (src.hasContent()) + tgt.setContent(convertAttachment(src.getContent())); + for (org.hl7.fhir.r4.model.Annotation t : src.getNote()) + tgt.addNote(convertAnnotation(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.Media convertMedia(org.hl7.fhir.r5.model.Media src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Media tgt = new org.hl7.fhir.r4.model.Media(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getBasedOn()) + tgt.addBasedOn(convertReference(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getPartOf()) + tgt.addPartOf(convertReference(t)); + if (src.hasStatus()) + tgt.setStatus(convertMediaStatus(src.getStatus())); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + if (src.hasModality()) + tgt.setModality(convertCodeableConcept(src.getModality())); + if (src.hasView()) + tgt.setView(convertCodeableConcept(src.getView())); + if (src.hasSubject()) + tgt.setSubject(convertReference(src.getSubject())); + if (src.hasEncounter()) + tgt.setEncounter(convertReference(src.getEncounter())); + if (src.hasCreated()) + tgt.setCreated(convertType(src.getCreated())); + if (src.hasIssued()) + tgt.setIssuedElement(convertInstant(src.getIssuedElement())); + if (src.hasOperator()) + tgt.setOperator(convertReference(src.getOperator())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getReasonCode()) + tgt.addReasonCode(convertCodeableConcept(t)); + if (src.hasBodySite()) + tgt.setBodySite(convertCodeableConcept(src.getBodySite())); + if (src.hasDeviceName()) + tgt.setDeviceNameElement(convertString(src.getDeviceNameElement())); + if (src.hasDevice()) + tgt.setDevice(convertReference(src.getDevice())); + if (src.hasHeight()) + tgt.setHeightElement(convertPositiveInt(src.getHeightElement())); + if (src.hasWidth()) + tgt.setWidthElement(convertPositiveInt(src.getWidthElement())); + if (src.hasFrames()) + tgt.setFramesElement(convertPositiveInt(src.getFramesElement())); + if (src.hasDuration()) + tgt.setDurationElement(convertDecimal(src.getDurationElement())); + if (src.hasContent()) + tgt.setContent(convertAttachment(src.getContent())); + for (org.hl7.fhir.r5.model.Annotation t : src.getNote()) + tgt.addNote(convertAnnotation(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.Media.MediaStatus convertMediaStatus(org.hl7.fhir.r4.model.Media.MediaStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PREPARATION: return org.hl7.fhir.r5.model.Media.MediaStatus.PREPARATION; + case INPROGRESS: return org.hl7.fhir.r5.model.Media.MediaStatus.INPROGRESS; + case NOTDONE: return org.hl7.fhir.r5.model.Media.MediaStatus.NOTDONE; + case ONHOLD: return org.hl7.fhir.r5.model.Media.MediaStatus.ONHOLD; + case STOPPED: return org.hl7.fhir.r5.model.Media.MediaStatus.STOPPED; + case COMPLETED: return org.hl7.fhir.r5.model.Media.MediaStatus.COMPLETED; + case ENTEREDINERROR: return org.hl7.fhir.r5.model.Media.MediaStatus.ENTEREDINERROR; + case UNKNOWN: return org.hl7.fhir.r5.model.Media.MediaStatus.UNKNOWN; + default: return org.hl7.fhir.r5.model.Media.MediaStatus.NULL; + } +} + + public static org.hl7.fhir.r4.model.Media.MediaStatus convertMediaStatus(org.hl7.fhir.r5.model.Media.MediaStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PREPARATION: return org.hl7.fhir.r4.model.Media.MediaStatus.PREPARATION; + case INPROGRESS: return org.hl7.fhir.r4.model.Media.MediaStatus.INPROGRESS; + case NOTDONE: return org.hl7.fhir.r4.model.Media.MediaStatus.NOTDONE; + case ONHOLD: return org.hl7.fhir.r4.model.Media.MediaStatus.ONHOLD; + case STOPPED: return org.hl7.fhir.r4.model.Media.MediaStatus.STOPPED; + case COMPLETED: return org.hl7.fhir.r4.model.Media.MediaStatus.COMPLETED; + case ENTEREDINERROR: return org.hl7.fhir.r4.model.Media.MediaStatus.ENTEREDINERROR; + case UNKNOWN: return org.hl7.fhir.r4.model.Media.MediaStatus.UNKNOWN; + default: return org.hl7.fhir.r4.model.Media.MediaStatus.NULL; + } +} + + +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Medication.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Medication.java new file mode 100644 index 000000000..7ee0b277a --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Medication.java @@ -0,0 +1,165 @@ +package org.hl7.fhir.convertors.conv40_50; + +import org.hl7.fhir.exceptions.FHIRException; + +import org.hl7.fhir.convertors.VersionConvertor_40_50; + + +/* + Copyright (c) 2011+, HL7, Inc. + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of HL7 nor the names of its contributors may be used to + endorse or promote products derived from this software without specific + prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + +*/ + +// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0 + + +public class Medication extends VersionConvertor_40_50 { + + public static org.hl7.fhir.r5.model.Medication convertMedication(org.hl7.fhir.r4.model.Medication src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Medication tgt = new org.hl7.fhir.r5.model.Medication(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasCode()) + tgt.setCode(convertCodeableConcept(src.getCode())); + if (src.hasStatus()) + tgt.setStatus(convertMedicationStatus(src.getStatus())); + if (src.hasManufacturer()) + tgt.setManufacturer(convertReference(src.getManufacturer())); + if (src.hasForm()) + tgt.setForm(convertCodeableConcept(src.getForm())); + if (src.hasAmount()) + tgt.setAmount(convertRatio(src.getAmount())); + for (org.hl7.fhir.r4.model.Medication.MedicationIngredientComponent t : src.getIngredient()) + tgt.addIngredient(convertMedicationIngredientComponent(t)); + if (src.hasBatch()) + tgt.setBatch(convertMedicationBatchComponent(src.getBatch())); + return tgt; + } + + public static org.hl7.fhir.r4.model.Medication convertMedication(org.hl7.fhir.r5.model.Medication src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Medication tgt = new org.hl7.fhir.r4.model.Medication(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasCode()) + tgt.setCode(convertCodeableConcept(src.getCode())); + if (src.hasStatus()) + tgt.setStatus(convertMedicationStatus(src.getStatus())); + if (src.hasManufacturer()) + tgt.setManufacturer(convertReference(src.getManufacturer())); + if (src.hasForm()) + tgt.setForm(convertCodeableConcept(src.getForm())); + if (src.hasAmount()) + tgt.setAmount(convertRatio(src.getAmount())); + for (org.hl7.fhir.r5.model.Medication.MedicationIngredientComponent t : src.getIngredient()) + tgt.addIngredient(convertMedicationIngredientComponent(t)); + if (src.hasBatch()) + tgt.setBatch(convertMedicationBatchComponent(src.getBatch())); + return tgt; + } + + public static org.hl7.fhir.r5.model.Medication.MedicationStatus convertMedicationStatus(org.hl7.fhir.r4.model.Medication.MedicationStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case ACTIVE: return org.hl7.fhir.r5.model.Medication.MedicationStatus.ACTIVE; + case INACTIVE: return org.hl7.fhir.r5.model.Medication.MedicationStatus.INACTIVE; + case ENTEREDINERROR: return org.hl7.fhir.r5.model.Medication.MedicationStatus.ENTEREDINERROR; + default: return org.hl7.fhir.r5.model.Medication.MedicationStatus.NULL; + } +} + + public static org.hl7.fhir.r4.model.Medication.MedicationStatus convertMedicationStatus(org.hl7.fhir.r5.model.Medication.MedicationStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case ACTIVE: return org.hl7.fhir.r4.model.Medication.MedicationStatus.ACTIVE; + case INACTIVE: return org.hl7.fhir.r4.model.Medication.MedicationStatus.INACTIVE; + case ENTEREDINERROR: return org.hl7.fhir.r4.model.Medication.MedicationStatus.ENTEREDINERROR; + default: return org.hl7.fhir.r4.model.Medication.MedicationStatus.NULL; + } +} + + public static org.hl7.fhir.r5.model.Medication.MedicationIngredientComponent convertMedicationIngredientComponent(org.hl7.fhir.r4.model.Medication.MedicationIngredientComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Medication.MedicationIngredientComponent tgt = new org.hl7.fhir.r5.model.Medication.MedicationIngredientComponent(); + copyElement(src, tgt); + if (src.hasItem()) + tgt.setItem(convertType(src.getItem())); + if (src.hasIsActive()) + tgt.setIsActiveElement(convertBoolean(src.getIsActiveElement())); + if (src.hasStrength()) + tgt.setStrength(convertRatio(src.getStrength())); + return tgt; + } + + public static org.hl7.fhir.r4.model.Medication.MedicationIngredientComponent convertMedicationIngredientComponent(org.hl7.fhir.r5.model.Medication.MedicationIngredientComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Medication.MedicationIngredientComponent tgt = new org.hl7.fhir.r4.model.Medication.MedicationIngredientComponent(); + copyElement(src, tgt); + if (src.hasItem()) + tgt.setItem(convertType(src.getItem())); + if (src.hasIsActive()) + tgt.setIsActiveElement(convertBoolean(src.getIsActiveElement())); + if (src.hasStrength()) + tgt.setStrength(convertRatio(src.getStrength())); + return tgt; + } + + public static org.hl7.fhir.r5.model.Medication.MedicationBatchComponent convertMedicationBatchComponent(org.hl7.fhir.r4.model.Medication.MedicationBatchComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Medication.MedicationBatchComponent tgt = new org.hl7.fhir.r5.model.Medication.MedicationBatchComponent(); + copyElement(src, tgt); + if (src.hasLotNumber()) + tgt.setLotNumberElement(convertString(src.getLotNumberElement())); + if (src.hasExpirationDate()) + tgt.setExpirationDateElement(convertDateTime(src.getExpirationDateElement())); + return tgt; + } + + public static org.hl7.fhir.r4.model.Medication.MedicationBatchComponent convertMedicationBatchComponent(org.hl7.fhir.r5.model.Medication.MedicationBatchComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Medication.MedicationBatchComponent tgt = new org.hl7.fhir.r4.model.Medication.MedicationBatchComponent(); + copyElement(src, tgt); + if (src.hasLotNumber()) + tgt.setLotNumberElement(convertString(src.getLotNumberElement())); + if (src.hasExpirationDate()) + tgt.setExpirationDateElement(convertDateTime(src.getExpirationDateElement())); + return tgt; + } + + +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/MedicationAdministration.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/MedicationAdministration.java new file mode 100644 index 000000000..752a0b1b6 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/MedicationAdministration.java @@ -0,0 +1,199 @@ +package org.hl7.fhir.convertors.conv40_50; + +import org.hl7.fhir.exceptions.FHIRException; + +import org.hl7.fhir.convertors.VersionConvertor_40_50; + + +/* + Copyright (c) 2011+, HL7, Inc. + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of HL7 nor the names of its contributors may be used to + endorse or promote products derived from this software without specific + prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + +*/ + +// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0 + + +public class MedicationAdministration extends VersionConvertor_40_50 { + + public static org.hl7.fhir.r5.model.MedicationAdministration convertMedicationAdministration(org.hl7.fhir.r4.model.MedicationAdministration src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.MedicationAdministration tgt = new org.hl7.fhir.r5.model.MedicationAdministration(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + for (org.hl7.fhir.r4.model.UriType t : src.getInstantiates()) + tgt.getInstantiates().add(convertUri(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getPartOf()) + tgt.addPartOf(convertReference(t)); + if (src.hasStatus()) + tgt.setStatusElement(convertCode(src.getStatusElement())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getStatusReason()) + tgt.addStatusReason(convertCodeableConcept(t)); + if (src.hasCategory()) + tgt.setCategory(convertCodeableConcept(src.getCategory())); + if (src.hasMedication()) + tgt.setMedication(convertType(src.getMedication())); + if (src.hasSubject()) + tgt.setSubject(convertReference(src.getSubject())); + if (src.hasContext()) + tgt.setContext(convertReference(src.getContext())); + for (org.hl7.fhir.r4.model.Reference t : src.getSupportingInformation()) + tgt.addSupportingInformation(convertReference(t)); + if (src.hasEffective()) + tgt.setEffective(convertType(src.getEffective())); + for (org.hl7.fhir.r4.model.MedicationAdministration.MedicationAdministrationPerformerComponent t : src.getPerformer()) + tgt.addPerformer(convertMedicationAdministrationPerformerComponent(t)); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getReasonCode()) + tgt.addReasonCode(convertCodeableConcept(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getReasonReference()) + tgt.addReasonReference(convertReference(t)); + if (src.hasRequest()) + tgt.setRequest(convertReference(src.getRequest())); + for (org.hl7.fhir.r4.model.Reference t : src.getDevice()) + tgt.addDevice(convertReference(t)); + for (org.hl7.fhir.r4.model.Annotation t : src.getNote()) + tgt.addNote(convertAnnotation(t)); + if (src.hasDosage()) + tgt.setDosage(convertMedicationAdministrationDosageComponent(src.getDosage())); + for (org.hl7.fhir.r4.model.Reference t : src.getEventHistory()) + tgt.addEventHistory(convertReference(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.MedicationAdministration convertMedicationAdministration(org.hl7.fhir.r5.model.MedicationAdministration src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.MedicationAdministration tgt = new org.hl7.fhir.r4.model.MedicationAdministration(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + for (org.hl7.fhir.r5.model.UriType t : src.getInstantiates()) + tgt.getInstantiates().add(convertUri(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getPartOf()) + tgt.addPartOf(convertReference(t)); + if (src.hasStatus()) + tgt.setStatusElement(convertCode(src.getStatusElement())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getStatusReason()) + tgt.addStatusReason(convertCodeableConcept(t)); + if (src.hasCategory()) + tgt.setCategory(convertCodeableConcept(src.getCategory())); + if (src.hasMedication()) + tgt.setMedication(convertType(src.getMedication())); + if (src.hasSubject()) + tgt.setSubject(convertReference(src.getSubject())); + if (src.hasContext()) + tgt.setContext(convertReference(src.getContext())); + for (org.hl7.fhir.r5.model.Reference t : src.getSupportingInformation()) + tgt.addSupportingInformation(convertReference(t)); + if (src.hasEffective()) + tgt.setEffective(convertType(src.getEffective())); + for (org.hl7.fhir.r5.model.MedicationAdministration.MedicationAdministrationPerformerComponent t : src.getPerformer()) + tgt.addPerformer(convertMedicationAdministrationPerformerComponent(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getReasonCode()) + tgt.addReasonCode(convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getReasonReference()) + tgt.addReasonReference(convertReference(t)); + if (src.hasRequest()) + tgt.setRequest(convertReference(src.getRequest())); + for (org.hl7.fhir.r5.model.Reference t : src.getDevice()) + tgt.addDevice(convertReference(t)); + for (org.hl7.fhir.r5.model.Annotation t : src.getNote()) + tgt.addNote(convertAnnotation(t)); + if (src.hasDosage()) + tgt.setDosage(convertMedicationAdministrationDosageComponent(src.getDosage())); + for (org.hl7.fhir.r5.model.Reference t : src.getEventHistory()) + tgt.addEventHistory(convertReference(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.MedicationAdministration.MedicationAdministrationPerformerComponent convertMedicationAdministrationPerformerComponent(org.hl7.fhir.r4.model.MedicationAdministration.MedicationAdministrationPerformerComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.MedicationAdministration.MedicationAdministrationPerformerComponent tgt = new org.hl7.fhir.r5.model.MedicationAdministration.MedicationAdministrationPerformerComponent(); + copyElement(src, tgt); + if (src.hasFunction()) + tgt.setFunction(convertCodeableConcept(src.getFunction())); + if (src.hasActor()) + tgt.setActor(convertReference(src.getActor())); + return tgt; + } + + public static org.hl7.fhir.r4.model.MedicationAdministration.MedicationAdministrationPerformerComponent convertMedicationAdministrationPerformerComponent(org.hl7.fhir.r5.model.MedicationAdministration.MedicationAdministrationPerformerComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.MedicationAdministration.MedicationAdministrationPerformerComponent tgt = new org.hl7.fhir.r4.model.MedicationAdministration.MedicationAdministrationPerformerComponent(); + copyElement(src, tgt); + if (src.hasFunction()) + tgt.setFunction(convertCodeableConcept(src.getFunction())); + if (src.hasActor()) + tgt.setActor(convertReference(src.getActor())); + return tgt; + } + + public static org.hl7.fhir.r5.model.MedicationAdministration.MedicationAdministrationDosageComponent convertMedicationAdministrationDosageComponent(org.hl7.fhir.r4.model.MedicationAdministration.MedicationAdministrationDosageComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.MedicationAdministration.MedicationAdministrationDosageComponent tgt = new org.hl7.fhir.r5.model.MedicationAdministration.MedicationAdministrationDosageComponent(); + copyElement(src, tgt); + if (src.hasText()) + tgt.setTextElement(convertString(src.getTextElement())); + if (src.hasSite()) + tgt.setSite(convertCodeableConcept(src.getSite())); + if (src.hasRoute()) + tgt.setRoute(convertCodeableConcept(src.getRoute())); + if (src.hasMethod()) + tgt.setMethod(convertCodeableConcept(src.getMethod())); + if (src.hasDose()) + tgt.setDose(convertSimpleQuantity(src.getDose())); + if (src.hasRate()) + tgt.setRate(convertType(src.getRate())); + return tgt; + } + + public static org.hl7.fhir.r4.model.MedicationAdministration.MedicationAdministrationDosageComponent convertMedicationAdministrationDosageComponent(org.hl7.fhir.r5.model.MedicationAdministration.MedicationAdministrationDosageComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.MedicationAdministration.MedicationAdministrationDosageComponent tgt = new org.hl7.fhir.r4.model.MedicationAdministration.MedicationAdministrationDosageComponent(); + copyElement(src, tgt); + if (src.hasText()) + tgt.setTextElement(convertString(src.getTextElement())); + if (src.hasSite()) + tgt.setSite(convertCodeableConcept(src.getSite())); + if (src.hasRoute()) + tgt.setRoute(convertCodeableConcept(src.getRoute())); + if (src.hasMethod()) + tgt.setMethod(convertCodeableConcept(src.getMethod())); + if (src.hasDose()) + tgt.setDose(convertSimpleQuantity(src.getDose())); + if (src.hasRate()) + tgt.setRate(convertType(src.getRate())); + return tgt; + } + + +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/MedicationDispense.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/MedicationDispense.java new file mode 100644 index 000000000..ef28d0647 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/MedicationDispense.java @@ -0,0 +1,211 @@ +package org.hl7.fhir.convertors.conv40_50; + +import org.hl7.fhir.exceptions.FHIRException; + +import org.hl7.fhir.convertors.VersionConvertor_40_50; + + +/* + Copyright (c) 2011+, HL7, Inc. + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of HL7 nor the names of its contributors may be used to + endorse or promote products derived from this software without specific + prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + +*/ + +// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0 + + +public class MedicationDispense extends VersionConvertor_40_50 { + + public static org.hl7.fhir.r5.model.MedicationDispense convertMedicationDispense(org.hl7.fhir.r4.model.MedicationDispense src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.MedicationDispense tgt = new org.hl7.fhir.r5.model.MedicationDispense(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getPartOf()) + tgt.addPartOf(convertReference(t)); + if (src.hasStatus()) + tgt.setStatusElement(convertCode(src.getStatusElement())); + if (src.hasStatusReason()) + tgt.setStatusReason(convertType(src.getStatusReason())); + if (src.hasCategory()) + tgt.setCategory(convertCodeableConcept(src.getCategory())); + if (src.hasMedication()) + tgt.setMedication(convertType(src.getMedication())); + if (src.hasSubject()) + tgt.setSubject(convertReference(src.getSubject())); + if (src.hasContext()) + tgt.setContext(convertReference(src.getContext())); + for (org.hl7.fhir.r4.model.Reference t : src.getSupportingInformation()) + tgt.addSupportingInformation(convertReference(t)); + for (org.hl7.fhir.r4.model.MedicationDispense.MedicationDispensePerformerComponent t : src.getPerformer()) + tgt.addPerformer(convertMedicationDispensePerformerComponent(t)); + if (src.hasLocation()) + tgt.setLocation(convertReference(src.getLocation())); + for (org.hl7.fhir.r4.model.Reference t : src.getAuthorizingPrescription()) + tgt.addAuthorizingPrescription(convertReference(t)); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + if (src.hasQuantity()) + tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); + if (src.hasDaysSupply()) + tgt.setDaysSupply(convertSimpleQuantity(src.getDaysSupply())); + if (src.hasWhenPrepared()) + tgt.setWhenPreparedElement(convertDateTime(src.getWhenPreparedElement())); + if (src.hasWhenHandedOver()) + tgt.setWhenHandedOverElement(convertDateTime(src.getWhenHandedOverElement())); + if (src.hasDestination()) + tgt.setDestination(convertReference(src.getDestination())); + for (org.hl7.fhir.r4.model.Reference t : src.getReceiver()) + tgt.addReceiver(convertReference(t)); + for (org.hl7.fhir.r4.model.Annotation t : src.getNote()) + tgt.addNote(convertAnnotation(t)); + for (org.hl7.fhir.r4.model.Dosage t : src.getDosageInstruction()) + tgt.addDosageInstruction(convertDosage(t)); + if (src.hasSubstitution()) + tgt.setSubstitution(convertMedicationDispenseSubstitutionComponent(src.getSubstitution())); + for (org.hl7.fhir.r4.model.Reference t : src.getDetectedIssue()) + tgt.addDetectedIssue(convertReference(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getEventHistory()) + tgt.addEventHistory(convertReference(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.MedicationDispense convertMedicationDispense(org.hl7.fhir.r5.model.MedicationDispense src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.MedicationDispense tgt = new org.hl7.fhir.r4.model.MedicationDispense(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getPartOf()) + tgt.addPartOf(convertReference(t)); + if (src.hasStatus()) + tgt.setStatusElement(convertCode(src.getStatusElement())); + if (src.hasStatusReason()) + tgt.setStatusReason(convertType(src.getStatusReason())); + if (src.hasCategory()) + tgt.setCategory(convertCodeableConcept(src.getCategory())); + if (src.hasMedication()) + tgt.setMedication(convertType(src.getMedication())); + if (src.hasSubject()) + tgt.setSubject(convertReference(src.getSubject())); + if (src.hasContext()) + tgt.setContext(convertReference(src.getContext())); + for (org.hl7.fhir.r5.model.Reference t : src.getSupportingInformation()) + tgt.addSupportingInformation(convertReference(t)); + for (org.hl7.fhir.r5.model.MedicationDispense.MedicationDispensePerformerComponent t : src.getPerformer()) + tgt.addPerformer(convertMedicationDispensePerformerComponent(t)); + if (src.hasLocation()) + tgt.setLocation(convertReference(src.getLocation())); + for (org.hl7.fhir.r5.model.Reference t : src.getAuthorizingPrescription()) + tgt.addAuthorizingPrescription(convertReference(t)); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + if (src.hasQuantity()) + tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); + if (src.hasDaysSupply()) + tgt.setDaysSupply(convertSimpleQuantity(src.getDaysSupply())); + if (src.hasWhenPrepared()) + tgt.setWhenPreparedElement(convertDateTime(src.getWhenPreparedElement())); + if (src.hasWhenHandedOver()) + tgt.setWhenHandedOverElement(convertDateTime(src.getWhenHandedOverElement())); + if (src.hasDestination()) + tgt.setDestination(convertReference(src.getDestination())); + for (org.hl7.fhir.r5.model.Reference t : src.getReceiver()) + tgt.addReceiver(convertReference(t)); + for (org.hl7.fhir.r5.model.Annotation t : src.getNote()) + tgt.addNote(convertAnnotation(t)); + for (org.hl7.fhir.r5.model.Dosage t : src.getDosageInstruction()) + tgt.addDosageInstruction(convertDosage(t)); + if (src.hasSubstitution()) + tgt.setSubstitution(convertMedicationDispenseSubstitutionComponent(src.getSubstitution())); + for (org.hl7.fhir.r5.model.Reference t : src.getDetectedIssue()) + tgt.addDetectedIssue(convertReference(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getEventHistory()) + tgt.addEventHistory(convertReference(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.MedicationDispense.MedicationDispensePerformerComponent convertMedicationDispensePerformerComponent(org.hl7.fhir.r4.model.MedicationDispense.MedicationDispensePerformerComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.MedicationDispense.MedicationDispensePerformerComponent tgt = new org.hl7.fhir.r5.model.MedicationDispense.MedicationDispensePerformerComponent(); + copyElement(src, tgt); + if (src.hasFunction()) + tgt.setFunction(convertCodeableConcept(src.getFunction())); + if (src.hasActor()) + tgt.setActor(convertReference(src.getActor())); + return tgt; + } + + public static org.hl7.fhir.r4.model.MedicationDispense.MedicationDispensePerformerComponent convertMedicationDispensePerformerComponent(org.hl7.fhir.r5.model.MedicationDispense.MedicationDispensePerformerComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.MedicationDispense.MedicationDispensePerformerComponent tgt = new org.hl7.fhir.r4.model.MedicationDispense.MedicationDispensePerformerComponent(); + copyElement(src, tgt); + if (src.hasFunction()) + tgt.setFunction(convertCodeableConcept(src.getFunction())); + if (src.hasActor()) + tgt.setActor(convertReference(src.getActor())); + return tgt; + } + + public static org.hl7.fhir.r5.model.MedicationDispense.MedicationDispenseSubstitutionComponent convertMedicationDispenseSubstitutionComponent(org.hl7.fhir.r4.model.MedicationDispense.MedicationDispenseSubstitutionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.MedicationDispense.MedicationDispenseSubstitutionComponent tgt = new org.hl7.fhir.r5.model.MedicationDispense.MedicationDispenseSubstitutionComponent(); + copyElement(src, tgt); + if (src.hasWasSubstituted()) + tgt.setWasSubstitutedElement(convertBoolean(src.getWasSubstitutedElement())); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getReason()) + tgt.addReason(convertCodeableConcept(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getResponsibleParty()) + tgt.addResponsibleParty(convertReference(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.MedicationDispense.MedicationDispenseSubstitutionComponent convertMedicationDispenseSubstitutionComponent(org.hl7.fhir.r5.model.MedicationDispense.MedicationDispenseSubstitutionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.MedicationDispense.MedicationDispenseSubstitutionComponent tgt = new org.hl7.fhir.r4.model.MedicationDispense.MedicationDispenseSubstitutionComponent(); + copyElement(src, tgt); + if (src.hasWasSubstituted()) + tgt.setWasSubstitutedElement(convertBoolean(src.getWasSubstitutedElement())); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getReason()) + tgt.addReason(convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getResponsibleParty()) + tgt.addResponsibleParty(convertReference(t)); + return tgt; + } + + +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/MedicationKnowledge.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/MedicationKnowledge.java new file mode 100644 index 000000000..6dd65a026 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/MedicationKnowledge.java @@ -0,0 +1,551 @@ +package org.hl7.fhir.convertors.conv40_50; + +import org.hl7.fhir.exceptions.FHIRException; + +import org.hl7.fhir.convertors.VersionConvertor_40_50; + + +/* + Copyright (c) 2011+, HL7, Inc. + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of HL7 nor the names of its contributors may be used to + endorse or promote products derived from this software without specific + prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + +*/ + +// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0 + + +public class MedicationKnowledge extends VersionConvertor_40_50 { + + public static org.hl7.fhir.r5.model.MedicationKnowledge convertMedicationKnowledge(org.hl7.fhir.r4.model.MedicationKnowledge src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.MedicationKnowledge tgt = new org.hl7.fhir.r5.model.MedicationKnowledge(); + copyDomainResource(src, tgt); + if (src.hasCode()) + tgt.setCode(convertCodeableConcept(src.getCode())); + if (src.hasStatus()) + tgt.setStatusElement(convertCode(src.getStatusElement())); + if (src.hasManufacturer()) + tgt.setManufacturer(convertReference(src.getManufacturer())); + if (src.hasDoseForm()) + tgt.setDoseForm(convertCodeableConcept(src.getDoseForm())); + if (src.hasAmount()) + tgt.setAmount(convertSimpleQuantity(src.getAmount())); + for (org.hl7.fhir.r4.model.StringType t : src.getSynonym()) + tgt.getSynonym().add(convertString(t)); + for (org.hl7.fhir.r4.model.MedicationKnowledge.MedicationKnowledgeRelatedMedicationKnowledgeComponent t : src.getRelatedMedicationKnowledge()) + tgt.addRelatedMedicationKnowledge(convertMedicationKnowledgeRelatedMedicationKnowledgeComponent(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getAssociatedMedication()) + tgt.addAssociatedMedication(convertReference(t)); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getProductType()) + tgt.addProductType(convertCodeableConcept(t)); + for (org.hl7.fhir.r4.model.MedicationKnowledge.MedicationKnowledgeMonographComponent t : src.getMonograph()) + tgt.addMonograph(convertMedicationKnowledgeMonographComponent(t)); + for (org.hl7.fhir.r4.model.MedicationKnowledge.MedicationKnowledgeIngredientComponent t : src.getIngredient()) + tgt.addIngredient(convertMedicationKnowledgeIngredientComponent(t)); + if (src.hasPreparationInstruction()) + tgt.setPreparationInstructionElement(convertMarkdown(src.getPreparationInstructionElement())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getIntendedRoute()) + tgt.addIntendedRoute(convertCodeableConcept(t)); + for (org.hl7.fhir.r4.model.MedicationKnowledge.MedicationKnowledgeCostComponent t : src.getCost()) + tgt.addCost(convertMedicationKnowledgeCostComponent(t)); + for (org.hl7.fhir.r4.model.MedicationKnowledge.MedicationKnowledgeMonitoringProgramComponent t : src.getMonitoringProgram()) + tgt.addMonitoringProgram(convertMedicationKnowledgeMonitoringProgramComponent(t)); + for (org.hl7.fhir.r4.model.MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesComponent t : src.getAdministrationGuidelines()) + tgt.addAdministrationGuidelines(convertMedicationKnowledgeAdministrationGuidelinesComponent(t)); + for (org.hl7.fhir.r4.model.MedicationKnowledge.MedicationKnowledgeMedicineClassificationComponent t : src.getMedicineClassification()) + tgt.addMedicineClassification(convertMedicationKnowledgeMedicineClassificationComponent(t)); + if (src.hasPackaging()) + tgt.setPackaging(convertMedicationKnowledgePackagingComponent(src.getPackaging())); + for (org.hl7.fhir.r4.model.MedicationKnowledge.MedicationKnowledgeDrugCharacteristicComponent t : src.getDrugCharacteristic()) + tgt.addDrugCharacteristic(convertMedicationKnowledgeDrugCharacteristicComponent(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getContraindication()) + tgt.addContraindication(convertReference(t)); + for (org.hl7.fhir.r4.model.MedicationKnowledge.MedicationKnowledgeRegulatoryComponent t : src.getRegulatory()) + tgt.addRegulatory(convertMedicationKnowledgeRegulatoryComponent(t)); + for (org.hl7.fhir.r4.model.MedicationKnowledge.MedicationKnowledgeKineticsComponent t : src.getKinetics()) + tgt.addKinetics(convertMedicationKnowledgeKineticsComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.MedicationKnowledge convertMedicationKnowledge(org.hl7.fhir.r5.model.MedicationKnowledge src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.MedicationKnowledge tgt = new org.hl7.fhir.r4.model.MedicationKnowledge(); + copyDomainResource(src, tgt); + if (src.hasCode()) + tgt.setCode(convertCodeableConcept(src.getCode())); + if (src.hasStatus()) + tgt.setStatusElement(convertCode(src.getStatusElement())); + if (src.hasManufacturer()) + tgt.setManufacturer(convertReference(src.getManufacturer())); + if (src.hasDoseForm()) + tgt.setDoseForm(convertCodeableConcept(src.getDoseForm())); + if (src.hasAmount()) + tgt.setAmount(convertSimpleQuantity(src.getAmount())); + for (org.hl7.fhir.r5.model.StringType t : src.getSynonym()) + tgt.getSynonym().add(convertString(t)); + for (org.hl7.fhir.r5.model.MedicationKnowledge.MedicationKnowledgeRelatedMedicationKnowledgeComponent t : src.getRelatedMedicationKnowledge()) + tgt.addRelatedMedicationKnowledge(convertMedicationKnowledgeRelatedMedicationKnowledgeComponent(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getAssociatedMedication()) + tgt.addAssociatedMedication(convertReference(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getProductType()) + tgt.addProductType(convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.MedicationKnowledge.MedicationKnowledgeMonographComponent t : src.getMonograph()) + tgt.addMonograph(convertMedicationKnowledgeMonographComponent(t)); + for (org.hl7.fhir.r5.model.MedicationKnowledge.MedicationKnowledgeIngredientComponent t : src.getIngredient()) + tgt.addIngredient(convertMedicationKnowledgeIngredientComponent(t)); + if (src.hasPreparationInstruction()) + tgt.setPreparationInstructionElement(convertMarkdown(src.getPreparationInstructionElement())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getIntendedRoute()) + tgt.addIntendedRoute(convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.MedicationKnowledge.MedicationKnowledgeCostComponent t : src.getCost()) + tgt.addCost(convertMedicationKnowledgeCostComponent(t)); + for (org.hl7.fhir.r5.model.MedicationKnowledge.MedicationKnowledgeMonitoringProgramComponent t : src.getMonitoringProgram()) + tgt.addMonitoringProgram(convertMedicationKnowledgeMonitoringProgramComponent(t)); + for (org.hl7.fhir.r5.model.MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesComponent t : src.getAdministrationGuidelines()) + tgt.addAdministrationGuidelines(convertMedicationKnowledgeAdministrationGuidelinesComponent(t)); + for (org.hl7.fhir.r5.model.MedicationKnowledge.MedicationKnowledgeMedicineClassificationComponent t : src.getMedicineClassification()) + tgt.addMedicineClassification(convertMedicationKnowledgeMedicineClassificationComponent(t)); + if (src.hasPackaging()) + tgt.setPackaging(convertMedicationKnowledgePackagingComponent(src.getPackaging())); + for (org.hl7.fhir.r5.model.MedicationKnowledge.MedicationKnowledgeDrugCharacteristicComponent t : src.getDrugCharacteristic()) + tgt.addDrugCharacteristic(convertMedicationKnowledgeDrugCharacteristicComponent(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getContraindication()) + tgt.addContraindication(convertReference(t)); + for (org.hl7.fhir.r5.model.MedicationKnowledge.MedicationKnowledgeRegulatoryComponent t : src.getRegulatory()) + tgt.addRegulatory(convertMedicationKnowledgeRegulatoryComponent(t)); + for (org.hl7.fhir.r5.model.MedicationKnowledge.MedicationKnowledgeKineticsComponent t : src.getKinetics()) + tgt.addKinetics(convertMedicationKnowledgeKineticsComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.MedicationKnowledge.MedicationKnowledgeRelatedMedicationKnowledgeComponent convertMedicationKnowledgeRelatedMedicationKnowledgeComponent(org.hl7.fhir.r4.model.MedicationKnowledge.MedicationKnowledgeRelatedMedicationKnowledgeComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.MedicationKnowledge.MedicationKnowledgeRelatedMedicationKnowledgeComponent tgt = new org.hl7.fhir.r5.model.MedicationKnowledge.MedicationKnowledgeRelatedMedicationKnowledgeComponent(); + copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + for (org.hl7.fhir.r4.model.Reference t : src.getReference()) + tgt.addReference(convertReference(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.MedicationKnowledge.MedicationKnowledgeRelatedMedicationKnowledgeComponent convertMedicationKnowledgeRelatedMedicationKnowledgeComponent(org.hl7.fhir.r5.model.MedicationKnowledge.MedicationKnowledgeRelatedMedicationKnowledgeComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.MedicationKnowledge.MedicationKnowledgeRelatedMedicationKnowledgeComponent tgt = new org.hl7.fhir.r4.model.MedicationKnowledge.MedicationKnowledgeRelatedMedicationKnowledgeComponent(); + copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + for (org.hl7.fhir.r5.model.Reference t : src.getReference()) + tgt.addReference(convertReference(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.MedicationKnowledge.MedicationKnowledgeMonographComponent convertMedicationKnowledgeMonographComponent(org.hl7.fhir.r4.model.MedicationKnowledge.MedicationKnowledgeMonographComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.MedicationKnowledge.MedicationKnowledgeMonographComponent tgt = new org.hl7.fhir.r5.model.MedicationKnowledge.MedicationKnowledgeMonographComponent(); + copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + if (src.hasSource()) + tgt.setSource(convertReference(src.getSource())); + return tgt; + } + + public static org.hl7.fhir.r4.model.MedicationKnowledge.MedicationKnowledgeMonographComponent convertMedicationKnowledgeMonographComponent(org.hl7.fhir.r5.model.MedicationKnowledge.MedicationKnowledgeMonographComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.MedicationKnowledge.MedicationKnowledgeMonographComponent tgt = new org.hl7.fhir.r4.model.MedicationKnowledge.MedicationKnowledgeMonographComponent(); + copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + if (src.hasSource()) + tgt.setSource(convertReference(src.getSource())); + return tgt; + } + + public static org.hl7.fhir.r5.model.MedicationKnowledge.MedicationKnowledgeIngredientComponent convertMedicationKnowledgeIngredientComponent(org.hl7.fhir.r4.model.MedicationKnowledge.MedicationKnowledgeIngredientComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.MedicationKnowledge.MedicationKnowledgeIngredientComponent tgt = new org.hl7.fhir.r5.model.MedicationKnowledge.MedicationKnowledgeIngredientComponent(); + copyElement(src, tgt); + if (src.hasItem()) + tgt.setItem(convertType(src.getItem())); + if (src.hasIsActive()) + tgt.setIsActiveElement(convertBoolean(src.getIsActiveElement())); + if (src.hasStrength()) + tgt.setStrength(convertRatio(src.getStrength())); + return tgt; + } + + public static org.hl7.fhir.r4.model.MedicationKnowledge.MedicationKnowledgeIngredientComponent convertMedicationKnowledgeIngredientComponent(org.hl7.fhir.r5.model.MedicationKnowledge.MedicationKnowledgeIngredientComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.MedicationKnowledge.MedicationKnowledgeIngredientComponent tgt = new org.hl7.fhir.r4.model.MedicationKnowledge.MedicationKnowledgeIngredientComponent(); + copyElement(src, tgt); + if (src.hasItem()) + tgt.setItem(convertType(src.getItem())); + if (src.hasIsActive()) + tgt.setIsActiveElement(convertBoolean(src.getIsActiveElement())); + if (src.hasStrength()) + tgt.setStrength(convertRatio(src.getStrength())); + return tgt; + } + + public static org.hl7.fhir.r5.model.MedicationKnowledge.MedicationKnowledgeCostComponent convertMedicationKnowledgeCostComponent(org.hl7.fhir.r4.model.MedicationKnowledge.MedicationKnowledgeCostComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.MedicationKnowledge.MedicationKnowledgeCostComponent tgt = new org.hl7.fhir.r5.model.MedicationKnowledge.MedicationKnowledgeCostComponent(); + copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + if (src.hasSource()) + tgt.setSourceElement(convertString(src.getSourceElement())); + if (src.hasCost()) + tgt.setCost(convertMoney(src.getCost())); + return tgt; + } + + public static org.hl7.fhir.r4.model.MedicationKnowledge.MedicationKnowledgeCostComponent convertMedicationKnowledgeCostComponent(org.hl7.fhir.r5.model.MedicationKnowledge.MedicationKnowledgeCostComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.MedicationKnowledge.MedicationKnowledgeCostComponent tgt = new org.hl7.fhir.r4.model.MedicationKnowledge.MedicationKnowledgeCostComponent(); + copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + if (src.hasSource()) + tgt.setSourceElement(convertString(src.getSourceElement())); + if (src.hasCost()) + tgt.setCost(convertMoney(src.getCost())); + return tgt; + } + + public static org.hl7.fhir.r5.model.MedicationKnowledge.MedicationKnowledgeMonitoringProgramComponent convertMedicationKnowledgeMonitoringProgramComponent(org.hl7.fhir.r4.model.MedicationKnowledge.MedicationKnowledgeMonitoringProgramComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.MedicationKnowledge.MedicationKnowledgeMonitoringProgramComponent tgt = new org.hl7.fhir.r5.model.MedicationKnowledge.MedicationKnowledgeMonitoringProgramComponent(); + copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + if (src.hasName()) + tgt.setNameElement(convertString(src.getNameElement())); + return tgt; + } + + public static org.hl7.fhir.r4.model.MedicationKnowledge.MedicationKnowledgeMonitoringProgramComponent convertMedicationKnowledgeMonitoringProgramComponent(org.hl7.fhir.r5.model.MedicationKnowledge.MedicationKnowledgeMonitoringProgramComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.MedicationKnowledge.MedicationKnowledgeMonitoringProgramComponent tgt = new org.hl7.fhir.r4.model.MedicationKnowledge.MedicationKnowledgeMonitoringProgramComponent(); + copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + if (src.hasName()) + tgt.setNameElement(convertString(src.getNameElement())); + return tgt; + } + + public static org.hl7.fhir.r5.model.MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesComponent convertMedicationKnowledgeAdministrationGuidelinesComponent(org.hl7.fhir.r4.model.MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesComponent tgt = new org.hl7.fhir.r5.model.MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.r4.model.MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesDosageComponent t : src.getDosage()) + tgt.addDosage(convertMedicationKnowledgeAdministrationGuidelinesDosageComponent(t)); + if (src.hasIndication()) + tgt.setIndication(convertType(src.getIndication())); + for (org.hl7.fhir.r4.model.MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesPatientCharacteristicsComponent t : src.getPatientCharacteristics()) + tgt.addPatientCharacteristics(convertMedicationKnowledgeAdministrationGuidelinesPatientCharacteristicsComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesComponent convertMedicationKnowledgeAdministrationGuidelinesComponent(org.hl7.fhir.r5.model.MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesComponent tgt = new org.hl7.fhir.r4.model.MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.r5.model.MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesDosageComponent t : src.getDosage()) + tgt.addDosage(convertMedicationKnowledgeAdministrationGuidelinesDosageComponent(t)); + if (src.hasIndication()) + tgt.setIndication(convertType(src.getIndication())); + for (org.hl7.fhir.r5.model.MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesPatientCharacteristicsComponent t : src.getPatientCharacteristics()) + tgt.addPatientCharacteristics(convertMedicationKnowledgeAdministrationGuidelinesPatientCharacteristicsComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesDosageComponent convertMedicationKnowledgeAdministrationGuidelinesDosageComponent(org.hl7.fhir.r4.model.MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesDosageComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesDosageComponent tgt = new org.hl7.fhir.r5.model.MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesDosageComponent(); + copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + for (org.hl7.fhir.r4.model.Dosage t : src.getDosage()) + tgt.addDosage(convertDosage(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesDosageComponent convertMedicationKnowledgeAdministrationGuidelinesDosageComponent(org.hl7.fhir.r5.model.MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesDosageComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesDosageComponent tgt = new org.hl7.fhir.r4.model.MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesDosageComponent(); + copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + for (org.hl7.fhir.r5.model.Dosage t : src.getDosage()) + tgt.addDosage(convertDosage(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesPatientCharacteristicsComponent convertMedicationKnowledgeAdministrationGuidelinesPatientCharacteristicsComponent(org.hl7.fhir.r4.model.MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesPatientCharacteristicsComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesPatientCharacteristicsComponent tgt = new org.hl7.fhir.r5.model.MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesPatientCharacteristicsComponent(); + copyElement(src, tgt); + if (src.hasCharacteristic()) + tgt.setCharacteristic(convertType(src.getCharacteristic())); + for (org.hl7.fhir.r4.model.StringType t : src.getValue()) + tgt.getValue().add(convertString(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesPatientCharacteristicsComponent convertMedicationKnowledgeAdministrationGuidelinesPatientCharacteristicsComponent(org.hl7.fhir.r5.model.MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesPatientCharacteristicsComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesPatientCharacteristicsComponent tgt = new org.hl7.fhir.r4.model.MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesPatientCharacteristicsComponent(); + copyElement(src, tgt); + if (src.hasCharacteristic()) + tgt.setCharacteristic(convertType(src.getCharacteristic())); + for (org.hl7.fhir.r5.model.StringType t : src.getValue()) + tgt.getValue().add(convertString(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.MedicationKnowledge.MedicationKnowledgeMedicineClassificationComponent convertMedicationKnowledgeMedicineClassificationComponent(org.hl7.fhir.r4.model.MedicationKnowledge.MedicationKnowledgeMedicineClassificationComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.MedicationKnowledge.MedicationKnowledgeMedicineClassificationComponent tgt = new org.hl7.fhir.r5.model.MedicationKnowledge.MedicationKnowledgeMedicineClassificationComponent(); + copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getClassification()) + tgt.addClassification(convertCodeableConcept(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.MedicationKnowledge.MedicationKnowledgeMedicineClassificationComponent convertMedicationKnowledgeMedicineClassificationComponent(org.hl7.fhir.r5.model.MedicationKnowledge.MedicationKnowledgeMedicineClassificationComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.MedicationKnowledge.MedicationKnowledgeMedicineClassificationComponent tgt = new org.hl7.fhir.r4.model.MedicationKnowledge.MedicationKnowledgeMedicineClassificationComponent(); + copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getClassification()) + tgt.addClassification(convertCodeableConcept(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.MedicationKnowledge.MedicationKnowledgePackagingComponent convertMedicationKnowledgePackagingComponent(org.hl7.fhir.r4.model.MedicationKnowledge.MedicationKnowledgePackagingComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.MedicationKnowledge.MedicationKnowledgePackagingComponent tgt = new org.hl7.fhir.r5.model.MedicationKnowledge.MedicationKnowledgePackagingComponent(); + copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + if (src.hasQuantity()) + tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); + return tgt; + } + + public static org.hl7.fhir.r4.model.MedicationKnowledge.MedicationKnowledgePackagingComponent convertMedicationKnowledgePackagingComponent(org.hl7.fhir.r5.model.MedicationKnowledge.MedicationKnowledgePackagingComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.MedicationKnowledge.MedicationKnowledgePackagingComponent tgt = new org.hl7.fhir.r4.model.MedicationKnowledge.MedicationKnowledgePackagingComponent(); + copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + if (src.hasQuantity()) + tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); + return tgt; + } + + public static org.hl7.fhir.r5.model.MedicationKnowledge.MedicationKnowledgeDrugCharacteristicComponent convertMedicationKnowledgeDrugCharacteristicComponent(org.hl7.fhir.r4.model.MedicationKnowledge.MedicationKnowledgeDrugCharacteristicComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.MedicationKnowledge.MedicationKnowledgeDrugCharacteristicComponent tgt = new org.hl7.fhir.r5.model.MedicationKnowledge.MedicationKnowledgeDrugCharacteristicComponent(); + copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + if (src.hasValue()) + tgt.setValue(convertType(src.getValue())); + return tgt; + } + + public static org.hl7.fhir.r4.model.MedicationKnowledge.MedicationKnowledgeDrugCharacteristicComponent convertMedicationKnowledgeDrugCharacteristicComponent(org.hl7.fhir.r5.model.MedicationKnowledge.MedicationKnowledgeDrugCharacteristicComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.MedicationKnowledge.MedicationKnowledgeDrugCharacteristicComponent tgt = new org.hl7.fhir.r4.model.MedicationKnowledge.MedicationKnowledgeDrugCharacteristicComponent(); + copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + if (src.hasValue()) + tgt.setValue(convertType(src.getValue())); + return tgt; + } + + public static org.hl7.fhir.r5.model.MedicationKnowledge.MedicationKnowledgeRegulatoryComponent convertMedicationKnowledgeRegulatoryComponent(org.hl7.fhir.r4.model.MedicationKnowledge.MedicationKnowledgeRegulatoryComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.MedicationKnowledge.MedicationKnowledgeRegulatoryComponent tgt = new org.hl7.fhir.r5.model.MedicationKnowledge.MedicationKnowledgeRegulatoryComponent(); + copyElement(src, tgt); + if (src.hasRegulatoryAuthority()) + tgt.setRegulatoryAuthority(convertReference(src.getRegulatoryAuthority())); + for (org.hl7.fhir.r4.model.MedicationKnowledge.MedicationKnowledgeRegulatorySubstitutionComponent t : src.getSubstitution()) + tgt.addSubstitution(convertMedicationKnowledgeRegulatorySubstitutionComponent(t)); + for (org.hl7.fhir.r4.model.MedicationKnowledge.MedicationKnowledgeRegulatoryScheduleComponent t : src.getSchedule()) + tgt.addSchedule(convertMedicationKnowledgeRegulatoryScheduleComponent(t)); + if (src.hasMaxDispense()) + tgt.setMaxDispense(convertMedicationKnowledgeRegulatoryMaxDispenseComponent(src.getMaxDispense())); + return tgt; + } + + public static org.hl7.fhir.r4.model.MedicationKnowledge.MedicationKnowledgeRegulatoryComponent convertMedicationKnowledgeRegulatoryComponent(org.hl7.fhir.r5.model.MedicationKnowledge.MedicationKnowledgeRegulatoryComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.MedicationKnowledge.MedicationKnowledgeRegulatoryComponent tgt = new org.hl7.fhir.r4.model.MedicationKnowledge.MedicationKnowledgeRegulatoryComponent(); + copyElement(src, tgt); + if (src.hasRegulatoryAuthority()) + tgt.setRegulatoryAuthority(convertReference(src.getRegulatoryAuthority())); + for (org.hl7.fhir.r5.model.MedicationKnowledge.MedicationKnowledgeRegulatorySubstitutionComponent t : src.getSubstitution()) + tgt.addSubstitution(convertMedicationKnowledgeRegulatorySubstitutionComponent(t)); + for (org.hl7.fhir.r5.model.MedicationKnowledge.MedicationKnowledgeRegulatoryScheduleComponent t : src.getSchedule()) + tgt.addSchedule(convertMedicationKnowledgeRegulatoryScheduleComponent(t)); + if (src.hasMaxDispense()) + tgt.setMaxDispense(convertMedicationKnowledgeRegulatoryMaxDispenseComponent(src.getMaxDispense())); + return tgt; + } + + public static org.hl7.fhir.r5.model.MedicationKnowledge.MedicationKnowledgeRegulatorySubstitutionComponent convertMedicationKnowledgeRegulatorySubstitutionComponent(org.hl7.fhir.r4.model.MedicationKnowledge.MedicationKnowledgeRegulatorySubstitutionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.MedicationKnowledge.MedicationKnowledgeRegulatorySubstitutionComponent tgt = new org.hl7.fhir.r5.model.MedicationKnowledge.MedicationKnowledgeRegulatorySubstitutionComponent(); + copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + if (src.hasAllowed()) + tgt.setAllowedElement(convertBoolean(src.getAllowedElement())); + return tgt; + } + + public static org.hl7.fhir.r4.model.MedicationKnowledge.MedicationKnowledgeRegulatorySubstitutionComponent convertMedicationKnowledgeRegulatorySubstitutionComponent(org.hl7.fhir.r5.model.MedicationKnowledge.MedicationKnowledgeRegulatorySubstitutionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.MedicationKnowledge.MedicationKnowledgeRegulatorySubstitutionComponent tgt = new org.hl7.fhir.r4.model.MedicationKnowledge.MedicationKnowledgeRegulatorySubstitutionComponent(); + copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + if (src.hasAllowed()) + tgt.setAllowedElement(convertBoolean(src.getAllowedElement())); + return tgt; + } + + public static org.hl7.fhir.r5.model.MedicationKnowledge.MedicationKnowledgeRegulatoryScheduleComponent convertMedicationKnowledgeRegulatoryScheduleComponent(org.hl7.fhir.r4.model.MedicationKnowledge.MedicationKnowledgeRegulatoryScheduleComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.MedicationKnowledge.MedicationKnowledgeRegulatoryScheduleComponent tgt = new org.hl7.fhir.r5.model.MedicationKnowledge.MedicationKnowledgeRegulatoryScheduleComponent(); + copyElement(src, tgt); + if (src.hasSchedule()) + tgt.setSchedule(convertCodeableConcept(src.getSchedule())); + return tgt; + } + + public static org.hl7.fhir.r4.model.MedicationKnowledge.MedicationKnowledgeRegulatoryScheduleComponent convertMedicationKnowledgeRegulatoryScheduleComponent(org.hl7.fhir.r5.model.MedicationKnowledge.MedicationKnowledgeRegulatoryScheduleComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.MedicationKnowledge.MedicationKnowledgeRegulatoryScheduleComponent tgt = new org.hl7.fhir.r4.model.MedicationKnowledge.MedicationKnowledgeRegulatoryScheduleComponent(); + copyElement(src, tgt); + if (src.hasSchedule()) + tgt.setSchedule(convertCodeableConcept(src.getSchedule())); + return tgt; + } + + public static org.hl7.fhir.r5.model.MedicationKnowledge.MedicationKnowledgeRegulatoryMaxDispenseComponent convertMedicationKnowledgeRegulatoryMaxDispenseComponent(org.hl7.fhir.r4.model.MedicationKnowledge.MedicationKnowledgeRegulatoryMaxDispenseComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.MedicationKnowledge.MedicationKnowledgeRegulatoryMaxDispenseComponent tgt = new org.hl7.fhir.r5.model.MedicationKnowledge.MedicationKnowledgeRegulatoryMaxDispenseComponent(); + copyElement(src, tgt); + if (src.hasQuantity()) + tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); + if (src.hasPeriod()) + tgt.setPeriod(convertDuration(src.getPeriod())); + return tgt; + } + + public static org.hl7.fhir.r4.model.MedicationKnowledge.MedicationKnowledgeRegulatoryMaxDispenseComponent convertMedicationKnowledgeRegulatoryMaxDispenseComponent(org.hl7.fhir.r5.model.MedicationKnowledge.MedicationKnowledgeRegulatoryMaxDispenseComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.MedicationKnowledge.MedicationKnowledgeRegulatoryMaxDispenseComponent tgt = new org.hl7.fhir.r4.model.MedicationKnowledge.MedicationKnowledgeRegulatoryMaxDispenseComponent(); + copyElement(src, tgt); + if (src.hasQuantity()) + tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); + if (src.hasPeriod()) + tgt.setPeriod(convertDuration(src.getPeriod())); + return tgt; + } + + public static org.hl7.fhir.r5.model.MedicationKnowledge.MedicationKnowledgeKineticsComponent convertMedicationKnowledgeKineticsComponent(org.hl7.fhir.r4.model.MedicationKnowledge.MedicationKnowledgeKineticsComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.MedicationKnowledge.MedicationKnowledgeKineticsComponent tgt = new org.hl7.fhir.r5.model.MedicationKnowledge.MedicationKnowledgeKineticsComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.r4.model.Quantity t : src.getAreaUnderCurve()) + tgt.addAreaUnderCurve(convertSimpleQuantity(t)); + for (org.hl7.fhir.r4.model.Quantity t : src.getLethalDose50()) + tgt.addLethalDose50(convertSimpleQuantity(t)); + if (src.hasHalfLifePeriod()) + tgt.setHalfLifePeriod(convertDuration(src.getHalfLifePeriod())); + return tgt; + } + + public static org.hl7.fhir.r4.model.MedicationKnowledge.MedicationKnowledgeKineticsComponent convertMedicationKnowledgeKineticsComponent(org.hl7.fhir.r5.model.MedicationKnowledge.MedicationKnowledgeKineticsComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.MedicationKnowledge.MedicationKnowledgeKineticsComponent tgt = new org.hl7.fhir.r4.model.MedicationKnowledge.MedicationKnowledgeKineticsComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.r5.model.Quantity t : src.getAreaUnderCurve()) + tgt.addAreaUnderCurve(convertSimpleQuantity(t)); + for (org.hl7.fhir.r5.model.Quantity t : src.getLethalDose50()) + tgt.addLethalDose50(convertSimpleQuantity(t)); + if (src.hasHalfLifePeriod()) + tgt.setHalfLifePeriod(convertDuration(src.getHalfLifePeriod())); + return tgt; + } + + +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/MedicationRequest.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/MedicationRequest.java new file mode 100644 index 000000000..eff4cf513 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/MedicationRequest.java @@ -0,0 +1,367 @@ +package org.hl7.fhir.convertors.conv40_50; + +import org.hl7.fhir.exceptions.FHIRException; + +import org.hl7.fhir.convertors.VersionConvertor_40_50; + + +/* + Copyright (c) 2011+, HL7, Inc. + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of HL7 nor the names of its contributors may be used to + endorse or promote products derived from this software without specific + prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + +*/ + +// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0 + + +public class MedicationRequest extends VersionConvertor_40_50 { + + public static org.hl7.fhir.r5.model.MedicationRequest convertMedicationRequest(org.hl7.fhir.r4.model.MedicationRequest src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.MedicationRequest tgt = new org.hl7.fhir.r5.model.MedicationRequest(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasStatus()) + tgt.setStatus(convertMedicationRequestStatus(src.getStatus())); + if (src.hasStatusReason()) + tgt.setStatusReason(convertCodeableConcept(src.getStatusReason())); + if (src.hasIntent()) + tgt.setIntent(convertMedicationRequestIntent(src.getIntent())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getCategory()) + tgt.addCategory(convertCodeableConcept(t)); + if (src.hasPriority()) + tgt.setPriority(convertMedicationRequestPriority(src.getPriority())); + if (src.hasDoNotPerform()) + tgt.setDoNotPerformElement(convertBoolean(src.getDoNotPerformElement())); + if (src.hasReported()) + tgt.setReported(convertType(src.getReported())); + if (src.hasMedication()) + tgt.setMedication(convertType(src.getMedication())); + if (src.hasSubject()) + tgt.setSubject(convertReference(src.getSubject())); + if (src.hasEncounter()) + tgt.setEncounter(convertReference(src.getEncounter())); + for (org.hl7.fhir.r4.model.Reference t : src.getSupportingInformation()) + tgt.addSupportingInformation(convertReference(t)); + if (src.hasAuthoredOn()) + tgt.setAuthoredOnElement(convertDateTime(src.getAuthoredOnElement())); + if (src.hasRequester()) + tgt.setRequester(convertReference(src.getRequester())); + if (src.hasPerformer()) + tgt.setPerformer(convertReference(src.getPerformer())); + if (src.hasPerformerType()) + tgt.setPerformerType(convertCodeableConcept(src.getPerformerType())); + if (src.hasRecorder()) + tgt.setRecorder(convertReference(src.getRecorder())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getReasonCode()) + tgt.addReasonCode(convertCodeableConcept(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getReasonReference()) + tgt.addReasonReference(convertReference(t)); + for (org.hl7.fhir.r4.model.CanonicalType t : src.getInstantiatesCanonical()) + tgt.getInstantiatesCanonical().add(convertCanonical(t)); + for (org.hl7.fhir.r4.model.UriType t : src.getInstantiatesUri()) + tgt.getInstantiatesUri().add(convertUri(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getBasedOn()) + tgt.addBasedOn(convertReference(t)); + if (src.hasGroupIdentifier()) + tgt.setGroupIdentifier(convertIdentifier(src.getGroupIdentifier())); + if (src.hasCourseOfTherapyType()) + tgt.setCourseOfTherapyType(convertCodeableConcept(src.getCourseOfTherapyType())); + for (org.hl7.fhir.r4.model.Reference t : src.getInsurance()) + tgt.addInsurance(convertReference(t)); + for (org.hl7.fhir.r4.model.Annotation t : src.getNote()) + tgt.addNote(convertAnnotation(t)); + for (org.hl7.fhir.r4.model.Dosage t : src.getDosageInstruction()) + tgt.addDosageInstruction(convertDosage(t)); + if (src.hasDispenseRequest()) + tgt.setDispenseRequest(convertMedicationRequestDispenseRequestComponent(src.getDispenseRequest())); + if (src.hasSubstitution()) + tgt.setSubstitution(convertMedicationRequestSubstitutionComponent(src.getSubstitution())); + if (src.hasPriorPrescription()) + tgt.setPriorPrescription(convertReference(src.getPriorPrescription())); + for (org.hl7.fhir.r4.model.Reference t : src.getDetectedIssue()) + tgt.addDetectedIssue(convertReference(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getEventHistory()) + tgt.addEventHistory(convertReference(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.MedicationRequest convertMedicationRequest(org.hl7.fhir.r5.model.MedicationRequest src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.MedicationRequest tgt = new org.hl7.fhir.r4.model.MedicationRequest(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasStatus()) + tgt.setStatus(convertMedicationRequestStatus(src.getStatus())); + if (src.hasStatusReason()) + tgt.setStatusReason(convertCodeableConcept(src.getStatusReason())); + if (src.hasIntent()) + tgt.setIntent(convertMedicationRequestIntent(src.getIntent())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getCategory()) + tgt.addCategory(convertCodeableConcept(t)); + if (src.hasPriority()) + tgt.setPriority(convertMedicationRequestPriority(src.getPriority())); + if (src.hasDoNotPerform()) + tgt.setDoNotPerformElement(convertBoolean(src.getDoNotPerformElement())); + if (src.hasReported()) + tgt.setReported(convertType(src.getReported())); + if (src.hasMedication()) + tgt.setMedication(convertType(src.getMedication())); + if (src.hasSubject()) + tgt.setSubject(convertReference(src.getSubject())); + if (src.hasEncounter()) + tgt.setEncounter(convertReference(src.getEncounter())); + for (org.hl7.fhir.r5.model.Reference t : src.getSupportingInformation()) + tgt.addSupportingInformation(convertReference(t)); + if (src.hasAuthoredOn()) + tgt.setAuthoredOnElement(convertDateTime(src.getAuthoredOnElement())); + if (src.hasRequester()) + tgt.setRequester(convertReference(src.getRequester())); + if (src.hasPerformer()) + tgt.setPerformer(convertReference(src.getPerformer())); + if (src.hasPerformerType()) + tgt.setPerformerType(convertCodeableConcept(src.getPerformerType())); + if (src.hasRecorder()) + tgt.setRecorder(convertReference(src.getRecorder())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getReasonCode()) + tgt.addReasonCode(convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getReasonReference()) + tgt.addReasonReference(convertReference(t)); + for (org.hl7.fhir.r5.model.CanonicalType t : src.getInstantiatesCanonical()) + tgt.getInstantiatesCanonical().add(convertCanonical(t)); + for (org.hl7.fhir.r5.model.UriType t : src.getInstantiatesUri()) + tgt.getInstantiatesUri().add(convertUri(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getBasedOn()) + tgt.addBasedOn(convertReference(t)); + if (src.hasGroupIdentifier()) + tgt.setGroupIdentifier(convertIdentifier(src.getGroupIdentifier())); + if (src.hasCourseOfTherapyType()) + tgt.setCourseOfTherapyType(convertCodeableConcept(src.getCourseOfTherapyType())); + for (org.hl7.fhir.r5.model.Reference t : src.getInsurance()) + tgt.addInsurance(convertReference(t)); + for (org.hl7.fhir.r5.model.Annotation t : src.getNote()) + tgt.addNote(convertAnnotation(t)); + for (org.hl7.fhir.r5.model.Dosage t : src.getDosageInstruction()) + tgt.addDosageInstruction(convertDosage(t)); + if (src.hasDispenseRequest()) + tgt.setDispenseRequest(convertMedicationRequestDispenseRequestComponent(src.getDispenseRequest())); + if (src.hasSubstitution()) + tgt.setSubstitution(convertMedicationRequestSubstitutionComponent(src.getSubstitution())); + if (src.hasPriorPrescription()) + tgt.setPriorPrescription(convertReference(src.getPriorPrescription())); + for (org.hl7.fhir.r5.model.Reference t : src.getDetectedIssue()) + tgt.addDetectedIssue(convertReference(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getEventHistory()) + tgt.addEventHistory(convertReference(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.MedicationRequest.MedicationRequestStatus convertMedicationRequestStatus(org.hl7.fhir.r4.model.MedicationRequest.MedicationRequestStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case ACTIVE: return org.hl7.fhir.r5.model.MedicationRequest.MedicationRequestStatus.ACTIVE; + case ONHOLD: return org.hl7.fhir.r5.model.MedicationRequest.MedicationRequestStatus.ONHOLD; + case CANCELLED: return org.hl7.fhir.r5.model.MedicationRequest.MedicationRequestStatus.CANCELLED; + case COMPLETED: return org.hl7.fhir.r5.model.MedicationRequest.MedicationRequestStatus.COMPLETED; + case ENTEREDINERROR: return org.hl7.fhir.r5.model.MedicationRequest.MedicationRequestStatus.ENTEREDINERROR; + case STOPPED: return org.hl7.fhir.r5.model.MedicationRequest.MedicationRequestStatus.STOPPED; + case DRAFT: return org.hl7.fhir.r5.model.MedicationRequest.MedicationRequestStatus.DRAFT; + case UNKNOWN: return org.hl7.fhir.r5.model.MedicationRequest.MedicationRequestStatus.UNKNOWN; + default: return org.hl7.fhir.r5.model.MedicationRequest.MedicationRequestStatus.NULL; + } +} + + public static org.hl7.fhir.r4.model.MedicationRequest.MedicationRequestStatus convertMedicationRequestStatus(org.hl7.fhir.r5.model.MedicationRequest.MedicationRequestStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case ACTIVE: return org.hl7.fhir.r4.model.MedicationRequest.MedicationRequestStatus.ACTIVE; + case ONHOLD: return org.hl7.fhir.r4.model.MedicationRequest.MedicationRequestStatus.ONHOLD; + case CANCELLED: return org.hl7.fhir.r4.model.MedicationRequest.MedicationRequestStatus.CANCELLED; + case COMPLETED: return org.hl7.fhir.r4.model.MedicationRequest.MedicationRequestStatus.COMPLETED; + case ENTEREDINERROR: return org.hl7.fhir.r4.model.MedicationRequest.MedicationRequestStatus.ENTEREDINERROR; + case STOPPED: return org.hl7.fhir.r4.model.MedicationRequest.MedicationRequestStatus.STOPPED; + case DRAFT: return org.hl7.fhir.r4.model.MedicationRequest.MedicationRequestStatus.DRAFT; + case UNKNOWN: return org.hl7.fhir.r4.model.MedicationRequest.MedicationRequestStatus.UNKNOWN; + default: return org.hl7.fhir.r4.model.MedicationRequest.MedicationRequestStatus.NULL; + } +} + + public static org.hl7.fhir.r5.model.MedicationRequest.MedicationRequestIntent convertMedicationRequestIntent(org.hl7.fhir.r4.model.MedicationRequest.MedicationRequestIntent src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PROPOSAL: return org.hl7.fhir.r5.model.MedicationRequest.MedicationRequestIntent.PROPOSAL; + case PLAN: return org.hl7.fhir.r5.model.MedicationRequest.MedicationRequestIntent.PLAN; + case ORDER: return org.hl7.fhir.r5.model.MedicationRequest.MedicationRequestIntent.ORDER; + case ORIGINALORDER: return org.hl7.fhir.r5.model.MedicationRequest.MedicationRequestIntent.ORIGINALORDER; + case REFLEXORDER: return org.hl7.fhir.r5.model.MedicationRequest.MedicationRequestIntent.REFLEXORDER; + case FILLERORDER: return org.hl7.fhir.r5.model.MedicationRequest.MedicationRequestIntent.FILLERORDER; + case INSTANCEORDER: return org.hl7.fhir.r5.model.MedicationRequest.MedicationRequestIntent.INSTANCEORDER; + case OPTION: return org.hl7.fhir.r5.model.MedicationRequest.MedicationRequestIntent.OPTION; + default: return org.hl7.fhir.r5.model.MedicationRequest.MedicationRequestIntent.NULL; + } +} + + public static org.hl7.fhir.r4.model.MedicationRequest.MedicationRequestIntent convertMedicationRequestIntent(org.hl7.fhir.r5.model.MedicationRequest.MedicationRequestIntent src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PROPOSAL: return org.hl7.fhir.r4.model.MedicationRequest.MedicationRequestIntent.PROPOSAL; + case PLAN: return org.hl7.fhir.r4.model.MedicationRequest.MedicationRequestIntent.PLAN; + case ORDER: return org.hl7.fhir.r4.model.MedicationRequest.MedicationRequestIntent.ORDER; + case ORIGINALORDER: return org.hl7.fhir.r4.model.MedicationRequest.MedicationRequestIntent.ORIGINALORDER; + case REFLEXORDER: return org.hl7.fhir.r4.model.MedicationRequest.MedicationRequestIntent.REFLEXORDER; + case FILLERORDER: return org.hl7.fhir.r4.model.MedicationRequest.MedicationRequestIntent.FILLERORDER; + case INSTANCEORDER: return org.hl7.fhir.r4.model.MedicationRequest.MedicationRequestIntent.INSTANCEORDER; + case OPTION: return org.hl7.fhir.r4.model.MedicationRequest.MedicationRequestIntent.OPTION; + default: return org.hl7.fhir.r4.model.MedicationRequest.MedicationRequestIntent.NULL; + } +} + + public static org.hl7.fhir.r5.model.MedicationRequest.MedicationRequestPriority convertMedicationRequestPriority(org.hl7.fhir.r4.model.MedicationRequest.MedicationRequestPriority src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case ROUTINE: return org.hl7.fhir.r5.model.MedicationRequest.MedicationRequestPriority.ROUTINE; + case URGENT: return org.hl7.fhir.r5.model.MedicationRequest.MedicationRequestPriority.URGENT; + case ASAP: return org.hl7.fhir.r5.model.MedicationRequest.MedicationRequestPriority.ASAP; + case STAT: return org.hl7.fhir.r5.model.MedicationRequest.MedicationRequestPriority.STAT; + default: return org.hl7.fhir.r5.model.MedicationRequest.MedicationRequestPriority.NULL; + } +} + + public static org.hl7.fhir.r4.model.MedicationRequest.MedicationRequestPriority convertMedicationRequestPriority(org.hl7.fhir.r5.model.MedicationRequest.MedicationRequestPriority src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case ROUTINE: return org.hl7.fhir.r4.model.MedicationRequest.MedicationRequestPriority.ROUTINE; + case URGENT: return org.hl7.fhir.r4.model.MedicationRequest.MedicationRequestPriority.URGENT; + case ASAP: return org.hl7.fhir.r4.model.MedicationRequest.MedicationRequestPriority.ASAP; + case STAT: return org.hl7.fhir.r4.model.MedicationRequest.MedicationRequestPriority.STAT; + default: return org.hl7.fhir.r4.model.MedicationRequest.MedicationRequestPriority.NULL; + } +} + + public static org.hl7.fhir.r5.model.MedicationRequest.MedicationRequestDispenseRequestComponent convertMedicationRequestDispenseRequestComponent(org.hl7.fhir.r4.model.MedicationRequest.MedicationRequestDispenseRequestComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.MedicationRequest.MedicationRequestDispenseRequestComponent tgt = new org.hl7.fhir.r5.model.MedicationRequest.MedicationRequestDispenseRequestComponent(); + copyElement(src, tgt); + if (src.hasInitialFill()) + tgt.setInitialFill(convertMedicationRequestDispenseRequestInitialFillComponent(src.getInitialFill())); + if (src.hasDispenseInterval()) + tgt.setDispenseInterval(convertDuration(src.getDispenseInterval())); + if (src.hasValidityPeriod()) + tgt.setValidityPeriod(convertPeriod(src.getValidityPeriod())); + if (src.hasNumberOfRepeatsAllowed()) + tgt.setNumberOfRepeatsAllowedElement(convertUnsignedInt(src.getNumberOfRepeatsAllowedElement())); + if (src.hasQuantity()) + tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); + if (src.hasExpectedSupplyDuration()) + tgt.setExpectedSupplyDuration(convertDuration(src.getExpectedSupplyDuration())); + if (src.hasPerformer()) + tgt.setPerformer(convertReference(src.getPerformer())); + return tgt; + } + + public static org.hl7.fhir.r4.model.MedicationRequest.MedicationRequestDispenseRequestComponent convertMedicationRequestDispenseRequestComponent(org.hl7.fhir.r5.model.MedicationRequest.MedicationRequestDispenseRequestComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.MedicationRequest.MedicationRequestDispenseRequestComponent tgt = new org.hl7.fhir.r4.model.MedicationRequest.MedicationRequestDispenseRequestComponent(); + copyElement(src, tgt); + if (src.hasInitialFill()) + tgt.setInitialFill(convertMedicationRequestDispenseRequestInitialFillComponent(src.getInitialFill())); + if (src.hasDispenseInterval()) + tgt.setDispenseInterval(convertDuration(src.getDispenseInterval())); + if (src.hasValidityPeriod()) + tgt.setValidityPeriod(convertPeriod(src.getValidityPeriod())); + if (src.hasNumberOfRepeatsAllowed()) + tgt.setNumberOfRepeatsAllowedElement(convertUnsignedInt(src.getNumberOfRepeatsAllowedElement())); + if (src.hasQuantity()) + tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); + if (src.hasExpectedSupplyDuration()) + tgt.setExpectedSupplyDuration(convertDuration(src.getExpectedSupplyDuration())); + if (src.hasPerformer()) + tgt.setPerformer(convertReference(src.getPerformer())); + return tgt; + } + + public static org.hl7.fhir.r5.model.MedicationRequest.MedicationRequestDispenseRequestInitialFillComponent convertMedicationRequestDispenseRequestInitialFillComponent(org.hl7.fhir.r4.model.MedicationRequest.MedicationRequestDispenseRequestInitialFillComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.MedicationRequest.MedicationRequestDispenseRequestInitialFillComponent tgt = new org.hl7.fhir.r5.model.MedicationRequest.MedicationRequestDispenseRequestInitialFillComponent(); + copyElement(src, tgt); + if (src.hasQuantity()) + tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); + if (src.hasDuration()) + tgt.setDuration(convertDuration(src.getDuration())); + return tgt; + } + + public static org.hl7.fhir.r4.model.MedicationRequest.MedicationRequestDispenseRequestInitialFillComponent convertMedicationRequestDispenseRequestInitialFillComponent(org.hl7.fhir.r5.model.MedicationRequest.MedicationRequestDispenseRequestInitialFillComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.MedicationRequest.MedicationRequestDispenseRequestInitialFillComponent tgt = new org.hl7.fhir.r4.model.MedicationRequest.MedicationRequestDispenseRequestInitialFillComponent(); + copyElement(src, tgt); + if (src.hasQuantity()) + tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); + if (src.hasDuration()) + tgt.setDuration(convertDuration(src.getDuration())); + return tgt; + } + + public static org.hl7.fhir.r5.model.MedicationRequest.MedicationRequestSubstitutionComponent convertMedicationRequestSubstitutionComponent(org.hl7.fhir.r4.model.MedicationRequest.MedicationRequestSubstitutionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.MedicationRequest.MedicationRequestSubstitutionComponent tgt = new org.hl7.fhir.r5.model.MedicationRequest.MedicationRequestSubstitutionComponent(); + copyElement(src, tgt); + if (src.hasAllowed()) + tgt.setAllowed(convertType(src.getAllowed())); + if (src.hasReason()) + tgt.setReason(convertCodeableConcept(src.getReason())); + return tgt; + } + + public static org.hl7.fhir.r4.model.MedicationRequest.MedicationRequestSubstitutionComponent convertMedicationRequestSubstitutionComponent(org.hl7.fhir.r5.model.MedicationRequest.MedicationRequestSubstitutionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.MedicationRequest.MedicationRequestSubstitutionComponent tgt = new org.hl7.fhir.r4.model.MedicationRequest.MedicationRequestSubstitutionComponent(); + copyElement(src, tgt); + if (src.hasAllowed()) + tgt.setAllowed(convertType(src.getAllowed())); + if (src.hasReason()) + tgt.setReason(convertCodeableConcept(src.getReason())); + return tgt; + } + + +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/MedicationStatement.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/MedicationStatement.java new file mode 100644 index 000000000..a5edef37e --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/MedicationStatement.java @@ -0,0 +1,159 @@ +package org.hl7.fhir.convertors.conv40_50; + +import org.hl7.fhir.exceptions.FHIRException; + +import org.hl7.fhir.convertors.VersionConvertor_40_50; + + +/* + Copyright (c) 2011+, HL7, Inc. + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of HL7 nor the names of its contributors may be used to + endorse or promote products derived from this software without specific + prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + +*/ + +// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0 + + +public class MedicationStatement extends VersionConvertor_40_50 { + + public static org.hl7.fhir.r5.model.MedicationStatement convertMedicationStatement(org.hl7.fhir.r4.model.MedicationStatement src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.MedicationStatement tgt = new org.hl7.fhir.r5.model.MedicationStatement(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getBasedOn()) + tgt.addBasedOn(convertReference(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getPartOf()) + tgt.addPartOf(convertReference(t)); + if (src.hasStatus()) + tgt.setStatus(convertMedicationStatementStatus(src.getStatus())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getStatusReason()) + tgt.addStatusReason(convertCodeableConcept(t)); + if (src.hasCategory()) + tgt.setCategory(convertCodeableConcept(src.getCategory())); + if (src.hasMedication()) + tgt.setMedication(convertType(src.getMedication())); + if (src.hasSubject()) + tgt.setSubject(convertReference(src.getSubject())); + if (src.hasContext()) + tgt.setContext(convertReference(src.getContext())); + if (src.hasEffective()) + tgt.setEffective(convertType(src.getEffective())); + if (src.hasDateAsserted()) + tgt.setDateAssertedElement(convertDateTime(src.getDateAssertedElement())); + if (src.hasInformationSource()) + tgt.setInformationSource(convertReference(src.getInformationSource())); + for (org.hl7.fhir.r4.model.Reference t : src.getDerivedFrom()) + tgt.addDerivedFrom(convertReference(t)); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getReasonCode()) + tgt.addReasonCode(convertCodeableConcept(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getReasonReference()) + tgt.addReasonReference(convertReference(t)); + for (org.hl7.fhir.r4.model.Annotation t : src.getNote()) + tgt.addNote(convertAnnotation(t)); + for (org.hl7.fhir.r4.model.Dosage t : src.getDosage()) + tgt.addDosage(convertDosage(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.MedicationStatement convertMedicationStatement(org.hl7.fhir.r5.model.MedicationStatement src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.MedicationStatement tgt = new org.hl7.fhir.r4.model.MedicationStatement(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getBasedOn()) + tgt.addBasedOn(convertReference(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getPartOf()) + tgt.addPartOf(convertReference(t)); + if (src.hasStatus()) + tgt.setStatus(convertMedicationStatementStatus(src.getStatus())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getStatusReason()) + tgt.addStatusReason(convertCodeableConcept(t)); + if (src.hasCategory()) + tgt.setCategory(convertCodeableConcept(src.getCategory())); + if (src.hasMedication()) + tgt.setMedication(convertType(src.getMedication())); + if (src.hasSubject()) + tgt.setSubject(convertReference(src.getSubject())); + if (src.hasContext()) + tgt.setContext(convertReference(src.getContext())); + if (src.hasEffective()) + tgt.setEffective(convertType(src.getEffective())); + if (src.hasDateAsserted()) + tgt.setDateAssertedElement(convertDateTime(src.getDateAssertedElement())); + if (src.hasInformationSource()) + tgt.setInformationSource(convertReference(src.getInformationSource())); + for (org.hl7.fhir.r5.model.Reference t : src.getDerivedFrom()) + tgt.addDerivedFrom(convertReference(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getReasonCode()) + tgt.addReasonCode(convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getReasonReference()) + tgt.addReasonReference(convertReference(t)); + for (org.hl7.fhir.r5.model.Annotation t : src.getNote()) + tgt.addNote(convertAnnotation(t)); + for (org.hl7.fhir.r5.model.Dosage t : src.getDosage()) + tgt.addDosage(convertDosage(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.MedicationStatement.MedicationStatementStatus convertMedicationStatementStatus(org.hl7.fhir.r4.model.MedicationStatement.MedicationStatementStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case ACTIVE: return org.hl7.fhir.r5.model.MedicationStatement.MedicationStatementStatus.ACTIVE; + case COMPLETED: return org.hl7.fhir.r5.model.MedicationStatement.MedicationStatementStatus.COMPLETED; + case ENTEREDINERROR: return org.hl7.fhir.r5.model.MedicationStatement.MedicationStatementStatus.ENTEREDINERROR; + case INTENDED: return org.hl7.fhir.r5.model.MedicationStatement.MedicationStatementStatus.INTENDED; + case STOPPED: return org.hl7.fhir.r5.model.MedicationStatement.MedicationStatementStatus.STOPPED; + case ONHOLD: return org.hl7.fhir.r5.model.MedicationStatement.MedicationStatementStatus.ONHOLD; + case UNKNOWN: return org.hl7.fhir.r5.model.MedicationStatement.MedicationStatementStatus.UNKNOWN; + case NOTTAKEN: return org.hl7.fhir.r5.model.MedicationStatement.MedicationStatementStatus.NOTTAKEN; + default: return org.hl7.fhir.r5.model.MedicationStatement.MedicationStatementStatus.NULL; + } +} + + public static org.hl7.fhir.r4.model.MedicationStatement.MedicationStatementStatus convertMedicationStatementStatus(org.hl7.fhir.r5.model.MedicationStatement.MedicationStatementStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case ACTIVE: return org.hl7.fhir.r4.model.MedicationStatement.MedicationStatementStatus.ACTIVE; + case COMPLETED: return org.hl7.fhir.r4.model.MedicationStatement.MedicationStatementStatus.COMPLETED; + case ENTEREDINERROR: return org.hl7.fhir.r4.model.MedicationStatement.MedicationStatementStatus.ENTEREDINERROR; + case INTENDED: return org.hl7.fhir.r4.model.MedicationStatement.MedicationStatementStatus.INTENDED; + case STOPPED: return org.hl7.fhir.r4.model.MedicationStatement.MedicationStatementStatus.STOPPED; + case ONHOLD: return org.hl7.fhir.r4.model.MedicationStatement.MedicationStatementStatus.ONHOLD; + case UNKNOWN: return org.hl7.fhir.r4.model.MedicationStatement.MedicationStatementStatus.UNKNOWN; + case NOTTAKEN: return org.hl7.fhir.r4.model.MedicationStatement.MedicationStatementStatus.NOTTAKEN; + default: return org.hl7.fhir.r4.model.MedicationStatement.MedicationStatementStatus.NULL; + } +} + + +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/MedicinalProduct.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/MedicinalProduct.java new file mode 100644 index 000000000..28fd5a2fd --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/MedicinalProduct.java @@ -0,0 +1,303 @@ +package org.hl7.fhir.convertors.conv40_50; + +import org.hl7.fhir.exceptions.FHIRException; + +import org.hl7.fhir.convertors.VersionConvertor_40_50; + + +/* + Copyright (c) 2011+, HL7, Inc. + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of HL7 nor the names of its contributors may be used to + endorse or promote products derived from this software without specific + prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + +*/ + +// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0 + + +public class MedicinalProduct extends VersionConvertor_40_50 { + + public static org.hl7.fhir.r5.model.MedicinalProduct convertMedicinalProduct(org.hl7.fhir.r4.model.MedicinalProduct src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.MedicinalProduct tgt = new org.hl7.fhir.r5.model.MedicinalProduct(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + if (src.hasDomain()) + tgt.setDomain(convertCoding(src.getDomain())); + if (src.hasCombinedPharmaceuticalDoseForm()) + tgt.setCombinedPharmaceuticalDoseForm(convertCodeableConcept(src.getCombinedPharmaceuticalDoseForm())); + if (src.hasLegalStatusOfSupply()) + tgt.setLegalStatusOfSupply(convertCodeableConcept(src.getLegalStatusOfSupply())); + if (src.hasAdditionalMonitoringIndicator()) + tgt.setAdditionalMonitoringIndicator(convertCodeableConcept(src.getAdditionalMonitoringIndicator())); + for (org.hl7.fhir.r4.model.StringType t : src.getSpecialMeasures()) + tgt.getSpecialMeasures().add(convertString(t)); + if (src.hasPaediatricUseIndicator()) + tgt.setPaediatricUseIndicator(convertCodeableConcept(src.getPaediatricUseIndicator())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getProductClassification()) + tgt.addProductClassification(convertCodeableConcept(t)); + for (org.hl7.fhir.r4.model.MarketingStatus t : src.getMarketingStatus()) + tgt.addMarketingStatus(convertMarketingStatus(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getPharmaceuticalProduct()) + tgt.addPharmaceuticalProduct(convertReference(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getPackagedMedicinalProduct()) + tgt.addPackagedMedicinalProduct(convertReference(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getAttachedDocument()) + tgt.addAttachedDocument(convertReference(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getMasterFile()) + tgt.addMasterFile(convertReference(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getContact()) + tgt.addContact(convertReference(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getClinicalTrial()) + tgt.addClinicalTrial(convertReference(t)); + for (org.hl7.fhir.r4.model.MedicinalProduct.MedicinalProductNameComponent t : src.getName()) + tgt.addName(convertMedicinalProductNameComponent(t)); + for (org.hl7.fhir.r4.model.Identifier t : src.getCrossReference()) + tgt.addCrossReference(convertIdentifier(t)); + for (org.hl7.fhir.r4.model.MedicinalProduct.MedicinalProductManufacturingBusinessOperationComponent t : src.getManufacturingBusinessOperation()) + tgt.addManufacturingBusinessOperation(convertMedicinalProductManufacturingBusinessOperationComponent(t)); + for (org.hl7.fhir.r4.model.MedicinalProduct.MedicinalProductSpecialDesignationComponent t : src.getSpecialDesignation()) + tgt.addSpecialDesignation(convertMedicinalProductSpecialDesignationComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.MedicinalProduct convertMedicinalProduct(org.hl7.fhir.r5.model.MedicinalProduct src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.MedicinalProduct tgt = new org.hl7.fhir.r4.model.MedicinalProduct(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + if (src.hasDomain()) + tgt.setDomain(convertCoding(src.getDomain())); + if (src.hasCombinedPharmaceuticalDoseForm()) + tgt.setCombinedPharmaceuticalDoseForm(convertCodeableConcept(src.getCombinedPharmaceuticalDoseForm())); + if (src.hasLegalStatusOfSupply()) + tgt.setLegalStatusOfSupply(convertCodeableConcept(src.getLegalStatusOfSupply())); + if (src.hasAdditionalMonitoringIndicator()) + tgt.setAdditionalMonitoringIndicator(convertCodeableConcept(src.getAdditionalMonitoringIndicator())); + for (org.hl7.fhir.r5.model.StringType t : src.getSpecialMeasures()) + tgt.getSpecialMeasures().add(convertString(t)); + if (src.hasPaediatricUseIndicator()) + tgt.setPaediatricUseIndicator(convertCodeableConcept(src.getPaediatricUseIndicator())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getProductClassification()) + tgt.addProductClassification(convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.MarketingStatus t : src.getMarketingStatus()) + tgt.addMarketingStatus(convertMarketingStatus(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getPharmaceuticalProduct()) + tgt.addPharmaceuticalProduct(convertReference(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getPackagedMedicinalProduct()) + tgt.addPackagedMedicinalProduct(convertReference(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getAttachedDocument()) + tgt.addAttachedDocument(convertReference(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getMasterFile()) + tgt.addMasterFile(convertReference(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getContact()) + tgt.addContact(convertReference(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getClinicalTrial()) + tgt.addClinicalTrial(convertReference(t)); + for (org.hl7.fhir.r5.model.MedicinalProduct.MedicinalProductNameComponent t : src.getName()) + tgt.addName(convertMedicinalProductNameComponent(t)); + for (org.hl7.fhir.r5.model.Identifier t : src.getCrossReference()) + tgt.addCrossReference(convertIdentifier(t)); + for (org.hl7.fhir.r5.model.MedicinalProduct.MedicinalProductManufacturingBusinessOperationComponent t : src.getManufacturingBusinessOperation()) + tgt.addManufacturingBusinessOperation(convertMedicinalProductManufacturingBusinessOperationComponent(t)); + for (org.hl7.fhir.r5.model.MedicinalProduct.MedicinalProductSpecialDesignationComponent t : src.getSpecialDesignation()) + tgt.addSpecialDesignation(convertMedicinalProductSpecialDesignationComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.MedicinalProduct.MedicinalProductNameComponent convertMedicinalProductNameComponent(org.hl7.fhir.r4.model.MedicinalProduct.MedicinalProductNameComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.MedicinalProduct.MedicinalProductNameComponent tgt = new org.hl7.fhir.r5.model.MedicinalProduct.MedicinalProductNameComponent(); + copyElement(src, tgt); + if (src.hasProductName()) + tgt.setProductNameElement(convertString(src.getProductNameElement())); + for (org.hl7.fhir.r4.model.MedicinalProduct.MedicinalProductNameNamePartComponent t : src.getNamePart()) + tgt.addNamePart(convertMedicinalProductNameNamePartComponent(t)); + for (org.hl7.fhir.r4.model.MedicinalProduct.MedicinalProductNameCountryLanguageComponent t : src.getCountryLanguage()) + tgt.addCountryLanguage(convertMedicinalProductNameCountryLanguageComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.MedicinalProduct.MedicinalProductNameComponent convertMedicinalProductNameComponent(org.hl7.fhir.r5.model.MedicinalProduct.MedicinalProductNameComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.MedicinalProduct.MedicinalProductNameComponent tgt = new org.hl7.fhir.r4.model.MedicinalProduct.MedicinalProductNameComponent(); + copyElement(src, tgt); + if (src.hasProductName()) + tgt.setProductNameElement(convertString(src.getProductNameElement())); + for (org.hl7.fhir.r5.model.MedicinalProduct.MedicinalProductNameNamePartComponent t : src.getNamePart()) + tgt.addNamePart(convertMedicinalProductNameNamePartComponent(t)); + for (org.hl7.fhir.r5.model.MedicinalProduct.MedicinalProductNameCountryLanguageComponent t : src.getCountryLanguage()) + tgt.addCountryLanguage(convertMedicinalProductNameCountryLanguageComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.MedicinalProduct.MedicinalProductNameNamePartComponent convertMedicinalProductNameNamePartComponent(org.hl7.fhir.r4.model.MedicinalProduct.MedicinalProductNameNamePartComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.MedicinalProduct.MedicinalProductNameNamePartComponent tgt = new org.hl7.fhir.r5.model.MedicinalProduct.MedicinalProductNameNamePartComponent(); + copyElement(src, tgt); + if (src.hasPart()) + tgt.setPartElement(convertString(src.getPartElement())); + if (src.hasType()) + tgt.setType(convertCoding(src.getType())); + return tgt; + } + + public static org.hl7.fhir.r4.model.MedicinalProduct.MedicinalProductNameNamePartComponent convertMedicinalProductNameNamePartComponent(org.hl7.fhir.r5.model.MedicinalProduct.MedicinalProductNameNamePartComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.MedicinalProduct.MedicinalProductNameNamePartComponent tgt = new org.hl7.fhir.r4.model.MedicinalProduct.MedicinalProductNameNamePartComponent(); + copyElement(src, tgt); + if (src.hasPart()) + tgt.setPartElement(convertString(src.getPartElement())); + if (src.hasType()) + tgt.setType(convertCoding(src.getType())); + return tgt; + } + + public static org.hl7.fhir.r5.model.MedicinalProduct.MedicinalProductNameCountryLanguageComponent convertMedicinalProductNameCountryLanguageComponent(org.hl7.fhir.r4.model.MedicinalProduct.MedicinalProductNameCountryLanguageComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.MedicinalProduct.MedicinalProductNameCountryLanguageComponent tgt = new org.hl7.fhir.r5.model.MedicinalProduct.MedicinalProductNameCountryLanguageComponent(); + copyElement(src, tgt); + if (src.hasCountry()) + tgt.setCountry(convertCodeableConcept(src.getCountry())); + if (src.hasJurisdiction()) + tgt.setJurisdiction(convertCodeableConcept(src.getJurisdiction())); + if (src.hasLanguage()) + tgt.setLanguage(convertCodeableConcept(src.getLanguage())); + return tgt; + } + + public static org.hl7.fhir.r4.model.MedicinalProduct.MedicinalProductNameCountryLanguageComponent convertMedicinalProductNameCountryLanguageComponent(org.hl7.fhir.r5.model.MedicinalProduct.MedicinalProductNameCountryLanguageComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.MedicinalProduct.MedicinalProductNameCountryLanguageComponent tgt = new org.hl7.fhir.r4.model.MedicinalProduct.MedicinalProductNameCountryLanguageComponent(); + copyElement(src, tgt); + if (src.hasCountry()) + tgt.setCountry(convertCodeableConcept(src.getCountry())); + if (src.hasJurisdiction()) + tgt.setJurisdiction(convertCodeableConcept(src.getJurisdiction())); + if (src.hasLanguage()) + tgt.setLanguage(convertCodeableConcept(src.getLanguage())); + return tgt; + } + + public static org.hl7.fhir.r5.model.MedicinalProduct.MedicinalProductManufacturingBusinessOperationComponent convertMedicinalProductManufacturingBusinessOperationComponent(org.hl7.fhir.r4.model.MedicinalProduct.MedicinalProductManufacturingBusinessOperationComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.MedicinalProduct.MedicinalProductManufacturingBusinessOperationComponent tgt = new org.hl7.fhir.r5.model.MedicinalProduct.MedicinalProductManufacturingBusinessOperationComponent(); + copyElement(src, tgt); + if (src.hasOperationType()) + tgt.setOperationType(convertCodeableConcept(src.getOperationType())); + if (src.hasAuthorisationReferenceNumber()) + tgt.setAuthorisationReferenceNumber(convertIdentifier(src.getAuthorisationReferenceNumber())); + if (src.hasEffectiveDate()) + tgt.setEffectiveDateElement(convertDateTime(src.getEffectiveDateElement())); + if (src.hasConfidentialityIndicator()) + tgt.setConfidentialityIndicator(convertCodeableConcept(src.getConfidentialityIndicator())); + for (org.hl7.fhir.r4.model.Reference t : src.getManufacturer()) + tgt.addManufacturer(convertReference(t)); + if (src.hasRegulator()) + tgt.setRegulator(convertReference(src.getRegulator())); + return tgt; + } + + public static org.hl7.fhir.r4.model.MedicinalProduct.MedicinalProductManufacturingBusinessOperationComponent convertMedicinalProductManufacturingBusinessOperationComponent(org.hl7.fhir.r5.model.MedicinalProduct.MedicinalProductManufacturingBusinessOperationComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.MedicinalProduct.MedicinalProductManufacturingBusinessOperationComponent tgt = new org.hl7.fhir.r4.model.MedicinalProduct.MedicinalProductManufacturingBusinessOperationComponent(); + copyElement(src, tgt); + if (src.hasOperationType()) + tgt.setOperationType(convertCodeableConcept(src.getOperationType())); + if (src.hasAuthorisationReferenceNumber()) + tgt.setAuthorisationReferenceNumber(convertIdentifier(src.getAuthorisationReferenceNumber())); + if (src.hasEffectiveDate()) + tgt.setEffectiveDateElement(convertDateTime(src.getEffectiveDateElement())); + if (src.hasConfidentialityIndicator()) + tgt.setConfidentialityIndicator(convertCodeableConcept(src.getConfidentialityIndicator())); + for (org.hl7.fhir.r5.model.Reference t : src.getManufacturer()) + tgt.addManufacturer(convertReference(t)); + if (src.hasRegulator()) + tgt.setRegulator(convertReference(src.getRegulator())); + return tgt; + } + + public static org.hl7.fhir.r5.model.MedicinalProduct.MedicinalProductSpecialDesignationComponent convertMedicinalProductSpecialDesignationComponent(org.hl7.fhir.r4.model.MedicinalProduct.MedicinalProductSpecialDesignationComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.MedicinalProduct.MedicinalProductSpecialDesignationComponent tgt = new org.hl7.fhir.r5.model.MedicinalProduct.MedicinalProductSpecialDesignationComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + if (src.hasIntendedUse()) + tgt.setIntendedUse(convertCodeableConcept(src.getIntendedUse())); + if (src.hasIndication()) + tgt.setIndication(convertType(src.getIndication())); + if (src.hasStatus()) + tgt.setStatus(convertCodeableConcept(src.getStatus())); + if (src.hasDate()) + tgt.setDateElement(convertDateTime(src.getDateElement())); + if (src.hasSpecies()) + tgt.setSpecies(convertCodeableConcept(src.getSpecies())); + return tgt; + } + + public static org.hl7.fhir.r4.model.MedicinalProduct.MedicinalProductSpecialDesignationComponent convertMedicinalProductSpecialDesignationComponent(org.hl7.fhir.r5.model.MedicinalProduct.MedicinalProductSpecialDesignationComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.MedicinalProduct.MedicinalProductSpecialDesignationComponent tgt = new org.hl7.fhir.r4.model.MedicinalProduct.MedicinalProductSpecialDesignationComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + if (src.hasIntendedUse()) + tgt.setIntendedUse(convertCodeableConcept(src.getIntendedUse())); + if (src.hasIndication()) + tgt.setIndication(convertType(src.getIndication())); + if (src.hasStatus()) + tgt.setStatus(convertCodeableConcept(src.getStatus())); + if (src.hasDate()) + tgt.setDateElement(convertDateTime(src.getDateElement())); + if (src.hasSpecies()) + tgt.setSpecies(convertCodeableConcept(src.getSpecies())); + return tgt; + } + + +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/MedicinalProductAuthorization.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/MedicinalProductAuthorization.java new file mode 100644 index 000000000..66e0a9c44 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/MedicinalProductAuthorization.java @@ -0,0 +1,191 @@ +package org.hl7.fhir.convertors.conv40_50; + +import org.hl7.fhir.exceptions.FHIRException; + +import org.hl7.fhir.convertors.VersionConvertor_40_50; + + +/* + Copyright (c) 2011+, HL7, Inc. + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of HL7 nor the names of its contributors may be used to + endorse or promote products derived from this software without specific + prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + +*/ + +// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0 + + +public class MedicinalProductAuthorization extends VersionConvertor_40_50 { + + public static org.hl7.fhir.r5.model.MedicinalProductAuthorization convertMedicinalProductAuthorization(org.hl7.fhir.r4.model.MedicinalProductAuthorization src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.MedicinalProductAuthorization tgt = new org.hl7.fhir.r5.model.MedicinalProductAuthorization(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasSubject()) + tgt.setSubject(convertReference(src.getSubject())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getCountry()) + tgt.addCountry(convertCodeableConcept(t)); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getJurisdiction()) + tgt.addJurisdiction(convertCodeableConcept(t)); + if (src.hasStatus()) + tgt.setStatus(convertCodeableConcept(src.getStatus())); + if (src.hasStatusDate()) + tgt.setStatusDateElement(convertDateTime(src.getStatusDateElement())); + if (src.hasRestoreDate()) + tgt.setRestoreDateElement(convertDateTime(src.getRestoreDateElement())); + if (src.hasValidityPeriod()) + tgt.setValidityPeriod(convertPeriod(src.getValidityPeriod())); + if (src.hasDataExclusivityPeriod()) + tgt.setDataExclusivityPeriod(convertPeriod(src.getDataExclusivityPeriod())); + if (src.hasDateOfFirstAuthorization()) + tgt.setDateOfFirstAuthorizationElement(convertDateTime(src.getDateOfFirstAuthorizationElement())); + if (src.hasInternationalBirthDate()) + tgt.setInternationalBirthDateElement(convertDateTime(src.getInternationalBirthDateElement())); + if (src.hasLegalBasis()) + tgt.setLegalBasis(convertCodeableConcept(src.getLegalBasis())); + for (org.hl7.fhir.r4.model.MedicinalProductAuthorization.MedicinalProductAuthorizationJurisdictionalAuthorizationComponent t : src.getJurisdictionalAuthorization()) + tgt.addJurisdictionalAuthorization(convertMedicinalProductAuthorizationJurisdictionalAuthorizationComponent(t)); + if (src.hasHolder()) + tgt.setHolder(convertReference(src.getHolder())); + if (src.hasRegulator()) + tgt.setRegulator(convertReference(src.getRegulator())); + if (src.hasProcedure()) + tgt.setProcedure(convertMedicinalProductAuthorizationProcedureComponent(src.getProcedure())); + return tgt; + } + + public static org.hl7.fhir.r4.model.MedicinalProductAuthorization convertMedicinalProductAuthorization(org.hl7.fhir.r5.model.MedicinalProductAuthorization src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.MedicinalProductAuthorization tgt = new org.hl7.fhir.r4.model.MedicinalProductAuthorization(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasSubject()) + tgt.setSubject(convertReference(src.getSubject())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getCountry()) + tgt.addCountry(convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getJurisdiction()) + tgt.addJurisdiction(convertCodeableConcept(t)); + if (src.hasStatus()) + tgt.setStatus(convertCodeableConcept(src.getStatus())); + if (src.hasStatusDate()) + tgt.setStatusDateElement(convertDateTime(src.getStatusDateElement())); + if (src.hasRestoreDate()) + tgt.setRestoreDateElement(convertDateTime(src.getRestoreDateElement())); + if (src.hasValidityPeriod()) + tgt.setValidityPeriod(convertPeriod(src.getValidityPeriod())); + if (src.hasDataExclusivityPeriod()) + tgt.setDataExclusivityPeriod(convertPeriod(src.getDataExclusivityPeriod())); + if (src.hasDateOfFirstAuthorization()) + tgt.setDateOfFirstAuthorizationElement(convertDateTime(src.getDateOfFirstAuthorizationElement())); + if (src.hasInternationalBirthDate()) + tgt.setInternationalBirthDateElement(convertDateTime(src.getInternationalBirthDateElement())); + if (src.hasLegalBasis()) + tgt.setLegalBasis(convertCodeableConcept(src.getLegalBasis())); + for (org.hl7.fhir.r5.model.MedicinalProductAuthorization.MedicinalProductAuthorizationJurisdictionalAuthorizationComponent t : src.getJurisdictionalAuthorization()) + tgt.addJurisdictionalAuthorization(convertMedicinalProductAuthorizationJurisdictionalAuthorizationComponent(t)); + if (src.hasHolder()) + tgt.setHolder(convertReference(src.getHolder())); + if (src.hasRegulator()) + tgt.setRegulator(convertReference(src.getRegulator())); + if (src.hasProcedure()) + tgt.setProcedure(convertMedicinalProductAuthorizationProcedureComponent(src.getProcedure())); + return tgt; + } + + public static org.hl7.fhir.r5.model.MedicinalProductAuthorization.MedicinalProductAuthorizationJurisdictionalAuthorizationComponent convertMedicinalProductAuthorizationJurisdictionalAuthorizationComponent(org.hl7.fhir.r4.model.MedicinalProductAuthorization.MedicinalProductAuthorizationJurisdictionalAuthorizationComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.MedicinalProductAuthorization.MedicinalProductAuthorizationJurisdictionalAuthorizationComponent tgt = new org.hl7.fhir.r5.model.MedicinalProductAuthorization.MedicinalProductAuthorizationJurisdictionalAuthorizationComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasCountry()) + tgt.setCountry(convertCodeableConcept(src.getCountry())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getJurisdiction()) + tgt.addJurisdiction(convertCodeableConcept(t)); + if (src.hasLegalStatusOfSupply()) + tgt.setLegalStatusOfSupply(convertCodeableConcept(src.getLegalStatusOfSupply())); + if (src.hasValidityPeriod()) + tgt.setValidityPeriod(convertPeriod(src.getValidityPeriod())); + return tgt; + } + + public static org.hl7.fhir.r4.model.MedicinalProductAuthorization.MedicinalProductAuthorizationJurisdictionalAuthorizationComponent convertMedicinalProductAuthorizationJurisdictionalAuthorizationComponent(org.hl7.fhir.r5.model.MedicinalProductAuthorization.MedicinalProductAuthorizationJurisdictionalAuthorizationComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.MedicinalProductAuthorization.MedicinalProductAuthorizationJurisdictionalAuthorizationComponent tgt = new org.hl7.fhir.r4.model.MedicinalProductAuthorization.MedicinalProductAuthorizationJurisdictionalAuthorizationComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasCountry()) + tgt.setCountry(convertCodeableConcept(src.getCountry())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getJurisdiction()) + tgt.addJurisdiction(convertCodeableConcept(t)); + if (src.hasLegalStatusOfSupply()) + tgt.setLegalStatusOfSupply(convertCodeableConcept(src.getLegalStatusOfSupply())); + if (src.hasValidityPeriod()) + tgt.setValidityPeriod(convertPeriod(src.getValidityPeriod())); + return tgt; + } + + public static org.hl7.fhir.r5.model.MedicinalProductAuthorization.MedicinalProductAuthorizationProcedureComponent convertMedicinalProductAuthorizationProcedureComponent(org.hl7.fhir.r4.model.MedicinalProductAuthorization.MedicinalProductAuthorizationProcedureComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.MedicinalProductAuthorization.MedicinalProductAuthorizationProcedureComponent tgt = new org.hl7.fhir.r5.model.MedicinalProductAuthorization.MedicinalProductAuthorizationProcedureComponent(); + copyElement(src, tgt); + if (src.hasIdentifier()) + tgt.setIdentifier(convertIdentifier(src.getIdentifier())); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + if (src.hasDate()) + tgt.setDate(convertType(src.getDate())); + for (org.hl7.fhir.r4.model.MedicinalProductAuthorization.MedicinalProductAuthorizationProcedureComponent t : src.getApplication()) + tgt.addApplication(convertMedicinalProductAuthorizationProcedureComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.MedicinalProductAuthorization.MedicinalProductAuthorizationProcedureComponent convertMedicinalProductAuthorizationProcedureComponent(org.hl7.fhir.r5.model.MedicinalProductAuthorization.MedicinalProductAuthorizationProcedureComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.MedicinalProductAuthorization.MedicinalProductAuthorizationProcedureComponent tgt = new org.hl7.fhir.r4.model.MedicinalProductAuthorization.MedicinalProductAuthorizationProcedureComponent(); + copyElement(src, tgt); + if (src.hasIdentifier()) + tgt.setIdentifier(convertIdentifier(src.getIdentifier())); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + if (src.hasDate()) + tgt.setDate(convertType(src.getDate())); + for (org.hl7.fhir.r5.model.MedicinalProductAuthorization.MedicinalProductAuthorizationProcedureComponent t : src.getApplication()) + tgt.addApplication(convertMedicinalProductAuthorizationProcedureComponent(t)); + return tgt; + } + + +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/MedicinalProductContraindication.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/MedicinalProductContraindication.java new file mode 100644 index 000000000..b319a3740 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/MedicinalProductContraindication.java @@ -0,0 +1,111 @@ +package org.hl7.fhir.convertors.conv40_50; + +import org.hl7.fhir.exceptions.FHIRException; + +import org.hl7.fhir.convertors.VersionConvertor_40_50; + + +/* + Copyright (c) 2011+, HL7, Inc. + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of HL7 nor the names of its contributors may be used to + endorse or promote products derived from this software without specific + prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + +*/ + +// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0 + + +public class MedicinalProductContraindication extends VersionConvertor_40_50 { + + public static org.hl7.fhir.r5.model.MedicinalProductContraindication convertMedicinalProductContraindication(org.hl7.fhir.r4.model.MedicinalProductContraindication src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.MedicinalProductContraindication tgt = new org.hl7.fhir.r5.model.MedicinalProductContraindication(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r4.model.Reference t : src.getSubject()) + tgt.addSubject(convertReference(t)); + if (src.hasDisease()) + tgt.setDisease(convertCodeableConcept(src.getDisease())); + if (src.hasDiseaseStatus()) + tgt.setDiseaseStatus(convertCodeableConcept(src.getDiseaseStatus())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getComorbidity()) + tgt.addComorbidity(convertCodeableConcept(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getTherapeuticIndication()) + tgt.addTherapeuticIndication(convertReference(t)); + for (org.hl7.fhir.r4.model.MedicinalProductContraindication.MedicinalProductContraindicationOtherTherapyComponent t : src.getOtherTherapy()) + tgt.addOtherTherapy(convertMedicinalProductContraindicationOtherTherapyComponent(t)); + for (org.hl7.fhir.r4.model.Population t : src.getPopulation()) + tgt.addPopulation(convertPopulation(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.MedicinalProductContraindication convertMedicinalProductContraindication(org.hl7.fhir.r5.model.MedicinalProductContraindication src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.MedicinalProductContraindication tgt = new org.hl7.fhir.r4.model.MedicinalProductContraindication(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Reference t : src.getSubject()) + tgt.addSubject(convertReference(t)); + if (src.hasDisease()) + tgt.setDisease(convertCodeableConcept(src.getDisease())); + if (src.hasDiseaseStatus()) + tgt.setDiseaseStatus(convertCodeableConcept(src.getDiseaseStatus())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getComorbidity()) + tgt.addComorbidity(convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getTherapeuticIndication()) + tgt.addTherapeuticIndication(convertReference(t)); + for (org.hl7.fhir.r5.model.MedicinalProductContraindication.MedicinalProductContraindicationOtherTherapyComponent t : src.getOtherTherapy()) + tgt.addOtherTherapy(convertMedicinalProductContraindicationOtherTherapyComponent(t)); + for (org.hl7.fhir.r5.model.Population t : src.getPopulation()) + tgt.addPopulation(convertPopulation(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.MedicinalProductContraindication.MedicinalProductContraindicationOtherTherapyComponent convertMedicinalProductContraindicationOtherTherapyComponent(org.hl7.fhir.r4.model.MedicinalProductContraindication.MedicinalProductContraindicationOtherTherapyComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.MedicinalProductContraindication.MedicinalProductContraindicationOtherTherapyComponent tgt = new org.hl7.fhir.r5.model.MedicinalProductContraindication.MedicinalProductContraindicationOtherTherapyComponent(); + copyElement(src, tgt); + if (src.hasTherapyRelationshipType()) + tgt.setTherapyRelationshipType(convertCodeableConcept(src.getTherapyRelationshipType())); + if (src.hasMedication()) + tgt.setMedication(convertType(src.getMedication())); + return tgt; + } + + public static org.hl7.fhir.r4.model.MedicinalProductContraindication.MedicinalProductContraindicationOtherTherapyComponent convertMedicinalProductContraindicationOtherTherapyComponent(org.hl7.fhir.r5.model.MedicinalProductContraindication.MedicinalProductContraindicationOtherTherapyComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.MedicinalProductContraindication.MedicinalProductContraindicationOtherTherapyComponent tgt = new org.hl7.fhir.r4.model.MedicinalProductContraindication.MedicinalProductContraindicationOtherTherapyComponent(); + copyElement(src, tgt); + if (src.hasTherapyRelationshipType()) + tgt.setTherapyRelationshipType(convertCodeableConcept(src.getTherapyRelationshipType())); + if (src.hasMedication()) + tgt.setMedication(convertType(src.getMedication())); + return tgt; + } + + +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/MedicinalProductIndication.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/MedicinalProductIndication.java new file mode 100644 index 000000000..1981d2aad --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/MedicinalProductIndication.java @@ -0,0 +1,119 @@ +package org.hl7.fhir.convertors.conv40_50; + +import org.hl7.fhir.exceptions.FHIRException; + +import org.hl7.fhir.convertors.VersionConvertor_40_50; + + +/* + Copyright (c) 2011+, HL7, Inc. + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of HL7 nor the names of its contributors may be used to + endorse or promote products derived from this software without specific + prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + +*/ + +// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0 + + +public class MedicinalProductIndication extends VersionConvertor_40_50 { + + public static org.hl7.fhir.r5.model.MedicinalProductIndication convertMedicinalProductIndication(org.hl7.fhir.r4.model.MedicinalProductIndication src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.MedicinalProductIndication tgt = new org.hl7.fhir.r5.model.MedicinalProductIndication(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r4.model.Reference t : src.getSubject()) + tgt.addSubject(convertReference(t)); + if (src.hasDiseaseSymptomProcedure()) + tgt.setDiseaseSymptomProcedure(convertCodeableConcept(src.getDiseaseSymptomProcedure())); + if (src.hasDiseaseStatus()) + tgt.setDiseaseStatus(convertCodeableConcept(src.getDiseaseStatus())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getComorbidity()) + tgt.addComorbidity(convertCodeableConcept(t)); + if (src.hasIntendedEffect()) + tgt.setIntendedEffect(convertCodeableConcept(src.getIntendedEffect())); + if (src.hasDuration()) + tgt.setDuration(convertQuantity(src.getDuration())); + for (org.hl7.fhir.r4.model.MedicinalProductIndication.MedicinalProductIndicationOtherTherapyComponent t : src.getOtherTherapy()) + tgt.addOtherTherapy(convertMedicinalProductIndicationOtherTherapyComponent(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getUndesirableEffect()) + tgt.addUndesirableEffect(convertReference(t)); + for (org.hl7.fhir.r4.model.Population t : src.getPopulation()) + tgt.addPopulation(convertPopulation(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.MedicinalProductIndication convertMedicinalProductIndication(org.hl7.fhir.r5.model.MedicinalProductIndication src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.MedicinalProductIndication tgt = new org.hl7.fhir.r4.model.MedicinalProductIndication(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Reference t : src.getSubject()) + tgt.addSubject(convertReference(t)); + if (src.hasDiseaseSymptomProcedure()) + tgt.setDiseaseSymptomProcedure(convertCodeableConcept(src.getDiseaseSymptomProcedure())); + if (src.hasDiseaseStatus()) + tgt.setDiseaseStatus(convertCodeableConcept(src.getDiseaseStatus())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getComorbidity()) + tgt.addComorbidity(convertCodeableConcept(t)); + if (src.hasIntendedEffect()) + tgt.setIntendedEffect(convertCodeableConcept(src.getIntendedEffect())); + if (src.hasDuration()) + tgt.setDuration(convertQuantity(src.getDuration())); + for (org.hl7.fhir.r5.model.MedicinalProductIndication.MedicinalProductIndicationOtherTherapyComponent t : src.getOtherTherapy()) + tgt.addOtherTherapy(convertMedicinalProductIndicationOtherTherapyComponent(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getUndesirableEffect()) + tgt.addUndesirableEffect(convertReference(t)); + for (org.hl7.fhir.r5.model.Population t : src.getPopulation()) + tgt.addPopulation(convertPopulation(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.MedicinalProductIndication.MedicinalProductIndicationOtherTherapyComponent convertMedicinalProductIndicationOtherTherapyComponent(org.hl7.fhir.r4.model.MedicinalProductIndication.MedicinalProductIndicationOtherTherapyComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.MedicinalProductIndication.MedicinalProductIndicationOtherTherapyComponent tgt = new org.hl7.fhir.r5.model.MedicinalProductIndication.MedicinalProductIndicationOtherTherapyComponent(); + copyElement(src, tgt); + if (src.hasTherapyRelationshipType()) + tgt.setTherapyRelationshipType(convertCodeableConcept(src.getTherapyRelationshipType())); + if (src.hasMedication()) + tgt.setMedication(convertType(src.getMedication())); + return tgt; + } + + public static org.hl7.fhir.r4.model.MedicinalProductIndication.MedicinalProductIndicationOtherTherapyComponent convertMedicinalProductIndicationOtherTherapyComponent(org.hl7.fhir.r5.model.MedicinalProductIndication.MedicinalProductIndicationOtherTherapyComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.MedicinalProductIndication.MedicinalProductIndicationOtherTherapyComponent tgt = new org.hl7.fhir.r4.model.MedicinalProductIndication.MedicinalProductIndicationOtherTherapyComponent(); + copyElement(src, tgt); + if (src.hasTherapyRelationshipType()) + tgt.setTherapyRelationshipType(convertCodeableConcept(src.getTherapyRelationshipType())); + if (src.hasMedication()) + tgt.setMedication(convertType(src.getMedication())); + return tgt; + } + + +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/MedicinalProductIngredient.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/MedicinalProductIngredient.java new file mode 100644 index 000000000..efc7e9849 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/MedicinalProductIngredient.java @@ -0,0 +1,219 @@ +package org.hl7.fhir.convertors.conv40_50; + +import org.hl7.fhir.exceptions.FHIRException; + +import org.hl7.fhir.convertors.VersionConvertor_40_50; + + +/* + Copyright (c) 2011+, HL7, Inc. + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of HL7 nor the names of its contributors may be used to + endorse or promote products derived from this software without specific + prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + +*/ + +// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0 + + +public class MedicinalProductIngredient extends VersionConvertor_40_50 { + + public static org.hl7.fhir.r5.model.MedicinalProductIngredient convertMedicinalProductIngredient(org.hl7.fhir.r4.model.MedicinalProductIngredient src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.MedicinalProductIngredient tgt = new org.hl7.fhir.r5.model.MedicinalProductIngredient(); + copyDomainResource(src, tgt); + if (src.hasIdentifier()) + tgt.setIdentifier(convertIdentifier(src.getIdentifier())); + if (src.hasRole()) + tgt.setRole(convertCodeableConcept(src.getRole())); + if (src.hasAllergenicIndicator()) + tgt.setAllergenicIndicatorElement(convertBoolean(src.getAllergenicIndicatorElement())); + for (org.hl7.fhir.r4.model.Reference t : src.getManufacturer()) + tgt.addManufacturer(convertReference(t)); + for (org.hl7.fhir.r4.model.MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceComponent t : src.getSpecifiedSubstance()) + tgt.addSpecifiedSubstance(convertMedicinalProductIngredientSpecifiedSubstanceComponent(t)); + if (src.hasSubstance()) + tgt.setSubstance(convertMedicinalProductIngredientSubstanceComponent(src.getSubstance())); + return tgt; + } + + public static org.hl7.fhir.r4.model.MedicinalProductIngredient convertMedicinalProductIngredient(org.hl7.fhir.r5.model.MedicinalProductIngredient src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.MedicinalProductIngredient tgt = new org.hl7.fhir.r4.model.MedicinalProductIngredient(); + copyDomainResource(src, tgt); + if (src.hasIdentifier()) + tgt.setIdentifier(convertIdentifier(src.getIdentifier())); + if (src.hasRole()) + tgt.setRole(convertCodeableConcept(src.getRole())); + if (src.hasAllergenicIndicator()) + tgt.setAllergenicIndicatorElement(convertBoolean(src.getAllergenicIndicatorElement())); + for (org.hl7.fhir.r5.model.Reference t : src.getManufacturer()) + tgt.addManufacturer(convertReference(t)); + for (org.hl7.fhir.r5.model.MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceComponent t : src.getSpecifiedSubstance()) + tgt.addSpecifiedSubstance(convertMedicinalProductIngredientSpecifiedSubstanceComponent(t)); + if (src.hasSubstance()) + tgt.setSubstance(convertMedicinalProductIngredientSubstanceComponent(src.getSubstance())); + return tgt; + } + + public static org.hl7.fhir.r5.model.MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceComponent convertMedicinalProductIngredientSpecifiedSubstanceComponent(org.hl7.fhir.r4.model.MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceComponent tgt = new org.hl7.fhir.r5.model.MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceComponent(); + copyElement(src, tgt); + if (src.hasCode()) + tgt.setCode(convertCodeableConcept(src.getCode())); + if (src.hasGroup()) + tgt.setGroup(convertCodeableConcept(src.getGroup())); + if (src.hasConfidentiality()) + tgt.setConfidentiality(convertCodeableConcept(src.getConfidentiality())); + for (org.hl7.fhir.r4.model.MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceStrengthComponent t : src.getStrength()) + tgt.addStrength(convertMedicinalProductIngredientSpecifiedSubstanceStrengthComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceComponent convertMedicinalProductIngredientSpecifiedSubstanceComponent(org.hl7.fhir.r5.model.MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceComponent tgt = new org.hl7.fhir.r4.model.MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceComponent(); + copyElement(src, tgt); + if (src.hasCode()) + tgt.setCode(convertCodeableConcept(src.getCode())); + if (src.hasGroup()) + tgt.setGroup(convertCodeableConcept(src.getGroup())); + if (src.hasConfidentiality()) + tgt.setConfidentiality(convertCodeableConcept(src.getConfidentiality())); + for (org.hl7.fhir.r5.model.MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceStrengthComponent t : src.getStrength()) + tgt.addStrength(convertMedicinalProductIngredientSpecifiedSubstanceStrengthComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceStrengthComponent convertMedicinalProductIngredientSpecifiedSubstanceStrengthComponent(org.hl7.fhir.r4.model.MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceStrengthComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceStrengthComponent tgt = new org.hl7.fhir.r5.model.MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceStrengthComponent(); + copyElement(src, tgt); + if (src.hasPresentation()) + tgt.setPresentation(convertRatio(src.getPresentation())); + if (src.hasPresentationLowLimit()) + tgt.setPresentationLowLimit(convertRatio(src.getPresentationLowLimit())); + if (src.hasConcentration()) + tgt.setConcentration(convertRatio(src.getConcentration())); + if (src.hasConcentrationLowLimit()) + tgt.setConcentrationLowLimit(convertRatio(src.getConcentrationLowLimit())); + if (src.hasMeasurementPoint()) + tgt.setMeasurementPointElement(convertString(src.getMeasurementPointElement())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getCountry()) + tgt.addCountry(convertCodeableConcept(t)); + for (org.hl7.fhir.r4.model.MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceStrengthReferenceStrengthComponent t : src.getReferenceStrength()) + tgt.addReferenceStrength(convertMedicinalProductIngredientSpecifiedSubstanceStrengthReferenceStrengthComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceStrengthComponent convertMedicinalProductIngredientSpecifiedSubstanceStrengthComponent(org.hl7.fhir.r5.model.MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceStrengthComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceStrengthComponent tgt = new org.hl7.fhir.r4.model.MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceStrengthComponent(); + copyElement(src, tgt); + if (src.hasPresentation()) + tgt.setPresentation(convertRatio(src.getPresentation())); + if (src.hasPresentationLowLimit()) + tgt.setPresentationLowLimit(convertRatio(src.getPresentationLowLimit())); + if (src.hasConcentration()) + tgt.setConcentration(convertRatio(src.getConcentration())); + if (src.hasConcentrationLowLimit()) + tgt.setConcentrationLowLimit(convertRatio(src.getConcentrationLowLimit())); + if (src.hasMeasurementPoint()) + tgt.setMeasurementPointElement(convertString(src.getMeasurementPointElement())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getCountry()) + tgt.addCountry(convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceStrengthReferenceStrengthComponent t : src.getReferenceStrength()) + tgt.addReferenceStrength(convertMedicinalProductIngredientSpecifiedSubstanceStrengthReferenceStrengthComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceStrengthReferenceStrengthComponent convertMedicinalProductIngredientSpecifiedSubstanceStrengthReferenceStrengthComponent(org.hl7.fhir.r4.model.MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceStrengthReferenceStrengthComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceStrengthReferenceStrengthComponent tgt = new org.hl7.fhir.r5.model.MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceStrengthReferenceStrengthComponent(); + copyElement(src, tgt); + if (src.hasSubstance()) + tgt.setSubstance(convertCodeableConcept(src.getSubstance())); + if (src.hasStrength()) + tgt.setStrength(convertRatio(src.getStrength())); + if (src.hasStrengthLowLimit()) + tgt.setStrengthLowLimit(convertRatio(src.getStrengthLowLimit())); + if (src.hasMeasurementPoint()) + tgt.setMeasurementPointElement(convertString(src.getMeasurementPointElement())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getCountry()) + tgt.addCountry(convertCodeableConcept(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceStrengthReferenceStrengthComponent convertMedicinalProductIngredientSpecifiedSubstanceStrengthReferenceStrengthComponent(org.hl7.fhir.r5.model.MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceStrengthReferenceStrengthComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceStrengthReferenceStrengthComponent tgt = new org.hl7.fhir.r4.model.MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceStrengthReferenceStrengthComponent(); + copyElement(src, tgt); + if (src.hasSubstance()) + tgt.setSubstance(convertCodeableConcept(src.getSubstance())); + if (src.hasStrength()) + tgt.setStrength(convertRatio(src.getStrength())); + if (src.hasStrengthLowLimit()) + tgt.setStrengthLowLimit(convertRatio(src.getStrengthLowLimit())); + if (src.hasMeasurementPoint()) + tgt.setMeasurementPointElement(convertString(src.getMeasurementPointElement())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getCountry()) + tgt.addCountry(convertCodeableConcept(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.MedicinalProductIngredient.MedicinalProductIngredientSubstanceComponent convertMedicinalProductIngredientSubstanceComponent(org.hl7.fhir.r4.model.MedicinalProductIngredient.MedicinalProductIngredientSubstanceComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.MedicinalProductIngredient.MedicinalProductIngredientSubstanceComponent tgt = new org.hl7.fhir.r5.model.MedicinalProductIngredient.MedicinalProductIngredientSubstanceComponent(); + copyElement(src, tgt); + if (src.hasCode()) + tgt.setCode(convertCodeableConcept(src.getCode())); + for (org.hl7.fhir.r4.model.MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceStrengthComponent t : src.getStrength()) + tgt.addStrength(convertMedicinalProductIngredientSpecifiedSubstanceStrengthComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.MedicinalProductIngredient.MedicinalProductIngredientSubstanceComponent convertMedicinalProductIngredientSubstanceComponent(org.hl7.fhir.r5.model.MedicinalProductIngredient.MedicinalProductIngredientSubstanceComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.MedicinalProductIngredient.MedicinalProductIngredientSubstanceComponent tgt = new org.hl7.fhir.r4.model.MedicinalProductIngredient.MedicinalProductIngredientSubstanceComponent(); + copyElement(src, tgt); + if (src.hasCode()) + tgt.setCode(convertCodeableConcept(src.getCode())); + for (org.hl7.fhir.r5.model.MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceStrengthComponent t : src.getStrength()) + tgt.addStrength(convertMedicinalProductIngredientSpecifiedSubstanceStrengthComponent(t)); + return tgt; + } + + +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/MedicinalProductInteraction.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/MedicinalProductInteraction.java new file mode 100644 index 000000000..89a3715db --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/MedicinalProductInteraction.java @@ -0,0 +1,107 @@ +package org.hl7.fhir.convertors.conv40_50; + +import org.hl7.fhir.exceptions.FHIRException; + +import org.hl7.fhir.convertors.VersionConvertor_40_50; + + +/* + Copyright (c) 2011+, HL7, Inc. + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of HL7 nor the names of its contributors may be used to + endorse or promote products derived from this software without specific + prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + +*/ + +// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0 + + +public class MedicinalProductInteraction extends VersionConvertor_40_50 { + + public static org.hl7.fhir.r5.model.MedicinalProductInteraction convertMedicinalProductInteraction(org.hl7.fhir.r4.model.MedicinalProductInteraction src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.MedicinalProductInteraction tgt = new org.hl7.fhir.r5.model.MedicinalProductInteraction(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r4.model.Reference t : src.getSubject()) + tgt.addSubject(convertReference(t)); + if (src.hasDescription()) + tgt.setDescriptionElement(convertString(src.getDescriptionElement())); + for (org.hl7.fhir.r4.model.MedicinalProductInteraction.MedicinalProductInteractionInteractantComponent t : src.getInteractant()) + tgt.addInteractant(convertMedicinalProductInteractionInteractantComponent(t)); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + if (src.hasEffect()) + tgt.setEffect(convertCodeableConcept(src.getEffect())); + if (src.hasIncidence()) + tgt.setIncidence(convertCodeableConcept(src.getIncidence())); + if (src.hasManagement()) + tgt.setManagement(convertCodeableConcept(src.getManagement())); + return tgt; + } + + public static org.hl7.fhir.r4.model.MedicinalProductInteraction convertMedicinalProductInteraction(org.hl7.fhir.r5.model.MedicinalProductInteraction src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.MedicinalProductInteraction tgt = new org.hl7.fhir.r4.model.MedicinalProductInteraction(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Reference t : src.getSubject()) + tgt.addSubject(convertReference(t)); + if (src.hasDescription()) + tgt.setDescriptionElement(convertString(src.getDescriptionElement())); + for (org.hl7.fhir.r5.model.MedicinalProductInteraction.MedicinalProductInteractionInteractantComponent t : src.getInteractant()) + tgt.addInteractant(convertMedicinalProductInteractionInteractantComponent(t)); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + if (src.hasEffect()) + tgt.setEffect(convertCodeableConcept(src.getEffect())); + if (src.hasIncidence()) + tgt.setIncidence(convertCodeableConcept(src.getIncidence())); + if (src.hasManagement()) + tgt.setManagement(convertCodeableConcept(src.getManagement())); + return tgt; + } + + public static org.hl7.fhir.r5.model.MedicinalProductInteraction.MedicinalProductInteractionInteractantComponent convertMedicinalProductInteractionInteractantComponent(org.hl7.fhir.r4.model.MedicinalProductInteraction.MedicinalProductInteractionInteractantComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.MedicinalProductInteraction.MedicinalProductInteractionInteractantComponent tgt = new org.hl7.fhir.r5.model.MedicinalProductInteraction.MedicinalProductInteractionInteractantComponent(); + copyElement(src, tgt); + if (src.hasItem()) + tgt.setItem(convertType(src.getItem())); + return tgt; + } + + public static org.hl7.fhir.r4.model.MedicinalProductInteraction.MedicinalProductInteractionInteractantComponent convertMedicinalProductInteractionInteractantComponent(org.hl7.fhir.r5.model.MedicinalProductInteraction.MedicinalProductInteractionInteractantComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.MedicinalProductInteraction.MedicinalProductInteractionInteractantComponent tgt = new org.hl7.fhir.r4.model.MedicinalProductInteraction.MedicinalProductInteractionInteractantComponent(); + copyElement(src, tgt); + if (src.hasItem()) + tgt.setItem(convertType(src.getItem())); + return tgt; + } + + +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/MedicinalProductManufactured.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/MedicinalProductManufactured.java new file mode 100644 index 000000000..0b04ab1a4 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/MedicinalProductManufactured.java @@ -0,0 +1,87 @@ +package org.hl7.fhir.convertors.conv40_50; + +import org.hl7.fhir.exceptions.FHIRException; + +import org.hl7.fhir.convertors.VersionConvertor_40_50; + + +/* + Copyright (c) 2011+, HL7, Inc. + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of HL7 nor the names of its contributors may be used to + endorse or promote products derived from this software without specific + prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + +*/ + +// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0 + + +public class MedicinalProductManufactured extends VersionConvertor_40_50 { + + public static org.hl7.fhir.r5.model.MedicinalProductManufactured convertMedicinalProductManufactured(org.hl7.fhir.r4.model.MedicinalProductManufactured src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.MedicinalProductManufactured tgt = new org.hl7.fhir.r5.model.MedicinalProductManufactured(); + copyDomainResource(src, tgt); + if (src.hasManufacturedDoseForm()) + tgt.setManufacturedDoseForm(convertCodeableConcept(src.getManufacturedDoseForm())); + if (src.hasUnitOfPresentation()) + tgt.setUnitOfPresentation(convertCodeableConcept(src.getUnitOfPresentation())); + if (src.hasQuantity()) + tgt.setQuantity(convertQuantity(src.getQuantity())); + for (org.hl7.fhir.r4.model.Reference t : src.getManufacturer()) + tgt.addManufacturer(convertReference(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getIngredient()) + tgt.addIngredient(convertReference(t)); + if (src.hasPhysicalCharacteristics()) + tgt.setPhysicalCharacteristics(convertProdCharacteristic(src.getPhysicalCharacteristics())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getOtherCharacteristics()) + tgt.addOtherCharacteristics(convertCodeableConcept(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.MedicinalProductManufactured convertMedicinalProductManufactured(org.hl7.fhir.r5.model.MedicinalProductManufactured src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.MedicinalProductManufactured tgt = new org.hl7.fhir.r4.model.MedicinalProductManufactured(); + copyDomainResource(src, tgt); + if (src.hasManufacturedDoseForm()) + tgt.setManufacturedDoseForm(convertCodeableConcept(src.getManufacturedDoseForm())); + if (src.hasUnitOfPresentation()) + tgt.setUnitOfPresentation(convertCodeableConcept(src.getUnitOfPresentation())); + if (src.hasQuantity()) + tgt.setQuantity(convertQuantity(src.getQuantity())); + for (org.hl7.fhir.r5.model.Reference t : src.getManufacturer()) + tgt.addManufacturer(convertReference(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getIngredient()) + tgt.addIngredient(convertReference(t)); + if (src.hasPhysicalCharacteristics()) + tgt.setPhysicalCharacteristics(convertProdCharacteristic(src.getPhysicalCharacteristics())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getOtherCharacteristics()) + tgt.addOtherCharacteristics(convertCodeableConcept(t)); + return tgt; + } + + +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/MedicinalProductPackaged.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/MedicinalProductPackaged.java new file mode 100644 index 000000000..4dfa47bdd --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/MedicinalProductPackaged.java @@ -0,0 +1,183 @@ +package org.hl7.fhir.convertors.conv40_50; + +import org.hl7.fhir.exceptions.FHIRException; + +import org.hl7.fhir.convertors.VersionConvertor_40_50; + + +/* + Copyright (c) 2011+, HL7, Inc. + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of HL7 nor the names of its contributors may be used to + endorse or promote products derived from this software without specific + prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + +*/ + +// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0 + + +public class MedicinalProductPackaged extends VersionConvertor_40_50 { + + public static org.hl7.fhir.r5.model.MedicinalProductPackaged convertMedicinalProductPackaged(org.hl7.fhir.r4.model.MedicinalProductPackaged src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.MedicinalProductPackaged tgt = new org.hl7.fhir.r5.model.MedicinalProductPackaged(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getSubject()) + tgt.addSubject(convertReference(t)); + if (src.hasDescription()) + tgt.setDescriptionElement(convertString(src.getDescriptionElement())); + if (src.hasLegalStatusOfSupply()) + tgt.setLegalStatusOfSupply(convertCodeableConcept(src.getLegalStatusOfSupply())); + for (org.hl7.fhir.r4.model.MarketingStatus t : src.getMarketingStatus()) + tgt.addMarketingStatus(convertMarketingStatus(t)); + if (src.hasMarketingAuthorization()) + tgt.setMarketingAuthorization(convertReference(src.getMarketingAuthorization())); + for (org.hl7.fhir.r4.model.Reference t : src.getManufacturer()) + tgt.addManufacturer(convertReference(t)); + for (org.hl7.fhir.r4.model.MedicinalProductPackaged.MedicinalProductPackagedBatchIdentifierComponent t : src.getBatchIdentifier()) + tgt.addBatchIdentifier(convertMedicinalProductPackagedBatchIdentifierComponent(t)); + for (org.hl7.fhir.r4.model.MedicinalProductPackaged.MedicinalProductPackagedPackageItemComponent t : src.getPackageItem()) + tgt.addPackageItem(convertMedicinalProductPackagedPackageItemComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.MedicinalProductPackaged convertMedicinalProductPackaged(org.hl7.fhir.r5.model.MedicinalProductPackaged src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.MedicinalProductPackaged tgt = new org.hl7.fhir.r4.model.MedicinalProductPackaged(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getSubject()) + tgt.addSubject(convertReference(t)); + if (src.hasDescription()) + tgt.setDescriptionElement(convertString(src.getDescriptionElement())); + if (src.hasLegalStatusOfSupply()) + tgt.setLegalStatusOfSupply(convertCodeableConcept(src.getLegalStatusOfSupply())); + for (org.hl7.fhir.r5.model.MarketingStatus t : src.getMarketingStatus()) + tgt.addMarketingStatus(convertMarketingStatus(t)); + if (src.hasMarketingAuthorization()) + tgt.setMarketingAuthorization(convertReference(src.getMarketingAuthorization())); + for (org.hl7.fhir.r5.model.Reference t : src.getManufacturer()) + tgt.addManufacturer(convertReference(t)); + for (org.hl7.fhir.r5.model.MedicinalProductPackaged.MedicinalProductPackagedBatchIdentifierComponent t : src.getBatchIdentifier()) + tgt.addBatchIdentifier(convertMedicinalProductPackagedBatchIdentifierComponent(t)); + for (org.hl7.fhir.r5.model.MedicinalProductPackaged.MedicinalProductPackagedPackageItemComponent t : src.getPackageItem()) + tgt.addPackageItem(convertMedicinalProductPackagedPackageItemComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.MedicinalProductPackaged.MedicinalProductPackagedBatchIdentifierComponent convertMedicinalProductPackagedBatchIdentifierComponent(org.hl7.fhir.r4.model.MedicinalProductPackaged.MedicinalProductPackagedBatchIdentifierComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.MedicinalProductPackaged.MedicinalProductPackagedBatchIdentifierComponent tgt = new org.hl7.fhir.r5.model.MedicinalProductPackaged.MedicinalProductPackagedBatchIdentifierComponent(); + copyElement(src, tgt); + if (src.hasOuterPackaging()) + tgt.setOuterPackaging(convertIdentifier(src.getOuterPackaging())); + if (src.hasImmediatePackaging()) + tgt.setImmediatePackaging(convertIdentifier(src.getImmediatePackaging())); + return tgt; + } + + public static org.hl7.fhir.r4.model.MedicinalProductPackaged.MedicinalProductPackagedBatchIdentifierComponent convertMedicinalProductPackagedBatchIdentifierComponent(org.hl7.fhir.r5.model.MedicinalProductPackaged.MedicinalProductPackagedBatchIdentifierComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.MedicinalProductPackaged.MedicinalProductPackagedBatchIdentifierComponent tgt = new org.hl7.fhir.r4.model.MedicinalProductPackaged.MedicinalProductPackagedBatchIdentifierComponent(); + copyElement(src, tgt); + if (src.hasOuterPackaging()) + tgt.setOuterPackaging(convertIdentifier(src.getOuterPackaging())); + if (src.hasImmediatePackaging()) + tgt.setImmediatePackaging(convertIdentifier(src.getImmediatePackaging())); + return tgt; + } + + public static org.hl7.fhir.r5.model.MedicinalProductPackaged.MedicinalProductPackagedPackageItemComponent convertMedicinalProductPackagedPackageItemComponent(org.hl7.fhir.r4.model.MedicinalProductPackaged.MedicinalProductPackagedPackageItemComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.MedicinalProductPackaged.MedicinalProductPackagedPackageItemComponent tgt = new org.hl7.fhir.r5.model.MedicinalProductPackaged.MedicinalProductPackagedPackageItemComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + if (src.hasQuantity()) + tgt.setQuantity(convertQuantity(src.getQuantity())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getMaterial()) + tgt.addMaterial(convertCodeableConcept(t)); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getAlternateMaterial()) + tgt.addAlternateMaterial(convertCodeableConcept(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getDevice()) + tgt.addDevice(convertReference(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getManufacturedItem()) + tgt.addManufacturedItem(convertReference(t)); + for (org.hl7.fhir.r4.model.MedicinalProductPackaged.MedicinalProductPackagedPackageItemComponent t : src.getPackageItem()) + tgt.addPackageItem(convertMedicinalProductPackagedPackageItemComponent(t)); + if (src.hasPhysicalCharacteristics()) + tgt.setPhysicalCharacteristics(convertProdCharacteristic(src.getPhysicalCharacteristics())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getOtherCharacteristics()) + tgt.addOtherCharacteristics(convertCodeableConcept(t)); + for (org.hl7.fhir.r4.model.ProductShelfLife t : src.getShelfLifeStorage()) + tgt.addShelfLifeStorage(convertProductShelfLife(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getManufacturer()) + tgt.addManufacturer(convertReference(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.MedicinalProductPackaged.MedicinalProductPackagedPackageItemComponent convertMedicinalProductPackagedPackageItemComponent(org.hl7.fhir.r5.model.MedicinalProductPackaged.MedicinalProductPackagedPackageItemComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.MedicinalProductPackaged.MedicinalProductPackagedPackageItemComponent tgt = new org.hl7.fhir.r4.model.MedicinalProductPackaged.MedicinalProductPackagedPackageItemComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + if (src.hasQuantity()) + tgt.setQuantity(convertQuantity(src.getQuantity())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getMaterial()) + tgt.addMaterial(convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getAlternateMaterial()) + tgt.addAlternateMaterial(convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getDevice()) + tgt.addDevice(convertReference(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getManufacturedItem()) + tgt.addManufacturedItem(convertReference(t)); + for (org.hl7.fhir.r5.model.MedicinalProductPackaged.MedicinalProductPackagedPackageItemComponent t : src.getPackageItem()) + tgt.addPackageItem(convertMedicinalProductPackagedPackageItemComponent(t)); + if (src.hasPhysicalCharacteristics()) + tgt.setPhysicalCharacteristics(convertProdCharacteristic(src.getPhysicalCharacteristics())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getOtherCharacteristics()) + tgt.addOtherCharacteristics(convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.ProductShelfLife t : src.getShelfLifeStorage()) + tgt.addShelfLifeStorage(convertProductShelfLife(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getManufacturer()) + tgt.addManufacturer(convertReference(t)); + return tgt; + } + + +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/MedicinalProductPharmaceutical.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/MedicinalProductPharmaceutical.java new file mode 100644 index 000000000..1e4d60000 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/MedicinalProductPharmaceutical.java @@ -0,0 +1,207 @@ +package org.hl7.fhir.convertors.conv40_50; + +import org.hl7.fhir.exceptions.FHIRException; + +import org.hl7.fhir.convertors.VersionConvertor_40_50; + + +/* + Copyright (c) 2011+, HL7, Inc. + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of HL7 nor the names of its contributors may be used to + endorse or promote products derived from this software without specific + prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + +*/ + +// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0 + + +public class MedicinalProductPharmaceutical extends VersionConvertor_40_50 { + + public static org.hl7.fhir.r5.model.MedicinalProductPharmaceutical convertMedicinalProductPharmaceutical(org.hl7.fhir.r4.model.MedicinalProductPharmaceutical src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.MedicinalProductPharmaceutical tgt = new org.hl7.fhir.r5.model.MedicinalProductPharmaceutical(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasAdministrableDoseForm()) + tgt.setAdministrableDoseForm(convertCodeableConcept(src.getAdministrableDoseForm())); + if (src.hasUnitOfPresentation()) + tgt.setUnitOfPresentation(convertCodeableConcept(src.getUnitOfPresentation())); + for (org.hl7.fhir.r4.model.Reference t : src.getIngredient()) + tgt.addIngredient(convertReference(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getDevice()) + tgt.addDevice(convertReference(t)); + for (org.hl7.fhir.r4.model.MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalCharacteristicsComponent t : src.getCharacteristics()) + tgt.addCharacteristics(convertMedicinalProductPharmaceuticalCharacteristicsComponent(t)); + for (org.hl7.fhir.r4.model.MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalRouteOfAdministrationComponent t : src.getRouteOfAdministration()) + tgt.addRouteOfAdministration(convertMedicinalProductPharmaceuticalRouteOfAdministrationComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.MedicinalProductPharmaceutical convertMedicinalProductPharmaceutical(org.hl7.fhir.r5.model.MedicinalProductPharmaceutical src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.MedicinalProductPharmaceutical tgt = new org.hl7.fhir.r4.model.MedicinalProductPharmaceutical(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasAdministrableDoseForm()) + tgt.setAdministrableDoseForm(convertCodeableConcept(src.getAdministrableDoseForm())); + if (src.hasUnitOfPresentation()) + tgt.setUnitOfPresentation(convertCodeableConcept(src.getUnitOfPresentation())); + for (org.hl7.fhir.r5.model.Reference t : src.getIngredient()) + tgt.addIngredient(convertReference(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getDevice()) + tgt.addDevice(convertReference(t)); + for (org.hl7.fhir.r5.model.MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalCharacteristicsComponent t : src.getCharacteristics()) + tgt.addCharacteristics(convertMedicinalProductPharmaceuticalCharacteristicsComponent(t)); + for (org.hl7.fhir.r5.model.MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalRouteOfAdministrationComponent t : src.getRouteOfAdministration()) + tgt.addRouteOfAdministration(convertMedicinalProductPharmaceuticalRouteOfAdministrationComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalCharacteristicsComponent convertMedicinalProductPharmaceuticalCharacteristicsComponent(org.hl7.fhir.r4.model.MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalCharacteristicsComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalCharacteristicsComponent tgt = new org.hl7.fhir.r5.model.MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalCharacteristicsComponent(); + copyElement(src, tgt); + if (src.hasCode()) + tgt.setCode(convertCodeableConcept(src.getCode())); + if (src.hasStatus()) + tgt.setStatus(convertCodeableConcept(src.getStatus())); + return tgt; + } + + public static org.hl7.fhir.r4.model.MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalCharacteristicsComponent convertMedicinalProductPharmaceuticalCharacteristicsComponent(org.hl7.fhir.r5.model.MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalCharacteristicsComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalCharacteristicsComponent tgt = new org.hl7.fhir.r4.model.MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalCharacteristicsComponent(); + copyElement(src, tgt); + if (src.hasCode()) + tgt.setCode(convertCodeableConcept(src.getCode())); + if (src.hasStatus()) + tgt.setStatus(convertCodeableConcept(src.getStatus())); + return tgt; + } + + public static org.hl7.fhir.r5.model.MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalRouteOfAdministrationComponent convertMedicinalProductPharmaceuticalRouteOfAdministrationComponent(org.hl7.fhir.r4.model.MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalRouteOfAdministrationComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalRouteOfAdministrationComponent tgt = new org.hl7.fhir.r5.model.MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalRouteOfAdministrationComponent(); + copyElement(src, tgt); + if (src.hasCode()) + tgt.setCode(convertCodeableConcept(src.getCode())); + if (src.hasFirstDose()) + tgt.setFirstDose(convertQuantity(src.getFirstDose())); + if (src.hasMaxSingleDose()) + tgt.setMaxSingleDose(convertQuantity(src.getMaxSingleDose())); + if (src.hasMaxDosePerDay()) + tgt.setMaxDosePerDay(convertQuantity(src.getMaxDosePerDay())); + if (src.hasMaxDosePerTreatmentPeriod()) + tgt.setMaxDosePerTreatmentPeriod(convertRatio(src.getMaxDosePerTreatmentPeriod())); + if (src.hasMaxTreatmentPeriod()) + tgt.setMaxTreatmentPeriod(convertDuration(src.getMaxTreatmentPeriod())); + for (org.hl7.fhir.r4.model.MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesComponent t : src.getTargetSpecies()) + tgt.addTargetSpecies(convertMedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalRouteOfAdministrationComponent convertMedicinalProductPharmaceuticalRouteOfAdministrationComponent(org.hl7.fhir.r5.model.MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalRouteOfAdministrationComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalRouteOfAdministrationComponent tgt = new org.hl7.fhir.r4.model.MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalRouteOfAdministrationComponent(); + copyElement(src, tgt); + if (src.hasCode()) + tgt.setCode(convertCodeableConcept(src.getCode())); + if (src.hasFirstDose()) + tgt.setFirstDose(convertQuantity(src.getFirstDose())); + if (src.hasMaxSingleDose()) + tgt.setMaxSingleDose(convertQuantity(src.getMaxSingleDose())); + if (src.hasMaxDosePerDay()) + tgt.setMaxDosePerDay(convertQuantity(src.getMaxDosePerDay())); + if (src.hasMaxDosePerTreatmentPeriod()) + tgt.setMaxDosePerTreatmentPeriod(convertRatio(src.getMaxDosePerTreatmentPeriod())); + if (src.hasMaxTreatmentPeriod()) + tgt.setMaxTreatmentPeriod(convertDuration(src.getMaxTreatmentPeriod())); + for (org.hl7.fhir.r5.model.MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesComponent t : src.getTargetSpecies()) + tgt.addTargetSpecies(convertMedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesComponent convertMedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesComponent(org.hl7.fhir.r4.model.MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesComponent tgt = new org.hl7.fhir.r5.model.MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesComponent(); + copyElement(src, tgt); + if (src.hasCode()) + tgt.setCode(convertCodeableConcept(src.getCode())); + for (org.hl7.fhir.r4.model.MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent t : src.getWithdrawalPeriod()) + tgt.addWithdrawalPeriod(convertMedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesComponent convertMedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesComponent(org.hl7.fhir.r5.model.MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesComponent tgt = new org.hl7.fhir.r4.model.MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesComponent(); + copyElement(src, tgt); + if (src.hasCode()) + tgt.setCode(convertCodeableConcept(src.getCode())); + for (org.hl7.fhir.r5.model.MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent t : src.getWithdrawalPeriod()) + tgt.addWithdrawalPeriod(convertMedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent convertMedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent(org.hl7.fhir.r4.model.MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent tgt = new org.hl7.fhir.r5.model.MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent(); + copyElement(src, tgt); + if (src.hasTissue()) + tgt.setTissue(convertCodeableConcept(src.getTissue())); + if (src.hasValue()) + tgt.setValue(convertQuantity(src.getValue())); + if (src.hasSupportingInformation()) + tgt.setSupportingInformationElement(convertString(src.getSupportingInformationElement())); + return tgt; + } + + public static org.hl7.fhir.r4.model.MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent convertMedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent(org.hl7.fhir.r5.model.MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent tgt = new org.hl7.fhir.r4.model.MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent(); + copyElement(src, tgt); + if (src.hasTissue()) + tgt.setTissue(convertCodeableConcept(src.getTissue())); + if (src.hasValue()) + tgt.setValue(convertQuantity(src.getValue())); + if (src.hasSupportingInformation()) + tgt.setSupportingInformationElement(convertString(src.getSupportingInformationElement())); + return tgt; + } + + +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/MedicinalProductUndesirableEffect.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/MedicinalProductUndesirableEffect.java new file mode 100644 index 000000000..6cb8ba6d9 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/MedicinalProductUndesirableEffect.java @@ -0,0 +1,79 @@ +package org.hl7.fhir.convertors.conv40_50; + +import org.hl7.fhir.exceptions.FHIRException; + +import org.hl7.fhir.convertors.VersionConvertor_40_50; + + +/* + Copyright (c) 2011+, HL7, Inc. + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of HL7 nor the names of its contributors may be used to + endorse or promote products derived from this software without specific + prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + +*/ + +// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0 + + +public class MedicinalProductUndesirableEffect extends VersionConvertor_40_50 { + + public static org.hl7.fhir.r5.model.MedicinalProductUndesirableEffect convertMedicinalProductUndesirableEffect(org.hl7.fhir.r4.model.MedicinalProductUndesirableEffect src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.MedicinalProductUndesirableEffect tgt = new org.hl7.fhir.r5.model.MedicinalProductUndesirableEffect(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r4.model.Reference t : src.getSubject()) + tgt.addSubject(convertReference(t)); + if (src.hasSymptomConditionEffect()) + tgt.setSymptomConditionEffect(convertCodeableConcept(src.getSymptomConditionEffect())); + if (src.hasClassification()) + tgt.setClassification(convertCodeableConcept(src.getClassification())); + if (src.hasFrequencyOfOccurrence()) + tgt.setFrequencyOfOccurrence(convertCodeableConcept(src.getFrequencyOfOccurrence())); + for (org.hl7.fhir.r4.model.Population t : src.getPopulation()) + tgt.addPopulation(convertPopulation(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.MedicinalProductUndesirableEffect convertMedicinalProductUndesirableEffect(org.hl7.fhir.r5.model.MedicinalProductUndesirableEffect src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.MedicinalProductUndesirableEffect tgt = new org.hl7.fhir.r4.model.MedicinalProductUndesirableEffect(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Reference t : src.getSubject()) + tgt.addSubject(convertReference(t)); + if (src.hasSymptomConditionEffect()) + tgt.setSymptomConditionEffect(convertCodeableConcept(src.getSymptomConditionEffect())); + if (src.hasClassification()) + tgt.setClassification(convertCodeableConcept(src.getClassification())); + if (src.hasFrequencyOfOccurrence()) + tgt.setFrequencyOfOccurrence(convertCodeableConcept(src.getFrequencyOfOccurrence())); + for (org.hl7.fhir.r5.model.Population t : src.getPopulation()) + tgt.addPopulation(convertPopulation(t)); + return tgt; + } + + +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/MessageDefinition.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/MessageDefinition.java new file mode 100644 index 000000000..0550fa380 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/MessageDefinition.java @@ -0,0 +1,257 @@ +package org.hl7.fhir.convertors.conv40_50; + +import org.hl7.fhir.exceptions.FHIRException; + +import org.hl7.fhir.convertors.VersionConvertor_40_50; + + +/* + Copyright (c) 2011+, HL7, Inc. + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of HL7 nor the names of its contributors may be used to + endorse or promote products derived from this software without specific + prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + +*/ + +// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0 + + +public class MessageDefinition extends VersionConvertor_40_50 { + + public static org.hl7.fhir.r5.model.MessageDefinition convertMessageDefinition(org.hl7.fhir.r4.model.MessageDefinition src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.MessageDefinition tgt = new org.hl7.fhir.r5.model.MessageDefinition(); + copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrlElement(convertUri(src.getUrlElement())); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasVersion()) + tgt.setVersionElement(convertString(src.getVersionElement())); + if (src.hasName()) + tgt.setNameElement(convertString(src.getNameElement())); + if (src.hasTitle()) + tgt.setTitleElement(convertString(src.getTitleElement())); + for (org.hl7.fhir.r4.model.CanonicalType t : src.getReplaces()) + tgt.getReplaces().add(convertCanonical(t)); + if (src.hasStatus()) + tgt.setStatus(Enumerations.convertPublicationStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimentalElement(convertBoolean(src.getExperimentalElement())); + if (src.hasDate()) + tgt.setDateElement(convertDateTime(src.getDateElement())); + if (src.hasPublisher()) + tgt.setPublisherElement(convertString(src.getPublisherElement())); + for (org.hl7.fhir.r4.model.ContactDetail t : src.getContact()) + tgt.addContact(convertContactDetail(t)); + if (src.hasDescription()) + tgt.setDescriptionElement(convertMarkdown(src.getDescriptionElement())); + for (org.hl7.fhir.r4.model.UsageContext t : src.getUseContext()) + tgt.addUseContext(convertUsageContext(t)); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getJurisdiction()) + tgt.addJurisdiction(convertCodeableConcept(t)); + if (src.hasPurpose()) + tgt.setPurposeElement(convertMarkdown(src.getPurposeElement())); + if (src.hasCopyright()) + tgt.setCopyrightElement(convertMarkdown(src.getCopyrightElement())); + if (src.hasBase()) + tgt.setBaseElement(convertCanonical(src.getBaseElement())); + for (org.hl7.fhir.r4.model.CanonicalType t : src.getParent()) + tgt.getParent().add(convertCanonical(t)); + if (src.hasEvent()) + tgt.setEvent(convertType(src.getEvent())); + if (src.hasCategory()) + tgt.setCategory(convertMessageSignificanceCategory(src.getCategory())); + for (org.hl7.fhir.r4.model.MessageDefinition.MessageDefinitionFocusComponent t : src.getFocus()) + tgt.addFocus(convertMessageDefinitionFocusComponent(t)); + if (src.hasResponseRequired()) + tgt.setResponseRequired(convertMessageheaderResponseRequest(src.getResponseRequired())); + for (org.hl7.fhir.r4.model.MessageDefinition.MessageDefinitionAllowedResponseComponent t : src.getAllowedResponse()) + tgt.addAllowedResponse(convertMessageDefinitionAllowedResponseComponent(t)); + for (org.hl7.fhir.r4.model.CanonicalType t : src.getGraph()) + tgt.getGraph().add(convertCanonical(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.MessageDefinition convertMessageDefinition(org.hl7.fhir.r5.model.MessageDefinition src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.MessageDefinition tgt = new org.hl7.fhir.r4.model.MessageDefinition(); + copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrlElement(convertUri(src.getUrlElement())); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasVersion()) + tgt.setVersionElement(convertString(src.getVersionElement())); + if (src.hasName()) + tgt.setNameElement(convertString(src.getNameElement())); + if (src.hasTitle()) + tgt.setTitleElement(convertString(src.getTitleElement())); + for (org.hl7.fhir.r5.model.CanonicalType t : src.getReplaces()) + tgt.getReplaces().add(convertCanonical(t)); + if (src.hasStatus()) + tgt.setStatus(Enumerations.convertPublicationStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimentalElement(convertBoolean(src.getExperimentalElement())); + if (src.hasDate()) + tgt.setDateElement(convertDateTime(src.getDateElement())); + if (src.hasPublisher()) + tgt.setPublisherElement(convertString(src.getPublisherElement())); + for (org.hl7.fhir.r5.model.ContactDetail t : src.getContact()) + tgt.addContact(convertContactDetail(t)); + if (src.hasDescription()) + tgt.setDescriptionElement(convertMarkdown(src.getDescriptionElement())); + for (org.hl7.fhir.r5.model.UsageContext t : src.getUseContext()) + tgt.addUseContext(convertUsageContext(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getJurisdiction()) + tgt.addJurisdiction(convertCodeableConcept(t)); + if (src.hasPurpose()) + tgt.setPurposeElement(convertMarkdown(src.getPurposeElement())); + if (src.hasCopyright()) + tgt.setCopyrightElement(convertMarkdown(src.getCopyrightElement())); + if (src.hasBase()) + tgt.setBaseElement(convertCanonical(src.getBaseElement())); + for (org.hl7.fhir.r5.model.CanonicalType t : src.getParent()) + tgt.getParent().add(convertCanonical(t)); + if (src.hasEvent()) + tgt.setEvent(convertType(src.getEvent())); + if (src.hasCategory()) + tgt.setCategory(convertMessageSignificanceCategory(src.getCategory())); + for (org.hl7.fhir.r5.model.MessageDefinition.MessageDefinitionFocusComponent t : src.getFocus()) + tgt.addFocus(convertMessageDefinitionFocusComponent(t)); + if (src.hasResponseRequired()) + tgt.setResponseRequired(convertMessageheaderResponseRequest(src.getResponseRequired())); + for (org.hl7.fhir.r5.model.MessageDefinition.MessageDefinitionAllowedResponseComponent t : src.getAllowedResponse()) + tgt.addAllowedResponse(convertMessageDefinitionAllowedResponseComponent(t)); + for (org.hl7.fhir.r5.model.CanonicalType t : src.getGraph()) + tgt.getGraph().add(convertCanonical(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.MessageDefinition.MessageSignificanceCategory convertMessageSignificanceCategory(org.hl7.fhir.r4.model.MessageDefinition.MessageSignificanceCategory src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case CONSEQUENCE: return org.hl7.fhir.r5.model.MessageDefinition.MessageSignificanceCategory.CONSEQUENCE; + case CURRENCY: return org.hl7.fhir.r5.model.MessageDefinition.MessageSignificanceCategory.CURRENCY; + case NOTIFICATION: return org.hl7.fhir.r5.model.MessageDefinition.MessageSignificanceCategory.NOTIFICATION; + default: return org.hl7.fhir.r5.model.MessageDefinition.MessageSignificanceCategory.NULL; + } +} + + public static org.hl7.fhir.r4.model.MessageDefinition.MessageSignificanceCategory convertMessageSignificanceCategory(org.hl7.fhir.r5.model.MessageDefinition.MessageSignificanceCategory src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case CONSEQUENCE: return org.hl7.fhir.r4.model.MessageDefinition.MessageSignificanceCategory.CONSEQUENCE; + case CURRENCY: return org.hl7.fhir.r4.model.MessageDefinition.MessageSignificanceCategory.CURRENCY; + case NOTIFICATION: return org.hl7.fhir.r4.model.MessageDefinition.MessageSignificanceCategory.NOTIFICATION; + default: return org.hl7.fhir.r4.model.MessageDefinition.MessageSignificanceCategory.NULL; + } +} + + public static org.hl7.fhir.r5.model.MessageDefinition.MessageheaderResponseRequest convertMessageheaderResponseRequest(org.hl7.fhir.r4.model.MessageDefinition.MessageheaderResponseRequest src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case ALWAYS: return org.hl7.fhir.r5.model.MessageDefinition.MessageheaderResponseRequest.ALWAYS; + case ONERROR: return org.hl7.fhir.r5.model.MessageDefinition.MessageheaderResponseRequest.ONERROR; + case NEVER: return org.hl7.fhir.r5.model.MessageDefinition.MessageheaderResponseRequest.NEVER; + case ONSUCCESS: return org.hl7.fhir.r5.model.MessageDefinition.MessageheaderResponseRequest.ONSUCCESS; + default: return org.hl7.fhir.r5.model.MessageDefinition.MessageheaderResponseRequest.NULL; + } +} + + public static org.hl7.fhir.r4.model.MessageDefinition.MessageheaderResponseRequest convertMessageheaderResponseRequest(org.hl7.fhir.r5.model.MessageDefinition.MessageheaderResponseRequest src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case ALWAYS: return org.hl7.fhir.r4.model.MessageDefinition.MessageheaderResponseRequest.ALWAYS; + case ONERROR: return org.hl7.fhir.r4.model.MessageDefinition.MessageheaderResponseRequest.ONERROR; + case NEVER: return org.hl7.fhir.r4.model.MessageDefinition.MessageheaderResponseRequest.NEVER; + case ONSUCCESS: return org.hl7.fhir.r4.model.MessageDefinition.MessageheaderResponseRequest.ONSUCCESS; + default: return org.hl7.fhir.r4.model.MessageDefinition.MessageheaderResponseRequest.NULL; + } +} + + public static org.hl7.fhir.r5.model.MessageDefinition.MessageDefinitionFocusComponent convertMessageDefinitionFocusComponent(org.hl7.fhir.r4.model.MessageDefinition.MessageDefinitionFocusComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.MessageDefinition.MessageDefinitionFocusComponent tgt = new org.hl7.fhir.r5.model.MessageDefinition.MessageDefinitionFocusComponent(); + copyElement(src, tgt); + if (src.hasCode()) + tgt.setCodeElement(convertCode(src.getCodeElement())); + if (src.hasProfile()) + tgt.setProfileElement(convertCanonical(src.getProfileElement())); + if (src.hasMin()) + tgt.setMinElement(convertUnsignedInt(src.getMinElement())); + if (src.hasMax()) + tgt.setMaxElement(convertString(src.getMaxElement())); + return tgt; + } + + public static org.hl7.fhir.r4.model.MessageDefinition.MessageDefinitionFocusComponent convertMessageDefinitionFocusComponent(org.hl7.fhir.r5.model.MessageDefinition.MessageDefinitionFocusComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.MessageDefinition.MessageDefinitionFocusComponent tgt = new org.hl7.fhir.r4.model.MessageDefinition.MessageDefinitionFocusComponent(); + copyElement(src, tgt); + if (src.hasCode()) + tgt.setCodeElement(convertCode(src.getCodeElement())); + if (src.hasProfile()) + tgt.setProfileElement(convertCanonical(src.getProfileElement())); + if (src.hasMin()) + tgt.setMinElement(convertUnsignedInt(src.getMinElement())); + if (src.hasMax()) + tgt.setMaxElement(convertString(src.getMaxElement())); + return tgt; + } + + public static org.hl7.fhir.r5.model.MessageDefinition.MessageDefinitionAllowedResponseComponent convertMessageDefinitionAllowedResponseComponent(org.hl7.fhir.r4.model.MessageDefinition.MessageDefinitionAllowedResponseComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.MessageDefinition.MessageDefinitionAllowedResponseComponent tgt = new org.hl7.fhir.r5.model.MessageDefinition.MessageDefinitionAllowedResponseComponent(); + copyElement(src, tgt); + if (src.hasMessage()) + tgt.setMessageElement(convertCanonical(src.getMessageElement())); + if (src.hasSituation()) + tgt.setSituationElement(convertMarkdown(src.getSituationElement())); + return tgt; + } + + public static org.hl7.fhir.r4.model.MessageDefinition.MessageDefinitionAllowedResponseComponent convertMessageDefinitionAllowedResponseComponent(org.hl7.fhir.r5.model.MessageDefinition.MessageDefinitionAllowedResponseComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.MessageDefinition.MessageDefinitionAllowedResponseComponent tgt = new org.hl7.fhir.r4.model.MessageDefinition.MessageDefinitionAllowedResponseComponent(); + copyElement(src, tgt); + if (src.hasMessage()) + tgt.setMessageElement(convertCanonical(src.getMessageElement())); + if (src.hasSituation()) + tgt.setSituationElement(convertMarkdown(src.getSituationElement())); + return tgt; + } + + +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/MessageHeader.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/MessageHeader.java new file mode 100644 index 000000000..20b61bd5c --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/MessageHeader.java @@ -0,0 +1,221 @@ +package org.hl7.fhir.convertors.conv40_50; + +import org.hl7.fhir.exceptions.FHIRException; + +import org.hl7.fhir.convertors.VersionConvertor_40_50; + + +/* + Copyright (c) 2011+, HL7, Inc. + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of HL7 nor the names of its contributors may be used to + endorse or promote products derived from this software without specific + prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + +*/ + +// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0 + + +public class MessageHeader extends VersionConvertor_40_50 { + + public static org.hl7.fhir.r5.model.MessageHeader convertMessageHeader(org.hl7.fhir.r4.model.MessageHeader src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.MessageHeader tgt = new org.hl7.fhir.r5.model.MessageHeader(); + copyDomainResource(src, tgt); + if (src.hasEvent()) + tgt.setEvent(convertType(src.getEvent())); + for (org.hl7.fhir.r4.model.MessageHeader.MessageDestinationComponent t : src.getDestination()) + tgt.addDestination(convertMessageDestinationComponent(t)); + if (src.hasSender()) + tgt.setSender(convertReference(src.getSender())); + if (src.hasEnterer()) + tgt.setEnterer(convertReference(src.getEnterer())); + if (src.hasAuthor()) + tgt.setAuthor(convertReference(src.getAuthor())); + if (src.hasSource()) + tgt.setSource(convertMessageSourceComponent(src.getSource())); + if (src.hasResponsible()) + tgt.setResponsible(convertReference(src.getResponsible())); + if (src.hasReason()) + tgt.setReason(convertCodeableConcept(src.getReason())); + if (src.hasResponse()) + tgt.setResponse(convertMessageHeaderResponseComponent(src.getResponse())); + for (org.hl7.fhir.r4.model.Reference t : src.getFocus()) + tgt.addFocus(convertReference(t)); + if (src.hasDefinition()) + tgt.setDefinitionElement(convertCanonical(src.getDefinitionElement())); + return tgt; + } + + public static org.hl7.fhir.r4.model.MessageHeader convertMessageHeader(org.hl7.fhir.r5.model.MessageHeader src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.MessageHeader tgt = new org.hl7.fhir.r4.model.MessageHeader(); + copyDomainResource(src, tgt); + if (src.hasEvent()) + tgt.setEvent(convertType(src.getEvent())); + for (org.hl7.fhir.r5.model.MessageHeader.MessageDestinationComponent t : src.getDestination()) + tgt.addDestination(convertMessageDestinationComponent(t)); + if (src.hasSender()) + tgt.setSender(convertReference(src.getSender())); + if (src.hasEnterer()) + tgt.setEnterer(convertReference(src.getEnterer())); + if (src.hasAuthor()) + tgt.setAuthor(convertReference(src.getAuthor())); + if (src.hasSource()) + tgt.setSource(convertMessageSourceComponent(src.getSource())); + if (src.hasResponsible()) + tgt.setResponsible(convertReference(src.getResponsible())); + if (src.hasReason()) + tgt.setReason(convertCodeableConcept(src.getReason())); + if (src.hasResponse()) + tgt.setResponse(convertMessageHeaderResponseComponent(src.getResponse())); + for (org.hl7.fhir.r5.model.Reference t : src.getFocus()) + tgt.addFocus(convertReference(t)); + if (src.hasDefinition()) + tgt.setDefinitionElement(convertCanonical(src.getDefinitionElement())); + return tgt; + } + + public static org.hl7.fhir.r5.model.MessageHeader.MessageDestinationComponent convertMessageDestinationComponent(org.hl7.fhir.r4.model.MessageHeader.MessageDestinationComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.MessageHeader.MessageDestinationComponent tgt = new org.hl7.fhir.r5.model.MessageHeader.MessageDestinationComponent(); + copyElement(src, tgt); + if (src.hasName()) + tgt.setNameElement(convertString(src.getNameElement())); + if (src.hasTarget()) + tgt.setTarget(convertReference(src.getTarget())); + if (src.hasEndpoint()) + tgt.setEndpointElement(convertUrl(src.getEndpointElement())); + if (src.hasReceiver()) + tgt.setReceiver(convertReference(src.getReceiver())); + return tgt; + } + + public static org.hl7.fhir.r4.model.MessageHeader.MessageDestinationComponent convertMessageDestinationComponent(org.hl7.fhir.r5.model.MessageHeader.MessageDestinationComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.MessageHeader.MessageDestinationComponent tgt = new org.hl7.fhir.r4.model.MessageHeader.MessageDestinationComponent(); + copyElement(src, tgt); + if (src.hasName()) + tgt.setNameElement(convertString(src.getNameElement())); + if (src.hasTarget()) + tgt.setTarget(convertReference(src.getTarget())); + if (src.hasEndpoint()) + tgt.setEndpointElement(convertUrl(src.getEndpointElement())); + if (src.hasReceiver()) + tgt.setReceiver(convertReference(src.getReceiver())); + return tgt; + } + + public static org.hl7.fhir.r5.model.MessageHeader.MessageSourceComponent convertMessageSourceComponent(org.hl7.fhir.r4.model.MessageHeader.MessageSourceComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.MessageHeader.MessageSourceComponent tgt = new org.hl7.fhir.r5.model.MessageHeader.MessageSourceComponent(); + copyElement(src, tgt); + if (src.hasName()) + tgt.setNameElement(convertString(src.getNameElement())); + if (src.hasSoftware()) + tgt.setSoftwareElement(convertString(src.getSoftwareElement())); + if (src.hasVersion()) + tgt.setVersionElement(convertString(src.getVersionElement())); + if (src.hasContact()) + tgt.setContact(convertContactPoint(src.getContact())); + if (src.hasEndpoint()) + tgt.setEndpointElement(convertUrl(src.getEndpointElement())); + return tgt; + } + + public static org.hl7.fhir.r4.model.MessageHeader.MessageSourceComponent convertMessageSourceComponent(org.hl7.fhir.r5.model.MessageHeader.MessageSourceComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.MessageHeader.MessageSourceComponent tgt = new org.hl7.fhir.r4.model.MessageHeader.MessageSourceComponent(); + copyElement(src, tgt); + if (src.hasName()) + tgt.setNameElement(convertString(src.getNameElement())); + if (src.hasSoftware()) + tgt.setSoftwareElement(convertString(src.getSoftwareElement())); + if (src.hasVersion()) + tgt.setVersionElement(convertString(src.getVersionElement())); + if (src.hasContact()) + tgt.setContact(convertContactPoint(src.getContact())); + if (src.hasEndpoint()) + tgt.setEndpointElement(convertUrl(src.getEndpointElement())); + return tgt; + } + + public static org.hl7.fhir.r5.model.MessageHeader.MessageHeaderResponseComponent convertMessageHeaderResponseComponent(org.hl7.fhir.r4.model.MessageHeader.MessageHeaderResponseComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.MessageHeader.MessageHeaderResponseComponent tgt = new org.hl7.fhir.r5.model.MessageHeader.MessageHeaderResponseComponent(); + copyElement(src, tgt); + if (src.hasIdentifier()) + tgt.setIdentifierElement(convertId(src.getIdentifierElement())); + if (src.hasCode()) + tgt.setCode(convertResponseType(src.getCode())); + if (src.hasDetails()) + tgt.setDetails(convertReference(src.getDetails())); + return tgt; + } + + public static org.hl7.fhir.r4.model.MessageHeader.MessageHeaderResponseComponent convertMessageHeaderResponseComponent(org.hl7.fhir.r5.model.MessageHeader.MessageHeaderResponseComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.MessageHeader.MessageHeaderResponseComponent tgt = new org.hl7.fhir.r4.model.MessageHeader.MessageHeaderResponseComponent(); + copyElement(src, tgt); + if (src.hasIdentifier()) + tgt.setIdentifierElement(convertId(src.getIdentifierElement())); + if (src.hasCode()) + tgt.setCode(convertResponseType(src.getCode())); + if (src.hasDetails()) + tgt.setDetails(convertReference(src.getDetails())); + return tgt; + } + + public static org.hl7.fhir.r5.model.MessageHeader.ResponseType convertResponseType(org.hl7.fhir.r4.model.MessageHeader.ResponseType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case OK: return org.hl7.fhir.r5.model.MessageHeader.ResponseType.OK; + case TRANSIENTERROR: return org.hl7.fhir.r5.model.MessageHeader.ResponseType.TRANSIENTERROR; + case FATALERROR: return org.hl7.fhir.r5.model.MessageHeader.ResponseType.FATALERROR; + default: return org.hl7.fhir.r5.model.MessageHeader.ResponseType.NULL; + } +} + + public static org.hl7.fhir.r4.model.MessageHeader.ResponseType convertResponseType(org.hl7.fhir.r5.model.MessageHeader.ResponseType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case OK: return org.hl7.fhir.r4.model.MessageHeader.ResponseType.OK; + case TRANSIENTERROR: return org.hl7.fhir.r4.model.MessageHeader.ResponseType.TRANSIENTERROR; + case FATALERROR: return org.hl7.fhir.r4.model.MessageHeader.ResponseType.FATALERROR; + default: return org.hl7.fhir.r4.model.MessageHeader.ResponseType.NULL; + } +} + + +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/MolecularSequence.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/MolecularSequence.java new file mode 100644 index 000000000..c70669fef --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/MolecularSequence.java @@ -0,0 +1,569 @@ +package org.hl7.fhir.convertors.conv40_50; + +import org.hl7.fhir.exceptions.FHIRException; + +import org.hl7.fhir.convertors.VersionConvertor_40_50; + + +/* + Copyright (c) 2011+, HL7, Inc. + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of HL7 nor the names of its contributors may be used to + endorse or promote products derived from this software without specific + prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + +*/ + +// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0 + + +public class MolecularSequence extends VersionConvertor_40_50 { + + public static org.hl7.fhir.r5.model.MolecularSequence convertMolecularSequence(org.hl7.fhir.r4.model.MolecularSequence src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.MolecularSequence tgt = new org.hl7.fhir.r5.model.MolecularSequence(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasType()) + tgt.setType(convertSequenceType(src.getType())); + if (src.hasCoordinateSystem()) + tgt.setCoordinateSystemElement(convertInteger(src.getCoordinateSystemElement())); + if (src.hasPatient()) + tgt.setPatient(convertReference(src.getPatient())); + if (src.hasSpecimen()) + tgt.setSpecimen(convertReference(src.getSpecimen())); + if (src.hasDevice()) + tgt.setDevice(convertReference(src.getDevice())); + if (src.hasPerformer()) + tgt.setPerformer(convertReference(src.getPerformer())); + if (src.hasQuantity()) + tgt.setQuantity(convertQuantity(src.getQuantity())); + if (src.hasReferenceSeq()) + tgt.setReferenceSeq(convertMolecularSequenceReferenceSeqComponent(src.getReferenceSeq())); + for (org.hl7.fhir.r4.model.MolecularSequence.MolecularSequenceVariantComponent t : src.getVariant()) + tgt.addVariant(convertMolecularSequenceVariantComponent(t)); + if (src.hasObservedSeq()) + tgt.setObservedSeqElement(convertString(src.getObservedSeqElement())); + for (org.hl7.fhir.r4.model.MolecularSequence.MolecularSequenceQualityComponent t : src.getQuality()) + tgt.addQuality(convertMolecularSequenceQualityComponent(t)); + if (src.hasReadCoverage()) + tgt.setReadCoverageElement(convertInteger(src.getReadCoverageElement())); + for (org.hl7.fhir.r4.model.MolecularSequence.MolecularSequenceRepositoryComponent t : src.getRepository()) + tgt.addRepository(convertMolecularSequenceRepositoryComponent(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getPointer()) + tgt.addPointer(convertReference(t)); + for (org.hl7.fhir.r4.model.MolecularSequence.MolecularSequenceStructureVariantComponent t : src.getStructureVariant()) + tgt.addStructureVariant(convertMolecularSequenceStructureVariantComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.MolecularSequence convertMolecularSequence(org.hl7.fhir.r5.model.MolecularSequence src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.MolecularSequence tgt = new org.hl7.fhir.r4.model.MolecularSequence(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasType()) + tgt.setType(convertSequenceType(src.getType())); + if (src.hasCoordinateSystem()) + tgt.setCoordinateSystemElement(convertInteger(src.getCoordinateSystemElement())); + if (src.hasPatient()) + tgt.setPatient(convertReference(src.getPatient())); + if (src.hasSpecimen()) + tgt.setSpecimen(convertReference(src.getSpecimen())); + if (src.hasDevice()) + tgt.setDevice(convertReference(src.getDevice())); + if (src.hasPerformer()) + tgt.setPerformer(convertReference(src.getPerformer())); + if (src.hasQuantity()) + tgt.setQuantity(convertQuantity(src.getQuantity())); + if (src.hasReferenceSeq()) + tgt.setReferenceSeq(convertMolecularSequenceReferenceSeqComponent(src.getReferenceSeq())); + for (org.hl7.fhir.r5.model.MolecularSequence.MolecularSequenceVariantComponent t : src.getVariant()) + tgt.addVariant(convertMolecularSequenceVariantComponent(t)); + if (src.hasObservedSeq()) + tgt.setObservedSeqElement(convertString(src.getObservedSeqElement())); + for (org.hl7.fhir.r5.model.MolecularSequence.MolecularSequenceQualityComponent t : src.getQuality()) + tgt.addQuality(convertMolecularSequenceQualityComponent(t)); + if (src.hasReadCoverage()) + tgt.setReadCoverageElement(convertInteger(src.getReadCoverageElement())); + for (org.hl7.fhir.r5.model.MolecularSequence.MolecularSequenceRepositoryComponent t : src.getRepository()) + tgt.addRepository(convertMolecularSequenceRepositoryComponent(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getPointer()) + tgt.addPointer(convertReference(t)); + for (org.hl7.fhir.r5.model.MolecularSequence.MolecularSequenceStructureVariantComponent t : src.getStructureVariant()) + tgt.addStructureVariant(convertMolecularSequenceStructureVariantComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.MolecularSequence.SequenceType convertSequenceType(org.hl7.fhir.r4.model.MolecularSequence.SequenceType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case AA: return org.hl7.fhir.r5.model.MolecularSequence.SequenceType.AA; + case DNA: return org.hl7.fhir.r5.model.MolecularSequence.SequenceType.DNA; + case RNA: return org.hl7.fhir.r5.model.MolecularSequence.SequenceType.RNA; + default: return org.hl7.fhir.r5.model.MolecularSequence.SequenceType.NULL; + } +} + + public static org.hl7.fhir.r4.model.MolecularSequence.SequenceType convertSequenceType(org.hl7.fhir.r5.model.MolecularSequence.SequenceType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case AA: return org.hl7.fhir.r4.model.MolecularSequence.SequenceType.AA; + case DNA: return org.hl7.fhir.r4.model.MolecularSequence.SequenceType.DNA; + case RNA: return org.hl7.fhir.r4.model.MolecularSequence.SequenceType.RNA; + default: return org.hl7.fhir.r4.model.MolecularSequence.SequenceType.NULL; + } +} + + public static org.hl7.fhir.r5.model.MolecularSequence.MolecularSequenceReferenceSeqComponent convertMolecularSequenceReferenceSeqComponent(org.hl7.fhir.r4.model.MolecularSequence.MolecularSequenceReferenceSeqComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.MolecularSequence.MolecularSequenceReferenceSeqComponent tgt = new org.hl7.fhir.r5.model.MolecularSequence.MolecularSequenceReferenceSeqComponent(); + copyElement(src, tgt); + if (src.hasChromosome()) + tgt.setChromosome(convertCodeableConcept(src.getChromosome())); + if (src.hasGenomeBuild()) + tgt.setGenomeBuildElement(convertString(src.getGenomeBuildElement())); + if (src.hasOrientation()) + tgt.setOrientation(convertOrientationType(src.getOrientation())); + if (src.hasReferenceSeqId()) + tgt.setReferenceSeqId(convertCodeableConcept(src.getReferenceSeqId())); + if (src.hasReferenceSeqPointer()) + tgt.setReferenceSeqPointer(convertReference(src.getReferenceSeqPointer())); + if (src.hasReferenceSeqString()) + tgt.setReferenceSeqStringElement(convertString(src.getReferenceSeqStringElement())); + if (src.hasStrand()) + tgt.setStrand(convertStrandType(src.getStrand())); + if (src.hasWindowStart()) + tgt.setWindowStartElement(convertInteger(src.getWindowStartElement())); + if (src.hasWindowEnd()) + tgt.setWindowEndElement(convertInteger(src.getWindowEndElement())); + return tgt; + } + + public static org.hl7.fhir.r4.model.MolecularSequence.MolecularSequenceReferenceSeqComponent convertMolecularSequenceReferenceSeqComponent(org.hl7.fhir.r5.model.MolecularSequence.MolecularSequenceReferenceSeqComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.MolecularSequence.MolecularSequenceReferenceSeqComponent tgt = new org.hl7.fhir.r4.model.MolecularSequence.MolecularSequenceReferenceSeqComponent(); + copyElement(src, tgt); + if (src.hasChromosome()) + tgt.setChromosome(convertCodeableConcept(src.getChromosome())); + if (src.hasGenomeBuild()) + tgt.setGenomeBuildElement(convertString(src.getGenomeBuildElement())); + if (src.hasOrientation()) + tgt.setOrientation(convertOrientationType(src.getOrientation())); + if (src.hasReferenceSeqId()) + tgt.setReferenceSeqId(convertCodeableConcept(src.getReferenceSeqId())); + if (src.hasReferenceSeqPointer()) + tgt.setReferenceSeqPointer(convertReference(src.getReferenceSeqPointer())); + if (src.hasReferenceSeqString()) + tgt.setReferenceSeqStringElement(convertString(src.getReferenceSeqStringElement())); + if (src.hasStrand()) + tgt.setStrand(convertStrandType(src.getStrand())); + if (src.hasWindowStart()) + tgt.setWindowStartElement(convertInteger(src.getWindowStartElement())); + if (src.hasWindowEnd()) + tgt.setWindowEndElement(convertInteger(src.getWindowEndElement())); + return tgt; + } + + public static org.hl7.fhir.r5.model.MolecularSequence.OrientationType convertOrientationType(org.hl7.fhir.r4.model.MolecularSequence.OrientationType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case SENSE: return org.hl7.fhir.r5.model.MolecularSequence.OrientationType.SENSE; + case ANTISENSE: return org.hl7.fhir.r5.model.MolecularSequence.OrientationType.ANTISENSE; + default: return org.hl7.fhir.r5.model.MolecularSequence.OrientationType.NULL; + } +} + + public static org.hl7.fhir.r4.model.MolecularSequence.OrientationType convertOrientationType(org.hl7.fhir.r5.model.MolecularSequence.OrientationType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case SENSE: return org.hl7.fhir.r4.model.MolecularSequence.OrientationType.SENSE; + case ANTISENSE: return org.hl7.fhir.r4.model.MolecularSequence.OrientationType.ANTISENSE; + default: return org.hl7.fhir.r4.model.MolecularSequence.OrientationType.NULL; + } +} + + public static org.hl7.fhir.r5.model.MolecularSequence.StrandType convertStrandType(org.hl7.fhir.r4.model.MolecularSequence.StrandType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case WATSON: return org.hl7.fhir.r5.model.MolecularSequence.StrandType.WATSON; + case CRICK: return org.hl7.fhir.r5.model.MolecularSequence.StrandType.CRICK; + default: return org.hl7.fhir.r5.model.MolecularSequence.StrandType.NULL; + } +} + + public static org.hl7.fhir.r4.model.MolecularSequence.StrandType convertStrandType(org.hl7.fhir.r5.model.MolecularSequence.StrandType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case WATSON: return org.hl7.fhir.r4.model.MolecularSequence.StrandType.WATSON; + case CRICK: return org.hl7.fhir.r4.model.MolecularSequence.StrandType.CRICK; + default: return org.hl7.fhir.r4.model.MolecularSequence.StrandType.NULL; + } +} + + public static org.hl7.fhir.r5.model.MolecularSequence.MolecularSequenceVariantComponent convertMolecularSequenceVariantComponent(org.hl7.fhir.r4.model.MolecularSequence.MolecularSequenceVariantComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.MolecularSequence.MolecularSequenceVariantComponent tgt = new org.hl7.fhir.r5.model.MolecularSequence.MolecularSequenceVariantComponent(); + copyElement(src, tgt); + if (src.hasStart()) + tgt.setStartElement(convertInteger(src.getStartElement())); + if (src.hasEnd()) + tgt.setEndElement(convertInteger(src.getEndElement())); + if (src.hasObservedAllele()) + tgt.setObservedAlleleElement(convertString(src.getObservedAlleleElement())); + if (src.hasReferenceAllele()) + tgt.setReferenceAlleleElement(convertString(src.getReferenceAlleleElement())); + if (src.hasCigar()) + tgt.setCigarElement(convertString(src.getCigarElement())); + if (src.hasVariantPointer()) + tgt.setVariantPointer(convertReference(src.getVariantPointer())); + return tgt; + } + + public static org.hl7.fhir.r4.model.MolecularSequence.MolecularSequenceVariantComponent convertMolecularSequenceVariantComponent(org.hl7.fhir.r5.model.MolecularSequence.MolecularSequenceVariantComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.MolecularSequence.MolecularSequenceVariantComponent tgt = new org.hl7.fhir.r4.model.MolecularSequence.MolecularSequenceVariantComponent(); + copyElement(src, tgt); + if (src.hasStart()) + tgt.setStartElement(convertInteger(src.getStartElement())); + if (src.hasEnd()) + tgt.setEndElement(convertInteger(src.getEndElement())); + if (src.hasObservedAllele()) + tgt.setObservedAlleleElement(convertString(src.getObservedAlleleElement())); + if (src.hasReferenceAllele()) + tgt.setReferenceAlleleElement(convertString(src.getReferenceAlleleElement())); + if (src.hasCigar()) + tgt.setCigarElement(convertString(src.getCigarElement())); + if (src.hasVariantPointer()) + tgt.setVariantPointer(convertReference(src.getVariantPointer())); + return tgt; + } + + public static org.hl7.fhir.r5.model.MolecularSequence.MolecularSequenceQualityComponent convertMolecularSequenceQualityComponent(org.hl7.fhir.r4.model.MolecularSequence.MolecularSequenceQualityComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.MolecularSequence.MolecularSequenceQualityComponent tgt = new org.hl7.fhir.r5.model.MolecularSequence.MolecularSequenceQualityComponent(); + copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertQualityType(src.getType())); + if (src.hasStandardSequence()) + tgt.setStandardSequence(convertCodeableConcept(src.getStandardSequence())); + if (src.hasStart()) + tgt.setStartElement(convertInteger(src.getStartElement())); + if (src.hasEnd()) + tgt.setEndElement(convertInteger(src.getEndElement())); + if (src.hasScore()) + tgt.setScore(convertQuantity(src.getScore())); + if (src.hasMethod()) + tgt.setMethod(convertCodeableConcept(src.getMethod())); + if (src.hasTruthTP()) + tgt.setTruthTPElement(convertDecimal(src.getTruthTPElement())); + if (src.hasQueryTP()) + tgt.setQueryTPElement(convertDecimal(src.getQueryTPElement())); + if (src.hasTruthFN()) + tgt.setTruthFNElement(convertDecimal(src.getTruthFNElement())); + if (src.hasQueryFP()) + tgt.setQueryFPElement(convertDecimal(src.getQueryFPElement())); + if (src.hasGtFP()) + tgt.setGtFPElement(convertDecimal(src.getGtFPElement())); + if (src.hasPrecision()) + tgt.setPrecisionElement(convertDecimal(src.getPrecisionElement())); + if (src.hasRecall()) + tgt.setRecallElement(convertDecimal(src.getRecallElement())); + if (src.hasFScore()) + tgt.setFScoreElement(convertDecimal(src.getFScoreElement())); + if (src.hasRoc()) + tgt.setRoc(convertMolecularSequenceQualityRocComponent(src.getRoc())); + return tgt; + } + + public static org.hl7.fhir.r4.model.MolecularSequence.MolecularSequenceQualityComponent convertMolecularSequenceQualityComponent(org.hl7.fhir.r5.model.MolecularSequence.MolecularSequenceQualityComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.MolecularSequence.MolecularSequenceQualityComponent tgt = new org.hl7.fhir.r4.model.MolecularSequence.MolecularSequenceQualityComponent(); + copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertQualityType(src.getType())); + if (src.hasStandardSequence()) + tgt.setStandardSequence(convertCodeableConcept(src.getStandardSequence())); + if (src.hasStart()) + tgt.setStartElement(convertInteger(src.getStartElement())); + if (src.hasEnd()) + tgt.setEndElement(convertInteger(src.getEndElement())); + if (src.hasScore()) + tgt.setScore(convertQuantity(src.getScore())); + if (src.hasMethod()) + tgt.setMethod(convertCodeableConcept(src.getMethod())); + if (src.hasTruthTP()) + tgt.setTruthTPElement(convertDecimal(src.getTruthTPElement())); + if (src.hasQueryTP()) + tgt.setQueryTPElement(convertDecimal(src.getQueryTPElement())); + if (src.hasTruthFN()) + tgt.setTruthFNElement(convertDecimal(src.getTruthFNElement())); + if (src.hasQueryFP()) + tgt.setQueryFPElement(convertDecimal(src.getQueryFPElement())); + if (src.hasGtFP()) + tgt.setGtFPElement(convertDecimal(src.getGtFPElement())); + if (src.hasPrecision()) + tgt.setPrecisionElement(convertDecimal(src.getPrecisionElement())); + if (src.hasRecall()) + tgt.setRecallElement(convertDecimal(src.getRecallElement())); + if (src.hasFScore()) + tgt.setFScoreElement(convertDecimal(src.getFScoreElement())); + if (src.hasRoc()) + tgt.setRoc(convertMolecularSequenceQualityRocComponent(src.getRoc())); + return tgt; + } + + public static org.hl7.fhir.r5.model.MolecularSequence.QualityType convertQualityType(org.hl7.fhir.r4.model.MolecularSequence.QualityType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case INDEL: return org.hl7.fhir.r5.model.MolecularSequence.QualityType.INDEL; + case SNP: return org.hl7.fhir.r5.model.MolecularSequence.QualityType.SNP; + case UNKNOWN: return org.hl7.fhir.r5.model.MolecularSequence.QualityType.UNKNOWN; + default: return org.hl7.fhir.r5.model.MolecularSequence.QualityType.NULL; + } +} + + public static org.hl7.fhir.r4.model.MolecularSequence.QualityType convertQualityType(org.hl7.fhir.r5.model.MolecularSequence.QualityType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case INDEL: return org.hl7.fhir.r4.model.MolecularSequence.QualityType.INDEL; + case SNP: return org.hl7.fhir.r4.model.MolecularSequence.QualityType.SNP; + case UNKNOWN: return org.hl7.fhir.r4.model.MolecularSequence.QualityType.UNKNOWN; + default: return org.hl7.fhir.r4.model.MolecularSequence.QualityType.NULL; + } +} + + public static org.hl7.fhir.r5.model.MolecularSequence.MolecularSequenceQualityRocComponent convertMolecularSequenceQualityRocComponent(org.hl7.fhir.r4.model.MolecularSequence.MolecularSequenceQualityRocComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.MolecularSequence.MolecularSequenceQualityRocComponent tgt = new org.hl7.fhir.r5.model.MolecularSequence.MolecularSequenceQualityRocComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.r4.model.IntegerType t : src.getScore()) + tgt.getScore().add(convertInteger(t)); + for (org.hl7.fhir.r4.model.IntegerType t : src.getNumTP()) + tgt.getNumTP().add(convertInteger(t)); + for (org.hl7.fhir.r4.model.IntegerType t : src.getNumFP()) + tgt.getNumFP().add(convertInteger(t)); + for (org.hl7.fhir.r4.model.IntegerType t : src.getNumFN()) + tgt.getNumFN().add(convertInteger(t)); + for (org.hl7.fhir.r4.model.DecimalType t : src.getPrecision()) + tgt.getPrecision().add(convertDecimal(t)); + for (org.hl7.fhir.r4.model.DecimalType t : src.getSensitivity()) + tgt.getSensitivity().add(convertDecimal(t)); + for (org.hl7.fhir.r4.model.DecimalType t : src.getFMeasure()) + tgt.getFMeasure().add(convertDecimal(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.MolecularSequence.MolecularSequenceQualityRocComponent convertMolecularSequenceQualityRocComponent(org.hl7.fhir.r5.model.MolecularSequence.MolecularSequenceQualityRocComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.MolecularSequence.MolecularSequenceQualityRocComponent tgt = new org.hl7.fhir.r4.model.MolecularSequence.MolecularSequenceQualityRocComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.r5.model.IntegerType t : src.getScore()) + tgt.getScore().add(convertInteger(t)); + for (org.hl7.fhir.r5.model.IntegerType t : src.getNumTP()) + tgt.getNumTP().add(convertInteger(t)); + for (org.hl7.fhir.r5.model.IntegerType t : src.getNumFP()) + tgt.getNumFP().add(convertInteger(t)); + for (org.hl7.fhir.r5.model.IntegerType t : src.getNumFN()) + tgt.getNumFN().add(convertInteger(t)); + for (org.hl7.fhir.r5.model.DecimalType t : src.getPrecision()) + tgt.getPrecision().add(convertDecimal(t)); + for (org.hl7.fhir.r5.model.DecimalType t : src.getSensitivity()) + tgt.getSensitivity().add(convertDecimal(t)); + for (org.hl7.fhir.r5.model.DecimalType t : src.getFMeasure()) + tgt.getFMeasure().add(convertDecimal(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.MolecularSequence.MolecularSequenceRepositoryComponent convertMolecularSequenceRepositoryComponent(org.hl7.fhir.r4.model.MolecularSequence.MolecularSequenceRepositoryComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.MolecularSequence.MolecularSequenceRepositoryComponent tgt = new org.hl7.fhir.r5.model.MolecularSequence.MolecularSequenceRepositoryComponent(); + copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertRepositoryType(src.getType())); + if (src.hasUrl()) + tgt.setUrlElement(convertUri(src.getUrlElement())); + if (src.hasName()) + tgt.setNameElement(convertString(src.getNameElement())); + if (src.hasDatasetId()) + tgt.setDatasetIdElement(convertString(src.getDatasetIdElement())); + if (src.hasVariantsetId()) + tgt.setVariantsetIdElement(convertString(src.getVariantsetIdElement())); + if (src.hasReadsetId()) + tgt.setReadsetIdElement(convertString(src.getReadsetIdElement())); + return tgt; + } + + public static org.hl7.fhir.r4.model.MolecularSequence.MolecularSequenceRepositoryComponent convertMolecularSequenceRepositoryComponent(org.hl7.fhir.r5.model.MolecularSequence.MolecularSequenceRepositoryComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.MolecularSequence.MolecularSequenceRepositoryComponent tgt = new org.hl7.fhir.r4.model.MolecularSequence.MolecularSequenceRepositoryComponent(); + copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertRepositoryType(src.getType())); + if (src.hasUrl()) + tgt.setUrlElement(convertUri(src.getUrlElement())); + if (src.hasName()) + tgt.setNameElement(convertString(src.getNameElement())); + if (src.hasDatasetId()) + tgt.setDatasetIdElement(convertString(src.getDatasetIdElement())); + if (src.hasVariantsetId()) + tgt.setVariantsetIdElement(convertString(src.getVariantsetIdElement())); + if (src.hasReadsetId()) + tgt.setReadsetIdElement(convertString(src.getReadsetIdElement())); + return tgt; + } + + public static org.hl7.fhir.r5.model.MolecularSequence.RepositoryType convertRepositoryType(org.hl7.fhir.r4.model.MolecularSequence.RepositoryType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case DIRECTLINK: return org.hl7.fhir.r5.model.MolecularSequence.RepositoryType.DIRECTLINK; + case OPENAPI: return org.hl7.fhir.r5.model.MolecularSequence.RepositoryType.OPENAPI; + case LOGIN: return org.hl7.fhir.r5.model.MolecularSequence.RepositoryType.LOGIN; + case OAUTH: return org.hl7.fhir.r5.model.MolecularSequence.RepositoryType.OAUTH; + case OTHER: return org.hl7.fhir.r5.model.MolecularSequence.RepositoryType.OTHER; + default: return org.hl7.fhir.r5.model.MolecularSequence.RepositoryType.NULL; + } +} + + public static org.hl7.fhir.r4.model.MolecularSequence.RepositoryType convertRepositoryType(org.hl7.fhir.r5.model.MolecularSequence.RepositoryType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case DIRECTLINK: return org.hl7.fhir.r4.model.MolecularSequence.RepositoryType.DIRECTLINK; + case OPENAPI: return org.hl7.fhir.r4.model.MolecularSequence.RepositoryType.OPENAPI; + case LOGIN: return org.hl7.fhir.r4.model.MolecularSequence.RepositoryType.LOGIN; + case OAUTH: return org.hl7.fhir.r4.model.MolecularSequence.RepositoryType.OAUTH; + case OTHER: return org.hl7.fhir.r4.model.MolecularSequence.RepositoryType.OTHER; + default: return org.hl7.fhir.r4.model.MolecularSequence.RepositoryType.NULL; + } +} + + public static org.hl7.fhir.r5.model.MolecularSequence.MolecularSequenceStructureVariantComponent convertMolecularSequenceStructureVariantComponent(org.hl7.fhir.r4.model.MolecularSequence.MolecularSequenceStructureVariantComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.MolecularSequence.MolecularSequenceStructureVariantComponent tgt = new org.hl7.fhir.r5.model.MolecularSequence.MolecularSequenceStructureVariantComponent(); + copyElement(src, tgt); + if (src.hasVariantType()) + tgt.setVariantType(convertCodeableConcept(src.getVariantType())); + if (src.hasExact()) + tgt.setExactElement(convertBoolean(src.getExactElement())); + if (src.hasLength()) + tgt.setLengthElement(convertInteger(src.getLengthElement())); + if (src.hasOuter()) + tgt.setOuter(convertMolecularSequenceStructureVariantOuterComponent(src.getOuter())); + if (src.hasInner()) + tgt.setInner(convertMolecularSequenceStructureVariantInnerComponent(src.getInner())); + return tgt; + } + + public static org.hl7.fhir.r4.model.MolecularSequence.MolecularSequenceStructureVariantComponent convertMolecularSequenceStructureVariantComponent(org.hl7.fhir.r5.model.MolecularSequence.MolecularSequenceStructureVariantComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.MolecularSequence.MolecularSequenceStructureVariantComponent tgt = new org.hl7.fhir.r4.model.MolecularSequence.MolecularSequenceStructureVariantComponent(); + copyElement(src, tgt); + if (src.hasVariantType()) + tgt.setVariantType(convertCodeableConcept(src.getVariantType())); + if (src.hasExact()) + tgt.setExactElement(convertBoolean(src.getExactElement())); + if (src.hasLength()) + tgt.setLengthElement(convertInteger(src.getLengthElement())); + if (src.hasOuter()) + tgt.setOuter(convertMolecularSequenceStructureVariantOuterComponent(src.getOuter())); + if (src.hasInner()) + tgt.setInner(convertMolecularSequenceStructureVariantInnerComponent(src.getInner())); + return tgt; + } + + public static org.hl7.fhir.r5.model.MolecularSequence.MolecularSequenceStructureVariantOuterComponent convertMolecularSequenceStructureVariantOuterComponent(org.hl7.fhir.r4.model.MolecularSequence.MolecularSequenceStructureVariantOuterComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.MolecularSequence.MolecularSequenceStructureVariantOuterComponent tgt = new org.hl7.fhir.r5.model.MolecularSequence.MolecularSequenceStructureVariantOuterComponent(); + copyElement(src, tgt); + if (src.hasStart()) + tgt.setStartElement(convertInteger(src.getStartElement())); + if (src.hasEnd()) + tgt.setEndElement(convertInteger(src.getEndElement())); + return tgt; + } + + public static org.hl7.fhir.r4.model.MolecularSequence.MolecularSequenceStructureVariantOuterComponent convertMolecularSequenceStructureVariantOuterComponent(org.hl7.fhir.r5.model.MolecularSequence.MolecularSequenceStructureVariantOuterComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.MolecularSequence.MolecularSequenceStructureVariantOuterComponent tgt = new org.hl7.fhir.r4.model.MolecularSequence.MolecularSequenceStructureVariantOuterComponent(); + copyElement(src, tgt); + if (src.hasStart()) + tgt.setStartElement(convertInteger(src.getStartElement())); + if (src.hasEnd()) + tgt.setEndElement(convertInteger(src.getEndElement())); + return tgt; + } + + public static org.hl7.fhir.r5.model.MolecularSequence.MolecularSequenceStructureVariantInnerComponent convertMolecularSequenceStructureVariantInnerComponent(org.hl7.fhir.r4.model.MolecularSequence.MolecularSequenceStructureVariantInnerComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.MolecularSequence.MolecularSequenceStructureVariantInnerComponent tgt = new org.hl7.fhir.r5.model.MolecularSequence.MolecularSequenceStructureVariantInnerComponent(); + copyElement(src, tgt); + if (src.hasStart()) + tgt.setStartElement(convertInteger(src.getStartElement())); + if (src.hasEnd()) + tgt.setEndElement(convertInteger(src.getEndElement())); + return tgt; + } + + public static org.hl7.fhir.r4.model.MolecularSequence.MolecularSequenceStructureVariantInnerComponent convertMolecularSequenceStructureVariantInnerComponent(org.hl7.fhir.r5.model.MolecularSequence.MolecularSequenceStructureVariantInnerComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.MolecularSequence.MolecularSequenceStructureVariantInnerComponent tgt = new org.hl7.fhir.r4.model.MolecularSequence.MolecularSequenceStructureVariantInnerComponent(); + copyElement(src, tgt); + if (src.hasStart()) + tgt.setStartElement(convertInteger(src.getStartElement())); + if (src.hasEnd()) + tgt.setEndElement(convertInteger(src.getEndElement())); + return tgt; + } + + +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/NamingSystem.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/NamingSystem.java new file mode 100644 index 000000000..4caf5bbb4 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/NamingSystem.java @@ -0,0 +1,193 @@ +package org.hl7.fhir.convertors.conv40_50; + +import org.hl7.fhir.exceptions.FHIRException; + +import org.hl7.fhir.convertors.VersionConvertor_40_50; + + +/* + Copyright (c) 2011+, HL7, Inc. + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of HL7 nor the names of its contributors may be used to + endorse or promote products derived from this software without specific + prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + +*/ + +// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0 + + +public class NamingSystem extends VersionConvertor_40_50 { + + public static org.hl7.fhir.r5.model.NamingSystem convertNamingSystem(org.hl7.fhir.r4.model.NamingSystem src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.NamingSystem tgt = new org.hl7.fhir.r5.model.NamingSystem(); + copyDomainResource(src, tgt); + if (src.hasName()) + tgt.setNameElement(convertString(src.getNameElement())); + if (src.hasStatus()) + tgt.setStatus(Enumerations.convertPublicationStatus(src.getStatus())); + if (src.hasKind()) + tgt.setKind(convertNamingSystemType(src.getKind())); + if (src.hasDate()) + tgt.setDateElement(convertDateTime(src.getDateElement())); + if (src.hasPublisher()) + tgt.setPublisherElement(convertString(src.getPublisherElement())); + for (org.hl7.fhir.r4.model.ContactDetail t : src.getContact()) + tgt.addContact(convertContactDetail(t)); + if (src.hasResponsible()) + tgt.setResponsibleElement(convertString(src.getResponsibleElement())); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + if (src.hasDescription()) + tgt.setDescriptionElement(convertMarkdown(src.getDescriptionElement())); + for (org.hl7.fhir.r4.model.UsageContext t : src.getUseContext()) + tgt.addUseContext(convertUsageContext(t)); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getJurisdiction()) + tgt.addJurisdiction(convertCodeableConcept(t)); + if (src.hasUsage()) + tgt.setUsageElement(convertString(src.getUsageElement())); + for (org.hl7.fhir.r4.model.NamingSystem.NamingSystemUniqueIdComponent t : src.getUniqueId()) + tgt.addUniqueId(convertNamingSystemUniqueIdComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.NamingSystem convertNamingSystem(org.hl7.fhir.r5.model.NamingSystem src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.NamingSystem tgt = new org.hl7.fhir.r4.model.NamingSystem(); + copyDomainResource(src, tgt); + if (src.hasName()) + tgt.setNameElement(convertString(src.getNameElement())); + if (src.hasStatus()) + tgt.setStatus(Enumerations.convertPublicationStatus(src.getStatus())); + if (src.hasKind()) + tgt.setKind(convertNamingSystemType(src.getKind())); + if (src.hasDate()) + tgt.setDateElement(convertDateTime(src.getDateElement())); + if (src.hasPublisher()) + tgt.setPublisherElement(convertString(src.getPublisherElement())); + for (org.hl7.fhir.r5.model.ContactDetail t : src.getContact()) + tgt.addContact(convertContactDetail(t)); + if (src.hasResponsible()) + tgt.setResponsibleElement(convertString(src.getResponsibleElement())); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + if (src.hasDescription()) + tgt.setDescriptionElement(convertMarkdown(src.getDescriptionElement())); + for (org.hl7.fhir.r5.model.UsageContext t : src.getUseContext()) + tgt.addUseContext(convertUsageContext(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getJurisdiction()) + tgt.addJurisdiction(convertCodeableConcept(t)); + if (src.hasUsage()) + tgt.setUsageElement(convertString(src.getUsageElement())); + for (org.hl7.fhir.r5.model.NamingSystem.NamingSystemUniqueIdComponent t : src.getUniqueId()) + tgt.addUniqueId(convertNamingSystemUniqueIdComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.NamingSystem.NamingSystemType convertNamingSystemType(org.hl7.fhir.r4.model.NamingSystem.NamingSystemType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case CODESYSTEM: return org.hl7.fhir.r5.model.NamingSystem.NamingSystemType.CODESYSTEM; + case IDENTIFIER: return org.hl7.fhir.r5.model.NamingSystem.NamingSystemType.IDENTIFIER; + case ROOT: return org.hl7.fhir.r5.model.NamingSystem.NamingSystemType.ROOT; + default: return org.hl7.fhir.r5.model.NamingSystem.NamingSystemType.NULL; + } +} + + public static org.hl7.fhir.r4.model.NamingSystem.NamingSystemType convertNamingSystemType(org.hl7.fhir.r5.model.NamingSystem.NamingSystemType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case CODESYSTEM: return org.hl7.fhir.r4.model.NamingSystem.NamingSystemType.CODESYSTEM; + case IDENTIFIER: return org.hl7.fhir.r4.model.NamingSystem.NamingSystemType.IDENTIFIER; + case ROOT: return org.hl7.fhir.r4.model.NamingSystem.NamingSystemType.ROOT; + default: return org.hl7.fhir.r4.model.NamingSystem.NamingSystemType.NULL; + } +} + + public static org.hl7.fhir.r5.model.NamingSystem.NamingSystemUniqueIdComponent convertNamingSystemUniqueIdComponent(org.hl7.fhir.r4.model.NamingSystem.NamingSystemUniqueIdComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.NamingSystem.NamingSystemUniqueIdComponent tgt = new org.hl7.fhir.r5.model.NamingSystem.NamingSystemUniqueIdComponent(); + copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertNamingSystemIdentifierType(src.getType())); + if (src.hasValue()) + tgt.setValueElement(convertString(src.getValueElement())); + if (src.hasPreferred()) + tgt.setPreferredElement(convertBoolean(src.getPreferredElement())); + if (src.hasComment()) + tgt.setCommentElement(convertString(src.getCommentElement())); + if (src.hasPeriod()) + tgt.setPeriod(convertPeriod(src.getPeriod())); + return tgt; + } + + public static org.hl7.fhir.r4.model.NamingSystem.NamingSystemUniqueIdComponent convertNamingSystemUniqueIdComponent(org.hl7.fhir.r5.model.NamingSystem.NamingSystemUniqueIdComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.NamingSystem.NamingSystemUniqueIdComponent tgt = new org.hl7.fhir.r4.model.NamingSystem.NamingSystemUniqueIdComponent(); + copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertNamingSystemIdentifierType(src.getType())); + if (src.hasValue()) + tgt.setValueElement(convertString(src.getValueElement())); + if (src.hasPreferred()) + tgt.setPreferredElement(convertBoolean(src.getPreferredElement())); + if (src.hasComment()) + tgt.setCommentElement(convertString(src.getCommentElement())); + if (src.hasPeriod()) + tgt.setPeriod(convertPeriod(src.getPeriod())); + return tgt; + } + + public static org.hl7.fhir.r5.model.NamingSystem.NamingSystemIdentifierType convertNamingSystemIdentifierType(org.hl7.fhir.r4.model.NamingSystem.NamingSystemIdentifierType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case OID: return org.hl7.fhir.r5.model.NamingSystem.NamingSystemIdentifierType.OID; + case UUID: return org.hl7.fhir.r5.model.NamingSystem.NamingSystemIdentifierType.UUID; + case URI: return org.hl7.fhir.r5.model.NamingSystem.NamingSystemIdentifierType.URI; + case OTHER: return org.hl7.fhir.r5.model.NamingSystem.NamingSystemIdentifierType.OTHER; + default: return org.hl7.fhir.r5.model.NamingSystem.NamingSystemIdentifierType.NULL; + } +} + + public static org.hl7.fhir.r4.model.NamingSystem.NamingSystemIdentifierType convertNamingSystemIdentifierType(org.hl7.fhir.r5.model.NamingSystem.NamingSystemIdentifierType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case OID: return org.hl7.fhir.r4.model.NamingSystem.NamingSystemIdentifierType.OID; + case UUID: return org.hl7.fhir.r4.model.NamingSystem.NamingSystemIdentifierType.UUID; + case URI: return org.hl7.fhir.r4.model.NamingSystem.NamingSystemIdentifierType.URI; + case OTHER: return org.hl7.fhir.r4.model.NamingSystem.NamingSystemIdentifierType.OTHER; + default: return org.hl7.fhir.r4.model.NamingSystem.NamingSystemIdentifierType.NULL; + } +} + + +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/NutritionOrder.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/NutritionOrder.java new file mode 100644 index 000000000..17a6d7c33 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/NutritionOrder.java @@ -0,0 +1,395 @@ +package org.hl7.fhir.convertors.conv40_50; + +import org.hl7.fhir.exceptions.FHIRException; + +import org.hl7.fhir.convertors.VersionConvertor_40_50; + + +/* + Copyright (c) 2011+, HL7, Inc. + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of HL7 nor the names of its contributors may be used to + endorse or promote products derived from this software without specific + prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + +*/ + +// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0 + + +public class NutritionOrder extends VersionConvertor_40_50 { + + public static org.hl7.fhir.r5.model.NutritionOrder convertNutritionOrder(org.hl7.fhir.r4.model.NutritionOrder src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.NutritionOrder tgt = new org.hl7.fhir.r5.model.NutritionOrder(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + for (org.hl7.fhir.r4.model.CanonicalType t : src.getInstantiatesCanonical()) + tgt.getInstantiatesCanonical().add(convertCanonical(t)); + for (org.hl7.fhir.r4.model.UriType t : src.getInstantiatesUri()) + tgt.getInstantiatesUri().add(convertUri(t)); + for (org.hl7.fhir.r4.model.UriType t : src.getInstantiates()) + tgt.getInstantiates().add(convertUri(t)); + if (src.hasStatus()) + tgt.setStatus(convertNutritionOrderStatus(src.getStatus())); + if (src.hasIntent()) + tgt.setIntent(convertNutritiionOrderIntent(src.getIntent())); + if (src.hasPatient()) + tgt.setPatient(convertReference(src.getPatient())); + if (src.hasEncounter()) + tgt.setEncounter(convertReference(src.getEncounter())); + if (src.hasDateTime()) + tgt.setDateTimeElement(convertDateTime(src.getDateTimeElement())); + if (src.hasOrderer()) + tgt.setOrderer(convertReference(src.getOrderer())); + for (org.hl7.fhir.r4.model.Reference t : src.getAllergyIntolerance()) + tgt.addAllergyIntolerance(convertReference(t)); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getFoodPreferenceModifier()) + tgt.addFoodPreferenceModifier(convertCodeableConcept(t)); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getExcludeFoodModifier()) + tgt.addExcludeFoodModifier(convertCodeableConcept(t)); + if (src.hasOralDiet()) + tgt.setOralDiet(convertNutritionOrderOralDietComponent(src.getOralDiet())); + for (org.hl7.fhir.r4.model.NutritionOrder.NutritionOrderSupplementComponent t : src.getSupplement()) + tgt.addSupplement(convertNutritionOrderSupplementComponent(t)); + if (src.hasEnteralFormula()) + tgt.setEnteralFormula(convertNutritionOrderEnteralFormulaComponent(src.getEnteralFormula())); + for (org.hl7.fhir.r4.model.Annotation t : src.getNote()) + tgt.addNote(convertAnnotation(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.NutritionOrder convertNutritionOrder(org.hl7.fhir.r5.model.NutritionOrder src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.NutritionOrder tgt = new org.hl7.fhir.r4.model.NutritionOrder(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + for (org.hl7.fhir.r5.model.CanonicalType t : src.getInstantiatesCanonical()) + tgt.getInstantiatesCanonical().add(convertCanonical(t)); + for (org.hl7.fhir.r5.model.UriType t : src.getInstantiatesUri()) + tgt.getInstantiatesUri().add(convertUri(t)); + for (org.hl7.fhir.r5.model.UriType t : src.getInstantiates()) + tgt.getInstantiates().add(convertUri(t)); + if (src.hasStatus()) + tgt.setStatus(convertNutritionOrderStatus(src.getStatus())); + if (src.hasIntent()) + tgt.setIntent(convertNutritiionOrderIntent(src.getIntent())); + if (src.hasPatient()) + tgt.setPatient(convertReference(src.getPatient())); + if (src.hasEncounter()) + tgt.setEncounter(convertReference(src.getEncounter())); + if (src.hasDateTime()) + tgt.setDateTimeElement(convertDateTime(src.getDateTimeElement())); + if (src.hasOrderer()) + tgt.setOrderer(convertReference(src.getOrderer())); + for (org.hl7.fhir.r5.model.Reference t : src.getAllergyIntolerance()) + tgt.addAllergyIntolerance(convertReference(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getFoodPreferenceModifier()) + tgt.addFoodPreferenceModifier(convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getExcludeFoodModifier()) + tgt.addExcludeFoodModifier(convertCodeableConcept(t)); + if (src.hasOralDiet()) + tgt.setOralDiet(convertNutritionOrderOralDietComponent(src.getOralDiet())); + for (org.hl7.fhir.r5.model.NutritionOrder.NutritionOrderSupplementComponent t : src.getSupplement()) + tgt.addSupplement(convertNutritionOrderSupplementComponent(t)); + if (src.hasEnteralFormula()) + tgt.setEnteralFormula(convertNutritionOrderEnteralFormulaComponent(src.getEnteralFormula())); + for (org.hl7.fhir.r5.model.Annotation t : src.getNote()) + tgt.addNote(convertAnnotation(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.NutritionOrder.NutritionOrderStatus convertNutritionOrderStatus(org.hl7.fhir.r4.model.NutritionOrder.NutritionOrderStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case DRAFT: return org.hl7.fhir.r5.model.NutritionOrder.NutritionOrderStatus.DRAFT; + case ACTIVE: return org.hl7.fhir.r5.model.NutritionOrder.NutritionOrderStatus.ACTIVE; + case ONHOLD: return org.hl7.fhir.r5.model.NutritionOrder.NutritionOrderStatus.ONHOLD; + case REVOKED: return org.hl7.fhir.r5.model.NutritionOrder.NutritionOrderStatus.REVOKED; + case COMPLETED: return org.hl7.fhir.r5.model.NutritionOrder.NutritionOrderStatus.COMPLETED; + case ENTEREDINERROR: return org.hl7.fhir.r5.model.NutritionOrder.NutritionOrderStatus.ENTEREDINERROR; + case UNKNOWN: return org.hl7.fhir.r5.model.NutritionOrder.NutritionOrderStatus.UNKNOWN; + default: return org.hl7.fhir.r5.model.NutritionOrder.NutritionOrderStatus.NULL; + } +} + + public static org.hl7.fhir.r4.model.NutritionOrder.NutritionOrderStatus convertNutritionOrderStatus(org.hl7.fhir.r5.model.NutritionOrder.NutritionOrderStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case DRAFT: return org.hl7.fhir.r4.model.NutritionOrder.NutritionOrderStatus.DRAFT; + case ACTIVE: return org.hl7.fhir.r4.model.NutritionOrder.NutritionOrderStatus.ACTIVE; + case ONHOLD: return org.hl7.fhir.r4.model.NutritionOrder.NutritionOrderStatus.ONHOLD; + case REVOKED: return org.hl7.fhir.r4.model.NutritionOrder.NutritionOrderStatus.REVOKED; + case COMPLETED: return org.hl7.fhir.r4.model.NutritionOrder.NutritionOrderStatus.COMPLETED; + case ENTEREDINERROR: return org.hl7.fhir.r4.model.NutritionOrder.NutritionOrderStatus.ENTEREDINERROR; + case UNKNOWN: return org.hl7.fhir.r4.model.NutritionOrder.NutritionOrderStatus.UNKNOWN; + default: return org.hl7.fhir.r4.model.NutritionOrder.NutritionOrderStatus.NULL; + } +} + + public static org.hl7.fhir.r5.model.NutritionOrder.NutritiionOrderIntent convertNutritiionOrderIntent(org.hl7.fhir.r4.model.NutritionOrder.NutritiionOrderIntent src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PROPOSAL: return org.hl7.fhir.r5.model.NutritionOrder.NutritiionOrderIntent.PROPOSAL; + case PLAN: return org.hl7.fhir.r5.model.NutritionOrder.NutritiionOrderIntent.PLAN; + case DIRECTIVE: return org.hl7.fhir.r5.model.NutritionOrder.NutritiionOrderIntent.DIRECTIVE; + case ORDER: return org.hl7.fhir.r5.model.NutritionOrder.NutritiionOrderIntent.ORDER; + case ORIGINALORDER: return org.hl7.fhir.r5.model.NutritionOrder.NutritiionOrderIntent.ORIGINALORDER; + case REFLEXORDER: return org.hl7.fhir.r5.model.NutritionOrder.NutritiionOrderIntent.REFLEXORDER; + case FILLERORDER: return org.hl7.fhir.r5.model.NutritionOrder.NutritiionOrderIntent.FILLERORDER; + case INSTANCEORDER: return org.hl7.fhir.r5.model.NutritionOrder.NutritiionOrderIntent.INSTANCEORDER; + case OPTION: return org.hl7.fhir.r5.model.NutritionOrder.NutritiionOrderIntent.OPTION; + default: return org.hl7.fhir.r5.model.NutritionOrder.NutritiionOrderIntent.NULL; + } +} + + public static org.hl7.fhir.r4.model.NutritionOrder.NutritiionOrderIntent convertNutritiionOrderIntent(org.hl7.fhir.r5.model.NutritionOrder.NutritiionOrderIntent src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PROPOSAL: return org.hl7.fhir.r4.model.NutritionOrder.NutritiionOrderIntent.PROPOSAL; + case PLAN: return org.hl7.fhir.r4.model.NutritionOrder.NutritiionOrderIntent.PLAN; + case DIRECTIVE: return org.hl7.fhir.r4.model.NutritionOrder.NutritiionOrderIntent.DIRECTIVE; + case ORDER: return org.hl7.fhir.r4.model.NutritionOrder.NutritiionOrderIntent.ORDER; + case ORIGINALORDER: return org.hl7.fhir.r4.model.NutritionOrder.NutritiionOrderIntent.ORIGINALORDER; + case REFLEXORDER: return org.hl7.fhir.r4.model.NutritionOrder.NutritiionOrderIntent.REFLEXORDER; + case FILLERORDER: return org.hl7.fhir.r4.model.NutritionOrder.NutritiionOrderIntent.FILLERORDER; + case INSTANCEORDER: return org.hl7.fhir.r4.model.NutritionOrder.NutritiionOrderIntent.INSTANCEORDER; + case OPTION: return org.hl7.fhir.r4.model.NutritionOrder.NutritiionOrderIntent.OPTION; + default: return org.hl7.fhir.r4.model.NutritionOrder.NutritiionOrderIntent.NULL; + } +} + + public static org.hl7.fhir.r5.model.NutritionOrder.NutritionOrderOralDietComponent convertNutritionOrderOralDietComponent(org.hl7.fhir.r4.model.NutritionOrder.NutritionOrderOralDietComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.NutritionOrder.NutritionOrderOralDietComponent tgt = new org.hl7.fhir.r5.model.NutritionOrder.NutritionOrderOralDietComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getType()) + tgt.addType(convertCodeableConcept(t)); + for (org.hl7.fhir.r4.model.Timing t : src.getSchedule()) + tgt.addSchedule(convertTiming(t)); + for (org.hl7.fhir.r4.model.NutritionOrder.NutritionOrderOralDietNutrientComponent t : src.getNutrient()) + tgt.addNutrient(convertNutritionOrderOralDietNutrientComponent(t)); + for (org.hl7.fhir.r4.model.NutritionOrder.NutritionOrderOralDietTextureComponent t : src.getTexture()) + tgt.addTexture(convertNutritionOrderOralDietTextureComponent(t)); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getFluidConsistencyType()) + tgt.addFluidConsistencyType(convertCodeableConcept(t)); + if (src.hasInstruction()) + tgt.setInstructionElement(convertString(src.getInstructionElement())); + return tgt; + } + + public static org.hl7.fhir.r4.model.NutritionOrder.NutritionOrderOralDietComponent convertNutritionOrderOralDietComponent(org.hl7.fhir.r5.model.NutritionOrder.NutritionOrderOralDietComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.NutritionOrder.NutritionOrderOralDietComponent tgt = new org.hl7.fhir.r4.model.NutritionOrder.NutritionOrderOralDietComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getType()) + tgt.addType(convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.Timing t : src.getSchedule()) + tgt.addSchedule(convertTiming(t)); + for (org.hl7.fhir.r5.model.NutritionOrder.NutritionOrderOralDietNutrientComponent t : src.getNutrient()) + tgt.addNutrient(convertNutritionOrderOralDietNutrientComponent(t)); + for (org.hl7.fhir.r5.model.NutritionOrder.NutritionOrderOralDietTextureComponent t : src.getTexture()) + tgt.addTexture(convertNutritionOrderOralDietTextureComponent(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getFluidConsistencyType()) + tgt.addFluidConsistencyType(convertCodeableConcept(t)); + if (src.hasInstruction()) + tgt.setInstructionElement(convertString(src.getInstructionElement())); + return tgt; + } + + public static org.hl7.fhir.r5.model.NutritionOrder.NutritionOrderOralDietNutrientComponent convertNutritionOrderOralDietNutrientComponent(org.hl7.fhir.r4.model.NutritionOrder.NutritionOrderOralDietNutrientComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.NutritionOrder.NutritionOrderOralDietNutrientComponent tgt = new org.hl7.fhir.r5.model.NutritionOrder.NutritionOrderOralDietNutrientComponent(); + copyElement(src, tgt); + if (src.hasModifier()) + tgt.setModifier(convertCodeableConcept(src.getModifier())); + if (src.hasAmount()) + tgt.setAmount(convertSimpleQuantity(src.getAmount())); + return tgt; + } + + public static org.hl7.fhir.r4.model.NutritionOrder.NutritionOrderOralDietNutrientComponent convertNutritionOrderOralDietNutrientComponent(org.hl7.fhir.r5.model.NutritionOrder.NutritionOrderOralDietNutrientComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.NutritionOrder.NutritionOrderOralDietNutrientComponent tgt = new org.hl7.fhir.r4.model.NutritionOrder.NutritionOrderOralDietNutrientComponent(); + copyElement(src, tgt); + if (src.hasModifier()) + tgt.setModifier(convertCodeableConcept(src.getModifier())); + if (src.hasAmount()) + tgt.setAmount(convertSimpleQuantity(src.getAmount())); + return tgt; + } + + public static org.hl7.fhir.r5.model.NutritionOrder.NutritionOrderOralDietTextureComponent convertNutritionOrderOralDietTextureComponent(org.hl7.fhir.r4.model.NutritionOrder.NutritionOrderOralDietTextureComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.NutritionOrder.NutritionOrderOralDietTextureComponent tgt = new org.hl7.fhir.r5.model.NutritionOrder.NutritionOrderOralDietTextureComponent(); + copyElement(src, tgt); + if (src.hasModifier()) + tgt.setModifier(convertCodeableConcept(src.getModifier())); + if (src.hasFoodType()) + tgt.setFoodType(convertCodeableConcept(src.getFoodType())); + return tgt; + } + + public static org.hl7.fhir.r4.model.NutritionOrder.NutritionOrderOralDietTextureComponent convertNutritionOrderOralDietTextureComponent(org.hl7.fhir.r5.model.NutritionOrder.NutritionOrderOralDietTextureComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.NutritionOrder.NutritionOrderOralDietTextureComponent tgt = new org.hl7.fhir.r4.model.NutritionOrder.NutritionOrderOralDietTextureComponent(); + copyElement(src, tgt); + if (src.hasModifier()) + tgt.setModifier(convertCodeableConcept(src.getModifier())); + if (src.hasFoodType()) + tgt.setFoodType(convertCodeableConcept(src.getFoodType())); + return tgt; + } + + public static org.hl7.fhir.r5.model.NutritionOrder.NutritionOrderSupplementComponent convertNutritionOrderSupplementComponent(org.hl7.fhir.r4.model.NutritionOrder.NutritionOrderSupplementComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.NutritionOrder.NutritionOrderSupplementComponent tgt = new org.hl7.fhir.r5.model.NutritionOrder.NutritionOrderSupplementComponent(); + copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + if (src.hasProductName()) + tgt.setProductNameElement(convertString(src.getProductNameElement())); + for (org.hl7.fhir.r4.model.Timing t : src.getSchedule()) + tgt.addSchedule(convertTiming(t)); + if (src.hasQuantity()) + tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); + if (src.hasInstruction()) + tgt.setInstructionElement(convertString(src.getInstructionElement())); + return tgt; + } + + public static org.hl7.fhir.r4.model.NutritionOrder.NutritionOrderSupplementComponent convertNutritionOrderSupplementComponent(org.hl7.fhir.r5.model.NutritionOrder.NutritionOrderSupplementComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.NutritionOrder.NutritionOrderSupplementComponent tgt = new org.hl7.fhir.r4.model.NutritionOrder.NutritionOrderSupplementComponent(); + copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + if (src.hasProductName()) + tgt.setProductNameElement(convertString(src.getProductNameElement())); + for (org.hl7.fhir.r5.model.Timing t : src.getSchedule()) + tgt.addSchedule(convertTiming(t)); + if (src.hasQuantity()) + tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); + if (src.hasInstruction()) + tgt.setInstructionElement(convertString(src.getInstructionElement())); + return tgt; + } + + public static org.hl7.fhir.r5.model.NutritionOrder.NutritionOrderEnteralFormulaComponent convertNutritionOrderEnteralFormulaComponent(org.hl7.fhir.r4.model.NutritionOrder.NutritionOrderEnteralFormulaComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.NutritionOrder.NutritionOrderEnteralFormulaComponent tgt = new org.hl7.fhir.r5.model.NutritionOrder.NutritionOrderEnteralFormulaComponent(); + copyElement(src, tgt); + if (src.hasBaseFormulaType()) + tgt.setBaseFormulaType(convertCodeableConcept(src.getBaseFormulaType())); + if (src.hasBaseFormulaProductName()) + tgt.setBaseFormulaProductNameElement(convertString(src.getBaseFormulaProductNameElement())); + if (src.hasAdditiveType()) + tgt.setAdditiveType(convertCodeableConcept(src.getAdditiveType())); + if (src.hasAdditiveProductName()) + tgt.setAdditiveProductNameElement(convertString(src.getAdditiveProductNameElement())); + if (src.hasCaloricDensity()) + tgt.setCaloricDensity(convertSimpleQuantity(src.getCaloricDensity())); + if (src.hasRouteofAdministration()) + tgt.setRouteofAdministration(convertCodeableConcept(src.getRouteofAdministration())); + for (org.hl7.fhir.r4.model.NutritionOrder.NutritionOrderEnteralFormulaAdministrationComponent t : src.getAdministration()) + tgt.addAdministration(convertNutritionOrderEnteralFormulaAdministrationComponent(t)); + if (src.hasMaxVolumeToDeliver()) + tgt.setMaxVolumeToDeliver(convertSimpleQuantity(src.getMaxVolumeToDeliver())); + if (src.hasAdministrationInstruction()) + tgt.setAdministrationInstructionElement(convertString(src.getAdministrationInstructionElement())); + return tgt; + } + + public static org.hl7.fhir.r4.model.NutritionOrder.NutritionOrderEnteralFormulaComponent convertNutritionOrderEnteralFormulaComponent(org.hl7.fhir.r5.model.NutritionOrder.NutritionOrderEnteralFormulaComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.NutritionOrder.NutritionOrderEnteralFormulaComponent tgt = new org.hl7.fhir.r4.model.NutritionOrder.NutritionOrderEnteralFormulaComponent(); + copyElement(src, tgt); + if (src.hasBaseFormulaType()) + tgt.setBaseFormulaType(convertCodeableConcept(src.getBaseFormulaType())); + if (src.hasBaseFormulaProductName()) + tgt.setBaseFormulaProductNameElement(convertString(src.getBaseFormulaProductNameElement())); + if (src.hasAdditiveType()) + tgt.setAdditiveType(convertCodeableConcept(src.getAdditiveType())); + if (src.hasAdditiveProductName()) + tgt.setAdditiveProductNameElement(convertString(src.getAdditiveProductNameElement())); + if (src.hasCaloricDensity()) + tgt.setCaloricDensity(convertSimpleQuantity(src.getCaloricDensity())); + if (src.hasRouteofAdministration()) + tgt.setRouteofAdministration(convertCodeableConcept(src.getRouteofAdministration())); + for (org.hl7.fhir.r5.model.NutritionOrder.NutritionOrderEnteralFormulaAdministrationComponent t : src.getAdministration()) + tgt.addAdministration(convertNutritionOrderEnteralFormulaAdministrationComponent(t)); + if (src.hasMaxVolumeToDeliver()) + tgt.setMaxVolumeToDeliver(convertSimpleQuantity(src.getMaxVolumeToDeliver())); + if (src.hasAdministrationInstruction()) + tgt.setAdministrationInstructionElement(convertString(src.getAdministrationInstructionElement())); + return tgt; + } + + public static org.hl7.fhir.r5.model.NutritionOrder.NutritionOrderEnteralFormulaAdministrationComponent convertNutritionOrderEnteralFormulaAdministrationComponent(org.hl7.fhir.r4.model.NutritionOrder.NutritionOrderEnteralFormulaAdministrationComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.NutritionOrder.NutritionOrderEnteralFormulaAdministrationComponent tgt = new org.hl7.fhir.r5.model.NutritionOrder.NutritionOrderEnteralFormulaAdministrationComponent(); + copyElement(src, tgt); + if (src.hasSchedule()) + tgt.setSchedule(convertTiming(src.getSchedule())); + if (src.hasQuantity()) + tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); + if (src.hasRate()) + tgt.setRate(convertType(src.getRate())); + return tgt; + } + + public static org.hl7.fhir.r4.model.NutritionOrder.NutritionOrderEnteralFormulaAdministrationComponent convertNutritionOrderEnteralFormulaAdministrationComponent(org.hl7.fhir.r5.model.NutritionOrder.NutritionOrderEnteralFormulaAdministrationComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.NutritionOrder.NutritionOrderEnteralFormulaAdministrationComponent tgt = new org.hl7.fhir.r4.model.NutritionOrder.NutritionOrderEnteralFormulaAdministrationComponent(); + copyElement(src, tgt); + if (src.hasSchedule()) + tgt.setSchedule(convertTiming(src.getSchedule())); + if (src.hasQuantity()) + tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); + if (src.hasRate()) + tgt.setRate(convertType(src.getRate())); + return tgt; + } + + +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Observation.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Observation.java new file mode 100644 index 000000000..3df73561b --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Observation.java @@ -0,0 +1,263 @@ +package org.hl7.fhir.convertors.conv40_50; + +import org.hl7.fhir.exceptions.FHIRException; + +import org.hl7.fhir.convertors.VersionConvertor_40_50; + + +/* + Copyright (c) 2011+, HL7, Inc. + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of HL7 nor the names of its contributors may be used to + endorse or promote products derived from this software without specific + prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + +*/ + +// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0 + + +public class Observation extends VersionConvertor_40_50 { + + public static org.hl7.fhir.r5.model.Observation convertObservation(org.hl7.fhir.r4.model.Observation src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Observation tgt = new org.hl7.fhir.r5.model.Observation(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getBasedOn()) + tgt.addBasedOn(convertReference(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getPartOf()) + tgt.addPartOf(convertReference(t)); + if (src.hasStatus()) + tgt.setStatus(convertObservationStatus(src.getStatus())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getCategory()) + tgt.addCategory(convertCodeableConcept(t)); + if (src.hasCode()) + tgt.setCode(convertCodeableConcept(src.getCode())); + if (src.hasSubject()) + tgt.setSubject(convertReference(src.getSubject())); + for (org.hl7.fhir.r4.model.Reference t : src.getFocus()) + tgt.addFocus(convertReference(t)); + if (src.hasEncounter()) + tgt.setEncounter(convertReference(src.getEncounter())); + if (src.hasEffective()) + tgt.setEffective(convertType(src.getEffective())); + if (src.hasIssued()) + tgt.setIssuedElement(convertInstant(src.getIssuedElement())); + for (org.hl7.fhir.r4.model.Reference t : src.getPerformer()) + tgt.addPerformer(convertReference(t)); + if (src.hasValue()) + tgt.setValue(convertType(src.getValue())); + if (src.hasDataAbsentReason()) + tgt.setDataAbsentReason(convertCodeableConcept(src.getDataAbsentReason())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getInterpretation()) + tgt.addInterpretation(convertCodeableConcept(t)); + for (org.hl7.fhir.r4.model.Annotation t : src.getNote()) + tgt.addNote(convertAnnotation(t)); + if (src.hasBodySite()) + tgt.setBodySite(convertCodeableConcept(src.getBodySite())); + if (src.hasMethod()) + tgt.setMethod(convertCodeableConcept(src.getMethod())); + if (src.hasSpecimen()) + tgt.setSpecimen(convertReference(src.getSpecimen())); + if (src.hasDevice()) + tgt.setDevice(convertReference(src.getDevice())); + for (org.hl7.fhir.r4.model.Observation.ObservationReferenceRangeComponent t : src.getReferenceRange()) + tgt.addReferenceRange(convertObservationReferenceRangeComponent(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getHasMember()) + tgt.addHasMember(convertReference(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getDerivedFrom()) + tgt.addDerivedFrom(convertReference(t)); + for (org.hl7.fhir.r4.model.Observation.ObservationComponentComponent t : src.getComponent()) + tgt.addComponent(convertObservationComponentComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.Observation convertObservation(org.hl7.fhir.r5.model.Observation src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Observation tgt = new org.hl7.fhir.r4.model.Observation(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getBasedOn()) + tgt.addBasedOn(convertReference(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getPartOf()) + tgt.addPartOf(convertReference(t)); + if (src.hasStatus()) + tgt.setStatus(convertObservationStatus(src.getStatus())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getCategory()) + tgt.addCategory(convertCodeableConcept(t)); + if (src.hasCode()) + tgt.setCode(convertCodeableConcept(src.getCode())); + if (src.hasSubject()) + tgt.setSubject(convertReference(src.getSubject())); + for (org.hl7.fhir.r5.model.Reference t : src.getFocus()) + tgt.addFocus(convertReference(t)); + if (src.hasEncounter()) + tgt.setEncounter(convertReference(src.getEncounter())); + if (src.hasEffective()) + tgt.setEffective(convertType(src.getEffective())); + if (src.hasIssued()) + tgt.setIssuedElement(convertInstant(src.getIssuedElement())); + for (org.hl7.fhir.r5.model.Reference t : src.getPerformer()) + tgt.addPerformer(convertReference(t)); + if (src.hasValue()) + tgt.setValue(convertType(src.getValue())); + if (src.hasDataAbsentReason()) + tgt.setDataAbsentReason(convertCodeableConcept(src.getDataAbsentReason())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getInterpretation()) + tgt.addInterpretation(convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.Annotation t : src.getNote()) + tgt.addNote(convertAnnotation(t)); + if (src.hasBodySite()) + tgt.setBodySite(convertCodeableConcept(src.getBodySite())); + if (src.hasMethod()) + tgt.setMethod(convertCodeableConcept(src.getMethod())); + if (src.hasSpecimen()) + tgt.setSpecimen(convertReference(src.getSpecimen())); + if (src.hasDevice()) + tgt.setDevice(convertReference(src.getDevice())); + for (org.hl7.fhir.r5.model.Observation.ObservationReferenceRangeComponent t : src.getReferenceRange()) + tgt.addReferenceRange(convertObservationReferenceRangeComponent(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getHasMember()) + tgt.addHasMember(convertReference(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getDerivedFrom()) + tgt.addDerivedFrom(convertReference(t)); + for (org.hl7.fhir.r5.model.Observation.ObservationComponentComponent t : src.getComponent()) + tgt.addComponent(convertObservationComponentComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.Observation.ObservationStatus convertObservationStatus(org.hl7.fhir.r4.model.Observation.ObservationStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case REGISTERED: return org.hl7.fhir.r5.model.Observation.ObservationStatus.REGISTERED; + case PRELIMINARY: return org.hl7.fhir.r5.model.Observation.ObservationStatus.PRELIMINARY; + case FINAL: return org.hl7.fhir.r5.model.Observation.ObservationStatus.FINAL; + case AMENDED: return org.hl7.fhir.r5.model.Observation.ObservationStatus.AMENDED; + case CORRECTED: return org.hl7.fhir.r5.model.Observation.ObservationStatus.CORRECTED; + case CANCELLED: return org.hl7.fhir.r5.model.Observation.ObservationStatus.CANCELLED; + case ENTEREDINERROR: return org.hl7.fhir.r5.model.Observation.ObservationStatus.ENTEREDINERROR; + case UNKNOWN: return org.hl7.fhir.r5.model.Observation.ObservationStatus.UNKNOWN; + default: return org.hl7.fhir.r5.model.Observation.ObservationStatus.NULL; + } +} + + public static org.hl7.fhir.r4.model.Observation.ObservationStatus convertObservationStatus(org.hl7.fhir.r5.model.Observation.ObservationStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case REGISTERED: return org.hl7.fhir.r4.model.Observation.ObservationStatus.REGISTERED; + case PRELIMINARY: return org.hl7.fhir.r4.model.Observation.ObservationStatus.PRELIMINARY; + case FINAL: return org.hl7.fhir.r4.model.Observation.ObservationStatus.FINAL; + case AMENDED: return org.hl7.fhir.r4.model.Observation.ObservationStatus.AMENDED; + case CORRECTED: return org.hl7.fhir.r4.model.Observation.ObservationStatus.CORRECTED; + case CANCELLED: return org.hl7.fhir.r4.model.Observation.ObservationStatus.CANCELLED; + case ENTEREDINERROR: return org.hl7.fhir.r4.model.Observation.ObservationStatus.ENTEREDINERROR; + case UNKNOWN: return org.hl7.fhir.r4.model.Observation.ObservationStatus.UNKNOWN; + default: return org.hl7.fhir.r4.model.Observation.ObservationStatus.NULL; + } +} + + public static org.hl7.fhir.r5.model.Observation.ObservationReferenceRangeComponent convertObservationReferenceRangeComponent(org.hl7.fhir.r4.model.Observation.ObservationReferenceRangeComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Observation.ObservationReferenceRangeComponent tgt = new org.hl7.fhir.r5.model.Observation.ObservationReferenceRangeComponent(); + copyElement(src, tgt); + if (src.hasLow()) + tgt.setLow(convertSimpleQuantity(src.getLow())); + if (src.hasHigh()) + tgt.setHigh(convertSimpleQuantity(src.getHigh())); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getAppliesTo()) + tgt.addAppliesTo(convertCodeableConcept(t)); + if (src.hasAge()) + tgt.setAge(convertRange(src.getAge())); + if (src.hasText()) + tgt.setTextElement(convertString(src.getTextElement())); + return tgt; + } + + public static org.hl7.fhir.r4.model.Observation.ObservationReferenceRangeComponent convertObservationReferenceRangeComponent(org.hl7.fhir.r5.model.Observation.ObservationReferenceRangeComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Observation.ObservationReferenceRangeComponent tgt = new org.hl7.fhir.r4.model.Observation.ObservationReferenceRangeComponent(); + copyElement(src, tgt); + if (src.hasLow()) + tgt.setLow(convertSimpleQuantity(src.getLow())); + if (src.hasHigh()) + tgt.setHigh(convertSimpleQuantity(src.getHigh())); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getAppliesTo()) + tgt.addAppliesTo(convertCodeableConcept(t)); + if (src.hasAge()) + tgt.setAge(convertRange(src.getAge())); + if (src.hasText()) + tgt.setTextElement(convertString(src.getTextElement())); + return tgt; + } + + public static org.hl7.fhir.r5.model.Observation.ObservationComponentComponent convertObservationComponentComponent(org.hl7.fhir.r4.model.Observation.ObservationComponentComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Observation.ObservationComponentComponent tgt = new org.hl7.fhir.r5.model.Observation.ObservationComponentComponent(); + copyElement(src, tgt); + if (src.hasCode()) + tgt.setCode(convertCodeableConcept(src.getCode())); + if (src.hasValue()) + tgt.setValue(convertType(src.getValue())); + if (src.hasDataAbsentReason()) + tgt.setDataAbsentReason(convertCodeableConcept(src.getDataAbsentReason())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getInterpretation()) + tgt.addInterpretation(convertCodeableConcept(t)); + for (org.hl7.fhir.r4.model.Observation.ObservationReferenceRangeComponent t : src.getReferenceRange()) + tgt.addReferenceRange(convertObservationReferenceRangeComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.Observation.ObservationComponentComponent convertObservationComponentComponent(org.hl7.fhir.r5.model.Observation.ObservationComponentComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Observation.ObservationComponentComponent tgt = new org.hl7.fhir.r4.model.Observation.ObservationComponentComponent(); + copyElement(src, tgt); + if (src.hasCode()) + tgt.setCode(convertCodeableConcept(src.getCode())); + if (src.hasValue()) + tgt.setValue(convertType(src.getValue())); + if (src.hasDataAbsentReason()) + tgt.setDataAbsentReason(convertCodeableConcept(src.getDataAbsentReason())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getInterpretation()) + tgt.addInterpretation(convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.Observation.ObservationReferenceRangeComponent t : src.getReferenceRange()) + tgt.addReferenceRange(convertObservationReferenceRangeComponent(t)); + return tgt; + } + + +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/ObservationDefinition.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/ObservationDefinition.java new file mode 100644 index 000000000..2cb29965a --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/ObservationDefinition.java @@ -0,0 +1,251 @@ +package org.hl7.fhir.convertors.conv40_50; + +import org.hl7.fhir.exceptions.FHIRException; + +import org.hl7.fhir.convertors.VersionConvertor_40_50; + + +/* + Copyright (c) 2011+, HL7, Inc. + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of HL7 nor the names of its contributors may be used to + endorse or promote products derived from this software without specific + prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + +*/ + +// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0 + + +public class ObservationDefinition extends VersionConvertor_40_50 { + + public static org.hl7.fhir.r5.model.ObservationDefinition convertObservationDefinition(org.hl7.fhir.r4.model.ObservationDefinition src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ObservationDefinition tgt = new org.hl7.fhir.r5.model.ObservationDefinition(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getCategory()) + tgt.addCategory(convertCodeableConcept(t)); + if (src.hasCode()) + tgt.setCode(convertCodeableConcept(src.getCode())); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + for (org.hl7.fhir.r4.model.Enumeration t : src.getPermittedDataType()) + tgt.addPermittedDataType(convertObservationDataType(t.getValue())); + if (src.hasMultipleResultsAllowed()) + tgt.setMultipleResultsAllowedElement(convertBoolean(src.getMultipleResultsAllowedElement())); + if (src.hasMethod()) + tgt.setMethod(convertCodeableConcept(src.getMethod())); + if (src.hasPreferredReportName()) + tgt.setPreferredReportNameElement(convertString(src.getPreferredReportNameElement())); + if (src.hasQuantitativeDetails()) + tgt.setQuantitativeDetails(convertObservationDefinitionQuantitativeDetailsComponent(src.getQuantitativeDetails())); + for (org.hl7.fhir.r4.model.ObservationDefinition.ObservationDefinitionQualifiedIntervalComponent t : src.getQualifiedInterval()) + tgt.addQualifiedInterval(convertObservationDefinitionQualifiedIntervalComponent(t)); + if (src.hasValidCodedValueSet()) + tgt.setValidCodedValueSet(convertReference(src.getValidCodedValueSet())); + if (src.hasNormalCodedValueSet()) + tgt.setNormalCodedValueSet(convertReference(src.getNormalCodedValueSet())); + if (src.hasAbnormalCodedValueSet()) + tgt.setAbnormalCodedValueSet(convertReference(src.getAbnormalCodedValueSet())); + if (src.hasCriticalCodedValueSet()) + tgt.setCriticalCodedValueSet(convertReference(src.getCriticalCodedValueSet())); + return tgt; + } + + public static org.hl7.fhir.r4.model.ObservationDefinition convertObservationDefinition(org.hl7.fhir.r5.model.ObservationDefinition src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.ObservationDefinition tgt = new org.hl7.fhir.r4.model.ObservationDefinition(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getCategory()) + tgt.addCategory(convertCodeableConcept(t)); + if (src.hasCode()) + tgt.setCode(convertCodeableConcept(src.getCode())); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + for (org.hl7.fhir.r5.model.Enumeration t : src.getPermittedDataType()) + tgt.addPermittedDataType(convertObservationDataType(t.getValue())); + if (src.hasMultipleResultsAllowed()) + tgt.setMultipleResultsAllowedElement(convertBoolean(src.getMultipleResultsAllowedElement())); + if (src.hasMethod()) + tgt.setMethod(convertCodeableConcept(src.getMethod())); + if (src.hasPreferredReportName()) + tgt.setPreferredReportNameElement(convertString(src.getPreferredReportNameElement())); + if (src.hasQuantitativeDetails()) + tgt.setQuantitativeDetails(convertObservationDefinitionQuantitativeDetailsComponent(src.getQuantitativeDetails())); + for (org.hl7.fhir.r5.model.ObservationDefinition.ObservationDefinitionQualifiedIntervalComponent t : src.getQualifiedInterval()) + tgt.addQualifiedInterval(convertObservationDefinitionQualifiedIntervalComponent(t)); + if (src.hasValidCodedValueSet()) + tgt.setValidCodedValueSet(convertReference(src.getValidCodedValueSet())); + if (src.hasNormalCodedValueSet()) + tgt.setNormalCodedValueSet(convertReference(src.getNormalCodedValueSet())); + if (src.hasAbnormalCodedValueSet()) + tgt.setAbnormalCodedValueSet(convertReference(src.getAbnormalCodedValueSet())); + if (src.hasCriticalCodedValueSet()) + tgt.setCriticalCodedValueSet(convertReference(src.getCriticalCodedValueSet())); + return tgt; + } + + public static org.hl7.fhir.r5.model.ObservationDefinition.ObservationDataType convertObservationDataType(org.hl7.fhir.r4.model.ObservationDefinition.ObservationDataType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case QUANTITY: return org.hl7.fhir.r5.model.ObservationDefinition.ObservationDataType.QUANTITY; + case CODEABLECONCEPT: return org.hl7.fhir.r5.model.ObservationDefinition.ObservationDataType.CODEABLECONCEPT; + case STRING: return org.hl7.fhir.r5.model.ObservationDefinition.ObservationDataType.STRING; + case BOOLEAN: return org.hl7.fhir.r5.model.ObservationDefinition.ObservationDataType.BOOLEAN; + case INTEGER: return org.hl7.fhir.r5.model.ObservationDefinition.ObservationDataType.INTEGER; + case RANGE: return org.hl7.fhir.r5.model.ObservationDefinition.ObservationDataType.RANGE; + case RATIO: return org.hl7.fhir.r5.model.ObservationDefinition.ObservationDataType.RATIO; + case SAMPLEDDATA: return org.hl7.fhir.r5.model.ObservationDefinition.ObservationDataType.SAMPLEDDATA; + case TIME: return org.hl7.fhir.r5.model.ObservationDefinition.ObservationDataType.TIME; + case DATETIME: return org.hl7.fhir.r5.model.ObservationDefinition.ObservationDataType.DATETIME; + case PERIOD: return org.hl7.fhir.r5.model.ObservationDefinition.ObservationDataType.PERIOD; + default: return org.hl7.fhir.r5.model.ObservationDefinition.ObservationDataType.NULL; + } +} + + public static org.hl7.fhir.r4.model.ObservationDefinition.ObservationDataType convertObservationDataType(org.hl7.fhir.r5.model.ObservationDefinition.ObservationDataType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case QUANTITY: return org.hl7.fhir.r4.model.ObservationDefinition.ObservationDataType.QUANTITY; + case CODEABLECONCEPT: return org.hl7.fhir.r4.model.ObservationDefinition.ObservationDataType.CODEABLECONCEPT; + case STRING: return org.hl7.fhir.r4.model.ObservationDefinition.ObservationDataType.STRING; + case BOOLEAN: return org.hl7.fhir.r4.model.ObservationDefinition.ObservationDataType.BOOLEAN; + case INTEGER: return org.hl7.fhir.r4.model.ObservationDefinition.ObservationDataType.INTEGER; + case RANGE: return org.hl7.fhir.r4.model.ObservationDefinition.ObservationDataType.RANGE; + case RATIO: return org.hl7.fhir.r4.model.ObservationDefinition.ObservationDataType.RATIO; + case SAMPLEDDATA: return org.hl7.fhir.r4.model.ObservationDefinition.ObservationDataType.SAMPLEDDATA; + case TIME: return org.hl7.fhir.r4.model.ObservationDefinition.ObservationDataType.TIME; + case DATETIME: return org.hl7.fhir.r4.model.ObservationDefinition.ObservationDataType.DATETIME; + case PERIOD: return org.hl7.fhir.r4.model.ObservationDefinition.ObservationDataType.PERIOD; + default: return org.hl7.fhir.r4.model.ObservationDefinition.ObservationDataType.NULL; + } +} + + public static org.hl7.fhir.r5.model.ObservationDefinition.ObservationDefinitionQuantitativeDetailsComponent convertObservationDefinitionQuantitativeDetailsComponent(org.hl7.fhir.r4.model.ObservationDefinition.ObservationDefinitionQuantitativeDetailsComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ObservationDefinition.ObservationDefinitionQuantitativeDetailsComponent tgt = new org.hl7.fhir.r5.model.ObservationDefinition.ObservationDefinitionQuantitativeDetailsComponent(); + copyElement(src, tgt); + if (src.hasCustomaryUnit()) + tgt.setCustomaryUnit(convertCodeableConcept(src.getCustomaryUnit())); + if (src.hasUnit()) + tgt.setUnit(convertCodeableConcept(src.getUnit())); + if (src.hasConversionFactor()) + tgt.setConversionFactorElement(convertDecimal(src.getConversionFactorElement())); + if (src.hasDecimalPrecision()) + tgt.setDecimalPrecisionElement(convertInteger(src.getDecimalPrecisionElement())); + return tgt; + } + + public static org.hl7.fhir.r4.model.ObservationDefinition.ObservationDefinitionQuantitativeDetailsComponent convertObservationDefinitionQuantitativeDetailsComponent(org.hl7.fhir.r5.model.ObservationDefinition.ObservationDefinitionQuantitativeDetailsComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.ObservationDefinition.ObservationDefinitionQuantitativeDetailsComponent tgt = new org.hl7.fhir.r4.model.ObservationDefinition.ObservationDefinitionQuantitativeDetailsComponent(); + copyElement(src, tgt); + if (src.hasCustomaryUnit()) + tgt.setCustomaryUnit(convertCodeableConcept(src.getCustomaryUnit())); + if (src.hasUnit()) + tgt.setUnit(convertCodeableConcept(src.getUnit())); + if (src.hasConversionFactor()) + tgt.setConversionFactorElement(convertDecimal(src.getConversionFactorElement())); + if (src.hasDecimalPrecision()) + tgt.setDecimalPrecisionElement(convertInteger(src.getDecimalPrecisionElement())); + return tgt; + } + + public static org.hl7.fhir.r5.model.ObservationDefinition.ObservationDefinitionQualifiedIntervalComponent convertObservationDefinitionQualifiedIntervalComponent(org.hl7.fhir.r4.model.ObservationDefinition.ObservationDefinitionQualifiedIntervalComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ObservationDefinition.ObservationDefinitionQualifiedIntervalComponent tgt = new org.hl7.fhir.r5.model.ObservationDefinition.ObservationDefinitionQualifiedIntervalComponent(); + copyElement(src, tgt); + if (src.hasCategory()) + tgt.setCategory(convertObservationRangeCategory(src.getCategory())); + if (src.hasRange()) + tgt.setRange(convertRange(src.getRange())); + if (src.hasContext()) + tgt.setContext(convertCodeableConcept(src.getContext())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getAppliesTo()) + tgt.addAppliesTo(convertCodeableConcept(t)); + if (src.hasGender()) + tgt.setGender(Enumerations.convertAdministrativeGender(src.getGender())); + if (src.hasAge()) + tgt.setAge(convertRange(src.getAge())); + if (src.hasGestationalAge()) + tgt.setGestationalAge(convertRange(src.getGestationalAge())); + if (src.hasCondition()) + tgt.setConditionElement(convertString(src.getConditionElement())); + return tgt; + } + + public static org.hl7.fhir.r4.model.ObservationDefinition.ObservationDefinitionQualifiedIntervalComponent convertObservationDefinitionQualifiedIntervalComponent(org.hl7.fhir.r5.model.ObservationDefinition.ObservationDefinitionQualifiedIntervalComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.ObservationDefinition.ObservationDefinitionQualifiedIntervalComponent tgt = new org.hl7.fhir.r4.model.ObservationDefinition.ObservationDefinitionQualifiedIntervalComponent(); + copyElement(src, tgt); + if (src.hasCategory()) + tgt.setCategory(convertObservationRangeCategory(src.getCategory())); + if (src.hasRange()) + tgt.setRange(convertRange(src.getRange())); + if (src.hasContext()) + tgt.setContext(convertCodeableConcept(src.getContext())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getAppliesTo()) + tgt.addAppliesTo(convertCodeableConcept(t)); + if (src.hasGender()) + tgt.setGender(Enumerations.convertAdministrativeGender(src.getGender())); + if (src.hasAge()) + tgt.setAge(convertRange(src.getAge())); + if (src.hasGestationalAge()) + tgt.setGestationalAge(convertRange(src.getGestationalAge())); + if (src.hasCondition()) + tgt.setConditionElement(convertString(src.getConditionElement())); + return tgt; + } + + public static org.hl7.fhir.r5.model.ObservationDefinition.ObservationRangeCategory convertObservationRangeCategory(org.hl7.fhir.r4.model.ObservationDefinition.ObservationRangeCategory src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case REFERENCE: return org.hl7.fhir.r5.model.ObservationDefinition.ObservationRangeCategory.REFERENCE; + case CRITICAL: return org.hl7.fhir.r5.model.ObservationDefinition.ObservationRangeCategory.CRITICAL; + case ABSOLUTE: return org.hl7.fhir.r5.model.ObservationDefinition.ObservationRangeCategory.ABSOLUTE; + default: return org.hl7.fhir.r5.model.ObservationDefinition.ObservationRangeCategory.NULL; + } +} + + public static org.hl7.fhir.r4.model.ObservationDefinition.ObservationRangeCategory convertObservationRangeCategory(org.hl7.fhir.r5.model.ObservationDefinition.ObservationRangeCategory src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case REFERENCE: return org.hl7.fhir.r4.model.ObservationDefinition.ObservationRangeCategory.REFERENCE; + case CRITICAL: return org.hl7.fhir.r4.model.ObservationDefinition.ObservationRangeCategory.CRITICAL; + case ABSOLUTE: return org.hl7.fhir.r4.model.ObservationDefinition.ObservationRangeCategory.ABSOLUTE; + default: return org.hl7.fhir.r4.model.ObservationDefinition.ObservationRangeCategory.NULL; + } +} + + +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/OperationDefinition.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/OperationDefinition.java new file mode 100644 index 000000000..01fa5e015 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/OperationDefinition.java @@ -0,0 +1,335 @@ +package org.hl7.fhir.convertors.conv40_50; + +import org.hl7.fhir.exceptions.FHIRException; + +import org.hl7.fhir.convertors.VersionConvertor_40_50; + + +/* + Copyright (c) 2011+, HL7, Inc. + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of HL7 nor the names of its contributors may be used to + endorse or promote products derived from this software without specific + prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + +*/ + +// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0 + + +public class OperationDefinition extends VersionConvertor_40_50 { + + public static org.hl7.fhir.r5.model.OperationDefinition convertOperationDefinition(org.hl7.fhir.r4.model.OperationDefinition src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.OperationDefinition tgt = new org.hl7.fhir.r5.model.OperationDefinition(); + copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrlElement(convertUri(src.getUrlElement())); + if (src.hasVersion()) + tgt.setVersionElement(convertString(src.getVersionElement())); + if (src.hasName()) + tgt.setNameElement(convertString(src.getNameElement())); + if (src.hasTitle()) + tgt.setTitleElement(convertString(src.getTitleElement())); + if (src.hasStatus()) + tgt.setStatus(Enumerations.convertPublicationStatus(src.getStatus())); + if (src.hasKind()) + tgt.setKind(convertOperationKind(src.getKind())); + if (src.hasExperimental()) + tgt.setExperimentalElement(convertBoolean(src.getExperimentalElement())); + if (src.hasDate()) + tgt.setDateElement(convertDateTime(src.getDateElement())); + if (src.hasPublisher()) + tgt.setPublisherElement(convertString(src.getPublisherElement())); + for (org.hl7.fhir.r4.model.ContactDetail t : src.getContact()) + tgt.addContact(convertContactDetail(t)); + if (src.hasDescription()) + tgt.setDescriptionElement(convertMarkdown(src.getDescriptionElement())); + for (org.hl7.fhir.r4.model.UsageContext t : src.getUseContext()) + tgt.addUseContext(convertUsageContext(t)); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getJurisdiction()) + tgt.addJurisdiction(convertCodeableConcept(t)); + if (src.hasPurpose()) + tgt.setPurposeElement(convertMarkdown(src.getPurposeElement())); + if (src.hasAffectsState()) + tgt.setAffectsStateElement(convertBoolean(src.getAffectsStateElement())); + if (src.hasCode()) + tgt.setCodeElement(convertCode(src.getCodeElement())); + if (src.hasComment()) + tgt.setCommentElement(convertMarkdown(src.getCommentElement())); + if (src.hasBase()) + tgt.setBaseElement(convertCanonical(src.getBaseElement())); + for (org.hl7.fhir.r4.model.CodeType t : src.getResource()) + tgt.getResource().add(convertCode(t)); + if (src.hasSystem()) + tgt.setSystemElement(convertBoolean(src.getSystemElement())); + if (src.hasType()) + tgt.setTypeElement(convertBoolean(src.getTypeElement())); + if (src.hasInstance()) + tgt.setInstanceElement(convertBoolean(src.getInstanceElement())); + if (src.hasInputProfile()) + tgt.setInputProfileElement(convertCanonical(src.getInputProfileElement())); + if (src.hasOutputProfile()) + tgt.setOutputProfileElement(convertCanonical(src.getOutputProfileElement())); + for (org.hl7.fhir.r4.model.OperationDefinition.OperationDefinitionParameterComponent t : src.getParameter()) + tgt.addParameter(convertOperationDefinitionParameterComponent(t)); + for (org.hl7.fhir.r4.model.OperationDefinition.OperationDefinitionOverloadComponent t : src.getOverload()) + tgt.addOverload(convertOperationDefinitionOverloadComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.OperationDefinition convertOperationDefinition(org.hl7.fhir.r5.model.OperationDefinition src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.OperationDefinition tgt = new org.hl7.fhir.r4.model.OperationDefinition(); + copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrlElement(convertUri(src.getUrlElement())); + if (src.hasVersion()) + tgt.setVersionElement(convertString(src.getVersionElement())); + if (src.hasName()) + tgt.setNameElement(convertString(src.getNameElement())); + if (src.hasTitle()) + tgt.setTitleElement(convertString(src.getTitleElement())); + if (src.hasStatus()) + tgt.setStatus(Enumerations.convertPublicationStatus(src.getStatus())); + if (src.hasKind()) + tgt.setKind(convertOperationKind(src.getKind())); + if (src.hasExperimental()) + tgt.setExperimentalElement(convertBoolean(src.getExperimentalElement())); + if (src.hasDate()) + tgt.setDateElement(convertDateTime(src.getDateElement())); + if (src.hasPublisher()) + tgt.setPublisherElement(convertString(src.getPublisherElement())); + for (org.hl7.fhir.r5.model.ContactDetail t : src.getContact()) + tgt.addContact(convertContactDetail(t)); + if (src.hasDescription()) + tgt.setDescriptionElement(convertMarkdown(src.getDescriptionElement())); + for (org.hl7.fhir.r5.model.UsageContext t : src.getUseContext()) + tgt.addUseContext(convertUsageContext(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getJurisdiction()) + tgt.addJurisdiction(convertCodeableConcept(t)); + if (src.hasPurpose()) + tgt.setPurposeElement(convertMarkdown(src.getPurposeElement())); + if (src.hasAffectsState()) + tgt.setAffectsStateElement(convertBoolean(src.getAffectsStateElement())); + if (src.hasCode()) + tgt.setCodeElement(convertCode(src.getCodeElement())); + if (src.hasComment()) + tgt.setCommentElement(convertMarkdown(src.getCommentElement())); + if (src.hasBase()) + tgt.setBaseElement(convertCanonical(src.getBaseElement())); + for (org.hl7.fhir.r5.model.CodeType t : src.getResource()) + tgt.getResource().add(convertCode(t)); + if (src.hasSystem()) + tgt.setSystemElement(convertBoolean(src.getSystemElement())); + if (src.hasType()) + tgt.setTypeElement(convertBoolean(src.getTypeElement())); + if (src.hasInstance()) + tgt.setInstanceElement(convertBoolean(src.getInstanceElement())); + if (src.hasInputProfile()) + tgt.setInputProfileElement(convertCanonical(src.getInputProfileElement())); + if (src.hasOutputProfile()) + tgt.setOutputProfileElement(convertCanonical(src.getOutputProfileElement())); + for (org.hl7.fhir.r5.model.OperationDefinition.OperationDefinitionParameterComponent t : src.getParameter()) + tgt.addParameter(convertOperationDefinitionParameterComponent(t)); + for (org.hl7.fhir.r5.model.OperationDefinition.OperationDefinitionOverloadComponent t : src.getOverload()) + tgt.addOverload(convertOperationDefinitionOverloadComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.OperationDefinition.OperationKind convertOperationKind(org.hl7.fhir.r4.model.OperationDefinition.OperationKind src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case OPERATION: return org.hl7.fhir.r5.model.OperationDefinition.OperationKind.OPERATION; + case QUERY: return org.hl7.fhir.r5.model.OperationDefinition.OperationKind.QUERY; + default: return org.hl7.fhir.r5.model.OperationDefinition.OperationKind.NULL; + } +} + + public static org.hl7.fhir.r4.model.OperationDefinition.OperationKind convertOperationKind(org.hl7.fhir.r5.model.OperationDefinition.OperationKind src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case OPERATION: return org.hl7.fhir.r4.model.OperationDefinition.OperationKind.OPERATION; + case QUERY: return org.hl7.fhir.r4.model.OperationDefinition.OperationKind.QUERY; + default: return org.hl7.fhir.r4.model.OperationDefinition.OperationKind.NULL; + } +} + + public static org.hl7.fhir.r5.model.OperationDefinition.OperationDefinitionParameterComponent convertOperationDefinitionParameterComponent(org.hl7.fhir.r4.model.OperationDefinition.OperationDefinitionParameterComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.OperationDefinition.OperationDefinitionParameterComponent tgt = new org.hl7.fhir.r5.model.OperationDefinition.OperationDefinitionParameterComponent(); + copyElement(src, tgt); + if (src.hasName()) + tgt.setNameElement(convertCode(src.getNameElement())); + if (src.hasUse()) + tgt.setUse(convertOperationParameterUse(src.getUse())); + if (src.hasMin()) + tgt.setMinElement(convertInteger(src.getMinElement())); + if (src.hasMax()) + tgt.setMaxElement(convertString(src.getMaxElement())); + if (src.hasDocumentation()) + tgt.setDocumentationElement(convertString(src.getDocumentationElement())); + if (src.hasType()) + tgt.setTypeElement(convertCode(src.getTypeElement())); + for (org.hl7.fhir.r4.model.CanonicalType t : src.getTargetProfile()) + tgt.getTargetProfile().add(convertCanonical(t)); + if (src.hasSearchType()) + tgt.setSearchType(Enumerations.convertSearchParamType(src.getSearchType())); + if (src.hasBinding()) + tgt.setBinding(convertOperationDefinitionParameterBindingComponent(src.getBinding())); + for (org.hl7.fhir.r4.model.OperationDefinition.OperationDefinitionParameterReferencedFromComponent t : src.getReferencedFrom()) + tgt.addReferencedFrom(convertOperationDefinitionParameterReferencedFromComponent(t)); + for (org.hl7.fhir.r4.model.OperationDefinition.OperationDefinitionParameterComponent t : src.getPart()) + tgt.addPart(convertOperationDefinitionParameterComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.OperationDefinition.OperationDefinitionParameterComponent convertOperationDefinitionParameterComponent(org.hl7.fhir.r5.model.OperationDefinition.OperationDefinitionParameterComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.OperationDefinition.OperationDefinitionParameterComponent tgt = new org.hl7.fhir.r4.model.OperationDefinition.OperationDefinitionParameterComponent(); + copyElement(src, tgt); + if (src.hasName()) + tgt.setNameElement(convertCode(src.getNameElement())); + if (src.hasUse()) + tgt.setUse(convertOperationParameterUse(src.getUse())); + if (src.hasMin()) + tgt.setMinElement(convertInteger(src.getMinElement())); + if (src.hasMax()) + tgt.setMaxElement(convertString(src.getMaxElement())); + if (src.hasDocumentation()) + tgt.setDocumentationElement(convertString(src.getDocumentationElement())); + if (src.hasType()) + tgt.setTypeElement(convertCode(src.getTypeElement())); + for (org.hl7.fhir.r5.model.CanonicalType t : src.getTargetProfile()) + tgt.getTargetProfile().add(convertCanonical(t)); + if (src.hasSearchType()) + tgt.setSearchType(Enumerations.convertSearchParamType(src.getSearchType())); + if (src.hasBinding()) + tgt.setBinding(convertOperationDefinitionParameterBindingComponent(src.getBinding())); + for (org.hl7.fhir.r5.model.OperationDefinition.OperationDefinitionParameterReferencedFromComponent t : src.getReferencedFrom()) + tgt.addReferencedFrom(convertOperationDefinitionParameterReferencedFromComponent(t)); + for (org.hl7.fhir.r5.model.OperationDefinition.OperationDefinitionParameterComponent t : src.getPart()) + tgt.addPart(convertOperationDefinitionParameterComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.OperationDefinition.OperationParameterUse convertOperationParameterUse(org.hl7.fhir.r4.model.OperationDefinition.OperationParameterUse src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case IN: return org.hl7.fhir.r5.model.OperationDefinition.OperationParameterUse.IN; + case OUT: return org.hl7.fhir.r5.model.OperationDefinition.OperationParameterUse.OUT; + default: return org.hl7.fhir.r5.model.OperationDefinition.OperationParameterUse.NULL; + } +} + + public static org.hl7.fhir.r4.model.OperationDefinition.OperationParameterUse convertOperationParameterUse(org.hl7.fhir.r5.model.OperationDefinition.OperationParameterUse src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case IN: return org.hl7.fhir.r4.model.OperationDefinition.OperationParameterUse.IN; + case OUT: return org.hl7.fhir.r4.model.OperationDefinition.OperationParameterUse.OUT; + default: return org.hl7.fhir.r4.model.OperationDefinition.OperationParameterUse.NULL; + } +} + + public static org.hl7.fhir.r5.model.OperationDefinition.OperationDefinitionParameterBindingComponent convertOperationDefinitionParameterBindingComponent(org.hl7.fhir.r4.model.OperationDefinition.OperationDefinitionParameterBindingComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.OperationDefinition.OperationDefinitionParameterBindingComponent tgt = new org.hl7.fhir.r5.model.OperationDefinition.OperationDefinitionParameterBindingComponent(); + copyElement(src, tgt); + if (src.hasStrength()) + tgt.setStrength(Enumerations.convertBindingStrength(src.getStrength())); + if (src.hasValueSet()) + tgt.setValueSetElement(convertCanonical(src.getValueSetElement())); + return tgt; + } + + public static org.hl7.fhir.r4.model.OperationDefinition.OperationDefinitionParameterBindingComponent convertOperationDefinitionParameterBindingComponent(org.hl7.fhir.r5.model.OperationDefinition.OperationDefinitionParameterBindingComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.OperationDefinition.OperationDefinitionParameterBindingComponent tgt = new org.hl7.fhir.r4.model.OperationDefinition.OperationDefinitionParameterBindingComponent(); + copyElement(src, tgt); + if (src.hasStrength()) + tgt.setStrength(Enumerations.convertBindingStrength(src.getStrength())); + if (src.hasValueSet()) + tgt.setValueSetElement(convertCanonical(src.getValueSetElement())); + return tgt; + } + + public static org.hl7.fhir.r5.model.OperationDefinition.OperationDefinitionParameterReferencedFromComponent convertOperationDefinitionParameterReferencedFromComponent(org.hl7.fhir.r4.model.OperationDefinition.OperationDefinitionParameterReferencedFromComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.OperationDefinition.OperationDefinitionParameterReferencedFromComponent tgt = new org.hl7.fhir.r5.model.OperationDefinition.OperationDefinitionParameterReferencedFromComponent(); + copyElement(src, tgt); + if (src.hasSource()) + tgt.setSourceElement(convertString(src.getSourceElement())); + if (src.hasSourceId()) + tgt.setSourceIdElement(convertString(src.getSourceIdElement())); + return tgt; + } + + public static org.hl7.fhir.r4.model.OperationDefinition.OperationDefinitionParameterReferencedFromComponent convertOperationDefinitionParameterReferencedFromComponent(org.hl7.fhir.r5.model.OperationDefinition.OperationDefinitionParameterReferencedFromComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.OperationDefinition.OperationDefinitionParameterReferencedFromComponent tgt = new org.hl7.fhir.r4.model.OperationDefinition.OperationDefinitionParameterReferencedFromComponent(); + copyElement(src, tgt); + if (src.hasSource()) + tgt.setSourceElement(convertString(src.getSourceElement())); + if (src.hasSourceId()) + tgt.setSourceIdElement(convertString(src.getSourceIdElement())); + return tgt; + } + + public static org.hl7.fhir.r5.model.OperationDefinition.OperationDefinitionOverloadComponent convertOperationDefinitionOverloadComponent(org.hl7.fhir.r4.model.OperationDefinition.OperationDefinitionOverloadComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.OperationDefinition.OperationDefinitionOverloadComponent tgt = new org.hl7.fhir.r5.model.OperationDefinition.OperationDefinitionOverloadComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.r4.model.StringType t : src.getParameterName()) + tgt.getParameterName().add(convertString(t)); + if (src.hasComment()) + tgt.setCommentElement(convertString(src.getCommentElement())); + return tgt; + } + + public static org.hl7.fhir.r4.model.OperationDefinition.OperationDefinitionOverloadComponent convertOperationDefinitionOverloadComponent(org.hl7.fhir.r5.model.OperationDefinition.OperationDefinitionOverloadComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.OperationDefinition.OperationDefinitionOverloadComponent tgt = new org.hl7.fhir.r4.model.OperationDefinition.OperationDefinitionOverloadComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.r5.model.StringType t : src.getParameterName()) + tgt.getParameterName().add(convertString(t)); + if (src.hasComment()) + tgt.setCommentElement(convertString(src.getCommentElement())); + return tgt; + } + + +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/OperationOutcome.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/OperationOutcome.java new file mode 100644 index 000000000..d02c65a2f --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/OperationOutcome.java @@ -0,0 +1,205 @@ +package org.hl7.fhir.convertors.conv40_50; + +import org.hl7.fhir.exceptions.FHIRException; + +import org.hl7.fhir.convertors.VersionConvertor_40_50; + + +/* + Copyright (c) 2011+, HL7, Inc. + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of HL7 nor the names of its contributors may be used to + endorse or promote products derived from this software without specific + prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + +*/ + +// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0 + + +public class OperationOutcome extends VersionConvertor_40_50 { + + public static org.hl7.fhir.r5.model.OperationOutcome convertOperationOutcome(org.hl7.fhir.r4.model.OperationOutcome src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.OperationOutcome tgt = new org.hl7.fhir.r5.model.OperationOutcome(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r4.model.OperationOutcome.OperationOutcomeIssueComponent t : src.getIssue()) + tgt.addIssue(convertOperationOutcomeIssueComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.OperationOutcome convertOperationOutcome(org.hl7.fhir.r5.model.OperationOutcome src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.OperationOutcome tgt = new org.hl7.fhir.r4.model.OperationOutcome(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.OperationOutcome.OperationOutcomeIssueComponent t : src.getIssue()) + tgt.addIssue(convertOperationOutcomeIssueComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.OperationOutcome.OperationOutcomeIssueComponent convertOperationOutcomeIssueComponent(org.hl7.fhir.r4.model.OperationOutcome.OperationOutcomeIssueComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.OperationOutcome.OperationOutcomeIssueComponent tgt = new org.hl7.fhir.r5.model.OperationOutcome.OperationOutcomeIssueComponent(); + copyElement(src, tgt); + if (src.hasSeverity()) + tgt.setSeverity(convertIssueSeverity(src.getSeverity())); + if (src.hasCode()) + tgt.setCode(convertIssueType(src.getCode())); + if (src.hasDetails()) + tgt.setDetails(convertCodeableConcept(src.getDetails())); + if (src.hasDiagnostics()) + tgt.setDiagnosticsElement(convertString(src.getDiagnosticsElement())); + for (org.hl7.fhir.r4.model.StringType t : src.getLocation()) + tgt.getLocation().add(convertString(t)); + for (org.hl7.fhir.r4.model.StringType t : src.getExpression()) + tgt.getExpression().add(convertString(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.OperationOutcome.OperationOutcomeIssueComponent convertOperationOutcomeIssueComponent(org.hl7.fhir.r5.model.OperationOutcome.OperationOutcomeIssueComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.OperationOutcome.OperationOutcomeIssueComponent tgt = new org.hl7.fhir.r4.model.OperationOutcome.OperationOutcomeIssueComponent(); + copyElement(src, tgt); + if (src.hasSeverity()) + tgt.setSeverity(convertIssueSeverity(src.getSeverity())); + if (src.hasCode()) + tgt.setCode(convertIssueType(src.getCode())); + if (src.hasDetails()) + tgt.setDetails(convertCodeableConcept(src.getDetails())); + if (src.hasDiagnostics()) + tgt.setDiagnosticsElement(convertString(src.getDiagnosticsElement())); + for (org.hl7.fhir.r5.model.StringType t : src.getLocation()) + tgt.getLocation().add(convertString(t)); + for (org.hl7.fhir.r5.model.StringType t : src.getExpression()) + tgt.getExpression().add(convertString(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.OperationOutcome.IssueSeverity convertIssueSeverity(org.hl7.fhir.r4.model.OperationOutcome.IssueSeverity src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case FATAL: return org.hl7.fhir.r5.model.OperationOutcome.IssueSeverity.FATAL; + case ERROR: return org.hl7.fhir.r5.model.OperationOutcome.IssueSeverity.ERROR; + case WARNING: return org.hl7.fhir.r5.model.OperationOutcome.IssueSeverity.WARNING; + case INFORMATION: return org.hl7.fhir.r5.model.OperationOutcome.IssueSeverity.INFORMATION; + default: return org.hl7.fhir.r5.model.OperationOutcome.IssueSeverity.NULL; + } +} + + public static org.hl7.fhir.r4.model.OperationOutcome.IssueSeverity convertIssueSeverity(org.hl7.fhir.r5.model.OperationOutcome.IssueSeverity src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case FATAL: return org.hl7.fhir.r4.model.OperationOutcome.IssueSeverity.FATAL; + case ERROR: return org.hl7.fhir.r4.model.OperationOutcome.IssueSeverity.ERROR; + case WARNING: return org.hl7.fhir.r4.model.OperationOutcome.IssueSeverity.WARNING; + case INFORMATION: return org.hl7.fhir.r4.model.OperationOutcome.IssueSeverity.INFORMATION; + default: return org.hl7.fhir.r4.model.OperationOutcome.IssueSeverity.NULL; + } +} + + public static org.hl7.fhir.r5.model.OperationOutcome.IssueType convertIssueType(org.hl7.fhir.r4.model.OperationOutcome.IssueType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case INVALID: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.INVALID; + case STRUCTURE: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.STRUCTURE; + case REQUIRED: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.REQUIRED; + case VALUE: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.VALUE; + case INVARIANT: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.INVARIANT; + case SECURITY: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.SECURITY; + case LOGIN: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.LOGIN; + case UNKNOWN: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.UNKNOWN; + case EXPIRED: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.EXPIRED; + case FORBIDDEN: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.FORBIDDEN; + case SUPPRESSED: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.SUPPRESSED; + case PROCESSING: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.PROCESSING; + case NOTSUPPORTED: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.NOTSUPPORTED; + case DUPLICATE: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.DUPLICATE; + case MULTIPLEMATCHES: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.MULTIPLEMATCHES; + case NOTFOUND: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.NOTFOUND; + case DELETED: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.DELETED; + case TOOLONG: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.TOOLONG; + case CODEINVALID: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.CODEINVALID; + case EXTENSION: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.EXTENSION; + case TOOCOSTLY: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.TOOCOSTLY; + case BUSINESSRULE: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.BUSINESSRULE; + case CONFLICT: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.CONFLICT; + case TRANSIENT: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.TRANSIENT; + case LOCKERROR: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.LOCKERROR; + case NOSTORE: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.NOSTORE; + case EXCEPTION: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.EXCEPTION; + case TIMEOUT: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.TIMEOUT; + case INCOMPLETE: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.INCOMPLETE; + case THROTTLED: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.THROTTLED; + case INFORMATIONAL: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.INFORMATIONAL; + default: return org.hl7.fhir.r5.model.OperationOutcome.IssueType.NULL; + } +} + + public static org.hl7.fhir.r4.model.OperationOutcome.IssueType convertIssueType(org.hl7.fhir.r5.model.OperationOutcome.IssueType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case INVALID: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.INVALID; + case STRUCTURE: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.STRUCTURE; + case REQUIRED: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.REQUIRED; + case VALUE: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.VALUE; + case INVARIANT: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.INVARIANT; + case SECURITY: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.SECURITY; + case LOGIN: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.LOGIN; + case UNKNOWN: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.UNKNOWN; + case EXPIRED: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.EXPIRED; + case FORBIDDEN: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.FORBIDDEN; + case SUPPRESSED: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.SUPPRESSED; + case PROCESSING: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.PROCESSING; + case NOTSUPPORTED: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.NOTSUPPORTED; + case DUPLICATE: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.DUPLICATE; + case MULTIPLEMATCHES: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.MULTIPLEMATCHES; + case NOTFOUND: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.NOTFOUND; + case DELETED: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.DELETED; + case TOOLONG: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.TOOLONG; + case CODEINVALID: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.CODEINVALID; + case EXTENSION: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.EXTENSION; + case TOOCOSTLY: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.TOOCOSTLY; + case BUSINESSRULE: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.BUSINESSRULE; + case CONFLICT: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.CONFLICT; + case TRANSIENT: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.TRANSIENT; + case LOCKERROR: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.LOCKERROR; + case NOSTORE: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.NOSTORE; + case EXCEPTION: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.EXCEPTION; + case TIMEOUT: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.TIMEOUT; + case INCOMPLETE: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.INCOMPLETE; + case THROTTLED: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.THROTTLED; + case INFORMATIONAL: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.INFORMATIONAL; + default: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.NULL; + } +} + + +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Organization.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Organization.java new file mode 100644 index 000000000..ff49b2d70 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Organization.java @@ -0,0 +1,131 @@ +package org.hl7.fhir.convertors.conv40_50; + +import org.hl7.fhir.exceptions.FHIRException; + +import org.hl7.fhir.convertors.VersionConvertor_40_50; + + +/* + Copyright (c) 2011+, HL7, Inc. + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of HL7 nor the names of its contributors may be used to + endorse or promote products derived from this software without specific + prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + +*/ + +// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0 + + +public class Organization extends VersionConvertor_40_50 { + + public static org.hl7.fhir.r5.model.Organization convertOrganization(org.hl7.fhir.r4.model.Organization src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Organization tgt = new org.hl7.fhir.r5.model.Organization(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasActive()) + tgt.setActiveElement(convertBoolean(src.getActiveElement())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getType()) + tgt.addType(convertCodeableConcept(t)); + if (src.hasName()) + tgt.setNameElement(convertString(src.getNameElement())); + for (org.hl7.fhir.r4.model.StringType t : src.getAlias()) + tgt.getAlias().add(convertString(t)); + for (org.hl7.fhir.r4.model.ContactPoint t : src.getTelecom()) + tgt.addTelecom(convertContactPoint(t)); + for (org.hl7.fhir.r4.model.Address t : src.getAddress()) + tgt.addAddress(convertAddress(t)); + if (src.hasPartOf()) + tgt.setPartOf(convertReference(src.getPartOf())); + for (org.hl7.fhir.r4.model.Organization.OrganizationContactComponent t : src.getContact()) + tgt.addContact(convertOrganizationContactComponent(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getEndpoint()) + tgt.addEndpoint(convertReference(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.Organization convertOrganization(org.hl7.fhir.r5.model.Organization src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Organization tgt = new org.hl7.fhir.r4.model.Organization(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasActive()) + tgt.setActiveElement(convertBoolean(src.getActiveElement())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getType()) + tgt.addType(convertCodeableConcept(t)); + if (src.hasName()) + tgt.setNameElement(convertString(src.getNameElement())); + for (org.hl7.fhir.r5.model.StringType t : src.getAlias()) + tgt.getAlias().add(convertString(t)); + for (org.hl7.fhir.r5.model.ContactPoint t : src.getTelecom()) + tgt.addTelecom(convertContactPoint(t)); + for (org.hl7.fhir.r5.model.Address t : src.getAddress()) + tgt.addAddress(convertAddress(t)); + if (src.hasPartOf()) + tgt.setPartOf(convertReference(src.getPartOf())); + for (org.hl7.fhir.r5.model.Organization.OrganizationContactComponent t : src.getContact()) + tgt.addContact(convertOrganizationContactComponent(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getEndpoint()) + tgt.addEndpoint(convertReference(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.Organization.OrganizationContactComponent convertOrganizationContactComponent(org.hl7.fhir.r4.model.Organization.OrganizationContactComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Organization.OrganizationContactComponent tgt = new org.hl7.fhir.r5.model.Organization.OrganizationContactComponent(); + copyElement(src, tgt); + if (src.hasPurpose()) + tgt.setPurpose(convertCodeableConcept(src.getPurpose())); + if (src.hasName()) + tgt.setName(convertHumanName(src.getName())); + for (org.hl7.fhir.r4.model.ContactPoint t : src.getTelecom()) + tgt.addTelecom(convertContactPoint(t)); + if (src.hasAddress()) + tgt.setAddress(convertAddress(src.getAddress())); + return tgt; + } + + public static org.hl7.fhir.r4.model.Organization.OrganizationContactComponent convertOrganizationContactComponent(org.hl7.fhir.r5.model.Organization.OrganizationContactComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Organization.OrganizationContactComponent tgt = new org.hl7.fhir.r4.model.Organization.OrganizationContactComponent(); + copyElement(src, tgt); + if (src.hasPurpose()) + tgt.setPurpose(convertCodeableConcept(src.getPurpose())); + if (src.hasName()) + tgt.setName(convertHumanName(src.getName())); + for (org.hl7.fhir.r5.model.ContactPoint t : src.getTelecom()) + tgt.addTelecom(convertContactPoint(t)); + if (src.hasAddress()) + tgt.setAddress(convertAddress(src.getAddress())); + return tgt; + } + + +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/OrganizationAffiliation.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/OrganizationAffiliation.java new file mode 100644 index 000000000..deb085517 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/OrganizationAffiliation.java @@ -0,0 +1,107 @@ +package org.hl7.fhir.convertors.conv40_50; + +import org.hl7.fhir.exceptions.FHIRException; + +import org.hl7.fhir.convertors.VersionConvertor_40_50; + + +/* + Copyright (c) 2011+, HL7, Inc. + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of HL7 nor the names of its contributors may be used to + endorse or promote products derived from this software without specific + prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + +*/ + +// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0 + + +public class OrganizationAffiliation extends VersionConvertor_40_50 { + + public static org.hl7.fhir.r5.model.OrganizationAffiliation convertOrganizationAffiliation(org.hl7.fhir.r4.model.OrganizationAffiliation src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.OrganizationAffiliation tgt = new org.hl7.fhir.r5.model.OrganizationAffiliation(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasActive()) + tgt.setActiveElement(convertBoolean(src.getActiveElement())); + if (src.hasPeriod()) + tgt.setPeriod(convertPeriod(src.getPeriod())); + if (src.hasOrganization()) + tgt.setOrganization(convertReference(src.getOrganization())); + if (src.hasParticipatingOrganization()) + tgt.setParticipatingOrganization(convertReference(src.getParticipatingOrganization())); + for (org.hl7.fhir.r4.model.Reference t : src.getNetwork()) + tgt.addNetwork(convertReference(t)); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getCode()) + tgt.addCode(convertCodeableConcept(t)); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getSpecialty()) + tgt.addSpecialty(convertCodeableConcept(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getLocation()) + tgt.addLocation(convertReference(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getHealthcareService()) + tgt.addHealthcareService(convertReference(t)); + for (org.hl7.fhir.r4.model.ContactPoint t : src.getTelecom()) + tgt.addTelecom(convertContactPoint(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getEndpoint()) + tgt.addEndpoint(convertReference(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.OrganizationAffiliation convertOrganizationAffiliation(org.hl7.fhir.r5.model.OrganizationAffiliation src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.OrganizationAffiliation tgt = new org.hl7.fhir.r4.model.OrganizationAffiliation(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasActive()) + tgt.setActiveElement(convertBoolean(src.getActiveElement())); + if (src.hasPeriod()) + tgt.setPeriod(convertPeriod(src.getPeriod())); + if (src.hasOrganization()) + tgt.setOrganization(convertReference(src.getOrganization())); + if (src.hasParticipatingOrganization()) + tgt.setParticipatingOrganization(convertReference(src.getParticipatingOrganization())); + for (org.hl7.fhir.r5.model.Reference t : src.getNetwork()) + tgt.addNetwork(convertReference(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getCode()) + tgt.addCode(convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getSpecialty()) + tgt.addSpecialty(convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getLocation()) + tgt.addLocation(convertReference(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getHealthcareService()) + tgt.addHealthcareService(convertReference(t)); + for (org.hl7.fhir.r5.model.ContactPoint t : src.getTelecom()) + tgt.addTelecom(convertContactPoint(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getEndpoint()) + tgt.addEndpoint(convertReference(t)); + return tgt; + } + + +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Parameters.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Parameters.java new file mode 100644 index 000000000..c01b5acaa --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Parameters.java @@ -0,0 +1,94 @@ +package org.hl7.fhir.convertors.conv40_50; + +import org.hl7.fhir.exceptions.FHIRException; + +import org.hl7.fhir.convertors.VersionConvertor_40_50; + + +/* + Copyright (c) 2011+, HL7, Inc. + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of HL7 nor the names of its contributors may be used to + endorse or promote products derived from this software without specific + prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + +*/ + +// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0 + + +public class Parameters extends VersionConvertor_40_50 { + + public static org.hl7.fhir.r5.model.Parameters convertParameters(org.hl7.fhir.r4.model.Parameters src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Parameters tgt = new org.hl7.fhir.r5.model.Parameters(); + copyResource(src, tgt); + for (org.hl7.fhir.r4.model.Parameters.ParametersParameterComponent t : src.getParameter()) + tgt.addParameter(convertParametersParameterComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.Parameters convertParameters(org.hl7.fhir.r5.model.Parameters src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Parameters tgt = new org.hl7.fhir.r4.model.Parameters(); + copyResource(src, tgt); + for (org.hl7.fhir.r5.model.Parameters.ParametersParameterComponent t : src.getParameter()) + tgt.addParameter(convertParametersParameterComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.Parameters.ParametersParameterComponent convertParametersParameterComponent(org.hl7.fhir.r4.model.Parameters.ParametersParameterComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Parameters.ParametersParameterComponent tgt = new org.hl7.fhir.r5.model.Parameters.ParametersParameterComponent(); + copyElement(src, tgt); + if (src.hasName()) + tgt.setNameElement(convertString(src.getNameElement())); + if (src.hasValue()) + tgt.setValue(convertType(src.getValue())); + if (src.hasResource()) + tgt.setResource(convertResource(src.getResource())); + for (org.hl7.fhir.r4.model.Parameters.ParametersParameterComponent t : src.getPart()) + tgt.addPart(convertParametersParameterComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.Parameters.ParametersParameterComponent convertParametersParameterComponent(org.hl7.fhir.r5.model.Parameters.ParametersParameterComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Parameters.ParametersParameterComponent tgt = new org.hl7.fhir.r4.model.Parameters.ParametersParameterComponent(); + copyElement(src, tgt); + if (src.hasName()) + tgt.setNameElement(convertString(src.getNameElement())); + if (src.hasValue()) + tgt.setValue(convertType(src.getValue())); + if (src.hasResource()) + tgt.setResource(convertResource(src.getResource())); + for (org.hl7.fhir.r5.model.Parameters.ParametersParameterComponent t : src.getPart()) + tgt.addPart(convertParametersParameterComponent(t)); + return tgt; + } + +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Patient.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Patient.java new file mode 100644 index 000000000..ba2619aff --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Patient.java @@ -0,0 +1,239 @@ +package org.hl7.fhir.convertors.conv40_50; + +import org.hl7.fhir.exceptions.FHIRException; + +import org.hl7.fhir.convertors.VersionConvertor_40_50; + + +/* + Copyright (c) 2011+, HL7, Inc. + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of HL7 nor the names of its contributors may be used to + endorse or promote products derived from this software without specific + prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + +*/ + +// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0 + + +public class Patient extends VersionConvertor_40_50 { + + public static org.hl7.fhir.r5.model.Patient convertPatient(org.hl7.fhir.r4.model.Patient src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Patient tgt = new org.hl7.fhir.r5.model.Patient(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasActive()) + tgt.setActiveElement(convertBoolean(src.getActiveElement())); + for (org.hl7.fhir.r4.model.HumanName t : src.getName()) + tgt.addName(convertHumanName(t)); + for (org.hl7.fhir.r4.model.ContactPoint t : src.getTelecom()) + tgt.addTelecom(convertContactPoint(t)); + if (src.hasGender()) + tgt.setGender(Enumerations.convertAdministrativeGender(src.getGender())); + if (src.hasBirthDate()) + tgt.setBirthDateElement(convertDate(src.getBirthDateElement())); + if (src.hasDeceased()) + tgt.setDeceased(convertType(src.getDeceased())); + for (org.hl7.fhir.r4.model.Address t : src.getAddress()) + tgt.addAddress(convertAddress(t)); + if (src.hasMaritalStatus()) + tgt.setMaritalStatus(convertCodeableConcept(src.getMaritalStatus())); + if (src.hasMultipleBirth()) + tgt.setMultipleBirth(convertType(src.getMultipleBirth())); + for (org.hl7.fhir.r4.model.Attachment t : src.getPhoto()) + tgt.addPhoto(convertAttachment(t)); + for (org.hl7.fhir.r4.model.Patient.ContactComponent t : src.getContact()) + tgt.addContact(convertContactComponent(t)); + for (org.hl7.fhir.r4.model.Patient.PatientCommunicationComponent t : src.getCommunication()) + tgt.addCommunication(convertPatientCommunicationComponent(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getGeneralPractitioner()) + tgt.addGeneralPractitioner(convertReference(t)); + if (src.hasManagingOrganization()) + tgt.setManagingOrganization(convertReference(src.getManagingOrganization())); + for (org.hl7.fhir.r4.model.Patient.PatientLinkComponent t : src.getLink()) + tgt.addLink(convertPatientLinkComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.Patient convertPatient(org.hl7.fhir.r5.model.Patient src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Patient tgt = new org.hl7.fhir.r4.model.Patient(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasActive()) + tgt.setActiveElement(convertBoolean(src.getActiveElement())); + for (org.hl7.fhir.r5.model.HumanName t : src.getName()) + tgt.addName(convertHumanName(t)); + for (org.hl7.fhir.r5.model.ContactPoint t : src.getTelecom()) + tgt.addTelecom(convertContactPoint(t)); + if (src.hasGender()) + tgt.setGender(Enumerations.convertAdministrativeGender(src.getGender())); + if (src.hasBirthDate()) + tgt.setBirthDateElement(convertDate(src.getBirthDateElement())); + if (src.hasDeceased()) + tgt.setDeceased(convertType(src.getDeceased())); + for (org.hl7.fhir.r5.model.Address t : src.getAddress()) + tgt.addAddress(convertAddress(t)); + if (src.hasMaritalStatus()) + tgt.setMaritalStatus(convertCodeableConcept(src.getMaritalStatus())); + if (src.hasMultipleBirth()) + tgt.setMultipleBirth(convertType(src.getMultipleBirth())); + for (org.hl7.fhir.r5.model.Attachment t : src.getPhoto()) + tgt.addPhoto(convertAttachment(t)); + for (org.hl7.fhir.r5.model.Patient.ContactComponent t : src.getContact()) + tgt.addContact(convertContactComponent(t)); + for (org.hl7.fhir.r5.model.Patient.PatientCommunicationComponent t : src.getCommunication()) + tgt.addCommunication(convertPatientCommunicationComponent(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getGeneralPractitioner()) + tgt.addGeneralPractitioner(convertReference(t)); + if (src.hasManagingOrganization()) + tgt.setManagingOrganization(convertReference(src.getManagingOrganization())); + for (org.hl7.fhir.r5.model.Patient.PatientLinkComponent t : src.getLink()) + tgt.addLink(convertPatientLinkComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.Patient.ContactComponent convertContactComponent(org.hl7.fhir.r4.model.Patient.ContactComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Patient.ContactComponent tgt = new org.hl7.fhir.r5.model.Patient.ContactComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getRelationship()) + tgt.addRelationship(convertCodeableConcept(t)); + if (src.hasName()) + tgt.setName(convertHumanName(src.getName())); + for (org.hl7.fhir.r4.model.ContactPoint t : src.getTelecom()) + tgt.addTelecom(convertContactPoint(t)); + if (src.hasAddress()) + tgt.setAddress(convertAddress(src.getAddress())); + if (src.hasGender()) + tgt.setGender(Enumerations.convertAdministrativeGender(src.getGender())); + if (src.hasOrganization()) + tgt.setOrganization(convertReference(src.getOrganization())); + if (src.hasPeriod()) + tgt.setPeriod(convertPeriod(src.getPeriod())); + return tgt; + } + + public static org.hl7.fhir.r4.model.Patient.ContactComponent convertContactComponent(org.hl7.fhir.r5.model.Patient.ContactComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Patient.ContactComponent tgt = new org.hl7.fhir.r4.model.Patient.ContactComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getRelationship()) + tgt.addRelationship(convertCodeableConcept(t)); + if (src.hasName()) + tgt.setName(convertHumanName(src.getName())); + for (org.hl7.fhir.r5.model.ContactPoint t : src.getTelecom()) + tgt.addTelecom(convertContactPoint(t)); + if (src.hasAddress()) + tgt.setAddress(convertAddress(src.getAddress())); + if (src.hasGender()) + tgt.setGender(Enumerations.convertAdministrativeGender(src.getGender())); + if (src.hasOrganization()) + tgt.setOrganization(convertReference(src.getOrganization())); + if (src.hasPeriod()) + tgt.setPeriod(convertPeriod(src.getPeriod())); + return tgt; + } + + public static org.hl7.fhir.r5.model.Patient.PatientCommunicationComponent convertPatientCommunicationComponent(org.hl7.fhir.r4.model.Patient.PatientCommunicationComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Patient.PatientCommunicationComponent tgt = new org.hl7.fhir.r5.model.Patient.PatientCommunicationComponent(); + copyElement(src, tgt); + if (src.hasLanguage()) + tgt.setLanguage(convertCodeableConcept(src.getLanguage())); + if (src.hasPreferred()) + tgt.setPreferredElement(convertBoolean(src.getPreferredElement())); + return tgt; + } + + public static org.hl7.fhir.r4.model.Patient.PatientCommunicationComponent convertPatientCommunicationComponent(org.hl7.fhir.r5.model.Patient.PatientCommunicationComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Patient.PatientCommunicationComponent tgt = new org.hl7.fhir.r4.model.Patient.PatientCommunicationComponent(); + copyElement(src, tgt); + if (src.hasLanguage()) + tgt.setLanguage(convertCodeableConcept(src.getLanguage())); + if (src.hasPreferred()) + tgt.setPreferredElement(convertBoolean(src.getPreferredElement())); + return tgt; + } + + public static org.hl7.fhir.r5.model.Patient.PatientLinkComponent convertPatientLinkComponent(org.hl7.fhir.r4.model.Patient.PatientLinkComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Patient.PatientLinkComponent tgt = new org.hl7.fhir.r5.model.Patient.PatientLinkComponent(); + copyElement(src, tgt); + if (src.hasOther()) + tgt.setOther(convertReference(src.getOther())); + if (src.hasType()) + tgt.setType(convertLinkType(src.getType())); + return tgt; + } + + public static org.hl7.fhir.r4.model.Patient.PatientLinkComponent convertPatientLinkComponent(org.hl7.fhir.r5.model.Patient.PatientLinkComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Patient.PatientLinkComponent tgt = new org.hl7.fhir.r4.model.Patient.PatientLinkComponent(); + copyElement(src, tgt); + if (src.hasOther()) + tgt.setOther(convertReference(src.getOther())); + if (src.hasType()) + tgt.setType(convertLinkType(src.getType())); + return tgt; + } + + public static org.hl7.fhir.r5.model.Patient.LinkType convertLinkType(org.hl7.fhir.r4.model.Patient.LinkType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case REPLACEDBY: return org.hl7.fhir.r5.model.Patient.LinkType.REPLACEDBY; + case REPLACES: return org.hl7.fhir.r5.model.Patient.LinkType.REPLACES; + case REFER: return org.hl7.fhir.r5.model.Patient.LinkType.REFER; + case SEEALSO: return org.hl7.fhir.r5.model.Patient.LinkType.SEEALSO; + default: return org.hl7.fhir.r5.model.Patient.LinkType.NULL; + } +} + + public static org.hl7.fhir.r4.model.Patient.LinkType convertLinkType(org.hl7.fhir.r5.model.Patient.LinkType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case REPLACEDBY: return org.hl7.fhir.r4.model.Patient.LinkType.REPLACEDBY; + case REPLACES: return org.hl7.fhir.r4.model.Patient.LinkType.REPLACES; + case REFER: return org.hl7.fhir.r4.model.Patient.LinkType.REFER; + case SEEALSO: return org.hl7.fhir.r4.model.Patient.LinkType.SEEALSO; + default: return org.hl7.fhir.r4.model.Patient.LinkType.NULL; + } +} + + +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/PaymentNotice.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/PaymentNotice.java new file mode 100644 index 000000000..242b2decb --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/PaymentNotice.java @@ -0,0 +1,131 @@ +package org.hl7.fhir.convertors.conv40_50; + +import org.hl7.fhir.exceptions.FHIRException; + +import org.hl7.fhir.convertors.VersionConvertor_40_50; + + +/* + Copyright (c) 2011+, HL7, Inc. + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of HL7 nor the names of its contributors may be used to + endorse or promote products derived from this software without specific + prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + +*/ + +// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0 + + +public class PaymentNotice extends VersionConvertor_40_50 { + + public static org.hl7.fhir.r5.model.PaymentNotice convertPaymentNotice(org.hl7.fhir.r4.model.PaymentNotice src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.PaymentNotice tgt = new org.hl7.fhir.r5.model.PaymentNotice(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasStatus()) + tgt.setStatus(convertPaymentNoticeStatus(src.getStatus())); + if (src.hasRequest()) + tgt.setRequest(convertReference(src.getRequest())); + if (src.hasResponse()) + tgt.setResponse(convertReference(src.getResponse())); + if (src.hasCreated()) + tgt.setCreatedElement(convertDateTime(src.getCreatedElement())); + if (src.hasProvider()) + tgt.setProvider(convertReference(src.getProvider())); + if (src.hasPayment()) + tgt.setPayment(convertReference(src.getPayment())); + if (src.hasPaymentDate()) + tgt.setPaymentDateElement(convertDate(src.getPaymentDateElement())); + if (src.hasPayee()) + tgt.setPayee(convertReference(src.getPayee())); + if (src.hasRecipient()) + tgt.setRecipient(convertReference(src.getRecipient())); + if (src.hasAmount()) + tgt.setAmount(convertMoney(src.getAmount())); + if (src.hasPaymentStatus()) + tgt.setPaymentStatus(convertCodeableConcept(src.getPaymentStatus())); + return tgt; + } + + public static org.hl7.fhir.r4.model.PaymentNotice convertPaymentNotice(org.hl7.fhir.r5.model.PaymentNotice src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.PaymentNotice tgt = new org.hl7.fhir.r4.model.PaymentNotice(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasStatus()) + tgt.setStatus(convertPaymentNoticeStatus(src.getStatus())); + if (src.hasRequest()) + tgt.setRequest(convertReference(src.getRequest())); + if (src.hasResponse()) + tgt.setResponse(convertReference(src.getResponse())); + if (src.hasCreated()) + tgt.setCreatedElement(convertDateTime(src.getCreatedElement())); + if (src.hasProvider()) + tgt.setProvider(convertReference(src.getProvider())); + if (src.hasPayment()) + tgt.setPayment(convertReference(src.getPayment())); + if (src.hasPaymentDate()) + tgt.setPaymentDateElement(convertDate(src.getPaymentDateElement())); + if (src.hasPayee()) + tgt.setPayee(convertReference(src.getPayee())); + if (src.hasRecipient()) + tgt.setRecipient(convertReference(src.getRecipient())); + if (src.hasAmount()) + tgt.setAmount(convertMoney(src.getAmount())); + if (src.hasPaymentStatus()) + tgt.setPaymentStatus(convertCodeableConcept(src.getPaymentStatus())); + return tgt; + } + + public static org.hl7.fhir.r5.model.PaymentNotice.PaymentNoticeStatus convertPaymentNoticeStatus(org.hl7.fhir.r4.model.PaymentNotice.PaymentNoticeStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case ACTIVE: return org.hl7.fhir.r5.model.PaymentNotice.PaymentNoticeStatus.ACTIVE; + case CANCELLED: return org.hl7.fhir.r5.model.PaymentNotice.PaymentNoticeStatus.CANCELLED; + case DRAFT: return org.hl7.fhir.r5.model.PaymentNotice.PaymentNoticeStatus.DRAFT; + case ENTEREDINERROR: return org.hl7.fhir.r5.model.PaymentNotice.PaymentNoticeStatus.ENTEREDINERROR; + default: return org.hl7.fhir.r5.model.PaymentNotice.PaymentNoticeStatus.NULL; + } +} + + public static org.hl7.fhir.r4.model.PaymentNotice.PaymentNoticeStatus convertPaymentNoticeStatus(org.hl7.fhir.r5.model.PaymentNotice.PaymentNoticeStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case ACTIVE: return org.hl7.fhir.r4.model.PaymentNotice.PaymentNoticeStatus.ACTIVE; + case CANCELLED: return org.hl7.fhir.r4.model.PaymentNotice.PaymentNoticeStatus.CANCELLED; + case DRAFT: return org.hl7.fhir.r4.model.PaymentNotice.PaymentNoticeStatus.DRAFT; + case ENTEREDINERROR: return org.hl7.fhir.r4.model.PaymentNotice.PaymentNoticeStatus.ENTEREDINERROR; + default: return org.hl7.fhir.r4.model.PaymentNotice.PaymentNoticeStatus.NULL; + } +} + + +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/PaymentReconciliation.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/PaymentReconciliation.java new file mode 100644 index 000000000..6f4b52d9a --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/PaymentReconciliation.java @@ -0,0 +1,247 @@ +package org.hl7.fhir.convertors.conv40_50; + +import org.hl7.fhir.exceptions.FHIRException; + +import org.hl7.fhir.convertors.VersionConvertor_40_50; + + +/* + Copyright (c) 2011+, HL7, Inc. + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of HL7 nor the names of its contributors may be used to + endorse or promote products derived from this software without specific + prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + +*/ + +// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0 + + +public class PaymentReconciliation extends VersionConvertor_40_50 { + + public static org.hl7.fhir.r5.model.PaymentReconciliation convertPaymentReconciliation(org.hl7.fhir.r4.model.PaymentReconciliation src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.PaymentReconciliation tgt = new org.hl7.fhir.r5.model.PaymentReconciliation(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasStatus()) + tgt.setStatus(convertPaymentReconciliationStatus(src.getStatus())); + if (src.hasPeriod()) + tgt.setPeriod(convertPeriod(src.getPeriod())); + if (src.hasCreated()) + tgt.setCreatedElement(convertDateTime(src.getCreatedElement())); + if (src.hasPaymentIssuer()) + tgt.setPaymentIssuer(convertReference(src.getPaymentIssuer())); + if (src.hasRequest()) + tgt.setRequest(convertReference(src.getRequest())); + if (src.hasRequestor()) + tgt.setRequestor(convertReference(src.getRequestor())); + if (src.hasOutcome()) + tgt.setOutcome(convertRemittanceOutcome(src.getOutcome())); + if (src.hasDisposition()) + tgt.setDispositionElement(convertString(src.getDispositionElement())); + if (src.hasPaymentDate()) + tgt.setPaymentDateElement(convertDate(src.getPaymentDateElement())); + if (src.hasPaymentAmount()) + tgt.setPaymentAmount(convertMoney(src.getPaymentAmount())); + if (src.hasPaymentIdentifier()) + tgt.setPaymentIdentifier(convertIdentifier(src.getPaymentIdentifier())); + for (org.hl7.fhir.r4.model.PaymentReconciliation.DetailsComponent t : src.getDetail()) + tgt.addDetail(convertDetailsComponent(t)); + if (src.hasFormCode()) + tgt.setFormCode(convertCodeableConcept(src.getFormCode())); + for (org.hl7.fhir.r4.model.PaymentReconciliation.NotesComponent t : src.getProcessNote()) + tgt.addProcessNote(convertNotesComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.PaymentReconciliation convertPaymentReconciliation(org.hl7.fhir.r5.model.PaymentReconciliation src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.PaymentReconciliation tgt = new org.hl7.fhir.r4.model.PaymentReconciliation(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasStatus()) + tgt.setStatus(convertPaymentReconciliationStatus(src.getStatus())); + if (src.hasPeriod()) + tgt.setPeriod(convertPeriod(src.getPeriod())); + if (src.hasCreated()) + tgt.setCreatedElement(convertDateTime(src.getCreatedElement())); + if (src.hasPaymentIssuer()) + tgt.setPaymentIssuer(convertReference(src.getPaymentIssuer())); + if (src.hasRequest()) + tgt.setRequest(convertReference(src.getRequest())); + if (src.hasRequestor()) + tgt.setRequestor(convertReference(src.getRequestor())); + if (src.hasOutcome()) + tgt.setOutcome(convertRemittanceOutcome(src.getOutcome())); + if (src.hasDisposition()) + tgt.setDispositionElement(convertString(src.getDispositionElement())); + if (src.hasPaymentDate()) + tgt.setPaymentDateElement(convertDate(src.getPaymentDateElement())); + if (src.hasPaymentAmount()) + tgt.setPaymentAmount(convertMoney(src.getPaymentAmount())); + if (src.hasPaymentIdentifier()) + tgt.setPaymentIdentifier(convertIdentifier(src.getPaymentIdentifier())); + for (org.hl7.fhir.r5.model.PaymentReconciliation.DetailsComponent t : src.getDetail()) + tgt.addDetail(convertDetailsComponent(t)); + if (src.hasFormCode()) + tgt.setFormCode(convertCodeableConcept(src.getFormCode())); + for (org.hl7.fhir.r5.model.PaymentReconciliation.NotesComponent t : src.getProcessNote()) + tgt.addProcessNote(convertNotesComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.PaymentReconciliation.PaymentReconciliationStatus convertPaymentReconciliationStatus(org.hl7.fhir.r4.model.PaymentReconciliation.PaymentReconciliationStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case ACTIVE: return org.hl7.fhir.r5.model.PaymentReconciliation.PaymentReconciliationStatus.ACTIVE; + case CANCELLED: return org.hl7.fhir.r5.model.PaymentReconciliation.PaymentReconciliationStatus.CANCELLED; + case DRAFT: return org.hl7.fhir.r5.model.PaymentReconciliation.PaymentReconciliationStatus.DRAFT; + case ENTEREDINERROR: return org.hl7.fhir.r5.model.PaymentReconciliation.PaymentReconciliationStatus.ENTEREDINERROR; + default: return org.hl7.fhir.r5.model.PaymentReconciliation.PaymentReconciliationStatus.NULL; + } +} + + public static org.hl7.fhir.r4.model.PaymentReconciliation.PaymentReconciliationStatus convertPaymentReconciliationStatus(org.hl7.fhir.r5.model.PaymentReconciliation.PaymentReconciliationStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case ACTIVE: return org.hl7.fhir.r4.model.PaymentReconciliation.PaymentReconciliationStatus.ACTIVE; + case CANCELLED: return org.hl7.fhir.r4.model.PaymentReconciliation.PaymentReconciliationStatus.CANCELLED; + case DRAFT: return org.hl7.fhir.r4.model.PaymentReconciliation.PaymentReconciliationStatus.DRAFT; + case ENTEREDINERROR: return org.hl7.fhir.r4.model.PaymentReconciliation.PaymentReconciliationStatus.ENTEREDINERROR; + default: return org.hl7.fhir.r4.model.PaymentReconciliation.PaymentReconciliationStatus.NULL; + } +} + + public static org.hl7.fhir.r5.model.Enumerations.RemittanceOutcome convertRemittanceOutcome(org.hl7.fhir.r4.model.Enumerations.RemittanceOutcome src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case QUEUED: return org.hl7.fhir.r5.model.Enumerations.RemittanceOutcome.QUEUED; + case COMPLETE: return org.hl7.fhir.r5.model.Enumerations.RemittanceOutcome.COMPLETE; + case ERROR: return org.hl7.fhir.r5.model.Enumerations.RemittanceOutcome.ERROR; + case PARTIAL: return org.hl7.fhir.r5.model.Enumerations.RemittanceOutcome.PARTIAL; + default: return org.hl7.fhir.r5.model.Enumerations.RemittanceOutcome.NULL; + } +} + + public static org.hl7.fhir.r4.model.Enumerations.RemittanceOutcome convertRemittanceOutcome(org.hl7.fhir.r5.model.Enumerations.RemittanceOutcome src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case QUEUED: return org.hl7.fhir.r4.model.Enumerations.RemittanceOutcome.QUEUED; + case COMPLETE: return org.hl7.fhir.r4.model.Enumerations.RemittanceOutcome.COMPLETE; + case ERROR: return org.hl7.fhir.r4.model.Enumerations.RemittanceOutcome.ERROR; + case PARTIAL: return org.hl7.fhir.r4.model.Enumerations.RemittanceOutcome.PARTIAL; + default: return org.hl7.fhir.r4.model.Enumerations.RemittanceOutcome.NULL; + } +} + + public static org.hl7.fhir.r5.model.PaymentReconciliation.DetailsComponent convertDetailsComponent(org.hl7.fhir.r4.model.PaymentReconciliation.DetailsComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.PaymentReconciliation.DetailsComponent tgt = new org.hl7.fhir.r5.model.PaymentReconciliation.DetailsComponent(); + copyElement(src, tgt); + if (src.hasIdentifier()) + tgt.setIdentifier(convertIdentifier(src.getIdentifier())); + if (src.hasPredecessor()) + tgt.setPredecessor(convertIdentifier(src.getPredecessor())); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + if (src.hasRequest()) + tgt.setRequest(convertReference(src.getRequest())); + if (src.hasSubmitter()) + tgt.setSubmitter(convertReference(src.getSubmitter())); + if (src.hasResponse()) + tgt.setResponse(convertReference(src.getResponse())); + if (src.hasDate()) + tgt.setDateElement(convertDate(src.getDateElement())); + if (src.hasResponsible()) + tgt.setResponsible(convertReference(src.getResponsible())); + if (src.hasPayee()) + tgt.setPayee(convertReference(src.getPayee())); + if (src.hasAmount()) + tgt.setAmount(convertMoney(src.getAmount())); + return tgt; + } + + public static org.hl7.fhir.r4.model.PaymentReconciliation.DetailsComponent convertDetailsComponent(org.hl7.fhir.r5.model.PaymentReconciliation.DetailsComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.PaymentReconciliation.DetailsComponent tgt = new org.hl7.fhir.r4.model.PaymentReconciliation.DetailsComponent(); + copyElement(src, tgt); + if (src.hasIdentifier()) + tgt.setIdentifier(convertIdentifier(src.getIdentifier())); + if (src.hasPredecessor()) + tgt.setPredecessor(convertIdentifier(src.getPredecessor())); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + if (src.hasRequest()) + tgt.setRequest(convertReference(src.getRequest())); + if (src.hasSubmitter()) + tgt.setSubmitter(convertReference(src.getSubmitter())); + if (src.hasResponse()) + tgt.setResponse(convertReference(src.getResponse())); + if (src.hasDate()) + tgt.setDateElement(convertDate(src.getDateElement())); + if (src.hasResponsible()) + tgt.setResponsible(convertReference(src.getResponsible())); + if (src.hasPayee()) + tgt.setPayee(convertReference(src.getPayee())); + if (src.hasAmount()) + tgt.setAmount(convertMoney(src.getAmount())); + return tgt; + } + + public static org.hl7.fhir.r5.model.PaymentReconciliation.NotesComponent convertNotesComponent(org.hl7.fhir.r4.model.PaymentReconciliation.NotesComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.PaymentReconciliation.NotesComponent tgt = new org.hl7.fhir.r5.model.PaymentReconciliation.NotesComponent(); + copyElement(src, tgt); + if (src.hasType()) + tgt.setType(Enumerations.convertNoteType(src.getType())); + if (src.hasText()) + tgt.setTextElement(convertString(src.getTextElement())); + return tgt; + } + + public static org.hl7.fhir.r4.model.PaymentReconciliation.NotesComponent convertNotesComponent(org.hl7.fhir.r5.model.PaymentReconciliation.NotesComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.PaymentReconciliation.NotesComponent tgt = new org.hl7.fhir.r4.model.PaymentReconciliation.NotesComponent(); + copyElement(src, tgt); + if (src.hasType()) + tgt.setType(Enumerations.convertNoteType(src.getType())); + if (src.hasText()) + tgt.setTextElement(convertString(src.getTextElement())); + return tgt; + } + + +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Person.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Person.java new file mode 100644 index 000000000..059b0e27e --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Person.java @@ -0,0 +1,147 @@ +package org.hl7.fhir.convertors.conv40_50; + +import org.hl7.fhir.exceptions.FHIRException; + +import org.hl7.fhir.convertors.VersionConvertor_40_50; + + +/* + Copyright (c) 2011+, HL7, Inc. + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of HL7 nor the names of its contributors may be used to + endorse or promote products derived from this software without specific + prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + +*/ + +// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0 + + +public class Person extends VersionConvertor_40_50 { + + public static org.hl7.fhir.r5.model.Person convertPerson(org.hl7.fhir.r4.model.Person src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Person tgt = new org.hl7.fhir.r5.model.Person(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + for (org.hl7.fhir.r4.model.HumanName t : src.getName()) + tgt.addName(convertHumanName(t)); + for (org.hl7.fhir.r4.model.ContactPoint t : src.getTelecom()) + tgt.addTelecom(convertContactPoint(t)); + if (src.hasGender()) + tgt.setGender(Enumerations.convertAdministrativeGender(src.getGender())); + if (src.hasBirthDate()) + tgt.setBirthDateElement(convertDate(src.getBirthDateElement())); + for (org.hl7.fhir.r4.model.Address t : src.getAddress()) + tgt.addAddress(convertAddress(t)); + if (src.hasPhoto()) + tgt.setPhoto(convertAttachment(src.getPhoto())); + if (src.hasManagingOrganization()) + tgt.setManagingOrganization(convertReference(src.getManagingOrganization())); + if (src.hasActive()) + tgt.setActiveElement(convertBoolean(src.getActiveElement())); + for (org.hl7.fhir.r4.model.Person.PersonLinkComponent t : src.getLink()) + tgt.addLink(convertPersonLinkComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.Person convertPerson(org.hl7.fhir.r5.model.Person src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Person tgt = new org.hl7.fhir.r4.model.Person(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + for (org.hl7.fhir.r5.model.HumanName t : src.getName()) + tgt.addName(convertHumanName(t)); + for (org.hl7.fhir.r5.model.ContactPoint t : src.getTelecom()) + tgt.addTelecom(convertContactPoint(t)); + if (src.hasGender()) + tgt.setGender(Enumerations.convertAdministrativeGender(src.getGender())); + if (src.hasBirthDate()) + tgt.setBirthDateElement(convertDate(src.getBirthDateElement())); + for (org.hl7.fhir.r5.model.Address t : src.getAddress()) + tgt.addAddress(convertAddress(t)); + if (src.hasPhoto()) + tgt.setPhoto(convertAttachment(src.getPhoto())); + if (src.hasManagingOrganization()) + tgt.setManagingOrganization(convertReference(src.getManagingOrganization())); + if (src.hasActive()) + tgt.setActiveElement(convertBoolean(src.getActiveElement())); + for (org.hl7.fhir.r5.model.Person.PersonLinkComponent t : src.getLink()) + tgt.addLink(convertPersonLinkComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.Person.PersonLinkComponent convertPersonLinkComponent(org.hl7.fhir.r4.model.Person.PersonLinkComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Person.PersonLinkComponent tgt = new org.hl7.fhir.r5.model.Person.PersonLinkComponent(); + copyElement(src, tgt); + if (src.hasTarget()) + tgt.setTarget(convertReference(src.getTarget())); + if (src.hasAssurance()) + tgt.setAssurance(convertIdentityAssuranceLevel(src.getAssurance())); + return tgt; + } + + public static org.hl7.fhir.r4.model.Person.PersonLinkComponent convertPersonLinkComponent(org.hl7.fhir.r5.model.Person.PersonLinkComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Person.PersonLinkComponent tgt = new org.hl7.fhir.r4.model.Person.PersonLinkComponent(); + copyElement(src, tgt); + if (src.hasTarget()) + tgt.setTarget(convertReference(src.getTarget())); + if (src.hasAssurance()) + tgt.setAssurance(convertIdentityAssuranceLevel(src.getAssurance())); + return tgt; + } + + public static org.hl7.fhir.r5.model.Person.IdentityAssuranceLevel convertIdentityAssuranceLevel(org.hl7.fhir.r4.model.Person.IdentityAssuranceLevel src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case LEVEL1: return org.hl7.fhir.r5.model.Person.IdentityAssuranceLevel.LEVEL1; + case LEVEL2: return org.hl7.fhir.r5.model.Person.IdentityAssuranceLevel.LEVEL2; + case LEVEL3: return org.hl7.fhir.r5.model.Person.IdentityAssuranceLevel.LEVEL3; + case LEVEL4: return org.hl7.fhir.r5.model.Person.IdentityAssuranceLevel.LEVEL4; + default: return org.hl7.fhir.r5.model.Person.IdentityAssuranceLevel.NULL; + } +} + + public static org.hl7.fhir.r4.model.Person.IdentityAssuranceLevel convertIdentityAssuranceLevel(org.hl7.fhir.r5.model.Person.IdentityAssuranceLevel src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case LEVEL1: return org.hl7.fhir.r4.model.Person.IdentityAssuranceLevel.LEVEL1; + case LEVEL2: return org.hl7.fhir.r4.model.Person.IdentityAssuranceLevel.LEVEL2; + case LEVEL3: return org.hl7.fhir.r4.model.Person.IdentityAssuranceLevel.LEVEL3; + case LEVEL4: return org.hl7.fhir.r4.model.Person.IdentityAssuranceLevel.LEVEL4; + default: return org.hl7.fhir.r4.model.Person.IdentityAssuranceLevel.NULL; + } +} + + +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/PlanDefinition.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/PlanDefinition.java new file mode 100644 index 000000000..c785fd609 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/PlanDefinition.java @@ -0,0 +1,695 @@ +package org.hl7.fhir.convertors.conv40_50; + +import org.hl7.fhir.exceptions.FHIRException; + +import org.hl7.fhir.convertors.VersionConvertor_40_50; + + +/* + Copyright (c) 2011+, HL7, Inc. + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of HL7 nor the names of its contributors may be used to + endorse or promote products derived from this software without specific + prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + +*/ + +// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0 + + +public class PlanDefinition extends VersionConvertor_40_50 { + + public static org.hl7.fhir.r5.model.PlanDefinition convertPlanDefinition(org.hl7.fhir.r4.model.PlanDefinition src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.PlanDefinition tgt = new org.hl7.fhir.r5.model.PlanDefinition(); + copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrlElement(convertUri(src.getUrlElement())); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasVersion()) + tgt.setVersionElement(convertString(src.getVersionElement())); + if (src.hasName()) + tgt.setNameElement(convertString(src.getNameElement())); + if (src.hasTitle()) + tgt.setTitleElement(convertString(src.getTitleElement())); + if (src.hasSubtitle()) + tgt.setSubtitleElement(convertString(src.getSubtitleElement())); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + if (src.hasStatus()) + tgt.setStatus(Enumerations.convertPublicationStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimentalElement(convertBoolean(src.getExperimentalElement())); + if (src.hasSubject()) + tgt.setSubject(convertType(src.getSubject())); + if (src.hasDate()) + tgt.setDateElement(convertDateTime(src.getDateElement())); + if (src.hasPublisher()) + tgt.setPublisherElement(convertString(src.getPublisherElement())); + for (org.hl7.fhir.r4.model.ContactDetail t : src.getContact()) + tgt.addContact(convertContactDetail(t)); + if (src.hasDescription()) + tgt.setDescriptionElement(convertMarkdown(src.getDescriptionElement())); + for (org.hl7.fhir.r4.model.UsageContext t : src.getUseContext()) + tgt.addUseContext(convertUsageContext(t)); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getJurisdiction()) + tgt.addJurisdiction(convertCodeableConcept(t)); + if (src.hasPurpose()) + tgt.setPurposeElement(convertMarkdown(src.getPurposeElement())); + if (src.hasUsage()) + tgt.setUsageElement(convertString(src.getUsageElement())); + if (src.hasCopyright()) + tgt.setCopyrightElement(convertMarkdown(src.getCopyrightElement())); + if (src.hasApprovalDate()) + tgt.setApprovalDateElement(convertDate(src.getApprovalDateElement())); + if (src.hasLastReviewDate()) + tgt.setLastReviewDateElement(convertDate(src.getLastReviewDateElement())); + if (src.hasEffectivePeriod()) + tgt.setEffectivePeriod(convertPeriod(src.getEffectivePeriod())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getTopic()) + tgt.addTopic(convertCodeableConcept(t)); + for (org.hl7.fhir.r4.model.ContactDetail t : src.getAuthor()) + tgt.addAuthor(convertContactDetail(t)); + for (org.hl7.fhir.r4.model.ContactDetail t : src.getEditor()) + tgt.addEditor(convertContactDetail(t)); + for (org.hl7.fhir.r4.model.ContactDetail t : src.getReviewer()) + tgt.addReviewer(convertContactDetail(t)); + for (org.hl7.fhir.r4.model.ContactDetail t : src.getEndorser()) + tgt.addEndorser(convertContactDetail(t)); + for (org.hl7.fhir.r4.model.RelatedArtifact t : src.getRelatedArtifact()) + tgt.addRelatedArtifact(convertRelatedArtifact(t)); + for (org.hl7.fhir.r4.model.CanonicalType t : src.getLibrary()) + tgt.getLibrary().add(convertCanonical(t)); + for (org.hl7.fhir.r4.model.PlanDefinition.PlanDefinitionGoalComponent t : src.getGoal()) + tgt.addGoal(convertPlanDefinitionGoalComponent(t)); + for (org.hl7.fhir.r4.model.PlanDefinition.PlanDefinitionActionComponent t : src.getAction()) + tgt.addAction(convertPlanDefinitionActionComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.PlanDefinition convertPlanDefinition(org.hl7.fhir.r5.model.PlanDefinition src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.PlanDefinition tgt = new org.hl7.fhir.r4.model.PlanDefinition(); + copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrlElement(convertUri(src.getUrlElement())); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasVersion()) + tgt.setVersionElement(convertString(src.getVersionElement())); + if (src.hasName()) + tgt.setNameElement(convertString(src.getNameElement())); + if (src.hasTitle()) + tgt.setTitleElement(convertString(src.getTitleElement())); + if (src.hasSubtitle()) + tgt.setSubtitleElement(convertString(src.getSubtitleElement())); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + if (src.hasStatus()) + tgt.setStatus(Enumerations.convertPublicationStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimentalElement(convertBoolean(src.getExperimentalElement())); + if (src.hasSubject()) + tgt.setSubject(convertType(src.getSubject())); + if (src.hasDate()) + tgt.setDateElement(convertDateTime(src.getDateElement())); + if (src.hasPublisher()) + tgt.setPublisherElement(convertString(src.getPublisherElement())); + for (org.hl7.fhir.r5.model.ContactDetail t : src.getContact()) + tgt.addContact(convertContactDetail(t)); + if (src.hasDescription()) + tgt.setDescriptionElement(convertMarkdown(src.getDescriptionElement())); + for (org.hl7.fhir.r5.model.UsageContext t : src.getUseContext()) + tgt.addUseContext(convertUsageContext(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getJurisdiction()) + tgt.addJurisdiction(convertCodeableConcept(t)); + if (src.hasPurpose()) + tgt.setPurposeElement(convertMarkdown(src.getPurposeElement())); + if (src.hasUsage()) + tgt.setUsageElement(convertString(src.getUsageElement())); + if (src.hasCopyright()) + tgt.setCopyrightElement(convertMarkdown(src.getCopyrightElement())); + if (src.hasApprovalDate()) + tgt.setApprovalDateElement(convertDate(src.getApprovalDateElement())); + if (src.hasLastReviewDate()) + tgt.setLastReviewDateElement(convertDate(src.getLastReviewDateElement())); + if (src.hasEffectivePeriod()) + tgt.setEffectivePeriod(convertPeriod(src.getEffectivePeriod())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getTopic()) + tgt.addTopic(convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.ContactDetail t : src.getAuthor()) + tgt.addAuthor(convertContactDetail(t)); + for (org.hl7.fhir.r5.model.ContactDetail t : src.getEditor()) + tgt.addEditor(convertContactDetail(t)); + for (org.hl7.fhir.r5.model.ContactDetail t : src.getReviewer()) + tgt.addReviewer(convertContactDetail(t)); + for (org.hl7.fhir.r5.model.ContactDetail t : src.getEndorser()) + tgt.addEndorser(convertContactDetail(t)); + for (org.hl7.fhir.r5.model.RelatedArtifact t : src.getRelatedArtifact()) + tgt.addRelatedArtifact(convertRelatedArtifact(t)); + for (org.hl7.fhir.r5.model.CanonicalType t : src.getLibrary()) + tgt.getLibrary().add(convertCanonical(t)); + for (org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionGoalComponent t : src.getGoal()) + tgt.addGoal(convertPlanDefinitionGoalComponent(t)); + for (org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionActionComponent t : src.getAction()) + tgt.addAction(convertPlanDefinitionActionComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionGoalComponent convertPlanDefinitionGoalComponent(org.hl7.fhir.r4.model.PlanDefinition.PlanDefinitionGoalComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionGoalComponent tgt = new org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionGoalComponent(); + copyElement(src, tgt); + if (src.hasCategory()) + tgt.setCategory(convertCodeableConcept(src.getCategory())); + if (src.hasDescription()) + tgt.setDescription(convertCodeableConcept(src.getDescription())); + if (src.hasPriority()) + tgt.setPriority(convertCodeableConcept(src.getPriority())); + if (src.hasStart()) + tgt.setStart(convertCodeableConcept(src.getStart())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getAddresses()) + tgt.addAddresses(convertCodeableConcept(t)); + for (org.hl7.fhir.r4.model.RelatedArtifact t : src.getDocumentation()) + tgt.addDocumentation(convertRelatedArtifact(t)); + for (org.hl7.fhir.r4.model.PlanDefinition.PlanDefinitionGoalTargetComponent t : src.getTarget()) + tgt.addTarget(convertPlanDefinitionGoalTargetComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.PlanDefinition.PlanDefinitionGoalComponent convertPlanDefinitionGoalComponent(org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionGoalComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.PlanDefinition.PlanDefinitionGoalComponent tgt = new org.hl7.fhir.r4.model.PlanDefinition.PlanDefinitionGoalComponent(); + copyElement(src, tgt); + if (src.hasCategory()) + tgt.setCategory(convertCodeableConcept(src.getCategory())); + if (src.hasDescription()) + tgt.setDescription(convertCodeableConcept(src.getDescription())); + if (src.hasPriority()) + tgt.setPriority(convertCodeableConcept(src.getPriority())); + if (src.hasStart()) + tgt.setStart(convertCodeableConcept(src.getStart())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getAddresses()) + tgt.addAddresses(convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.RelatedArtifact t : src.getDocumentation()) + tgt.addDocumentation(convertRelatedArtifact(t)); + for (org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionGoalTargetComponent t : src.getTarget()) + tgt.addTarget(convertPlanDefinitionGoalTargetComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionGoalTargetComponent convertPlanDefinitionGoalTargetComponent(org.hl7.fhir.r4.model.PlanDefinition.PlanDefinitionGoalTargetComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionGoalTargetComponent tgt = new org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionGoalTargetComponent(); + copyElement(src, tgt); + if (src.hasMeasure()) + tgt.setMeasure(convertCodeableConcept(src.getMeasure())); + if (src.hasDetail()) + tgt.setDetail(convertType(src.getDetail())); + if (src.hasDue()) + tgt.setDue(convertDuration(src.getDue())); + return tgt; + } + + public static org.hl7.fhir.r4.model.PlanDefinition.PlanDefinitionGoalTargetComponent convertPlanDefinitionGoalTargetComponent(org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionGoalTargetComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.PlanDefinition.PlanDefinitionGoalTargetComponent tgt = new org.hl7.fhir.r4.model.PlanDefinition.PlanDefinitionGoalTargetComponent(); + copyElement(src, tgt); + if (src.hasMeasure()) + tgt.setMeasure(convertCodeableConcept(src.getMeasure())); + if (src.hasDetail()) + tgt.setDetail(convertType(src.getDetail())); + if (src.hasDue()) + tgt.setDue(convertDuration(src.getDue())); + return tgt; + } + + public static org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionActionComponent convertPlanDefinitionActionComponent(org.hl7.fhir.r4.model.PlanDefinition.PlanDefinitionActionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionActionComponent tgt = new org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionActionComponent(); + copyElement(src, tgt); + if (src.hasPrefix()) + tgt.setPrefixElement(convertString(src.getPrefixElement())); + if (src.hasTitle()) + tgt.setTitleElement(convertString(src.getTitleElement())); + if (src.hasDescription()) + tgt.setDescriptionElement(convertString(src.getDescriptionElement())); + if (src.hasTextEquivalent()) + tgt.setTextEquivalentElement(convertString(src.getTextEquivalentElement())); + if (src.hasPriority()) + tgt.setPriority(convertRequestPriority(src.getPriority())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getCode()) + tgt.addCode(convertCodeableConcept(t)); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getReason()) + tgt.addReason(convertCodeableConcept(t)); + for (org.hl7.fhir.r4.model.RelatedArtifact t : src.getDocumentation()) + tgt.addDocumentation(convertRelatedArtifact(t)); + for (org.hl7.fhir.r4.model.IdType t : src.getGoalId()) + tgt.getGoalId().add(convertId(t)); + if (src.hasSubject()) + tgt.setSubject(convertType(src.getSubject())); + for (org.hl7.fhir.r4.model.TriggerDefinition t : src.getTrigger()) + tgt.addTrigger(convertTriggerDefinition(t)); + for (org.hl7.fhir.r4.model.PlanDefinition.PlanDefinitionActionConditionComponent t : src.getCondition()) + tgt.addCondition(convertPlanDefinitionActionConditionComponent(t)); + for (org.hl7.fhir.r4.model.DataRequirement t : src.getInput()) + tgt.addInput(convertDataRequirement(t)); + for (org.hl7.fhir.r4.model.DataRequirement t : src.getOutput()) + tgt.addOutput(convertDataRequirement(t)); + for (org.hl7.fhir.r4.model.PlanDefinition.PlanDefinitionActionRelatedActionComponent t : src.getRelatedAction()) + tgt.addRelatedAction(convertPlanDefinitionActionRelatedActionComponent(t)); + if (src.hasTiming()) + tgt.setTiming(convertType(src.getTiming())); + for (org.hl7.fhir.r4.model.PlanDefinition.PlanDefinitionActionParticipantComponent t : src.getParticipant()) + tgt.addParticipant(convertPlanDefinitionActionParticipantComponent(t)); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + if (src.hasGroupingBehavior()) + tgt.setGroupingBehavior(convertActionGroupingBehavior(src.getGroupingBehavior())); + if (src.hasSelectionBehavior()) + tgt.setSelectionBehavior(convertActionSelectionBehavior(src.getSelectionBehavior())); + if (src.hasRequiredBehavior()) + tgt.setRequiredBehavior(convertActionRequiredBehavior(src.getRequiredBehavior())); + if (src.hasPrecheckBehavior()) + tgt.setPrecheckBehavior(convertActionPrecheckBehavior(src.getPrecheckBehavior())); + if (src.hasCardinalityBehavior()) + tgt.setCardinalityBehavior(convertActionCardinalityBehavior(src.getCardinalityBehavior())); +// if (src.hasDefinition()) +// tgt.setDefinitionElement(convertType(src.getDefinitionElement())); + if (src.hasTransform()) + tgt.setTransformElement(convertCanonical(src.getTransformElement())); + for (org.hl7.fhir.r4.model.PlanDefinition.PlanDefinitionActionDynamicValueComponent t : src.getDynamicValue()) + tgt.addDynamicValue(convertPlanDefinitionActionDynamicValueComponent(t)); + for (org.hl7.fhir.r4.model.PlanDefinition.PlanDefinitionActionComponent t : src.getAction()) + tgt.addAction(convertPlanDefinitionActionComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.PlanDefinition.PlanDefinitionActionComponent convertPlanDefinitionActionComponent(org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionActionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.PlanDefinition.PlanDefinitionActionComponent tgt = new org.hl7.fhir.r4.model.PlanDefinition.PlanDefinitionActionComponent(); + copyElement(src, tgt); + if (src.hasPrefix()) + tgt.setPrefixElement(convertString(src.getPrefixElement())); + if (src.hasTitle()) + tgt.setTitleElement(convertString(src.getTitleElement())); + if (src.hasDescription()) + tgt.setDescriptionElement(convertString(src.getDescriptionElement())); + if (src.hasTextEquivalent()) + tgt.setTextEquivalentElement(convertString(src.getTextEquivalentElement())); + if (src.hasPriority()) + tgt.setPriority(convertRequestPriority(src.getPriority())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getCode()) + tgt.addCode(convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getReason()) + tgt.addReason(convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.RelatedArtifact t : src.getDocumentation()) + tgt.addDocumentation(convertRelatedArtifact(t)); + for (org.hl7.fhir.r5.model.IdType t : src.getGoalId()) + tgt.getGoalId().add(convertId(t)); + if (src.hasSubject()) + tgt.setSubject(convertType(src.getSubject())); + for (org.hl7.fhir.r5.model.TriggerDefinition t : src.getTrigger()) + tgt.addTrigger(convertTriggerDefinition(t)); + for (org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionActionConditionComponent t : src.getCondition()) + tgt.addCondition(convertPlanDefinitionActionConditionComponent(t)); + for (org.hl7.fhir.r5.model.DataRequirement t : src.getInput()) + tgt.addInput(convertDataRequirement(t)); + for (org.hl7.fhir.r5.model.DataRequirement t : src.getOutput()) + tgt.addOutput(convertDataRequirement(t)); + for (org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionActionRelatedActionComponent t : src.getRelatedAction()) + tgt.addRelatedAction(convertPlanDefinitionActionRelatedActionComponent(t)); + if (src.hasTiming()) + tgt.setTiming(convertType(src.getTiming())); + for (org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionActionParticipantComponent t : src.getParticipant()) + tgt.addParticipant(convertPlanDefinitionActionParticipantComponent(t)); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + if (src.hasGroupingBehavior()) + tgt.setGroupingBehavior(convertActionGroupingBehavior(src.getGroupingBehavior())); + if (src.hasSelectionBehavior()) + tgt.setSelectionBehavior(convertActionSelectionBehavior(src.getSelectionBehavior())); + if (src.hasRequiredBehavior()) + tgt.setRequiredBehavior(convertActionRequiredBehavior(src.getRequiredBehavior())); + if (src.hasPrecheckBehavior()) + tgt.setPrecheckBehavior(convertActionPrecheckBehavior(src.getPrecheckBehavior())); + if (src.hasCardinalityBehavior()) + tgt.setCardinalityBehavior(convertActionCardinalityBehavior(src.getCardinalityBehavior())); +// if (src.hasDefinition()) +// tgt.setDefinitionElement(convertType(src.getDefinitionElement())); + if (src.hasTransform()) + tgt.setTransformElement(convertCanonical(src.getTransformElement())); + for (org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionActionDynamicValueComponent t : src.getDynamicValue()) + tgt.addDynamicValue(convertPlanDefinitionActionDynamicValueComponent(t)); + for (org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionActionComponent t : src.getAction()) + tgt.addAction(convertPlanDefinitionActionComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.PlanDefinition.RequestPriority convertRequestPriority(org.hl7.fhir.r4.model.PlanDefinition.RequestPriority src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case ROUTINE: return org.hl7.fhir.r5.model.PlanDefinition.RequestPriority.ROUTINE; + case URGENT: return org.hl7.fhir.r5.model.PlanDefinition.RequestPriority.URGENT; + case ASAP: return org.hl7.fhir.r5.model.PlanDefinition.RequestPriority.ASAP; + case STAT: return org.hl7.fhir.r5.model.PlanDefinition.RequestPriority.STAT; + default: return org.hl7.fhir.r5.model.PlanDefinition.RequestPriority.NULL; + } +} + + public static org.hl7.fhir.r4.model.PlanDefinition.RequestPriority convertRequestPriority(org.hl7.fhir.r5.model.PlanDefinition.RequestPriority src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case ROUTINE: return org.hl7.fhir.r4.model.PlanDefinition.RequestPriority.ROUTINE; + case URGENT: return org.hl7.fhir.r4.model.PlanDefinition.RequestPriority.URGENT; + case ASAP: return org.hl7.fhir.r4.model.PlanDefinition.RequestPriority.ASAP; + case STAT: return org.hl7.fhir.r4.model.PlanDefinition.RequestPriority.STAT; + default: return org.hl7.fhir.r4.model.PlanDefinition.RequestPriority.NULL; + } +} + + public static org.hl7.fhir.r5.model.PlanDefinition.ActionGroupingBehavior convertActionGroupingBehavior(org.hl7.fhir.r4.model.PlanDefinition.ActionGroupingBehavior src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case VISUALGROUP: return org.hl7.fhir.r5.model.PlanDefinition.ActionGroupingBehavior.VISUALGROUP; + case LOGICALGROUP: return org.hl7.fhir.r5.model.PlanDefinition.ActionGroupingBehavior.LOGICALGROUP; + case SENTENCEGROUP: return org.hl7.fhir.r5.model.PlanDefinition.ActionGroupingBehavior.SENTENCEGROUP; + default: return org.hl7.fhir.r5.model.PlanDefinition.ActionGroupingBehavior.NULL; + } +} + + public static org.hl7.fhir.r4.model.PlanDefinition.ActionGroupingBehavior convertActionGroupingBehavior(org.hl7.fhir.r5.model.PlanDefinition.ActionGroupingBehavior src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case VISUALGROUP: return org.hl7.fhir.r4.model.PlanDefinition.ActionGroupingBehavior.VISUALGROUP; + case LOGICALGROUP: return org.hl7.fhir.r4.model.PlanDefinition.ActionGroupingBehavior.LOGICALGROUP; + case SENTENCEGROUP: return org.hl7.fhir.r4.model.PlanDefinition.ActionGroupingBehavior.SENTENCEGROUP; + default: return org.hl7.fhir.r4.model.PlanDefinition.ActionGroupingBehavior.NULL; + } +} + + public static org.hl7.fhir.r5.model.PlanDefinition.ActionSelectionBehavior convertActionSelectionBehavior(org.hl7.fhir.r4.model.PlanDefinition.ActionSelectionBehavior src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case ANY: return org.hl7.fhir.r5.model.PlanDefinition.ActionSelectionBehavior.ANY; + case ALL: return org.hl7.fhir.r5.model.PlanDefinition.ActionSelectionBehavior.ALL; + case ALLORNONE: return org.hl7.fhir.r5.model.PlanDefinition.ActionSelectionBehavior.ALLORNONE; + case EXACTLYONE: return org.hl7.fhir.r5.model.PlanDefinition.ActionSelectionBehavior.EXACTLYONE; + case ATMOSTONE: return org.hl7.fhir.r5.model.PlanDefinition.ActionSelectionBehavior.ATMOSTONE; + case ONEORMORE: return org.hl7.fhir.r5.model.PlanDefinition.ActionSelectionBehavior.ONEORMORE; + default: return org.hl7.fhir.r5.model.PlanDefinition.ActionSelectionBehavior.NULL; + } +} + + public static org.hl7.fhir.r4.model.PlanDefinition.ActionSelectionBehavior convertActionSelectionBehavior(org.hl7.fhir.r5.model.PlanDefinition.ActionSelectionBehavior src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case ANY: return org.hl7.fhir.r4.model.PlanDefinition.ActionSelectionBehavior.ANY; + case ALL: return org.hl7.fhir.r4.model.PlanDefinition.ActionSelectionBehavior.ALL; + case ALLORNONE: return org.hl7.fhir.r4.model.PlanDefinition.ActionSelectionBehavior.ALLORNONE; + case EXACTLYONE: return org.hl7.fhir.r4.model.PlanDefinition.ActionSelectionBehavior.EXACTLYONE; + case ATMOSTONE: return org.hl7.fhir.r4.model.PlanDefinition.ActionSelectionBehavior.ATMOSTONE; + case ONEORMORE: return org.hl7.fhir.r4.model.PlanDefinition.ActionSelectionBehavior.ONEORMORE; + default: return org.hl7.fhir.r4.model.PlanDefinition.ActionSelectionBehavior.NULL; + } +} + + public static org.hl7.fhir.r5.model.PlanDefinition.ActionRequiredBehavior convertActionRequiredBehavior(org.hl7.fhir.r4.model.PlanDefinition.ActionRequiredBehavior src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case MUST: return org.hl7.fhir.r5.model.PlanDefinition.ActionRequiredBehavior.MUST; + case COULD: return org.hl7.fhir.r5.model.PlanDefinition.ActionRequiredBehavior.COULD; + case MUSTUNLESSDOCUMENTED: return org.hl7.fhir.r5.model.PlanDefinition.ActionRequiredBehavior.MUSTUNLESSDOCUMENTED; + default: return org.hl7.fhir.r5.model.PlanDefinition.ActionRequiredBehavior.NULL; + } +} + + public static org.hl7.fhir.r4.model.PlanDefinition.ActionRequiredBehavior convertActionRequiredBehavior(org.hl7.fhir.r5.model.PlanDefinition.ActionRequiredBehavior src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case MUST: return org.hl7.fhir.r4.model.PlanDefinition.ActionRequiredBehavior.MUST; + case COULD: return org.hl7.fhir.r4.model.PlanDefinition.ActionRequiredBehavior.COULD; + case MUSTUNLESSDOCUMENTED: return org.hl7.fhir.r4.model.PlanDefinition.ActionRequiredBehavior.MUSTUNLESSDOCUMENTED; + default: return org.hl7.fhir.r4.model.PlanDefinition.ActionRequiredBehavior.NULL; + } +} + + public static org.hl7.fhir.r5.model.PlanDefinition.ActionPrecheckBehavior convertActionPrecheckBehavior(org.hl7.fhir.r4.model.PlanDefinition.ActionPrecheckBehavior src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case YES: return org.hl7.fhir.r5.model.PlanDefinition.ActionPrecheckBehavior.YES; + case NO: return org.hl7.fhir.r5.model.PlanDefinition.ActionPrecheckBehavior.NO; + default: return org.hl7.fhir.r5.model.PlanDefinition.ActionPrecheckBehavior.NULL; + } +} + + public static org.hl7.fhir.r4.model.PlanDefinition.ActionPrecheckBehavior convertActionPrecheckBehavior(org.hl7.fhir.r5.model.PlanDefinition.ActionPrecheckBehavior src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case YES: return org.hl7.fhir.r4.model.PlanDefinition.ActionPrecheckBehavior.YES; + case NO: return org.hl7.fhir.r4.model.PlanDefinition.ActionPrecheckBehavior.NO; + default: return org.hl7.fhir.r4.model.PlanDefinition.ActionPrecheckBehavior.NULL; + } +} + + public static org.hl7.fhir.r5.model.PlanDefinition.ActionCardinalityBehavior convertActionCardinalityBehavior(org.hl7.fhir.r4.model.PlanDefinition.ActionCardinalityBehavior src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case SINGLE: return org.hl7.fhir.r5.model.PlanDefinition.ActionCardinalityBehavior.SINGLE; + case MULTIPLE: return org.hl7.fhir.r5.model.PlanDefinition.ActionCardinalityBehavior.MULTIPLE; + default: return org.hl7.fhir.r5.model.PlanDefinition.ActionCardinalityBehavior.NULL; + } +} + + public static org.hl7.fhir.r4.model.PlanDefinition.ActionCardinalityBehavior convertActionCardinalityBehavior(org.hl7.fhir.r5.model.PlanDefinition.ActionCardinalityBehavior src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case SINGLE: return org.hl7.fhir.r4.model.PlanDefinition.ActionCardinalityBehavior.SINGLE; + case MULTIPLE: return org.hl7.fhir.r4.model.PlanDefinition.ActionCardinalityBehavior.MULTIPLE; + default: return org.hl7.fhir.r4.model.PlanDefinition.ActionCardinalityBehavior.NULL; + } +} + + public static org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionActionConditionComponent convertPlanDefinitionActionConditionComponent(org.hl7.fhir.r4.model.PlanDefinition.PlanDefinitionActionConditionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionActionConditionComponent tgt = new org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionActionConditionComponent(); + copyElement(src, tgt); + if (src.hasKind()) + tgt.setKind(convertActionConditionKind(src.getKind())); + if (src.hasExpression()) + tgt.setExpression(convertExpression(src.getExpression())); + return tgt; + } + + public static org.hl7.fhir.r4.model.PlanDefinition.PlanDefinitionActionConditionComponent convertPlanDefinitionActionConditionComponent(org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionActionConditionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.PlanDefinition.PlanDefinitionActionConditionComponent tgt = new org.hl7.fhir.r4.model.PlanDefinition.PlanDefinitionActionConditionComponent(); + copyElement(src, tgt); + if (src.hasKind()) + tgt.setKind(convertActionConditionKind(src.getKind())); + if (src.hasExpression()) + tgt.setExpression(convertExpression(src.getExpression())); + return tgt; + } + + public static org.hl7.fhir.r5.model.PlanDefinition.ActionConditionKind convertActionConditionKind(org.hl7.fhir.r4.model.PlanDefinition.ActionConditionKind src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case APPLICABILITY: return org.hl7.fhir.r5.model.PlanDefinition.ActionConditionKind.APPLICABILITY; + case START: return org.hl7.fhir.r5.model.PlanDefinition.ActionConditionKind.START; + case STOP: return org.hl7.fhir.r5.model.PlanDefinition.ActionConditionKind.STOP; + default: return org.hl7.fhir.r5.model.PlanDefinition.ActionConditionKind.NULL; + } +} + + public static org.hl7.fhir.r4.model.PlanDefinition.ActionConditionKind convertActionConditionKind(org.hl7.fhir.r5.model.PlanDefinition.ActionConditionKind src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case APPLICABILITY: return org.hl7.fhir.r4.model.PlanDefinition.ActionConditionKind.APPLICABILITY; + case START: return org.hl7.fhir.r4.model.PlanDefinition.ActionConditionKind.START; + case STOP: return org.hl7.fhir.r4.model.PlanDefinition.ActionConditionKind.STOP; + default: return org.hl7.fhir.r4.model.PlanDefinition.ActionConditionKind.NULL; + } +} + + public static org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionActionRelatedActionComponent convertPlanDefinitionActionRelatedActionComponent(org.hl7.fhir.r4.model.PlanDefinition.PlanDefinitionActionRelatedActionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionActionRelatedActionComponent tgt = new org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionActionRelatedActionComponent(); + copyElement(src, tgt); + if (src.hasActionId()) + tgt.setActionIdElement(convertId(src.getActionIdElement())); + if (src.hasRelationship()) + tgt.setRelationship(convertActionRelationshipType(src.getRelationship())); + if (src.hasOffset()) + tgt.setOffset(convertType(src.getOffset())); + return tgt; + } + + public static org.hl7.fhir.r4.model.PlanDefinition.PlanDefinitionActionRelatedActionComponent convertPlanDefinitionActionRelatedActionComponent(org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionActionRelatedActionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.PlanDefinition.PlanDefinitionActionRelatedActionComponent tgt = new org.hl7.fhir.r4.model.PlanDefinition.PlanDefinitionActionRelatedActionComponent(); + copyElement(src, tgt); + if (src.hasActionId()) + tgt.setActionIdElement(convertId(src.getActionIdElement())); + if (src.hasRelationship()) + tgt.setRelationship(convertActionRelationshipType(src.getRelationship())); + if (src.hasOffset()) + tgt.setOffset(convertType(src.getOffset())); + return tgt; + } + + public static org.hl7.fhir.r5.model.PlanDefinition.ActionRelationshipType convertActionRelationshipType(org.hl7.fhir.r4.model.PlanDefinition.ActionRelationshipType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case BEFORESTART: return org.hl7.fhir.r5.model.PlanDefinition.ActionRelationshipType.BEFORESTART; + case BEFORE: return org.hl7.fhir.r5.model.PlanDefinition.ActionRelationshipType.BEFORE; + case BEFOREEND: return org.hl7.fhir.r5.model.PlanDefinition.ActionRelationshipType.BEFOREEND; + case CONCURRENTWITHSTART: return org.hl7.fhir.r5.model.PlanDefinition.ActionRelationshipType.CONCURRENTWITHSTART; + case CONCURRENT: return org.hl7.fhir.r5.model.PlanDefinition.ActionRelationshipType.CONCURRENT; + case CONCURRENTWITHEND: return org.hl7.fhir.r5.model.PlanDefinition.ActionRelationshipType.CONCURRENTWITHEND; + case AFTERSTART: return org.hl7.fhir.r5.model.PlanDefinition.ActionRelationshipType.AFTERSTART; + case AFTER: return org.hl7.fhir.r5.model.PlanDefinition.ActionRelationshipType.AFTER; + case AFTEREND: return org.hl7.fhir.r5.model.PlanDefinition.ActionRelationshipType.AFTEREND; + default: return org.hl7.fhir.r5.model.PlanDefinition.ActionRelationshipType.NULL; + } +} + + public static org.hl7.fhir.r4.model.PlanDefinition.ActionRelationshipType convertActionRelationshipType(org.hl7.fhir.r5.model.PlanDefinition.ActionRelationshipType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case BEFORESTART: return org.hl7.fhir.r4.model.PlanDefinition.ActionRelationshipType.BEFORESTART; + case BEFORE: return org.hl7.fhir.r4.model.PlanDefinition.ActionRelationshipType.BEFORE; + case BEFOREEND: return org.hl7.fhir.r4.model.PlanDefinition.ActionRelationshipType.BEFOREEND; + case CONCURRENTWITHSTART: return org.hl7.fhir.r4.model.PlanDefinition.ActionRelationshipType.CONCURRENTWITHSTART; + case CONCURRENT: return org.hl7.fhir.r4.model.PlanDefinition.ActionRelationshipType.CONCURRENT; + case CONCURRENTWITHEND: return org.hl7.fhir.r4.model.PlanDefinition.ActionRelationshipType.CONCURRENTWITHEND; + case AFTERSTART: return org.hl7.fhir.r4.model.PlanDefinition.ActionRelationshipType.AFTERSTART; + case AFTER: return org.hl7.fhir.r4.model.PlanDefinition.ActionRelationshipType.AFTER; + case AFTEREND: return org.hl7.fhir.r4.model.PlanDefinition.ActionRelationshipType.AFTEREND; + default: return org.hl7.fhir.r4.model.PlanDefinition.ActionRelationshipType.NULL; + } +} + + public static org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionActionParticipantComponent convertPlanDefinitionActionParticipantComponent(org.hl7.fhir.r4.model.PlanDefinition.PlanDefinitionActionParticipantComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionActionParticipantComponent tgt = new org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionActionParticipantComponent(); + copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertActionParticipantType(src.getType())); + if (src.hasRole()) + tgt.setRole(convertCodeableConcept(src.getRole())); + return tgt; + } + + public static org.hl7.fhir.r4.model.PlanDefinition.PlanDefinitionActionParticipantComponent convertPlanDefinitionActionParticipantComponent(org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionActionParticipantComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.PlanDefinition.PlanDefinitionActionParticipantComponent tgt = new org.hl7.fhir.r4.model.PlanDefinition.PlanDefinitionActionParticipantComponent(); + copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertActionParticipantType(src.getType())); + if (src.hasRole()) + tgt.setRole(convertCodeableConcept(src.getRole())); + return tgt; + } + + public static org.hl7.fhir.r5.model.PlanDefinition.ActionParticipantType convertActionParticipantType(org.hl7.fhir.r4.model.PlanDefinition.ActionParticipantType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PATIENT: return org.hl7.fhir.r5.model.PlanDefinition.ActionParticipantType.PATIENT; + case PRACTITIONER: return org.hl7.fhir.r5.model.PlanDefinition.ActionParticipantType.PRACTITIONER; + case RELATEDPERSON: return org.hl7.fhir.r5.model.PlanDefinition.ActionParticipantType.RELATEDPERSON; + case DEVICE: return org.hl7.fhir.r5.model.PlanDefinition.ActionParticipantType.DEVICE; + default: return org.hl7.fhir.r5.model.PlanDefinition.ActionParticipantType.NULL; + } +} + + public static org.hl7.fhir.r4.model.PlanDefinition.ActionParticipantType convertActionParticipantType(org.hl7.fhir.r5.model.PlanDefinition.ActionParticipantType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PATIENT: return org.hl7.fhir.r4.model.PlanDefinition.ActionParticipantType.PATIENT; + case PRACTITIONER: return org.hl7.fhir.r4.model.PlanDefinition.ActionParticipantType.PRACTITIONER; + case RELATEDPERSON: return org.hl7.fhir.r4.model.PlanDefinition.ActionParticipantType.RELATEDPERSON; + case DEVICE: return org.hl7.fhir.r4.model.PlanDefinition.ActionParticipantType.DEVICE; + default: return org.hl7.fhir.r4.model.PlanDefinition.ActionParticipantType.NULL; + } +} + + public static org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionActionDynamicValueComponent convertPlanDefinitionActionDynamicValueComponent(org.hl7.fhir.r4.model.PlanDefinition.PlanDefinitionActionDynamicValueComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionActionDynamicValueComponent tgt = new org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionActionDynamicValueComponent(); + copyElement(src, tgt); + if (src.hasPath()) + tgt.setPathElement(convertString(src.getPathElement())); + if (src.hasExpression()) + tgt.setExpression(convertExpression(src.getExpression())); + return tgt; + } + + public static org.hl7.fhir.r4.model.PlanDefinition.PlanDefinitionActionDynamicValueComponent convertPlanDefinitionActionDynamicValueComponent(org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionActionDynamicValueComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.PlanDefinition.PlanDefinitionActionDynamicValueComponent tgt = new org.hl7.fhir.r4.model.PlanDefinition.PlanDefinitionActionDynamicValueComponent(); + copyElement(src, tgt); + if (src.hasPath()) + tgt.setPathElement(convertString(src.getPathElement())); + if (src.hasExpression()) + tgt.setExpression(convertExpression(src.getExpression())); + return tgt; + } + + +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Practitioner.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Practitioner.java new file mode 100644 index 000000000..0a9aae0f7 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Practitioner.java @@ -0,0 +1,131 @@ +package org.hl7.fhir.convertors.conv40_50; + +import org.hl7.fhir.exceptions.FHIRException; + +import org.hl7.fhir.convertors.VersionConvertor_40_50; + + +/* + Copyright (c) 2011+, HL7, Inc. + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of HL7 nor the names of its contributors may be used to + endorse or promote products derived from this software without specific + prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + +*/ + +// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0 + + +public class Practitioner extends VersionConvertor_40_50 { + + public static org.hl7.fhir.r5.model.Practitioner convertPractitioner(org.hl7.fhir.r4.model.Practitioner src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Practitioner tgt = new org.hl7.fhir.r5.model.Practitioner(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasActive()) + tgt.setActiveElement(convertBoolean(src.getActiveElement())); + for (org.hl7.fhir.r4.model.HumanName t : src.getName()) + tgt.addName(convertHumanName(t)); + for (org.hl7.fhir.r4.model.ContactPoint t : src.getTelecom()) + tgt.addTelecom(convertContactPoint(t)); + for (org.hl7.fhir.r4.model.Address t : src.getAddress()) + tgt.addAddress(convertAddress(t)); + if (src.hasGender()) + tgt.setGender(Enumerations.convertAdministrativeGender(src.getGender())); + if (src.hasBirthDate()) + tgt.setBirthDateElement(convertDate(src.getBirthDateElement())); + for (org.hl7.fhir.r4.model.Attachment t : src.getPhoto()) + tgt.addPhoto(convertAttachment(t)); + for (org.hl7.fhir.r4.model.Practitioner.PractitionerQualificationComponent t : src.getQualification()) + tgt.addQualification(convertPractitionerQualificationComponent(t)); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getCommunication()) + tgt.addCommunication(convertCodeableConcept(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.Practitioner convertPractitioner(org.hl7.fhir.r5.model.Practitioner src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Practitioner tgt = new org.hl7.fhir.r4.model.Practitioner(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasActive()) + tgt.setActiveElement(convertBoolean(src.getActiveElement())); + for (org.hl7.fhir.r5.model.HumanName t : src.getName()) + tgt.addName(convertHumanName(t)); + for (org.hl7.fhir.r5.model.ContactPoint t : src.getTelecom()) + tgt.addTelecom(convertContactPoint(t)); + for (org.hl7.fhir.r5.model.Address t : src.getAddress()) + tgt.addAddress(convertAddress(t)); + if (src.hasGender()) + tgt.setGender(Enumerations.convertAdministrativeGender(src.getGender())); + if (src.hasBirthDate()) + tgt.setBirthDateElement(convertDate(src.getBirthDateElement())); + for (org.hl7.fhir.r5.model.Attachment t : src.getPhoto()) + tgt.addPhoto(convertAttachment(t)); + for (org.hl7.fhir.r5.model.Practitioner.PractitionerQualificationComponent t : src.getQualification()) + tgt.addQualification(convertPractitionerQualificationComponent(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getCommunication()) + tgt.addCommunication(convertCodeableConcept(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.Practitioner.PractitionerQualificationComponent convertPractitionerQualificationComponent(org.hl7.fhir.r4.model.Practitioner.PractitionerQualificationComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Practitioner.PractitionerQualificationComponent tgt = new org.hl7.fhir.r5.model.Practitioner.PractitionerQualificationComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasCode()) + tgt.setCode(convertCodeableConcept(src.getCode())); + if (src.hasPeriod()) + tgt.setPeriod(convertPeriod(src.getPeriod())); + if (src.hasIssuer()) + tgt.setIssuer(convertReference(src.getIssuer())); + return tgt; + } + + public static org.hl7.fhir.r4.model.Practitioner.PractitionerQualificationComponent convertPractitionerQualificationComponent(org.hl7.fhir.r5.model.Practitioner.PractitionerQualificationComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Practitioner.PractitionerQualificationComponent tgt = new org.hl7.fhir.r4.model.Practitioner.PractitionerQualificationComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasCode()) + tgt.setCode(convertCodeableConcept(src.getCode())); + if (src.hasPeriod()) + tgt.setPeriod(convertPeriod(src.getPeriod())); + if (src.hasIssuer()) + tgt.setIssuer(convertReference(src.getIssuer())); + return tgt; + } + + +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/PractitionerRole.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/PractitionerRole.java new file mode 100644 index 000000000..e5f4313d2 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/PractitionerRole.java @@ -0,0 +1,201 @@ +package org.hl7.fhir.convertors.conv40_50; + +import org.hl7.fhir.exceptions.FHIRException; + +import org.hl7.fhir.convertors.VersionConvertor_40_50; + + +/* + Copyright (c) 2011+, HL7, Inc. + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of HL7 nor the names of its contributors may be used to + endorse or promote products derived from this software without specific + prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + +*/ + +// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0 + + +public class PractitionerRole extends VersionConvertor_40_50 { + + public static org.hl7.fhir.r5.model.PractitionerRole convertPractitionerRole(org.hl7.fhir.r4.model.PractitionerRole src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.PractitionerRole tgt = new org.hl7.fhir.r5.model.PractitionerRole(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasActive()) + tgt.setActiveElement(convertBoolean(src.getActiveElement())); + if (src.hasPeriod()) + tgt.setPeriod(convertPeriod(src.getPeriod())); + if (src.hasPractitioner()) + tgt.setPractitioner(convertReference(src.getPractitioner())); + if (src.hasOrganization()) + tgt.setOrganization(convertReference(src.getOrganization())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getCode()) + tgt.addCode(convertCodeableConcept(t)); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getSpecialty()) + tgt.addSpecialty(convertCodeableConcept(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getLocation()) + tgt.addLocation(convertReference(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getHealthcareService()) + tgt.addHealthcareService(convertReference(t)); + for (org.hl7.fhir.r4.model.ContactPoint t : src.getTelecom()) + tgt.addTelecom(convertContactPoint(t)); + for (org.hl7.fhir.r4.model.PractitionerRole.PractitionerRoleAvailableTimeComponent t : src.getAvailableTime()) + tgt.addAvailableTime(convertPractitionerRoleAvailableTimeComponent(t)); + for (org.hl7.fhir.r4.model.PractitionerRole.PractitionerRoleNotAvailableComponent t : src.getNotAvailable()) + tgt.addNotAvailable(convertPractitionerRoleNotAvailableComponent(t)); + if (src.hasAvailabilityExceptions()) + tgt.setAvailabilityExceptionsElement(convertString(src.getAvailabilityExceptionsElement())); + for (org.hl7.fhir.r4.model.Reference t : src.getEndpoint()) + tgt.addEndpoint(convertReference(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.PractitionerRole convertPractitionerRole(org.hl7.fhir.r5.model.PractitionerRole src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.PractitionerRole tgt = new org.hl7.fhir.r4.model.PractitionerRole(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasActive()) + tgt.setActiveElement(convertBoolean(src.getActiveElement())); + if (src.hasPeriod()) + tgt.setPeriod(convertPeriod(src.getPeriod())); + if (src.hasPractitioner()) + tgt.setPractitioner(convertReference(src.getPractitioner())); + if (src.hasOrganization()) + tgt.setOrganization(convertReference(src.getOrganization())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getCode()) + tgt.addCode(convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getSpecialty()) + tgt.addSpecialty(convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getLocation()) + tgt.addLocation(convertReference(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getHealthcareService()) + tgt.addHealthcareService(convertReference(t)); + for (org.hl7.fhir.r5.model.ContactPoint t : src.getTelecom()) + tgt.addTelecom(convertContactPoint(t)); + for (org.hl7.fhir.r5.model.PractitionerRole.PractitionerRoleAvailableTimeComponent t : src.getAvailableTime()) + tgt.addAvailableTime(convertPractitionerRoleAvailableTimeComponent(t)); + for (org.hl7.fhir.r5.model.PractitionerRole.PractitionerRoleNotAvailableComponent t : src.getNotAvailable()) + tgt.addNotAvailable(convertPractitionerRoleNotAvailableComponent(t)); + if (src.hasAvailabilityExceptions()) + tgt.setAvailabilityExceptionsElement(convertString(src.getAvailabilityExceptionsElement())); + for (org.hl7.fhir.r5.model.Reference t : src.getEndpoint()) + tgt.addEndpoint(convertReference(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.PractitionerRole.PractitionerRoleAvailableTimeComponent convertPractitionerRoleAvailableTimeComponent(org.hl7.fhir.r4.model.PractitionerRole.PractitionerRoleAvailableTimeComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.PractitionerRole.PractitionerRoleAvailableTimeComponent tgt = new org.hl7.fhir.r5.model.PractitionerRole.PractitionerRoleAvailableTimeComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.r4.model.Enumeration t : src.getDaysOfWeek()) + tgt.addDaysOfWeek(convertDaysOfWeek(t.getValue())); + if (src.hasAllDay()) + tgt.setAllDayElement(convertBoolean(src.getAllDayElement())); + if (src.hasAvailableStartTime()) + tgt.setAvailableStartTimeElement(convertTime(src.getAvailableStartTimeElement())); + if (src.hasAvailableEndTime()) + tgt.setAvailableEndTimeElement(convertTime(src.getAvailableEndTimeElement())); + return tgt; + } + + public static org.hl7.fhir.r4.model.PractitionerRole.PractitionerRoleAvailableTimeComponent convertPractitionerRoleAvailableTimeComponent(org.hl7.fhir.r5.model.PractitionerRole.PractitionerRoleAvailableTimeComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.PractitionerRole.PractitionerRoleAvailableTimeComponent tgt = new org.hl7.fhir.r4.model.PractitionerRole.PractitionerRoleAvailableTimeComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.r5.model.Enumeration t : src.getDaysOfWeek()) + tgt.addDaysOfWeek(convertDaysOfWeek(t.getValue())); + if (src.hasAllDay()) + tgt.setAllDayElement(convertBoolean(src.getAllDayElement())); + if (src.hasAvailableStartTime()) + tgt.setAvailableStartTimeElement(convertTime(src.getAvailableStartTimeElement())); + if (src.hasAvailableEndTime()) + tgt.setAvailableEndTimeElement(convertTime(src.getAvailableEndTimeElement())); + return tgt; + } + + public static org.hl7.fhir.r5.model.PractitionerRole.DaysOfWeek convertDaysOfWeek(org.hl7.fhir.r4.model.PractitionerRole.DaysOfWeek src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case MON: return org.hl7.fhir.r5.model.PractitionerRole.DaysOfWeek.MON; + case TUE: return org.hl7.fhir.r5.model.PractitionerRole.DaysOfWeek.TUE; + case WED: return org.hl7.fhir.r5.model.PractitionerRole.DaysOfWeek.WED; + case THU: return org.hl7.fhir.r5.model.PractitionerRole.DaysOfWeek.THU; + case FRI: return org.hl7.fhir.r5.model.PractitionerRole.DaysOfWeek.FRI; + case SAT: return org.hl7.fhir.r5.model.PractitionerRole.DaysOfWeek.SAT; + case SUN: return org.hl7.fhir.r5.model.PractitionerRole.DaysOfWeek.SUN; + default: return org.hl7.fhir.r5.model.PractitionerRole.DaysOfWeek.NULL; + } +} + + public static org.hl7.fhir.r4.model.PractitionerRole.DaysOfWeek convertDaysOfWeek(org.hl7.fhir.r5.model.PractitionerRole.DaysOfWeek src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case MON: return org.hl7.fhir.r4.model.PractitionerRole.DaysOfWeek.MON; + case TUE: return org.hl7.fhir.r4.model.PractitionerRole.DaysOfWeek.TUE; + case WED: return org.hl7.fhir.r4.model.PractitionerRole.DaysOfWeek.WED; + case THU: return org.hl7.fhir.r4.model.PractitionerRole.DaysOfWeek.THU; + case FRI: return org.hl7.fhir.r4.model.PractitionerRole.DaysOfWeek.FRI; + case SAT: return org.hl7.fhir.r4.model.PractitionerRole.DaysOfWeek.SAT; + case SUN: return org.hl7.fhir.r4.model.PractitionerRole.DaysOfWeek.SUN; + default: return org.hl7.fhir.r4.model.PractitionerRole.DaysOfWeek.NULL; + } +} + + public static org.hl7.fhir.r5.model.PractitionerRole.PractitionerRoleNotAvailableComponent convertPractitionerRoleNotAvailableComponent(org.hl7.fhir.r4.model.PractitionerRole.PractitionerRoleNotAvailableComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.PractitionerRole.PractitionerRoleNotAvailableComponent tgt = new org.hl7.fhir.r5.model.PractitionerRole.PractitionerRoleNotAvailableComponent(); + copyElement(src, tgt); + if (src.hasDescription()) + tgt.setDescriptionElement(convertString(src.getDescriptionElement())); + if (src.hasDuring()) + tgt.setDuring(convertPeriod(src.getDuring())); + return tgt; + } + + public static org.hl7.fhir.r4.model.PractitionerRole.PractitionerRoleNotAvailableComponent convertPractitionerRoleNotAvailableComponent(org.hl7.fhir.r5.model.PractitionerRole.PractitionerRoleNotAvailableComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.PractitionerRole.PractitionerRoleNotAvailableComponent tgt = new org.hl7.fhir.r4.model.PractitionerRole.PractitionerRoleNotAvailableComponent(); + copyElement(src, tgt); + if (src.hasDescription()) + tgt.setDescriptionElement(convertString(src.getDescriptionElement())); + if (src.hasDuring()) + tgt.setDuring(convertPeriod(src.getDuring())); + return tgt; + } + + +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Procedure.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Procedure.java new file mode 100644 index 000000000..2eba0180e --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Procedure.java @@ -0,0 +1,255 @@ +package org.hl7.fhir.convertors.conv40_50; + +import org.hl7.fhir.exceptions.FHIRException; + +import org.hl7.fhir.convertors.VersionConvertor_40_50; + + +/* + Copyright (c) 2011+, HL7, Inc. + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of HL7 nor the names of its contributors may be used to + endorse or promote products derived from this software without specific + prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + +*/ + +// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0 + + +public class Procedure extends VersionConvertor_40_50 { + + public static org.hl7.fhir.r5.model.Procedure convertProcedure(org.hl7.fhir.r4.model.Procedure src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Procedure tgt = new org.hl7.fhir.r5.model.Procedure(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + for (org.hl7.fhir.r4.model.CanonicalType t : src.getInstantiatesCanonical()) + tgt.getInstantiatesCanonical().add(convertCanonical(t)); + for (org.hl7.fhir.r4.model.UriType t : src.getInstantiatesUri()) + tgt.getInstantiatesUri().add(convertUri(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getBasedOn()) + tgt.addBasedOn(convertReference(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getPartOf()) + tgt.addPartOf(convertReference(t)); + if (src.hasStatus()) + tgt.setStatus(convertProcedureStatus(src.getStatus())); + if (src.hasStatusReason()) + tgt.setStatusReason(convertCodeableConcept(src.getStatusReason())); + if (src.hasCategory()) + tgt.setCategory(convertCodeableConcept(src.getCategory())); + if (src.hasCode()) + tgt.setCode(convertCodeableConcept(src.getCode())); + if (src.hasSubject()) + tgt.setSubject(convertReference(src.getSubject())); + if (src.hasEncounter()) + tgt.setEncounter(convertReference(src.getEncounter())); + if (src.hasPerformed()) + tgt.setPerformed(convertType(src.getPerformed())); + if (src.hasRecorder()) + tgt.setRecorder(convertReference(src.getRecorder())); + if (src.hasAsserter()) + tgt.setAsserter(convertReference(src.getAsserter())); + for (org.hl7.fhir.r4.model.Procedure.ProcedurePerformerComponent t : src.getPerformer()) + tgt.addPerformer(convertProcedurePerformerComponent(t)); + if (src.hasLocation()) + tgt.setLocation(convertReference(src.getLocation())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getReasonCode()) + tgt.addReasonCode(convertCodeableConcept(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getReasonReference()) + tgt.addReasonReference(convertReference(t)); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getBodySite()) + tgt.addBodySite(convertCodeableConcept(t)); + if (src.hasOutcome()) + tgt.setOutcome(convertCodeableConcept(src.getOutcome())); + for (org.hl7.fhir.r4.model.Reference t : src.getReport()) + tgt.addReport(convertReference(t)); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getComplication()) + tgt.addComplication(convertCodeableConcept(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getComplicationDetail()) + tgt.addComplicationDetail(convertReference(t)); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getFollowUp()) + tgt.addFollowUp(convertCodeableConcept(t)); + for (org.hl7.fhir.r4.model.Annotation t : src.getNote()) + tgt.addNote(convertAnnotation(t)); + for (org.hl7.fhir.r4.model.Procedure.ProcedureFocalDeviceComponent t : src.getFocalDevice()) + tgt.addFocalDevice(convertProcedureFocalDeviceComponent(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getUsedReference()) + tgt.addUsedReference(convertReference(t)); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getUsedCode()) + tgt.addUsedCode(convertCodeableConcept(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.Procedure convertProcedure(org.hl7.fhir.r5.model.Procedure src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Procedure tgt = new org.hl7.fhir.r4.model.Procedure(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + for (org.hl7.fhir.r5.model.CanonicalType t : src.getInstantiatesCanonical()) + tgt.getInstantiatesCanonical().add(convertCanonical(t)); + for (org.hl7.fhir.r5.model.UriType t : src.getInstantiatesUri()) + tgt.getInstantiatesUri().add(convertUri(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getBasedOn()) + tgt.addBasedOn(convertReference(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getPartOf()) + tgt.addPartOf(convertReference(t)); + if (src.hasStatus()) + tgt.setStatus(convertProcedureStatus(src.getStatus())); + if (src.hasStatusReason()) + tgt.setStatusReason(convertCodeableConcept(src.getStatusReason())); + if (src.hasCategory()) + tgt.setCategory(convertCodeableConcept(src.getCategory())); + if (src.hasCode()) + tgt.setCode(convertCodeableConcept(src.getCode())); + if (src.hasSubject()) + tgt.setSubject(convertReference(src.getSubject())); + if (src.hasEncounter()) + tgt.setEncounter(convertReference(src.getEncounter())); + if (src.hasPerformed()) + tgt.setPerformed(convertType(src.getPerformed())); + if (src.hasRecorder()) + tgt.setRecorder(convertReference(src.getRecorder())); + if (src.hasAsserter()) + tgt.setAsserter(convertReference(src.getAsserter())); + for (org.hl7.fhir.r5.model.Procedure.ProcedurePerformerComponent t : src.getPerformer()) + tgt.addPerformer(convertProcedurePerformerComponent(t)); + if (src.hasLocation()) + tgt.setLocation(convertReference(src.getLocation())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getReasonCode()) + tgt.addReasonCode(convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getReasonReference()) + tgt.addReasonReference(convertReference(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getBodySite()) + tgt.addBodySite(convertCodeableConcept(t)); + if (src.hasOutcome()) + tgt.setOutcome(convertCodeableConcept(src.getOutcome())); + for (org.hl7.fhir.r5.model.Reference t : src.getReport()) + tgt.addReport(convertReference(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getComplication()) + tgt.addComplication(convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getComplicationDetail()) + tgt.addComplicationDetail(convertReference(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getFollowUp()) + tgt.addFollowUp(convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.Annotation t : src.getNote()) + tgt.addNote(convertAnnotation(t)); + for (org.hl7.fhir.r5.model.Procedure.ProcedureFocalDeviceComponent t : src.getFocalDevice()) + tgt.addFocalDevice(convertProcedureFocalDeviceComponent(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getUsedReference()) + tgt.addUsedReference(convertReference(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getUsedCode()) + tgt.addUsedCode(convertCodeableConcept(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.Procedure.ProcedureStatus convertProcedureStatus(org.hl7.fhir.r4.model.Procedure.ProcedureStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PREPARATION: return org.hl7.fhir.r5.model.Procedure.ProcedureStatus.PREPARATION; + case INPROGRESS: return org.hl7.fhir.r5.model.Procedure.ProcedureStatus.INPROGRESS; + case NOTDONE: return org.hl7.fhir.r5.model.Procedure.ProcedureStatus.NOTDONE; + case ONHOLD: return org.hl7.fhir.r5.model.Procedure.ProcedureStatus.ONHOLD; + case STOPPED: return org.hl7.fhir.r5.model.Procedure.ProcedureStatus.STOPPED; + case COMPLETED: return org.hl7.fhir.r5.model.Procedure.ProcedureStatus.COMPLETED; + case ENTEREDINERROR: return org.hl7.fhir.r5.model.Procedure.ProcedureStatus.ENTEREDINERROR; + case UNKNOWN: return org.hl7.fhir.r5.model.Procedure.ProcedureStatus.UNKNOWN; + default: return org.hl7.fhir.r5.model.Procedure.ProcedureStatus.NULL; + } +} + + public static org.hl7.fhir.r4.model.Procedure.ProcedureStatus convertProcedureStatus(org.hl7.fhir.r5.model.Procedure.ProcedureStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PREPARATION: return org.hl7.fhir.r4.model.Procedure.ProcedureStatus.PREPARATION; + case INPROGRESS: return org.hl7.fhir.r4.model.Procedure.ProcedureStatus.INPROGRESS; + case NOTDONE: return org.hl7.fhir.r4.model.Procedure.ProcedureStatus.NOTDONE; + case ONHOLD: return org.hl7.fhir.r4.model.Procedure.ProcedureStatus.ONHOLD; + case STOPPED: return org.hl7.fhir.r4.model.Procedure.ProcedureStatus.STOPPED; + case COMPLETED: return org.hl7.fhir.r4.model.Procedure.ProcedureStatus.COMPLETED; + case ENTEREDINERROR: return org.hl7.fhir.r4.model.Procedure.ProcedureStatus.ENTEREDINERROR; + case UNKNOWN: return org.hl7.fhir.r4.model.Procedure.ProcedureStatus.UNKNOWN; + default: return org.hl7.fhir.r4.model.Procedure.ProcedureStatus.NULL; + } +} + + public static org.hl7.fhir.r5.model.Procedure.ProcedurePerformerComponent convertProcedurePerformerComponent(org.hl7.fhir.r4.model.Procedure.ProcedurePerformerComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Procedure.ProcedurePerformerComponent tgt = new org.hl7.fhir.r5.model.Procedure.ProcedurePerformerComponent(); + copyElement(src, tgt); + if (src.hasFunction()) + tgt.setFunction(convertCodeableConcept(src.getFunction())); + if (src.hasActor()) + tgt.setActor(convertReference(src.getActor())); + if (src.hasOnBehalfOf()) + tgt.setOnBehalfOf(convertReference(src.getOnBehalfOf())); + return tgt; + } + + public static org.hl7.fhir.r4.model.Procedure.ProcedurePerformerComponent convertProcedurePerformerComponent(org.hl7.fhir.r5.model.Procedure.ProcedurePerformerComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Procedure.ProcedurePerformerComponent tgt = new org.hl7.fhir.r4.model.Procedure.ProcedurePerformerComponent(); + copyElement(src, tgt); + if (src.hasFunction()) + tgt.setFunction(convertCodeableConcept(src.getFunction())); + if (src.hasActor()) + tgt.setActor(convertReference(src.getActor())); + if (src.hasOnBehalfOf()) + tgt.setOnBehalfOf(convertReference(src.getOnBehalfOf())); + return tgt; + } + + public static org.hl7.fhir.r5.model.Procedure.ProcedureFocalDeviceComponent convertProcedureFocalDeviceComponent(org.hl7.fhir.r4.model.Procedure.ProcedureFocalDeviceComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Procedure.ProcedureFocalDeviceComponent tgt = new org.hl7.fhir.r5.model.Procedure.ProcedureFocalDeviceComponent(); + copyElement(src, tgt); + if (src.hasAction()) + tgt.setAction(convertCodeableConcept(src.getAction())); + if (src.hasManipulated()) + tgt.setManipulated(convertReference(src.getManipulated())); + return tgt; + } + + public static org.hl7.fhir.r4.model.Procedure.ProcedureFocalDeviceComponent convertProcedureFocalDeviceComponent(org.hl7.fhir.r5.model.Procedure.ProcedureFocalDeviceComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Procedure.ProcedureFocalDeviceComponent tgt = new org.hl7.fhir.r4.model.Procedure.ProcedureFocalDeviceComponent(); + copyElement(src, tgt); + if (src.hasAction()) + tgt.setAction(convertCodeableConcept(src.getAction())); + if (src.hasManipulated()) + tgt.setManipulated(convertReference(src.getManipulated())); + return tgt; + } + + +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Provenance.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Provenance.java new file mode 100644 index 000000000..216a5775f --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Provenance.java @@ -0,0 +1,185 @@ +package org.hl7.fhir.convertors.conv40_50; + +import org.hl7.fhir.exceptions.FHIRException; + +import org.hl7.fhir.convertors.VersionConvertor_40_50; + + +/* + Copyright (c) 2011+, HL7, Inc. + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of HL7 nor the names of its contributors may be used to + endorse or promote products derived from this software without specific + prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + +*/ + +// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0 + + +public class Provenance extends VersionConvertor_40_50 { + + public static org.hl7.fhir.r5.model.Provenance convertProvenance(org.hl7.fhir.r4.model.Provenance src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Provenance tgt = new org.hl7.fhir.r5.model.Provenance(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r4.model.Reference t : src.getTarget()) + tgt.addTarget(convertReference(t)); + if (src.hasOccurred()) + tgt.setOccurred(convertType(src.getOccurred())); + if (src.hasRecorded()) + tgt.setRecordedElement(convertInstant(src.getRecordedElement())); + for (org.hl7.fhir.r4.model.UriType t : src.getPolicy()) + tgt.getPolicy().add(convertUri(t)); + if (src.hasLocation()) + tgt.setLocation(convertReference(src.getLocation())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getReason()) + tgt.addReason(convertCodeableConcept(t)); + if (src.hasActivity()) + tgt.setActivity(convertCodeableConcept(src.getActivity())); + for (org.hl7.fhir.r4.model.Provenance.ProvenanceAgentComponent t : src.getAgent()) + tgt.addAgent(convertProvenanceAgentComponent(t)); + for (org.hl7.fhir.r4.model.Provenance.ProvenanceEntityComponent t : src.getEntity()) + tgt.addEntity(convertProvenanceEntityComponent(t)); + for (org.hl7.fhir.r4.model.Signature t : src.getSignature()) + tgt.addSignature(convertSignature(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.Provenance convertProvenance(org.hl7.fhir.r5.model.Provenance src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Provenance tgt = new org.hl7.fhir.r4.model.Provenance(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Reference t : src.getTarget()) + tgt.addTarget(convertReference(t)); + if (src.hasOccurred()) + tgt.setOccurred(convertType(src.getOccurred())); + if (src.hasRecorded()) + tgt.setRecordedElement(convertInstant(src.getRecordedElement())); + for (org.hl7.fhir.r5.model.UriType t : src.getPolicy()) + tgt.getPolicy().add(convertUri(t)); + if (src.hasLocation()) + tgt.setLocation(convertReference(src.getLocation())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getReason()) + tgt.addReason(convertCodeableConcept(t)); + if (src.hasActivity()) + tgt.setActivity(convertCodeableConcept(src.getActivity())); + for (org.hl7.fhir.r5.model.Provenance.ProvenanceAgentComponent t : src.getAgent()) + tgt.addAgent(convertProvenanceAgentComponent(t)); + for (org.hl7.fhir.r5.model.Provenance.ProvenanceEntityComponent t : src.getEntity()) + tgt.addEntity(convertProvenanceEntityComponent(t)); + for (org.hl7.fhir.r5.model.Signature t : src.getSignature()) + tgt.addSignature(convertSignature(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.Provenance.ProvenanceAgentComponent convertProvenanceAgentComponent(org.hl7.fhir.r4.model.Provenance.ProvenanceAgentComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Provenance.ProvenanceAgentComponent tgt = new org.hl7.fhir.r5.model.Provenance.ProvenanceAgentComponent(); + copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getRole()) + tgt.addRole(convertCodeableConcept(t)); + if (src.hasWho()) + tgt.setWho(convertReference(src.getWho())); + if (src.hasOnBehalfOf()) + tgt.setOnBehalfOf(convertReference(src.getOnBehalfOf())); + return tgt; + } + + public static org.hl7.fhir.r4.model.Provenance.ProvenanceAgentComponent convertProvenanceAgentComponent(org.hl7.fhir.r5.model.Provenance.ProvenanceAgentComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Provenance.ProvenanceAgentComponent tgt = new org.hl7.fhir.r4.model.Provenance.ProvenanceAgentComponent(); + copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getRole()) + tgt.addRole(convertCodeableConcept(t)); + if (src.hasWho()) + tgt.setWho(convertReference(src.getWho())); + if (src.hasOnBehalfOf()) + tgt.setOnBehalfOf(convertReference(src.getOnBehalfOf())); + return tgt; + } + + public static org.hl7.fhir.r5.model.Provenance.ProvenanceEntityComponent convertProvenanceEntityComponent(org.hl7.fhir.r4.model.Provenance.ProvenanceEntityComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Provenance.ProvenanceEntityComponent tgt = new org.hl7.fhir.r5.model.Provenance.ProvenanceEntityComponent(); + copyElement(src, tgt); + if (src.hasRole()) + tgt.setRole(convertProvenanceEntityRole(src.getRole())); + if (src.hasWhat()) + tgt.setWhat(convertReference(src.getWhat())); + for (org.hl7.fhir.r4.model.Provenance.ProvenanceAgentComponent t : src.getAgent()) + tgt.addAgent(convertProvenanceAgentComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.Provenance.ProvenanceEntityComponent convertProvenanceEntityComponent(org.hl7.fhir.r5.model.Provenance.ProvenanceEntityComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Provenance.ProvenanceEntityComponent tgt = new org.hl7.fhir.r4.model.Provenance.ProvenanceEntityComponent(); + copyElement(src, tgt); + if (src.hasRole()) + tgt.setRole(convertProvenanceEntityRole(src.getRole())); + if (src.hasWhat()) + tgt.setWhat(convertReference(src.getWhat())); + for (org.hl7.fhir.r5.model.Provenance.ProvenanceAgentComponent t : src.getAgent()) + tgt.addAgent(convertProvenanceAgentComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.Provenance.ProvenanceEntityRole convertProvenanceEntityRole(org.hl7.fhir.r4.model.Provenance.ProvenanceEntityRole src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case DERIVATION: return org.hl7.fhir.r5.model.Provenance.ProvenanceEntityRole.DERIVATION; + case REVISION: return org.hl7.fhir.r5.model.Provenance.ProvenanceEntityRole.REVISION; + case QUOTATION: return org.hl7.fhir.r5.model.Provenance.ProvenanceEntityRole.QUOTATION; + case SOURCE: return org.hl7.fhir.r5.model.Provenance.ProvenanceEntityRole.SOURCE; + case REMOVAL: return org.hl7.fhir.r5.model.Provenance.ProvenanceEntityRole.REMOVAL; + default: return org.hl7.fhir.r5.model.Provenance.ProvenanceEntityRole.NULL; + } +} + + public static org.hl7.fhir.r4.model.Provenance.ProvenanceEntityRole convertProvenanceEntityRole(org.hl7.fhir.r5.model.Provenance.ProvenanceEntityRole src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case DERIVATION: return org.hl7.fhir.r4.model.Provenance.ProvenanceEntityRole.DERIVATION; + case REVISION: return org.hl7.fhir.r4.model.Provenance.ProvenanceEntityRole.REVISION; + case QUOTATION: return org.hl7.fhir.r4.model.Provenance.ProvenanceEntityRole.QUOTATION; + case SOURCE: return org.hl7.fhir.r4.model.Provenance.ProvenanceEntityRole.SOURCE; + case REMOVAL: return org.hl7.fhir.r4.model.Provenance.ProvenanceEntityRole.REMOVAL; + default: return org.hl7.fhir.r4.model.Provenance.ProvenanceEntityRole.NULL; + } +} + + +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Questionnaire.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Questionnaire.java new file mode 100644 index 000000000..946715367 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Questionnaire.java @@ -0,0 +1,399 @@ +package org.hl7.fhir.convertors.conv40_50; + +import org.hl7.fhir.exceptions.FHIRException; + +import org.hl7.fhir.convertors.VersionConvertor_40_50; + + +/* + Copyright (c) 2011+, HL7, Inc. + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of HL7 nor the names of its contributors may be used to + endorse or promote products derived from this software without specific + prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + +*/ + +// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0 + + +public class Questionnaire extends VersionConvertor_40_50 { + + public static org.hl7.fhir.r5.model.Questionnaire convertQuestionnaire(org.hl7.fhir.r4.model.Questionnaire src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Questionnaire tgt = new org.hl7.fhir.r5.model.Questionnaire(); + copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrlElement(convertUri(src.getUrlElement())); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasVersion()) + tgt.setVersionElement(convertString(src.getVersionElement())); + if (src.hasName()) + tgt.setNameElement(convertString(src.getNameElement())); + if (src.hasTitle()) + tgt.setTitleElement(convertString(src.getTitleElement())); + for (org.hl7.fhir.r4.model.CanonicalType t : src.getDerivedFrom()) + tgt.getDerivedFrom().add(convertCanonical(t)); + if (src.hasStatus()) + tgt.setStatus(Enumerations.convertPublicationStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimentalElement(convertBoolean(src.getExperimentalElement())); + for (org.hl7.fhir.r4.model.CodeType t : src.getSubjectType()) + tgt.getSubjectType().add(convertCode(t)); + if (src.hasDate()) + tgt.setDateElement(convertDateTime(src.getDateElement())); + if (src.hasPublisher()) + tgt.setPublisherElement(convertString(src.getPublisherElement())); + for (org.hl7.fhir.r4.model.ContactDetail t : src.getContact()) + tgt.addContact(convertContactDetail(t)); + if (src.hasDescription()) + tgt.setDescriptionElement(convertMarkdown(src.getDescriptionElement())); + for (org.hl7.fhir.r4.model.UsageContext t : src.getUseContext()) + tgt.addUseContext(convertUsageContext(t)); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getJurisdiction()) + tgt.addJurisdiction(convertCodeableConcept(t)); + if (src.hasPurpose()) + tgt.setPurposeElement(convertMarkdown(src.getPurposeElement())); + if (src.hasCopyright()) + tgt.setCopyrightElement(convertMarkdown(src.getCopyrightElement())); + if (src.hasApprovalDate()) + tgt.setApprovalDateElement(convertDate(src.getApprovalDateElement())); + if (src.hasLastReviewDate()) + tgt.setLastReviewDateElement(convertDate(src.getLastReviewDateElement())); + if (src.hasEffectivePeriod()) + tgt.setEffectivePeriod(convertPeriod(src.getEffectivePeriod())); + for (org.hl7.fhir.r4.model.Coding t : src.getCode()) + tgt.addCode(convertCoding(t)); + for (org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemComponent t : src.getItem()) + tgt.addItem(convertQuestionnaireItemComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.Questionnaire convertQuestionnaire(org.hl7.fhir.r5.model.Questionnaire src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Questionnaire tgt = new org.hl7.fhir.r4.model.Questionnaire(); + copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrlElement(convertUri(src.getUrlElement())); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasVersion()) + tgt.setVersionElement(convertString(src.getVersionElement())); + if (src.hasName()) + tgt.setNameElement(convertString(src.getNameElement())); + if (src.hasTitle()) + tgt.setTitleElement(convertString(src.getTitleElement())); + for (org.hl7.fhir.r5.model.CanonicalType t : src.getDerivedFrom()) + tgt.getDerivedFrom().add(convertCanonical(t)); + if (src.hasStatus()) + tgt.setStatus(Enumerations.convertPublicationStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimentalElement(convertBoolean(src.getExperimentalElement())); + for (org.hl7.fhir.r5.model.CodeType t : src.getSubjectType()) + tgt.getSubjectType().add(convertCode(t)); + if (src.hasDate()) + tgt.setDateElement(convertDateTime(src.getDateElement())); + if (src.hasPublisher()) + tgt.setPublisherElement(convertString(src.getPublisherElement())); + for (org.hl7.fhir.r5.model.ContactDetail t : src.getContact()) + tgt.addContact(convertContactDetail(t)); + if (src.hasDescription()) + tgt.setDescriptionElement(convertMarkdown(src.getDescriptionElement())); + for (org.hl7.fhir.r5.model.UsageContext t : src.getUseContext()) + tgt.addUseContext(convertUsageContext(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getJurisdiction()) + tgt.addJurisdiction(convertCodeableConcept(t)); + if (src.hasPurpose()) + tgt.setPurposeElement(convertMarkdown(src.getPurposeElement())); + if (src.hasCopyright()) + tgt.setCopyrightElement(convertMarkdown(src.getCopyrightElement())); + if (src.hasApprovalDate()) + tgt.setApprovalDateElement(convertDate(src.getApprovalDateElement())); + if (src.hasLastReviewDate()) + tgt.setLastReviewDateElement(convertDate(src.getLastReviewDateElement())); + if (src.hasEffectivePeriod()) + tgt.setEffectivePeriod(convertPeriod(src.getEffectivePeriod())); + for (org.hl7.fhir.r5.model.Coding t : src.getCode()) + tgt.addCode(convertCoding(t)); + for (org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemComponent t : src.getItem()) + tgt.addItem(convertQuestionnaireItemComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemComponent convertQuestionnaireItemComponent(org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemComponent tgt = new org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemComponent(); + copyElement(src, tgt); + if (src.hasLinkId()) + tgt.setLinkIdElement(convertString(src.getLinkIdElement())); + if (src.hasDefinition()) + tgt.setDefinitionElement(convertUri(src.getDefinitionElement())); + for (org.hl7.fhir.r4.model.Coding t : src.getCode()) + tgt.addCode(convertCoding(t)); + if (src.hasPrefix()) + tgt.setPrefixElement(convertString(src.getPrefixElement())); + if (src.hasText()) + tgt.setTextElement(convertString(src.getTextElement())); + if (src.hasType()) + tgt.setType(convertQuestionnaireItemType(src.getType())); + for (org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemEnableWhenComponent t : src.getEnableWhen()) + tgt.addEnableWhen(convertQuestionnaireItemEnableWhenComponent(t)); + if (src.hasEnableBehavior()) + tgt.setEnableBehavior(convertEnableWhenBehavior(src.getEnableBehavior())); + if (src.hasRequired()) + tgt.setRequiredElement(convertBoolean(src.getRequiredElement())); + if (src.hasRepeats()) + tgt.setRepeatsElement(convertBoolean(src.getRepeatsElement())); + if (src.hasReadOnly()) + tgt.setReadOnlyElement(convertBoolean(src.getReadOnlyElement())); + if (src.hasMaxLength()) + tgt.setMaxLengthElement(convertInteger(src.getMaxLengthElement())); + if (src.hasAnswerValueSet()) + tgt.setAnswerValueSetElement(convertCanonical(src.getAnswerValueSetElement())); + for (org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemAnswerOptionComponent t : src.getAnswerOption()) + tgt.addAnswerOption(convertQuestionnaireItemAnswerOptionComponent(t)); + for (org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemInitialComponent t : src.getInitial()) + tgt.addInitial(convertQuestionnaireItemInitialComponent(t)); + for (org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemComponent t : src.getItem()) + tgt.addItem(convertQuestionnaireItemComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemComponent convertQuestionnaireItemComponent(org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemComponent tgt = new org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemComponent(); + copyElement(src, tgt); + if (src.hasLinkId()) + tgt.setLinkIdElement(convertString(src.getLinkIdElement())); + if (src.hasDefinition()) + tgt.setDefinitionElement(convertUri(src.getDefinitionElement())); + for (org.hl7.fhir.r5.model.Coding t : src.getCode()) + tgt.addCode(convertCoding(t)); + if (src.hasPrefix()) + tgt.setPrefixElement(convertString(src.getPrefixElement())); + if (src.hasText()) + tgt.setTextElement(convertString(src.getTextElement())); + if (src.hasType()) + tgt.setType(convertQuestionnaireItemType(src.getType())); + for (org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemEnableWhenComponent t : src.getEnableWhen()) + tgt.addEnableWhen(convertQuestionnaireItemEnableWhenComponent(t)); + if (src.hasEnableBehavior()) + tgt.setEnableBehavior(convertEnableWhenBehavior(src.getEnableBehavior())); + if (src.hasRequired()) + tgt.setRequiredElement(convertBoolean(src.getRequiredElement())); + if (src.hasRepeats()) + tgt.setRepeatsElement(convertBoolean(src.getRepeatsElement())); + if (src.hasReadOnly()) + tgt.setReadOnlyElement(convertBoolean(src.getReadOnlyElement())); + if (src.hasMaxLength()) + tgt.setMaxLengthElement(convertInteger(src.getMaxLengthElement())); + if (src.hasAnswerValueSet()) + tgt.setAnswerValueSetElement(convertCanonical(src.getAnswerValueSetElement())); + for (org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemAnswerOptionComponent t : src.getAnswerOption()) + tgt.addAnswerOption(convertQuestionnaireItemAnswerOptionComponent(t)); + for (org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemInitialComponent t : src.getInitial()) + tgt.addInitial(convertQuestionnaireItemInitialComponent(t)); + for (org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemComponent t : src.getItem()) + tgt.addItem(convertQuestionnaireItemComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType convertQuestionnaireItemType(org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case GROUP: return org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.GROUP; + case DISPLAY: return org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.DISPLAY; + case QUESTION: return org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.QUESTION; + case BOOLEAN: return org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.BOOLEAN; + case DECIMAL: return org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.DECIMAL; + case INTEGER: return org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.INTEGER; + case DATE: return org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.DATE; + case DATETIME: return org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.DATETIME; + case TIME: return org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.TIME; + case STRING: return org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.STRING; + case TEXT: return org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.TEXT; + case URL: return org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.URL; + case CHOICE: return org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.CHOICE; + case OPENCHOICE: return org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.OPENCHOICE; + case ATTACHMENT: return org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.ATTACHMENT; + case REFERENCE: return org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.REFERENCE; + case QUANTITY: return org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.QUANTITY; + default: return org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.NULL; + } +} + + public static org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType convertQuestionnaireItemType(org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case GROUP: return org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.GROUP; + case DISPLAY: return org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.DISPLAY; + case QUESTION: return org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.QUESTION; + case BOOLEAN: return org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.BOOLEAN; + case DECIMAL: return org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.DECIMAL; + case INTEGER: return org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.INTEGER; + case DATE: return org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.DATE; + case DATETIME: return org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.DATETIME; + case TIME: return org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.TIME; + case STRING: return org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.STRING; + case TEXT: return org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.TEXT; + case URL: return org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.URL; + case CHOICE: return org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.CHOICE; + case OPENCHOICE: return org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.OPENCHOICE; + case ATTACHMENT: return org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.ATTACHMENT; + case REFERENCE: return org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.REFERENCE; + case QUANTITY: return org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.QUANTITY; + default: return org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.NULL; + } +} + + public static org.hl7.fhir.r5.model.Questionnaire.EnableWhenBehavior convertEnableWhenBehavior(org.hl7.fhir.r4.model.Questionnaire.EnableWhenBehavior src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case ALL: return org.hl7.fhir.r5.model.Questionnaire.EnableWhenBehavior.ALL; + case ANY: return org.hl7.fhir.r5.model.Questionnaire.EnableWhenBehavior.ANY; + default: return org.hl7.fhir.r5.model.Questionnaire.EnableWhenBehavior.NULL; + } +} + + public static org.hl7.fhir.r4.model.Questionnaire.EnableWhenBehavior convertEnableWhenBehavior(org.hl7.fhir.r5.model.Questionnaire.EnableWhenBehavior src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case ALL: return org.hl7.fhir.r4.model.Questionnaire.EnableWhenBehavior.ALL; + case ANY: return org.hl7.fhir.r4.model.Questionnaire.EnableWhenBehavior.ANY; + default: return org.hl7.fhir.r4.model.Questionnaire.EnableWhenBehavior.NULL; + } +} + + public static org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemEnableWhenComponent convertQuestionnaireItemEnableWhenComponent(org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemEnableWhenComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemEnableWhenComponent tgt = new org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemEnableWhenComponent(); + copyElement(src, tgt); + if (src.hasQuestion()) + tgt.setQuestionElement(convertString(src.getQuestionElement())); + if (src.hasOperator()) + tgt.setOperator(convertQuestionnaireItemOperator(src.getOperator())); + if (src.hasAnswer()) + tgt.setAnswer(convertType(src.getAnswer())); + return tgt; + } + + public static org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemEnableWhenComponent convertQuestionnaireItemEnableWhenComponent(org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemEnableWhenComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemEnableWhenComponent tgt = new org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemEnableWhenComponent(); + copyElement(src, tgt); + if (src.hasQuestion()) + tgt.setQuestionElement(convertString(src.getQuestionElement())); + if (src.hasOperator()) + tgt.setOperator(convertQuestionnaireItemOperator(src.getOperator())); + if (src.hasAnswer()) + tgt.setAnswer(convertType(src.getAnswer())); + return tgt; + } + + public static org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemOperator convertQuestionnaireItemOperator(org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemOperator src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case EXISTS: return org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemOperator.EXISTS; + case EQUAL: return org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemOperator.EQUAL; + case NOT_EQUAL: return org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemOperator.NOT_EQUAL; + case GREATER_THAN: return org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemOperator.GREATER_THAN; + case LESS_THAN: return org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemOperator.LESS_THAN; + case GREATER_OR_EQUAL: return org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemOperator.GREATER_OR_EQUAL; + case LESS_OR_EQUAL: return org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemOperator.LESS_OR_EQUAL; + default: return org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemOperator.NULL; + } +} + + public static org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemOperator convertQuestionnaireItemOperator(org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemOperator src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case EXISTS: return org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemOperator.EXISTS; + case EQUAL: return org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemOperator.EQUAL; + case NOT_EQUAL: return org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemOperator.NOT_EQUAL; + case GREATER_THAN: return org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemOperator.GREATER_THAN; + case LESS_THAN: return org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemOperator.LESS_THAN; + case GREATER_OR_EQUAL: return org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemOperator.GREATER_OR_EQUAL; + case LESS_OR_EQUAL: return org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemOperator.LESS_OR_EQUAL; + default: return org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemOperator.NULL; + } +} + + public static org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemAnswerOptionComponent convertQuestionnaireItemAnswerOptionComponent(org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemAnswerOptionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemAnswerOptionComponent tgt = new org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemAnswerOptionComponent(); + copyElement(src, tgt); + if (src.hasValue()) + tgt.setValue(convertType(src.getValue())); + if (src.hasInitialSelected()) + tgt.setInitialSelectedElement(convertBoolean(src.getInitialSelectedElement())); + return tgt; + } + + public static org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemAnswerOptionComponent convertQuestionnaireItemAnswerOptionComponent(org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemAnswerOptionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemAnswerOptionComponent tgt = new org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemAnswerOptionComponent(); + copyElement(src, tgt); + if (src.hasValue()) + tgt.setValue(convertType(src.getValue())); + if (src.hasInitialSelected()) + tgt.setInitialSelectedElement(convertBoolean(src.getInitialSelectedElement())); + return tgt; + } + + public static org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemInitialComponent convertQuestionnaireItemInitialComponent(org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemInitialComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemInitialComponent tgt = new org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemInitialComponent(); + copyElement(src, tgt); + if (src.hasValue()) + tgt.setValue(convertType(src.getValue())); + return tgt; + } + + public static org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemInitialComponent convertQuestionnaireItemInitialComponent(org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemInitialComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemInitialComponent tgt = new org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemInitialComponent(); + copyElement(src, tgt); + if (src.hasValue()) + tgt.setValue(convertType(src.getValue())); + return tgt; + } + + +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/QuestionnaireResponse.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/QuestionnaireResponse.java new file mode 100644 index 000000000..ff94981f6 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/QuestionnaireResponse.java @@ -0,0 +1,189 @@ +package org.hl7.fhir.convertors.conv40_50; + +import org.hl7.fhir.exceptions.FHIRException; + +import org.hl7.fhir.convertors.VersionConvertor_40_50; + + +/* + Copyright (c) 2011+, HL7, Inc. + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of HL7 nor the names of its contributors may be used to + endorse or promote products derived from this software without specific + prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + +*/ + +// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0 + + +public class QuestionnaireResponse extends VersionConvertor_40_50 { + + public static org.hl7.fhir.r5.model.QuestionnaireResponse convertQuestionnaireResponse(org.hl7.fhir.r4.model.QuestionnaireResponse src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.QuestionnaireResponse tgt = new org.hl7.fhir.r5.model.QuestionnaireResponse(); + copyDomainResource(src, tgt); + if (src.hasIdentifier()) + tgt.setIdentifier(convertIdentifier(src.getIdentifier())); + for (org.hl7.fhir.r4.model.Reference t : src.getBasedOn()) + tgt.addBasedOn(convertReference(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getPartOf()) + tgt.addPartOf(convertReference(t)); + if (src.hasQuestionnaire()) + tgt.setQuestionnaireElement(convertCanonical(src.getQuestionnaireElement())); + if (src.hasStatus()) + tgt.setStatus(convertQuestionnaireResponseStatus(src.getStatus())); + if (src.hasSubject()) + tgt.setSubject(convertReference(src.getSubject())); + if (src.hasEncounter()) + tgt.setEncounter(convertReference(src.getEncounter())); + if (src.hasAuthored()) + tgt.setAuthoredElement(convertDateTime(src.getAuthoredElement())); + if (src.hasAuthor()) + tgt.setAuthor(convertReference(src.getAuthor())); + if (src.hasSource()) + tgt.setSource(convertReference(src.getSource())); + for (org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseItemComponent t : src.getItem()) + tgt.addItem(convertQuestionnaireResponseItemComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.QuestionnaireResponse convertQuestionnaireResponse(org.hl7.fhir.r5.model.QuestionnaireResponse src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.QuestionnaireResponse tgt = new org.hl7.fhir.r4.model.QuestionnaireResponse(); + copyDomainResource(src, tgt); + if (src.hasIdentifier()) + tgt.setIdentifier(convertIdentifier(src.getIdentifier())); + for (org.hl7.fhir.r5.model.Reference t : src.getBasedOn()) + tgt.addBasedOn(convertReference(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getPartOf()) + tgt.addPartOf(convertReference(t)); + if (src.hasQuestionnaire()) + tgt.setQuestionnaireElement(convertCanonical(src.getQuestionnaireElement())); + if (src.hasStatus()) + tgt.setStatus(convertQuestionnaireResponseStatus(src.getStatus())); + if (src.hasSubject()) + tgt.setSubject(convertReference(src.getSubject())); + if (src.hasEncounter()) + tgt.setEncounter(convertReference(src.getEncounter())); + if (src.hasAuthored()) + tgt.setAuthoredElement(convertDateTime(src.getAuthoredElement())); + if (src.hasAuthor()) + tgt.setAuthor(convertReference(src.getAuthor())); + if (src.hasSource()) + tgt.setSource(convertReference(src.getSource())); + for (org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseItemComponent t : src.getItem()) + tgt.addItem(convertQuestionnaireResponseItemComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseStatus convertQuestionnaireResponseStatus(org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case INPROGRESS: return org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseStatus.INPROGRESS; + case COMPLETED: return org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseStatus.COMPLETED; + case AMENDED: return org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseStatus.AMENDED; + case ENTEREDINERROR: return org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseStatus.ENTEREDINERROR; + case STOPPED: return org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseStatus.STOPPED; + default: return org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseStatus.NULL; + } +} + + public static org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseStatus convertQuestionnaireResponseStatus(org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case INPROGRESS: return org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseStatus.INPROGRESS; + case COMPLETED: return org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseStatus.COMPLETED; + case AMENDED: return org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseStatus.AMENDED; + case ENTEREDINERROR: return org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseStatus.ENTEREDINERROR; + case STOPPED: return org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseStatus.STOPPED; + default: return org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseStatus.NULL; + } +} + + public static org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseItemComponent convertQuestionnaireResponseItemComponent(org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseItemComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseItemComponent tgt = new org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseItemComponent(); + copyElement(src, tgt); + if (src.hasLinkId()) + tgt.setLinkIdElement(convertString(src.getLinkIdElement())); + if (src.hasDefinition()) + tgt.setDefinitionElement(convertUri(src.getDefinitionElement())); + if (src.hasText()) + tgt.setTextElement(convertString(src.getTextElement())); + for (org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent t : src.getAnswer()) + tgt.addAnswer(convertQuestionnaireResponseItemAnswerComponent(t)); + for (org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseItemComponent t : src.getItem()) + tgt.addItem(convertQuestionnaireResponseItemComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseItemComponent convertQuestionnaireResponseItemComponent(org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseItemComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseItemComponent tgt = new org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseItemComponent(); + copyElement(src, tgt); + if (src.hasLinkId()) + tgt.setLinkIdElement(convertString(src.getLinkIdElement())); + if (src.hasDefinition()) + tgt.setDefinitionElement(convertUri(src.getDefinitionElement())); + if (src.hasText()) + tgt.setTextElement(convertString(src.getTextElement())); + for (org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent t : src.getAnswer()) + tgt.addAnswer(convertQuestionnaireResponseItemAnswerComponent(t)); + for (org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseItemComponent t : src.getItem()) + tgt.addItem(convertQuestionnaireResponseItemComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent convertQuestionnaireResponseItemAnswerComponent(org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent tgt = new org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent(); + copyElement(src, tgt); + if (src.hasValue()) + tgt.setValue(convertType(src.getValue())); + for (org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseItemComponent t : src.getItem()) + tgt.addItem(convertQuestionnaireResponseItemComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent convertQuestionnaireResponseItemAnswerComponent(org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent tgt = new org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent(); + copyElement(src, tgt); + if (src.hasValue()) + tgt.setValue(convertType(src.getValue())); + for (org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseItemComponent t : src.getItem()) + tgt.addItem(convertQuestionnaireResponseItemComponent(t)); + return tgt; + } + + +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/RelatedPerson.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/RelatedPerson.java new file mode 100644 index 000000000..c6298f281 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/RelatedPerson.java @@ -0,0 +1,131 @@ +package org.hl7.fhir.convertors.conv40_50; + +import org.hl7.fhir.exceptions.FHIRException; + +import org.hl7.fhir.convertors.VersionConvertor_40_50; + + +/* + Copyright (c) 2011+, HL7, Inc. + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of HL7 nor the names of its contributors may be used to + endorse or promote products derived from this software without specific + prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + +*/ + +// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0 + + +public class RelatedPerson extends VersionConvertor_40_50 { + + public static org.hl7.fhir.r5.model.RelatedPerson convertRelatedPerson(org.hl7.fhir.r4.model.RelatedPerson src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.RelatedPerson tgt = new org.hl7.fhir.r5.model.RelatedPerson(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasActive()) + tgt.setActiveElement(convertBoolean(src.getActiveElement())); + if (src.hasPatient()) + tgt.setPatient(convertReference(src.getPatient())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getRelationship()) + tgt.addRelationship(convertCodeableConcept(t)); + for (org.hl7.fhir.r4.model.HumanName t : src.getName()) + tgt.addName(convertHumanName(t)); + for (org.hl7.fhir.r4.model.ContactPoint t : src.getTelecom()) + tgt.addTelecom(convertContactPoint(t)); + if (src.hasGender()) + tgt.setGender(Enumerations.convertAdministrativeGender(src.getGender())); + if (src.hasBirthDate()) + tgt.setBirthDateElement(convertDate(src.getBirthDateElement())); + for (org.hl7.fhir.r4.model.Address t : src.getAddress()) + tgt.addAddress(convertAddress(t)); + for (org.hl7.fhir.r4.model.Attachment t : src.getPhoto()) + tgt.addPhoto(convertAttachment(t)); + if (src.hasPeriod()) + tgt.setPeriod(convertPeriod(src.getPeriod())); + for (org.hl7.fhir.r4.model.RelatedPerson.RelatedPersonCommunicationComponent t : src.getCommunication()) + tgt.addCommunication(convertRelatedPersonCommunicationComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.RelatedPerson convertRelatedPerson(org.hl7.fhir.r5.model.RelatedPerson src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.RelatedPerson tgt = new org.hl7.fhir.r4.model.RelatedPerson(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasActive()) + tgt.setActiveElement(convertBoolean(src.getActiveElement())); + if (src.hasPatient()) + tgt.setPatient(convertReference(src.getPatient())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getRelationship()) + tgt.addRelationship(convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.HumanName t : src.getName()) + tgt.addName(convertHumanName(t)); + for (org.hl7.fhir.r5.model.ContactPoint t : src.getTelecom()) + tgt.addTelecom(convertContactPoint(t)); + if (src.hasGender()) + tgt.setGender(Enumerations.convertAdministrativeGender(src.getGender())); + if (src.hasBirthDate()) + tgt.setBirthDateElement(convertDate(src.getBirthDateElement())); + for (org.hl7.fhir.r5.model.Address t : src.getAddress()) + tgt.addAddress(convertAddress(t)); + for (org.hl7.fhir.r5.model.Attachment t : src.getPhoto()) + tgt.addPhoto(convertAttachment(t)); + if (src.hasPeriod()) + tgt.setPeriod(convertPeriod(src.getPeriod())); + for (org.hl7.fhir.r5.model.RelatedPerson.RelatedPersonCommunicationComponent t : src.getCommunication()) + tgt.addCommunication(convertRelatedPersonCommunicationComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.RelatedPerson.RelatedPersonCommunicationComponent convertRelatedPersonCommunicationComponent(org.hl7.fhir.r4.model.RelatedPerson.RelatedPersonCommunicationComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.RelatedPerson.RelatedPersonCommunicationComponent tgt = new org.hl7.fhir.r5.model.RelatedPerson.RelatedPersonCommunicationComponent(); + copyElement(src, tgt); + if (src.hasLanguage()) + tgt.setLanguage(convertCodeableConcept(src.getLanguage())); + if (src.hasPreferred()) + tgt.setPreferredElement(convertBoolean(src.getPreferredElement())); + return tgt; + } + + public static org.hl7.fhir.r4.model.RelatedPerson.RelatedPersonCommunicationComponent convertRelatedPersonCommunicationComponent(org.hl7.fhir.r5.model.RelatedPerson.RelatedPersonCommunicationComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.RelatedPerson.RelatedPersonCommunicationComponent tgt = new org.hl7.fhir.r4.model.RelatedPerson.RelatedPersonCommunicationComponent(); + copyElement(src, tgt); + if (src.hasLanguage()) + tgt.setLanguage(convertCodeableConcept(src.getLanguage())); + if (src.hasPreferred()) + tgt.setPreferredElement(convertBoolean(src.getPreferredElement())); + return tgt; + } + + +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/RequestGroup.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/RequestGroup.java new file mode 100644 index 000000000..cb03309fa --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/RequestGroup.java @@ -0,0 +1,531 @@ +package org.hl7.fhir.convertors.conv40_50; + +import org.hl7.fhir.exceptions.FHIRException; + +import org.hl7.fhir.convertors.VersionConvertor_40_50; + + +/* + Copyright (c) 2011+, HL7, Inc. + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of HL7 nor the names of its contributors may be used to + endorse or promote products derived from this software without specific + prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + +*/ + +// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0 + + +public class RequestGroup extends VersionConvertor_40_50 { + + public static org.hl7.fhir.r5.model.RequestGroup convertRequestGroup(org.hl7.fhir.r4.model.RequestGroup src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.RequestGroup tgt = new org.hl7.fhir.r5.model.RequestGroup(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + for (org.hl7.fhir.r4.model.CanonicalType t : src.getInstantiatesCanonical()) + tgt.getInstantiatesCanonical().add(convertCanonical(t)); + for (org.hl7.fhir.r4.model.UriType t : src.getInstantiatesUri()) + tgt.getInstantiatesUri().add(convertUri(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getBasedOn()) + tgt.addBasedOn(convertReference(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getReplaces()) + tgt.addReplaces(convertReference(t)); + if (src.hasGroupIdentifier()) + tgt.setGroupIdentifier(convertIdentifier(src.getGroupIdentifier())); + if (src.hasStatus()) + tgt.setStatus(convertRequestStatus(src.getStatus())); + if (src.hasIntent()) + tgt.setIntent(convertRequestIntent(src.getIntent())); + if (src.hasPriority()) + tgt.setPriority(convertRequestPriority(src.getPriority())); + if (src.hasCode()) + tgt.setCode(convertCodeableConcept(src.getCode())); + if (src.hasSubject()) + tgt.setSubject(convertReference(src.getSubject())); + if (src.hasEncounter()) + tgt.setEncounter(convertReference(src.getEncounter())); + if (src.hasAuthoredOn()) + tgt.setAuthoredOnElement(convertDateTime(src.getAuthoredOnElement())); + if (src.hasAuthor()) + tgt.setAuthor(convertReference(src.getAuthor())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getReasonCode()) + tgt.addReasonCode(convertCodeableConcept(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getReasonReference()) + tgt.addReasonReference(convertReference(t)); + for (org.hl7.fhir.r4.model.Annotation t : src.getNote()) + tgt.addNote(convertAnnotation(t)); + for (org.hl7.fhir.r4.model.RequestGroup.RequestGroupActionComponent t : src.getAction()) + tgt.addAction(convertRequestGroupActionComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.RequestGroup convertRequestGroup(org.hl7.fhir.r5.model.RequestGroup src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.RequestGroup tgt = new org.hl7.fhir.r4.model.RequestGroup(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + for (org.hl7.fhir.r5.model.CanonicalType t : src.getInstantiatesCanonical()) + tgt.getInstantiatesCanonical().add(convertCanonical(t)); + for (org.hl7.fhir.r5.model.UriType t : src.getInstantiatesUri()) + tgt.getInstantiatesUri().add(convertUri(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getBasedOn()) + tgt.addBasedOn(convertReference(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getReplaces()) + tgt.addReplaces(convertReference(t)); + if (src.hasGroupIdentifier()) + tgt.setGroupIdentifier(convertIdentifier(src.getGroupIdentifier())); + if (src.hasStatus()) + tgt.setStatus(convertRequestStatus(src.getStatus())); + if (src.hasIntent()) + tgt.setIntent(convertRequestIntent(src.getIntent())); + if (src.hasPriority()) + tgt.setPriority(convertRequestPriority(src.getPriority())); + if (src.hasCode()) + tgt.setCode(convertCodeableConcept(src.getCode())); + if (src.hasSubject()) + tgt.setSubject(convertReference(src.getSubject())); + if (src.hasEncounter()) + tgt.setEncounter(convertReference(src.getEncounter())); + if (src.hasAuthoredOn()) + tgt.setAuthoredOnElement(convertDateTime(src.getAuthoredOnElement())); + if (src.hasAuthor()) + tgt.setAuthor(convertReference(src.getAuthor())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getReasonCode()) + tgt.addReasonCode(convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getReasonReference()) + tgt.addReasonReference(convertReference(t)); + for (org.hl7.fhir.r5.model.Annotation t : src.getNote()) + tgt.addNote(convertAnnotation(t)); + for (org.hl7.fhir.r5.model.RequestGroup.RequestGroupActionComponent t : src.getAction()) + tgt.addAction(convertRequestGroupActionComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.RequestGroup.RequestStatus convertRequestStatus(org.hl7.fhir.r4.model.RequestGroup.RequestStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case DRAFT: return org.hl7.fhir.r5.model.RequestGroup.RequestStatus.DRAFT; + case ACTIVE: return org.hl7.fhir.r5.model.RequestGroup.RequestStatus.ACTIVE; + case ONHOLD: return org.hl7.fhir.r5.model.RequestGroup.RequestStatus.ONHOLD; + case REVOKED: return org.hl7.fhir.r5.model.RequestGroup.RequestStatus.REVOKED; + case COMPLETED: return org.hl7.fhir.r5.model.RequestGroup.RequestStatus.COMPLETED; + case ENTEREDINERROR: return org.hl7.fhir.r5.model.RequestGroup.RequestStatus.ENTEREDINERROR; + case UNKNOWN: return org.hl7.fhir.r5.model.RequestGroup.RequestStatus.UNKNOWN; + default: return org.hl7.fhir.r5.model.RequestGroup.RequestStatus.NULL; + } +} + + public static org.hl7.fhir.r4.model.RequestGroup.RequestStatus convertRequestStatus(org.hl7.fhir.r5.model.RequestGroup.RequestStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case DRAFT: return org.hl7.fhir.r4.model.RequestGroup.RequestStatus.DRAFT; + case ACTIVE: return org.hl7.fhir.r4.model.RequestGroup.RequestStatus.ACTIVE; + case ONHOLD: return org.hl7.fhir.r4.model.RequestGroup.RequestStatus.ONHOLD; + case REVOKED: return org.hl7.fhir.r4.model.RequestGroup.RequestStatus.REVOKED; + case COMPLETED: return org.hl7.fhir.r4.model.RequestGroup.RequestStatus.COMPLETED; + case ENTEREDINERROR: return org.hl7.fhir.r4.model.RequestGroup.RequestStatus.ENTEREDINERROR; + case UNKNOWN: return org.hl7.fhir.r4.model.RequestGroup.RequestStatus.UNKNOWN; + default: return org.hl7.fhir.r4.model.RequestGroup.RequestStatus.NULL; + } +} + + public static org.hl7.fhir.r5.model.RequestGroup.RequestIntent convertRequestIntent(org.hl7.fhir.r4.model.RequestGroup.RequestIntent src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PROPOSAL: return org.hl7.fhir.r5.model.RequestGroup.RequestIntent.PROPOSAL; + case PLAN: return org.hl7.fhir.r5.model.RequestGroup.RequestIntent.PLAN; + case DIRECTIVE: return org.hl7.fhir.r5.model.RequestGroup.RequestIntent.DIRECTIVE; + case ORDER: return org.hl7.fhir.r5.model.RequestGroup.RequestIntent.ORDER; + case ORIGINALORDER: return org.hl7.fhir.r5.model.RequestGroup.RequestIntent.ORIGINALORDER; + case REFLEXORDER: return org.hl7.fhir.r5.model.RequestGroup.RequestIntent.REFLEXORDER; + case FILLERORDER: return org.hl7.fhir.r5.model.RequestGroup.RequestIntent.FILLERORDER; + case INSTANCEORDER: return org.hl7.fhir.r5.model.RequestGroup.RequestIntent.INSTANCEORDER; + case OPTION: return org.hl7.fhir.r5.model.RequestGroup.RequestIntent.OPTION; + default: return org.hl7.fhir.r5.model.RequestGroup.RequestIntent.NULL; + } +} + + public static org.hl7.fhir.r4.model.RequestGroup.RequestIntent convertRequestIntent(org.hl7.fhir.r5.model.RequestGroup.RequestIntent src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PROPOSAL: return org.hl7.fhir.r4.model.RequestGroup.RequestIntent.PROPOSAL; + case PLAN: return org.hl7.fhir.r4.model.RequestGroup.RequestIntent.PLAN; + case DIRECTIVE: return org.hl7.fhir.r4.model.RequestGroup.RequestIntent.DIRECTIVE; + case ORDER: return org.hl7.fhir.r4.model.RequestGroup.RequestIntent.ORDER; + case ORIGINALORDER: return org.hl7.fhir.r4.model.RequestGroup.RequestIntent.ORIGINALORDER; + case REFLEXORDER: return org.hl7.fhir.r4.model.RequestGroup.RequestIntent.REFLEXORDER; + case FILLERORDER: return org.hl7.fhir.r4.model.RequestGroup.RequestIntent.FILLERORDER; + case INSTANCEORDER: return org.hl7.fhir.r4.model.RequestGroup.RequestIntent.INSTANCEORDER; + case OPTION: return org.hl7.fhir.r4.model.RequestGroup.RequestIntent.OPTION; + default: return org.hl7.fhir.r4.model.RequestGroup.RequestIntent.NULL; + } +} + + public static org.hl7.fhir.r5.model.RequestGroup.RequestPriority convertRequestPriority(org.hl7.fhir.r4.model.RequestGroup.RequestPriority src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case ROUTINE: return org.hl7.fhir.r5.model.RequestGroup.RequestPriority.ROUTINE; + case URGENT: return org.hl7.fhir.r5.model.RequestGroup.RequestPriority.URGENT; + case ASAP: return org.hl7.fhir.r5.model.RequestGroup.RequestPriority.ASAP; + case STAT: return org.hl7.fhir.r5.model.RequestGroup.RequestPriority.STAT; + default: return org.hl7.fhir.r5.model.RequestGroup.RequestPriority.NULL; + } +} + + public static org.hl7.fhir.r4.model.RequestGroup.RequestPriority convertRequestPriority(org.hl7.fhir.r5.model.RequestGroup.RequestPriority src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case ROUTINE: return org.hl7.fhir.r4.model.RequestGroup.RequestPriority.ROUTINE; + case URGENT: return org.hl7.fhir.r4.model.RequestGroup.RequestPriority.URGENT; + case ASAP: return org.hl7.fhir.r4.model.RequestGroup.RequestPriority.ASAP; + case STAT: return org.hl7.fhir.r4.model.RequestGroup.RequestPriority.STAT; + default: return org.hl7.fhir.r4.model.RequestGroup.RequestPriority.NULL; + } +} + + public static org.hl7.fhir.r5.model.RequestGroup.RequestGroupActionComponent convertRequestGroupActionComponent(org.hl7.fhir.r4.model.RequestGroup.RequestGroupActionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.RequestGroup.RequestGroupActionComponent tgt = new org.hl7.fhir.r5.model.RequestGroup.RequestGroupActionComponent(); + copyElement(src, tgt); + if (src.hasPrefix()) + tgt.setPrefixElement(convertString(src.getPrefixElement())); + if (src.hasTitle()) + tgt.setTitleElement(convertString(src.getTitleElement())); + if (src.hasDescription()) + tgt.setDescriptionElement(convertString(src.getDescriptionElement())); + if (src.hasTextEquivalent()) + tgt.setTextEquivalentElement(convertString(src.getTextEquivalentElement())); + if (src.hasPriority()) + tgt.setPriority(convertRequestPriority(src.getPriority())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getCode()) + tgt.addCode(convertCodeableConcept(t)); + for (org.hl7.fhir.r4.model.RelatedArtifact t : src.getDocumentation()) + tgt.addDocumentation(convertRelatedArtifact(t)); + for (org.hl7.fhir.r4.model.RequestGroup.RequestGroupActionConditionComponent t : src.getCondition()) + tgt.addCondition(convertRequestGroupActionConditionComponent(t)); + for (org.hl7.fhir.r4.model.RequestGroup.RequestGroupActionRelatedActionComponent t : src.getRelatedAction()) + tgt.addRelatedAction(convertRequestGroupActionRelatedActionComponent(t)); + if (src.hasTiming()) + tgt.setTiming(convertType(src.getTiming())); + for (org.hl7.fhir.r4.model.Reference t : src.getParticipant()) + tgt.addParticipant(convertReference(t)); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + if (src.hasGroupingBehavior()) + tgt.setGroupingBehavior(convertActionGroupingBehavior(src.getGroupingBehavior())); + if (src.hasSelectionBehavior()) + tgt.setSelectionBehavior(convertActionSelectionBehavior(src.getSelectionBehavior())); + if (src.hasRequiredBehavior()) + tgt.setRequiredBehavior(convertActionRequiredBehavior(src.getRequiredBehavior())); + if (src.hasPrecheckBehavior()) + tgt.setPrecheckBehavior(convertActionPrecheckBehavior(src.getPrecheckBehavior())); + if (src.hasCardinalityBehavior()) + tgt.setCardinalityBehavior(convertActionCardinalityBehavior(src.getCardinalityBehavior())); + if (src.hasResource()) + tgt.setResource(convertReference(src.getResource())); + for (org.hl7.fhir.r4.model.RequestGroup.RequestGroupActionComponent t : src.getAction()) + tgt.addAction(convertRequestGroupActionComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.RequestGroup.RequestGroupActionComponent convertRequestGroupActionComponent(org.hl7.fhir.r5.model.RequestGroup.RequestGroupActionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.RequestGroup.RequestGroupActionComponent tgt = new org.hl7.fhir.r4.model.RequestGroup.RequestGroupActionComponent(); + copyElement(src, tgt); + if (src.hasPrefix()) + tgt.setPrefixElement(convertString(src.getPrefixElement())); + if (src.hasTitle()) + tgt.setTitleElement(convertString(src.getTitleElement())); + if (src.hasDescription()) + tgt.setDescriptionElement(convertString(src.getDescriptionElement())); + if (src.hasTextEquivalent()) + tgt.setTextEquivalentElement(convertString(src.getTextEquivalentElement())); + if (src.hasPriority()) + tgt.setPriority(convertRequestPriority(src.getPriority())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getCode()) + tgt.addCode(convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.RelatedArtifact t : src.getDocumentation()) + tgt.addDocumentation(convertRelatedArtifact(t)); + for (org.hl7.fhir.r5.model.RequestGroup.RequestGroupActionConditionComponent t : src.getCondition()) + tgt.addCondition(convertRequestGroupActionConditionComponent(t)); + for (org.hl7.fhir.r5.model.RequestGroup.RequestGroupActionRelatedActionComponent t : src.getRelatedAction()) + tgt.addRelatedAction(convertRequestGroupActionRelatedActionComponent(t)); + if (src.hasTiming()) + tgt.setTiming(convertType(src.getTiming())); + for (org.hl7.fhir.r5.model.Reference t : src.getParticipant()) + tgt.addParticipant(convertReference(t)); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + if (src.hasGroupingBehavior()) + tgt.setGroupingBehavior(convertActionGroupingBehavior(src.getGroupingBehavior())); + if (src.hasSelectionBehavior()) + tgt.setSelectionBehavior(convertActionSelectionBehavior(src.getSelectionBehavior())); + if (src.hasRequiredBehavior()) + tgt.setRequiredBehavior(convertActionRequiredBehavior(src.getRequiredBehavior())); + if (src.hasPrecheckBehavior()) + tgt.setPrecheckBehavior(convertActionPrecheckBehavior(src.getPrecheckBehavior())); + if (src.hasCardinalityBehavior()) + tgt.setCardinalityBehavior(convertActionCardinalityBehavior(src.getCardinalityBehavior())); + if (src.hasResource()) + tgt.setResource(convertReference(src.getResource())); + for (org.hl7.fhir.r5.model.RequestGroup.RequestGroupActionComponent t : src.getAction()) + tgt.addAction(convertRequestGroupActionComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.RequestGroup.ActionGroupingBehavior convertActionGroupingBehavior(org.hl7.fhir.r4.model.RequestGroup.ActionGroupingBehavior src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case VISUALGROUP: return org.hl7.fhir.r5.model.RequestGroup.ActionGroupingBehavior.VISUALGROUP; + case LOGICALGROUP: return org.hl7.fhir.r5.model.RequestGroup.ActionGroupingBehavior.LOGICALGROUP; + case SENTENCEGROUP: return org.hl7.fhir.r5.model.RequestGroup.ActionGroupingBehavior.SENTENCEGROUP; + default: return org.hl7.fhir.r5.model.RequestGroup.ActionGroupingBehavior.NULL; + } +} + + public static org.hl7.fhir.r4.model.RequestGroup.ActionGroupingBehavior convertActionGroupingBehavior(org.hl7.fhir.r5.model.RequestGroup.ActionGroupingBehavior src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case VISUALGROUP: return org.hl7.fhir.r4.model.RequestGroup.ActionGroupingBehavior.VISUALGROUP; + case LOGICALGROUP: return org.hl7.fhir.r4.model.RequestGroup.ActionGroupingBehavior.LOGICALGROUP; + case SENTENCEGROUP: return org.hl7.fhir.r4.model.RequestGroup.ActionGroupingBehavior.SENTENCEGROUP; + default: return org.hl7.fhir.r4.model.RequestGroup.ActionGroupingBehavior.NULL; + } +} + + public static org.hl7.fhir.r5.model.RequestGroup.ActionSelectionBehavior convertActionSelectionBehavior(org.hl7.fhir.r4.model.RequestGroup.ActionSelectionBehavior src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case ANY: return org.hl7.fhir.r5.model.RequestGroup.ActionSelectionBehavior.ANY; + case ALL: return org.hl7.fhir.r5.model.RequestGroup.ActionSelectionBehavior.ALL; + case ALLORNONE: return org.hl7.fhir.r5.model.RequestGroup.ActionSelectionBehavior.ALLORNONE; + case EXACTLYONE: return org.hl7.fhir.r5.model.RequestGroup.ActionSelectionBehavior.EXACTLYONE; + case ATMOSTONE: return org.hl7.fhir.r5.model.RequestGroup.ActionSelectionBehavior.ATMOSTONE; + case ONEORMORE: return org.hl7.fhir.r5.model.RequestGroup.ActionSelectionBehavior.ONEORMORE; + default: return org.hl7.fhir.r5.model.RequestGroup.ActionSelectionBehavior.NULL; + } +} + + public static org.hl7.fhir.r4.model.RequestGroup.ActionSelectionBehavior convertActionSelectionBehavior(org.hl7.fhir.r5.model.RequestGroup.ActionSelectionBehavior src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case ANY: return org.hl7.fhir.r4.model.RequestGroup.ActionSelectionBehavior.ANY; + case ALL: return org.hl7.fhir.r4.model.RequestGroup.ActionSelectionBehavior.ALL; + case ALLORNONE: return org.hl7.fhir.r4.model.RequestGroup.ActionSelectionBehavior.ALLORNONE; + case EXACTLYONE: return org.hl7.fhir.r4.model.RequestGroup.ActionSelectionBehavior.EXACTLYONE; + case ATMOSTONE: return org.hl7.fhir.r4.model.RequestGroup.ActionSelectionBehavior.ATMOSTONE; + case ONEORMORE: return org.hl7.fhir.r4.model.RequestGroup.ActionSelectionBehavior.ONEORMORE; + default: return org.hl7.fhir.r4.model.RequestGroup.ActionSelectionBehavior.NULL; + } +} + + public static org.hl7.fhir.r5.model.RequestGroup.ActionRequiredBehavior convertActionRequiredBehavior(org.hl7.fhir.r4.model.RequestGroup.ActionRequiredBehavior src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case MUST: return org.hl7.fhir.r5.model.RequestGroup.ActionRequiredBehavior.MUST; + case COULD: return org.hl7.fhir.r5.model.RequestGroup.ActionRequiredBehavior.COULD; + case MUSTUNLESSDOCUMENTED: return org.hl7.fhir.r5.model.RequestGroup.ActionRequiredBehavior.MUSTUNLESSDOCUMENTED; + default: return org.hl7.fhir.r5.model.RequestGroup.ActionRequiredBehavior.NULL; + } +} + + public static org.hl7.fhir.r4.model.RequestGroup.ActionRequiredBehavior convertActionRequiredBehavior(org.hl7.fhir.r5.model.RequestGroup.ActionRequiredBehavior src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case MUST: return org.hl7.fhir.r4.model.RequestGroup.ActionRequiredBehavior.MUST; + case COULD: return org.hl7.fhir.r4.model.RequestGroup.ActionRequiredBehavior.COULD; + case MUSTUNLESSDOCUMENTED: return org.hl7.fhir.r4.model.RequestGroup.ActionRequiredBehavior.MUSTUNLESSDOCUMENTED; + default: return org.hl7.fhir.r4.model.RequestGroup.ActionRequiredBehavior.NULL; + } +} + + public static org.hl7.fhir.r5.model.RequestGroup.ActionPrecheckBehavior convertActionPrecheckBehavior(org.hl7.fhir.r4.model.RequestGroup.ActionPrecheckBehavior src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case YES: return org.hl7.fhir.r5.model.RequestGroup.ActionPrecheckBehavior.YES; + case NO: return org.hl7.fhir.r5.model.RequestGroup.ActionPrecheckBehavior.NO; + default: return org.hl7.fhir.r5.model.RequestGroup.ActionPrecheckBehavior.NULL; + } +} + + public static org.hl7.fhir.r4.model.RequestGroup.ActionPrecheckBehavior convertActionPrecheckBehavior(org.hl7.fhir.r5.model.RequestGroup.ActionPrecheckBehavior src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case YES: return org.hl7.fhir.r4.model.RequestGroup.ActionPrecheckBehavior.YES; + case NO: return org.hl7.fhir.r4.model.RequestGroup.ActionPrecheckBehavior.NO; + default: return org.hl7.fhir.r4.model.RequestGroup.ActionPrecheckBehavior.NULL; + } +} + + public static org.hl7.fhir.r5.model.RequestGroup.ActionCardinalityBehavior convertActionCardinalityBehavior(org.hl7.fhir.r4.model.RequestGroup.ActionCardinalityBehavior src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case SINGLE: return org.hl7.fhir.r5.model.RequestGroup.ActionCardinalityBehavior.SINGLE; + case MULTIPLE: return org.hl7.fhir.r5.model.RequestGroup.ActionCardinalityBehavior.MULTIPLE; + default: return org.hl7.fhir.r5.model.RequestGroup.ActionCardinalityBehavior.NULL; + } +} + + public static org.hl7.fhir.r4.model.RequestGroup.ActionCardinalityBehavior convertActionCardinalityBehavior(org.hl7.fhir.r5.model.RequestGroup.ActionCardinalityBehavior src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case SINGLE: return org.hl7.fhir.r4.model.RequestGroup.ActionCardinalityBehavior.SINGLE; + case MULTIPLE: return org.hl7.fhir.r4.model.RequestGroup.ActionCardinalityBehavior.MULTIPLE; + default: return org.hl7.fhir.r4.model.RequestGroup.ActionCardinalityBehavior.NULL; + } +} + + public static org.hl7.fhir.r5.model.RequestGroup.RequestGroupActionConditionComponent convertRequestGroupActionConditionComponent(org.hl7.fhir.r4.model.RequestGroup.RequestGroupActionConditionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.RequestGroup.RequestGroupActionConditionComponent tgt = new org.hl7.fhir.r5.model.RequestGroup.RequestGroupActionConditionComponent(); + copyElement(src, tgt); + if (src.hasKind()) + tgt.setKind(convertActionConditionKind(src.getKind())); + if (src.hasExpression()) + tgt.setExpression(convertExpression(src.getExpression())); + return tgt; + } + + public static org.hl7.fhir.r4.model.RequestGroup.RequestGroupActionConditionComponent convertRequestGroupActionConditionComponent(org.hl7.fhir.r5.model.RequestGroup.RequestGroupActionConditionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.RequestGroup.RequestGroupActionConditionComponent tgt = new org.hl7.fhir.r4.model.RequestGroup.RequestGroupActionConditionComponent(); + copyElement(src, tgt); + if (src.hasKind()) + tgt.setKind(convertActionConditionKind(src.getKind())); + if (src.hasExpression()) + tgt.setExpression(convertExpression(src.getExpression())); + return tgt; + } + + public static org.hl7.fhir.r5.model.RequestGroup.ActionConditionKind convertActionConditionKind(org.hl7.fhir.r4.model.RequestGroup.ActionConditionKind src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case APPLICABILITY: return org.hl7.fhir.r5.model.RequestGroup.ActionConditionKind.APPLICABILITY; + case START: return org.hl7.fhir.r5.model.RequestGroup.ActionConditionKind.START; + case STOP: return org.hl7.fhir.r5.model.RequestGroup.ActionConditionKind.STOP; + default: return org.hl7.fhir.r5.model.RequestGroup.ActionConditionKind.NULL; + } +} + + public static org.hl7.fhir.r4.model.RequestGroup.ActionConditionKind convertActionConditionKind(org.hl7.fhir.r5.model.RequestGroup.ActionConditionKind src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case APPLICABILITY: return org.hl7.fhir.r4.model.RequestGroup.ActionConditionKind.APPLICABILITY; + case START: return org.hl7.fhir.r4.model.RequestGroup.ActionConditionKind.START; + case STOP: return org.hl7.fhir.r4.model.RequestGroup.ActionConditionKind.STOP; + default: return org.hl7.fhir.r4.model.RequestGroup.ActionConditionKind.NULL; + } +} + + public static org.hl7.fhir.r5.model.RequestGroup.RequestGroupActionRelatedActionComponent convertRequestGroupActionRelatedActionComponent(org.hl7.fhir.r4.model.RequestGroup.RequestGroupActionRelatedActionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.RequestGroup.RequestGroupActionRelatedActionComponent tgt = new org.hl7.fhir.r5.model.RequestGroup.RequestGroupActionRelatedActionComponent(); + copyElement(src, tgt); + if (src.hasActionId()) + tgt.setActionIdElement(convertId(src.getActionIdElement())); + if (src.hasRelationship()) + tgt.setRelationship(convertActionRelationshipType(src.getRelationship())); + if (src.hasOffset()) + tgt.setOffset(convertType(src.getOffset())); + return tgt; + } + + public static org.hl7.fhir.r4.model.RequestGroup.RequestGroupActionRelatedActionComponent convertRequestGroupActionRelatedActionComponent(org.hl7.fhir.r5.model.RequestGroup.RequestGroupActionRelatedActionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.RequestGroup.RequestGroupActionRelatedActionComponent tgt = new org.hl7.fhir.r4.model.RequestGroup.RequestGroupActionRelatedActionComponent(); + copyElement(src, tgt); + if (src.hasActionId()) + tgt.setActionIdElement(convertId(src.getActionIdElement())); + if (src.hasRelationship()) + tgt.setRelationship(convertActionRelationshipType(src.getRelationship())); + if (src.hasOffset()) + tgt.setOffset(convertType(src.getOffset())); + return tgt; + } + + public static org.hl7.fhir.r5.model.RequestGroup.ActionRelationshipType convertActionRelationshipType(org.hl7.fhir.r4.model.RequestGroup.ActionRelationshipType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case BEFORESTART: return org.hl7.fhir.r5.model.RequestGroup.ActionRelationshipType.BEFORESTART; + case BEFORE: return org.hl7.fhir.r5.model.RequestGroup.ActionRelationshipType.BEFORE; + case BEFOREEND: return org.hl7.fhir.r5.model.RequestGroup.ActionRelationshipType.BEFOREEND; + case CONCURRENTWITHSTART: return org.hl7.fhir.r5.model.RequestGroup.ActionRelationshipType.CONCURRENTWITHSTART; + case CONCURRENT: return org.hl7.fhir.r5.model.RequestGroup.ActionRelationshipType.CONCURRENT; + case CONCURRENTWITHEND: return org.hl7.fhir.r5.model.RequestGroup.ActionRelationshipType.CONCURRENTWITHEND; + case AFTERSTART: return org.hl7.fhir.r5.model.RequestGroup.ActionRelationshipType.AFTERSTART; + case AFTER: return org.hl7.fhir.r5.model.RequestGroup.ActionRelationshipType.AFTER; + case AFTEREND: return org.hl7.fhir.r5.model.RequestGroup.ActionRelationshipType.AFTEREND; + default: return org.hl7.fhir.r5.model.RequestGroup.ActionRelationshipType.NULL; + } +} + + public static org.hl7.fhir.r4.model.RequestGroup.ActionRelationshipType convertActionRelationshipType(org.hl7.fhir.r5.model.RequestGroup.ActionRelationshipType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case BEFORESTART: return org.hl7.fhir.r4.model.RequestGroup.ActionRelationshipType.BEFORESTART; + case BEFORE: return org.hl7.fhir.r4.model.RequestGroup.ActionRelationshipType.BEFORE; + case BEFOREEND: return org.hl7.fhir.r4.model.RequestGroup.ActionRelationshipType.BEFOREEND; + case CONCURRENTWITHSTART: return org.hl7.fhir.r4.model.RequestGroup.ActionRelationshipType.CONCURRENTWITHSTART; + case CONCURRENT: return org.hl7.fhir.r4.model.RequestGroup.ActionRelationshipType.CONCURRENT; + case CONCURRENTWITHEND: return org.hl7.fhir.r4.model.RequestGroup.ActionRelationshipType.CONCURRENTWITHEND; + case AFTERSTART: return org.hl7.fhir.r4.model.RequestGroup.ActionRelationshipType.AFTERSTART; + case AFTER: return org.hl7.fhir.r4.model.RequestGroup.ActionRelationshipType.AFTER; + case AFTEREND: return org.hl7.fhir.r4.model.RequestGroup.ActionRelationshipType.AFTEREND; + default: return org.hl7.fhir.r4.model.RequestGroup.ActionRelationshipType.NULL; + } +} + + +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/ResearchDefinition.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/ResearchDefinition.java new file mode 100644 index 000000000..32020b67c --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/ResearchDefinition.java @@ -0,0 +1,195 @@ +package org.hl7.fhir.convertors.conv40_50; + +import org.hl7.fhir.exceptions.FHIRException; + +import org.hl7.fhir.convertors.VersionConvertor_40_50; + + +/* + Copyright (c) 2011+, HL7, Inc. + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of HL7 nor the names of its contributors may be used to + endorse or promote products derived from this software without specific + prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + +*/ + +// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0 + + +public class ResearchDefinition extends VersionConvertor_40_50 { + + public static org.hl7.fhir.r5.model.ResearchDefinition convertResearchDefinition(org.hl7.fhir.r4.model.ResearchDefinition src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ResearchDefinition tgt = new org.hl7.fhir.r5.model.ResearchDefinition(); + copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrlElement(convertUri(src.getUrlElement())); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasVersion()) + tgt.setVersionElement(convertString(src.getVersionElement())); + if (src.hasName()) + tgt.setNameElement(convertString(src.getNameElement())); + if (src.hasTitle()) + tgt.setTitleElement(convertString(src.getTitleElement())); + if (src.hasShortTitle()) + tgt.setShortTitleElement(convertString(src.getShortTitleElement())); + if (src.hasSubtitle()) + tgt.setSubtitleElement(convertString(src.getSubtitleElement())); + if (src.hasStatus()) + tgt.setStatus(Enumerations.convertPublicationStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimentalElement(convertBoolean(src.getExperimentalElement())); + if (src.hasSubject()) + tgt.setSubject(convertType(src.getSubject())); + if (src.hasDate()) + tgt.setDateElement(convertDateTime(src.getDateElement())); + if (src.hasPublisher()) + tgt.setPublisherElement(convertString(src.getPublisherElement())); + for (org.hl7.fhir.r4.model.ContactDetail t : src.getContact()) + tgt.addContact(convertContactDetail(t)); + if (src.hasDescription()) + tgt.setDescriptionElement(convertMarkdown(src.getDescriptionElement())); + for (org.hl7.fhir.r4.model.StringType t : src.getComment()) + tgt.getComment().add(convertString(t)); + for (org.hl7.fhir.r4.model.UsageContext t : src.getUseContext()) + tgt.addUseContext(convertUsageContext(t)); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getJurisdiction()) + tgt.addJurisdiction(convertCodeableConcept(t)); + if (src.hasPurpose()) + tgt.setPurposeElement(convertMarkdown(src.getPurposeElement())); + if (src.hasUsage()) + tgt.setUsageElement(convertString(src.getUsageElement())); + if (src.hasCopyright()) + tgt.setCopyrightElement(convertMarkdown(src.getCopyrightElement())); + if (src.hasApprovalDate()) + tgt.setApprovalDateElement(convertDate(src.getApprovalDateElement())); + if (src.hasLastReviewDate()) + tgt.setLastReviewDateElement(convertDate(src.getLastReviewDateElement())); + if (src.hasEffectivePeriod()) + tgt.setEffectivePeriod(convertPeriod(src.getEffectivePeriod())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getTopic()) + tgt.addTopic(convertCodeableConcept(t)); + for (org.hl7.fhir.r4.model.ContactDetail t : src.getAuthor()) + tgt.addAuthor(convertContactDetail(t)); + for (org.hl7.fhir.r4.model.ContactDetail t : src.getEditor()) + tgt.addEditor(convertContactDetail(t)); + for (org.hl7.fhir.r4.model.ContactDetail t : src.getReviewer()) + tgt.addReviewer(convertContactDetail(t)); + for (org.hl7.fhir.r4.model.ContactDetail t : src.getEndorser()) + tgt.addEndorser(convertContactDetail(t)); + for (org.hl7.fhir.r4.model.RelatedArtifact t : src.getRelatedArtifact()) + tgt.addRelatedArtifact(convertRelatedArtifact(t)); + for (org.hl7.fhir.r4.model.CanonicalType t : src.getLibrary()) + tgt.getLibrary().add(convertCanonical(t)); + if (src.hasPopulation()) + tgt.setPopulation(convertReference(src.getPopulation())); + if (src.hasExposure()) + tgt.setExposure(convertReference(src.getExposure())); + if (src.hasExposureAlternative()) + tgt.setExposureAlternative(convertReference(src.getExposureAlternative())); + if (src.hasOutcome()) + tgt.setOutcome(convertReference(src.getOutcome())); + return tgt; + } + + public static org.hl7.fhir.r4.model.ResearchDefinition convertResearchDefinition(org.hl7.fhir.r5.model.ResearchDefinition src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.ResearchDefinition tgt = new org.hl7.fhir.r4.model.ResearchDefinition(); + copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrlElement(convertUri(src.getUrlElement())); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasVersion()) + tgt.setVersionElement(convertString(src.getVersionElement())); + if (src.hasName()) + tgt.setNameElement(convertString(src.getNameElement())); + if (src.hasTitle()) + tgt.setTitleElement(convertString(src.getTitleElement())); + if (src.hasShortTitle()) + tgt.setShortTitleElement(convertString(src.getShortTitleElement())); + if (src.hasSubtitle()) + tgt.setSubtitleElement(convertString(src.getSubtitleElement())); + if (src.hasStatus()) + tgt.setStatus(Enumerations.convertPublicationStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimentalElement(convertBoolean(src.getExperimentalElement())); + if (src.hasSubject()) + tgt.setSubject(convertType(src.getSubject())); + if (src.hasDate()) + tgt.setDateElement(convertDateTime(src.getDateElement())); + if (src.hasPublisher()) + tgt.setPublisherElement(convertString(src.getPublisherElement())); + for (org.hl7.fhir.r5.model.ContactDetail t : src.getContact()) + tgt.addContact(convertContactDetail(t)); + if (src.hasDescription()) + tgt.setDescriptionElement(convertMarkdown(src.getDescriptionElement())); + for (org.hl7.fhir.r5.model.StringType t : src.getComment()) + tgt.getComment().add(convertString(t)); + for (org.hl7.fhir.r5.model.UsageContext t : src.getUseContext()) + tgt.addUseContext(convertUsageContext(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getJurisdiction()) + tgt.addJurisdiction(convertCodeableConcept(t)); + if (src.hasPurpose()) + tgt.setPurposeElement(convertMarkdown(src.getPurposeElement())); + if (src.hasUsage()) + tgt.setUsageElement(convertString(src.getUsageElement())); + if (src.hasCopyright()) + tgt.setCopyrightElement(convertMarkdown(src.getCopyrightElement())); + if (src.hasApprovalDate()) + tgt.setApprovalDateElement(convertDate(src.getApprovalDateElement())); + if (src.hasLastReviewDate()) + tgt.setLastReviewDateElement(convertDate(src.getLastReviewDateElement())); + if (src.hasEffectivePeriod()) + tgt.setEffectivePeriod(convertPeriod(src.getEffectivePeriod())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getTopic()) + tgt.addTopic(convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.ContactDetail t : src.getAuthor()) + tgt.addAuthor(convertContactDetail(t)); + for (org.hl7.fhir.r5.model.ContactDetail t : src.getEditor()) + tgt.addEditor(convertContactDetail(t)); + for (org.hl7.fhir.r5.model.ContactDetail t : src.getReviewer()) + tgt.addReviewer(convertContactDetail(t)); + for (org.hl7.fhir.r5.model.ContactDetail t : src.getEndorser()) + tgt.addEndorser(convertContactDetail(t)); + for (org.hl7.fhir.r5.model.RelatedArtifact t : src.getRelatedArtifact()) + tgt.addRelatedArtifact(convertRelatedArtifact(t)); + for (org.hl7.fhir.r5.model.CanonicalType t : src.getLibrary()) + tgt.getLibrary().add(convertCanonical(t)); + if (src.hasPopulation()) + tgt.setPopulation(convertReference(src.getPopulation())); + if (src.hasExposure()) + tgt.setExposure(convertReference(src.getExposure())); + if (src.hasExposureAlternative()) + tgt.setExposureAlternative(convertReference(src.getExposureAlternative())); + if (src.hasOutcome()) + tgt.setOutcome(convertReference(src.getOutcome())); + return tgt; + } + + +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/ResearchElementDefinition.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/ResearchElementDefinition.java new file mode 100644 index 000000000..7f15745f3 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/ResearchElementDefinition.java @@ -0,0 +1,327 @@ +package org.hl7.fhir.convertors.conv40_50; + +import org.hl7.fhir.exceptions.FHIRException; + +import org.hl7.fhir.convertors.VersionConvertor_40_50; + + +/* + Copyright (c) 2011+, HL7, Inc. + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of HL7 nor the names of its contributors may be used to + endorse or promote products derived from this software without specific + prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + +*/ + +// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0 + + +public class ResearchElementDefinition extends VersionConvertor_40_50 { + + public static org.hl7.fhir.r5.model.ResearchElementDefinition convertResearchElementDefinition(org.hl7.fhir.r4.model.ResearchElementDefinition src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ResearchElementDefinition tgt = new org.hl7.fhir.r5.model.ResearchElementDefinition(); + copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrlElement(convertUri(src.getUrlElement())); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasVersion()) + tgt.setVersionElement(convertString(src.getVersionElement())); + if (src.hasName()) + tgt.setNameElement(convertString(src.getNameElement())); + if (src.hasTitle()) + tgt.setTitleElement(convertString(src.getTitleElement())); + if (src.hasShortTitle()) + tgt.setShortTitleElement(convertString(src.getShortTitleElement())); + if (src.hasSubtitle()) + tgt.setSubtitleElement(convertString(src.getSubtitleElement())); + if (src.hasStatus()) + tgt.setStatus(Enumerations.convertPublicationStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimentalElement(convertBoolean(src.getExperimentalElement())); + if (src.hasSubject()) + tgt.setSubject(convertType(src.getSubject())); + if (src.hasDate()) + tgt.setDateElement(convertDateTime(src.getDateElement())); + if (src.hasPublisher()) + tgt.setPublisherElement(convertString(src.getPublisherElement())); + for (org.hl7.fhir.r4.model.ContactDetail t : src.getContact()) + tgt.addContact(convertContactDetail(t)); + if (src.hasDescription()) + tgt.setDescriptionElement(convertMarkdown(src.getDescriptionElement())); + for (org.hl7.fhir.r4.model.StringType t : src.getComment()) + tgt.getComment().add(convertString(t)); + for (org.hl7.fhir.r4.model.UsageContext t : src.getUseContext()) + tgt.addUseContext(convertUsageContext(t)); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getJurisdiction()) + tgt.addJurisdiction(convertCodeableConcept(t)); + if (src.hasPurpose()) + tgt.setPurposeElement(convertMarkdown(src.getPurposeElement())); + if (src.hasUsage()) + tgt.setUsageElement(convertString(src.getUsageElement())); + if (src.hasCopyright()) + tgt.setCopyrightElement(convertMarkdown(src.getCopyrightElement())); + if (src.hasApprovalDate()) + tgt.setApprovalDateElement(convertDate(src.getApprovalDateElement())); + if (src.hasLastReviewDate()) + tgt.setLastReviewDateElement(convertDate(src.getLastReviewDateElement())); + if (src.hasEffectivePeriod()) + tgt.setEffectivePeriod(convertPeriod(src.getEffectivePeriod())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getTopic()) + tgt.addTopic(convertCodeableConcept(t)); + for (org.hl7.fhir.r4.model.ContactDetail t : src.getAuthor()) + tgt.addAuthor(convertContactDetail(t)); + for (org.hl7.fhir.r4.model.ContactDetail t : src.getEditor()) + tgt.addEditor(convertContactDetail(t)); + for (org.hl7.fhir.r4.model.ContactDetail t : src.getReviewer()) + tgt.addReviewer(convertContactDetail(t)); + for (org.hl7.fhir.r4.model.ContactDetail t : src.getEndorser()) + tgt.addEndorser(convertContactDetail(t)); + for (org.hl7.fhir.r4.model.RelatedArtifact t : src.getRelatedArtifact()) + tgt.addRelatedArtifact(convertRelatedArtifact(t)); + for (org.hl7.fhir.r4.model.CanonicalType t : src.getLibrary()) + tgt.getLibrary().add(convertCanonical(t)); + if (src.hasType()) + tgt.setType(convertResearchElementType(src.getType())); + if (src.hasVariableType()) + tgt.setVariableType(convertVariableType(src.getVariableType())); + for (org.hl7.fhir.r4.model.ResearchElementDefinition.ResearchElementDefinitionCharacteristicComponent t : src.getCharacteristic()) + tgt.addCharacteristic(convertResearchElementDefinitionCharacteristicComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.ResearchElementDefinition convertResearchElementDefinition(org.hl7.fhir.r5.model.ResearchElementDefinition src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.ResearchElementDefinition tgt = new org.hl7.fhir.r4.model.ResearchElementDefinition(); + copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrlElement(convertUri(src.getUrlElement())); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasVersion()) + tgt.setVersionElement(convertString(src.getVersionElement())); + if (src.hasName()) + tgt.setNameElement(convertString(src.getNameElement())); + if (src.hasTitle()) + tgt.setTitleElement(convertString(src.getTitleElement())); + if (src.hasShortTitle()) + tgt.setShortTitleElement(convertString(src.getShortTitleElement())); + if (src.hasSubtitle()) + tgt.setSubtitleElement(convertString(src.getSubtitleElement())); + if (src.hasStatus()) + tgt.setStatus(Enumerations.convertPublicationStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimentalElement(convertBoolean(src.getExperimentalElement())); + if (src.hasSubject()) + tgt.setSubject(convertType(src.getSubject())); + if (src.hasDate()) + tgt.setDateElement(convertDateTime(src.getDateElement())); + if (src.hasPublisher()) + tgt.setPublisherElement(convertString(src.getPublisherElement())); + for (org.hl7.fhir.r5.model.ContactDetail t : src.getContact()) + tgt.addContact(convertContactDetail(t)); + if (src.hasDescription()) + tgt.setDescriptionElement(convertMarkdown(src.getDescriptionElement())); + for (org.hl7.fhir.r5.model.StringType t : src.getComment()) + tgt.getComment().add(convertString(t)); + for (org.hl7.fhir.r5.model.UsageContext t : src.getUseContext()) + tgt.addUseContext(convertUsageContext(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getJurisdiction()) + tgt.addJurisdiction(convertCodeableConcept(t)); + if (src.hasPurpose()) + tgt.setPurposeElement(convertMarkdown(src.getPurposeElement())); + if (src.hasUsage()) + tgt.setUsageElement(convertString(src.getUsageElement())); + if (src.hasCopyright()) + tgt.setCopyrightElement(convertMarkdown(src.getCopyrightElement())); + if (src.hasApprovalDate()) + tgt.setApprovalDateElement(convertDate(src.getApprovalDateElement())); + if (src.hasLastReviewDate()) + tgt.setLastReviewDateElement(convertDate(src.getLastReviewDateElement())); + if (src.hasEffectivePeriod()) + tgt.setEffectivePeriod(convertPeriod(src.getEffectivePeriod())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getTopic()) + tgt.addTopic(convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.ContactDetail t : src.getAuthor()) + tgt.addAuthor(convertContactDetail(t)); + for (org.hl7.fhir.r5.model.ContactDetail t : src.getEditor()) + tgt.addEditor(convertContactDetail(t)); + for (org.hl7.fhir.r5.model.ContactDetail t : src.getReviewer()) + tgt.addReviewer(convertContactDetail(t)); + for (org.hl7.fhir.r5.model.ContactDetail t : src.getEndorser()) + tgt.addEndorser(convertContactDetail(t)); + for (org.hl7.fhir.r5.model.RelatedArtifact t : src.getRelatedArtifact()) + tgt.addRelatedArtifact(convertRelatedArtifact(t)); + for (org.hl7.fhir.r5.model.CanonicalType t : src.getLibrary()) + tgt.getLibrary().add(convertCanonical(t)); + if (src.hasType()) + tgt.setType(convertResearchElementType(src.getType())); + if (src.hasVariableType()) + tgt.setVariableType(convertVariableType(src.getVariableType())); + for (org.hl7.fhir.r5.model.ResearchElementDefinition.ResearchElementDefinitionCharacteristicComponent t : src.getCharacteristic()) + tgt.addCharacteristic(convertResearchElementDefinitionCharacteristicComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.ResearchElementDefinition.ResearchElementType convertResearchElementType(org.hl7.fhir.r4.model.ResearchElementDefinition.ResearchElementType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case POPULATION: return org.hl7.fhir.r5.model.ResearchElementDefinition.ResearchElementType.POPULATION; + case EXPOSURE: return org.hl7.fhir.r5.model.ResearchElementDefinition.ResearchElementType.EXPOSURE; + case OUTCOME: return org.hl7.fhir.r5.model.ResearchElementDefinition.ResearchElementType.OUTCOME; + default: return org.hl7.fhir.r5.model.ResearchElementDefinition.ResearchElementType.NULL; + } +} + + public static org.hl7.fhir.r4.model.ResearchElementDefinition.ResearchElementType convertResearchElementType(org.hl7.fhir.r5.model.ResearchElementDefinition.ResearchElementType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case POPULATION: return org.hl7.fhir.r4.model.ResearchElementDefinition.ResearchElementType.POPULATION; + case EXPOSURE: return org.hl7.fhir.r4.model.ResearchElementDefinition.ResearchElementType.EXPOSURE; + case OUTCOME: return org.hl7.fhir.r4.model.ResearchElementDefinition.ResearchElementType.OUTCOME; + default: return org.hl7.fhir.r4.model.ResearchElementDefinition.ResearchElementType.NULL; + } +} + + public static org.hl7.fhir.r5.model.ResearchElementDefinition.VariableType convertVariableType(org.hl7.fhir.r4.model.ResearchElementDefinition.VariableType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case DICHOTOMOUS: return org.hl7.fhir.r5.model.ResearchElementDefinition.VariableType.DICHOTOMOUS; + case CONTINUOUS: return org.hl7.fhir.r5.model.ResearchElementDefinition.VariableType.CONTINUOUS; + case DESCRIPTIVE: return org.hl7.fhir.r5.model.ResearchElementDefinition.VariableType.DESCRIPTIVE; + default: return org.hl7.fhir.r5.model.ResearchElementDefinition.VariableType.NULL; + } +} + + public static org.hl7.fhir.r4.model.ResearchElementDefinition.VariableType convertVariableType(org.hl7.fhir.r5.model.ResearchElementDefinition.VariableType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case DICHOTOMOUS: return org.hl7.fhir.r4.model.ResearchElementDefinition.VariableType.DICHOTOMOUS; + case CONTINUOUS: return org.hl7.fhir.r4.model.ResearchElementDefinition.VariableType.CONTINUOUS; + case DESCRIPTIVE: return org.hl7.fhir.r4.model.ResearchElementDefinition.VariableType.DESCRIPTIVE; + default: return org.hl7.fhir.r4.model.ResearchElementDefinition.VariableType.NULL; + } +} + + public static org.hl7.fhir.r5.model.ResearchElementDefinition.ResearchElementDefinitionCharacteristicComponent convertResearchElementDefinitionCharacteristicComponent(org.hl7.fhir.r4.model.ResearchElementDefinition.ResearchElementDefinitionCharacteristicComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ResearchElementDefinition.ResearchElementDefinitionCharacteristicComponent tgt = new org.hl7.fhir.r5.model.ResearchElementDefinition.ResearchElementDefinitionCharacteristicComponent(); + copyElement(src, tgt); + if (src.hasDefinition()) + tgt.setDefinition(convertType(src.getDefinition())); + for (org.hl7.fhir.r4.model.UsageContext t : src.getUsageContext()) + tgt.addUsageContext(convertUsageContext(t)); + if (src.hasExclude()) + tgt.setExcludeElement(convertBoolean(src.getExcludeElement())); + if (src.hasUnitOfMeasure()) + tgt.setUnitOfMeasure(convertCodeableConcept(src.getUnitOfMeasure())); + if (src.hasStudyEffectiveDescription()) + tgt.setStudyEffectiveDescriptionElement(convertString(src.getStudyEffectiveDescriptionElement())); + if (src.hasStudyEffective()) + tgt.setStudyEffective(convertType(src.getStudyEffective())); + if (src.hasStudyEffectiveTimeFromStart()) + tgt.setStudyEffectiveTimeFromStart(convertDuration(src.getStudyEffectiveTimeFromStart())); + if (src.hasStudyEffectiveGroupMeasure()) + tgt.setStudyEffectiveGroupMeasure(convertGroupMeasure(src.getStudyEffectiveGroupMeasure())); + if (src.hasParticipantEffectiveDescription()) + tgt.setParticipantEffectiveDescriptionElement(convertString(src.getParticipantEffectiveDescriptionElement())); + if (src.hasParticipantEffective()) + tgt.setParticipantEffective(convertType(src.getParticipantEffective())); + if (src.hasParticipantEffectiveTimeFromStart()) + tgt.setParticipantEffectiveTimeFromStart(convertDuration(src.getParticipantEffectiveTimeFromStart())); + if (src.hasParticipantEffectiveGroupMeasure()) + tgt.setParticipantEffectiveGroupMeasure(convertGroupMeasure(src.getParticipantEffectiveGroupMeasure())); + return tgt; + } + + public static org.hl7.fhir.r4.model.ResearchElementDefinition.ResearchElementDefinitionCharacteristicComponent convertResearchElementDefinitionCharacteristicComponent(org.hl7.fhir.r5.model.ResearchElementDefinition.ResearchElementDefinitionCharacteristicComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.ResearchElementDefinition.ResearchElementDefinitionCharacteristicComponent tgt = new org.hl7.fhir.r4.model.ResearchElementDefinition.ResearchElementDefinitionCharacteristicComponent(); + copyElement(src, tgt); + if (src.hasDefinition()) + tgt.setDefinition(convertType(src.getDefinition())); + for (org.hl7.fhir.r5.model.UsageContext t : src.getUsageContext()) + tgt.addUsageContext(convertUsageContext(t)); + if (src.hasExclude()) + tgt.setExcludeElement(convertBoolean(src.getExcludeElement())); + if (src.hasUnitOfMeasure()) + tgt.setUnitOfMeasure(convertCodeableConcept(src.getUnitOfMeasure())); + if (src.hasStudyEffectiveDescription()) + tgt.setStudyEffectiveDescriptionElement(convertString(src.getStudyEffectiveDescriptionElement())); + if (src.hasStudyEffective()) + tgt.setStudyEffective(convertType(src.getStudyEffective())); + if (src.hasStudyEffectiveTimeFromStart()) + tgt.setStudyEffectiveTimeFromStart(convertDuration(src.getStudyEffectiveTimeFromStart())); + if (src.hasStudyEffectiveGroupMeasure()) + tgt.setStudyEffectiveGroupMeasure(convertGroupMeasure(src.getStudyEffectiveGroupMeasure())); + if (src.hasParticipantEffectiveDescription()) + tgt.setParticipantEffectiveDescriptionElement(convertString(src.getParticipantEffectiveDescriptionElement())); + if (src.hasParticipantEffective()) + tgt.setParticipantEffective(convertType(src.getParticipantEffective())); + if (src.hasParticipantEffectiveTimeFromStart()) + tgt.setParticipantEffectiveTimeFromStart(convertDuration(src.getParticipantEffectiveTimeFromStart())); + if (src.hasParticipantEffectiveGroupMeasure()) + tgt.setParticipantEffectiveGroupMeasure(convertGroupMeasure(src.getParticipantEffectiveGroupMeasure())); + return tgt; + } + + public static org.hl7.fhir.r5.model.ResearchElementDefinition.GroupMeasure convertGroupMeasure(org.hl7.fhir.r4.model.ResearchElementDefinition.GroupMeasure src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case MEAN: return org.hl7.fhir.r5.model.ResearchElementDefinition.GroupMeasure.MEAN; + case MEDIAN: return org.hl7.fhir.r5.model.ResearchElementDefinition.GroupMeasure.MEDIAN; + case MEANOFMEAN: return org.hl7.fhir.r5.model.ResearchElementDefinition.GroupMeasure.MEANOFMEAN; + case MEANOFMEDIAN: return org.hl7.fhir.r5.model.ResearchElementDefinition.GroupMeasure.MEANOFMEDIAN; + case MEDIANOFMEAN: return org.hl7.fhir.r5.model.ResearchElementDefinition.GroupMeasure.MEDIANOFMEAN; + case MEDIANOFMEDIAN: return org.hl7.fhir.r5.model.ResearchElementDefinition.GroupMeasure.MEDIANOFMEDIAN; + default: return org.hl7.fhir.r5.model.ResearchElementDefinition.GroupMeasure.NULL; + } +} + + public static org.hl7.fhir.r4.model.ResearchElementDefinition.GroupMeasure convertGroupMeasure(org.hl7.fhir.r5.model.ResearchElementDefinition.GroupMeasure src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case MEAN: return org.hl7.fhir.r4.model.ResearchElementDefinition.GroupMeasure.MEAN; + case MEDIAN: return org.hl7.fhir.r4.model.ResearchElementDefinition.GroupMeasure.MEDIAN; + case MEANOFMEAN: return org.hl7.fhir.r4.model.ResearchElementDefinition.GroupMeasure.MEANOFMEAN; + case MEANOFMEDIAN: return org.hl7.fhir.r4.model.ResearchElementDefinition.GroupMeasure.MEANOFMEDIAN; + case MEDIANOFMEAN: return org.hl7.fhir.r4.model.ResearchElementDefinition.GroupMeasure.MEDIANOFMEAN; + case MEDIANOFMEDIAN: return org.hl7.fhir.r4.model.ResearchElementDefinition.GroupMeasure.MEDIANOFMEDIAN; + default: return org.hl7.fhir.r4.model.ResearchElementDefinition.GroupMeasure.NULL; + } +} + + +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/ResearchStudy.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/ResearchStudy.java new file mode 100644 index 000000000..0498bc030 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/ResearchStudy.java @@ -0,0 +1,245 @@ +package org.hl7.fhir.convertors.conv40_50; + +import org.hl7.fhir.exceptions.FHIRException; + +import org.hl7.fhir.convertors.VersionConvertor_40_50; + + +/* + Copyright (c) 2011+, HL7, Inc. + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of HL7 nor the names of its contributors may be used to + endorse or promote products derived from this software without specific + prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + +*/ + +// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0 + + +public class ResearchStudy extends VersionConvertor_40_50 { + + public static org.hl7.fhir.r5.model.ResearchStudy convertResearchStudy(org.hl7.fhir.r4.model.ResearchStudy src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ResearchStudy tgt = new org.hl7.fhir.r5.model.ResearchStudy(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasTitle()) + tgt.setTitleElement(convertString(src.getTitleElement())); + for (org.hl7.fhir.r4.model.Reference t : src.getProtocol()) + tgt.addProtocol(convertReference(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getPartOf()) + tgt.addPartOf(convertReference(t)); + if (src.hasStatus()) + tgt.setStatus(convertResearchStudyStatus(src.getStatus())); + if (src.hasPrimaryPurposeType()) + tgt.setPrimaryPurposeType(convertCodeableConcept(src.getPrimaryPurposeType())); + if (src.hasPhase()) + tgt.setPhase(convertCodeableConcept(src.getPhase())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getCategory()) + tgt.addCategory(convertCodeableConcept(t)); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getFocus()) + tgt.addFocus(convertCodeableConcept(t)); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getCondition()) + tgt.addCondition(convertCodeableConcept(t)); + for (org.hl7.fhir.r4.model.ContactDetail t : src.getContact()) + tgt.addContact(convertContactDetail(t)); + for (org.hl7.fhir.r4.model.RelatedArtifact t : src.getRelatedArtifact()) + tgt.addRelatedArtifact(convertRelatedArtifact(t)); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getKeyword()) + tgt.addKeyword(convertCodeableConcept(t)); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getLocation()) + tgt.addLocation(convertCodeableConcept(t)); + if (src.hasDescription()) + tgt.setDescriptionElement(convertMarkdown(src.getDescriptionElement())); + for (org.hl7.fhir.r4.model.Reference t : src.getEnrollment()) + tgt.addEnrollment(convertReference(t)); + if (src.hasPeriod()) + tgt.setPeriod(convertPeriod(src.getPeriod())); + if (src.hasSponsor()) + tgt.setSponsor(convertReference(src.getSponsor())); + if (src.hasPrincipalInvestigator()) + tgt.setPrincipalInvestigator(convertReference(src.getPrincipalInvestigator())); + for (org.hl7.fhir.r4.model.Reference t : src.getSite()) + tgt.addSite(convertReference(t)); + if (src.hasReasonStopped()) + tgt.setReasonStopped(convertCodeableConcept(src.getReasonStopped())); + for (org.hl7.fhir.r4.model.Annotation t : src.getNote()) + tgt.addNote(convertAnnotation(t)); + for (org.hl7.fhir.r4.model.ResearchStudy.ResearchStudyArmComponent t : src.getArm()) + tgt.addArm(convertResearchStudyArmComponent(t)); + for (org.hl7.fhir.r4.model.ResearchStudy.ResearchStudyObjectiveComponent t : src.getObjective()) + tgt.addObjective(convertResearchStudyObjectiveComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.ResearchStudy convertResearchStudy(org.hl7.fhir.r5.model.ResearchStudy src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.ResearchStudy tgt = new org.hl7.fhir.r4.model.ResearchStudy(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasTitle()) + tgt.setTitleElement(convertString(src.getTitleElement())); + for (org.hl7.fhir.r5.model.Reference t : src.getProtocol()) + tgt.addProtocol(convertReference(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getPartOf()) + tgt.addPartOf(convertReference(t)); + if (src.hasStatus()) + tgt.setStatus(convertResearchStudyStatus(src.getStatus())); + if (src.hasPrimaryPurposeType()) + tgt.setPrimaryPurposeType(convertCodeableConcept(src.getPrimaryPurposeType())); + if (src.hasPhase()) + tgt.setPhase(convertCodeableConcept(src.getPhase())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getCategory()) + tgt.addCategory(convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getFocus()) + tgt.addFocus(convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getCondition()) + tgt.addCondition(convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.ContactDetail t : src.getContact()) + tgt.addContact(convertContactDetail(t)); + for (org.hl7.fhir.r5.model.RelatedArtifact t : src.getRelatedArtifact()) + tgt.addRelatedArtifact(convertRelatedArtifact(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getKeyword()) + tgt.addKeyword(convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getLocation()) + tgt.addLocation(convertCodeableConcept(t)); + if (src.hasDescription()) + tgt.setDescriptionElement(convertMarkdown(src.getDescriptionElement())); + for (org.hl7.fhir.r5.model.Reference t : src.getEnrollment()) + tgt.addEnrollment(convertReference(t)); + if (src.hasPeriod()) + tgt.setPeriod(convertPeriod(src.getPeriod())); + if (src.hasSponsor()) + tgt.setSponsor(convertReference(src.getSponsor())); + if (src.hasPrincipalInvestigator()) + tgt.setPrincipalInvestigator(convertReference(src.getPrincipalInvestigator())); + for (org.hl7.fhir.r5.model.Reference t : src.getSite()) + tgt.addSite(convertReference(t)); + if (src.hasReasonStopped()) + tgt.setReasonStopped(convertCodeableConcept(src.getReasonStopped())); + for (org.hl7.fhir.r5.model.Annotation t : src.getNote()) + tgt.addNote(convertAnnotation(t)); + for (org.hl7.fhir.r5.model.ResearchStudy.ResearchStudyArmComponent t : src.getArm()) + tgt.addArm(convertResearchStudyArmComponent(t)); + for (org.hl7.fhir.r5.model.ResearchStudy.ResearchStudyObjectiveComponent t : src.getObjective()) + tgt.addObjective(convertResearchStudyObjectiveComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.ResearchStudy.ResearchStudyStatus convertResearchStudyStatus(org.hl7.fhir.r4.model.ResearchStudy.ResearchStudyStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case ACTIVE: return org.hl7.fhir.r5.model.ResearchStudy.ResearchStudyStatus.ACTIVE; + case ADMINISTRATIVELYCOMPLETED: return org.hl7.fhir.r5.model.ResearchStudy.ResearchStudyStatus.ADMINISTRATIVELYCOMPLETED; + case APPROVED: return org.hl7.fhir.r5.model.ResearchStudy.ResearchStudyStatus.APPROVED; + case CLOSEDTOACCRUAL: return org.hl7.fhir.r5.model.ResearchStudy.ResearchStudyStatus.CLOSEDTOACCRUAL; + case CLOSEDTOACCRUALANDINTERVENTION: return org.hl7.fhir.r5.model.ResearchStudy.ResearchStudyStatus.CLOSEDTOACCRUALANDINTERVENTION; + case COMPLETED: return org.hl7.fhir.r5.model.ResearchStudy.ResearchStudyStatus.COMPLETED; + case DISAPPROVED: return org.hl7.fhir.r5.model.ResearchStudy.ResearchStudyStatus.DISAPPROVED; + case INREVIEW: return org.hl7.fhir.r5.model.ResearchStudy.ResearchStudyStatus.INREVIEW; + case TEMPORARILYCLOSEDTOACCRUAL: return org.hl7.fhir.r5.model.ResearchStudy.ResearchStudyStatus.TEMPORARILYCLOSEDTOACCRUAL; + case TEMPORARILYCLOSEDTOACCRUALANDINTERVENTION: return org.hl7.fhir.r5.model.ResearchStudy.ResearchStudyStatus.TEMPORARILYCLOSEDTOACCRUALANDINTERVENTION; + case WITHDRAWN: return org.hl7.fhir.r5.model.ResearchStudy.ResearchStudyStatus.WITHDRAWN; + default: return org.hl7.fhir.r5.model.ResearchStudy.ResearchStudyStatus.NULL; + } +} + + public static org.hl7.fhir.r4.model.ResearchStudy.ResearchStudyStatus convertResearchStudyStatus(org.hl7.fhir.r5.model.ResearchStudy.ResearchStudyStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case ACTIVE: return org.hl7.fhir.r4.model.ResearchStudy.ResearchStudyStatus.ACTIVE; + case ADMINISTRATIVELYCOMPLETED: return org.hl7.fhir.r4.model.ResearchStudy.ResearchStudyStatus.ADMINISTRATIVELYCOMPLETED; + case APPROVED: return org.hl7.fhir.r4.model.ResearchStudy.ResearchStudyStatus.APPROVED; + case CLOSEDTOACCRUAL: return org.hl7.fhir.r4.model.ResearchStudy.ResearchStudyStatus.CLOSEDTOACCRUAL; + case CLOSEDTOACCRUALANDINTERVENTION: return org.hl7.fhir.r4.model.ResearchStudy.ResearchStudyStatus.CLOSEDTOACCRUALANDINTERVENTION; + case COMPLETED: return org.hl7.fhir.r4.model.ResearchStudy.ResearchStudyStatus.COMPLETED; + case DISAPPROVED: return org.hl7.fhir.r4.model.ResearchStudy.ResearchStudyStatus.DISAPPROVED; + case INREVIEW: return org.hl7.fhir.r4.model.ResearchStudy.ResearchStudyStatus.INREVIEW; + case TEMPORARILYCLOSEDTOACCRUAL: return org.hl7.fhir.r4.model.ResearchStudy.ResearchStudyStatus.TEMPORARILYCLOSEDTOACCRUAL; + case TEMPORARILYCLOSEDTOACCRUALANDINTERVENTION: return org.hl7.fhir.r4.model.ResearchStudy.ResearchStudyStatus.TEMPORARILYCLOSEDTOACCRUALANDINTERVENTION; + case WITHDRAWN: return org.hl7.fhir.r4.model.ResearchStudy.ResearchStudyStatus.WITHDRAWN; + default: return org.hl7.fhir.r4.model.ResearchStudy.ResearchStudyStatus.NULL; + } +} + + public static org.hl7.fhir.r5.model.ResearchStudy.ResearchStudyArmComponent convertResearchStudyArmComponent(org.hl7.fhir.r4.model.ResearchStudy.ResearchStudyArmComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ResearchStudy.ResearchStudyArmComponent tgt = new org.hl7.fhir.r5.model.ResearchStudy.ResearchStudyArmComponent(); + copyElement(src, tgt); + if (src.hasName()) + tgt.setNameElement(convertString(src.getNameElement())); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + if (src.hasDescription()) + tgt.setDescriptionElement(convertString(src.getDescriptionElement())); + return tgt; + } + + public static org.hl7.fhir.r4.model.ResearchStudy.ResearchStudyArmComponent convertResearchStudyArmComponent(org.hl7.fhir.r5.model.ResearchStudy.ResearchStudyArmComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.ResearchStudy.ResearchStudyArmComponent tgt = new org.hl7.fhir.r4.model.ResearchStudy.ResearchStudyArmComponent(); + copyElement(src, tgt); + if (src.hasName()) + tgt.setNameElement(convertString(src.getNameElement())); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + if (src.hasDescription()) + tgt.setDescriptionElement(convertString(src.getDescriptionElement())); + return tgt; + } + + public static org.hl7.fhir.r5.model.ResearchStudy.ResearchStudyObjectiveComponent convertResearchStudyObjectiveComponent(org.hl7.fhir.r4.model.ResearchStudy.ResearchStudyObjectiveComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ResearchStudy.ResearchStudyObjectiveComponent tgt = new org.hl7.fhir.r5.model.ResearchStudy.ResearchStudyObjectiveComponent(); + copyElement(src, tgt); + if (src.hasName()) + tgt.setNameElement(convertString(src.getNameElement())); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + return tgt; + } + + public static org.hl7.fhir.r4.model.ResearchStudy.ResearchStudyObjectiveComponent convertResearchStudyObjectiveComponent(org.hl7.fhir.r5.model.ResearchStudy.ResearchStudyObjectiveComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.ResearchStudy.ResearchStudyObjectiveComponent tgt = new org.hl7.fhir.r4.model.ResearchStudy.ResearchStudyObjectiveComponent(); + copyElement(src, tgt); + if (src.hasName()) + tgt.setNameElement(convertString(src.getNameElement())); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + return tgt; + } + + +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/ResearchSubject.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/ResearchSubject.java new file mode 100644 index 000000000..1b3c4edac --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/ResearchSubject.java @@ -0,0 +1,133 @@ +package org.hl7.fhir.convertors.conv40_50; + +import org.hl7.fhir.exceptions.FHIRException; + +import org.hl7.fhir.convertors.VersionConvertor_40_50; + + +/* + Copyright (c) 2011+, HL7, Inc. + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of HL7 nor the names of its contributors may be used to + endorse or promote products derived from this software without specific + prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + +*/ + +// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0 + + +public class ResearchSubject extends VersionConvertor_40_50 { + + public static org.hl7.fhir.r5.model.ResearchSubject convertResearchSubject(org.hl7.fhir.r4.model.ResearchSubject src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ResearchSubject tgt = new org.hl7.fhir.r5.model.ResearchSubject(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasStatus()) + tgt.setStatus(convertResearchSubjectStatus(src.getStatus())); + if (src.hasPeriod()) + tgt.setPeriod(convertPeriod(src.getPeriod())); + if (src.hasStudy()) + tgt.setStudy(convertReference(src.getStudy())); + if (src.hasIndividual()) + tgt.setIndividual(convertReference(src.getIndividual())); + if (src.hasAssignedArm()) + tgt.setAssignedArmElement(convertString(src.getAssignedArmElement())); + if (src.hasActualArm()) + tgt.setActualArmElement(convertString(src.getActualArmElement())); + if (src.hasConsent()) + tgt.setConsent(convertReference(src.getConsent())); + return tgt; + } + + public static org.hl7.fhir.r4.model.ResearchSubject convertResearchSubject(org.hl7.fhir.r5.model.ResearchSubject src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.ResearchSubject tgt = new org.hl7.fhir.r4.model.ResearchSubject(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasStatus()) + tgt.setStatus(convertResearchSubjectStatus(src.getStatus())); + if (src.hasPeriod()) + tgt.setPeriod(convertPeriod(src.getPeriod())); + if (src.hasStudy()) + tgt.setStudy(convertReference(src.getStudy())); + if (src.hasIndividual()) + tgt.setIndividual(convertReference(src.getIndividual())); + if (src.hasAssignedArm()) + tgt.setAssignedArmElement(convertString(src.getAssignedArmElement())); + if (src.hasActualArm()) + tgt.setActualArmElement(convertString(src.getActualArmElement())); + if (src.hasConsent()) + tgt.setConsent(convertReference(src.getConsent())); + return tgt; + } + + public static org.hl7.fhir.r5.model.ResearchSubject.ResearchSubjectStatus convertResearchSubjectStatus(org.hl7.fhir.r4.model.ResearchSubject.ResearchSubjectStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case CANDIDATE: return org.hl7.fhir.r5.model.ResearchSubject.ResearchSubjectStatus.CANDIDATE; + case ELIGIBLE: return org.hl7.fhir.r5.model.ResearchSubject.ResearchSubjectStatus.ELIGIBLE; + case FOLLOWUP: return org.hl7.fhir.r5.model.ResearchSubject.ResearchSubjectStatus.FOLLOWUP; + case INELIGIBLE: return org.hl7.fhir.r5.model.ResearchSubject.ResearchSubjectStatus.INELIGIBLE; + case NOTREGISTERED: return org.hl7.fhir.r5.model.ResearchSubject.ResearchSubjectStatus.NOTREGISTERED; + case OFFSTUDY: return org.hl7.fhir.r5.model.ResearchSubject.ResearchSubjectStatus.OFFSTUDY; + case ONSTUDY: return org.hl7.fhir.r5.model.ResearchSubject.ResearchSubjectStatus.ONSTUDY; + case ONSTUDYINTERVENTION: return org.hl7.fhir.r5.model.ResearchSubject.ResearchSubjectStatus.ONSTUDYINTERVENTION; + case ONSTUDYOBSERVATION: return org.hl7.fhir.r5.model.ResearchSubject.ResearchSubjectStatus.ONSTUDYOBSERVATION; + case PENDINGONSTUDY: return org.hl7.fhir.r5.model.ResearchSubject.ResearchSubjectStatus.PENDINGONSTUDY; + case POTENTIALCANDIDATE: return org.hl7.fhir.r5.model.ResearchSubject.ResearchSubjectStatus.POTENTIALCANDIDATE; + case SCREENING: return org.hl7.fhir.r5.model.ResearchSubject.ResearchSubjectStatus.SCREENING; + case WITHDRAWN: return org.hl7.fhir.r5.model.ResearchSubject.ResearchSubjectStatus.WITHDRAWN; + default: return org.hl7.fhir.r5.model.ResearchSubject.ResearchSubjectStatus.NULL; + } +} + + public static org.hl7.fhir.r4.model.ResearchSubject.ResearchSubjectStatus convertResearchSubjectStatus(org.hl7.fhir.r5.model.ResearchSubject.ResearchSubjectStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case CANDIDATE: return org.hl7.fhir.r4.model.ResearchSubject.ResearchSubjectStatus.CANDIDATE; + case ELIGIBLE: return org.hl7.fhir.r4.model.ResearchSubject.ResearchSubjectStatus.ELIGIBLE; + case FOLLOWUP: return org.hl7.fhir.r4.model.ResearchSubject.ResearchSubjectStatus.FOLLOWUP; + case INELIGIBLE: return org.hl7.fhir.r4.model.ResearchSubject.ResearchSubjectStatus.INELIGIBLE; + case NOTREGISTERED: return org.hl7.fhir.r4.model.ResearchSubject.ResearchSubjectStatus.NOTREGISTERED; + case OFFSTUDY: return org.hl7.fhir.r4.model.ResearchSubject.ResearchSubjectStatus.OFFSTUDY; + case ONSTUDY: return org.hl7.fhir.r4.model.ResearchSubject.ResearchSubjectStatus.ONSTUDY; + case ONSTUDYINTERVENTION: return org.hl7.fhir.r4.model.ResearchSubject.ResearchSubjectStatus.ONSTUDYINTERVENTION; + case ONSTUDYOBSERVATION: return org.hl7.fhir.r4.model.ResearchSubject.ResearchSubjectStatus.ONSTUDYOBSERVATION; + case PENDINGONSTUDY: return org.hl7.fhir.r4.model.ResearchSubject.ResearchSubjectStatus.PENDINGONSTUDY; + case POTENTIALCANDIDATE: return org.hl7.fhir.r4.model.ResearchSubject.ResearchSubjectStatus.POTENTIALCANDIDATE; + case SCREENING: return org.hl7.fhir.r4.model.ResearchSubject.ResearchSubjectStatus.SCREENING; + case WITHDRAWN: return org.hl7.fhir.r4.model.ResearchSubject.ResearchSubjectStatus.WITHDRAWN; + default: return org.hl7.fhir.r4.model.ResearchSubject.ResearchSubjectStatus.NULL; + } +} + + +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/RiskAssessment.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/RiskAssessment.java new file mode 100644 index 000000000..61a981769 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/RiskAssessment.java @@ -0,0 +1,199 @@ +package org.hl7.fhir.convertors.conv40_50; + +import org.hl7.fhir.exceptions.FHIRException; + +import org.hl7.fhir.convertors.VersionConvertor_40_50; + + +/* + Copyright (c) 2011+, HL7, Inc. + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of HL7 nor the names of its contributors may be used to + endorse or promote products derived from this software without specific + prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + +*/ + +// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0 + + +public class RiskAssessment extends VersionConvertor_40_50 { + + public static org.hl7.fhir.r5.model.RiskAssessment convertRiskAssessment(org.hl7.fhir.r4.model.RiskAssessment src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.RiskAssessment tgt = new org.hl7.fhir.r5.model.RiskAssessment(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasBasedOn()) + tgt.setBasedOn(convertReference(src.getBasedOn())); + if (src.hasParent()) + tgt.setParent(convertReference(src.getParent())); + if (src.hasStatus()) + tgt.setStatus(convertRiskAssessmentStatus(src.getStatus())); + if (src.hasMethod()) + tgt.setMethod(convertCodeableConcept(src.getMethod())); + if (src.hasCode()) + tgt.setCode(convertCodeableConcept(src.getCode())); + if (src.hasSubject()) + tgt.setSubject(convertReference(src.getSubject())); + if (src.hasEncounter()) + tgt.setEncounter(convertReference(src.getEncounter())); + if (src.hasOccurrence()) + tgt.setOccurrence(convertType(src.getOccurrence())); + if (src.hasCondition()) + tgt.setCondition(convertReference(src.getCondition())); + if (src.hasPerformer()) + tgt.setPerformer(convertReference(src.getPerformer())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getReasonCode()) + tgt.addReasonCode(convertCodeableConcept(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getReasonReference()) + tgt.addReasonReference(convertReference(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getBasis()) + tgt.addBasis(convertReference(t)); + for (org.hl7.fhir.r4.model.RiskAssessment.RiskAssessmentPredictionComponent t : src.getPrediction()) + tgt.addPrediction(convertRiskAssessmentPredictionComponent(t)); + if (src.hasMitigation()) + tgt.setMitigationElement(convertString(src.getMitigationElement())); + for (org.hl7.fhir.r4.model.Annotation t : src.getNote()) + tgt.addNote(convertAnnotation(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.RiskAssessment convertRiskAssessment(org.hl7.fhir.r5.model.RiskAssessment src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.RiskAssessment tgt = new org.hl7.fhir.r4.model.RiskAssessment(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasBasedOn()) + tgt.setBasedOn(convertReference(src.getBasedOn())); + if (src.hasParent()) + tgt.setParent(convertReference(src.getParent())); + if (src.hasStatus()) + tgt.setStatus(convertRiskAssessmentStatus(src.getStatus())); + if (src.hasMethod()) + tgt.setMethod(convertCodeableConcept(src.getMethod())); + if (src.hasCode()) + tgt.setCode(convertCodeableConcept(src.getCode())); + if (src.hasSubject()) + tgt.setSubject(convertReference(src.getSubject())); + if (src.hasEncounter()) + tgt.setEncounter(convertReference(src.getEncounter())); + if (src.hasOccurrence()) + tgt.setOccurrence(convertType(src.getOccurrence())); + if (src.hasCondition()) + tgt.setCondition(convertReference(src.getCondition())); + if (src.hasPerformer()) + tgt.setPerformer(convertReference(src.getPerformer())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getReasonCode()) + tgt.addReasonCode(convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getReasonReference()) + tgt.addReasonReference(convertReference(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getBasis()) + tgt.addBasis(convertReference(t)); + for (org.hl7.fhir.r5.model.RiskAssessment.RiskAssessmentPredictionComponent t : src.getPrediction()) + tgt.addPrediction(convertRiskAssessmentPredictionComponent(t)); + if (src.hasMitigation()) + tgt.setMitigationElement(convertString(src.getMitigationElement())); + for (org.hl7.fhir.r5.model.Annotation t : src.getNote()) + tgt.addNote(convertAnnotation(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.RiskAssessment.RiskAssessmentStatus convertRiskAssessmentStatus(org.hl7.fhir.r4.model.RiskAssessment.RiskAssessmentStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case REGISTERED: return org.hl7.fhir.r5.model.RiskAssessment.RiskAssessmentStatus.REGISTERED; + case PRELIMINARY: return org.hl7.fhir.r5.model.RiskAssessment.RiskAssessmentStatus.PRELIMINARY; + case FINAL: return org.hl7.fhir.r5.model.RiskAssessment.RiskAssessmentStatus.FINAL; + case AMENDED: return org.hl7.fhir.r5.model.RiskAssessment.RiskAssessmentStatus.AMENDED; + case CORRECTED: return org.hl7.fhir.r5.model.RiskAssessment.RiskAssessmentStatus.CORRECTED; + case CANCELLED: return org.hl7.fhir.r5.model.RiskAssessment.RiskAssessmentStatus.CANCELLED; + case ENTEREDINERROR: return org.hl7.fhir.r5.model.RiskAssessment.RiskAssessmentStatus.ENTEREDINERROR; + case UNKNOWN: return org.hl7.fhir.r5.model.RiskAssessment.RiskAssessmentStatus.UNKNOWN; + default: return org.hl7.fhir.r5.model.RiskAssessment.RiskAssessmentStatus.NULL; + } +} + + public static org.hl7.fhir.r4.model.RiskAssessment.RiskAssessmentStatus convertRiskAssessmentStatus(org.hl7.fhir.r5.model.RiskAssessment.RiskAssessmentStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case REGISTERED: return org.hl7.fhir.r4.model.RiskAssessment.RiskAssessmentStatus.REGISTERED; + case PRELIMINARY: return org.hl7.fhir.r4.model.RiskAssessment.RiskAssessmentStatus.PRELIMINARY; + case FINAL: return org.hl7.fhir.r4.model.RiskAssessment.RiskAssessmentStatus.FINAL; + case AMENDED: return org.hl7.fhir.r4.model.RiskAssessment.RiskAssessmentStatus.AMENDED; + case CORRECTED: return org.hl7.fhir.r4.model.RiskAssessment.RiskAssessmentStatus.CORRECTED; + case CANCELLED: return org.hl7.fhir.r4.model.RiskAssessment.RiskAssessmentStatus.CANCELLED; + case ENTEREDINERROR: return org.hl7.fhir.r4.model.RiskAssessment.RiskAssessmentStatus.ENTEREDINERROR; + case UNKNOWN: return org.hl7.fhir.r4.model.RiskAssessment.RiskAssessmentStatus.UNKNOWN; + default: return org.hl7.fhir.r4.model.RiskAssessment.RiskAssessmentStatus.NULL; + } +} + + public static org.hl7.fhir.r5.model.RiskAssessment.RiskAssessmentPredictionComponent convertRiskAssessmentPredictionComponent(org.hl7.fhir.r4.model.RiskAssessment.RiskAssessmentPredictionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.RiskAssessment.RiskAssessmentPredictionComponent tgt = new org.hl7.fhir.r5.model.RiskAssessment.RiskAssessmentPredictionComponent(); + copyElement(src, tgt); + if (src.hasOutcome()) + tgt.setOutcome(convertCodeableConcept(src.getOutcome())); + if (src.hasProbability()) + tgt.setProbability(convertType(src.getProbability())); + if (src.hasQualitativeRisk()) + tgt.setQualitativeRisk(convertCodeableConcept(src.getQualitativeRisk())); + if (src.hasRelativeRisk()) + tgt.setRelativeRiskElement(convertDecimal(src.getRelativeRiskElement())); + if (src.hasWhen()) + tgt.setWhen(convertType(src.getWhen())); + if (src.hasRationale()) + tgt.setRationaleElement(convertString(src.getRationaleElement())); + return tgt; + } + + public static org.hl7.fhir.r4.model.RiskAssessment.RiskAssessmentPredictionComponent convertRiskAssessmentPredictionComponent(org.hl7.fhir.r5.model.RiskAssessment.RiskAssessmentPredictionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.RiskAssessment.RiskAssessmentPredictionComponent tgt = new org.hl7.fhir.r4.model.RiskAssessment.RiskAssessmentPredictionComponent(); + copyElement(src, tgt); + if (src.hasOutcome()) + tgt.setOutcome(convertCodeableConcept(src.getOutcome())); + if (src.hasProbability()) + tgt.setProbability(convertType(src.getProbability())); + if (src.hasQualitativeRisk()) + tgt.setQualitativeRisk(convertCodeableConcept(src.getQualitativeRisk())); + if (src.hasRelativeRisk()) + tgt.setRelativeRiskElement(convertDecimal(src.getRelativeRiskElement())); + if (src.hasWhen()) + tgt.setWhen(convertType(src.getWhen())); + if (src.hasRationale()) + tgt.setRationaleElement(convertString(src.getRationaleElement())); + return tgt; + } + + +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/RiskEvidenceSynthesis.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/RiskEvidenceSynthesis.java new file mode 100644 index 000000000..c3c47c875 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/RiskEvidenceSynthesis.java @@ -0,0 +1,343 @@ +package org.hl7.fhir.convertors.conv40_50; + +import org.hl7.fhir.exceptions.FHIRException; + +import org.hl7.fhir.convertors.VersionConvertor_40_50; + + +/* + Copyright (c) 2011+, HL7, Inc. + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of HL7 nor the names of its contributors may be used to + endorse or promote products derived from this software without specific + prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + +*/ + +// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0 + + +public class RiskEvidenceSynthesis extends VersionConvertor_40_50 { + + public static org.hl7.fhir.r5.model.RiskEvidenceSynthesis convertRiskEvidenceSynthesis(org.hl7.fhir.r4.model.RiskEvidenceSynthesis src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.RiskEvidenceSynthesis tgt = new org.hl7.fhir.r5.model.RiskEvidenceSynthesis(); + copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrlElement(convertUri(src.getUrlElement())); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasVersion()) + tgt.setVersionElement(convertString(src.getVersionElement())); + if (src.hasName()) + tgt.setNameElement(convertString(src.getNameElement())); + if (src.hasTitle()) + tgt.setTitleElement(convertString(src.getTitleElement())); + if (src.hasStatus()) + tgt.setStatus(Enumerations.convertPublicationStatus(src.getStatus())); + if (src.hasDate()) + tgt.setDateElement(convertDateTime(src.getDateElement())); + if (src.hasPublisher()) + tgt.setPublisherElement(convertString(src.getPublisherElement())); + for (org.hl7.fhir.r4.model.ContactDetail t : src.getContact()) + tgt.addContact(convertContactDetail(t)); + if (src.hasDescription()) + tgt.setDescriptionElement(convertMarkdown(src.getDescriptionElement())); + for (org.hl7.fhir.r4.model.Annotation t : src.getNote()) + tgt.addNote(convertAnnotation(t)); + for (org.hl7.fhir.r4.model.UsageContext t : src.getUseContext()) + tgt.addUseContext(convertUsageContext(t)); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getJurisdiction()) + tgt.addJurisdiction(convertCodeableConcept(t)); + if (src.hasCopyright()) + tgt.setCopyrightElement(convertMarkdown(src.getCopyrightElement())); + if (src.hasApprovalDate()) + tgt.setApprovalDateElement(convertDate(src.getApprovalDateElement())); + if (src.hasLastReviewDate()) + tgt.setLastReviewDateElement(convertDate(src.getLastReviewDateElement())); + if (src.hasEffectivePeriod()) + tgt.setEffectivePeriod(convertPeriod(src.getEffectivePeriod())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getTopic()) + tgt.addTopic(convertCodeableConcept(t)); + for (org.hl7.fhir.r4.model.ContactDetail t : src.getAuthor()) + tgt.addAuthor(convertContactDetail(t)); + for (org.hl7.fhir.r4.model.ContactDetail t : src.getEditor()) + tgt.addEditor(convertContactDetail(t)); + for (org.hl7.fhir.r4.model.ContactDetail t : src.getReviewer()) + tgt.addReviewer(convertContactDetail(t)); + for (org.hl7.fhir.r4.model.ContactDetail t : src.getEndorser()) + tgt.addEndorser(convertContactDetail(t)); + for (org.hl7.fhir.r4.model.RelatedArtifact t : src.getRelatedArtifact()) + tgt.addRelatedArtifact(convertRelatedArtifact(t)); + if (src.hasSynthesisType()) + tgt.setSynthesisType(convertCodeableConcept(src.getSynthesisType())); + if (src.hasStudyType()) + tgt.setStudyType(convertCodeableConcept(src.getStudyType())); + if (src.hasPopulation()) + tgt.setPopulation(convertReference(src.getPopulation())); + if (src.hasExposure()) + tgt.setExposure(convertReference(src.getExposure())); + if (src.hasOutcome()) + tgt.setOutcome(convertReference(src.getOutcome())); + if (src.hasSampleSize()) + tgt.setSampleSize(convertRiskEvidenceSynthesisSampleSizeComponent(src.getSampleSize())); + if (src.hasRiskEstimate()) + tgt.setRiskEstimate(convertRiskEvidenceSynthesisRiskEstimateComponent(src.getRiskEstimate())); + for (org.hl7.fhir.r4.model.RiskEvidenceSynthesis.RiskEvidenceSynthesisCertaintyComponent t : src.getCertainty()) + tgt.addCertainty(convertRiskEvidenceSynthesisCertaintyComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.RiskEvidenceSynthesis convertRiskEvidenceSynthesis(org.hl7.fhir.r5.model.RiskEvidenceSynthesis src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.RiskEvidenceSynthesis tgt = new org.hl7.fhir.r4.model.RiskEvidenceSynthesis(); + copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrlElement(convertUri(src.getUrlElement())); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasVersion()) + tgt.setVersionElement(convertString(src.getVersionElement())); + if (src.hasName()) + tgt.setNameElement(convertString(src.getNameElement())); + if (src.hasTitle()) + tgt.setTitleElement(convertString(src.getTitleElement())); + if (src.hasStatus()) + tgt.setStatus(Enumerations.convertPublicationStatus(src.getStatus())); + if (src.hasDate()) + tgt.setDateElement(convertDateTime(src.getDateElement())); + if (src.hasPublisher()) + tgt.setPublisherElement(convertString(src.getPublisherElement())); + for (org.hl7.fhir.r5.model.ContactDetail t : src.getContact()) + tgt.addContact(convertContactDetail(t)); + if (src.hasDescription()) + tgt.setDescriptionElement(convertMarkdown(src.getDescriptionElement())); + for (org.hl7.fhir.r5.model.Annotation t : src.getNote()) + tgt.addNote(convertAnnotation(t)); + for (org.hl7.fhir.r5.model.UsageContext t : src.getUseContext()) + tgt.addUseContext(convertUsageContext(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getJurisdiction()) + tgt.addJurisdiction(convertCodeableConcept(t)); + if (src.hasCopyright()) + tgt.setCopyrightElement(convertMarkdown(src.getCopyrightElement())); + if (src.hasApprovalDate()) + tgt.setApprovalDateElement(convertDate(src.getApprovalDateElement())); + if (src.hasLastReviewDate()) + tgt.setLastReviewDateElement(convertDate(src.getLastReviewDateElement())); + if (src.hasEffectivePeriod()) + tgt.setEffectivePeriod(convertPeriod(src.getEffectivePeriod())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getTopic()) + tgt.addTopic(convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.ContactDetail t : src.getAuthor()) + tgt.addAuthor(convertContactDetail(t)); + for (org.hl7.fhir.r5.model.ContactDetail t : src.getEditor()) + tgt.addEditor(convertContactDetail(t)); + for (org.hl7.fhir.r5.model.ContactDetail t : src.getReviewer()) + tgt.addReviewer(convertContactDetail(t)); + for (org.hl7.fhir.r5.model.ContactDetail t : src.getEndorser()) + tgt.addEndorser(convertContactDetail(t)); + for (org.hl7.fhir.r5.model.RelatedArtifact t : src.getRelatedArtifact()) + tgt.addRelatedArtifact(convertRelatedArtifact(t)); + if (src.hasSynthesisType()) + tgt.setSynthesisType(convertCodeableConcept(src.getSynthesisType())); + if (src.hasStudyType()) + tgt.setStudyType(convertCodeableConcept(src.getStudyType())); + if (src.hasPopulation()) + tgt.setPopulation(convertReference(src.getPopulation())); + if (src.hasExposure()) + tgt.setExposure(convertReference(src.getExposure())); + if (src.hasOutcome()) + tgt.setOutcome(convertReference(src.getOutcome())); + if (src.hasSampleSize()) + tgt.setSampleSize(convertRiskEvidenceSynthesisSampleSizeComponent(src.getSampleSize())); + if (src.hasRiskEstimate()) + tgt.setRiskEstimate(convertRiskEvidenceSynthesisRiskEstimateComponent(src.getRiskEstimate())); + for (org.hl7.fhir.r5.model.RiskEvidenceSynthesis.RiskEvidenceSynthesisCertaintyComponent t : src.getCertainty()) + tgt.addCertainty(convertRiskEvidenceSynthesisCertaintyComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.RiskEvidenceSynthesis.RiskEvidenceSynthesisSampleSizeComponent convertRiskEvidenceSynthesisSampleSizeComponent(org.hl7.fhir.r4.model.RiskEvidenceSynthesis.RiskEvidenceSynthesisSampleSizeComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.RiskEvidenceSynthesis.RiskEvidenceSynthesisSampleSizeComponent tgt = new org.hl7.fhir.r5.model.RiskEvidenceSynthesis.RiskEvidenceSynthesisSampleSizeComponent(); + copyElement(src, tgt); + if (src.hasDescription()) + tgt.setDescriptionElement(convertString(src.getDescriptionElement())); + if (src.hasNumberOfStudies()) + tgt.setNumberOfStudiesElement(convertInteger(src.getNumberOfStudiesElement())); + if (src.hasNumberOfParticipants()) + tgt.setNumberOfParticipantsElement(convertInteger(src.getNumberOfParticipantsElement())); + return tgt; + } + + public static org.hl7.fhir.r4.model.RiskEvidenceSynthesis.RiskEvidenceSynthesisSampleSizeComponent convertRiskEvidenceSynthesisSampleSizeComponent(org.hl7.fhir.r5.model.RiskEvidenceSynthesis.RiskEvidenceSynthesisSampleSizeComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.RiskEvidenceSynthesis.RiskEvidenceSynthesisSampleSizeComponent tgt = new org.hl7.fhir.r4.model.RiskEvidenceSynthesis.RiskEvidenceSynthesisSampleSizeComponent(); + copyElement(src, tgt); + if (src.hasDescription()) + tgt.setDescriptionElement(convertString(src.getDescriptionElement())); + if (src.hasNumberOfStudies()) + tgt.setNumberOfStudiesElement(convertInteger(src.getNumberOfStudiesElement())); + if (src.hasNumberOfParticipants()) + tgt.setNumberOfParticipantsElement(convertInteger(src.getNumberOfParticipantsElement())); + return tgt; + } + + public static org.hl7.fhir.r5.model.RiskEvidenceSynthesis.RiskEvidenceSynthesisRiskEstimateComponent convertRiskEvidenceSynthesisRiskEstimateComponent(org.hl7.fhir.r4.model.RiskEvidenceSynthesis.RiskEvidenceSynthesisRiskEstimateComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.RiskEvidenceSynthesis.RiskEvidenceSynthesisRiskEstimateComponent tgt = new org.hl7.fhir.r5.model.RiskEvidenceSynthesis.RiskEvidenceSynthesisRiskEstimateComponent(); + copyElement(src, tgt); + if (src.hasDescription()) + tgt.setDescriptionElement(convertString(src.getDescriptionElement())); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + if (src.hasValue()) + tgt.setValueElement(convertDecimal(src.getValueElement())); + if (src.hasUnitOfMeasure()) + tgt.setUnitOfMeasure(convertCodeableConcept(src.getUnitOfMeasure())); + if (src.hasDenominatorCount()) + tgt.setDenominatorCountElement(convertInteger(src.getDenominatorCountElement())); + if (src.hasNumeratorCount()) + tgt.setNumeratorCountElement(convertInteger(src.getNumeratorCountElement())); + for (org.hl7.fhir.r4.model.RiskEvidenceSynthesis.RiskEvidenceSynthesisRiskEstimatePrecisionEstimateComponent t : src.getPrecisionEstimate()) + tgt.addPrecisionEstimate(convertRiskEvidenceSynthesisRiskEstimatePrecisionEstimateComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.RiskEvidenceSynthesis.RiskEvidenceSynthesisRiskEstimateComponent convertRiskEvidenceSynthesisRiskEstimateComponent(org.hl7.fhir.r5.model.RiskEvidenceSynthesis.RiskEvidenceSynthesisRiskEstimateComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.RiskEvidenceSynthesis.RiskEvidenceSynthesisRiskEstimateComponent tgt = new org.hl7.fhir.r4.model.RiskEvidenceSynthesis.RiskEvidenceSynthesisRiskEstimateComponent(); + copyElement(src, tgt); + if (src.hasDescription()) + tgt.setDescriptionElement(convertString(src.getDescriptionElement())); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + if (src.hasValue()) + tgt.setValueElement(convertDecimal(src.getValueElement())); + if (src.hasUnitOfMeasure()) + tgt.setUnitOfMeasure(convertCodeableConcept(src.getUnitOfMeasure())); + if (src.hasDenominatorCount()) + tgt.setDenominatorCountElement(convertInteger(src.getDenominatorCountElement())); + if (src.hasNumeratorCount()) + tgt.setNumeratorCountElement(convertInteger(src.getNumeratorCountElement())); + for (org.hl7.fhir.r5.model.RiskEvidenceSynthesis.RiskEvidenceSynthesisRiskEstimatePrecisionEstimateComponent t : src.getPrecisionEstimate()) + tgt.addPrecisionEstimate(convertRiskEvidenceSynthesisRiskEstimatePrecisionEstimateComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.RiskEvidenceSynthesis.RiskEvidenceSynthesisRiskEstimatePrecisionEstimateComponent convertRiskEvidenceSynthesisRiskEstimatePrecisionEstimateComponent(org.hl7.fhir.r4.model.RiskEvidenceSynthesis.RiskEvidenceSynthesisRiskEstimatePrecisionEstimateComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.RiskEvidenceSynthesis.RiskEvidenceSynthesisRiskEstimatePrecisionEstimateComponent tgt = new org.hl7.fhir.r5.model.RiskEvidenceSynthesis.RiskEvidenceSynthesisRiskEstimatePrecisionEstimateComponent(); + copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + if (src.hasLevel()) + tgt.setLevelElement(convertDecimal(src.getLevelElement())); + if (src.hasFrom()) + tgt.setFromElement(convertDecimal(src.getFromElement())); + if (src.hasTo()) + tgt.setToElement(convertDecimal(src.getToElement())); + return tgt; + } + + public static org.hl7.fhir.r4.model.RiskEvidenceSynthesis.RiskEvidenceSynthesisRiskEstimatePrecisionEstimateComponent convertRiskEvidenceSynthesisRiskEstimatePrecisionEstimateComponent(org.hl7.fhir.r5.model.RiskEvidenceSynthesis.RiskEvidenceSynthesisRiskEstimatePrecisionEstimateComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.RiskEvidenceSynthesis.RiskEvidenceSynthesisRiskEstimatePrecisionEstimateComponent tgt = new org.hl7.fhir.r4.model.RiskEvidenceSynthesis.RiskEvidenceSynthesisRiskEstimatePrecisionEstimateComponent(); + copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + if (src.hasLevel()) + tgt.setLevelElement(convertDecimal(src.getLevelElement())); + if (src.hasFrom()) + tgt.setFromElement(convertDecimal(src.getFromElement())); + if (src.hasTo()) + tgt.setToElement(convertDecimal(src.getToElement())); + return tgt; + } + + public static org.hl7.fhir.r5.model.RiskEvidenceSynthesis.RiskEvidenceSynthesisCertaintyComponent convertRiskEvidenceSynthesisCertaintyComponent(org.hl7.fhir.r4.model.RiskEvidenceSynthesis.RiskEvidenceSynthesisCertaintyComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.RiskEvidenceSynthesis.RiskEvidenceSynthesisCertaintyComponent tgt = new org.hl7.fhir.r5.model.RiskEvidenceSynthesis.RiskEvidenceSynthesisCertaintyComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getRating()) + tgt.addRating(convertCodeableConcept(t)); + for (org.hl7.fhir.r4.model.Annotation t : src.getNote()) + tgt.addNote(convertAnnotation(t)); + for (org.hl7.fhir.r4.model.RiskEvidenceSynthesis.RiskEvidenceSynthesisCertaintyCertaintySubcomponentComponent t : src.getCertaintySubcomponent()) + tgt.addCertaintySubcomponent(convertRiskEvidenceSynthesisCertaintyCertaintySubcomponentComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.RiskEvidenceSynthesis.RiskEvidenceSynthesisCertaintyComponent convertRiskEvidenceSynthesisCertaintyComponent(org.hl7.fhir.r5.model.RiskEvidenceSynthesis.RiskEvidenceSynthesisCertaintyComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.RiskEvidenceSynthesis.RiskEvidenceSynthesisCertaintyComponent tgt = new org.hl7.fhir.r4.model.RiskEvidenceSynthesis.RiskEvidenceSynthesisCertaintyComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getRating()) + tgt.addRating(convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.Annotation t : src.getNote()) + tgt.addNote(convertAnnotation(t)); + for (org.hl7.fhir.r5.model.RiskEvidenceSynthesis.RiskEvidenceSynthesisCertaintyCertaintySubcomponentComponent t : src.getCertaintySubcomponent()) + tgt.addCertaintySubcomponent(convertRiskEvidenceSynthesisCertaintyCertaintySubcomponentComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.RiskEvidenceSynthesis.RiskEvidenceSynthesisCertaintyCertaintySubcomponentComponent convertRiskEvidenceSynthesisCertaintyCertaintySubcomponentComponent(org.hl7.fhir.r4.model.RiskEvidenceSynthesis.RiskEvidenceSynthesisCertaintyCertaintySubcomponentComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.RiskEvidenceSynthesis.RiskEvidenceSynthesisCertaintyCertaintySubcomponentComponent tgt = new org.hl7.fhir.r5.model.RiskEvidenceSynthesis.RiskEvidenceSynthesisCertaintyCertaintySubcomponentComponent(); + copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getRating()) + tgt.addRating(convertCodeableConcept(t)); + for (org.hl7.fhir.r4.model.Annotation t : src.getNote()) + tgt.addNote(convertAnnotation(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.RiskEvidenceSynthesis.RiskEvidenceSynthesisCertaintyCertaintySubcomponentComponent convertRiskEvidenceSynthesisCertaintyCertaintySubcomponentComponent(org.hl7.fhir.r5.model.RiskEvidenceSynthesis.RiskEvidenceSynthesisCertaintyCertaintySubcomponentComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.RiskEvidenceSynthesis.RiskEvidenceSynthesisCertaintyCertaintySubcomponentComponent tgt = new org.hl7.fhir.r4.model.RiskEvidenceSynthesis.RiskEvidenceSynthesisCertaintyCertaintySubcomponentComponent(); + copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getRating()) + tgt.addRating(convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.Annotation t : src.getNote()) + tgt.addNote(convertAnnotation(t)); + return tgt; + } + + +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Schedule.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Schedule.java new file mode 100644 index 000000000..98f91270d --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Schedule.java @@ -0,0 +1,91 @@ +package org.hl7.fhir.convertors.conv40_50; + +import org.hl7.fhir.exceptions.FHIRException; + +import org.hl7.fhir.convertors.VersionConvertor_40_50; + + +/* + Copyright (c) 2011+, HL7, Inc. + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of HL7 nor the names of its contributors may be used to + endorse or promote products derived from this software without specific + prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + +*/ + +// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0 + + +public class Schedule extends VersionConvertor_40_50 { + + public static org.hl7.fhir.r5.model.Schedule convertSchedule(org.hl7.fhir.r4.model.Schedule src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Schedule tgt = new org.hl7.fhir.r5.model.Schedule(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasActive()) + tgt.setActiveElement(convertBoolean(src.getActiveElement())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getServiceCategory()) + tgt.addServiceCategory(convertCodeableConcept(t)); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getServiceType()) + tgt.addServiceType(convertCodeableConcept(t)); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getSpecialty()) + tgt.addSpecialty(convertCodeableConcept(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getActor()) + tgt.addActor(convertReference(t)); + if (src.hasPlanningHorizon()) + tgt.setPlanningHorizon(convertPeriod(src.getPlanningHorizon())); + if (src.hasComment()) + tgt.setCommentElement(convertString(src.getCommentElement())); + return tgt; + } + + public static org.hl7.fhir.r4.model.Schedule convertSchedule(org.hl7.fhir.r5.model.Schedule src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Schedule tgt = new org.hl7.fhir.r4.model.Schedule(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasActive()) + tgt.setActiveElement(convertBoolean(src.getActiveElement())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getServiceCategory()) + tgt.addServiceCategory(convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getServiceType()) + tgt.addServiceType(convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getSpecialty()) + tgt.addSpecialty(convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getActor()) + tgt.addActor(convertReference(t)); + if (src.hasPlanningHorizon()) + tgt.setPlanningHorizon(convertPeriod(src.getPlanningHorizon())); + if (src.hasComment()) + tgt.setCommentElement(convertString(src.getCommentElement())); + return tgt; + } + + +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/SearchParameter.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/SearchParameter.java new file mode 100644 index 000000000..11b945314 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/SearchParameter.java @@ -0,0 +1,287 @@ +package org.hl7.fhir.convertors.conv40_50; + +import org.hl7.fhir.exceptions.FHIRException; + +import org.hl7.fhir.convertors.VersionConvertor_40_50; + + +/* + Copyright (c) 2011+, HL7, Inc. + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of HL7 nor the names of its contributors may be used to + endorse or promote products derived from this software without specific + prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + +*/ + +// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0 + + +public class SearchParameter extends VersionConvertor_40_50 { + + public static org.hl7.fhir.r5.model.SearchParameter convertSearchParameter(org.hl7.fhir.r4.model.SearchParameter src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.SearchParameter tgt = new org.hl7.fhir.r5.model.SearchParameter(); + copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrlElement(convertUri(src.getUrlElement())); + if (src.hasVersion()) + tgt.setVersionElement(convertString(src.getVersionElement())); + if (src.hasName()) + tgt.setNameElement(convertString(src.getNameElement())); + if (src.hasDerivedFrom()) + tgt.setDerivedFromElement(convertCanonical(src.getDerivedFromElement())); + if (src.hasStatus()) + tgt.setStatus(Enumerations.convertPublicationStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimentalElement(convertBoolean(src.getExperimentalElement())); + if (src.hasDate()) + tgt.setDateElement(convertDateTime(src.getDateElement())); + if (src.hasPublisher()) + tgt.setPublisherElement(convertString(src.getPublisherElement())); + for (org.hl7.fhir.r4.model.ContactDetail t : src.getContact()) + tgt.addContact(convertContactDetail(t)); + if (src.hasDescription()) + tgt.setDescriptionElement(convertMarkdown(src.getDescriptionElement())); + for (org.hl7.fhir.r4.model.UsageContext t : src.getUseContext()) + tgt.addUseContext(convertUsageContext(t)); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getJurisdiction()) + tgt.addJurisdiction(convertCodeableConcept(t)); + if (src.hasPurpose()) + tgt.setPurposeElement(convertMarkdown(src.getPurposeElement())); + if (src.hasCode()) + tgt.setCodeElement(convertCode(src.getCodeElement())); + for (org.hl7.fhir.r4.model.CodeType t : src.getBase()) + tgt.getBase().add(convertCode(t)); + if (src.hasType()) + tgt.setType(Enumerations.convertSearchParamType(src.getType())); + if (src.hasExpression()) + tgt.setExpressionElement(convertString(src.getExpressionElement())); + if (src.hasXpath()) + tgt.setXpathElement(convertString(src.getXpathElement())); + if (src.hasXpathUsage()) + tgt.setXpathUsage(convertXPathUsageType(src.getXpathUsage())); + for (org.hl7.fhir.r4.model.CodeType t : src.getTarget()) + tgt.getTarget().add(convertCode(t)); + if (src.hasMultipleOr()) + tgt.setMultipleOrElement(convertBoolean(src.getMultipleOrElement())); + if (src.hasMultipleAnd()) + tgt.setMultipleAndElement(convertBoolean(src.getMultipleAndElement())); + for (org.hl7.fhir.r4.model.Enumeration t : src.getComparator()) + tgt.addComparator(convertSearchComparator(t.getValue())); + for (org.hl7.fhir.r4.model.Enumeration t : src.getModifier()) + tgt.addModifier(convertSearchModifierCode(t.getValue())); + for (org.hl7.fhir.r4.model.StringType t : src.getChain()) + tgt.getChain().add(convertString(t)); + for (org.hl7.fhir.r4.model.SearchParameter.SearchParameterComponentComponent t : src.getComponent()) + tgt.addComponent(convertSearchParameterComponentComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.SearchParameter convertSearchParameter(org.hl7.fhir.r5.model.SearchParameter src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.SearchParameter tgt = new org.hl7.fhir.r4.model.SearchParameter(); + copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrlElement(convertUri(src.getUrlElement())); + if (src.hasVersion()) + tgt.setVersionElement(convertString(src.getVersionElement())); + if (src.hasName()) + tgt.setNameElement(convertString(src.getNameElement())); + if (src.hasDerivedFrom()) + tgt.setDerivedFromElement(convertCanonical(src.getDerivedFromElement())); + if (src.hasStatus()) + tgt.setStatus(Enumerations.convertPublicationStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimentalElement(convertBoolean(src.getExperimentalElement())); + if (src.hasDate()) + tgt.setDateElement(convertDateTime(src.getDateElement())); + if (src.hasPublisher()) + tgt.setPublisherElement(convertString(src.getPublisherElement())); + for (org.hl7.fhir.r5.model.ContactDetail t : src.getContact()) + tgt.addContact(convertContactDetail(t)); + if (src.hasDescription()) + tgt.setDescriptionElement(convertMarkdown(src.getDescriptionElement())); + for (org.hl7.fhir.r5.model.UsageContext t : src.getUseContext()) + tgt.addUseContext(convertUsageContext(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getJurisdiction()) + tgt.addJurisdiction(convertCodeableConcept(t)); + if (src.hasPurpose()) + tgt.setPurposeElement(convertMarkdown(src.getPurposeElement())); + if (src.hasCode()) + tgt.setCodeElement(convertCode(src.getCodeElement())); + for (org.hl7.fhir.r5.model.CodeType t : src.getBase()) + tgt.getBase().add(convertCode(t)); + if (src.hasType()) + tgt.setType(Enumerations.convertSearchParamType(src.getType())); + if (src.hasExpression()) + tgt.setExpressionElement(convertString(src.getExpressionElement())); + if (src.hasXpath()) + tgt.setXpathElement(convertString(src.getXpathElement())); + if (src.hasXpathUsage()) + tgt.setXpathUsage(convertXPathUsageType(src.getXpathUsage())); + for (org.hl7.fhir.r5.model.CodeType t : src.getTarget()) + tgt.getTarget().add(convertCode(t)); + if (src.hasMultipleOr()) + tgt.setMultipleOrElement(convertBoolean(src.getMultipleOrElement())); + if (src.hasMultipleAnd()) + tgt.setMultipleAndElement(convertBoolean(src.getMultipleAndElement())); + for (org.hl7.fhir.r5.model.Enumeration t : src.getComparator()) + tgt.addComparator(convertSearchComparator(t.getValue())); + for (org.hl7.fhir.r5.model.Enumeration t : src.getModifier()) + tgt.addModifier(convertSearchModifierCode(t.getValue())); + for (org.hl7.fhir.r5.model.StringType t : src.getChain()) + tgt.getChain().add(convertString(t)); + for (org.hl7.fhir.r5.model.SearchParameter.SearchParameterComponentComponent t : src.getComponent()) + tgt.addComponent(convertSearchParameterComponentComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.SearchParameter.XPathUsageType convertXPathUsageType(org.hl7.fhir.r4.model.SearchParameter.XPathUsageType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case NORMAL: return org.hl7.fhir.r5.model.SearchParameter.XPathUsageType.NORMAL; + case PHONETIC: return org.hl7.fhir.r5.model.SearchParameter.XPathUsageType.PHONETIC; + case NEARBY: return org.hl7.fhir.r5.model.SearchParameter.XPathUsageType.NEARBY; + case DISTANCE: return org.hl7.fhir.r5.model.SearchParameter.XPathUsageType.DISTANCE; + case OTHER: return org.hl7.fhir.r5.model.SearchParameter.XPathUsageType.OTHER; + default: return org.hl7.fhir.r5.model.SearchParameter.XPathUsageType.NULL; + } +} + + public static org.hl7.fhir.r4.model.SearchParameter.XPathUsageType convertXPathUsageType(org.hl7.fhir.r5.model.SearchParameter.XPathUsageType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case NORMAL: return org.hl7.fhir.r4.model.SearchParameter.XPathUsageType.NORMAL; + case PHONETIC: return org.hl7.fhir.r4.model.SearchParameter.XPathUsageType.PHONETIC; + case NEARBY: return org.hl7.fhir.r4.model.SearchParameter.XPathUsageType.NEARBY; + case DISTANCE: return org.hl7.fhir.r4.model.SearchParameter.XPathUsageType.DISTANCE; + case OTHER: return org.hl7.fhir.r4.model.SearchParameter.XPathUsageType.OTHER; + default: return org.hl7.fhir.r4.model.SearchParameter.XPathUsageType.NULL; + } +} + + public static org.hl7.fhir.r5.model.SearchParameter.SearchComparator convertSearchComparator(org.hl7.fhir.r4.model.SearchParameter.SearchComparator src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case EQ: return org.hl7.fhir.r5.model.SearchParameter.SearchComparator.EQ; + case NE: return org.hl7.fhir.r5.model.SearchParameter.SearchComparator.NE; + case GT: return org.hl7.fhir.r5.model.SearchParameter.SearchComparator.GT; + case LT: return org.hl7.fhir.r5.model.SearchParameter.SearchComparator.LT; + case GE: return org.hl7.fhir.r5.model.SearchParameter.SearchComparator.GE; + case LE: return org.hl7.fhir.r5.model.SearchParameter.SearchComparator.LE; + case SA: return org.hl7.fhir.r5.model.SearchParameter.SearchComparator.SA; + case EB: return org.hl7.fhir.r5.model.SearchParameter.SearchComparator.EB; + case AP: return org.hl7.fhir.r5.model.SearchParameter.SearchComparator.AP; + default: return org.hl7.fhir.r5.model.SearchParameter.SearchComparator.NULL; + } +} + + public static org.hl7.fhir.r4.model.SearchParameter.SearchComparator convertSearchComparator(org.hl7.fhir.r5.model.SearchParameter.SearchComparator src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case EQ: return org.hl7.fhir.r4.model.SearchParameter.SearchComparator.EQ; + case NE: return org.hl7.fhir.r4.model.SearchParameter.SearchComparator.NE; + case GT: return org.hl7.fhir.r4.model.SearchParameter.SearchComparator.GT; + case LT: return org.hl7.fhir.r4.model.SearchParameter.SearchComparator.LT; + case GE: return org.hl7.fhir.r4.model.SearchParameter.SearchComparator.GE; + case LE: return org.hl7.fhir.r4.model.SearchParameter.SearchComparator.LE; + case SA: return org.hl7.fhir.r4.model.SearchParameter.SearchComparator.SA; + case EB: return org.hl7.fhir.r4.model.SearchParameter.SearchComparator.EB; + case AP: return org.hl7.fhir.r4.model.SearchParameter.SearchComparator.AP; + default: return org.hl7.fhir.r4.model.SearchParameter.SearchComparator.NULL; + } +} + + public static org.hl7.fhir.r5.model.SearchParameter.SearchModifierCode convertSearchModifierCode(org.hl7.fhir.r4.model.SearchParameter.SearchModifierCode src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case MISSING: return org.hl7.fhir.r5.model.SearchParameter.SearchModifierCode.MISSING; + case EXACT: return org.hl7.fhir.r5.model.SearchParameter.SearchModifierCode.EXACT; + case CONTAINS: return org.hl7.fhir.r5.model.SearchParameter.SearchModifierCode.CONTAINS; + case NOT: return org.hl7.fhir.r5.model.SearchParameter.SearchModifierCode.NOT; + case TEXT: return org.hl7.fhir.r5.model.SearchParameter.SearchModifierCode.TEXT; + case IN: return org.hl7.fhir.r5.model.SearchParameter.SearchModifierCode.IN; + case NOTIN: return org.hl7.fhir.r5.model.SearchParameter.SearchModifierCode.NOTIN; + case BELOW: return org.hl7.fhir.r5.model.SearchParameter.SearchModifierCode.BELOW; + case ABOVE: return org.hl7.fhir.r5.model.SearchParameter.SearchModifierCode.ABOVE; + case TYPE: return org.hl7.fhir.r5.model.SearchParameter.SearchModifierCode.TYPE; + case IDENTIFIER: return org.hl7.fhir.r5.model.SearchParameter.SearchModifierCode.IDENTIFIER; + case OFTYPE: return org.hl7.fhir.r5.model.SearchParameter.SearchModifierCode.OFTYPE; + default: return org.hl7.fhir.r5.model.SearchParameter.SearchModifierCode.NULL; + } +} + + public static org.hl7.fhir.r4.model.SearchParameter.SearchModifierCode convertSearchModifierCode(org.hl7.fhir.r5.model.SearchParameter.SearchModifierCode src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case MISSING: return org.hl7.fhir.r4.model.SearchParameter.SearchModifierCode.MISSING; + case EXACT: return org.hl7.fhir.r4.model.SearchParameter.SearchModifierCode.EXACT; + case CONTAINS: return org.hl7.fhir.r4.model.SearchParameter.SearchModifierCode.CONTAINS; + case NOT: return org.hl7.fhir.r4.model.SearchParameter.SearchModifierCode.NOT; + case TEXT: return org.hl7.fhir.r4.model.SearchParameter.SearchModifierCode.TEXT; + case IN: return org.hl7.fhir.r4.model.SearchParameter.SearchModifierCode.IN; + case NOTIN: return org.hl7.fhir.r4.model.SearchParameter.SearchModifierCode.NOTIN; + case BELOW: return org.hl7.fhir.r4.model.SearchParameter.SearchModifierCode.BELOW; + case ABOVE: return org.hl7.fhir.r4.model.SearchParameter.SearchModifierCode.ABOVE; + case TYPE: return org.hl7.fhir.r4.model.SearchParameter.SearchModifierCode.TYPE; + case IDENTIFIER: return org.hl7.fhir.r4.model.SearchParameter.SearchModifierCode.IDENTIFIER; + case OFTYPE: return org.hl7.fhir.r4.model.SearchParameter.SearchModifierCode.OFTYPE; + default: return org.hl7.fhir.r4.model.SearchParameter.SearchModifierCode.NULL; + } +} + + public static org.hl7.fhir.r5.model.SearchParameter.SearchParameterComponentComponent convertSearchParameterComponentComponent(org.hl7.fhir.r4.model.SearchParameter.SearchParameterComponentComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.SearchParameter.SearchParameterComponentComponent tgt = new org.hl7.fhir.r5.model.SearchParameter.SearchParameterComponentComponent(); + copyElement(src, tgt); + if (src.hasDefinition()) + tgt.setDefinitionElement(convertCanonical(src.getDefinitionElement())); + if (src.hasExpression()) + tgt.setExpressionElement(convertString(src.getExpressionElement())); + return tgt; + } + + public static org.hl7.fhir.r4.model.SearchParameter.SearchParameterComponentComponent convertSearchParameterComponentComponent(org.hl7.fhir.r5.model.SearchParameter.SearchParameterComponentComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.SearchParameter.SearchParameterComponentComponent tgt = new org.hl7.fhir.r4.model.SearchParameter.SearchParameterComponentComponent(); + copyElement(src, tgt); + if (src.hasDefinition()) + tgt.setDefinitionElement(convertCanonical(src.getDefinitionElement())); + if (src.hasExpression()) + tgt.setExpressionElement(convertString(src.getExpressionElement())); + return tgt; + } + + +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/ServiceRequest.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/ServiceRequest.java new file mode 100644 index 000000000..d597ac803 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/ServiceRequest.java @@ -0,0 +1,279 @@ +package org.hl7.fhir.convertors.conv40_50; + +import org.hl7.fhir.exceptions.FHIRException; + +import org.hl7.fhir.convertors.VersionConvertor_40_50; + + +/* + Copyright (c) 2011+, HL7, Inc. + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of HL7 nor the names of its contributors may be used to + endorse or promote products derived from this software without specific + prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + +*/ + +// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0 + + +public class ServiceRequest extends VersionConvertor_40_50 { + + public static org.hl7.fhir.r5.model.ServiceRequest convertServiceRequest(org.hl7.fhir.r4.model.ServiceRequest src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ServiceRequest tgt = new org.hl7.fhir.r5.model.ServiceRequest(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + for (org.hl7.fhir.r4.model.CanonicalType t : src.getInstantiatesCanonical()) + tgt.getInstantiatesCanonical().add(convertCanonical(t)); + for (org.hl7.fhir.r4.model.UriType t : src.getInstantiatesUri()) + tgt.getInstantiatesUri().add(convertUri(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getBasedOn()) + tgt.addBasedOn(convertReference(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getReplaces()) + tgt.addReplaces(convertReference(t)); + if (src.hasRequisition()) + tgt.setRequisition(convertIdentifier(src.getRequisition())); + if (src.hasStatus()) + tgt.setStatus(convertServiceRequestStatus(src.getStatus())); + if (src.hasIntent()) + tgt.setIntent(convertServiceRequestIntent(src.getIntent())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getCategory()) + tgt.addCategory(convertCodeableConcept(t)); + if (src.hasPriority()) + tgt.setPriority(convertServiceRequestPriority(src.getPriority())); + if (src.hasDoNotPerform()) + tgt.setDoNotPerformElement(convertBoolean(src.getDoNotPerformElement())); + if (src.hasCode()) + tgt.setCode(convertCodeableConcept(src.getCode())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getOrderDetail()) + tgt.addOrderDetail(convertCodeableConcept(t)); + if (src.hasQuantity()) + tgt.setQuantity(convertType(src.getQuantity())); + if (src.hasSubject()) + tgt.setSubject(convertReference(src.getSubject())); + if (src.hasEncounter()) + tgt.setEncounter(convertReference(src.getEncounter())); + if (src.hasOccurrence()) + tgt.setOccurrence(convertType(src.getOccurrence())); + if (src.hasAsNeeded()) + tgt.setAsNeeded(convertType(src.getAsNeeded())); + if (src.hasAuthoredOn()) + tgt.setAuthoredOnElement(convertDateTime(src.getAuthoredOnElement())); + if (src.hasRequester()) + tgt.setRequester(convertReference(src.getRequester())); + if (src.hasPerformerType()) + tgt.setPerformerType(convertCodeableConcept(src.getPerformerType())); + for (org.hl7.fhir.r4.model.Reference t : src.getPerformer()) + tgt.addPerformer(convertReference(t)); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getLocationCode()) + tgt.addLocationCode(convertCodeableConcept(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getLocationReference()) + tgt.addLocationReference(convertReference(t)); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getReasonCode()) + tgt.addReasonCode(convertCodeableConcept(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getReasonReference()) + tgt.addReasonReference(convertReference(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getInsurance()) + tgt.addInsurance(convertReference(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getSupportingInfo()) + tgt.addSupportingInfo(convertReference(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getSpecimen()) + tgt.addSpecimen(convertReference(t)); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getBodySite()) + tgt.addBodySite(convertCodeableConcept(t)); + for (org.hl7.fhir.r4.model.Annotation t : src.getNote()) + tgt.addNote(convertAnnotation(t)); + if (src.hasPatientInstruction()) + tgt.setPatientInstructionElement(convertString(src.getPatientInstructionElement())); + for (org.hl7.fhir.r4.model.Reference t : src.getRelevantHistory()) + tgt.addRelevantHistory(convertReference(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.ServiceRequest convertServiceRequest(org.hl7.fhir.r5.model.ServiceRequest src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.ServiceRequest tgt = new org.hl7.fhir.r4.model.ServiceRequest(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + for (org.hl7.fhir.r5.model.CanonicalType t : src.getInstantiatesCanonical()) + tgt.getInstantiatesCanonical().add(convertCanonical(t)); + for (org.hl7.fhir.r5.model.UriType t : src.getInstantiatesUri()) + tgt.getInstantiatesUri().add(convertUri(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getBasedOn()) + tgt.addBasedOn(convertReference(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getReplaces()) + tgt.addReplaces(convertReference(t)); + if (src.hasRequisition()) + tgt.setRequisition(convertIdentifier(src.getRequisition())); + if (src.hasStatus()) + tgt.setStatus(convertServiceRequestStatus(src.getStatus())); + if (src.hasIntent()) + tgt.setIntent(convertServiceRequestIntent(src.getIntent())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getCategory()) + tgt.addCategory(convertCodeableConcept(t)); + if (src.hasPriority()) + tgt.setPriority(convertServiceRequestPriority(src.getPriority())); + if (src.hasDoNotPerform()) + tgt.setDoNotPerformElement(convertBoolean(src.getDoNotPerformElement())); + if (src.hasCode()) + tgt.setCode(convertCodeableConcept(src.getCode())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getOrderDetail()) + tgt.addOrderDetail(convertCodeableConcept(t)); + if (src.hasQuantity()) + tgt.setQuantity(convertType(src.getQuantity())); + if (src.hasSubject()) + tgt.setSubject(convertReference(src.getSubject())); + if (src.hasEncounter()) + tgt.setEncounter(convertReference(src.getEncounter())); + if (src.hasOccurrence()) + tgt.setOccurrence(convertType(src.getOccurrence())); + if (src.hasAsNeeded()) + tgt.setAsNeeded(convertType(src.getAsNeeded())); + if (src.hasAuthoredOn()) + tgt.setAuthoredOnElement(convertDateTime(src.getAuthoredOnElement())); + if (src.hasRequester()) + tgt.setRequester(convertReference(src.getRequester())); + if (src.hasPerformerType()) + tgt.setPerformerType(convertCodeableConcept(src.getPerformerType())); + for (org.hl7.fhir.r5.model.Reference t : src.getPerformer()) + tgt.addPerformer(convertReference(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getLocationCode()) + tgt.addLocationCode(convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getLocationReference()) + tgt.addLocationReference(convertReference(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getReasonCode()) + tgt.addReasonCode(convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getReasonReference()) + tgt.addReasonReference(convertReference(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getInsurance()) + tgt.addInsurance(convertReference(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getSupportingInfo()) + tgt.addSupportingInfo(convertReference(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getSpecimen()) + tgt.addSpecimen(convertReference(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getBodySite()) + tgt.addBodySite(convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.Annotation t : src.getNote()) + tgt.addNote(convertAnnotation(t)); + if (src.hasPatientInstruction()) + tgt.setPatientInstructionElement(convertString(src.getPatientInstructionElement())); + for (org.hl7.fhir.r5.model.Reference t : src.getRelevantHistory()) + tgt.addRelevantHistory(convertReference(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.ServiceRequest.ServiceRequestStatus convertServiceRequestStatus(org.hl7.fhir.r4.model.ServiceRequest.ServiceRequestStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case DRAFT: return org.hl7.fhir.r5.model.ServiceRequest.ServiceRequestStatus.DRAFT; + case ACTIVE: return org.hl7.fhir.r5.model.ServiceRequest.ServiceRequestStatus.ACTIVE; + case ONHOLD: return org.hl7.fhir.r5.model.ServiceRequest.ServiceRequestStatus.ONHOLD; + case REVOKED: return org.hl7.fhir.r5.model.ServiceRequest.ServiceRequestStatus.REVOKED; + case COMPLETED: return org.hl7.fhir.r5.model.ServiceRequest.ServiceRequestStatus.COMPLETED; + case ENTEREDINERROR: return org.hl7.fhir.r5.model.ServiceRequest.ServiceRequestStatus.ENTEREDINERROR; + case UNKNOWN: return org.hl7.fhir.r5.model.ServiceRequest.ServiceRequestStatus.UNKNOWN; + default: return org.hl7.fhir.r5.model.ServiceRequest.ServiceRequestStatus.NULL; + } +} + + public static org.hl7.fhir.r4.model.ServiceRequest.ServiceRequestStatus convertServiceRequestStatus(org.hl7.fhir.r5.model.ServiceRequest.ServiceRequestStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case DRAFT: return org.hl7.fhir.r4.model.ServiceRequest.ServiceRequestStatus.DRAFT; + case ACTIVE: return org.hl7.fhir.r4.model.ServiceRequest.ServiceRequestStatus.ACTIVE; + case ONHOLD: return org.hl7.fhir.r4.model.ServiceRequest.ServiceRequestStatus.ONHOLD; + case REVOKED: return org.hl7.fhir.r4.model.ServiceRequest.ServiceRequestStatus.REVOKED; + case COMPLETED: return org.hl7.fhir.r4.model.ServiceRequest.ServiceRequestStatus.COMPLETED; + case ENTEREDINERROR: return org.hl7.fhir.r4.model.ServiceRequest.ServiceRequestStatus.ENTEREDINERROR; + case UNKNOWN: return org.hl7.fhir.r4.model.ServiceRequest.ServiceRequestStatus.UNKNOWN; + default: return org.hl7.fhir.r4.model.ServiceRequest.ServiceRequestStatus.NULL; + } +} + + public static org.hl7.fhir.r5.model.ServiceRequest.ServiceRequestIntent convertServiceRequestIntent(org.hl7.fhir.r4.model.ServiceRequest.ServiceRequestIntent src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PROPOSAL: return org.hl7.fhir.r5.model.ServiceRequest.ServiceRequestIntent.PROPOSAL; + case PLAN: return org.hl7.fhir.r5.model.ServiceRequest.ServiceRequestIntent.PLAN; + case DIRECTIVE: return org.hl7.fhir.r5.model.ServiceRequest.ServiceRequestIntent.DIRECTIVE; + case ORDER: return org.hl7.fhir.r5.model.ServiceRequest.ServiceRequestIntent.ORDER; + case ORIGINALORDER: return org.hl7.fhir.r5.model.ServiceRequest.ServiceRequestIntent.ORIGINALORDER; + case REFLEXORDER: return org.hl7.fhir.r5.model.ServiceRequest.ServiceRequestIntent.REFLEXORDER; + case FILLERORDER: return org.hl7.fhir.r5.model.ServiceRequest.ServiceRequestIntent.FILLERORDER; + case INSTANCEORDER: return org.hl7.fhir.r5.model.ServiceRequest.ServiceRequestIntent.INSTANCEORDER; + case OPTION: return org.hl7.fhir.r5.model.ServiceRequest.ServiceRequestIntent.OPTION; + default: return org.hl7.fhir.r5.model.ServiceRequest.ServiceRequestIntent.NULL; + } +} + + public static org.hl7.fhir.r4.model.ServiceRequest.ServiceRequestIntent convertServiceRequestIntent(org.hl7.fhir.r5.model.ServiceRequest.ServiceRequestIntent src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PROPOSAL: return org.hl7.fhir.r4.model.ServiceRequest.ServiceRequestIntent.PROPOSAL; + case PLAN: return org.hl7.fhir.r4.model.ServiceRequest.ServiceRequestIntent.PLAN; + case DIRECTIVE: return org.hl7.fhir.r4.model.ServiceRequest.ServiceRequestIntent.DIRECTIVE; + case ORDER: return org.hl7.fhir.r4.model.ServiceRequest.ServiceRequestIntent.ORDER; + case ORIGINALORDER: return org.hl7.fhir.r4.model.ServiceRequest.ServiceRequestIntent.ORIGINALORDER; + case REFLEXORDER: return org.hl7.fhir.r4.model.ServiceRequest.ServiceRequestIntent.REFLEXORDER; + case FILLERORDER: return org.hl7.fhir.r4.model.ServiceRequest.ServiceRequestIntent.FILLERORDER; + case INSTANCEORDER: return org.hl7.fhir.r4.model.ServiceRequest.ServiceRequestIntent.INSTANCEORDER; + case OPTION: return org.hl7.fhir.r4.model.ServiceRequest.ServiceRequestIntent.OPTION; + default: return org.hl7.fhir.r4.model.ServiceRequest.ServiceRequestIntent.NULL; + } +} + + public static org.hl7.fhir.r5.model.ServiceRequest.ServiceRequestPriority convertServiceRequestPriority(org.hl7.fhir.r4.model.ServiceRequest.ServiceRequestPriority src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case ROUTINE: return org.hl7.fhir.r5.model.ServiceRequest.ServiceRequestPriority.ROUTINE; + case URGENT: return org.hl7.fhir.r5.model.ServiceRequest.ServiceRequestPriority.URGENT; + case ASAP: return org.hl7.fhir.r5.model.ServiceRequest.ServiceRequestPriority.ASAP; + case STAT: return org.hl7.fhir.r5.model.ServiceRequest.ServiceRequestPriority.STAT; + default: return org.hl7.fhir.r5.model.ServiceRequest.ServiceRequestPriority.NULL; + } +} + + public static org.hl7.fhir.r4.model.ServiceRequest.ServiceRequestPriority convertServiceRequestPriority(org.hl7.fhir.r5.model.ServiceRequest.ServiceRequestPriority src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case ROUTINE: return org.hl7.fhir.r4.model.ServiceRequest.ServiceRequestPriority.ROUTINE; + case URGENT: return org.hl7.fhir.r4.model.ServiceRequest.ServiceRequestPriority.URGENT; + case ASAP: return org.hl7.fhir.r4.model.ServiceRequest.ServiceRequestPriority.ASAP; + case STAT: return org.hl7.fhir.r4.model.ServiceRequest.ServiceRequestPriority.STAT; + default: return org.hl7.fhir.r4.model.ServiceRequest.ServiceRequestPriority.NULL; + } +} + + +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Slot.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Slot.java new file mode 100644 index 000000000..e7f19a6ce --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Slot.java @@ -0,0 +1,129 @@ +package org.hl7.fhir.convertors.conv40_50; + +import org.hl7.fhir.exceptions.FHIRException; + +import org.hl7.fhir.convertors.VersionConvertor_40_50; + + +/* + Copyright (c) 2011+, HL7, Inc. + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of HL7 nor the names of its contributors may be used to + endorse or promote products derived from this software without specific + prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + +*/ + +// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0 + + +public class Slot extends VersionConvertor_40_50 { + + public static org.hl7.fhir.r5.model.Slot convertSlot(org.hl7.fhir.r4.model.Slot src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Slot tgt = new org.hl7.fhir.r5.model.Slot(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getServiceCategory()) + tgt.addServiceCategory(convertCodeableConcept(t)); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getServiceType()) + tgt.addServiceType(convertCodeableConcept(t)); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getSpecialty()) + tgt.addSpecialty(convertCodeableConcept(t)); + if (src.hasAppointmentType()) + tgt.setAppointmentType(convertCodeableConcept(src.getAppointmentType())); + if (src.hasSchedule()) + tgt.setSchedule(convertReference(src.getSchedule())); + if (src.hasStatus()) + tgt.setStatus(convertSlotStatus(src.getStatus())); + if (src.hasStart()) + tgt.setStartElement(convertInstant(src.getStartElement())); + if (src.hasEnd()) + tgt.setEndElement(convertInstant(src.getEndElement())); + if (src.hasOverbooked()) + tgt.setOverbookedElement(convertBoolean(src.getOverbookedElement())); + if (src.hasComment()) + tgt.setCommentElement(convertString(src.getCommentElement())); + return tgt; + } + + public static org.hl7.fhir.r4.model.Slot convertSlot(org.hl7.fhir.r5.model.Slot src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Slot tgt = new org.hl7.fhir.r4.model.Slot(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getServiceCategory()) + tgt.addServiceCategory(convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getServiceType()) + tgt.addServiceType(convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getSpecialty()) + tgt.addSpecialty(convertCodeableConcept(t)); + if (src.hasAppointmentType()) + tgt.setAppointmentType(convertCodeableConcept(src.getAppointmentType())); + if (src.hasSchedule()) + tgt.setSchedule(convertReference(src.getSchedule())); + if (src.hasStatus()) + tgt.setStatus(convertSlotStatus(src.getStatus())); + if (src.hasStart()) + tgt.setStartElement(convertInstant(src.getStartElement())); + if (src.hasEnd()) + tgt.setEndElement(convertInstant(src.getEndElement())); + if (src.hasOverbooked()) + tgt.setOverbookedElement(convertBoolean(src.getOverbookedElement())); + if (src.hasComment()) + tgt.setCommentElement(convertString(src.getCommentElement())); + return tgt; + } + + public static org.hl7.fhir.r5.model.Slot.SlotStatus convertSlotStatus(org.hl7.fhir.r4.model.Slot.SlotStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case BUSY: return org.hl7.fhir.r5.model.Slot.SlotStatus.BUSY; + case FREE: return org.hl7.fhir.r5.model.Slot.SlotStatus.FREE; + case BUSYUNAVAILABLE: return org.hl7.fhir.r5.model.Slot.SlotStatus.BUSYUNAVAILABLE; + case BUSYTENTATIVE: return org.hl7.fhir.r5.model.Slot.SlotStatus.BUSYTENTATIVE; + case ENTEREDINERROR: return org.hl7.fhir.r5.model.Slot.SlotStatus.ENTEREDINERROR; + default: return org.hl7.fhir.r5.model.Slot.SlotStatus.NULL; + } +} + + public static org.hl7.fhir.r4.model.Slot.SlotStatus convertSlotStatus(org.hl7.fhir.r5.model.Slot.SlotStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case BUSY: return org.hl7.fhir.r4.model.Slot.SlotStatus.BUSY; + case FREE: return org.hl7.fhir.r4.model.Slot.SlotStatus.FREE; + case BUSYUNAVAILABLE: return org.hl7.fhir.r4.model.Slot.SlotStatus.BUSYUNAVAILABLE; + case BUSYTENTATIVE: return org.hl7.fhir.r4.model.Slot.SlotStatus.BUSYTENTATIVE; + case ENTEREDINERROR: return org.hl7.fhir.r4.model.Slot.SlotStatus.ENTEREDINERROR; + default: return org.hl7.fhir.r4.model.Slot.SlotStatus.NULL; + } +} + + +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Specimen.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Specimen.java new file mode 100644 index 000000000..ddd3d0298 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Specimen.java @@ -0,0 +1,251 @@ +package org.hl7.fhir.convertors.conv40_50; + +import org.hl7.fhir.exceptions.FHIRException; + +import org.hl7.fhir.convertors.VersionConvertor_40_50; + + +/* + Copyright (c) 2011+, HL7, Inc. + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of HL7 nor the names of its contributors may be used to + endorse or promote products derived from this software without specific + prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + +*/ + +// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0 + + +public class Specimen extends VersionConvertor_40_50 { + + public static org.hl7.fhir.r5.model.Specimen convertSpecimen(org.hl7.fhir.r4.model.Specimen src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Specimen tgt = new org.hl7.fhir.r5.model.Specimen(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasAccessionIdentifier()) + tgt.setAccessionIdentifier(convertIdentifier(src.getAccessionIdentifier())); + if (src.hasStatus()) + tgt.setStatus(convertSpecimenStatus(src.getStatus())); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + if (src.hasSubject()) + tgt.setSubject(convertReference(src.getSubject())); + if (src.hasReceivedTime()) + tgt.setReceivedTimeElement(convertDateTime(src.getReceivedTimeElement())); + for (org.hl7.fhir.r4.model.Reference t : src.getParent()) + tgt.addParent(convertReference(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getRequest()) + tgt.addRequest(convertReference(t)); + if (src.hasCollection()) + tgt.setCollection(convertSpecimenCollectionComponent(src.getCollection())); + for (org.hl7.fhir.r4.model.Specimen.SpecimenProcessingComponent t : src.getProcessing()) + tgt.addProcessing(convertSpecimenProcessingComponent(t)); + for (org.hl7.fhir.r4.model.Specimen.SpecimenContainerComponent t : src.getContainer()) + tgt.addContainer(convertSpecimenContainerComponent(t)); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getCondition()) + tgt.addCondition(convertCodeableConcept(t)); + for (org.hl7.fhir.r4.model.Annotation t : src.getNote()) + tgt.addNote(convertAnnotation(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.Specimen convertSpecimen(org.hl7.fhir.r5.model.Specimen src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Specimen tgt = new org.hl7.fhir.r4.model.Specimen(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasAccessionIdentifier()) + tgt.setAccessionIdentifier(convertIdentifier(src.getAccessionIdentifier())); + if (src.hasStatus()) + tgt.setStatus(convertSpecimenStatus(src.getStatus())); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + if (src.hasSubject()) + tgt.setSubject(convertReference(src.getSubject())); + if (src.hasReceivedTime()) + tgt.setReceivedTimeElement(convertDateTime(src.getReceivedTimeElement())); + for (org.hl7.fhir.r5.model.Reference t : src.getParent()) + tgt.addParent(convertReference(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getRequest()) + tgt.addRequest(convertReference(t)); + if (src.hasCollection()) + tgt.setCollection(convertSpecimenCollectionComponent(src.getCollection())); + for (org.hl7.fhir.r5.model.Specimen.SpecimenProcessingComponent t : src.getProcessing()) + tgt.addProcessing(convertSpecimenProcessingComponent(t)); + for (org.hl7.fhir.r5.model.Specimen.SpecimenContainerComponent t : src.getContainer()) + tgt.addContainer(convertSpecimenContainerComponent(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getCondition()) + tgt.addCondition(convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.Annotation t : src.getNote()) + tgt.addNote(convertAnnotation(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.Specimen.SpecimenStatus convertSpecimenStatus(org.hl7.fhir.r4.model.Specimen.SpecimenStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case AVAILABLE: return org.hl7.fhir.r5.model.Specimen.SpecimenStatus.AVAILABLE; + case UNAVAILABLE: return org.hl7.fhir.r5.model.Specimen.SpecimenStatus.UNAVAILABLE; + case UNSATISFACTORY: return org.hl7.fhir.r5.model.Specimen.SpecimenStatus.UNSATISFACTORY; + case ENTEREDINERROR: return org.hl7.fhir.r5.model.Specimen.SpecimenStatus.ENTEREDINERROR; + default: return org.hl7.fhir.r5.model.Specimen.SpecimenStatus.NULL; + } +} + + public static org.hl7.fhir.r4.model.Specimen.SpecimenStatus convertSpecimenStatus(org.hl7.fhir.r5.model.Specimen.SpecimenStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case AVAILABLE: return org.hl7.fhir.r4.model.Specimen.SpecimenStatus.AVAILABLE; + case UNAVAILABLE: return org.hl7.fhir.r4.model.Specimen.SpecimenStatus.UNAVAILABLE; + case UNSATISFACTORY: return org.hl7.fhir.r4.model.Specimen.SpecimenStatus.UNSATISFACTORY; + case ENTEREDINERROR: return org.hl7.fhir.r4.model.Specimen.SpecimenStatus.ENTEREDINERROR; + default: return org.hl7.fhir.r4.model.Specimen.SpecimenStatus.NULL; + } +} + + public static org.hl7.fhir.r5.model.Specimen.SpecimenCollectionComponent convertSpecimenCollectionComponent(org.hl7.fhir.r4.model.Specimen.SpecimenCollectionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Specimen.SpecimenCollectionComponent tgt = new org.hl7.fhir.r5.model.Specimen.SpecimenCollectionComponent(); + copyElement(src, tgt); + if (src.hasCollector()) + tgt.setCollector(convertReference(src.getCollector())); + if (src.hasCollected()) + tgt.setCollected(convertType(src.getCollected())); + if (src.hasDuration()) + tgt.setDuration(convertDuration(src.getDuration())); + if (src.hasQuantity()) + tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); + if (src.hasMethod()) + tgt.setMethod(convertCodeableConcept(src.getMethod())); + if (src.hasBodySite()) + tgt.setBodySite(convertCodeableConcept(src.getBodySite())); + if (src.hasFastingStatus()) + tgt.setFastingStatus(convertType(src.getFastingStatus())); + return tgt; + } + + public static org.hl7.fhir.r4.model.Specimen.SpecimenCollectionComponent convertSpecimenCollectionComponent(org.hl7.fhir.r5.model.Specimen.SpecimenCollectionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Specimen.SpecimenCollectionComponent tgt = new org.hl7.fhir.r4.model.Specimen.SpecimenCollectionComponent(); + copyElement(src, tgt); + if (src.hasCollector()) + tgt.setCollector(convertReference(src.getCollector())); + if (src.hasCollected()) + tgt.setCollected(convertType(src.getCollected())); + if (src.hasDuration()) + tgt.setDuration(convertDuration(src.getDuration())); + if (src.hasQuantity()) + tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); + if (src.hasMethod()) + tgt.setMethod(convertCodeableConcept(src.getMethod())); + if (src.hasBodySite()) + tgt.setBodySite(convertCodeableConcept(src.getBodySite())); + if (src.hasFastingStatus()) + tgt.setFastingStatus(convertType(src.getFastingStatus())); + return tgt; + } + + public static org.hl7.fhir.r5.model.Specimen.SpecimenProcessingComponent convertSpecimenProcessingComponent(org.hl7.fhir.r4.model.Specimen.SpecimenProcessingComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Specimen.SpecimenProcessingComponent tgt = new org.hl7.fhir.r5.model.Specimen.SpecimenProcessingComponent(); + copyElement(src, tgt); + if (src.hasDescription()) + tgt.setDescriptionElement(convertString(src.getDescriptionElement())); + if (src.hasProcedure()) + tgt.setProcedure(convertCodeableConcept(src.getProcedure())); + for (org.hl7.fhir.r4.model.Reference t : src.getAdditive()) + tgt.addAdditive(convertReference(t)); + if (src.hasTime()) + tgt.setTime(convertType(src.getTime())); + return tgt; + } + + public static org.hl7.fhir.r4.model.Specimen.SpecimenProcessingComponent convertSpecimenProcessingComponent(org.hl7.fhir.r5.model.Specimen.SpecimenProcessingComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Specimen.SpecimenProcessingComponent tgt = new org.hl7.fhir.r4.model.Specimen.SpecimenProcessingComponent(); + copyElement(src, tgt); + if (src.hasDescription()) + tgt.setDescriptionElement(convertString(src.getDescriptionElement())); + if (src.hasProcedure()) + tgt.setProcedure(convertCodeableConcept(src.getProcedure())); + for (org.hl7.fhir.r5.model.Reference t : src.getAdditive()) + tgt.addAdditive(convertReference(t)); + if (src.hasTime()) + tgt.setTime(convertType(src.getTime())); + return tgt; + } + + public static org.hl7.fhir.r5.model.Specimen.SpecimenContainerComponent convertSpecimenContainerComponent(org.hl7.fhir.r4.model.Specimen.SpecimenContainerComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Specimen.SpecimenContainerComponent tgt = new org.hl7.fhir.r5.model.Specimen.SpecimenContainerComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasDescription()) + tgt.setDescriptionElement(convertString(src.getDescriptionElement())); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + if (src.hasCapacity()) + tgt.setCapacity(convertSimpleQuantity(src.getCapacity())); + if (src.hasSpecimenQuantity()) + tgt.setSpecimenQuantity(convertSimpleQuantity(src.getSpecimenQuantity())); + if (src.hasAdditive()) + tgt.setAdditive(convertType(src.getAdditive())); + return tgt; + } + + public static org.hl7.fhir.r4.model.Specimen.SpecimenContainerComponent convertSpecimenContainerComponent(org.hl7.fhir.r5.model.Specimen.SpecimenContainerComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Specimen.SpecimenContainerComponent tgt = new org.hl7.fhir.r4.model.Specimen.SpecimenContainerComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasDescription()) + tgt.setDescriptionElement(convertString(src.getDescriptionElement())); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + if (src.hasCapacity()) + tgt.setCapacity(convertSimpleQuantity(src.getCapacity())); + if (src.hasSpecimenQuantity()) + tgt.setSpecimenQuantity(convertSimpleQuantity(src.getSpecimenQuantity())); + if (src.hasAdditive()) + tgt.setAdditive(convertType(src.getAdditive())); + return tgt; + } + + +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/SpecimenDefinition.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/SpecimenDefinition.java new file mode 100644 index 000000000..32f71622a --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/SpecimenDefinition.java @@ -0,0 +1,251 @@ +package org.hl7.fhir.convertors.conv40_50; + +import org.hl7.fhir.exceptions.FHIRException; + +import org.hl7.fhir.convertors.VersionConvertor_40_50; + + +/* + Copyright (c) 2011+, HL7, Inc. + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of HL7 nor the names of its contributors may be used to + endorse or promote products derived from this software without specific + prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + +*/ + +// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0 + + +public class SpecimenDefinition extends VersionConvertor_40_50 { + + public static org.hl7.fhir.r5.model.SpecimenDefinition convertSpecimenDefinition(org.hl7.fhir.r4.model.SpecimenDefinition src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.SpecimenDefinition tgt = new org.hl7.fhir.r5.model.SpecimenDefinition(); + copyDomainResource(src, tgt); + if (src.hasIdentifier()) + tgt.setIdentifier(convertIdentifier(src.getIdentifier())); + if (src.hasTypeCollected()) + tgt.setTypeCollected(convertCodeableConcept(src.getTypeCollected())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getPatientPreparation()) + tgt.addPatientPreparation(convertCodeableConcept(t)); + if (src.hasTimeAspect()) + tgt.setTimeAspectElement(convertString(src.getTimeAspectElement())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getCollection()) + tgt.addCollection(convertCodeableConcept(t)); + for (org.hl7.fhir.r4.model.SpecimenDefinition.SpecimenDefinitionTypeTestedComponent t : src.getTypeTested()) + tgt.addTypeTested(convertSpecimenDefinitionTypeTestedComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.SpecimenDefinition convertSpecimenDefinition(org.hl7.fhir.r5.model.SpecimenDefinition src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.SpecimenDefinition tgt = new org.hl7.fhir.r4.model.SpecimenDefinition(); + copyDomainResource(src, tgt); + if (src.hasIdentifier()) + tgt.setIdentifier(convertIdentifier(src.getIdentifier())); + if (src.hasTypeCollected()) + tgt.setTypeCollected(convertCodeableConcept(src.getTypeCollected())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getPatientPreparation()) + tgt.addPatientPreparation(convertCodeableConcept(t)); + if (src.hasTimeAspect()) + tgt.setTimeAspectElement(convertString(src.getTimeAspectElement())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getCollection()) + tgt.addCollection(convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.SpecimenDefinition.SpecimenDefinitionTypeTestedComponent t : src.getTypeTested()) + tgt.addTypeTested(convertSpecimenDefinitionTypeTestedComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.SpecimenDefinition.SpecimenDefinitionTypeTestedComponent convertSpecimenDefinitionTypeTestedComponent(org.hl7.fhir.r4.model.SpecimenDefinition.SpecimenDefinitionTypeTestedComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.SpecimenDefinition.SpecimenDefinitionTypeTestedComponent tgt = new org.hl7.fhir.r5.model.SpecimenDefinition.SpecimenDefinitionTypeTestedComponent(); + copyElement(src, tgt); + if (src.hasIsDerived()) + tgt.setIsDerivedElement(convertBoolean(src.getIsDerivedElement())); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + if (src.hasPreference()) + tgt.setPreference(convertSpecimenContainedPreference(src.getPreference())); + if (src.hasContainer()) + tgt.setContainer(convertSpecimenDefinitionTypeTestedContainerComponent(src.getContainer())); + if (src.hasRequirement()) + tgt.setRequirementElement(convertString(src.getRequirementElement())); + if (src.hasRetentionTime()) + tgt.setRetentionTime(convertDuration(src.getRetentionTime())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getRejectionCriterion()) + tgt.addRejectionCriterion(convertCodeableConcept(t)); + for (org.hl7.fhir.r4.model.SpecimenDefinition.SpecimenDefinitionTypeTestedHandlingComponent t : src.getHandling()) + tgt.addHandling(convertSpecimenDefinitionTypeTestedHandlingComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.SpecimenDefinition.SpecimenDefinitionTypeTestedComponent convertSpecimenDefinitionTypeTestedComponent(org.hl7.fhir.r5.model.SpecimenDefinition.SpecimenDefinitionTypeTestedComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.SpecimenDefinition.SpecimenDefinitionTypeTestedComponent tgt = new org.hl7.fhir.r4.model.SpecimenDefinition.SpecimenDefinitionTypeTestedComponent(); + copyElement(src, tgt); + if (src.hasIsDerived()) + tgt.setIsDerivedElement(convertBoolean(src.getIsDerivedElement())); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + if (src.hasPreference()) + tgt.setPreference(convertSpecimenContainedPreference(src.getPreference())); + if (src.hasContainer()) + tgt.setContainer(convertSpecimenDefinitionTypeTestedContainerComponent(src.getContainer())); + if (src.hasRequirement()) + tgt.setRequirementElement(convertString(src.getRequirementElement())); + if (src.hasRetentionTime()) + tgt.setRetentionTime(convertDuration(src.getRetentionTime())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getRejectionCriterion()) + tgt.addRejectionCriterion(convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.SpecimenDefinition.SpecimenDefinitionTypeTestedHandlingComponent t : src.getHandling()) + tgt.addHandling(convertSpecimenDefinitionTypeTestedHandlingComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.SpecimenDefinition.SpecimenContainedPreference convertSpecimenContainedPreference(org.hl7.fhir.r4.model.SpecimenDefinition.SpecimenContainedPreference src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PREFERRED: return org.hl7.fhir.r5.model.SpecimenDefinition.SpecimenContainedPreference.PREFERRED; + case ALTERNATE: return org.hl7.fhir.r5.model.SpecimenDefinition.SpecimenContainedPreference.ALTERNATE; + default: return org.hl7.fhir.r5.model.SpecimenDefinition.SpecimenContainedPreference.NULL; + } +} + + public static org.hl7.fhir.r4.model.SpecimenDefinition.SpecimenContainedPreference convertSpecimenContainedPreference(org.hl7.fhir.r5.model.SpecimenDefinition.SpecimenContainedPreference src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PREFERRED: return org.hl7.fhir.r4.model.SpecimenDefinition.SpecimenContainedPreference.PREFERRED; + case ALTERNATE: return org.hl7.fhir.r4.model.SpecimenDefinition.SpecimenContainedPreference.ALTERNATE; + default: return org.hl7.fhir.r4.model.SpecimenDefinition.SpecimenContainedPreference.NULL; + } +} + + public static org.hl7.fhir.r5.model.SpecimenDefinition.SpecimenDefinitionTypeTestedContainerComponent convertSpecimenDefinitionTypeTestedContainerComponent(org.hl7.fhir.r4.model.SpecimenDefinition.SpecimenDefinitionTypeTestedContainerComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.SpecimenDefinition.SpecimenDefinitionTypeTestedContainerComponent tgt = new org.hl7.fhir.r5.model.SpecimenDefinition.SpecimenDefinitionTypeTestedContainerComponent(); + copyElement(src, tgt); + if (src.hasMaterial()) + tgt.setMaterial(convertCodeableConcept(src.getMaterial())); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + if (src.hasCap()) + tgt.setCap(convertCodeableConcept(src.getCap())); + if (src.hasDescription()) + tgt.setDescriptionElement(convertString(src.getDescriptionElement())); + if (src.hasCapacity()) + tgt.setCapacity(convertSimpleQuantity(src.getCapacity())); + if (src.hasMinimumVolume()) + tgt.setMinimumVolume(convertType(src.getMinimumVolume())); + for (org.hl7.fhir.r4.model.SpecimenDefinition.SpecimenDefinitionTypeTestedContainerAdditiveComponent t : src.getAdditive()) + tgt.addAdditive(convertSpecimenDefinitionTypeTestedContainerAdditiveComponent(t)); + if (src.hasPreparation()) + tgt.setPreparationElement(convertString(src.getPreparationElement())); + return tgt; + } + + public static org.hl7.fhir.r4.model.SpecimenDefinition.SpecimenDefinitionTypeTestedContainerComponent convertSpecimenDefinitionTypeTestedContainerComponent(org.hl7.fhir.r5.model.SpecimenDefinition.SpecimenDefinitionTypeTestedContainerComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.SpecimenDefinition.SpecimenDefinitionTypeTestedContainerComponent tgt = new org.hl7.fhir.r4.model.SpecimenDefinition.SpecimenDefinitionTypeTestedContainerComponent(); + copyElement(src, tgt); + if (src.hasMaterial()) + tgt.setMaterial(convertCodeableConcept(src.getMaterial())); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + if (src.hasCap()) + tgt.setCap(convertCodeableConcept(src.getCap())); + if (src.hasDescription()) + tgt.setDescriptionElement(convertString(src.getDescriptionElement())); + if (src.hasCapacity()) + tgt.setCapacity(convertSimpleQuantity(src.getCapacity())); + if (src.hasMinimumVolume()) + tgt.setMinimumVolume(convertType(src.getMinimumVolume())); + for (org.hl7.fhir.r5.model.SpecimenDefinition.SpecimenDefinitionTypeTestedContainerAdditiveComponent t : src.getAdditive()) + tgt.addAdditive(convertSpecimenDefinitionTypeTestedContainerAdditiveComponent(t)); + if (src.hasPreparation()) + tgt.setPreparationElement(convertString(src.getPreparationElement())); + return tgt; + } + + public static org.hl7.fhir.r5.model.SpecimenDefinition.SpecimenDefinitionTypeTestedContainerAdditiveComponent convertSpecimenDefinitionTypeTestedContainerAdditiveComponent(org.hl7.fhir.r4.model.SpecimenDefinition.SpecimenDefinitionTypeTestedContainerAdditiveComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.SpecimenDefinition.SpecimenDefinitionTypeTestedContainerAdditiveComponent tgt = new org.hl7.fhir.r5.model.SpecimenDefinition.SpecimenDefinitionTypeTestedContainerAdditiveComponent(); + copyElement(src, tgt); + if (src.hasAdditive()) + tgt.setAdditive(convertType(src.getAdditive())); + return tgt; + } + + public static org.hl7.fhir.r4.model.SpecimenDefinition.SpecimenDefinitionTypeTestedContainerAdditiveComponent convertSpecimenDefinitionTypeTestedContainerAdditiveComponent(org.hl7.fhir.r5.model.SpecimenDefinition.SpecimenDefinitionTypeTestedContainerAdditiveComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.SpecimenDefinition.SpecimenDefinitionTypeTestedContainerAdditiveComponent tgt = new org.hl7.fhir.r4.model.SpecimenDefinition.SpecimenDefinitionTypeTestedContainerAdditiveComponent(); + copyElement(src, tgt); + if (src.hasAdditive()) + tgt.setAdditive(convertType(src.getAdditive())); + return tgt; + } + + public static org.hl7.fhir.r5.model.SpecimenDefinition.SpecimenDefinitionTypeTestedHandlingComponent convertSpecimenDefinitionTypeTestedHandlingComponent(org.hl7.fhir.r4.model.SpecimenDefinition.SpecimenDefinitionTypeTestedHandlingComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.SpecimenDefinition.SpecimenDefinitionTypeTestedHandlingComponent tgt = new org.hl7.fhir.r5.model.SpecimenDefinition.SpecimenDefinitionTypeTestedHandlingComponent(); + copyElement(src, tgt); + if (src.hasTemperatureQualifier()) + tgt.setTemperatureQualifier(convertCodeableConcept(src.getTemperatureQualifier())); + if (src.hasTemperatureRange()) + tgt.setTemperatureRange(convertRange(src.getTemperatureRange())); + if (src.hasMaxDuration()) + tgt.setMaxDuration(convertDuration(src.getMaxDuration())); + if (src.hasInstruction()) + tgt.setInstructionElement(convertString(src.getInstructionElement())); + return tgt; + } + + public static org.hl7.fhir.r4.model.SpecimenDefinition.SpecimenDefinitionTypeTestedHandlingComponent convertSpecimenDefinitionTypeTestedHandlingComponent(org.hl7.fhir.r5.model.SpecimenDefinition.SpecimenDefinitionTypeTestedHandlingComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.SpecimenDefinition.SpecimenDefinitionTypeTestedHandlingComponent tgt = new org.hl7.fhir.r4.model.SpecimenDefinition.SpecimenDefinitionTypeTestedHandlingComponent(); + copyElement(src, tgt); + if (src.hasTemperatureQualifier()) + tgt.setTemperatureQualifier(convertCodeableConcept(src.getTemperatureQualifier())); + if (src.hasTemperatureRange()) + tgt.setTemperatureRange(convertRange(src.getTemperatureRange())); + if (src.hasMaxDuration()) + tgt.setMaxDuration(convertDuration(src.getMaxDuration())); + if (src.hasInstruction()) + tgt.setInstructionElement(convertString(src.getInstructionElement())); + return tgt; + } + + +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/StructureDefinition.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/StructureDefinition.java new file mode 100644 index 000000000..f497b05cf --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/StructureDefinition.java @@ -0,0 +1,329 @@ +package org.hl7.fhir.convertors.conv40_50; + +import org.hl7.fhir.exceptions.FHIRException; + +import org.hl7.fhir.convertors.VersionConvertor_40_50; + + +/* + Copyright (c) 2011+, HL7, Inc. + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of HL7 nor the names of its contributors may be used to + endorse or promote products derived from this software without specific + prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + +*/ + +// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0 + + +public class StructureDefinition extends VersionConvertor_40_50 { + + public static org.hl7.fhir.r5.model.StructureDefinition convertStructureDefinition(org.hl7.fhir.r4.model.StructureDefinition src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.StructureDefinition tgt = new org.hl7.fhir.r5.model.StructureDefinition(); + copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrlElement(convertUri(src.getUrlElement())); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasVersion()) + tgt.setVersionElement(convertString(src.getVersionElement())); + if (src.hasName()) + tgt.setNameElement(convertString(src.getNameElement())); + if (src.hasTitle()) + tgt.setTitleElement(convertString(src.getTitleElement())); + if (src.hasStatus()) + tgt.setStatus(Enumerations.convertPublicationStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimentalElement(convertBoolean(src.getExperimentalElement())); + if (src.hasDate()) + tgt.setDateElement(convertDateTime(src.getDateElement())); + if (src.hasPublisher()) + tgt.setPublisherElement(convertString(src.getPublisherElement())); + for (org.hl7.fhir.r4.model.ContactDetail t : src.getContact()) + tgt.addContact(convertContactDetail(t)); + if (src.hasDescription()) + tgt.setDescriptionElement(convertMarkdown(src.getDescriptionElement())); + for (org.hl7.fhir.r4.model.UsageContext t : src.getUseContext()) + tgt.addUseContext(convertUsageContext(t)); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getJurisdiction()) + tgt.addJurisdiction(convertCodeableConcept(t)); + if (src.hasPurpose()) + tgt.setPurposeElement(convertMarkdown(src.getPurposeElement())); + if (src.hasCopyright()) + tgt.setCopyrightElement(convertMarkdown(src.getCopyrightElement())); + for (org.hl7.fhir.r4.model.Coding t : src.getKeyword()) + tgt.addKeyword(convertCoding(t)); + if (src.hasFhirVersion()) + tgt.setFhirVersion(Enumerations.convertFHIRVersion(src.getFhirVersion())); + for (org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionMappingComponent t : src.getMapping()) + tgt.addMapping(convertStructureDefinitionMappingComponent(t)); + if (src.hasKind()) + tgt.setKind(convertStructureDefinitionKind(src.getKind())); + if (src.hasAbstract()) + tgt.setAbstractElement(convertBoolean(src.getAbstractElement())); + for (org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionContextComponent t : src.getContext()) + tgt.addContext(convertStructureDefinitionContextComponent(t)); + for (org.hl7.fhir.r4.model.StringType t : src.getContextInvariant()) + tgt.getContextInvariant().add(convertString(t)); + if (src.hasType()) + tgt.setTypeElement(convertUri(src.getTypeElement())); + if (src.hasBaseDefinition()) + tgt.setBaseDefinitionElement(convertCanonical(src.getBaseDefinitionElement())); + if (src.hasDerivation()) + tgt.setDerivation(convertTypeDerivationRule(src.getDerivation())); + if (src.hasSnapshot()) + tgt.setSnapshot(convertStructureDefinitionSnapshotComponent(src.getSnapshot())); + if (src.hasDifferential()) + tgt.setDifferential(convertStructureDefinitionDifferentialComponent(src.getDifferential())); + return tgt; + } + + public static org.hl7.fhir.r4.model.StructureDefinition convertStructureDefinition(org.hl7.fhir.r5.model.StructureDefinition src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.StructureDefinition tgt = new org.hl7.fhir.r4.model.StructureDefinition(); + copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrlElement(convertUri(src.getUrlElement())); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasVersion()) + tgt.setVersionElement(convertString(src.getVersionElement())); + if (src.hasName()) + tgt.setNameElement(convertString(src.getNameElement())); + if (src.hasTitle()) + tgt.setTitleElement(convertString(src.getTitleElement())); + if (src.hasStatus()) + tgt.setStatus(Enumerations.convertPublicationStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimentalElement(convertBoolean(src.getExperimentalElement())); + if (src.hasDate()) + tgt.setDateElement(convertDateTime(src.getDateElement())); + if (src.hasPublisher()) + tgt.setPublisherElement(convertString(src.getPublisherElement())); + for (org.hl7.fhir.r5.model.ContactDetail t : src.getContact()) + tgt.addContact(convertContactDetail(t)); + if (src.hasDescription()) + tgt.setDescriptionElement(convertMarkdown(src.getDescriptionElement())); + for (org.hl7.fhir.r5.model.UsageContext t : src.getUseContext()) + tgt.addUseContext(convertUsageContext(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getJurisdiction()) + tgt.addJurisdiction(convertCodeableConcept(t)); + if (src.hasPurpose()) + tgt.setPurposeElement(convertMarkdown(src.getPurposeElement())); + if (src.hasCopyright()) + tgt.setCopyrightElement(convertMarkdown(src.getCopyrightElement())); + for (org.hl7.fhir.r5.model.Coding t : src.getKeyword()) + tgt.addKeyword(convertCoding(t)); + if (src.hasFhirVersion()) + tgt.setFhirVersion(Enumerations.convertFHIRVersion(src.getFhirVersion())); + for (org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionMappingComponent t : src.getMapping()) + tgt.addMapping(convertStructureDefinitionMappingComponent(t)); + if (src.hasKind()) + tgt.setKind(convertStructureDefinitionKind(src.getKind())); + if (src.hasAbstract()) + tgt.setAbstractElement(convertBoolean(src.getAbstractElement())); + for (org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionContextComponent t : src.getContext()) + tgt.addContext(convertStructureDefinitionContextComponent(t)); + for (org.hl7.fhir.r5.model.StringType t : src.getContextInvariant()) + tgt.getContextInvariant().add(convertString(t)); + if (src.hasType()) + tgt.setTypeElement(convertUri(src.getTypeElement())); + if (src.hasBaseDefinition()) + tgt.setBaseDefinitionElement(convertCanonical(src.getBaseDefinitionElement())); + if (src.hasDerivation()) + tgt.setDerivation(convertTypeDerivationRule(src.getDerivation())); + if (src.hasSnapshot()) + tgt.setSnapshot(convertStructureDefinitionSnapshotComponent(src.getSnapshot())); + if (src.hasDifferential()) + tgt.setDifferential(convertStructureDefinitionDifferentialComponent(src.getDifferential())); + return tgt; + } + + public static org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionKind convertStructureDefinitionKind(org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionKind src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PRIMITIVETYPE: return org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionKind.PRIMITIVETYPE; + case COMPLEXTYPE: return org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionKind.COMPLEXTYPE; + case RESOURCE: return org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionKind.RESOURCE; + case LOGICAL: return org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionKind.LOGICAL; + default: return org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionKind.NULL; + } +} + + public static org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionKind convertStructureDefinitionKind(org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionKind src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PRIMITIVETYPE: return org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionKind.PRIMITIVETYPE; + case COMPLEXTYPE: return org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionKind.COMPLEXTYPE; + case RESOURCE: return org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionKind.RESOURCE; + case LOGICAL: return org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionKind.LOGICAL; + default: return org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionKind.NULL; + } +} + + public static org.hl7.fhir.r5.model.StructureDefinition.TypeDerivationRule convertTypeDerivationRule(org.hl7.fhir.r4.model.StructureDefinition.TypeDerivationRule src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case SPECIALIZATION: return org.hl7.fhir.r5.model.StructureDefinition.TypeDerivationRule.SPECIALIZATION; + case CONSTRAINT: return org.hl7.fhir.r5.model.StructureDefinition.TypeDerivationRule.CONSTRAINT; + default: return org.hl7.fhir.r5.model.StructureDefinition.TypeDerivationRule.NULL; + } +} + + public static org.hl7.fhir.r4.model.StructureDefinition.TypeDerivationRule convertTypeDerivationRule(org.hl7.fhir.r5.model.StructureDefinition.TypeDerivationRule src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case SPECIALIZATION: return org.hl7.fhir.r4.model.StructureDefinition.TypeDerivationRule.SPECIALIZATION; + case CONSTRAINT: return org.hl7.fhir.r4.model.StructureDefinition.TypeDerivationRule.CONSTRAINT; + default: return org.hl7.fhir.r4.model.StructureDefinition.TypeDerivationRule.NULL; + } +} + + public static org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionMappingComponent convertStructureDefinitionMappingComponent(org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionMappingComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionMappingComponent tgt = new org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionMappingComponent(); + copyElement(src, tgt); + if (src.hasIdentity()) + tgt.setIdentityElement(convertId(src.getIdentityElement())); + if (src.hasUri()) + tgt.setUriElement(convertUri(src.getUriElement())); + if (src.hasName()) + tgt.setNameElement(convertString(src.getNameElement())); + if (src.hasComment()) + tgt.setCommentElement(convertString(src.getCommentElement())); + return tgt; + } + + public static org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionMappingComponent convertStructureDefinitionMappingComponent(org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionMappingComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionMappingComponent tgt = new org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionMappingComponent(); + copyElement(src, tgt); + if (src.hasIdentity()) + tgt.setIdentityElement(convertId(src.getIdentityElement())); + if (src.hasUri()) + tgt.setUriElement(convertUri(src.getUriElement())); + if (src.hasName()) + tgt.setNameElement(convertString(src.getNameElement())); + if (src.hasComment()) + tgt.setCommentElement(convertString(src.getCommentElement())); + return tgt; + } + + public static org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionContextComponent convertStructureDefinitionContextComponent(org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionContextComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionContextComponent tgt = new org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionContextComponent(); + copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertExtensionContextType(src.getType())); + if (src.hasExpression()) + tgt.setExpressionElement(convertString(src.getExpressionElement())); + return tgt; + } + + public static org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionContextComponent convertStructureDefinitionContextComponent(org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionContextComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionContextComponent tgt = new org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionContextComponent(); + copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertExtensionContextType(src.getType())); + if (src.hasExpression()) + tgt.setExpressionElement(convertString(src.getExpressionElement())); + return tgt; + } + + public static org.hl7.fhir.r5.model.StructureDefinition.ExtensionContextType convertExtensionContextType(org.hl7.fhir.r4.model.StructureDefinition.ExtensionContextType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case FHIRPATH: return org.hl7.fhir.r5.model.StructureDefinition.ExtensionContextType.FHIRPATH; + case ELEMENT: return org.hl7.fhir.r5.model.StructureDefinition.ExtensionContextType.ELEMENT; + case EXTENSION: return org.hl7.fhir.r5.model.StructureDefinition.ExtensionContextType.EXTENSION; + default: return org.hl7.fhir.r5.model.StructureDefinition.ExtensionContextType.NULL; + } +} + + public static org.hl7.fhir.r4.model.StructureDefinition.ExtensionContextType convertExtensionContextType(org.hl7.fhir.r5.model.StructureDefinition.ExtensionContextType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case FHIRPATH: return org.hl7.fhir.r4.model.StructureDefinition.ExtensionContextType.FHIRPATH; + case ELEMENT: return org.hl7.fhir.r4.model.StructureDefinition.ExtensionContextType.ELEMENT; + case EXTENSION: return org.hl7.fhir.r4.model.StructureDefinition.ExtensionContextType.EXTENSION; + default: return org.hl7.fhir.r4.model.StructureDefinition.ExtensionContextType.NULL; + } +} + + public static org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionSnapshotComponent convertStructureDefinitionSnapshotComponent(org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionSnapshotComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionSnapshotComponent tgt = new org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionSnapshotComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.r4.model.ElementDefinition t : src.getElement()) + tgt.addElement(convertElementDefinition(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionSnapshotComponent convertStructureDefinitionSnapshotComponent(org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionSnapshotComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionSnapshotComponent tgt = new org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionSnapshotComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.r5.model.ElementDefinition t : src.getElement()) + tgt.addElement(convertElementDefinition(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionDifferentialComponent convertStructureDefinitionDifferentialComponent(org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionDifferentialComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionDifferentialComponent tgt = new org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionDifferentialComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.r4.model.ElementDefinition t : src.getElement()) + tgt.addElement(convertElementDefinition(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionDifferentialComponent convertStructureDefinitionDifferentialComponent(org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionDifferentialComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionDifferentialComponent tgt = new org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionDifferentialComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.r5.model.ElementDefinition t : src.getElement()) + tgt.addElement(convertElementDefinition(t)); + return tgt; + } + + +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/StructureMap.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/StructureMap.java new file mode 100644 index 000000000..1ce9c14d3 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/StructureMap.java @@ -0,0 +1,613 @@ +package org.hl7.fhir.convertors.conv40_50; + +import org.hl7.fhir.exceptions.FHIRException; + +import org.hl7.fhir.convertors.VersionConvertor_40_50; + + +/* + Copyright (c) 2011+, HL7, Inc. + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of HL7 nor the names of its contributors may be used to + endorse or promote products derived from this software without specific + prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + +*/ + +// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0 + + +public class StructureMap extends VersionConvertor_40_50 { + + public static org.hl7.fhir.r5.model.StructureMap convertStructureMap(org.hl7.fhir.r4.model.StructureMap src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.StructureMap tgt = new org.hl7.fhir.r5.model.StructureMap(); + copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrlElement(convertUri(src.getUrlElement())); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasVersion()) + tgt.setVersionElement(convertString(src.getVersionElement())); + if (src.hasName()) + tgt.setNameElement(convertString(src.getNameElement())); + if (src.hasTitle()) + tgt.setTitleElement(convertString(src.getTitleElement())); + if (src.hasStatus()) + tgt.setStatus(Enumerations.convertPublicationStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimentalElement(convertBoolean(src.getExperimentalElement())); + if (src.hasDate()) + tgt.setDateElement(convertDateTime(src.getDateElement())); + if (src.hasPublisher()) + tgt.setPublisherElement(convertString(src.getPublisherElement())); + for (org.hl7.fhir.r4.model.ContactDetail t : src.getContact()) + tgt.addContact(convertContactDetail(t)); + if (src.hasDescription()) + tgt.setDescriptionElement(convertMarkdown(src.getDescriptionElement())); + for (org.hl7.fhir.r4.model.UsageContext t : src.getUseContext()) + tgt.addUseContext(convertUsageContext(t)); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getJurisdiction()) + tgt.addJurisdiction(convertCodeableConcept(t)); + if (src.hasPurpose()) + tgt.setPurposeElement(convertMarkdown(src.getPurposeElement())); + if (src.hasCopyright()) + tgt.setCopyrightElement(convertMarkdown(src.getCopyrightElement())); + for (org.hl7.fhir.r4.model.StructureMap.StructureMapStructureComponent t : src.getStructure()) + tgt.addStructure(convertStructureMapStructureComponent(t)); + for (org.hl7.fhir.r4.model.CanonicalType t : src.getImport()) + tgt.getImport().add(convertCanonical(t)); + for (org.hl7.fhir.r4.model.StructureMap.StructureMapGroupComponent t : src.getGroup()) + tgt.addGroup(convertStructureMapGroupComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.StructureMap convertStructureMap(org.hl7.fhir.r5.model.StructureMap src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.StructureMap tgt = new org.hl7.fhir.r4.model.StructureMap(); + copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrlElement(convertUri(src.getUrlElement())); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasVersion()) + tgt.setVersionElement(convertString(src.getVersionElement())); + if (src.hasName()) + tgt.setNameElement(convertString(src.getNameElement())); + if (src.hasTitle()) + tgt.setTitleElement(convertString(src.getTitleElement())); + if (src.hasStatus()) + tgt.setStatus(Enumerations.convertPublicationStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimentalElement(convertBoolean(src.getExperimentalElement())); + if (src.hasDate()) + tgt.setDateElement(convertDateTime(src.getDateElement())); + if (src.hasPublisher()) + tgt.setPublisherElement(convertString(src.getPublisherElement())); + for (org.hl7.fhir.r5.model.ContactDetail t : src.getContact()) + tgt.addContact(convertContactDetail(t)); + if (src.hasDescription()) + tgt.setDescriptionElement(convertMarkdown(src.getDescriptionElement())); + for (org.hl7.fhir.r5.model.UsageContext t : src.getUseContext()) + tgt.addUseContext(convertUsageContext(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getJurisdiction()) + tgt.addJurisdiction(convertCodeableConcept(t)); + if (src.hasPurpose()) + tgt.setPurposeElement(convertMarkdown(src.getPurposeElement())); + if (src.hasCopyright()) + tgt.setCopyrightElement(convertMarkdown(src.getCopyrightElement())); + for (org.hl7.fhir.r5.model.StructureMap.StructureMapStructureComponent t : src.getStructure()) + tgt.addStructure(convertStructureMapStructureComponent(t)); + for (org.hl7.fhir.r5.model.CanonicalType t : src.getImport()) + tgt.getImport().add(convertCanonical(t)); + for (org.hl7.fhir.r5.model.StructureMap.StructureMapGroupComponent t : src.getGroup()) + tgt.addGroup(convertStructureMapGroupComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.StructureMap.StructureMapStructureComponent convertStructureMapStructureComponent(org.hl7.fhir.r4.model.StructureMap.StructureMapStructureComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.StructureMap.StructureMapStructureComponent tgt = new org.hl7.fhir.r5.model.StructureMap.StructureMapStructureComponent(); + copyElement(src, tgt); + if (src.hasUrl()) + tgt.setUrlElement(convertCanonical(src.getUrlElement())); + if (src.hasMode()) + tgt.setMode(convertStructureMapModelMode(src.getMode())); + if (src.hasAlias()) + tgt.setAliasElement(convertString(src.getAliasElement())); + if (src.hasDocumentation()) + tgt.setDocumentationElement(convertString(src.getDocumentationElement())); + return tgt; + } + + public static org.hl7.fhir.r4.model.StructureMap.StructureMapStructureComponent convertStructureMapStructureComponent(org.hl7.fhir.r5.model.StructureMap.StructureMapStructureComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.StructureMap.StructureMapStructureComponent tgt = new org.hl7.fhir.r4.model.StructureMap.StructureMapStructureComponent(); + copyElement(src, tgt); + if (src.hasUrl()) + tgt.setUrlElement(convertCanonical(src.getUrlElement())); + if (src.hasMode()) + tgt.setMode(convertStructureMapModelMode(src.getMode())); + if (src.hasAlias()) + tgt.setAliasElement(convertString(src.getAliasElement())); + if (src.hasDocumentation()) + tgt.setDocumentationElement(convertString(src.getDocumentationElement())); + return tgt; + } + + public static org.hl7.fhir.r5.model.StructureMap.StructureMapModelMode convertStructureMapModelMode(org.hl7.fhir.r4.model.StructureMap.StructureMapModelMode src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case SOURCE: return org.hl7.fhir.r5.model.StructureMap.StructureMapModelMode.SOURCE; + case QUERIED: return org.hl7.fhir.r5.model.StructureMap.StructureMapModelMode.QUERIED; + case TARGET: return org.hl7.fhir.r5.model.StructureMap.StructureMapModelMode.TARGET; + case PRODUCED: return org.hl7.fhir.r5.model.StructureMap.StructureMapModelMode.PRODUCED; + default: return org.hl7.fhir.r5.model.StructureMap.StructureMapModelMode.NULL; + } +} + + public static org.hl7.fhir.r4.model.StructureMap.StructureMapModelMode convertStructureMapModelMode(org.hl7.fhir.r5.model.StructureMap.StructureMapModelMode src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case SOURCE: return org.hl7.fhir.r4.model.StructureMap.StructureMapModelMode.SOURCE; + case QUERIED: return org.hl7.fhir.r4.model.StructureMap.StructureMapModelMode.QUERIED; + case TARGET: return org.hl7.fhir.r4.model.StructureMap.StructureMapModelMode.TARGET; + case PRODUCED: return org.hl7.fhir.r4.model.StructureMap.StructureMapModelMode.PRODUCED; + default: return org.hl7.fhir.r4.model.StructureMap.StructureMapModelMode.NULL; + } +} + + public static org.hl7.fhir.r5.model.StructureMap.StructureMapGroupComponent convertStructureMapGroupComponent(org.hl7.fhir.r4.model.StructureMap.StructureMapGroupComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.StructureMap.StructureMapGroupComponent tgt = new org.hl7.fhir.r5.model.StructureMap.StructureMapGroupComponent(); + copyElement(src, tgt); + if (src.hasName()) + tgt.setNameElement(convertId(src.getNameElement())); + if (src.hasExtends()) + tgt.setExtendsElement(convertId(src.getExtendsElement())); + if (src.hasTypeMode()) + tgt.setTypeMode(convertStructureMapGroupTypeMode(src.getTypeMode())); + if (src.hasDocumentation()) + tgt.setDocumentationElement(convertString(src.getDocumentationElement())); + for (org.hl7.fhir.r4.model.StructureMap.StructureMapGroupInputComponent t : src.getInput()) + tgt.addInput(convertStructureMapGroupInputComponent(t)); + for (org.hl7.fhir.r4.model.StructureMap.StructureMapGroupRuleComponent t : src.getRule()) + tgt.addRule(convertStructureMapGroupRuleComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.StructureMap.StructureMapGroupComponent convertStructureMapGroupComponent(org.hl7.fhir.r5.model.StructureMap.StructureMapGroupComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.StructureMap.StructureMapGroupComponent tgt = new org.hl7.fhir.r4.model.StructureMap.StructureMapGroupComponent(); + copyElement(src, tgt); + if (src.hasName()) + tgt.setNameElement(convertId(src.getNameElement())); + if (src.hasExtends()) + tgt.setExtendsElement(convertId(src.getExtendsElement())); + if (src.hasTypeMode()) + tgt.setTypeMode(convertStructureMapGroupTypeMode(src.getTypeMode())); + if (src.hasDocumentation()) + tgt.setDocumentationElement(convertString(src.getDocumentationElement())); + for (org.hl7.fhir.r5.model.StructureMap.StructureMapGroupInputComponent t : src.getInput()) + tgt.addInput(convertStructureMapGroupInputComponent(t)); + for (org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleComponent t : src.getRule()) + tgt.addRule(convertStructureMapGroupRuleComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.StructureMap.StructureMapGroupTypeMode convertStructureMapGroupTypeMode(org.hl7.fhir.r4.model.StructureMap.StructureMapGroupTypeMode src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case NONE: return org.hl7.fhir.r5.model.StructureMap.StructureMapGroupTypeMode.NONE; + case TYPES: return org.hl7.fhir.r5.model.StructureMap.StructureMapGroupTypeMode.TYPES; + case TYPEANDTYPES: return org.hl7.fhir.r5.model.StructureMap.StructureMapGroupTypeMode.TYPEANDTYPES; + default: return org.hl7.fhir.r5.model.StructureMap.StructureMapGroupTypeMode.NULL; + } +} + + public static org.hl7.fhir.r4.model.StructureMap.StructureMapGroupTypeMode convertStructureMapGroupTypeMode(org.hl7.fhir.r5.model.StructureMap.StructureMapGroupTypeMode src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case NONE: return org.hl7.fhir.r4.model.StructureMap.StructureMapGroupTypeMode.NONE; + case TYPES: return org.hl7.fhir.r4.model.StructureMap.StructureMapGroupTypeMode.TYPES; + case TYPEANDTYPES: return org.hl7.fhir.r4.model.StructureMap.StructureMapGroupTypeMode.TYPEANDTYPES; + default: return org.hl7.fhir.r4.model.StructureMap.StructureMapGroupTypeMode.NULL; + } +} + + public static org.hl7.fhir.r5.model.StructureMap.StructureMapGroupInputComponent convertStructureMapGroupInputComponent(org.hl7.fhir.r4.model.StructureMap.StructureMapGroupInputComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.StructureMap.StructureMapGroupInputComponent tgt = new org.hl7.fhir.r5.model.StructureMap.StructureMapGroupInputComponent(); + copyElement(src, tgt); + if (src.hasName()) + tgt.setNameElement(convertId(src.getNameElement())); + if (src.hasType()) + tgt.setTypeElement(convertString(src.getTypeElement())); + if (src.hasMode()) + tgt.setMode(convertStructureMapInputMode(src.getMode())); + if (src.hasDocumentation()) + tgt.setDocumentationElement(convertString(src.getDocumentationElement())); + return tgt; + } + + public static org.hl7.fhir.r4.model.StructureMap.StructureMapGroupInputComponent convertStructureMapGroupInputComponent(org.hl7.fhir.r5.model.StructureMap.StructureMapGroupInputComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.StructureMap.StructureMapGroupInputComponent tgt = new org.hl7.fhir.r4.model.StructureMap.StructureMapGroupInputComponent(); + copyElement(src, tgt); + if (src.hasName()) + tgt.setNameElement(convertId(src.getNameElement())); + if (src.hasType()) + tgt.setTypeElement(convertString(src.getTypeElement())); + if (src.hasMode()) + tgt.setMode(convertStructureMapInputMode(src.getMode())); + if (src.hasDocumentation()) + tgt.setDocumentationElement(convertString(src.getDocumentationElement())); + return tgt; + } + + public static org.hl7.fhir.r5.model.StructureMap.StructureMapInputMode convertStructureMapInputMode(org.hl7.fhir.r4.model.StructureMap.StructureMapInputMode src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case SOURCE: return org.hl7.fhir.r5.model.StructureMap.StructureMapInputMode.SOURCE; + case TARGET: return org.hl7.fhir.r5.model.StructureMap.StructureMapInputMode.TARGET; + default: return org.hl7.fhir.r5.model.StructureMap.StructureMapInputMode.NULL; + } +} + + public static org.hl7.fhir.r4.model.StructureMap.StructureMapInputMode convertStructureMapInputMode(org.hl7.fhir.r5.model.StructureMap.StructureMapInputMode src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case SOURCE: return org.hl7.fhir.r4.model.StructureMap.StructureMapInputMode.SOURCE; + case TARGET: return org.hl7.fhir.r4.model.StructureMap.StructureMapInputMode.TARGET; + default: return org.hl7.fhir.r4.model.StructureMap.StructureMapInputMode.NULL; + } +} + + public static org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleComponent convertStructureMapGroupRuleComponent(org.hl7.fhir.r4.model.StructureMap.StructureMapGroupRuleComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleComponent tgt = new org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleComponent(); + copyElement(src, tgt); + if (src.hasName()) + tgt.setNameElement(convertId(src.getNameElement())); + for (org.hl7.fhir.r4.model.StructureMap.StructureMapGroupRuleSourceComponent t : src.getSource()) + tgt.addSource(convertStructureMapGroupRuleSourceComponent(t)); + for (org.hl7.fhir.r4.model.StructureMap.StructureMapGroupRuleTargetComponent t : src.getTarget()) + tgt.addTarget(convertStructureMapGroupRuleTargetComponent(t)); + for (org.hl7.fhir.r4.model.StructureMap.StructureMapGroupRuleComponent t : src.getRule()) + tgt.addRule(convertStructureMapGroupRuleComponent(t)); + for (org.hl7.fhir.r4.model.StructureMap.StructureMapGroupRuleDependentComponent t : src.getDependent()) + tgt.addDependent(convertStructureMapGroupRuleDependentComponent(t)); + if (src.hasDocumentation()) + tgt.setDocumentationElement(convertString(src.getDocumentationElement())); + return tgt; + } + + public static org.hl7.fhir.r4.model.StructureMap.StructureMapGroupRuleComponent convertStructureMapGroupRuleComponent(org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.StructureMap.StructureMapGroupRuleComponent tgt = new org.hl7.fhir.r4.model.StructureMap.StructureMapGroupRuleComponent(); + copyElement(src, tgt); + if (src.hasName()) + tgt.setNameElement(convertId(src.getNameElement())); + for (org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleSourceComponent t : src.getSource()) + tgt.addSource(convertStructureMapGroupRuleSourceComponent(t)); + for (org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleTargetComponent t : src.getTarget()) + tgt.addTarget(convertStructureMapGroupRuleTargetComponent(t)); + for (org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleComponent t : src.getRule()) + tgt.addRule(convertStructureMapGroupRuleComponent(t)); + for (org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleDependentComponent t : src.getDependent()) + tgt.addDependent(convertStructureMapGroupRuleDependentComponent(t)); + if (src.hasDocumentation()) + tgt.setDocumentationElement(convertString(src.getDocumentationElement())); + return tgt; + } + + public static org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleSourceComponent convertStructureMapGroupRuleSourceComponent(org.hl7.fhir.r4.model.StructureMap.StructureMapGroupRuleSourceComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleSourceComponent tgt = new org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleSourceComponent(); + copyElement(src, tgt); + if (src.hasContext()) + tgt.setContextElement(convertId(src.getContextElement())); + if (src.hasMin()) + tgt.setMinElement(convertInteger(src.getMinElement())); + if (src.hasMax()) + tgt.setMaxElement(convertString(src.getMaxElement())); + if (src.hasType()) + tgt.setTypeElement(convertString(src.getTypeElement())); + if (src.hasDefaultValue()) + tgt.setDefaultValue(convertType(src.getDefaultValue())); + if (src.hasElement()) + tgt.setElementElement(convertString(src.getElementElement())); + if (src.hasListMode()) + tgt.setListMode(convertStructureMapSourceListMode(src.getListMode())); + if (src.hasVariable()) + tgt.setVariableElement(convertId(src.getVariableElement())); + if (src.hasCondition()) + tgt.setConditionElement(convertString(src.getConditionElement())); + if (src.hasCheck()) + tgt.setCheckElement(convertString(src.getCheckElement())); + if (src.hasLogMessage()) + tgt.setLogMessageElement(convertString(src.getLogMessageElement())); + return tgt; + } + + public static org.hl7.fhir.r4.model.StructureMap.StructureMapGroupRuleSourceComponent convertStructureMapGroupRuleSourceComponent(org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleSourceComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.StructureMap.StructureMapGroupRuleSourceComponent tgt = new org.hl7.fhir.r4.model.StructureMap.StructureMapGroupRuleSourceComponent(); + copyElement(src, tgt); + if (src.hasContext()) + tgt.setContextElement(convertId(src.getContextElement())); + if (src.hasMin()) + tgt.setMinElement(convertInteger(src.getMinElement())); + if (src.hasMax()) + tgt.setMaxElement(convertString(src.getMaxElement())); + if (src.hasType()) + tgt.setTypeElement(convertString(src.getTypeElement())); + if (src.hasDefaultValue()) + tgt.setDefaultValue(convertType(src.getDefaultValue())); + if (src.hasElement()) + tgt.setElementElement(convertString(src.getElementElement())); + if (src.hasListMode()) + tgt.setListMode(convertStructureMapSourceListMode(src.getListMode())); + if (src.hasVariable()) + tgt.setVariableElement(convertId(src.getVariableElement())); + if (src.hasCondition()) + tgt.setConditionElement(convertString(src.getConditionElement())); + if (src.hasCheck()) + tgt.setCheckElement(convertString(src.getCheckElement())); + if (src.hasLogMessage()) + tgt.setLogMessageElement(convertString(src.getLogMessageElement())); + return tgt; + } + + public static org.hl7.fhir.r5.model.StructureMap.StructureMapSourceListMode convertStructureMapSourceListMode(org.hl7.fhir.r4.model.StructureMap.StructureMapSourceListMode src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case FIRST: return org.hl7.fhir.r5.model.StructureMap.StructureMapSourceListMode.FIRST; + case NOTFIRST: return org.hl7.fhir.r5.model.StructureMap.StructureMapSourceListMode.NOTFIRST; + case LAST: return org.hl7.fhir.r5.model.StructureMap.StructureMapSourceListMode.LAST; + case NOTLAST: return org.hl7.fhir.r5.model.StructureMap.StructureMapSourceListMode.NOTLAST; + case ONLYONE: return org.hl7.fhir.r5.model.StructureMap.StructureMapSourceListMode.ONLYONE; + default: return org.hl7.fhir.r5.model.StructureMap.StructureMapSourceListMode.NULL; + } +} + + public static org.hl7.fhir.r4.model.StructureMap.StructureMapSourceListMode convertStructureMapSourceListMode(org.hl7.fhir.r5.model.StructureMap.StructureMapSourceListMode src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case FIRST: return org.hl7.fhir.r4.model.StructureMap.StructureMapSourceListMode.FIRST; + case NOTFIRST: return org.hl7.fhir.r4.model.StructureMap.StructureMapSourceListMode.NOTFIRST; + case LAST: return org.hl7.fhir.r4.model.StructureMap.StructureMapSourceListMode.LAST; + case NOTLAST: return org.hl7.fhir.r4.model.StructureMap.StructureMapSourceListMode.NOTLAST; + case ONLYONE: return org.hl7.fhir.r4.model.StructureMap.StructureMapSourceListMode.ONLYONE; + default: return org.hl7.fhir.r4.model.StructureMap.StructureMapSourceListMode.NULL; + } +} + + public static org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleTargetComponent convertStructureMapGroupRuleTargetComponent(org.hl7.fhir.r4.model.StructureMap.StructureMapGroupRuleTargetComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleTargetComponent tgt = new org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleTargetComponent(); + copyElement(src, tgt); + if (src.hasContext()) + tgt.setContextElement(convertId(src.getContextElement())); + if (src.hasContextType()) + tgt.setContextType(convertStructureMapContextType(src.getContextType())); + if (src.hasElement()) + tgt.setElementElement(convertString(src.getElementElement())); + if (src.hasVariable()) + tgt.setVariableElement(convertId(src.getVariableElement())); + for (org.hl7.fhir.r4.model.Enumeration t : src.getListMode()) + tgt.addListMode(convertStructureMapTargetListMode(t.getValue())); + if (src.hasListRuleId()) + tgt.setListRuleIdElement(convertId(src.getListRuleIdElement())); + if (src.hasTransform()) + tgt.setTransform(convertStructureMapTransform(src.getTransform())); + for (org.hl7.fhir.r4.model.StructureMap.StructureMapGroupRuleTargetParameterComponent t : src.getParameter()) + tgt.addParameter(convertStructureMapGroupRuleTargetParameterComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.StructureMap.StructureMapGroupRuleTargetComponent convertStructureMapGroupRuleTargetComponent(org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleTargetComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.StructureMap.StructureMapGroupRuleTargetComponent tgt = new org.hl7.fhir.r4.model.StructureMap.StructureMapGroupRuleTargetComponent(); + copyElement(src, tgt); + if (src.hasContext()) + tgt.setContextElement(convertId(src.getContextElement())); + if (src.hasContextType()) + tgt.setContextType(convertStructureMapContextType(src.getContextType())); + if (src.hasElement()) + tgt.setElementElement(convertString(src.getElementElement())); + if (src.hasVariable()) + tgt.setVariableElement(convertId(src.getVariableElement())); + for (org.hl7.fhir.r5.model.Enumeration t : src.getListMode()) + tgt.addListMode(convertStructureMapTargetListMode(t.getValue())); + if (src.hasListRuleId()) + tgt.setListRuleIdElement(convertId(src.getListRuleIdElement())); + if (src.hasTransform()) + tgt.setTransform(convertStructureMapTransform(src.getTransform())); + for (org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleTargetParameterComponent t : src.getParameter()) + tgt.addParameter(convertStructureMapGroupRuleTargetParameterComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.StructureMap.StructureMapContextType convertStructureMapContextType(org.hl7.fhir.r4.model.StructureMap.StructureMapContextType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case TYPE: return org.hl7.fhir.r5.model.StructureMap.StructureMapContextType.TYPE; + case VARIABLE: return org.hl7.fhir.r5.model.StructureMap.StructureMapContextType.VARIABLE; + default: return org.hl7.fhir.r5.model.StructureMap.StructureMapContextType.NULL; + } +} + + public static org.hl7.fhir.r4.model.StructureMap.StructureMapContextType convertStructureMapContextType(org.hl7.fhir.r5.model.StructureMap.StructureMapContextType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case TYPE: return org.hl7.fhir.r4.model.StructureMap.StructureMapContextType.TYPE; + case VARIABLE: return org.hl7.fhir.r4.model.StructureMap.StructureMapContextType.VARIABLE; + default: return org.hl7.fhir.r4.model.StructureMap.StructureMapContextType.NULL; + } +} + + public static org.hl7.fhir.r5.model.StructureMap.StructureMapTargetListMode convertStructureMapTargetListMode(org.hl7.fhir.r4.model.StructureMap.StructureMapTargetListMode src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case FIRST: return org.hl7.fhir.r5.model.StructureMap.StructureMapTargetListMode.FIRST; + case SHARE: return org.hl7.fhir.r5.model.StructureMap.StructureMapTargetListMode.SHARE; + case LAST: return org.hl7.fhir.r5.model.StructureMap.StructureMapTargetListMode.LAST; + case COLLATE: return org.hl7.fhir.r5.model.StructureMap.StructureMapTargetListMode.COLLATE; + default: return org.hl7.fhir.r5.model.StructureMap.StructureMapTargetListMode.NULL; + } +} + + public static org.hl7.fhir.r4.model.StructureMap.StructureMapTargetListMode convertStructureMapTargetListMode(org.hl7.fhir.r5.model.StructureMap.StructureMapTargetListMode src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case FIRST: return org.hl7.fhir.r4.model.StructureMap.StructureMapTargetListMode.FIRST; + case SHARE: return org.hl7.fhir.r4.model.StructureMap.StructureMapTargetListMode.SHARE; + case LAST: return org.hl7.fhir.r4.model.StructureMap.StructureMapTargetListMode.LAST; + case COLLATE: return org.hl7.fhir.r4.model.StructureMap.StructureMapTargetListMode.COLLATE; + default: return org.hl7.fhir.r4.model.StructureMap.StructureMapTargetListMode.NULL; + } +} + + public static org.hl7.fhir.r5.model.StructureMap.StructureMapTransform convertStructureMapTransform(org.hl7.fhir.r4.model.StructureMap.StructureMapTransform src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case CREATE: return org.hl7.fhir.r5.model.StructureMap.StructureMapTransform.CREATE; + case COPY: return org.hl7.fhir.r5.model.StructureMap.StructureMapTransform.COPY; + case TRUNCATE: return org.hl7.fhir.r5.model.StructureMap.StructureMapTransform.TRUNCATE; + case ESCAPE: return org.hl7.fhir.r5.model.StructureMap.StructureMapTransform.ESCAPE; + case CAST: return org.hl7.fhir.r5.model.StructureMap.StructureMapTransform.CAST; + case APPEND: return org.hl7.fhir.r5.model.StructureMap.StructureMapTransform.APPEND; + case TRANSLATE: return org.hl7.fhir.r5.model.StructureMap.StructureMapTransform.TRANSLATE; + case REFERENCE: return org.hl7.fhir.r5.model.StructureMap.StructureMapTransform.REFERENCE; + case DATEOP: return org.hl7.fhir.r5.model.StructureMap.StructureMapTransform.DATEOP; + case UUID: return org.hl7.fhir.r5.model.StructureMap.StructureMapTransform.UUID; + case POINTER: return org.hl7.fhir.r5.model.StructureMap.StructureMapTransform.POINTER; + case EVALUATE: return org.hl7.fhir.r5.model.StructureMap.StructureMapTransform.EVALUATE; + case CC: return org.hl7.fhir.r5.model.StructureMap.StructureMapTransform.CC; + case C: return org.hl7.fhir.r5.model.StructureMap.StructureMapTransform.C; + case QTY: return org.hl7.fhir.r5.model.StructureMap.StructureMapTransform.QTY; + case ID: return org.hl7.fhir.r5.model.StructureMap.StructureMapTransform.ID; + case CP: return org.hl7.fhir.r5.model.StructureMap.StructureMapTransform.CP; + default: return org.hl7.fhir.r5.model.StructureMap.StructureMapTransform.NULL; + } +} + + public static org.hl7.fhir.r4.model.StructureMap.StructureMapTransform convertStructureMapTransform(org.hl7.fhir.r5.model.StructureMap.StructureMapTransform src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case CREATE: return org.hl7.fhir.r4.model.StructureMap.StructureMapTransform.CREATE; + case COPY: return org.hl7.fhir.r4.model.StructureMap.StructureMapTransform.COPY; + case TRUNCATE: return org.hl7.fhir.r4.model.StructureMap.StructureMapTransform.TRUNCATE; + case ESCAPE: return org.hl7.fhir.r4.model.StructureMap.StructureMapTransform.ESCAPE; + case CAST: return org.hl7.fhir.r4.model.StructureMap.StructureMapTransform.CAST; + case APPEND: return org.hl7.fhir.r4.model.StructureMap.StructureMapTransform.APPEND; + case TRANSLATE: return org.hl7.fhir.r4.model.StructureMap.StructureMapTransform.TRANSLATE; + case REFERENCE: return org.hl7.fhir.r4.model.StructureMap.StructureMapTransform.REFERENCE; + case DATEOP: return org.hl7.fhir.r4.model.StructureMap.StructureMapTransform.DATEOP; + case UUID: return org.hl7.fhir.r4.model.StructureMap.StructureMapTransform.UUID; + case POINTER: return org.hl7.fhir.r4.model.StructureMap.StructureMapTransform.POINTER; + case EVALUATE: return org.hl7.fhir.r4.model.StructureMap.StructureMapTransform.EVALUATE; + case CC: return org.hl7.fhir.r4.model.StructureMap.StructureMapTransform.CC; + case C: return org.hl7.fhir.r4.model.StructureMap.StructureMapTransform.C; + case QTY: return org.hl7.fhir.r4.model.StructureMap.StructureMapTransform.QTY; + case ID: return org.hl7.fhir.r4.model.StructureMap.StructureMapTransform.ID; + case CP: return org.hl7.fhir.r4.model.StructureMap.StructureMapTransform.CP; + default: return org.hl7.fhir.r4.model.StructureMap.StructureMapTransform.NULL; + } +} + + public static org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleTargetParameterComponent convertStructureMapGroupRuleTargetParameterComponent(org.hl7.fhir.r4.model.StructureMap.StructureMapGroupRuleTargetParameterComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleTargetParameterComponent tgt = new org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleTargetParameterComponent(); + copyElement(src, tgt); + if (src.hasValue()) + tgt.setValue(convertType(src.getValue())); + return tgt; + } + + public static org.hl7.fhir.r4.model.StructureMap.StructureMapGroupRuleTargetParameterComponent convertStructureMapGroupRuleTargetParameterComponent(org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleTargetParameterComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.StructureMap.StructureMapGroupRuleTargetParameterComponent tgt = new org.hl7.fhir.r4.model.StructureMap.StructureMapGroupRuleTargetParameterComponent(); + copyElement(src, tgt); + if (src.hasValue()) + tgt.setValue(convertType(src.getValue())); + return tgt; + } + + public static org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleDependentComponent convertStructureMapGroupRuleDependentComponent(org.hl7.fhir.r4.model.StructureMap.StructureMapGroupRuleDependentComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleDependentComponent tgt = new org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleDependentComponent(); + copyElement(src, tgt); + if (src.hasName()) + tgt.setNameElement(convertId(src.getNameElement())); + for (org.hl7.fhir.r4.model.StringType t : src.getVariable()) + tgt.getVariable().add(convertString(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.StructureMap.StructureMapGroupRuleDependentComponent convertStructureMapGroupRuleDependentComponent(org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleDependentComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.StructureMap.StructureMapGroupRuleDependentComponent tgt = new org.hl7.fhir.r4.model.StructureMap.StructureMapGroupRuleDependentComponent(); + copyElement(src, tgt); + if (src.hasName()) + tgt.setNameElement(convertId(src.getNameElement())); + for (org.hl7.fhir.r5.model.StringType t : src.getVariable()) + tgt.getVariable().add(convertString(t)); + return tgt; + } + + +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Subscription.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Subscription.java new file mode 100644 index 000000000..904f9c0a9 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Subscription.java @@ -0,0 +1,169 @@ +package org.hl7.fhir.convertors.conv40_50; + +import org.hl7.fhir.exceptions.FHIRException; + +import org.hl7.fhir.convertors.VersionConvertor_40_50; + + +/* + Copyright (c) 2011+, HL7, Inc. + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of HL7 nor the names of its contributors may be used to + endorse or promote products derived from this software without specific + prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + +*/ + +// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0 + + +public class Subscription extends VersionConvertor_40_50 { + + public static org.hl7.fhir.r5.model.Subscription convertSubscription(org.hl7.fhir.r4.model.Subscription src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Subscription tgt = new org.hl7.fhir.r5.model.Subscription(); + copyDomainResource(src, tgt); + if (src.hasStatus()) + tgt.setStatus(convertSubscriptionStatus(src.getStatus())); + for (org.hl7.fhir.r4.model.ContactPoint t : src.getContact()) + tgt.addContact(convertContactPoint(t)); + if (src.hasEnd()) + tgt.setEndElement(convertInstant(src.getEndElement())); + if (src.hasReason()) + tgt.setReasonElement(convertString(src.getReasonElement())); + if (src.hasCriteria()) + tgt.setCriteriaElement(convertString(src.getCriteriaElement())); + if (src.hasError()) + tgt.setErrorElement(convertString(src.getErrorElement())); + if (src.hasChannel()) + tgt.setChannel(convertSubscriptionChannelComponent(src.getChannel())); + return tgt; + } + + public static org.hl7.fhir.r4.model.Subscription convertSubscription(org.hl7.fhir.r5.model.Subscription src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Subscription tgt = new org.hl7.fhir.r4.model.Subscription(); + copyDomainResource(src, tgt); + if (src.hasStatus()) + tgt.setStatus(convertSubscriptionStatus(src.getStatus())); + for (org.hl7.fhir.r5.model.ContactPoint t : src.getContact()) + tgt.addContact(convertContactPoint(t)); + if (src.hasEnd()) + tgt.setEndElement(convertInstant(src.getEndElement())); + if (src.hasReason()) + tgt.setReasonElement(convertString(src.getReasonElement())); + if (src.hasCriteria()) + tgt.setCriteriaElement(convertString(src.getCriteriaElement())); + if (src.hasError()) + tgt.setErrorElement(convertString(src.getErrorElement())); + if (src.hasChannel()) + tgt.setChannel(convertSubscriptionChannelComponent(src.getChannel())); + return tgt; + } + + public static org.hl7.fhir.r5.model.Subscription.SubscriptionStatus convertSubscriptionStatus(org.hl7.fhir.r4.model.Subscription.SubscriptionStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case REQUESTED: return org.hl7.fhir.r5.model.Subscription.SubscriptionStatus.REQUESTED; + case ACTIVE: return org.hl7.fhir.r5.model.Subscription.SubscriptionStatus.ACTIVE; + case ERROR: return org.hl7.fhir.r5.model.Subscription.SubscriptionStatus.ERROR; + case OFF: return org.hl7.fhir.r5.model.Subscription.SubscriptionStatus.OFF; + default: return org.hl7.fhir.r5.model.Subscription.SubscriptionStatus.NULL; + } +} + + public static org.hl7.fhir.r4.model.Subscription.SubscriptionStatus convertSubscriptionStatus(org.hl7.fhir.r5.model.Subscription.SubscriptionStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case REQUESTED: return org.hl7.fhir.r4.model.Subscription.SubscriptionStatus.REQUESTED; + case ACTIVE: return org.hl7.fhir.r4.model.Subscription.SubscriptionStatus.ACTIVE; + case ERROR: return org.hl7.fhir.r4.model.Subscription.SubscriptionStatus.ERROR; + case OFF: return org.hl7.fhir.r4.model.Subscription.SubscriptionStatus.OFF; + default: return org.hl7.fhir.r4.model.Subscription.SubscriptionStatus.NULL; + } +} + + public static org.hl7.fhir.r5.model.Subscription.SubscriptionChannelComponent convertSubscriptionChannelComponent(org.hl7.fhir.r4.model.Subscription.SubscriptionChannelComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Subscription.SubscriptionChannelComponent tgt = new org.hl7.fhir.r5.model.Subscription.SubscriptionChannelComponent(); + copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertSubscriptionChannelType(src.getType())); + if (src.hasEndpoint()) + tgt.setEndpointElement(convertUrl(src.getEndpointElement())); + if (src.hasPayload()) + tgt.setPayloadElement(convertCode(src.getPayloadElement())); + for (org.hl7.fhir.r4.model.StringType t : src.getHeader()) + tgt.getHeader().add(convertString(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.Subscription.SubscriptionChannelComponent convertSubscriptionChannelComponent(org.hl7.fhir.r5.model.Subscription.SubscriptionChannelComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Subscription.SubscriptionChannelComponent tgt = new org.hl7.fhir.r4.model.Subscription.SubscriptionChannelComponent(); + copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertSubscriptionChannelType(src.getType())); + if (src.hasEndpoint()) + tgt.setEndpointElement(convertUrl(src.getEndpointElement())); + if (src.hasPayload()) + tgt.setPayloadElement(convertCode(src.getPayloadElement())); + for (org.hl7.fhir.r5.model.StringType t : src.getHeader()) + tgt.getHeader().add(convertString(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.Subscription.SubscriptionChannelType convertSubscriptionChannelType(org.hl7.fhir.r4.model.Subscription.SubscriptionChannelType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case RESTHOOK: return org.hl7.fhir.r5.model.Subscription.SubscriptionChannelType.RESTHOOK; + case WEBSOCKET: return org.hl7.fhir.r5.model.Subscription.SubscriptionChannelType.WEBSOCKET; + case EMAIL: return org.hl7.fhir.r5.model.Subscription.SubscriptionChannelType.EMAIL; + case SMS: return org.hl7.fhir.r5.model.Subscription.SubscriptionChannelType.SMS; + case MESSAGE: return org.hl7.fhir.r5.model.Subscription.SubscriptionChannelType.MESSAGE; + default: return org.hl7.fhir.r5.model.Subscription.SubscriptionChannelType.NULL; + } +} + + public static org.hl7.fhir.r4.model.Subscription.SubscriptionChannelType convertSubscriptionChannelType(org.hl7.fhir.r5.model.Subscription.SubscriptionChannelType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case RESTHOOK: return org.hl7.fhir.r4.model.Subscription.SubscriptionChannelType.RESTHOOK; + case WEBSOCKET: return org.hl7.fhir.r4.model.Subscription.SubscriptionChannelType.WEBSOCKET; + case EMAIL: return org.hl7.fhir.r4.model.Subscription.SubscriptionChannelType.EMAIL; + case SMS: return org.hl7.fhir.r4.model.Subscription.SubscriptionChannelType.SMS; + case MESSAGE: return org.hl7.fhir.r4.model.Subscription.SubscriptionChannelType.MESSAGE; + default: return org.hl7.fhir.r4.model.Subscription.SubscriptionChannelType.NULL; + } +} + + +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Substance.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Substance.java new file mode 100644 index 000000000..a29ab0350 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Substance.java @@ -0,0 +1,161 @@ +package org.hl7.fhir.convertors.conv40_50; + +import org.hl7.fhir.exceptions.FHIRException; + +import org.hl7.fhir.convertors.VersionConvertor_40_50; + + +/* + Copyright (c) 2011+, HL7, Inc. + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of HL7 nor the names of its contributors may be used to + endorse or promote products derived from this software without specific + prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + +*/ + +// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0 + + +public class Substance extends VersionConvertor_40_50 { + + public static org.hl7.fhir.r5.model.Substance convertSubstance(org.hl7.fhir.r4.model.Substance src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Substance tgt = new org.hl7.fhir.r5.model.Substance(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasStatus()) + tgt.setStatus(convertFHIRSubstanceStatus(src.getStatus())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getCategory()) + tgt.addCategory(convertCodeableConcept(t)); + if (src.hasCode()) + tgt.setCode(convertCodeableConcept(src.getCode())); + if (src.hasDescription()) + tgt.setDescriptionElement(convertString(src.getDescriptionElement())); + for (org.hl7.fhir.r4.model.Substance.SubstanceInstanceComponent t : src.getInstance()) + tgt.addInstance(convertSubstanceInstanceComponent(t)); + for (org.hl7.fhir.r4.model.Substance.SubstanceIngredientComponent t : src.getIngredient()) + tgt.addIngredient(convertSubstanceIngredientComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.Substance convertSubstance(org.hl7.fhir.r5.model.Substance src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Substance tgt = new org.hl7.fhir.r4.model.Substance(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasStatus()) + tgt.setStatus(convertFHIRSubstanceStatus(src.getStatus())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getCategory()) + tgt.addCategory(convertCodeableConcept(t)); + if (src.hasCode()) + tgt.setCode(convertCodeableConcept(src.getCode())); + if (src.hasDescription()) + tgt.setDescriptionElement(convertString(src.getDescriptionElement())); + for (org.hl7.fhir.r5.model.Substance.SubstanceInstanceComponent t : src.getInstance()) + tgt.addInstance(convertSubstanceInstanceComponent(t)); + for (org.hl7.fhir.r5.model.Substance.SubstanceIngredientComponent t : src.getIngredient()) + tgt.addIngredient(convertSubstanceIngredientComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.Substance.FHIRSubstanceStatus convertFHIRSubstanceStatus(org.hl7.fhir.r4.model.Substance.FHIRSubstanceStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case ACTIVE: return org.hl7.fhir.r5.model.Substance.FHIRSubstanceStatus.ACTIVE; + case INACTIVE: return org.hl7.fhir.r5.model.Substance.FHIRSubstanceStatus.INACTIVE; + case ENTEREDINERROR: return org.hl7.fhir.r5.model.Substance.FHIRSubstanceStatus.ENTEREDINERROR; + default: return org.hl7.fhir.r5.model.Substance.FHIRSubstanceStatus.NULL; + } +} + + public static org.hl7.fhir.r4.model.Substance.FHIRSubstanceStatus convertFHIRSubstanceStatus(org.hl7.fhir.r5.model.Substance.FHIRSubstanceStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case ACTIVE: return org.hl7.fhir.r4.model.Substance.FHIRSubstanceStatus.ACTIVE; + case INACTIVE: return org.hl7.fhir.r4.model.Substance.FHIRSubstanceStatus.INACTIVE; + case ENTEREDINERROR: return org.hl7.fhir.r4.model.Substance.FHIRSubstanceStatus.ENTEREDINERROR; + default: return org.hl7.fhir.r4.model.Substance.FHIRSubstanceStatus.NULL; + } +} + + public static org.hl7.fhir.r5.model.Substance.SubstanceInstanceComponent convertSubstanceInstanceComponent(org.hl7.fhir.r4.model.Substance.SubstanceInstanceComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Substance.SubstanceInstanceComponent tgt = new org.hl7.fhir.r5.model.Substance.SubstanceInstanceComponent(); + copyElement(src, tgt); + if (src.hasIdentifier()) + tgt.setIdentifier(convertIdentifier(src.getIdentifier())); + if (src.hasExpiry()) + tgt.setExpiryElement(convertDateTime(src.getExpiryElement())); + if (src.hasQuantity()) + tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); + return tgt; + } + + public static org.hl7.fhir.r4.model.Substance.SubstanceInstanceComponent convertSubstanceInstanceComponent(org.hl7.fhir.r5.model.Substance.SubstanceInstanceComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Substance.SubstanceInstanceComponent tgt = new org.hl7.fhir.r4.model.Substance.SubstanceInstanceComponent(); + copyElement(src, tgt); + if (src.hasIdentifier()) + tgt.setIdentifier(convertIdentifier(src.getIdentifier())); + if (src.hasExpiry()) + tgt.setExpiryElement(convertDateTime(src.getExpiryElement())); + if (src.hasQuantity()) + tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); + return tgt; + } + + public static org.hl7.fhir.r5.model.Substance.SubstanceIngredientComponent convertSubstanceIngredientComponent(org.hl7.fhir.r4.model.Substance.SubstanceIngredientComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Substance.SubstanceIngredientComponent tgt = new org.hl7.fhir.r5.model.Substance.SubstanceIngredientComponent(); + copyElement(src, tgt); + if (src.hasQuantity()) + tgt.setQuantity(convertRatio(src.getQuantity())); + if (src.hasSubstance()) + tgt.setSubstance(convertType(src.getSubstance())); + return tgt; + } + + public static org.hl7.fhir.r4.model.Substance.SubstanceIngredientComponent convertSubstanceIngredientComponent(org.hl7.fhir.r5.model.Substance.SubstanceIngredientComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Substance.SubstanceIngredientComponent tgt = new org.hl7.fhir.r4.model.Substance.SubstanceIngredientComponent(); + copyElement(src, tgt); + if (src.hasQuantity()) + tgt.setQuantity(convertRatio(src.getQuantity())); + if (src.hasSubstance()) + tgt.setSubstance(convertType(src.getSubstance())); + return tgt; + } + + +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/SubstanceNucleicAcid.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/SubstanceNucleicAcid.java new file mode 100644 index 000000000..737f772af --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/SubstanceNucleicAcid.java @@ -0,0 +1,187 @@ +package org.hl7.fhir.convertors.conv40_50; + +import org.hl7.fhir.exceptions.FHIRException; + +import org.hl7.fhir.convertors.VersionConvertor_40_50; + + +/* + Copyright (c) 2011+, HL7, Inc. + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of HL7 nor the names of its contributors may be used to + endorse or promote products derived from this software without specific + prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + +*/ + +// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0 + + +public class SubstanceNucleicAcid extends VersionConvertor_40_50 { + + public static org.hl7.fhir.r5.model.SubstanceNucleicAcid convertSubstanceNucleicAcid(org.hl7.fhir.r4.model.SubstanceNucleicAcid src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.SubstanceNucleicAcid tgt = new org.hl7.fhir.r5.model.SubstanceNucleicAcid(); + copyDomainResource(src, tgt); + if (src.hasSequenceType()) + tgt.setSequenceType(convertCodeableConcept(src.getSequenceType())); + if (src.hasNumberOfSubunits()) + tgt.setNumberOfSubunitsElement(convertInteger(src.getNumberOfSubunitsElement())); + if (src.hasAreaOfHybridisation()) + tgt.setAreaOfHybridisationElement(convertString(src.getAreaOfHybridisationElement())); + if (src.hasOligoNucleotideType()) + tgt.setOligoNucleotideType(convertCodeableConcept(src.getOligoNucleotideType())); + for (org.hl7.fhir.r4.model.SubstanceNucleicAcid.SubstanceNucleicAcidSubunitComponent t : src.getSubunit()) + tgt.addSubunit(convertSubstanceNucleicAcidSubunitComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.SubstanceNucleicAcid convertSubstanceNucleicAcid(org.hl7.fhir.r5.model.SubstanceNucleicAcid src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.SubstanceNucleicAcid tgt = new org.hl7.fhir.r4.model.SubstanceNucleicAcid(); + copyDomainResource(src, tgt); + if (src.hasSequenceType()) + tgt.setSequenceType(convertCodeableConcept(src.getSequenceType())); + if (src.hasNumberOfSubunits()) + tgt.setNumberOfSubunitsElement(convertInteger(src.getNumberOfSubunitsElement())); + if (src.hasAreaOfHybridisation()) + tgt.setAreaOfHybridisationElement(convertString(src.getAreaOfHybridisationElement())); + if (src.hasOligoNucleotideType()) + tgt.setOligoNucleotideType(convertCodeableConcept(src.getOligoNucleotideType())); + for (org.hl7.fhir.r5.model.SubstanceNucleicAcid.SubstanceNucleicAcidSubunitComponent t : src.getSubunit()) + tgt.addSubunit(convertSubstanceNucleicAcidSubunitComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.SubstanceNucleicAcid.SubstanceNucleicAcidSubunitComponent convertSubstanceNucleicAcidSubunitComponent(org.hl7.fhir.r4.model.SubstanceNucleicAcid.SubstanceNucleicAcidSubunitComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.SubstanceNucleicAcid.SubstanceNucleicAcidSubunitComponent tgt = new org.hl7.fhir.r5.model.SubstanceNucleicAcid.SubstanceNucleicAcidSubunitComponent(); + copyElement(src, tgt); + if (src.hasSubunit()) + tgt.setSubunitElement(convertInteger(src.getSubunitElement())); + if (src.hasSequence()) + tgt.setSequenceElement(convertString(src.getSequenceElement())); + if (src.hasLength()) + tgt.setLengthElement(convertInteger(src.getLengthElement())); + if (src.hasSequenceAttachment()) + tgt.setSequenceAttachment(convertAttachment(src.getSequenceAttachment())); + if (src.hasFivePrime()) + tgt.setFivePrime(convertCodeableConcept(src.getFivePrime())); + if (src.hasThreePrime()) + tgt.setThreePrime(convertCodeableConcept(src.getThreePrime())); + for (org.hl7.fhir.r4.model.SubstanceNucleicAcid.SubstanceNucleicAcidSubunitLinkageComponent t : src.getLinkage()) + tgt.addLinkage(convertSubstanceNucleicAcidSubunitLinkageComponent(t)); + for (org.hl7.fhir.r4.model.SubstanceNucleicAcid.SubstanceNucleicAcidSubunitSugarComponent t : src.getSugar()) + tgt.addSugar(convertSubstanceNucleicAcidSubunitSugarComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.SubstanceNucleicAcid.SubstanceNucleicAcidSubunitComponent convertSubstanceNucleicAcidSubunitComponent(org.hl7.fhir.r5.model.SubstanceNucleicAcid.SubstanceNucleicAcidSubunitComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.SubstanceNucleicAcid.SubstanceNucleicAcidSubunitComponent tgt = new org.hl7.fhir.r4.model.SubstanceNucleicAcid.SubstanceNucleicAcidSubunitComponent(); + copyElement(src, tgt); + if (src.hasSubunit()) + tgt.setSubunitElement(convertInteger(src.getSubunitElement())); + if (src.hasSequence()) + tgt.setSequenceElement(convertString(src.getSequenceElement())); + if (src.hasLength()) + tgt.setLengthElement(convertInteger(src.getLengthElement())); + if (src.hasSequenceAttachment()) + tgt.setSequenceAttachment(convertAttachment(src.getSequenceAttachment())); + if (src.hasFivePrime()) + tgt.setFivePrime(convertCodeableConcept(src.getFivePrime())); + if (src.hasThreePrime()) + tgt.setThreePrime(convertCodeableConcept(src.getThreePrime())); + for (org.hl7.fhir.r5.model.SubstanceNucleicAcid.SubstanceNucleicAcidSubunitLinkageComponent t : src.getLinkage()) + tgt.addLinkage(convertSubstanceNucleicAcidSubunitLinkageComponent(t)); + for (org.hl7.fhir.r5.model.SubstanceNucleicAcid.SubstanceNucleicAcidSubunitSugarComponent t : src.getSugar()) + tgt.addSugar(convertSubstanceNucleicAcidSubunitSugarComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.SubstanceNucleicAcid.SubstanceNucleicAcidSubunitLinkageComponent convertSubstanceNucleicAcidSubunitLinkageComponent(org.hl7.fhir.r4.model.SubstanceNucleicAcid.SubstanceNucleicAcidSubunitLinkageComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.SubstanceNucleicAcid.SubstanceNucleicAcidSubunitLinkageComponent tgt = new org.hl7.fhir.r5.model.SubstanceNucleicAcid.SubstanceNucleicAcidSubunitLinkageComponent(); + copyElement(src, tgt); + if (src.hasConnectivity()) + tgt.setConnectivityElement(convertString(src.getConnectivityElement())); + if (src.hasIdentifier()) + tgt.setIdentifier(convertIdentifier(src.getIdentifier())); + if (src.hasName()) + tgt.setNameElement(convertString(src.getNameElement())); + if (src.hasResidueSite()) + tgt.setResidueSiteElement(convertString(src.getResidueSiteElement())); + return tgt; + } + + public static org.hl7.fhir.r4.model.SubstanceNucleicAcid.SubstanceNucleicAcidSubunitLinkageComponent convertSubstanceNucleicAcidSubunitLinkageComponent(org.hl7.fhir.r5.model.SubstanceNucleicAcid.SubstanceNucleicAcidSubunitLinkageComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.SubstanceNucleicAcid.SubstanceNucleicAcidSubunitLinkageComponent tgt = new org.hl7.fhir.r4.model.SubstanceNucleicAcid.SubstanceNucleicAcidSubunitLinkageComponent(); + copyElement(src, tgt); + if (src.hasConnectivity()) + tgt.setConnectivityElement(convertString(src.getConnectivityElement())); + if (src.hasIdentifier()) + tgt.setIdentifier(convertIdentifier(src.getIdentifier())); + if (src.hasName()) + tgt.setNameElement(convertString(src.getNameElement())); + if (src.hasResidueSite()) + tgt.setResidueSiteElement(convertString(src.getResidueSiteElement())); + return tgt; + } + + public static org.hl7.fhir.r5.model.SubstanceNucleicAcid.SubstanceNucleicAcidSubunitSugarComponent convertSubstanceNucleicAcidSubunitSugarComponent(org.hl7.fhir.r4.model.SubstanceNucleicAcid.SubstanceNucleicAcidSubunitSugarComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.SubstanceNucleicAcid.SubstanceNucleicAcidSubunitSugarComponent tgt = new org.hl7.fhir.r5.model.SubstanceNucleicAcid.SubstanceNucleicAcidSubunitSugarComponent(); + copyElement(src, tgt); + if (src.hasIdentifier()) + tgt.setIdentifier(convertIdentifier(src.getIdentifier())); + if (src.hasName()) + tgt.setNameElement(convertString(src.getNameElement())); + if (src.hasResidueSite()) + tgt.setResidueSiteElement(convertString(src.getResidueSiteElement())); + return tgt; + } + + public static org.hl7.fhir.r4.model.SubstanceNucleicAcid.SubstanceNucleicAcidSubunitSugarComponent convertSubstanceNucleicAcidSubunitSugarComponent(org.hl7.fhir.r5.model.SubstanceNucleicAcid.SubstanceNucleicAcidSubunitSugarComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.SubstanceNucleicAcid.SubstanceNucleicAcidSubunitSugarComponent tgt = new org.hl7.fhir.r4.model.SubstanceNucleicAcid.SubstanceNucleicAcidSubunitSugarComponent(); + copyElement(src, tgt); + if (src.hasIdentifier()) + tgt.setIdentifier(convertIdentifier(src.getIdentifier())); + if (src.hasName()) + tgt.setNameElement(convertString(src.getNameElement())); + if (src.hasResidueSite()) + tgt.setResidueSiteElement(convertString(src.getResidueSiteElement())); + return tgt; + } + + +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/SubstancePolymer.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/SubstancePolymer.java new file mode 100644 index 000000000..b28087df3 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/SubstancePolymer.java @@ -0,0 +1,259 @@ +package org.hl7.fhir.convertors.conv40_50; + +import org.hl7.fhir.exceptions.FHIRException; + +import org.hl7.fhir.convertors.VersionConvertor_40_50; + + +/* + Copyright (c) 2011+, HL7, Inc. + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of HL7 nor the names of its contributors may be used to + endorse or promote products derived from this software without specific + prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + +*/ + +// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0 + + +public class SubstancePolymer extends VersionConvertor_40_50 { + + public static org.hl7.fhir.r5.model.SubstancePolymer convertSubstancePolymer(org.hl7.fhir.r4.model.SubstancePolymer src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.SubstancePolymer tgt = new org.hl7.fhir.r5.model.SubstancePolymer(); + copyDomainResource(src, tgt); + if (src.hasClass_()) + tgt.setClass_(convertCodeableConcept(src.getClass_())); + if (src.hasGeometry()) + tgt.setGeometry(convertCodeableConcept(src.getGeometry())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getCopolymerConnectivity()) + tgt.addCopolymerConnectivity(convertCodeableConcept(t)); + for (org.hl7.fhir.r4.model.StringType t : src.getModification()) + tgt.getModification().add(convertString(t)); + for (org.hl7.fhir.r4.model.SubstancePolymer.SubstancePolymerMonomerSetComponent t : src.getMonomerSet()) + tgt.addMonomerSet(convertSubstancePolymerMonomerSetComponent(t)); + for (org.hl7.fhir.r4.model.SubstancePolymer.SubstancePolymerRepeatComponent t : src.getRepeat()) + tgt.addRepeat(convertSubstancePolymerRepeatComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.SubstancePolymer convertSubstancePolymer(org.hl7.fhir.r5.model.SubstancePolymer src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.SubstancePolymer tgt = new org.hl7.fhir.r4.model.SubstancePolymer(); + copyDomainResource(src, tgt); + if (src.hasClass_()) + tgt.setClass_(convertCodeableConcept(src.getClass_())); + if (src.hasGeometry()) + tgt.setGeometry(convertCodeableConcept(src.getGeometry())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getCopolymerConnectivity()) + tgt.addCopolymerConnectivity(convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.StringType t : src.getModification()) + tgt.getModification().add(convertString(t)); + for (org.hl7.fhir.r5.model.SubstancePolymer.SubstancePolymerMonomerSetComponent t : src.getMonomerSet()) + tgt.addMonomerSet(convertSubstancePolymerMonomerSetComponent(t)); + for (org.hl7.fhir.r5.model.SubstancePolymer.SubstancePolymerRepeatComponent t : src.getRepeat()) + tgt.addRepeat(convertSubstancePolymerRepeatComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.SubstancePolymer.SubstancePolymerMonomerSetComponent convertSubstancePolymerMonomerSetComponent(org.hl7.fhir.r4.model.SubstancePolymer.SubstancePolymerMonomerSetComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.SubstancePolymer.SubstancePolymerMonomerSetComponent tgt = new org.hl7.fhir.r5.model.SubstancePolymer.SubstancePolymerMonomerSetComponent(); + copyElement(src, tgt); + if (src.hasRatioType()) + tgt.setRatioType(convertCodeableConcept(src.getRatioType())); + for (org.hl7.fhir.r4.model.SubstancePolymer.SubstancePolymerMonomerSetStartingMaterialComponent t : src.getStartingMaterial()) + tgt.addStartingMaterial(convertSubstancePolymerMonomerSetStartingMaterialComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.SubstancePolymer.SubstancePolymerMonomerSetComponent convertSubstancePolymerMonomerSetComponent(org.hl7.fhir.r5.model.SubstancePolymer.SubstancePolymerMonomerSetComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.SubstancePolymer.SubstancePolymerMonomerSetComponent tgt = new org.hl7.fhir.r4.model.SubstancePolymer.SubstancePolymerMonomerSetComponent(); + copyElement(src, tgt); + if (src.hasRatioType()) + tgt.setRatioType(convertCodeableConcept(src.getRatioType())); + for (org.hl7.fhir.r5.model.SubstancePolymer.SubstancePolymerMonomerSetStartingMaterialComponent t : src.getStartingMaterial()) + tgt.addStartingMaterial(convertSubstancePolymerMonomerSetStartingMaterialComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.SubstancePolymer.SubstancePolymerMonomerSetStartingMaterialComponent convertSubstancePolymerMonomerSetStartingMaterialComponent(org.hl7.fhir.r4.model.SubstancePolymer.SubstancePolymerMonomerSetStartingMaterialComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.SubstancePolymer.SubstancePolymerMonomerSetStartingMaterialComponent tgt = new org.hl7.fhir.r5.model.SubstancePolymer.SubstancePolymerMonomerSetStartingMaterialComponent(); + copyElement(src, tgt); + if (src.hasMaterial()) + tgt.setMaterial(convertCodeableConcept(src.getMaterial())); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + if (src.hasIsDefining()) + tgt.setIsDefiningElement(convertBoolean(src.getIsDefiningElement())); + if (src.hasAmount()) + tgt.setAmount(convertSubstanceAmount(src.getAmount())); + return tgt; + } + + public static org.hl7.fhir.r4.model.SubstancePolymer.SubstancePolymerMonomerSetStartingMaterialComponent convertSubstancePolymerMonomerSetStartingMaterialComponent(org.hl7.fhir.r5.model.SubstancePolymer.SubstancePolymerMonomerSetStartingMaterialComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.SubstancePolymer.SubstancePolymerMonomerSetStartingMaterialComponent tgt = new org.hl7.fhir.r4.model.SubstancePolymer.SubstancePolymerMonomerSetStartingMaterialComponent(); + copyElement(src, tgt); + if (src.hasMaterial()) + tgt.setMaterial(convertCodeableConcept(src.getMaterial())); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + if (src.hasIsDefining()) + tgt.setIsDefiningElement(convertBoolean(src.getIsDefiningElement())); + if (src.hasAmount()) + tgt.setAmount(convertSubstanceAmount(src.getAmount())); + return tgt; + } + + public static org.hl7.fhir.r5.model.SubstancePolymer.SubstancePolymerRepeatComponent convertSubstancePolymerRepeatComponent(org.hl7.fhir.r4.model.SubstancePolymer.SubstancePolymerRepeatComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.SubstancePolymer.SubstancePolymerRepeatComponent tgt = new org.hl7.fhir.r5.model.SubstancePolymer.SubstancePolymerRepeatComponent(); + copyElement(src, tgt); + if (src.hasNumberOfUnits()) + tgt.setNumberOfUnitsElement(convertInteger(src.getNumberOfUnitsElement())); + if (src.hasAverageMolecularFormula()) + tgt.setAverageMolecularFormulaElement(convertString(src.getAverageMolecularFormulaElement())); + if (src.hasRepeatUnitAmountType()) + tgt.setRepeatUnitAmountType(convertCodeableConcept(src.getRepeatUnitAmountType())); + for (org.hl7.fhir.r4.model.SubstancePolymer.SubstancePolymerRepeatRepeatUnitComponent t : src.getRepeatUnit()) + tgt.addRepeatUnit(convertSubstancePolymerRepeatRepeatUnitComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.SubstancePolymer.SubstancePolymerRepeatComponent convertSubstancePolymerRepeatComponent(org.hl7.fhir.r5.model.SubstancePolymer.SubstancePolymerRepeatComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.SubstancePolymer.SubstancePolymerRepeatComponent tgt = new org.hl7.fhir.r4.model.SubstancePolymer.SubstancePolymerRepeatComponent(); + copyElement(src, tgt); + if (src.hasNumberOfUnits()) + tgt.setNumberOfUnitsElement(convertInteger(src.getNumberOfUnitsElement())); + if (src.hasAverageMolecularFormula()) + tgt.setAverageMolecularFormulaElement(convertString(src.getAverageMolecularFormulaElement())); + if (src.hasRepeatUnitAmountType()) + tgt.setRepeatUnitAmountType(convertCodeableConcept(src.getRepeatUnitAmountType())); + for (org.hl7.fhir.r5.model.SubstancePolymer.SubstancePolymerRepeatRepeatUnitComponent t : src.getRepeatUnit()) + tgt.addRepeatUnit(convertSubstancePolymerRepeatRepeatUnitComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.SubstancePolymer.SubstancePolymerRepeatRepeatUnitComponent convertSubstancePolymerRepeatRepeatUnitComponent(org.hl7.fhir.r4.model.SubstancePolymer.SubstancePolymerRepeatRepeatUnitComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.SubstancePolymer.SubstancePolymerRepeatRepeatUnitComponent tgt = new org.hl7.fhir.r5.model.SubstancePolymer.SubstancePolymerRepeatRepeatUnitComponent(); + copyElement(src, tgt); + if (src.hasOrientationOfPolymerisation()) + tgt.setOrientationOfPolymerisation(convertCodeableConcept(src.getOrientationOfPolymerisation())); + if (src.hasRepeatUnit()) + tgt.setRepeatUnitElement(convertString(src.getRepeatUnitElement())); + if (src.hasAmount()) + tgt.setAmount(convertSubstanceAmount(src.getAmount())); + for (org.hl7.fhir.r4.model.SubstancePolymer.SubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponent t : src.getDegreeOfPolymerisation()) + tgt.addDegreeOfPolymerisation(convertSubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponent(t)); + for (org.hl7.fhir.r4.model.SubstancePolymer.SubstancePolymerRepeatRepeatUnitStructuralRepresentationComponent t : src.getStructuralRepresentation()) + tgt.addStructuralRepresentation(convertSubstancePolymerRepeatRepeatUnitStructuralRepresentationComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.SubstancePolymer.SubstancePolymerRepeatRepeatUnitComponent convertSubstancePolymerRepeatRepeatUnitComponent(org.hl7.fhir.r5.model.SubstancePolymer.SubstancePolymerRepeatRepeatUnitComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.SubstancePolymer.SubstancePolymerRepeatRepeatUnitComponent tgt = new org.hl7.fhir.r4.model.SubstancePolymer.SubstancePolymerRepeatRepeatUnitComponent(); + copyElement(src, tgt); + if (src.hasOrientationOfPolymerisation()) + tgt.setOrientationOfPolymerisation(convertCodeableConcept(src.getOrientationOfPolymerisation())); + if (src.hasRepeatUnit()) + tgt.setRepeatUnitElement(convertString(src.getRepeatUnitElement())); + if (src.hasAmount()) + tgt.setAmount(convertSubstanceAmount(src.getAmount())); + for (org.hl7.fhir.r5.model.SubstancePolymer.SubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponent t : src.getDegreeOfPolymerisation()) + tgt.addDegreeOfPolymerisation(convertSubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponent(t)); + for (org.hl7.fhir.r5.model.SubstancePolymer.SubstancePolymerRepeatRepeatUnitStructuralRepresentationComponent t : src.getStructuralRepresentation()) + tgt.addStructuralRepresentation(convertSubstancePolymerRepeatRepeatUnitStructuralRepresentationComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.SubstancePolymer.SubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponent convertSubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponent(org.hl7.fhir.r4.model.SubstancePolymer.SubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.SubstancePolymer.SubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponent tgt = new org.hl7.fhir.r5.model.SubstancePolymer.SubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponent(); + copyElement(src, tgt); + if (src.hasDegree()) + tgt.setDegree(convertCodeableConcept(src.getDegree())); + if (src.hasAmount()) + tgt.setAmount(convertSubstanceAmount(src.getAmount())); + return tgt; + } + + public static org.hl7.fhir.r4.model.SubstancePolymer.SubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponent convertSubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponent(org.hl7.fhir.r5.model.SubstancePolymer.SubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.SubstancePolymer.SubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponent tgt = new org.hl7.fhir.r4.model.SubstancePolymer.SubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponent(); + copyElement(src, tgt); + if (src.hasDegree()) + tgt.setDegree(convertCodeableConcept(src.getDegree())); + if (src.hasAmount()) + tgt.setAmount(convertSubstanceAmount(src.getAmount())); + return tgt; + } + + public static org.hl7.fhir.r5.model.SubstancePolymer.SubstancePolymerRepeatRepeatUnitStructuralRepresentationComponent convertSubstancePolymerRepeatRepeatUnitStructuralRepresentationComponent(org.hl7.fhir.r4.model.SubstancePolymer.SubstancePolymerRepeatRepeatUnitStructuralRepresentationComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.SubstancePolymer.SubstancePolymerRepeatRepeatUnitStructuralRepresentationComponent tgt = new org.hl7.fhir.r5.model.SubstancePolymer.SubstancePolymerRepeatRepeatUnitStructuralRepresentationComponent(); + copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + if (src.hasRepresentation()) + tgt.setRepresentationElement(convertString(src.getRepresentationElement())); + if (src.hasAttachment()) + tgt.setAttachment(convertAttachment(src.getAttachment())); + return tgt; + } + + public static org.hl7.fhir.r4.model.SubstancePolymer.SubstancePolymerRepeatRepeatUnitStructuralRepresentationComponent convertSubstancePolymerRepeatRepeatUnitStructuralRepresentationComponent(org.hl7.fhir.r5.model.SubstancePolymer.SubstancePolymerRepeatRepeatUnitStructuralRepresentationComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.SubstancePolymer.SubstancePolymerRepeatRepeatUnitStructuralRepresentationComponent tgt = new org.hl7.fhir.r4.model.SubstancePolymer.SubstancePolymerRepeatRepeatUnitStructuralRepresentationComponent(); + copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + if (src.hasRepresentation()) + tgt.setRepresentationElement(convertString(src.getRepresentationElement())); + if (src.hasAttachment()) + tgt.setAttachment(convertAttachment(src.getAttachment())); + return tgt; + } + + +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/SubstanceProtein.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/SubstanceProtein.java new file mode 100644 index 000000000..4a7f4b2b7 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/SubstanceProtein.java @@ -0,0 +1,123 @@ +package org.hl7.fhir.convertors.conv40_50; + +import org.hl7.fhir.exceptions.FHIRException; + +import org.hl7.fhir.convertors.VersionConvertor_40_50; + + +/* + Copyright (c) 2011+, HL7, Inc. + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of HL7 nor the names of its contributors may be used to + endorse or promote products derived from this software without specific + prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + +*/ + +// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0 + + +public class SubstanceProtein extends VersionConvertor_40_50 { + + public static org.hl7.fhir.r5.model.SubstanceProtein convertSubstanceProtein(org.hl7.fhir.r4.model.SubstanceProtein src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.SubstanceProtein tgt = new org.hl7.fhir.r5.model.SubstanceProtein(); + copyDomainResource(src, tgt); + if (src.hasSequenceType()) + tgt.setSequenceType(convertCodeableConcept(src.getSequenceType())); + if (src.hasNumberOfSubunits()) + tgt.setNumberOfSubunitsElement(convertInteger(src.getNumberOfSubunitsElement())); + for (org.hl7.fhir.r4.model.StringType t : src.getDisulfideLinkage()) + tgt.getDisulfideLinkage().add(convertString(t)); + for (org.hl7.fhir.r4.model.SubstanceProtein.SubstanceProteinSubunitComponent t : src.getSubunit()) + tgt.addSubunit(convertSubstanceProteinSubunitComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.SubstanceProtein convertSubstanceProtein(org.hl7.fhir.r5.model.SubstanceProtein src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.SubstanceProtein tgt = new org.hl7.fhir.r4.model.SubstanceProtein(); + copyDomainResource(src, tgt); + if (src.hasSequenceType()) + tgt.setSequenceType(convertCodeableConcept(src.getSequenceType())); + if (src.hasNumberOfSubunits()) + tgt.setNumberOfSubunitsElement(convertInteger(src.getNumberOfSubunitsElement())); + for (org.hl7.fhir.r5.model.StringType t : src.getDisulfideLinkage()) + tgt.getDisulfideLinkage().add(convertString(t)); + for (org.hl7.fhir.r5.model.SubstanceProtein.SubstanceProteinSubunitComponent t : src.getSubunit()) + tgt.addSubunit(convertSubstanceProteinSubunitComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.SubstanceProtein.SubstanceProteinSubunitComponent convertSubstanceProteinSubunitComponent(org.hl7.fhir.r4.model.SubstanceProtein.SubstanceProteinSubunitComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.SubstanceProtein.SubstanceProteinSubunitComponent tgt = new org.hl7.fhir.r5.model.SubstanceProtein.SubstanceProteinSubunitComponent(); + copyElement(src, tgt); + if (src.hasSubunit()) + tgt.setSubunitElement(convertInteger(src.getSubunitElement())); + if (src.hasSequence()) + tgt.setSequenceElement(convertString(src.getSequenceElement())); + if (src.hasLength()) + tgt.setLengthElement(convertInteger(src.getLengthElement())); + if (src.hasSequenceAttachment()) + tgt.setSequenceAttachment(convertAttachment(src.getSequenceAttachment())); + if (src.hasNTerminalModificationId()) + tgt.setNTerminalModificationId(convertIdentifier(src.getNTerminalModificationId())); + if (src.hasNTerminalModification()) + tgt.setNTerminalModificationElement(convertString(src.getNTerminalModificationElement())); + if (src.hasCTerminalModificationId()) + tgt.setCTerminalModificationId(convertIdentifier(src.getCTerminalModificationId())); + if (src.hasCTerminalModification()) + tgt.setCTerminalModificationElement(convertString(src.getCTerminalModificationElement())); + return tgt; + } + + public static org.hl7.fhir.r4.model.SubstanceProtein.SubstanceProteinSubunitComponent convertSubstanceProteinSubunitComponent(org.hl7.fhir.r5.model.SubstanceProtein.SubstanceProteinSubunitComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.SubstanceProtein.SubstanceProteinSubunitComponent tgt = new org.hl7.fhir.r4.model.SubstanceProtein.SubstanceProteinSubunitComponent(); + copyElement(src, tgt); + if (src.hasSubunit()) + tgt.setSubunitElement(convertInteger(src.getSubunitElement())); + if (src.hasSequence()) + tgt.setSequenceElement(convertString(src.getSequenceElement())); + if (src.hasLength()) + tgt.setLengthElement(convertInteger(src.getLengthElement())); + if (src.hasSequenceAttachment()) + tgt.setSequenceAttachment(convertAttachment(src.getSequenceAttachment())); + if (src.hasNTerminalModificationId()) + tgt.setNTerminalModificationId(convertIdentifier(src.getNTerminalModificationId())); + if (src.hasNTerminalModification()) + tgt.setNTerminalModificationElement(convertString(src.getNTerminalModificationElement())); + if (src.hasCTerminalModificationId()) + tgt.setCTerminalModificationId(convertIdentifier(src.getCTerminalModificationId())); + if (src.hasCTerminalModification()) + tgt.setCTerminalModificationElement(convertString(src.getCTerminalModificationElement())); + return tgt; + } + + +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/SubstanceReferenceInformation.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/SubstanceReferenceInformation.java new file mode 100644 index 000000000..e04477248 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/SubstanceReferenceInformation.java @@ -0,0 +1,215 @@ +package org.hl7.fhir.convertors.conv40_50; + +import org.hl7.fhir.exceptions.FHIRException; + +import org.hl7.fhir.convertors.VersionConvertor_40_50; + + +/* + Copyright (c) 2011+, HL7, Inc. + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of HL7 nor the names of its contributors may be used to + endorse or promote products derived from this software without specific + prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + +*/ + +// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0 + + +public class SubstanceReferenceInformation extends VersionConvertor_40_50 { + + public static org.hl7.fhir.r5.model.SubstanceReferenceInformation convertSubstanceReferenceInformation(org.hl7.fhir.r4.model.SubstanceReferenceInformation src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.SubstanceReferenceInformation tgt = new org.hl7.fhir.r5.model.SubstanceReferenceInformation(); + copyDomainResource(src, tgt); + if (src.hasComment()) + tgt.setCommentElement(convertString(src.getCommentElement())); + for (org.hl7.fhir.r4.model.SubstanceReferenceInformation.SubstanceReferenceInformationGeneComponent t : src.getGene()) + tgt.addGene(convertSubstanceReferenceInformationGeneComponent(t)); + for (org.hl7.fhir.r4.model.SubstanceReferenceInformation.SubstanceReferenceInformationGeneElementComponent t : src.getGeneElement()) + tgt.addGeneElement(convertSubstanceReferenceInformationGeneElementComponent(t)); + for (org.hl7.fhir.r4.model.SubstanceReferenceInformation.SubstanceReferenceInformationClassificationComponent t : src.getClassification()) + tgt.addClassification(convertSubstanceReferenceInformationClassificationComponent(t)); + for (org.hl7.fhir.r4.model.SubstanceReferenceInformation.SubstanceReferenceInformationTargetComponent t : src.getTarget()) + tgt.addTarget(convertSubstanceReferenceInformationTargetComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.SubstanceReferenceInformation convertSubstanceReferenceInformation(org.hl7.fhir.r5.model.SubstanceReferenceInformation src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.SubstanceReferenceInformation tgt = new org.hl7.fhir.r4.model.SubstanceReferenceInformation(); + copyDomainResource(src, tgt); + if (src.hasComment()) + tgt.setCommentElement(convertString(src.getCommentElement())); + for (org.hl7.fhir.r5.model.SubstanceReferenceInformation.SubstanceReferenceInformationGeneComponent t : src.getGene()) + tgt.addGene(convertSubstanceReferenceInformationGeneComponent(t)); + for (org.hl7.fhir.r5.model.SubstanceReferenceInformation.SubstanceReferenceInformationGeneElementComponent t : src.getGeneElement()) + tgt.addGeneElement(convertSubstanceReferenceInformationGeneElementComponent(t)); + for (org.hl7.fhir.r5.model.SubstanceReferenceInformation.SubstanceReferenceInformationClassificationComponent t : src.getClassification()) + tgt.addClassification(convertSubstanceReferenceInformationClassificationComponent(t)); + for (org.hl7.fhir.r5.model.SubstanceReferenceInformation.SubstanceReferenceInformationTargetComponent t : src.getTarget()) + tgt.addTarget(convertSubstanceReferenceInformationTargetComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.SubstanceReferenceInformation.SubstanceReferenceInformationGeneComponent convertSubstanceReferenceInformationGeneComponent(org.hl7.fhir.r4.model.SubstanceReferenceInformation.SubstanceReferenceInformationGeneComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.SubstanceReferenceInformation.SubstanceReferenceInformationGeneComponent tgt = new org.hl7.fhir.r5.model.SubstanceReferenceInformation.SubstanceReferenceInformationGeneComponent(); + copyElement(src, tgt); + if (src.hasGeneSequenceOrigin()) + tgt.setGeneSequenceOrigin(convertCodeableConcept(src.getGeneSequenceOrigin())); + if (src.hasGene()) + tgt.setGene(convertCodeableConcept(src.getGene())); + for (org.hl7.fhir.r4.model.Reference t : src.getSource()) + tgt.addSource(convertReference(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.SubstanceReferenceInformation.SubstanceReferenceInformationGeneComponent convertSubstanceReferenceInformationGeneComponent(org.hl7.fhir.r5.model.SubstanceReferenceInformation.SubstanceReferenceInformationGeneComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.SubstanceReferenceInformation.SubstanceReferenceInformationGeneComponent tgt = new org.hl7.fhir.r4.model.SubstanceReferenceInformation.SubstanceReferenceInformationGeneComponent(); + copyElement(src, tgt); + if (src.hasGeneSequenceOrigin()) + tgt.setGeneSequenceOrigin(convertCodeableConcept(src.getGeneSequenceOrigin())); + if (src.hasGene()) + tgt.setGene(convertCodeableConcept(src.getGene())); + for (org.hl7.fhir.r5.model.Reference t : src.getSource()) + tgt.addSource(convertReference(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.SubstanceReferenceInformation.SubstanceReferenceInformationGeneElementComponent convertSubstanceReferenceInformationGeneElementComponent(org.hl7.fhir.r4.model.SubstanceReferenceInformation.SubstanceReferenceInformationGeneElementComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.SubstanceReferenceInformation.SubstanceReferenceInformationGeneElementComponent tgt = new org.hl7.fhir.r5.model.SubstanceReferenceInformation.SubstanceReferenceInformationGeneElementComponent(); + copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + if (src.hasElement()) + tgt.setElement(convertIdentifier(src.getElement())); + for (org.hl7.fhir.r4.model.Reference t : src.getSource()) + tgt.addSource(convertReference(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.SubstanceReferenceInformation.SubstanceReferenceInformationGeneElementComponent convertSubstanceReferenceInformationGeneElementComponent(org.hl7.fhir.r5.model.SubstanceReferenceInformation.SubstanceReferenceInformationGeneElementComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.SubstanceReferenceInformation.SubstanceReferenceInformationGeneElementComponent tgt = new org.hl7.fhir.r4.model.SubstanceReferenceInformation.SubstanceReferenceInformationGeneElementComponent(); + copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + if (src.hasElement()) + tgt.setElement(convertIdentifier(src.getElement())); + for (org.hl7.fhir.r5.model.Reference t : src.getSource()) + tgt.addSource(convertReference(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.SubstanceReferenceInformation.SubstanceReferenceInformationClassificationComponent convertSubstanceReferenceInformationClassificationComponent(org.hl7.fhir.r4.model.SubstanceReferenceInformation.SubstanceReferenceInformationClassificationComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.SubstanceReferenceInformation.SubstanceReferenceInformationClassificationComponent tgt = new org.hl7.fhir.r5.model.SubstanceReferenceInformation.SubstanceReferenceInformationClassificationComponent(); + copyElement(src, tgt); + if (src.hasDomain()) + tgt.setDomain(convertCodeableConcept(src.getDomain())); + if (src.hasClassification()) + tgt.setClassification(convertCodeableConcept(src.getClassification())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getSubtype()) + tgt.addSubtype(convertCodeableConcept(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getSource()) + tgt.addSource(convertReference(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.SubstanceReferenceInformation.SubstanceReferenceInformationClassificationComponent convertSubstanceReferenceInformationClassificationComponent(org.hl7.fhir.r5.model.SubstanceReferenceInformation.SubstanceReferenceInformationClassificationComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.SubstanceReferenceInformation.SubstanceReferenceInformationClassificationComponent tgt = new org.hl7.fhir.r4.model.SubstanceReferenceInformation.SubstanceReferenceInformationClassificationComponent(); + copyElement(src, tgt); + if (src.hasDomain()) + tgt.setDomain(convertCodeableConcept(src.getDomain())); + if (src.hasClassification()) + tgt.setClassification(convertCodeableConcept(src.getClassification())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getSubtype()) + tgt.addSubtype(convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getSource()) + tgt.addSource(convertReference(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.SubstanceReferenceInformation.SubstanceReferenceInformationTargetComponent convertSubstanceReferenceInformationTargetComponent(org.hl7.fhir.r4.model.SubstanceReferenceInformation.SubstanceReferenceInformationTargetComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.SubstanceReferenceInformation.SubstanceReferenceInformationTargetComponent tgt = new org.hl7.fhir.r5.model.SubstanceReferenceInformation.SubstanceReferenceInformationTargetComponent(); + copyElement(src, tgt); + if (src.hasTarget()) + tgt.setTarget(convertIdentifier(src.getTarget())); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + if (src.hasInteraction()) + tgt.setInteraction(convertCodeableConcept(src.getInteraction())); + if (src.hasOrganism()) + tgt.setOrganism(convertCodeableConcept(src.getOrganism())); + if (src.hasOrganismType()) + tgt.setOrganismType(convertCodeableConcept(src.getOrganismType())); + if (src.hasAmount()) + tgt.setAmount(convertType(src.getAmount())); + if (src.hasAmountType()) + tgt.setAmountType(convertCodeableConcept(src.getAmountType())); + for (org.hl7.fhir.r4.model.Reference t : src.getSource()) + tgt.addSource(convertReference(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.SubstanceReferenceInformation.SubstanceReferenceInformationTargetComponent convertSubstanceReferenceInformationTargetComponent(org.hl7.fhir.r5.model.SubstanceReferenceInformation.SubstanceReferenceInformationTargetComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.SubstanceReferenceInformation.SubstanceReferenceInformationTargetComponent tgt = new org.hl7.fhir.r4.model.SubstanceReferenceInformation.SubstanceReferenceInformationTargetComponent(); + copyElement(src, tgt); + if (src.hasTarget()) + tgt.setTarget(convertIdentifier(src.getTarget())); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + if (src.hasInteraction()) + tgt.setInteraction(convertCodeableConcept(src.getInteraction())); + if (src.hasOrganism()) + tgt.setOrganism(convertCodeableConcept(src.getOrganism())); + if (src.hasOrganismType()) + tgt.setOrganismType(convertCodeableConcept(src.getOrganismType())); + if (src.hasAmount()) + tgt.setAmount(convertType(src.getAmount())); + if (src.hasAmountType()) + tgt.setAmountType(convertCodeableConcept(src.getAmountType())); + for (org.hl7.fhir.r5.model.Reference t : src.getSource()) + tgt.addSource(convertReference(t)); + return tgt; + } + + +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/SubstanceSourceMaterial.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/SubstanceSourceMaterial.java new file mode 100644 index 000000000..3904ca141 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/SubstanceSourceMaterial.java @@ -0,0 +1,299 @@ +package org.hl7.fhir.convertors.conv40_50; + +import org.hl7.fhir.exceptions.FHIRException; + +import org.hl7.fhir.convertors.VersionConvertor_40_50; + + +/* + Copyright (c) 2011+, HL7, Inc. + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of HL7 nor the names of its contributors may be used to + endorse or promote products derived from this software without specific + prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + +*/ + +// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0 + + +public class SubstanceSourceMaterial extends VersionConvertor_40_50 { + + public static org.hl7.fhir.r5.model.SubstanceSourceMaterial convertSubstanceSourceMaterial(org.hl7.fhir.r4.model.SubstanceSourceMaterial src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.SubstanceSourceMaterial tgt = new org.hl7.fhir.r5.model.SubstanceSourceMaterial(); + copyDomainResource(src, tgt); + if (src.hasSourceMaterialClass()) + tgt.setSourceMaterialClass(convertCodeableConcept(src.getSourceMaterialClass())); + if (src.hasSourceMaterialType()) + tgt.setSourceMaterialType(convertCodeableConcept(src.getSourceMaterialType())); + if (src.hasSourceMaterialState()) + tgt.setSourceMaterialState(convertCodeableConcept(src.getSourceMaterialState())); + if (src.hasOrganismId()) + tgt.setOrganismId(convertIdentifier(src.getOrganismId())); + if (src.hasOrganismName()) + tgt.setOrganismNameElement(convertString(src.getOrganismNameElement())); + for (org.hl7.fhir.r4.model.Identifier t : src.getParentSubstanceId()) + tgt.addParentSubstanceId(convertIdentifier(t)); + for (org.hl7.fhir.r4.model.StringType t : src.getParentSubstanceName()) + tgt.getParentSubstanceName().add(convertString(t)); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getCountryOfOrigin()) + tgt.addCountryOfOrigin(convertCodeableConcept(t)); + for (org.hl7.fhir.r4.model.StringType t : src.getGeographicalLocation()) + tgt.getGeographicalLocation().add(convertString(t)); + if (src.hasDevelopmentStage()) + tgt.setDevelopmentStage(convertCodeableConcept(src.getDevelopmentStage())); + for (org.hl7.fhir.r4.model.SubstanceSourceMaterial.SubstanceSourceMaterialFractionDescriptionComponent t : src.getFractionDescription()) + tgt.addFractionDescription(convertSubstanceSourceMaterialFractionDescriptionComponent(t)); + if (src.hasOrganism()) + tgt.setOrganism(convertSubstanceSourceMaterialOrganismComponent(src.getOrganism())); + for (org.hl7.fhir.r4.model.SubstanceSourceMaterial.SubstanceSourceMaterialPartDescriptionComponent t : src.getPartDescription()) + tgt.addPartDescription(convertSubstanceSourceMaterialPartDescriptionComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.SubstanceSourceMaterial convertSubstanceSourceMaterial(org.hl7.fhir.r5.model.SubstanceSourceMaterial src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.SubstanceSourceMaterial tgt = new org.hl7.fhir.r4.model.SubstanceSourceMaterial(); + copyDomainResource(src, tgt); + if (src.hasSourceMaterialClass()) + tgt.setSourceMaterialClass(convertCodeableConcept(src.getSourceMaterialClass())); + if (src.hasSourceMaterialType()) + tgt.setSourceMaterialType(convertCodeableConcept(src.getSourceMaterialType())); + if (src.hasSourceMaterialState()) + tgt.setSourceMaterialState(convertCodeableConcept(src.getSourceMaterialState())); + if (src.hasOrganismId()) + tgt.setOrganismId(convertIdentifier(src.getOrganismId())); + if (src.hasOrganismName()) + tgt.setOrganismNameElement(convertString(src.getOrganismNameElement())); + for (org.hl7.fhir.r5.model.Identifier t : src.getParentSubstanceId()) + tgt.addParentSubstanceId(convertIdentifier(t)); + for (org.hl7.fhir.r5.model.StringType t : src.getParentSubstanceName()) + tgt.getParentSubstanceName().add(convertString(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getCountryOfOrigin()) + tgt.addCountryOfOrigin(convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.StringType t : src.getGeographicalLocation()) + tgt.getGeographicalLocation().add(convertString(t)); + if (src.hasDevelopmentStage()) + tgt.setDevelopmentStage(convertCodeableConcept(src.getDevelopmentStage())); + for (org.hl7.fhir.r5.model.SubstanceSourceMaterial.SubstanceSourceMaterialFractionDescriptionComponent t : src.getFractionDescription()) + tgt.addFractionDescription(convertSubstanceSourceMaterialFractionDescriptionComponent(t)); + if (src.hasOrganism()) + tgt.setOrganism(convertSubstanceSourceMaterialOrganismComponent(src.getOrganism())); + for (org.hl7.fhir.r5.model.SubstanceSourceMaterial.SubstanceSourceMaterialPartDescriptionComponent t : src.getPartDescription()) + tgt.addPartDescription(convertSubstanceSourceMaterialPartDescriptionComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.SubstanceSourceMaterial.SubstanceSourceMaterialFractionDescriptionComponent convertSubstanceSourceMaterialFractionDescriptionComponent(org.hl7.fhir.r4.model.SubstanceSourceMaterial.SubstanceSourceMaterialFractionDescriptionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.SubstanceSourceMaterial.SubstanceSourceMaterialFractionDescriptionComponent tgt = new org.hl7.fhir.r5.model.SubstanceSourceMaterial.SubstanceSourceMaterialFractionDescriptionComponent(); + copyElement(src, tgt); + if (src.hasFraction()) + tgt.setFractionElement(convertString(src.getFractionElement())); + if (src.hasMaterialType()) + tgt.setMaterialType(convertCodeableConcept(src.getMaterialType())); + return tgt; + } + + public static org.hl7.fhir.r4.model.SubstanceSourceMaterial.SubstanceSourceMaterialFractionDescriptionComponent convertSubstanceSourceMaterialFractionDescriptionComponent(org.hl7.fhir.r5.model.SubstanceSourceMaterial.SubstanceSourceMaterialFractionDescriptionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.SubstanceSourceMaterial.SubstanceSourceMaterialFractionDescriptionComponent tgt = new org.hl7.fhir.r4.model.SubstanceSourceMaterial.SubstanceSourceMaterialFractionDescriptionComponent(); + copyElement(src, tgt); + if (src.hasFraction()) + tgt.setFractionElement(convertString(src.getFractionElement())); + if (src.hasMaterialType()) + tgt.setMaterialType(convertCodeableConcept(src.getMaterialType())); + return tgt; + } + + public static org.hl7.fhir.r5.model.SubstanceSourceMaterial.SubstanceSourceMaterialOrganismComponent convertSubstanceSourceMaterialOrganismComponent(org.hl7.fhir.r4.model.SubstanceSourceMaterial.SubstanceSourceMaterialOrganismComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.SubstanceSourceMaterial.SubstanceSourceMaterialOrganismComponent tgt = new org.hl7.fhir.r5.model.SubstanceSourceMaterial.SubstanceSourceMaterialOrganismComponent(); + copyElement(src, tgt); + if (src.hasFamily()) + tgt.setFamily(convertCodeableConcept(src.getFamily())); + if (src.hasGenus()) + tgt.setGenus(convertCodeableConcept(src.getGenus())); + if (src.hasSpecies()) + tgt.setSpecies(convertCodeableConcept(src.getSpecies())); + if (src.hasIntraspecificType()) + tgt.setIntraspecificType(convertCodeableConcept(src.getIntraspecificType())); + if (src.hasIntraspecificDescription()) + tgt.setIntraspecificDescriptionElement(convertString(src.getIntraspecificDescriptionElement())); + for (org.hl7.fhir.r4.model.SubstanceSourceMaterial.SubstanceSourceMaterialOrganismAuthorComponent t : src.getAuthor()) + tgt.addAuthor(convertSubstanceSourceMaterialOrganismAuthorComponent(t)); + if (src.hasHybrid()) + tgt.setHybrid(convertSubstanceSourceMaterialOrganismHybridComponent(src.getHybrid())); + if (src.hasOrganismGeneral()) + tgt.setOrganismGeneral(convertSubstanceSourceMaterialOrganismOrganismGeneralComponent(src.getOrganismGeneral())); + return tgt; + } + + public static org.hl7.fhir.r4.model.SubstanceSourceMaterial.SubstanceSourceMaterialOrganismComponent convertSubstanceSourceMaterialOrganismComponent(org.hl7.fhir.r5.model.SubstanceSourceMaterial.SubstanceSourceMaterialOrganismComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.SubstanceSourceMaterial.SubstanceSourceMaterialOrganismComponent tgt = new org.hl7.fhir.r4.model.SubstanceSourceMaterial.SubstanceSourceMaterialOrganismComponent(); + copyElement(src, tgt); + if (src.hasFamily()) + tgt.setFamily(convertCodeableConcept(src.getFamily())); + if (src.hasGenus()) + tgt.setGenus(convertCodeableConcept(src.getGenus())); + if (src.hasSpecies()) + tgt.setSpecies(convertCodeableConcept(src.getSpecies())); + if (src.hasIntraspecificType()) + tgt.setIntraspecificType(convertCodeableConcept(src.getIntraspecificType())); + if (src.hasIntraspecificDescription()) + tgt.setIntraspecificDescriptionElement(convertString(src.getIntraspecificDescriptionElement())); + for (org.hl7.fhir.r5.model.SubstanceSourceMaterial.SubstanceSourceMaterialOrganismAuthorComponent t : src.getAuthor()) + tgt.addAuthor(convertSubstanceSourceMaterialOrganismAuthorComponent(t)); + if (src.hasHybrid()) + tgt.setHybrid(convertSubstanceSourceMaterialOrganismHybridComponent(src.getHybrid())); + if (src.hasOrganismGeneral()) + tgt.setOrganismGeneral(convertSubstanceSourceMaterialOrganismOrganismGeneralComponent(src.getOrganismGeneral())); + return tgt; + } + + public static org.hl7.fhir.r5.model.SubstanceSourceMaterial.SubstanceSourceMaterialOrganismAuthorComponent convertSubstanceSourceMaterialOrganismAuthorComponent(org.hl7.fhir.r4.model.SubstanceSourceMaterial.SubstanceSourceMaterialOrganismAuthorComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.SubstanceSourceMaterial.SubstanceSourceMaterialOrganismAuthorComponent tgt = new org.hl7.fhir.r5.model.SubstanceSourceMaterial.SubstanceSourceMaterialOrganismAuthorComponent(); + copyElement(src, tgt); + if (src.hasAuthorType()) + tgt.setAuthorType(convertCodeableConcept(src.getAuthorType())); + if (src.hasAuthorDescription()) + tgt.setAuthorDescriptionElement(convertString(src.getAuthorDescriptionElement())); + return tgt; + } + + public static org.hl7.fhir.r4.model.SubstanceSourceMaterial.SubstanceSourceMaterialOrganismAuthorComponent convertSubstanceSourceMaterialOrganismAuthorComponent(org.hl7.fhir.r5.model.SubstanceSourceMaterial.SubstanceSourceMaterialOrganismAuthorComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.SubstanceSourceMaterial.SubstanceSourceMaterialOrganismAuthorComponent tgt = new org.hl7.fhir.r4.model.SubstanceSourceMaterial.SubstanceSourceMaterialOrganismAuthorComponent(); + copyElement(src, tgt); + if (src.hasAuthorType()) + tgt.setAuthorType(convertCodeableConcept(src.getAuthorType())); + if (src.hasAuthorDescription()) + tgt.setAuthorDescriptionElement(convertString(src.getAuthorDescriptionElement())); + return tgt; + } + + public static org.hl7.fhir.r5.model.SubstanceSourceMaterial.SubstanceSourceMaterialOrganismHybridComponent convertSubstanceSourceMaterialOrganismHybridComponent(org.hl7.fhir.r4.model.SubstanceSourceMaterial.SubstanceSourceMaterialOrganismHybridComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.SubstanceSourceMaterial.SubstanceSourceMaterialOrganismHybridComponent tgt = new org.hl7.fhir.r5.model.SubstanceSourceMaterial.SubstanceSourceMaterialOrganismHybridComponent(); + copyElement(src, tgt); + if (src.hasMaternalOrganismId()) + tgt.setMaternalOrganismIdElement(convertString(src.getMaternalOrganismIdElement())); + if (src.hasMaternalOrganismName()) + tgt.setMaternalOrganismNameElement(convertString(src.getMaternalOrganismNameElement())); + if (src.hasPaternalOrganismId()) + tgt.setPaternalOrganismIdElement(convertString(src.getPaternalOrganismIdElement())); + if (src.hasPaternalOrganismName()) + tgt.setPaternalOrganismNameElement(convertString(src.getPaternalOrganismNameElement())); + if (src.hasHybridType()) + tgt.setHybridType(convertCodeableConcept(src.getHybridType())); + return tgt; + } + + public static org.hl7.fhir.r4.model.SubstanceSourceMaterial.SubstanceSourceMaterialOrganismHybridComponent convertSubstanceSourceMaterialOrganismHybridComponent(org.hl7.fhir.r5.model.SubstanceSourceMaterial.SubstanceSourceMaterialOrganismHybridComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.SubstanceSourceMaterial.SubstanceSourceMaterialOrganismHybridComponent tgt = new org.hl7.fhir.r4.model.SubstanceSourceMaterial.SubstanceSourceMaterialOrganismHybridComponent(); + copyElement(src, tgt); + if (src.hasMaternalOrganismId()) + tgt.setMaternalOrganismIdElement(convertString(src.getMaternalOrganismIdElement())); + if (src.hasMaternalOrganismName()) + tgt.setMaternalOrganismNameElement(convertString(src.getMaternalOrganismNameElement())); + if (src.hasPaternalOrganismId()) + tgt.setPaternalOrganismIdElement(convertString(src.getPaternalOrganismIdElement())); + if (src.hasPaternalOrganismName()) + tgt.setPaternalOrganismNameElement(convertString(src.getPaternalOrganismNameElement())); + if (src.hasHybridType()) + tgt.setHybridType(convertCodeableConcept(src.getHybridType())); + return tgt; + } + + public static org.hl7.fhir.r5.model.SubstanceSourceMaterial.SubstanceSourceMaterialOrganismOrganismGeneralComponent convertSubstanceSourceMaterialOrganismOrganismGeneralComponent(org.hl7.fhir.r4.model.SubstanceSourceMaterial.SubstanceSourceMaterialOrganismOrganismGeneralComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.SubstanceSourceMaterial.SubstanceSourceMaterialOrganismOrganismGeneralComponent tgt = new org.hl7.fhir.r5.model.SubstanceSourceMaterial.SubstanceSourceMaterialOrganismOrganismGeneralComponent(); + copyElement(src, tgt); + if (src.hasKingdom()) + tgt.setKingdom(convertCodeableConcept(src.getKingdom())); + if (src.hasPhylum()) + tgt.setPhylum(convertCodeableConcept(src.getPhylum())); + if (src.hasClass_()) + tgt.setClass_(convertCodeableConcept(src.getClass_())); + if (src.hasOrder()) + tgt.setOrder(convertCodeableConcept(src.getOrder())); + return tgt; + } + + public static org.hl7.fhir.r4.model.SubstanceSourceMaterial.SubstanceSourceMaterialOrganismOrganismGeneralComponent convertSubstanceSourceMaterialOrganismOrganismGeneralComponent(org.hl7.fhir.r5.model.SubstanceSourceMaterial.SubstanceSourceMaterialOrganismOrganismGeneralComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.SubstanceSourceMaterial.SubstanceSourceMaterialOrganismOrganismGeneralComponent tgt = new org.hl7.fhir.r4.model.SubstanceSourceMaterial.SubstanceSourceMaterialOrganismOrganismGeneralComponent(); + copyElement(src, tgt); + if (src.hasKingdom()) + tgt.setKingdom(convertCodeableConcept(src.getKingdom())); + if (src.hasPhylum()) + tgt.setPhylum(convertCodeableConcept(src.getPhylum())); + if (src.hasClass_()) + tgt.setClass_(convertCodeableConcept(src.getClass_())); + if (src.hasOrder()) + tgt.setOrder(convertCodeableConcept(src.getOrder())); + return tgt; + } + + public static org.hl7.fhir.r5.model.SubstanceSourceMaterial.SubstanceSourceMaterialPartDescriptionComponent convertSubstanceSourceMaterialPartDescriptionComponent(org.hl7.fhir.r4.model.SubstanceSourceMaterial.SubstanceSourceMaterialPartDescriptionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.SubstanceSourceMaterial.SubstanceSourceMaterialPartDescriptionComponent tgt = new org.hl7.fhir.r5.model.SubstanceSourceMaterial.SubstanceSourceMaterialPartDescriptionComponent(); + copyElement(src, tgt); + if (src.hasPart()) + tgt.setPart(convertCodeableConcept(src.getPart())); + if (src.hasPartLocation()) + tgt.setPartLocation(convertCodeableConcept(src.getPartLocation())); + return tgt; + } + + public static org.hl7.fhir.r4.model.SubstanceSourceMaterial.SubstanceSourceMaterialPartDescriptionComponent convertSubstanceSourceMaterialPartDescriptionComponent(org.hl7.fhir.r5.model.SubstanceSourceMaterial.SubstanceSourceMaterialPartDescriptionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.SubstanceSourceMaterial.SubstanceSourceMaterialPartDescriptionComponent tgt = new org.hl7.fhir.r4.model.SubstanceSourceMaterial.SubstanceSourceMaterialPartDescriptionComponent(); + copyElement(src, tgt); + if (src.hasPart()) + tgt.setPart(convertCodeableConcept(src.getPart())); + if (src.hasPartLocation()) + tgt.setPartLocation(convertCodeableConcept(src.getPartLocation())); + return tgt; + } + + +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/SubstanceSpecification.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/SubstanceSpecification.java new file mode 100644 index 000000000..a8b88d515 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/SubstanceSpecification.java @@ -0,0 +1,523 @@ +package org.hl7.fhir.convertors.conv40_50; + +import org.hl7.fhir.exceptions.FHIRException; + +import org.hl7.fhir.convertors.VersionConvertor_40_50; + + +/* + Copyright (c) 2011+, HL7, Inc. + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of HL7 nor the names of its contributors may be used to + endorse or promote products derived from this software without specific + prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + +*/ + +// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0 + + +public class SubstanceSpecification extends VersionConvertor_40_50 { + + public static org.hl7.fhir.r5.model.SubstanceSpecification convertSubstanceSpecification(org.hl7.fhir.r4.model.SubstanceSpecification src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.SubstanceSpecification tgt = new org.hl7.fhir.r5.model.SubstanceSpecification(); + copyDomainResource(src, tgt); + if (src.hasIdentifier()) + tgt.setIdentifier(convertIdentifier(src.getIdentifier())); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + if (src.hasStatus()) + tgt.setStatus(convertCodeableConcept(src.getStatus())); + if (src.hasDomain()) + tgt.setDomain(convertCodeableConcept(src.getDomain())); + if (src.hasDescription()) + tgt.setDescriptionElement(convertString(src.getDescriptionElement())); + for (org.hl7.fhir.r4.model.Reference t : src.getSource()) + tgt.addSource(convertReference(t)); + if (src.hasComment()) + tgt.setCommentElement(convertString(src.getCommentElement())); + for (org.hl7.fhir.r4.model.SubstanceSpecification.SubstanceSpecificationMoietyComponent t : src.getMoiety()) + tgt.addMoiety(convertSubstanceSpecificationMoietyComponent(t)); + for (org.hl7.fhir.r4.model.SubstanceSpecification.SubstanceSpecificationPropertyComponent t : src.getProperty()) + tgt.addProperty(convertSubstanceSpecificationPropertyComponent(t)); + if (src.hasReferenceInformation()) + tgt.setReferenceInformation(convertReference(src.getReferenceInformation())); + if (src.hasStructure()) + tgt.setStructure(convertSubstanceSpecificationStructureComponent(src.getStructure())); + for (org.hl7.fhir.r4.model.SubstanceSpecification.SubstanceSpecificationCodeComponent t : src.getCode()) + tgt.addCode(convertSubstanceSpecificationCodeComponent(t)); + for (org.hl7.fhir.r4.model.SubstanceSpecification.SubstanceSpecificationNameComponent t : src.getName()) + tgt.addName(convertSubstanceSpecificationNameComponent(t)); + for (org.hl7.fhir.r4.model.SubstanceSpecification.SubstanceSpecificationStructureIsotopeMolecularWeightComponent t : src.getMolecularWeight()) + tgt.addMolecularWeight(convertSubstanceSpecificationStructureIsotopeMolecularWeightComponent(t)); + for (org.hl7.fhir.r4.model.SubstanceSpecification.SubstanceSpecificationRelationshipComponent t : src.getRelationship()) + tgt.addRelationship(convertSubstanceSpecificationRelationshipComponent(t)); + if (src.hasNucleicAcid()) + tgt.setNucleicAcid(convertReference(src.getNucleicAcid())); + if (src.hasPolymer()) + tgt.setPolymer(convertReference(src.getPolymer())); + if (src.hasProtein()) + tgt.setProtein(convertReference(src.getProtein())); + if (src.hasSourceMaterial()) + tgt.setSourceMaterial(convertReference(src.getSourceMaterial())); + return tgt; + } + + public static org.hl7.fhir.r4.model.SubstanceSpecification convertSubstanceSpecification(org.hl7.fhir.r5.model.SubstanceSpecification src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.SubstanceSpecification tgt = new org.hl7.fhir.r4.model.SubstanceSpecification(); + copyDomainResource(src, tgt); + if (src.hasIdentifier()) + tgt.setIdentifier(convertIdentifier(src.getIdentifier())); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + if (src.hasStatus()) + tgt.setStatus(convertCodeableConcept(src.getStatus())); + if (src.hasDomain()) + tgt.setDomain(convertCodeableConcept(src.getDomain())); + if (src.hasDescription()) + tgt.setDescriptionElement(convertString(src.getDescriptionElement())); + for (org.hl7.fhir.r5.model.Reference t : src.getSource()) + tgt.addSource(convertReference(t)); + if (src.hasComment()) + tgt.setCommentElement(convertString(src.getCommentElement())); + for (org.hl7.fhir.r5.model.SubstanceSpecification.SubstanceSpecificationMoietyComponent t : src.getMoiety()) + tgt.addMoiety(convertSubstanceSpecificationMoietyComponent(t)); + for (org.hl7.fhir.r5.model.SubstanceSpecification.SubstanceSpecificationPropertyComponent t : src.getProperty()) + tgt.addProperty(convertSubstanceSpecificationPropertyComponent(t)); + if (src.hasReferenceInformation()) + tgt.setReferenceInformation(convertReference(src.getReferenceInformation())); + if (src.hasStructure()) + tgt.setStructure(convertSubstanceSpecificationStructureComponent(src.getStructure())); + for (org.hl7.fhir.r5.model.SubstanceSpecification.SubstanceSpecificationCodeComponent t : src.getCode()) + tgt.addCode(convertSubstanceSpecificationCodeComponent(t)); + for (org.hl7.fhir.r5.model.SubstanceSpecification.SubstanceSpecificationNameComponent t : src.getName()) + tgt.addName(convertSubstanceSpecificationNameComponent(t)); + for (org.hl7.fhir.r5.model.SubstanceSpecification.SubstanceSpecificationStructureIsotopeMolecularWeightComponent t : src.getMolecularWeight()) + tgt.addMolecularWeight(convertSubstanceSpecificationStructureIsotopeMolecularWeightComponent(t)); + for (org.hl7.fhir.r5.model.SubstanceSpecification.SubstanceSpecificationRelationshipComponent t : src.getRelationship()) + tgt.addRelationship(convertSubstanceSpecificationRelationshipComponent(t)); + if (src.hasNucleicAcid()) + tgt.setNucleicAcid(convertReference(src.getNucleicAcid())); + if (src.hasPolymer()) + tgt.setPolymer(convertReference(src.getPolymer())); + if (src.hasProtein()) + tgt.setProtein(convertReference(src.getProtein())); + if (src.hasSourceMaterial()) + tgt.setSourceMaterial(convertReference(src.getSourceMaterial())); + return tgt; + } + + public static org.hl7.fhir.r5.model.SubstanceSpecification.SubstanceSpecificationMoietyComponent convertSubstanceSpecificationMoietyComponent(org.hl7.fhir.r4.model.SubstanceSpecification.SubstanceSpecificationMoietyComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.SubstanceSpecification.SubstanceSpecificationMoietyComponent tgt = new org.hl7.fhir.r5.model.SubstanceSpecification.SubstanceSpecificationMoietyComponent(); + copyElement(src, tgt); + if (src.hasRole()) + tgt.setRole(convertCodeableConcept(src.getRole())); + if (src.hasIdentifier()) + tgt.setIdentifier(convertIdentifier(src.getIdentifier())); + if (src.hasName()) + tgt.setNameElement(convertString(src.getNameElement())); + if (src.hasStereochemistry()) + tgt.setStereochemistry(convertCodeableConcept(src.getStereochemistry())); + if (src.hasOpticalActivity()) + tgt.setOpticalActivity(convertCodeableConcept(src.getOpticalActivity())); + if (src.hasMolecularFormula()) + tgt.setMolecularFormulaElement(convertString(src.getMolecularFormulaElement())); + if (src.hasAmount()) + tgt.setAmount(convertType(src.getAmount())); + return tgt; + } + + public static org.hl7.fhir.r4.model.SubstanceSpecification.SubstanceSpecificationMoietyComponent convertSubstanceSpecificationMoietyComponent(org.hl7.fhir.r5.model.SubstanceSpecification.SubstanceSpecificationMoietyComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.SubstanceSpecification.SubstanceSpecificationMoietyComponent tgt = new org.hl7.fhir.r4.model.SubstanceSpecification.SubstanceSpecificationMoietyComponent(); + copyElement(src, tgt); + if (src.hasRole()) + tgt.setRole(convertCodeableConcept(src.getRole())); + if (src.hasIdentifier()) + tgt.setIdentifier(convertIdentifier(src.getIdentifier())); + if (src.hasName()) + tgt.setNameElement(convertString(src.getNameElement())); + if (src.hasStereochemistry()) + tgt.setStereochemistry(convertCodeableConcept(src.getStereochemistry())); + if (src.hasOpticalActivity()) + tgt.setOpticalActivity(convertCodeableConcept(src.getOpticalActivity())); + if (src.hasMolecularFormula()) + tgt.setMolecularFormulaElement(convertString(src.getMolecularFormulaElement())); + if (src.hasAmount()) + tgt.setAmount(convertType(src.getAmount())); + return tgt; + } + + public static org.hl7.fhir.r5.model.SubstanceSpecification.SubstanceSpecificationPropertyComponent convertSubstanceSpecificationPropertyComponent(org.hl7.fhir.r4.model.SubstanceSpecification.SubstanceSpecificationPropertyComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.SubstanceSpecification.SubstanceSpecificationPropertyComponent tgt = new org.hl7.fhir.r5.model.SubstanceSpecification.SubstanceSpecificationPropertyComponent(); + copyElement(src, tgt); + if (src.hasCategory()) + tgt.setCategory(convertCodeableConcept(src.getCategory())); + if (src.hasCode()) + tgt.setCode(convertCodeableConcept(src.getCode())); + if (src.hasParameters()) + tgt.setParametersElement(convertString(src.getParametersElement())); + if (src.hasDefiningSubstance()) + tgt.setDefiningSubstance(convertType(src.getDefiningSubstance())); + if (src.hasAmount()) + tgt.setAmount(convertType(src.getAmount())); + return tgt; + } + + public static org.hl7.fhir.r4.model.SubstanceSpecification.SubstanceSpecificationPropertyComponent convertSubstanceSpecificationPropertyComponent(org.hl7.fhir.r5.model.SubstanceSpecification.SubstanceSpecificationPropertyComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.SubstanceSpecification.SubstanceSpecificationPropertyComponent tgt = new org.hl7.fhir.r4.model.SubstanceSpecification.SubstanceSpecificationPropertyComponent(); + copyElement(src, tgt); + if (src.hasCategory()) + tgt.setCategory(convertCodeableConcept(src.getCategory())); + if (src.hasCode()) + tgt.setCode(convertCodeableConcept(src.getCode())); + if (src.hasParameters()) + tgt.setParametersElement(convertString(src.getParametersElement())); + if (src.hasDefiningSubstance()) + tgt.setDefiningSubstance(convertType(src.getDefiningSubstance())); + if (src.hasAmount()) + tgt.setAmount(convertType(src.getAmount())); + return tgt; + } + + public static org.hl7.fhir.r5.model.SubstanceSpecification.SubstanceSpecificationStructureComponent convertSubstanceSpecificationStructureComponent(org.hl7.fhir.r4.model.SubstanceSpecification.SubstanceSpecificationStructureComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.SubstanceSpecification.SubstanceSpecificationStructureComponent tgt = new org.hl7.fhir.r5.model.SubstanceSpecification.SubstanceSpecificationStructureComponent(); + copyElement(src, tgt); + if (src.hasStereochemistry()) + tgt.setStereochemistry(convertCodeableConcept(src.getStereochemistry())); + if (src.hasOpticalActivity()) + tgt.setOpticalActivity(convertCodeableConcept(src.getOpticalActivity())); + if (src.hasMolecularFormula()) + tgt.setMolecularFormulaElement(convertString(src.getMolecularFormulaElement())); + if (src.hasMolecularFormulaByMoiety()) + tgt.setMolecularFormulaByMoietyElement(convertString(src.getMolecularFormulaByMoietyElement())); + for (org.hl7.fhir.r4.model.SubstanceSpecification.SubstanceSpecificationStructureIsotopeComponent t : src.getIsotope()) + tgt.addIsotope(convertSubstanceSpecificationStructureIsotopeComponent(t)); + if (src.hasMolecularWeight()) + tgt.setMolecularWeight(convertSubstanceSpecificationStructureIsotopeMolecularWeightComponent(src.getMolecularWeight())); + for (org.hl7.fhir.r4.model.Reference t : src.getSource()) + tgt.addSource(convertReference(t)); + for (org.hl7.fhir.r4.model.SubstanceSpecification.SubstanceSpecificationStructureRepresentationComponent t : src.getRepresentation()) + tgt.addRepresentation(convertSubstanceSpecificationStructureRepresentationComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.SubstanceSpecification.SubstanceSpecificationStructureComponent convertSubstanceSpecificationStructureComponent(org.hl7.fhir.r5.model.SubstanceSpecification.SubstanceSpecificationStructureComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.SubstanceSpecification.SubstanceSpecificationStructureComponent tgt = new org.hl7.fhir.r4.model.SubstanceSpecification.SubstanceSpecificationStructureComponent(); + copyElement(src, tgt); + if (src.hasStereochemistry()) + tgt.setStereochemistry(convertCodeableConcept(src.getStereochemistry())); + if (src.hasOpticalActivity()) + tgt.setOpticalActivity(convertCodeableConcept(src.getOpticalActivity())); + if (src.hasMolecularFormula()) + tgt.setMolecularFormulaElement(convertString(src.getMolecularFormulaElement())); + if (src.hasMolecularFormulaByMoiety()) + tgt.setMolecularFormulaByMoietyElement(convertString(src.getMolecularFormulaByMoietyElement())); + for (org.hl7.fhir.r5.model.SubstanceSpecification.SubstanceSpecificationStructureIsotopeComponent t : src.getIsotope()) + tgt.addIsotope(convertSubstanceSpecificationStructureIsotopeComponent(t)); + if (src.hasMolecularWeight()) + tgt.setMolecularWeight(convertSubstanceSpecificationStructureIsotopeMolecularWeightComponent(src.getMolecularWeight())); + for (org.hl7.fhir.r5.model.Reference t : src.getSource()) + tgt.addSource(convertReference(t)); + for (org.hl7.fhir.r5.model.SubstanceSpecification.SubstanceSpecificationStructureRepresentationComponent t : src.getRepresentation()) + tgt.addRepresentation(convertSubstanceSpecificationStructureRepresentationComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.SubstanceSpecification.SubstanceSpecificationStructureIsotopeComponent convertSubstanceSpecificationStructureIsotopeComponent(org.hl7.fhir.r4.model.SubstanceSpecification.SubstanceSpecificationStructureIsotopeComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.SubstanceSpecification.SubstanceSpecificationStructureIsotopeComponent tgt = new org.hl7.fhir.r5.model.SubstanceSpecification.SubstanceSpecificationStructureIsotopeComponent(); + copyElement(src, tgt); + if (src.hasIdentifier()) + tgt.setIdentifier(convertIdentifier(src.getIdentifier())); + if (src.hasName()) + tgt.setName(convertCodeableConcept(src.getName())); + if (src.hasSubstitution()) + tgt.setSubstitution(convertCodeableConcept(src.getSubstitution())); + if (src.hasHalfLife()) + tgt.setHalfLife(convertQuantity(src.getHalfLife())); + if (src.hasMolecularWeight()) + tgt.setMolecularWeight(convertSubstanceSpecificationStructureIsotopeMolecularWeightComponent(src.getMolecularWeight())); + return tgt; + } + + public static org.hl7.fhir.r4.model.SubstanceSpecification.SubstanceSpecificationStructureIsotopeComponent convertSubstanceSpecificationStructureIsotopeComponent(org.hl7.fhir.r5.model.SubstanceSpecification.SubstanceSpecificationStructureIsotopeComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.SubstanceSpecification.SubstanceSpecificationStructureIsotopeComponent tgt = new org.hl7.fhir.r4.model.SubstanceSpecification.SubstanceSpecificationStructureIsotopeComponent(); + copyElement(src, tgt); + if (src.hasIdentifier()) + tgt.setIdentifier(convertIdentifier(src.getIdentifier())); + if (src.hasName()) + tgt.setName(convertCodeableConcept(src.getName())); + if (src.hasSubstitution()) + tgt.setSubstitution(convertCodeableConcept(src.getSubstitution())); + if (src.hasHalfLife()) + tgt.setHalfLife(convertQuantity(src.getHalfLife())); + if (src.hasMolecularWeight()) + tgt.setMolecularWeight(convertSubstanceSpecificationStructureIsotopeMolecularWeightComponent(src.getMolecularWeight())); + return tgt; + } + + public static org.hl7.fhir.r5.model.SubstanceSpecification.SubstanceSpecificationStructureIsotopeMolecularWeightComponent convertSubstanceSpecificationStructureIsotopeMolecularWeightComponent(org.hl7.fhir.r4.model.SubstanceSpecification.SubstanceSpecificationStructureIsotopeMolecularWeightComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.SubstanceSpecification.SubstanceSpecificationStructureIsotopeMolecularWeightComponent tgt = new org.hl7.fhir.r5.model.SubstanceSpecification.SubstanceSpecificationStructureIsotopeMolecularWeightComponent(); + copyElement(src, tgt); + if (src.hasMethod()) + tgt.setMethod(convertCodeableConcept(src.getMethod())); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + if (src.hasAmount()) + tgt.setAmount(convertQuantity(src.getAmount())); + return tgt; + } + + public static org.hl7.fhir.r4.model.SubstanceSpecification.SubstanceSpecificationStructureIsotopeMolecularWeightComponent convertSubstanceSpecificationStructureIsotopeMolecularWeightComponent(org.hl7.fhir.r5.model.SubstanceSpecification.SubstanceSpecificationStructureIsotopeMolecularWeightComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.SubstanceSpecification.SubstanceSpecificationStructureIsotopeMolecularWeightComponent tgt = new org.hl7.fhir.r4.model.SubstanceSpecification.SubstanceSpecificationStructureIsotopeMolecularWeightComponent(); + copyElement(src, tgt); + if (src.hasMethod()) + tgt.setMethod(convertCodeableConcept(src.getMethod())); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + if (src.hasAmount()) + tgt.setAmount(convertQuantity(src.getAmount())); + return tgt; + } + + public static org.hl7.fhir.r5.model.SubstanceSpecification.SubstanceSpecificationStructureRepresentationComponent convertSubstanceSpecificationStructureRepresentationComponent(org.hl7.fhir.r4.model.SubstanceSpecification.SubstanceSpecificationStructureRepresentationComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.SubstanceSpecification.SubstanceSpecificationStructureRepresentationComponent tgt = new org.hl7.fhir.r5.model.SubstanceSpecification.SubstanceSpecificationStructureRepresentationComponent(); + copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + if (src.hasRepresentation()) + tgt.setRepresentationElement(convertString(src.getRepresentationElement())); + if (src.hasAttachment()) + tgt.setAttachment(convertAttachment(src.getAttachment())); + return tgt; + } + + public static org.hl7.fhir.r4.model.SubstanceSpecification.SubstanceSpecificationStructureRepresentationComponent convertSubstanceSpecificationStructureRepresentationComponent(org.hl7.fhir.r5.model.SubstanceSpecification.SubstanceSpecificationStructureRepresentationComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.SubstanceSpecification.SubstanceSpecificationStructureRepresentationComponent tgt = new org.hl7.fhir.r4.model.SubstanceSpecification.SubstanceSpecificationStructureRepresentationComponent(); + copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + if (src.hasRepresentation()) + tgt.setRepresentationElement(convertString(src.getRepresentationElement())); + if (src.hasAttachment()) + tgt.setAttachment(convertAttachment(src.getAttachment())); + return tgt; + } + + public static org.hl7.fhir.r5.model.SubstanceSpecification.SubstanceSpecificationCodeComponent convertSubstanceSpecificationCodeComponent(org.hl7.fhir.r4.model.SubstanceSpecification.SubstanceSpecificationCodeComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.SubstanceSpecification.SubstanceSpecificationCodeComponent tgt = new org.hl7.fhir.r5.model.SubstanceSpecification.SubstanceSpecificationCodeComponent(); + copyElement(src, tgt); + if (src.hasCode()) + tgt.setCode(convertCodeableConcept(src.getCode())); + if (src.hasStatus()) + tgt.setStatus(convertCodeableConcept(src.getStatus())); + if (src.hasStatusDate()) + tgt.setStatusDateElement(convertDateTime(src.getStatusDateElement())); + if (src.hasComment()) + tgt.setCommentElement(convertString(src.getCommentElement())); + for (org.hl7.fhir.r4.model.Reference t : src.getSource()) + tgt.addSource(convertReference(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.SubstanceSpecification.SubstanceSpecificationCodeComponent convertSubstanceSpecificationCodeComponent(org.hl7.fhir.r5.model.SubstanceSpecification.SubstanceSpecificationCodeComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.SubstanceSpecification.SubstanceSpecificationCodeComponent tgt = new org.hl7.fhir.r4.model.SubstanceSpecification.SubstanceSpecificationCodeComponent(); + copyElement(src, tgt); + if (src.hasCode()) + tgt.setCode(convertCodeableConcept(src.getCode())); + if (src.hasStatus()) + tgt.setStatus(convertCodeableConcept(src.getStatus())); + if (src.hasStatusDate()) + tgt.setStatusDateElement(convertDateTime(src.getStatusDateElement())); + if (src.hasComment()) + tgt.setCommentElement(convertString(src.getCommentElement())); + for (org.hl7.fhir.r5.model.Reference t : src.getSource()) + tgt.addSource(convertReference(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.SubstanceSpecification.SubstanceSpecificationNameComponent convertSubstanceSpecificationNameComponent(org.hl7.fhir.r4.model.SubstanceSpecification.SubstanceSpecificationNameComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.SubstanceSpecification.SubstanceSpecificationNameComponent tgt = new org.hl7.fhir.r5.model.SubstanceSpecification.SubstanceSpecificationNameComponent(); + copyElement(src, tgt); + if (src.hasName()) + tgt.setNameElement(convertString(src.getNameElement())); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + if (src.hasStatus()) + tgt.setStatus(convertCodeableConcept(src.getStatus())); + if (src.hasPreferred()) + tgt.setPreferredElement(convertBoolean(src.getPreferredElement())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getLanguage()) + tgt.addLanguage(convertCodeableConcept(t)); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getDomain()) + tgt.addDomain(convertCodeableConcept(t)); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getJurisdiction()) + tgt.addJurisdiction(convertCodeableConcept(t)); + for (org.hl7.fhir.r4.model.SubstanceSpecification.SubstanceSpecificationNameComponent t : src.getSynonym()) + tgt.addSynonym(convertSubstanceSpecificationNameComponent(t)); + for (org.hl7.fhir.r4.model.SubstanceSpecification.SubstanceSpecificationNameComponent t : src.getTranslation()) + tgt.addTranslation(convertSubstanceSpecificationNameComponent(t)); + for (org.hl7.fhir.r4.model.SubstanceSpecification.SubstanceSpecificationNameOfficialComponent t : src.getOfficial()) + tgt.addOfficial(convertSubstanceSpecificationNameOfficialComponent(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getSource()) + tgt.addSource(convertReference(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.SubstanceSpecification.SubstanceSpecificationNameComponent convertSubstanceSpecificationNameComponent(org.hl7.fhir.r5.model.SubstanceSpecification.SubstanceSpecificationNameComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.SubstanceSpecification.SubstanceSpecificationNameComponent tgt = new org.hl7.fhir.r4.model.SubstanceSpecification.SubstanceSpecificationNameComponent(); + copyElement(src, tgt); + if (src.hasName()) + tgt.setNameElement(convertString(src.getNameElement())); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + if (src.hasStatus()) + tgt.setStatus(convertCodeableConcept(src.getStatus())); + if (src.hasPreferred()) + tgt.setPreferredElement(convertBoolean(src.getPreferredElement())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getLanguage()) + tgt.addLanguage(convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getDomain()) + tgt.addDomain(convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getJurisdiction()) + tgt.addJurisdiction(convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.SubstanceSpecification.SubstanceSpecificationNameComponent t : src.getSynonym()) + tgt.addSynonym(convertSubstanceSpecificationNameComponent(t)); + for (org.hl7.fhir.r5.model.SubstanceSpecification.SubstanceSpecificationNameComponent t : src.getTranslation()) + tgt.addTranslation(convertSubstanceSpecificationNameComponent(t)); + for (org.hl7.fhir.r5.model.SubstanceSpecification.SubstanceSpecificationNameOfficialComponent t : src.getOfficial()) + tgt.addOfficial(convertSubstanceSpecificationNameOfficialComponent(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getSource()) + tgt.addSource(convertReference(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.SubstanceSpecification.SubstanceSpecificationNameOfficialComponent convertSubstanceSpecificationNameOfficialComponent(org.hl7.fhir.r4.model.SubstanceSpecification.SubstanceSpecificationNameOfficialComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.SubstanceSpecification.SubstanceSpecificationNameOfficialComponent tgt = new org.hl7.fhir.r5.model.SubstanceSpecification.SubstanceSpecificationNameOfficialComponent(); + copyElement(src, tgt); + if (src.hasAuthority()) + tgt.setAuthority(convertCodeableConcept(src.getAuthority())); + if (src.hasStatus()) + tgt.setStatus(convertCodeableConcept(src.getStatus())); + if (src.hasDate()) + tgt.setDateElement(convertDateTime(src.getDateElement())); + return tgt; + } + + public static org.hl7.fhir.r4.model.SubstanceSpecification.SubstanceSpecificationNameOfficialComponent convertSubstanceSpecificationNameOfficialComponent(org.hl7.fhir.r5.model.SubstanceSpecification.SubstanceSpecificationNameOfficialComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.SubstanceSpecification.SubstanceSpecificationNameOfficialComponent tgt = new org.hl7.fhir.r4.model.SubstanceSpecification.SubstanceSpecificationNameOfficialComponent(); + copyElement(src, tgt); + if (src.hasAuthority()) + tgt.setAuthority(convertCodeableConcept(src.getAuthority())); + if (src.hasStatus()) + tgt.setStatus(convertCodeableConcept(src.getStatus())); + if (src.hasDate()) + tgt.setDateElement(convertDateTime(src.getDateElement())); + return tgt; + } + + public static org.hl7.fhir.r5.model.SubstanceSpecification.SubstanceSpecificationRelationshipComponent convertSubstanceSpecificationRelationshipComponent(org.hl7.fhir.r4.model.SubstanceSpecification.SubstanceSpecificationRelationshipComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.SubstanceSpecification.SubstanceSpecificationRelationshipComponent tgt = new org.hl7.fhir.r5.model.SubstanceSpecification.SubstanceSpecificationRelationshipComponent(); + copyElement(src, tgt); + if (src.hasSubstance()) + tgt.setSubstance(convertType(src.getSubstance())); + if (src.hasRelationship()) + tgt.setRelationship(convertCodeableConcept(src.getRelationship())); + if (src.hasIsDefining()) + tgt.setIsDefiningElement(convertBoolean(src.getIsDefiningElement())); + if (src.hasAmount()) + tgt.setAmount(convertType(src.getAmount())); + if (src.hasAmountRatioLowLimit()) + tgt.setAmountRatioLowLimit(convertRatio(src.getAmountRatioLowLimit())); + if (src.hasAmountType()) + tgt.setAmountType(convertCodeableConcept(src.getAmountType())); + for (org.hl7.fhir.r4.model.Reference t : src.getSource()) + tgt.addSource(convertReference(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.SubstanceSpecification.SubstanceSpecificationRelationshipComponent convertSubstanceSpecificationRelationshipComponent(org.hl7.fhir.r5.model.SubstanceSpecification.SubstanceSpecificationRelationshipComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.SubstanceSpecification.SubstanceSpecificationRelationshipComponent tgt = new org.hl7.fhir.r4.model.SubstanceSpecification.SubstanceSpecificationRelationshipComponent(); + copyElement(src, tgt); + if (src.hasSubstance()) + tgt.setSubstance(convertType(src.getSubstance())); + if (src.hasRelationship()) + tgt.setRelationship(convertCodeableConcept(src.getRelationship())); + if (src.hasIsDefining()) + tgt.setIsDefiningElement(convertBoolean(src.getIsDefiningElement())); + if (src.hasAmount()) + tgt.setAmount(convertType(src.getAmount())); + if (src.hasAmountRatioLowLimit()) + tgt.setAmountRatioLowLimit(convertRatio(src.getAmountRatioLowLimit())); + if (src.hasAmountType()) + tgt.setAmountType(convertCodeableConcept(src.getAmountType())); + for (org.hl7.fhir.r5.model.Reference t : src.getSource()) + tgt.addSource(convertReference(t)); + return tgt; + } + + +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/SupplyDelivery.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/SupplyDelivery.java new file mode 100644 index 000000000..5d34369f4 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/SupplyDelivery.java @@ -0,0 +1,151 @@ +package org.hl7.fhir.convertors.conv40_50; + +import org.hl7.fhir.exceptions.FHIRException; + +import org.hl7.fhir.convertors.VersionConvertor_40_50; + + +/* + Copyright (c) 2011+, HL7, Inc. + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of HL7 nor the names of its contributors may be used to + endorse or promote products derived from this software without specific + prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + +*/ + +// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0 + + +public class SupplyDelivery extends VersionConvertor_40_50 { + + public static org.hl7.fhir.r5.model.SupplyDelivery convertSupplyDelivery(org.hl7.fhir.r4.model.SupplyDelivery src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.SupplyDelivery tgt = new org.hl7.fhir.r5.model.SupplyDelivery(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getBasedOn()) + tgt.addBasedOn(convertReference(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getPartOf()) + tgt.addPartOf(convertReference(t)); + if (src.hasStatus()) + tgt.setStatus(convertSupplyDeliveryStatus(src.getStatus())); + if (src.hasPatient()) + tgt.setPatient(convertReference(src.getPatient())); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + if (src.hasSuppliedItem()) + tgt.setSuppliedItem(convertSupplyDeliverySuppliedItemComponent(src.getSuppliedItem())); + if (src.hasOccurrence()) + tgt.setOccurrence(convertType(src.getOccurrence())); + if (src.hasSupplier()) + tgt.setSupplier(convertReference(src.getSupplier())); + if (src.hasDestination()) + tgt.setDestination(convertReference(src.getDestination())); + for (org.hl7.fhir.r4.model.Reference t : src.getReceiver()) + tgt.addReceiver(convertReference(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.SupplyDelivery convertSupplyDelivery(org.hl7.fhir.r5.model.SupplyDelivery src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.SupplyDelivery tgt = new org.hl7.fhir.r4.model.SupplyDelivery(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getBasedOn()) + tgt.addBasedOn(convertReference(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getPartOf()) + tgt.addPartOf(convertReference(t)); + if (src.hasStatus()) + tgt.setStatus(convertSupplyDeliveryStatus(src.getStatus())); + if (src.hasPatient()) + tgt.setPatient(convertReference(src.getPatient())); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + if (src.hasSuppliedItem()) + tgt.setSuppliedItem(convertSupplyDeliverySuppliedItemComponent(src.getSuppliedItem())); + if (src.hasOccurrence()) + tgt.setOccurrence(convertType(src.getOccurrence())); + if (src.hasSupplier()) + tgt.setSupplier(convertReference(src.getSupplier())); + if (src.hasDestination()) + tgt.setDestination(convertReference(src.getDestination())); + for (org.hl7.fhir.r5.model.Reference t : src.getReceiver()) + tgt.addReceiver(convertReference(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.SupplyDelivery.SupplyDeliveryStatus convertSupplyDeliveryStatus(org.hl7.fhir.r4.model.SupplyDelivery.SupplyDeliveryStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case INPROGRESS: return org.hl7.fhir.r5.model.SupplyDelivery.SupplyDeliveryStatus.INPROGRESS; + case COMPLETED: return org.hl7.fhir.r5.model.SupplyDelivery.SupplyDeliveryStatus.COMPLETED; + case ABANDONED: return org.hl7.fhir.r5.model.SupplyDelivery.SupplyDeliveryStatus.ABANDONED; + case ENTEREDINERROR: return org.hl7.fhir.r5.model.SupplyDelivery.SupplyDeliveryStatus.ENTEREDINERROR; + default: return org.hl7.fhir.r5.model.SupplyDelivery.SupplyDeliveryStatus.NULL; + } +} + + public static org.hl7.fhir.r4.model.SupplyDelivery.SupplyDeliveryStatus convertSupplyDeliveryStatus(org.hl7.fhir.r5.model.SupplyDelivery.SupplyDeliveryStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case INPROGRESS: return org.hl7.fhir.r4.model.SupplyDelivery.SupplyDeliveryStatus.INPROGRESS; + case COMPLETED: return org.hl7.fhir.r4.model.SupplyDelivery.SupplyDeliveryStatus.COMPLETED; + case ABANDONED: return org.hl7.fhir.r4.model.SupplyDelivery.SupplyDeliveryStatus.ABANDONED; + case ENTEREDINERROR: return org.hl7.fhir.r4.model.SupplyDelivery.SupplyDeliveryStatus.ENTEREDINERROR; + default: return org.hl7.fhir.r4.model.SupplyDelivery.SupplyDeliveryStatus.NULL; + } +} + + public static org.hl7.fhir.r5.model.SupplyDelivery.SupplyDeliverySuppliedItemComponent convertSupplyDeliverySuppliedItemComponent(org.hl7.fhir.r4.model.SupplyDelivery.SupplyDeliverySuppliedItemComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.SupplyDelivery.SupplyDeliverySuppliedItemComponent tgt = new org.hl7.fhir.r5.model.SupplyDelivery.SupplyDeliverySuppliedItemComponent(); + copyElement(src, tgt); + if (src.hasQuantity()) + tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); + if (src.hasItem()) + tgt.setItem(convertType(src.getItem())); + return tgt; + } + + public static org.hl7.fhir.r4.model.SupplyDelivery.SupplyDeliverySuppliedItemComponent convertSupplyDeliverySuppliedItemComponent(org.hl7.fhir.r5.model.SupplyDelivery.SupplyDeliverySuppliedItemComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.SupplyDelivery.SupplyDeliverySuppliedItemComponent tgt = new org.hl7.fhir.r4.model.SupplyDelivery.SupplyDeliverySuppliedItemComponent(); + copyElement(src, tgt); + if (src.hasQuantity()) + tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); + if (src.hasItem()) + tgt.setItem(convertType(src.getItem())); + return tgt; + } + + +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/SupplyRequest.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/SupplyRequest.java new file mode 100644 index 000000000..e6839c02a --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/SupplyRequest.java @@ -0,0 +1,197 @@ +package org.hl7.fhir.convertors.conv40_50; + +import org.hl7.fhir.exceptions.FHIRException; + +import org.hl7.fhir.convertors.VersionConvertor_40_50; + + +/* + Copyright (c) 2011+, HL7, Inc. + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of HL7 nor the names of its contributors may be used to + endorse or promote products derived from this software without specific + prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + +*/ + +// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0 + + +public class SupplyRequest extends VersionConvertor_40_50 { + + public static org.hl7.fhir.r5.model.SupplyRequest convertSupplyRequest(org.hl7.fhir.r4.model.SupplyRequest src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.SupplyRequest tgt = new org.hl7.fhir.r5.model.SupplyRequest(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasStatus()) + tgt.setStatus(convertSupplyRequestStatus(src.getStatus())); + if (src.hasCategory()) + tgt.setCategory(convertCodeableConcept(src.getCategory())); + if (src.hasPriority()) + tgt.setPriority(convertRequestPriority(src.getPriority())); + if (src.hasItem()) + tgt.setItem(convertType(src.getItem())); + if (src.hasQuantity()) + tgt.setQuantity(convertQuantity(src.getQuantity())); + for (org.hl7.fhir.r4.model.SupplyRequest.SupplyRequestParameterComponent t : src.getParameter()) + tgt.addParameter(convertSupplyRequestParameterComponent(t)); + if (src.hasOccurrence()) + tgt.setOccurrence(convertType(src.getOccurrence())); + if (src.hasAuthoredOn()) + tgt.setAuthoredOnElement(convertDateTime(src.getAuthoredOnElement())); + if (src.hasRequester()) + tgt.setRequester(convertReference(src.getRequester())); + for (org.hl7.fhir.r4.model.Reference t : src.getSupplier()) + tgt.addSupplier(convertReference(t)); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getReasonCode()) + tgt.addReasonCode(convertCodeableConcept(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getReasonReference()) + tgt.addReasonReference(convertReference(t)); + if (src.hasDeliverFrom()) + tgt.setDeliverFrom(convertReference(src.getDeliverFrom())); + if (src.hasDeliverTo()) + tgt.setDeliverTo(convertReference(src.getDeliverTo())); + return tgt; + } + + public static org.hl7.fhir.r4.model.SupplyRequest convertSupplyRequest(org.hl7.fhir.r5.model.SupplyRequest src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.SupplyRequest tgt = new org.hl7.fhir.r4.model.SupplyRequest(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasStatus()) + tgt.setStatus(convertSupplyRequestStatus(src.getStatus())); + if (src.hasCategory()) + tgt.setCategory(convertCodeableConcept(src.getCategory())); + if (src.hasPriority()) + tgt.setPriority(convertRequestPriority(src.getPriority())); + if (src.hasItem()) + tgt.setItem(convertType(src.getItem())); + if (src.hasQuantity()) + tgt.setQuantity(convertQuantity(src.getQuantity())); + for (org.hl7.fhir.r5.model.SupplyRequest.SupplyRequestParameterComponent t : src.getParameter()) + tgt.addParameter(convertSupplyRequestParameterComponent(t)); + if (src.hasOccurrence()) + tgt.setOccurrence(convertType(src.getOccurrence())); + if (src.hasAuthoredOn()) + tgt.setAuthoredOnElement(convertDateTime(src.getAuthoredOnElement())); + if (src.hasRequester()) + tgt.setRequester(convertReference(src.getRequester())); + for (org.hl7.fhir.r5.model.Reference t : src.getSupplier()) + tgt.addSupplier(convertReference(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getReasonCode()) + tgt.addReasonCode(convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getReasonReference()) + tgt.addReasonReference(convertReference(t)); + if (src.hasDeliverFrom()) + tgt.setDeliverFrom(convertReference(src.getDeliverFrom())); + if (src.hasDeliverTo()) + tgt.setDeliverTo(convertReference(src.getDeliverTo())); + return tgt; + } + + public static org.hl7.fhir.r5.model.SupplyRequest.SupplyRequestStatus convertSupplyRequestStatus(org.hl7.fhir.r4.model.SupplyRequest.SupplyRequestStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case DRAFT: return org.hl7.fhir.r5.model.SupplyRequest.SupplyRequestStatus.DRAFT; + case ACTIVE: return org.hl7.fhir.r5.model.SupplyRequest.SupplyRequestStatus.ACTIVE; + case SUSPENDED: return org.hl7.fhir.r5.model.SupplyRequest.SupplyRequestStatus.SUSPENDED; + case CANCELLED: return org.hl7.fhir.r5.model.SupplyRequest.SupplyRequestStatus.CANCELLED; + case COMPLETED: return org.hl7.fhir.r5.model.SupplyRequest.SupplyRequestStatus.COMPLETED; + case ENTEREDINERROR: return org.hl7.fhir.r5.model.SupplyRequest.SupplyRequestStatus.ENTEREDINERROR; + case UNKNOWN: return org.hl7.fhir.r5.model.SupplyRequest.SupplyRequestStatus.UNKNOWN; + default: return org.hl7.fhir.r5.model.SupplyRequest.SupplyRequestStatus.NULL; + } +} + + public static org.hl7.fhir.r4.model.SupplyRequest.SupplyRequestStatus convertSupplyRequestStatus(org.hl7.fhir.r5.model.SupplyRequest.SupplyRequestStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case DRAFT: return org.hl7.fhir.r4.model.SupplyRequest.SupplyRequestStatus.DRAFT; + case ACTIVE: return org.hl7.fhir.r4.model.SupplyRequest.SupplyRequestStatus.ACTIVE; + case SUSPENDED: return org.hl7.fhir.r4.model.SupplyRequest.SupplyRequestStatus.SUSPENDED; + case CANCELLED: return org.hl7.fhir.r4.model.SupplyRequest.SupplyRequestStatus.CANCELLED; + case COMPLETED: return org.hl7.fhir.r4.model.SupplyRequest.SupplyRequestStatus.COMPLETED; + case ENTEREDINERROR: return org.hl7.fhir.r4.model.SupplyRequest.SupplyRequestStatus.ENTEREDINERROR; + case UNKNOWN: return org.hl7.fhir.r4.model.SupplyRequest.SupplyRequestStatus.UNKNOWN; + default: return org.hl7.fhir.r4.model.SupplyRequest.SupplyRequestStatus.NULL; + } +} + + public static org.hl7.fhir.r5.model.SupplyRequest.RequestPriority convertRequestPriority(org.hl7.fhir.r4.model.SupplyRequest.RequestPriority src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case ROUTINE: return org.hl7.fhir.r5.model.SupplyRequest.RequestPriority.ROUTINE; + case URGENT: return org.hl7.fhir.r5.model.SupplyRequest.RequestPriority.URGENT; + case ASAP: return org.hl7.fhir.r5.model.SupplyRequest.RequestPriority.ASAP; + case STAT: return org.hl7.fhir.r5.model.SupplyRequest.RequestPriority.STAT; + default: return org.hl7.fhir.r5.model.SupplyRequest.RequestPriority.NULL; + } +} + + public static org.hl7.fhir.r4.model.SupplyRequest.RequestPriority convertRequestPriority(org.hl7.fhir.r5.model.SupplyRequest.RequestPriority src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case ROUTINE: return org.hl7.fhir.r4.model.SupplyRequest.RequestPriority.ROUTINE; + case URGENT: return org.hl7.fhir.r4.model.SupplyRequest.RequestPriority.URGENT; + case ASAP: return org.hl7.fhir.r4.model.SupplyRequest.RequestPriority.ASAP; + case STAT: return org.hl7.fhir.r4.model.SupplyRequest.RequestPriority.STAT; + default: return org.hl7.fhir.r4.model.SupplyRequest.RequestPriority.NULL; + } +} + + public static org.hl7.fhir.r5.model.SupplyRequest.SupplyRequestParameterComponent convertSupplyRequestParameterComponent(org.hl7.fhir.r4.model.SupplyRequest.SupplyRequestParameterComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.SupplyRequest.SupplyRequestParameterComponent tgt = new org.hl7.fhir.r5.model.SupplyRequest.SupplyRequestParameterComponent(); + copyElement(src, tgt); + if (src.hasCode()) + tgt.setCode(convertCodeableConcept(src.getCode())); + if (src.hasValue()) + tgt.setValue(convertType(src.getValue())); + return tgt; + } + + public static org.hl7.fhir.r4.model.SupplyRequest.SupplyRequestParameterComponent convertSupplyRequestParameterComponent(org.hl7.fhir.r5.model.SupplyRequest.SupplyRequestParameterComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.SupplyRequest.SupplyRequestParameterComponent tgt = new org.hl7.fhir.r4.model.SupplyRequest.SupplyRequestParameterComponent(); + copyElement(src, tgt); + if (src.hasCode()) + tgt.setCode(convertCodeableConcept(src.getCode())); + if (src.hasValue()) + tgt.setValue(convertType(src.getValue())); + return tgt; + } + + +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Task.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Task.java new file mode 100644 index 000000000..c60f3029b --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Task.java @@ -0,0 +1,357 @@ +package org.hl7.fhir.convertors.conv40_50; + +import org.hl7.fhir.exceptions.FHIRException; + +import org.hl7.fhir.convertors.VersionConvertor_40_50; + + +/* + Copyright (c) 2011+, HL7, Inc. + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of HL7 nor the names of its contributors may be used to + endorse or promote products derived from this software without specific + prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + +*/ + +// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0 + + +public class Task extends VersionConvertor_40_50 { + + public static org.hl7.fhir.r5.model.Task convertTask(org.hl7.fhir.r4.model.Task src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Task tgt = new org.hl7.fhir.r5.model.Task(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasInstantiatesCanonical()) + tgt.setInstantiatesCanonicalElement(convertCanonical(src.getInstantiatesCanonicalElement())); + if (src.hasInstantiatesUri()) + tgt.setInstantiatesUriElement(convertUri(src.getInstantiatesUriElement())); + for (org.hl7.fhir.r4.model.Reference t : src.getBasedOn()) + tgt.addBasedOn(convertReference(t)); + if (src.hasGroupIdentifier()) + tgt.setGroupIdentifier(convertIdentifier(src.getGroupIdentifier())); + for (org.hl7.fhir.r4.model.Reference t : src.getPartOf()) + tgt.addPartOf(convertReference(t)); + if (src.hasStatus()) + tgt.setStatus(convertTaskStatus(src.getStatus())); + if (src.hasStatusReason()) + tgt.setStatusReason(convertCodeableConcept(src.getStatusReason())); + if (src.hasBusinessStatus()) + tgt.setBusinessStatus(convertCodeableConcept(src.getBusinessStatus())); + if (src.hasIntent()) + tgt.setIntent(convertTaskIntent(src.getIntent())); + if (src.hasPriority()) + tgt.setPriority(convertTaskPriority(src.getPriority())); + if (src.hasCode()) + tgt.setCode(convertCodeableConcept(src.getCode())); + if (src.hasDescription()) + tgt.setDescriptionElement(convertString(src.getDescriptionElement())); + if (src.hasFocus()) + tgt.setFocus(convertReference(src.getFocus())); + if (src.hasFor()) + tgt.setFor(convertReference(src.getFor())); + if (src.hasEncounter()) + tgt.setEncounter(convertReference(src.getEncounter())); + if (src.hasExecutionPeriod()) + tgt.setExecutionPeriod(convertPeriod(src.getExecutionPeriod())); + if (src.hasAuthoredOn()) + tgt.setAuthoredOnElement(convertDateTime(src.getAuthoredOnElement())); + if (src.hasLastModified()) + tgt.setLastModifiedElement(convertDateTime(src.getLastModifiedElement())); + if (src.hasRequester()) + tgt.setRequester(convertReference(src.getRequester())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getPerformerType()) + tgt.addPerformerType(convertCodeableConcept(t)); + if (src.hasOwner()) + tgt.setOwner(convertReference(src.getOwner())); + if (src.hasLocation()) + tgt.setLocation(convertReference(src.getLocation())); + if (src.hasReasonCode()) + tgt.setReasonCode(convertCodeableConcept(src.getReasonCode())); + if (src.hasReasonReference()) + tgt.setReasonReference(convertReference(src.getReasonReference())); + for (org.hl7.fhir.r4.model.Reference t : src.getInsurance()) + tgt.addInsurance(convertReference(t)); + for (org.hl7.fhir.r4.model.Annotation t : src.getNote()) + tgt.addNote(convertAnnotation(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getRelevantHistory()) + tgt.addRelevantHistory(convertReference(t)); + if (src.hasRestriction()) + tgt.setRestriction(convertTaskRestrictionComponent(src.getRestriction())); + for (org.hl7.fhir.r4.model.Task.ParameterComponent t : src.getInput()) + tgt.addInput(convertParameterComponent(t)); + for (org.hl7.fhir.r4.model.Task.TaskOutputComponent t : src.getOutput()) + tgt.addOutput(convertTaskOutputComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.Task convertTask(org.hl7.fhir.r5.model.Task src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Task tgt = new org.hl7.fhir.r4.model.Task(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasInstantiatesCanonical()) + tgt.setInstantiatesCanonicalElement(convertCanonical(src.getInstantiatesCanonicalElement())); + if (src.hasInstantiatesUri()) + tgt.setInstantiatesUriElement(convertUri(src.getInstantiatesUriElement())); + for (org.hl7.fhir.r5.model.Reference t : src.getBasedOn()) + tgt.addBasedOn(convertReference(t)); + if (src.hasGroupIdentifier()) + tgt.setGroupIdentifier(convertIdentifier(src.getGroupIdentifier())); + for (org.hl7.fhir.r5.model.Reference t : src.getPartOf()) + tgt.addPartOf(convertReference(t)); + if (src.hasStatus()) + tgt.setStatus(convertTaskStatus(src.getStatus())); + if (src.hasStatusReason()) + tgt.setStatusReason(convertCodeableConcept(src.getStatusReason())); + if (src.hasBusinessStatus()) + tgt.setBusinessStatus(convertCodeableConcept(src.getBusinessStatus())); + if (src.hasIntent()) + tgt.setIntent(convertTaskIntent(src.getIntent())); + if (src.hasPriority()) + tgt.setPriority(convertTaskPriority(src.getPriority())); + if (src.hasCode()) + tgt.setCode(convertCodeableConcept(src.getCode())); + if (src.hasDescription()) + tgt.setDescriptionElement(convertString(src.getDescriptionElement())); + if (src.hasFocus()) + tgt.setFocus(convertReference(src.getFocus())); + if (src.hasFor()) + tgt.setFor(convertReference(src.getFor())); + if (src.hasEncounter()) + tgt.setEncounter(convertReference(src.getEncounter())); + if (src.hasExecutionPeriod()) + tgt.setExecutionPeriod(convertPeriod(src.getExecutionPeriod())); + if (src.hasAuthoredOn()) + tgt.setAuthoredOnElement(convertDateTime(src.getAuthoredOnElement())); + if (src.hasLastModified()) + tgt.setLastModifiedElement(convertDateTime(src.getLastModifiedElement())); + if (src.hasRequester()) + tgt.setRequester(convertReference(src.getRequester())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getPerformerType()) + tgt.addPerformerType(convertCodeableConcept(t)); + if (src.hasOwner()) + tgt.setOwner(convertReference(src.getOwner())); + if (src.hasLocation()) + tgt.setLocation(convertReference(src.getLocation())); + if (src.hasReasonCode()) + tgt.setReasonCode(convertCodeableConcept(src.getReasonCode())); + if (src.hasReasonReference()) + tgt.setReasonReference(convertReference(src.getReasonReference())); + for (org.hl7.fhir.r5.model.Reference t : src.getInsurance()) + tgt.addInsurance(convertReference(t)); + for (org.hl7.fhir.r5.model.Annotation t : src.getNote()) + tgt.addNote(convertAnnotation(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getRelevantHistory()) + tgt.addRelevantHistory(convertReference(t)); + if (src.hasRestriction()) + tgt.setRestriction(convertTaskRestrictionComponent(src.getRestriction())); + for (org.hl7.fhir.r5.model.Task.ParameterComponent t : src.getInput()) + tgt.addInput(convertParameterComponent(t)); + for (org.hl7.fhir.r5.model.Task.TaskOutputComponent t : src.getOutput()) + tgt.addOutput(convertTaskOutputComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.Task.TaskStatus convertTaskStatus(org.hl7.fhir.r4.model.Task.TaskStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case DRAFT: return org.hl7.fhir.r5.model.Task.TaskStatus.DRAFT; + case REQUESTED: return org.hl7.fhir.r5.model.Task.TaskStatus.REQUESTED; + case RECEIVED: return org.hl7.fhir.r5.model.Task.TaskStatus.RECEIVED; + case ACCEPTED: return org.hl7.fhir.r5.model.Task.TaskStatus.ACCEPTED; + case REJECTED: return org.hl7.fhir.r5.model.Task.TaskStatus.REJECTED; + case READY: return org.hl7.fhir.r5.model.Task.TaskStatus.READY; + case CANCELLED: return org.hl7.fhir.r5.model.Task.TaskStatus.CANCELLED; + case INPROGRESS: return org.hl7.fhir.r5.model.Task.TaskStatus.INPROGRESS; + case ONHOLD: return org.hl7.fhir.r5.model.Task.TaskStatus.ONHOLD; + case FAILED: return org.hl7.fhir.r5.model.Task.TaskStatus.FAILED; + case COMPLETED: return org.hl7.fhir.r5.model.Task.TaskStatus.COMPLETED; + case ENTEREDINERROR: return org.hl7.fhir.r5.model.Task.TaskStatus.ENTEREDINERROR; + default: return org.hl7.fhir.r5.model.Task.TaskStatus.NULL; + } +} + + public static org.hl7.fhir.r4.model.Task.TaskStatus convertTaskStatus(org.hl7.fhir.r5.model.Task.TaskStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case DRAFT: return org.hl7.fhir.r4.model.Task.TaskStatus.DRAFT; + case REQUESTED: return org.hl7.fhir.r4.model.Task.TaskStatus.REQUESTED; + case RECEIVED: return org.hl7.fhir.r4.model.Task.TaskStatus.RECEIVED; + case ACCEPTED: return org.hl7.fhir.r4.model.Task.TaskStatus.ACCEPTED; + case REJECTED: return org.hl7.fhir.r4.model.Task.TaskStatus.REJECTED; + case READY: return org.hl7.fhir.r4.model.Task.TaskStatus.READY; + case CANCELLED: return org.hl7.fhir.r4.model.Task.TaskStatus.CANCELLED; + case INPROGRESS: return org.hl7.fhir.r4.model.Task.TaskStatus.INPROGRESS; + case ONHOLD: return org.hl7.fhir.r4.model.Task.TaskStatus.ONHOLD; + case FAILED: return org.hl7.fhir.r4.model.Task.TaskStatus.FAILED; + case COMPLETED: return org.hl7.fhir.r4.model.Task.TaskStatus.COMPLETED; + case ENTEREDINERROR: return org.hl7.fhir.r4.model.Task.TaskStatus.ENTEREDINERROR; + default: return org.hl7.fhir.r4.model.Task.TaskStatus.NULL; + } +} + + public static org.hl7.fhir.r5.model.Task.TaskIntent convertTaskIntent(org.hl7.fhir.r4.model.Task.TaskIntent src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case UNKNOWN: return org.hl7.fhir.r5.model.Task.TaskIntent.UNKNOWN; + case PROPOSAL: return org.hl7.fhir.r5.model.Task.TaskIntent.PROPOSAL; + case PLAN: return org.hl7.fhir.r5.model.Task.TaskIntent.PLAN; + case ORDER: return org.hl7.fhir.r5.model.Task.TaskIntent.ORDER; + case ORIGINALORDER: return org.hl7.fhir.r5.model.Task.TaskIntent.ORIGINALORDER; + case REFLEXORDER: return org.hl7.fhir.r5.model.Task.TaskIntent.REFLEXORDER; + case FILLERORDER: return org.hl7.fhir.r5.model.Task.TaskIntent.FILLERORDER; + case INSTANCEORDER: return org.hl7.fhir.r5.model.Task.TaskIntent.INSTANCEORDER; + case OPTION: return org.hl7.fhir.r5.model.Task.TaskIntent.OPTION; + default: return org.hl7.fhir.r5.model.Task.TaskIntent.NULL; + } +} + + public static org.hl7.fhir.r4.model.Task.TaskIntent convertTaskIntent(org.hl7.fhir.r5.model.Task.TaskIntent src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case UNKNOWN: return org.hl7.fhir.r4.model.Task.TaskIntent.UNKNOWN; + case PROPOSAL: return org.hl7.fhir.r4.model.Task.TaskIntent.PROPOSAL; + case PLAN: return org.hl7.fhir.r4.model.Task.TaskIntent.PLAN; + case ORDER: return org.hl7.fhir.r4.model.Task.TaskIntent.ORDER; + case ORIGINALORDER: return org.hl7.fhir.r4.model.Task.TaskIntent.ORIGINALORDER; + case REFLEXORDER: return org.hl7.fhir.r4.model.Task.TaskIntent.REFLEXORDER; + case FILLERORDER: return org.hl7.fhir.r4.model.Task.TaskIntent.FILLERORDER; + case INSTANCEORDER: return org.hl7.fhir.r4.model.Task.TaskIntent.INSTANCEORDER; + case OPTION: return org.hl7.fhir.r4.model.Task.TaskIntent.OPTION; + default: return org.hl7.fhir.r4.model.Task.TaskIntent.NULL; + } +} + + public static org.hl7.fhir.r5.model.Task.TaskPriority convertTaskPriority(org.hl7.fhir.r4.model.Task.TaskPriority src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case ROUTINE: return org.hl7.fhir.r5.model.Task.TaskPriority.ROUTINE; + case URGENT: return org.hl7.fhir.r5.model.Task.TaskPriority.URGENT; + case ASAP: return org.hl7.fhir.r5.model.Task.TaskPriority.ASAP; + case STAT: return org.hl7.fhir.r5.model.Task.TaskPriority.STAT; + default: return org.hl7.fhir.r5.model.Task.TaskPriority.NULL; + } +} + + public static org.hl7.fhir.r4.model.Task.TaskPriority convertTaskPriority(org.hl7.fhir.r5.model.Task.TaskPriority src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case ROUTINE: return org.hl7.fhir.r4.model.Task.TaskPriority.ROUTINE; + case URGENT: return org.hl7.fhir.r4.model.Task.TaskPriority.URGENT; + case ASAP: return org.hl7.fhir.r4.model.Task.TaskPriority.ASAP; + case STAT: return org.hl7.fhir.r4.model.Task.TaskPriority.STAT; + default: return org.hl7.fhir.r4.model.Task.TaskPriority.NULL; + } +} + + public static org.hl7.fhir.r5.model.Task.TaskRestrictionComponent convertTaskRestrictionComponent(org.hl7.fhir.r4.model.Task.TaskRestrictionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Task.TaskRestrictionComponent tgt = new org.hl7.fhir.r5.model.Task.TaskRestrictionComponent(); + copyElement(src, tgt); + if (src.hasRepetitions()) + tgt.setRepetitionsElement(convertPositiveInt(src.getRepetitionsElement())); + if (src.hasPeriod()) + tgt.setPeriod(convertPeriod(src.getPeriod())); + for (org.hl7.fhir.r4.model.Reference t : src.getRecipient()) + tgt.addRecipient(convertReference(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.Task.TaskRestrictionComponent convertTaskRestrictionComponent(org.hl7.fhir.r5.model.Task.TaskRestrictionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Task.TaskRestrictionComponent tgt = new org.hl7.fhir.r4.model.Task.TaskRestrictionComponent(); + copyElement(src, tgt); + if (src.hasRepetitions()) + tgt.setRepetitionsElement(convertPositiveInt(src.getRepetitionsElement())); + if (src.hasPeriod()) + tgt.setPeriod(convertPeriod(src.getPeriod())); + for (org.hl7.fhir.r5.model.Reference t : src.getRecipient()) + tgt.addRecipient(convertReference(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.Task.ParameterComponent convertParameterComponent(org.hl7.fhir.r4.model.Task.ParameterComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Task.ParameterComponent tgt = new org.hl7.fhir.r5.model.Task.ParameterComponent(); + copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + if (src.hasValue()) + tgt.setValue(convertType(src.getValue())); + return tgt; + } + + public static org.hl7.fhir.r4.model.Task.ParameterComponent convertParameterComponent(org.hl7.fhir.r5.model.Task.ParameterComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Task.ParameterComponent tgt = new org.hl7.fhir.r4.model.Task.ParameterComponent(); + copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + if (src.hasValue()) + tgt.setValue(convertType(src.getValue())); + return tgt; + } + + public static org.hl7.fhir.r5.model.Task.TaskOutputComponent convertTaskOutputComponent(org.hl7.fhir.r4.model.Task.TaskOutputComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.Task.TaskOutputComponent tgt = new org.hl7.fhir.r5.model.Task.TaskOutputComponent(); + copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + if (src.hasValue()) + tgt.setValue(convertType(src.getValue())); + return tgt; + } + + public static org.hl7.fhir.r4.model.Task.TaskOutputComponent convertTaskOutputComponent(org.hl7.fhir.r5.model.Task.TaskOutputComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.Task.TaskOutputComponent tgt = new org.hl7.fhir.r4.model.Task.TaskOutputComponent(); + copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + if (src.hasValue()) + tgt.setValue(convertType(src.getValue())); + return tgt; + } + + +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/TerminologyCapabilities.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/TerminologyCapabilities.java new file mode 100644 index 000000000..1f4f3fbe1 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/TerminologyCapabilities.java @@ -0,0 +1,457 @@ +package org.hl7.fhir.convertors.conv40_50; + +import org.hl7.fhir.exceptions.FHIRException; + +import org.hl7.fhir.convertors.VersionConvertor_40_50; + + +/* + Copyright (c) 2011+, HL7, Inc. + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of HL7 nor the names of its contributors may be used to + endorse or promote products derived from this software without specific + prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + +*/ + +// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0 + + +public class TerminologyCapabilities extends VersionConvertor_40_50 { + + public static org.hl7.fhir.r5.model.TerminologyCapabilities convertTerminologyCapabilities(org.hl7.fhir.r4.model.TerminologyCapabilities src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.TerminologyCapabilities tgt = new org.hl7.fhir.r5.model.TerminologyCapabilities(); + copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrlElement(convertUri(src.getUrlElement())); + if (src.hasVersion()) + tgt.setVersionElement(convertString(src.getVersionElement())); + if (src.hasName()) + tgt.setNameElement(convertString(src.getNameElement())); + if (src.hasTitle()) + tgt.setTitleElement(convertString(src.getTitleElement())); + if (src.hasStatus()) + tgt.setStatus(Enumerations.convertPublicationStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimentalElement(convertBoolean(src.getExperimentalElement())); + if (src.hasDate()) + tgt.setDateElement(convertDateTime(src.getDateElement())); + if (src.hasPublisher()) + tgt.setPublisherElement(convertString(src.getPublisherElement())); + for (org.hl7.fhir.r4.model.ContactDetail t : src.getContact()) + tgt.addContact(convertContactDetail(t)); + if (src.hasDescription()) + tgt.setDescriptionElement(convertMarkdown(src.getDescriptionElement())); + for (org.hl7.fhir.r4.model.UsageContext t : src.getUseContext()) + tgt.addUseContext(convertUsageContext(t)); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getJurisdiction()) + tgt.addJurisdiction(convertCodeableConcept(t)); + if (src.hasPurpose()) + tgt.setPurposeElement(convertMarkdown(src.getPurposeElement())); + if (src.hasCopyright()) + tgt.setCopyrightElement(convertMarkdown(src.getCopyrightElement())); + if (src.hasKind()) + tgt.setKind(convertCapabilityStatementKind(src.getKind())); + if (src.hasSoftware()) + tgt.setSoftware(convertTerminologyCapabilitiesSoftwareComponent(src.getSoftware())); + if (src.hasImplementation()) + tgt.setImplementation(convertTerminologyCapabilitiesImplementationComponent(src.getImplementation())); + if (src.hasLockedDate()) + tgt.setLockedDateElement(convertBoolean(src.getLockedDateElement())); + for (org.hl7.fhir.r4.model.TerminologyCapabilities.TerminologyCapabilitiesCodeSystemComponent t : src.getCodeSystem()) + tgt.addCodeSystem(convertTerminologyCapabilitiesCodeSystemComponent(t)); + if (src.hasExpansion()) + tgt.setExpansion(convertTerminologyCapabilitiesExpansionComponent(src.getExpansion())); + if (src.hasCodeSearch()) + tgt.setCodeSearch(convertCodeSearchSupport(src.getCodeSearch())); + if (src.hasValidateCode()) + tgt.setValidateCode(convertTerminologyCapabilitiesValidateCodeComponent(src.getValidateCode())); + if (src.hasTranslation()) + tgt.setTranslation(convertTerminologyCapabilitiesTranslationComponent(src.getTranslation())); + if (src.hasClosure()) + tgt.setClosure(convertTerminologyCapabilitiesClosureComponent(src.getClosure())); + return tgt; + } + + public static org.hl7.fhir.r4.model.TerminologyCapabilities convertTerminologyCapabilities(org.hl7.fhir.r5.model.TerminologyCapabilities src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.TerminologyCapabilities tgt = new org.hl7.fhir.r4.model.TerminologyCapabilities(); + copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrlElement(convertUri(src.getUrlElement())); + if (src.hasVersion()) + tgt.setVersionElement(convertString(src.getVersionElement())); + if (src.hasName()) + tgt.setNameElement(convertString(src.getNameElement())); + if (src.hasTitle()) + tgt.setTitleElement(convertString(src.getTitleElement())); + if (src.hasStatus()) + tgt.setStatus(Enumerations.convertPublicationStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimentalElement(convertBoolean(src.getExperimentalElement())); + if (src.hasDate()) + tgt.setDateElement(convertDateTime(src.getDateElement())); + if (src.hasPublisher()) + tgt.setPublisherElement(convertString(src.getPublisherElement())); + for (org.hl7.fhir.r5.model.ContactDetail t : src.getContact()) + tgt.addContact(convertContactDetail(t)); + if (src.hasDescription()) + tgt.setDescriptionElement(convertMarkdown(src.getDescriptionElement())); + for (org.hl7.fhir.r5.model.UsageContext t : src.getUseContext()) + tgt.addUseContext(convertUsageContext(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getJurisdiction()) + tgt.addJurisdiction(convertCodeableConcept(t)); + if (src.hasPurpose()) + tgt.setPurposeElement(convertMarkdown(src.getPurposeElement())); + if (src.hasCopyright()) + tgt.setCopyrightElement(convertMarkdown(src.getCopyrightElement())); + if (src.hasKind()) + tgt.setKind(convertCapabilityStatementKind(src.getKind())); + if (src.hasSoftware()) + tgt.setSoftware(convertTerminologyCapabilitiesSoftwareComponent(src.getSoftware())); + if (src.hasImplementation()) + tgt.setImplementation(convertTerminologyCapabilitiesImplementationComponent(src.getImplementation())); + if (src.hasLockedDate()) + tgt.setLockedDateElement(convertBoolean(src.getLockedDateElement())); + for (org.hl7.fhir.r5.model.TerminologyCapabilities.TerminologyCapabilitiesCodeSystemComponent t : src.getCodeSystem()) + tgt.addCodeSystem(convertTerminologyCapabilitiesCodeSystemComponent(t)); + if (src.hasExpansion()) + tgt.setExpansion(convertTerminologyCapabilitiesExpansionComponent(src.getExpansion())); + if (src.hasCodeSearch()) + tgt.setCodeSearch(convertCodeSearchSupport(src.getCodeSearch())); + if (src.hasValidateCode()) + tgt.setValidateCode(convertTerminologyCapabilitiesValidateCodeComponent(src.getValidateCode())); + if (src.hasTranslation()) + tgt.setTranslation(convertTerminologyCapabilitiesTranslationComponent(src.getTranslation())); + if (src.hasClosure()) + tgt.setClosure(convertTerminologyCapabilitiesClosureComponent(src.getClosure())); + return tgt; + } + + public static org.hl7.fhir.r5.model.TerminologyCapabilities.CapabilityStatementKind convertCapabilityStatementKind(org.hl7.fhir.r4.model.TerminologyCapabilities.CapabilityStatementKind src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case INSTANCE: return org.hl7.fhir.r5.model.TerminologyCapabilities.CapabilityStatementKind.INSTANCE; + case CAPABILITY: return org.hl7.fhir.r5.model.TerminologyCapabilities.CapabilityStatementKind.CAPABILITY; + case REQUIREMENTS: return org.hl7.fhir.r5.model.TerminologyCapabilities.CapabilityStatementKind.REQUIREMENTS; + default: return org.hl7.fhir.r5.model.TerminologyCapabilities.CapabilityStatementKind.NULL; + } +} + + public static org.hl7.fhir.r4.model.TerminologyCapabilities.CapabilityStatementKind convertCapabilityStatementKind(org.hl7.fhir.r5.model.TerminologyCapabilities.CapabilityStatementKind src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case INSTANCE: return org.hl7.fhir.r4.model.TerminologyCapabilities.CapabilityStatementKind.INSTANCE; + case CAPABILITY: return org.hl7.fhir.r4.model.TerminologyCapabilities.CapabilityStatementKind.CAPABILITY; + case REQUIREMENTS: return org.hl7.fhir.r4.model.TerminologyCapabilities.CapabilityStatementKind.REQUIREMENTS; + default: return org.hl7.fhir.r4.model.TerminologyCapabilities.CapabilityStatementKind.NULL; + } +} + + public static org.hl7.fhir.r5.model.TerminologyCapabilities.CodeSearchSupport convertCodeSearchSupport(org.hl7.fhir.r4.model.TerminologyCapabilities.CodeSearchSupport src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case EXPLICIT: return org.hl7.fhir.r5.model.TerminologyCapabilities.CodeSearchSupport.EXPLICIT; + case ALL: return org.hl7.fhir.r5.model.TerminologyCapabilities.CodeSearchSupport.ALL; + default: return org.hl7.fhir.r5.model.TerminologyCapabilities.CodeSearchSupport.NULL; + } +} + + public static org.hl7.fhir.r4.model.TerminologyCapabilities.CodeSearchSupport convertCodeSearchSupport(org.hl7.fhir.r5.model.TerminologyCapabilities.CodeSearchSupport src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case EXPLICIT: return org.hl7.fhir.r4.model.TerminologyCapabilities.CodeSearchSupport.EXPLICIT; + case ALL: return org.hl7.fhir.r4.model.TerminologyCapabilities.CodeSearchSupport.ALL; + default: return org.hl7.fhir.r4.model.TerminologyCapabilities.CodeSearchSupport.NULL; + } +} + + public static org.hl7.fhir.r5.model.TerminologyCapabilities.TerminologyCapabilitiesSoftwareComponent convertTerminologyCapabilitiesSoftwareComponent(org.hl7.fhir.r4.model.TerminologyCapabilities.TerminologyCapabilitiesSoftwareComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.TerminologyCapabilities.TerminologyCapabilitiesSoftwareComponent tgt = new org.hl7.fhir.r5.model.TerminologyCapabilities.TerminologyCapabilitiesSoftwareComponent(); + copyElement(src, tgt); + if (src.hasName()) + tgt.setNameElement(convertString(src.getNameElement())); + if (src.hasVersion()) + tgt.setVersionElement(convertString(src.getVersionElement())); + return tgt; + } + + public static org.hl7.fhir.r4.model.TerminologyCapabilities.TerminologyCapabilitiesSoftwareComponent convertTerminologyCapabilitiesSoftwareComponent(org.hl7.fhir.r5.model.TerminologyCapabilities.TerminologyCapabilitiesSoftwareComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.TerminologyCapabilities.TerminologyCapabilitiesSoftwareComponent tgt = new org.hl7.fhir.r4.model.TerminologyCapabilities.TerminologyCapabilitiesSoftwareComponent(); + copyElement(src, tgt); + if (src.hasName()) + tgt.setNameElement(convertString(src.getNameElement())); + if (src.hasVersion()) + tgt.setVersionElement(convertString(src.getVersionElement())); + return tgt; + } + + public static org.hl7.fhir.r5.model.TerminologyCapabilities.TerminologyCapabilitiesImplementationComponent convertTerminologyCapabilitiesImplementationComponent(org.hl7.fhir.r4.model.TerminologyCapabilities.TerminologyCapabilitiesImplementationComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.TerminologyCapabilities.TerminologyCapabilitiesImplementationComponent tgt = new org.hl7.fhir.r5.model.TerminologyCapabilities.TerminologyCapabilitiesImplementationComponent(); + copyElement(src, tgt); + if (src.hasDescription()) + tgt.setDescriptionElement(convertString(src.getDescriptionElement())); + if (src.hasUrl()) + tgt.setUrlElement(convertUrl(src.getUrlElement())); + return tgt; + } + + public static org.hl7.fhir.r4.model.TerminologyCapabilities.TerminologyCapabilitiesImplementationComponent convertTerminologyCapabilitiesImplementationComponent(org.hl7.fhir.r5.model.TerminologyCapabilities.TerminologyCapabilitiesImplementationComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.TerminologyCapabilities.TerminologyCapabilitiesImplementationComponent tgt = new org.hl7.fhir.r4.model.TerminologyCapabilities.TerminologyCapabilitiesImplementationComponent(); + copyElement(src, tgt); + if (src.hasDescription()) + tgt.setDescriptionElement(convertString(src.getDescriptionElement())); + if (src.hasUrl()) + tgt.setUrlElement(convertUrl(src.getUrlElement())); + return tgt; + } + + public static org.hl7.fhir.r5.model.TerminologyCapabilities.TerminologyCapabilitiesCodeSystemComponent convertTerminologyCapabilitiesCodeSystemComponent(org.hl7.fhir.r4.model.TerminologyCapabilities.TerminologyCapabilitiesCodeSystemComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.TerminologyCapabilities.TerminologyCapabilitiesCodeSystemComponent tgt = new org.hl7.fhir.r5.model.TerminologyCapabilities.TerminologyCapabilitiesCodeSystemComponent(); + copyElement(src, tgt); + if (src.hasUri()) + tgt.setUriElement(convertCanonical(src.getUriElement())); + for (org.hl7.fhir.r4.model.TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionComponent t : src.getVersion()) + tgt.addVersion(convertTerminologyCapabilitiesCodeSystemVersionComponent(t)); + if (src.hasSubsumption()) + tgt.setSubsumptionElement(convertBoolean(src.getSubsumptionElement())); + return tgt; + } + + public static org.hl7.fhir.r4.model.TerminologyCapabilities.TerminologyCapabilitiesCodeSystemComponent convertTerminologyCapabilitiesCodeSystemComponent(org.hl7.fhir.r5.model.TerminologyCapabilities.TerminologyCapabilitiesCodeSystemComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.TerminologyCapabilities.TerminologyCapabilitiesCodeSystemComponent tgt = new org.hl7.fhir.r4.model.TerminologyCapabilities.TerminologyCapabilitiesCodeSystemComponent(); + copyElement(src, tgt); + if (src.hasUri()) + tgt.setUriElement(convertCanonical(src.getUriElement())); + for (org.hl7.fhir.r5.model.TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionComponent t : src.getVersion()) + tgt.addVersion(convertTerminologyCapabilitiesCodeSystemVersionComponent(t)); + if (src.hasSubsumption()) + tgt.setSubsumptionElement(convertBoolean(src.getSubsumptionElement())); + return tgt; + } + + public static org.hl7.fhir.r5.model.TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionComponent convertTerminologyCapabilitiesCodeSystemVersionComponent(org.hl7.fhir.r4.model.TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionComponent tgt = new org.hl7.fhir.r5.model.TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionComponent(); + copyElement(src, tgt); + if (src.hasCode()) + tgt.setCodeElement(convertString(src.getCodeElement())); + if (src.hasIsDefault()) + tgt.setIsDefaultElement(convertBoolean(src.getIsDefaultElement())); + if (src.hasCompositional()) + tgt.setCompositionalElement(convertBoolean(src.getCompositionalElement())); + for (org.hl7.fhir.r4.model.CodeType t : src.getLanguage()) + tgt.getLanguage().add(convertCode(t)); + for (org.hl7.fhir.r4.model.TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionFilterComponent t : src.getFilter()) + tgt.addFilter(convertTerminologyCapabilitiesCodeSystemVersionFilterComponent(t)); + for (org.hl7.fhir.r4.model.CodeType t : src.getProperty()) + tgt.getProperty().add(convertCode(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionComponent convertTerminologyCapabilitiesCodeSystemVersionComponent(org.hl7.fhir.r5.model.TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionComponent tgt = new org.hl7.fhir.r4.model.TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionComponent(); + copyElement(src, tgt); + if (src.hasCode()) + tgt.setCodeElement(convertString(src.getCodeElement())); + if (src.hasIsDefault()) + tgt.setIsDefaultElement(convertBoolean(src.getIsDefaultElement())); + if (src.hasCompositional()) + tgt.setCompositionalElement(convertBoolean(src.getCompositionalElement())); + for (org.hl7.fhir.r5.model.CodeType t : src.getLanguage()) + tgt.getLanguage().add(convertCode(t)); + for (org.hl7.fhir.r5.model.TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionFilterComponent t : src.getFilter()) + tgt.addFilter(convertTerminologyCapabilitiesCodeSystemVersionFilterComponent(t)); + for (org.hl7.fhir.r5.model.CodeType t : src.getProperty()) + tgt.getProperty().add(convertCode(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionFilterComponent convertTerminologyCapabilitiesCodeSystemVersionFilterComponent(org.hl7.fhir.r4.model.TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionFilterComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionFilterComponent tgt = new org.hl7.fhir.r5.model.TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionFilterComponent(); + copyElement(src, tgt); + if (src.hasCode()) + tgt.setCodeElement(convertCode(src.getCodeElement())); + for (org.hl7.fhir.r4.model.CodeType t : src.getOp()) + tgt.getOp().add(convertCode(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionFilterComponent convertTerminologyCapabilitiesCodeSystemVersionFilterComponent(org.hl7.fhir.r5.model.TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionFilterComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionFilterComponent tgt = new org.hl7.fhir.r4.model.TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionFilterComponent(); + copyElement(src, tgt); + if (src.hasCode()) + tgt.setCodeElement(convertCode(src.getCodeElement())); + for (org.hl7.fhir.r5.model.CodeType t : src.getOp()) + tgt.getOp().add(convertCode(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.TerminologyCapabilities.TerminologyCapabilitiesExpansionComponent convertTerminologyCapabilitiesExpansionComponent(org.hl7.fhir.r4.model.TerminologyCapabilities.TerminologyCapabilitiesExpansionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.TerminologyCapabilities.TerminologyCapabilitiesExpansionComponent tgt = new org.hl7.fhir.r5.model.TerminologyCapabilities.TerminologyCapabilitiesExpansionComponent(); + copyElement(src, tgt); + if (src.hasHierarchical()) + tgt.setHierarchicalElement(convertBoolean(src.getHierarchicalElement())); + if (src.hasPaging()) + tgt.setPagingElement(convertBoolean(src.getPagingElement())); + if (src.hasIncomplete()) + tgt.setIncompleteElement(convertBoolean(src.getIncompleteElement())); + for (org.hl7.fhir.r4.model.TerminologyCapabilities.TerminologyCapabilitiesExpansionParameterComponent t : src.getParameter()) + tgt.addParameter(convertTerminologyCapabilitiesExpansionParameterComponent(t)); + if (src.hasTextFilter()) + tgt.setTextFilterElement(convertMarkdown(src.getTextFilterElement())); + return tgt; + } + + public static org.hl7.fhir.r4.model.TerminologyCapabilities.TerminologyCapabilitiesExpansionComponent convertTerminologyCapabilitiesExpansionComponent(org.hl7.fhir.r5.model.TerminologyCapabilities.TerminologyCapabilitiesExpansionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.TerminologyCapabilities.TerminologyCapabilitiesExpansionComponent tgt = new org.hl7.fhir.r4.model.TerminologyCapabilities.TerminologyCapabilitiesExpansionComponent(); + copyElement(src, tgt); + if (src.hasHierarchical()) + tgt.setHierarchicalElement(convertBoolean(src.getHierarchicalElement())); + if (src.hasPaging()) + tgt.setPagingElement(convertBoolean(src.getPagingElement())); + if (src.hasIncomplete()) + tgt.setIncompleteElement(convertBoolean(src.getIncompleteElement())); + for (org.hl7.fhir.r5.model.TerminologyCapabilities.TerminologyCapabilitiesExpansionParameterComponent t : src.getParameter()) + tgt.addParameter(convertTerminologyCapabilitiesExpansionParameterComponent(t)); + if (src.hasTextFilter()) + tgt.setTextFilterElement(convertMarkdown(src.getTextFilterElement())); + return tgt; + } + + public static org.hl7.fhir.r5.model.TerminologyCapabilities.TerminologyCapabilitiesExpansionParameterComponent convertTerminologyCapabilitiesExpansionParameterComponent(org.hl7.fhir.r4.model.TerminologyCapabilities.TerminologyCapabilitiesExpansionParameterComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.TerminologyCapabilities.TerminologyCapabilitiesExpansionParameterComponent tgt = new org.hl7.fhir.r5.model.TerminologyCapabilities.TerminologyCapabilitiesExpansionParameterComponent(); + copyElement(src, tgt); + if (src.hasName()) + tgt.setNameElement(convertCode(src.getNameElement())); + if (src.hasDocumentation()) + tgt.setDocumentationElement(convertString(src.getDocumentationElement())); + return tgt; + } + + public static org.hl7.fhir.r4.model.TerminologyCapabilities.TerminologyCapabilitiesExpansionParameterComponent convertTerminologyCapabilitiesExpansionParameterComponent(org.hl7.fhir.r5.model.TerminologyCapabilities.TerminologyCapabilitiesExpansionParameterComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.TerminologyCapabilities.TerminologyCapabilitiesExpansionParameterComponent tgt = new org.hl7.fhir.r4.model.TerminologyCapabilities.TerminologyCapabilitiesExpansionParameterComponent(); + copyElement(src, tgt); + if (src.hasName()) + tgt.setNameElement(convertCode(src.getNameElement())); + if (src.hasDocumentation()) + tgt.setDocumentationElement(convertString(src.getDocumentationElement())); + return tgt; + } + + public static org.hl7.fhir.r5.model.TerminologyCapabilities.TerminologyCapabilitiesValidateCodeComponent convertTerminologyCapabilitiesValidateCodeComponent(org.hl7.fhir.r4.model.TerminologyCapabilities.TerminologyCapabilitiesValidateCodeComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.TerminologyCapabilities.TerminologyCapabilitiesValidateCodeComponent tgt = new org.hl7.fhir.r5.model.TerminologyCapabilities.TerminologyCapabilitiesValidateCodeComponent(); + copyElement(src, tgt); + if (src.hasTranslations()) + tgt.setTranslationsElement(convertBoolean(src.getTranslationsElement())); + return tgt; + } + + public static org.hl7.fhir.r4.model.TerminologyCapabilities.TerminologyCapabilitiesValidateCodeComponent convertTerminologyCapabilitiesValidateCodeComponent(org.hl7.fhir.r5.model.TerminologyCapabilities.TerminologyCapabilitiesValidateCodeComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.TerminologyCapabilities.TerminologyCapabilitiesValidateCodeComponent tgt = new org.hl7.fhir.r4.model.TerminologyCapabilities.TerminologyCapabilitiesValidateCodeComponent(); + copyElement(src, tgt); + if (src.hasTranslations()) + tgt.setTranslationsElement(convertBoolean(src.getTranslationsElement())); + return tgt; + } + + public static org.hl7.fhir.r5.model.TerminologyCapabilities.TerminologyCapabilitiesTranslationComponent convertTerminologyCapabilitiesTranslationComponent(org.hl7.fhir.r4.model.TerminologyCapabilities.TerminologyCapabilitiesTranslationComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.TerminologyCapabilities.TerminologyCapabilitiesTranslationComponent tgt = new org.hl7.fhir.r5.model.TerminologyCapabilities.TerminologyCapabilitiesTranslationComponent(); + copyElement(src, tgt); + if (src.hasNeedsMap()) + tgt.setNeedsMapElement(convertBoolean(src.getNeedsMapElement())); + return tgt; + } + + public static org.hl7.fhir.r4.model.TerminologyCapabilities.TerminologyCapabilitiesTranslationComponent convertTerminologyCapabilitiesTranslationComponent(org.hl7.fhir.r5.model.TerminologyCapabilities.TerminologyCapabilitiesTranslationComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.TerminologyCapabilities.TerminologyCapabilitiesTranslationComponent tgt = new org.hl7.fhir.r4.model.TerminologyCapabilities.TerminologyCapabilitiesTranslationComponent(); + copyElement(src, tgt); + if (src.hasNeedsMap()) + tgt.setNeedsMapElement(convertBoolean(src.getNeedsMapElement())); + return tgt; + } + + public static org.hl7.fhir.r5.model.TerminologyCapabilities.TerminologyCapabilitiesClosureComponent convertTerminologyCapabilitiesClosureComponent(org.hl7.fhir.r4.model.TerminologyCapabilities.TerminologyCapabilitiesClosureComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.TerminologyCapabilities.TerminologyCapabilitiesClosureComponent tgt = new org.hl7.fhir.r5.model.TerminologyCapabilities.TerminologyCapabilitiesClosureComponent(); + copyElement(src, tgt); + if (src.hasTranslation()) + tgt.setTranslationElement(convertBoolean(src.getTranslationElement())); + return tgt; + } + + public static org.hl7.fhir.r4.model.TerminologyCapabilities.TerminologyCapabilitiesClosureComponent convertTerminologyCapabilitiesClosureComponent(org.hl7.fhir.r5.model.TerminologyCapabilities.TerminologyCapabilitiesClosureComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.TerminologyCapabilities.TerminologyCapabilitiesClosureComponent tgt = new org.hl7.fhir.r4.model.TerminologyCapabilities.TerminologyCapabilitiesClosureComponent(); + copyElement(src, tgt); + if (src.hasTranslation()) + tgt.setTranslationElement(convertBoolean(src.getTranslationElement())); + return tgt; + } + + +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/TestReport.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/TestReport.java new file mode 100644 index 000000000..0810a692a --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/TestReport.java @@ -0,0 +1,423 @@ +package org.hl7.fhir.convertors.conv40_50; + +import org.hl7.fhir.exceptions.FHIRException; + +import org.hl7.fhir.convertors.VersionConvertor_40_50; + + +/* + Copyright (c) 2011+, HL7, Inc. + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of HL7 nor the names of its contributors may be used to + endorse or promote products derived from this software without specific + prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + +*/ + +// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0 + + +public class TestReport extends VersionConvertor_40_50 { + + public static org.hl7.fhir.r5.model.TestReport convertTestReport(org.hl7.fhir.r4.model.TestReport src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.TestReport tgt = new org.hl7.fhir.r5.model.TestReport(); + copyDomainResource(src, tgt); + if (src.hasIdentifier()) + tgt.setIdentifier(convertIdentifier(src.getIdentifier())); + if (src.hasName()) + tgt.setNameElement(convertString(src.getNameElement())); + if (src.hasStatus()) + tgt.setStatus(convertTestReportStatus(src.getStatus())); + if (src.hasTestScript()) + tgt.setTestScript(convertReference(src.getTestScript())); + if (src.hasResult()) + tgt.setResult(convertTestReportResult(src.getResult())); + if (src.hasScore()) + tgt.setScoreElement(convertDecimal(src.getScoreElement())); + if (src.hasTester()) + tgt.setTesterElement(convertString(src.getTesterElement())); + if (src.hasIssued()) + tgt.setIssuedElement(convertDateTime(src.getIssuedElement())); + for (org.hl7.fhir.r4.model.TestReport.TestReportParticipantComponent t : src.getParticipant()) + tgt.addParticipant(convertTestReportParticipantComponent(t)); + if (src.hasSetup()) + tgt.setSetup(convertTestReportSetupComponent(src.getSetup())); + for (org.hl7.fhir.r4.model.TestReport.TestReportTestComponent t : src.getTest()) + tgt.addTest(convertTestReportTestComponent(t)); + if (src.hasTeardown()) + tgt.setTeardown(convertTestReportTeardownComponent(src.getTeardown())); + return tgt; + } + + public static org.hl7.fhir.r4.model.TestReport convertTestReport(org.hl7.fhir.r5.model.TestReport src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.TestReport tgt = new org.hl7.fhir.r4.model.TestReport(); + copyDomainResource(src, tgt); + if (src.hasIdentifier()) + tgt.setIdentifier(convertIdentifier(src.getIdentifier())); + if (src.hasName()) + tgt.setNameElement(convertString(src.getNameElement())); + if (src.hasStatus()) + tgt.setStatus(convertTestReportStatus(src.getStatus())); + if (src.hasTestScript()) + tgt.setTestScript(convertReference(src.getTestScript())); + if (src.hasResult()) + tgt.setResult(convertTestReportResult(src.getResult())); + if (src.hasScore()) + tgt.setScoreElement(convertDecimal(src.getScoreElement())); + if (src.hasTester()) + tgt.setTesterElement(convertString(src.getTesterElement())); + if (src.hasIssued()) + tgt.setIssuedElement(convertDateTime(src.getIssuedElement())); + for (org.hl7.fhir.r5.model.TestReport.TestReportParticipantComponent t : src.getParticipant()) + tgt.addParticipant(convertTestReportParticipantComponent(t)); + if (src.hasSetup()) + tgt.setSetup(convertTestReportSetupComponent(src.getSetup())); + for (org.hl7.fhir.r5.model.TestReport.TestReportTestComponent t : src.getTest()) + tgt.addTest(convertTestReportTestComponent(t)); + if (src.hasTeardown()) + tgt.setTeardown(convertTestReportTeardownComponent(src.getTeardown())); + return tgt; + } + + public static org.hl7.fhir.r5.model.TestReport.TestReportStatus convertTestReportStatus(org.hl7.fhir.r4.model.TestReport.TestReportStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case COMPLETED: return org.hl7.fhir.r5.model.TestReport.TestReportStatus.COMPLETED; + case INPROGRESS: return org.hl7.fhir.r5.model.TestReport.TestReportStatus.INPROGRESS; + case WAITING: return org.hl7.fhir.r5.model.TestReport.TestReportStatus.WAITING; + case STOPPED: return org.hl7.fhir.r5.model.TestReport.TestReportStatus.STOPPED; + case ENTEREDINERROR: return org.hl7.fhir.r5.model.TestReport.TestReportStatus.ENTEREDINERROR; + default: return org.hl7.fhir.r5.model.TestReport.TestReportStatus.NULL; + } +} + + public static org.hl7.fhir.r4.model.TestReport.TestReportStatus convertTestReportStatus(org.hl7.fhir.r5.model.TestReport.TestReportStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case COMPLETED: return org.hl7.fhir.r4.model.TestReport.TestReportStatus.COMPLETED; + case INPROGRESS: return org.hl7.fhir.r4.model.TestReport.TestReportStatus.INPROGRESS; + case WAITING: return org.hl7.fhir.r4.model.TestReport.TestReportStatus.WAITING; + case STOPPED: return org.hl7.fhir.r4.model.TestReport.TestReportStatus.STOPPED; + case ENTEREDINERROR: return org.hl7.fhir.r4.model.TestReport.TestReportStatus.ENTEREDINERROR; + default: return org.hl7.fhir.r4.model.TestReport.TestReportStatus.NULL; + } +} + + public static org.hl7.fhir.r5.model.TestReport.TestReportResult convertTestReportResult(org.hl7.fhir.r4.model.TestReport.TestReportResult src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PASS: return org.hl7.fhir.r5.model.TestReport.TestReportResult.PASS; + case FAIL: return org.hl7.fhir.r5.model.TestReport.TestReportResult.FAIL; + case PENDING: return org.hl7.fhir.r5.model.TestReport.TestReportResult.PENDING; + default: return org.hl7.fhir.r5.model.TestReport.TestReportResult.NULL; + } +} + + public static org.hl7.fhir.r4.model.TestReport.TestReportResult convertTestReportResult(org.hl7.fhir.r5.model.TestReport.TestReportResult src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PASS: return org.hl7.fhir.r4.model.TestReport.TestReportResult.PASS; + case FAIL: return org.hl7.fhir.r4.model.TestReport.TestReportResult.FAIL; + case PENDING: return org.hl7.fhir.r4.model.TestReport.TestReportResult.PENDING; + default: return org.hl7.fhir.r4.model.TestReport.TestReportResult.NULL; + } +} + + public static org.hl7.fhir.r5.model.TestReport.TestReportParticipantComponent convertTestReportParticipantComponent(org.hl7.fhir.r4.model.TestReport.TestReportParticipantComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.TestReport.TestReportParticipantComponent tgt = new org.hl7.fhir.r5.model.TestReport.TestReportParticipantComponent(); + copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertTestReportParticipantType(src.getType())); + if (src.hasUri()) + tgt.setUriElement(convertUri(src.getUriElement())); + if (src.hasDisplay()) + tgt.setDisplayElement(convertString(src.getDisplayElement())); + return tgt; + } + + public static org.hl7.fhir.r4.model.TestReport.TestReportParticipantComponent convertTestReportParticipantComponent(org.hl7.fhir.r5.model.TestReport.TestReportParticipantComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.TestReport.TestReportParticipantComponent tgt = new org.hl7.fhir.r4.model.TestReport.TestReportParticipantComponent(); + copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertTestReportParticipantType(src.getType())); + if (src.hasUri()) + tgt.setUriElement(convertUri(src.getUriElement())); + if (src.hasDisplay()) + tgt.setDisplayElement(convertString(src.getDisplayElement())); + return tgt; + } + + public static org.hl7.fhir.r5.model.TestReport.TestReportParticipantType convertTestReportParticipantType(org.hl7.fhir.r4.model.TestReport.TestReportParticipantType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case TESTENGINE: return org.hl7.fhir.r5.model.TestReport.TestReportParticipantType.TESTENGINE; + case CLIENT: return org.hl7.fhir.r5.model.TestReport.TestReportParticipantType.CLIENT; + case SERVER: return org.hl7.fhir.r5.model.TestReport.TestReportParticipantType.SERVER; + default: return org.hl7.fhir.r5.model.TestReport.TestReportParticipantType.NULL; + } +} + + public static org.hl7.fhir.r4.model.TestReport.TestReportParticipantType convertTestReportParticipantType(org.hl7.fhir.r5.model.TestReport.TestReportParticipantType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case TESTENGINE: return org.hl7.fhir.r4.model.TestReport.TestReportParticipantType.TESTENGINE; + case CLIENT: return org.hl7.fhir.r4.model.TestReport.TestReportParticipantType.CLIENT; + case SERVER: return org.hl7.fhir.r4.model.TestReport.TestReportParticipantType.SERVER; + default: return org.hl7.fhir.r4.model.TestReport.TestReportParticipantType.NULL; + } +} + + public static org.hl7.fhir.r5.model.TestReport.TestReportSetupComponent convertTestReportSetupComponent(org.hl7.fhir.r4.model.TestReport.TestReportSetupComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.TestReport.TestReportSetupComponent tgt = new org.hl7.fhir.r5.model.TestReport.TestReportSetupComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.r4.model.TestReport.SetupActionComponent t : src.getAction()) + tgt.addAction(convertSetupActionComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.TestReport.TestReportSetupComponent convertTestReportSetupComponent(org.hl7.fhir.r5.model.TestReport.TestReportSetupComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.TestReport.TestReportSetupComponent tgt = new org.hl7.fhir.r4.model.TestReport.TestReportSetupComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.r5.model.TestReport.SetupActionComponent t : src.getAction()) + tgt.addAction(convertSetupActionComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.TestReport.SetupActionComponent convertSetupActionComponent(org.hl7.fhir.r4.model.TestReport.SetupActionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.TestReport.SetupActionComponent tgt = new org.hl7.fhir.r5.model.TestReport.SetupActionComponent(); + copyElement(src, tgt); + if (src.hasOperation()) + tgt.setOperation(convertSetupActionOperationComponent(src.getOperation())); + if (src.hasAssert()) + tgt.setAssert(convertSetupActionAssertComponent(src.getAssert())); + return tgt; + } + + public static org.hl7.fhir.r4.model.TestReport.SetupActionComponent convertSetupActionComponent(org.hl7.fhir.r5.model.TestReport.SetupActionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.TestReport.SetupActionComponent tgt = new org.hl7.fhir.r4.model.TestReport.SetupActionComponent(); + copyElement(src, tgt); + if (src.hasOperation()) + tgt.setOperation(convertSetupActionOperationComponent(src.getOperation())); + if (src.hasAssert()) + tgt.setAssert(convertSetupActionAssertComponent(src.getAssert())); + return tgt; + } + + public static org.hl7.fhir.r5.model.TestReport.SetupActionOperationComponent convertSetupActionOperationComponent(org.hl7.fhir.r4.model.TestReport.SetupActionOperationComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.TestReport.SetupActionOperationComponent tgt = new org.hl7.fhir.r5.model.TestReport.SetupActionOperationComponent(); + copyElement(src, tgt); + if (src.hasResult()) + tgt.setResult(convertTestReportActionResult(src.getResult())); + if (src.hasMessage()) + tgt.setMessageElement(convertMarkdown(src.getMessageElement())); + if (src.hasDetail()) + tgt.setDetailElement(convertUri(src.getDetailElement())); + return tgt; + } + + public static org.hl7.fhir.r4.model.TestReport.SetupActionOperationComponent convertSetupActionOperationComponent(org.hl7.fhir.r5.model.TestReport.SetupActionOperationComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.TestReport.SetupActionOperationComponent tgt = new org.hl7.fhir.r4.model.TestReport.SetupActionOperationComponent(); + copyElement(src, tgt); + if (src.hasResult()) + tgt.setResult(convertTestReportActionResult(src.getResult())); + if (src.hasMessage()) + tgt.setMessageElement(convertMarkdown(src.getMessageElement())); + if (src.hasDetail()) + tgt.setDetailElement(convertUri(src.getDetailElement())); + return tgt; + } + + public static org.hl7.fhir.r5.model.TestReport.TestReportActionResult convertTestReportActionResult(org.hl7.fhir.r4.model.TestReport.TestReportActionResult src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PASS: return org.hl7.fhir.r5.model.TestReport.TestReportActionResult.PASS; + case SKIP: return org.hl7.fhir.r5.model.TestReport.TestReportActionResult.SKIP; + case FAIL: return org.hl7.fhir.r5.model.TestReport.TestReportActionResult.FAIL; + case WARNING: return org.hl7.fhir.r5.model.TestReport.TestReportActionResult.WARNING; + case ERROR: return org.hl7.fhir.r5.model.TestReport.TestReportActionResult.ERROR; + default: return org.hl7.fhir.r5.model.TestReport.TestReportActionResult.NULL; + } +} + + public static org.hl7.fhir.r4.model.TestReport.TestReportActionResult convertTestReportActionResult(org.hl7.fhir.r5.model.TestReport.TestReportActionResult src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PASS: return org.hl7.fhir.r4.model.TestReport.TestReportActionResult.PASS; + case SKIP: return org.hl7.fhir.r4.model.TestReport.TestReportActionResult.SKIP; + case FAIL: return org.hl7.fhir.r4.model.TestReport.TestReportActionResult.FAIL; + case WARNING: return org.hl7.fhir.r4.model.TestReport.TestReportActionResult.WARNING; + case ERROR: return org.hl7.fhir.r4.model.TestReport.TestReportActionResult.ERROR; + default: return org.hl7.fhir.r4.model.TestReport.TestReportActionResult.NULL; + } +} + + public static org.hl7.fhir.r5.model.TestReport.SetupActionAssertComponent convertSetupActionAssertComponent(org.hl7.fhir.r4.model.TestReport.SetupActionAssertComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.TestReport.SetupActionAssertComponent tgt = new org.hl7.fhir.r5.model.TestReport.SetupActionAssertComponent(); + copyElement(src, tgt); + if (src.hasResult()) + tgt.setResult(convertTestReportActionResult(src.getResult())); + if (src.hasMessage()) + tgt.setMessageElement(convertMarkdown(src.getMessageElement())); + if (src.hasDetail()) + tgt.setDetailElement(convertString(src.getDetailElement())); + return tgt; + } + + public static org.hl7.fhir.r4.model.TestReport.SetupActionAssertComponent convertSetupActionAssertComponent(org.hl7.fhir.r5.model.TestReport.SetupActionAssertComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.TestReport.SetupActionAssertComponent tgt = new org.hl7.fhir.r4.model.TestReport.SetupActionAssertComponent(); + copyElement(src, tgt); + if (src.hasResult()) + tgt.setResult(convertTestReportActionResult(src.getResult())); + if (src.hasMessage()) + tgt.setMessageElement(convertMarkdown(src.getMessageElement())); + if (src.hasDetail()) + tgt.setDetailElement(convertString(src.getDetailElement())); + return tgt; + } + + public static org.hl7.fhir.r5.model.TestReport.TestReportTestComponent convertTestReportTestComponent(org.hl7.fhir.r4.model.TestReport.TestReportTestComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.TestReport.TestReportTestComponent tgt = new org.hl7.fhir.r5.model.TestReport.TestReportTestComponent(); + copyElement(src, tgt); + if (src.hasName()) + tgt.setNameElement(convertString(src.getNameElement())); + if (src.hasDescription()) + tgt.setDescriptionElement(convertString(src.getDescriptionElement())); + for (org.hl7.fhir.r4.model.TestReport.TestActionComponent t : src.getAction()) + tgt.addAction(convertTestActionComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.TestReport.TestReportTestComponent convertTestReportTestComponent(org.hl7.fhir.r5.model.TestReport.TestReportTestComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.TestReport.TestReportTestComponent tgt = new org.hl7.fhir.r4.model.TestReport.TestReportTestComponent(); + copyElement(src, tgt); + if (src.hasName()) + tgt.setNameElement(convertString(src.getNameElement())); + if (src.hasDescription()) + tgt.setDescriptionElement(convertString(src.getDescriptionElement())); + for (org.hl7.fhir.r5.model.TestReport.TestActionComponent t : src.getAction()) + tgt.addAction(convertTestActionComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.TestReport.TestActionComponent convertTestActionComponent(org.hl7.fhir.r4.model.TestReport.TestActionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.TestReport.TestActionComponent tgt = new org.hl7.fhir.r5.model.TestReport.TestActionComponent(); + copyElement(src, tgt); + if (src.hasOperation()) + tgt.setOperation(convertSetupActionOperationComponent(src.getOperation())); + if (src.hasAssert()) + tgt.setAssert(convertSetupActionAssertComponent(src.getAssert())); + return tgt; + } + + public static org.hl7.fhir.r4.model.TestReport.TestActionComponent convertTestActionComponent(org.hl7.fhir.r5.model.TestReport.TestActionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.TestReport.TestActionComponent tgt = new org.hl7.fhir.r4.model.TestReport.TestActionComponent(); + copyElement(src, tgt); + if (src.hasOperation()) + tgt.setOperation(convertSetupActionOperationComponent(src.getOperation())); + if (src.hasAssert()) + tgt.setAssert(convertSetupActionAssertComponent(src.getAssert())); + return tgt; + } + + public static org.hl7.fhir.r5.model.TestReport.TestReportTeardownComponent convertTestReportTeardownComponent(org.hl7.fhir.r4.model.TestReport.TestReportTeardownComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.TestReport.TestReportTeardownComponent tgt = new org.hl7.fhir.r5.model.TestReport.TestReportTeardownComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.r4.model.TestReport.TeardownActionComponent t : src.getAction()) + tgt.addAction(convertTeardownActionComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.TestReport.TestReportTeardownComponent convertTestReportTeardownComponent(org.hl7.fhir.r5.model.TestReport.TestReportTeardownComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.TestReport.TestReportTeardownComponent tgt = new org.hl7.fhir.r4.model.TestReport.TestReportTeardownComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.r5.model.TestReport.TeardownActionComponent t : src.getAction()) + tgt.addAction(convertTeardownActionComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.TestReport.TeardownActionComponent convertTeardownActionComponent(org.hl7.fhir.r4.model.TestReport.TeardownActionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.TestReport.TeardownActionComponent tgt = new org.hl7.fhir.r5.model.TestReport.TeardownActionComponent(); + copyElement(src, tgt); + if (src.hasOperation()) + tgt.setOperation(convertSetupActionOperationComponent(src.getOperation())); + return tgt; + } + + public static org.hl7.fhir.r4.model.TestReport.TeardownActionComponent convertTeardownActionComponent(org.hl7.fhir.r5.model.TestReport.TeardownActionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.TestReport.TeardownActionComponent tgt = new org.hl7.fhir.r4.model.TestReport.TeardownActionComponent(); + copyElement(src, tgt); + if (src.hasOperation()) + tgt.setOperation(convertSetupActionOperationComponent(src.getOperation())); + return tgt; + } + + +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/TestScript.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/TestScript.java new file mode 100644 index 000000000..ad3e0ccb4 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/TestScript.java @@ -0,0 +1,847 @@ +package org.hl7.fhir.convertors.conv40_50; + +import org.hl7.fhir.exceptions.FHIRException; + +import org.hl7.fhir.convertors.VersionConvertor_40_50; + + +/* + Copyright (c) 2011+, HL7, Inc. + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of HL7 nor the names of its contributors may be used to + endorse or promote products derived from this software without specific + prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + +*/ + +// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0 + + +public class TestScript extends VersionConvertor_40_50 { + + public static org.hl7.fhir.r5.model.TestScript convertTestScript(org.hl7.fhir.r4.model.TestScript src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.TestScript tgt = new org.hl7.fhir.r5.model.TestScript(); + copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrlElement(convertUri(src.getUrlElement())); + if (src.hasIdentifier()) + tgt.setIdentifier(convertIdentifier(src.getIdentifier())); + if (src.hasVersion()) + tgt.setVersionElement(convertString(src.getVersionElement())); + if (src.hasName()) + tgt.setNameElement(convertString(src.getNameElement())); + if (src.hasTitle()) + tgt.setTitleElement(convertString(src.getTitleElement())); + if (src.hasStatus()) + tgt.setStatus(Enumerations.convertPublicationStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimentalElement(convertBoolean(src.getExperimentalElement())); + if (src.hasDate()) + tgt.setDateElement(convertDateTime(src.getDateElement())); + if (src.hasPublisher()) + tgt.setPublisherElement(convertString(src.getPublisherElement())); + for (org.hl7.fhir.r4.model.ContactDetail t : src.getContact()) + tgt.addContact(convertContactDetail(t)); + if (src.hasDescription()) + tgt.setDescriptionElement(convertMarkdown(src.getDescriptionElement())); + for (org.hl7.fhir.r4.model.UsageContext t : src.getUseContext()) + tgt.addUseContext(convertUsageContext(t)); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getJurisdiction()) + tgt.addJurisdiction(convertCodeableConcept(t)); + if (src.hasPurpose()) + tgt.setPurposeElement(convertMarkdown(src.getPurposeElement())); + if (src.hasCopyright()) + tgt.setCopyrightElement(convertMarkdown(src.getCopyrightElement())); + for (org.hl7.fhir.r4.model.TestScript.TestScriptOriginComponent t : src.getOrigin()) + tgt.addOrigin(convertTestScriptOriginComponent(t)); + for (org.hl7.fhir.r4.model.TestScript.TestScriptDestinationComponent t : src.getDestination()) + tgt.addDestination(convertTestScriptDestinationComponent(t)); + if (src.hasMetadata()) + tgt.setMetadata(convertTestScriptMetadataComponent(src.getMetadata())); + for (org.hl7.fhir.r4.model.TestScript.TestScriptFixtureComponent t : src.getFixture()) + tgt.addFixture(convertTestScriptFixtureComponent(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getProfile()) + tgt.addProfile(convertReference(t)); + for (org.hl7.fhir.r4.model.TestScript.TestScriptVariableComponent t : src.getVariable()) + tgt.addVariable(convertTestScriptVariableComponent(t)); + if (src.hasSetup()) + tgt.setSetup(convertTestScriptSetupComponent(src.getSetup())); + for (org.hl7.fhir.r4.model.TestScript.TestScriptTestComponent t : src.getTest()) + tgt.addTest(convertTestScriptTestComponent(t)); + if (src.hasTeardown()) + tgt.setTeardown(convertTestScriptTeardownComponent(src.getTeardown())); + return tgt; + } + + public static org.hl7.fhir.r4.model.TestScript convertTestScript(org.hl7.fhir.r5.model.TestScript src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.TestScript tgt = new org.hl7.fhir.r4.model.TestScript(); + copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrlElement(convertUri(src.getUrlElement())); + if (src.hasIdentifier()) + tgt.setIdentifier(convertIdentifier(src.getIdentifier())); + if (src.hasVersion()) + tgt.setVersionElement(convertString(src.getVersionElement())); + if (src.hasName()) + tgt.setNameElement(convertString(src.getNameElement())); + if (src.hasTitle()) + tgt.setTitleElement(convertString(src.getTitleElement())); + if (src.hasStatus()) + tgt.setStatus(Enumerations.convertPublicationStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimentalElement(convertBoolean(src.getExperimentalElement())); + if (src.hasDate()) + tgt.setDateElement(convertDateTime(src.getDateElement())); + if (src.hasPublisher()) + tgt.setPublisherElement(convertString(src.getPublisherElement())); + for (org.hl7.fhir.r5.model.ContactDetail t : src.getContact()) + tgt.addContact(convertContactDetail(t)); + if (src.hasDescription()) + tgt.setDescriptionElement(convertMarkdown(src.getDescriptionElement())); + for (org.hl7.fhir.r5.model.UsageContext t : src.getUseContext()) + tgt.addUseContext(convertUsageContext(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getJurisdiction()) + tgt.addJurisdiction(convertCodeableConcept(t)); + if (src.hasPurpose()) + tgt.setPurposeElement(convertMarkdown(src.getPurposeElement())); + if (src.hasCopyright()) + tgt.setCopyrightElement(convertMarkdown(src.getCopyrightElement())); + for (org.hl7.fhir.r5.model.TestScript.TestScriptOriginComponent t : src.getOrigin()) + tgt.addOrigin(convertTestScriptOriginComponent(t)); + for (org.hl7.fhir.r5.model.TestScript.TestScriptDestinationComponent t : src.getDestination()) + tgt.addDestination(convertTestScriptDestinationComponent(t)); + if (src.hasMetadata()) + tgt.setMetadata(convertTestScriptMetadataComponent(src.getMetadata())); + for (org.hl7.fhir.r5.model.TestScript.TestScriptFixtureComponent t : src.getFixture()) + tgt.addFixture(convertTestScriptFixtureComponent(t)); + for (org.hl7.fhir.r5.model.Reference t : src.getProfile()) + tgt.addProfile(convertReference(t)); + for (org.hl7.fhir.r5.model.TestScript.TestScriptVariableComponent t : src.getVariable()) + tgt.addVariable(convertTestScriptVariableComponent(t)); + if (src.hasSetup()) + tgt.setSetup(convertTestScriptSetupComponent(src.getSetup())); + for (org.hl7.fhir.r5.model.TestScript.TestScriptTestComponent t : src.getTest()) + tgt.addTest(convertTestScriptTestComponent(t)); + if (src.hasTeardown()) + tgt.setTeardown(convertTestScriptTeardownComponent(src.getTeardown())); + return tgt; + } + + public static org.hl7.fhir.r5.model.TestScript.TestScriptOriginComponent convertTestScriptOriginComponent(org.hl7.fhir.r4.model.TestScript.TestScriptOriginComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.TestScript.TestScriptOriginComponent tgt = new org.hl7.fhir.r5.model.TestScript.TestScriptOriginComponent(); + copyElement(src, tgt); + if (src.hasIndex()) + tgt.setIndexElement(convertInteger(src.getIndexElement())); + if (src.hasProfile()) + tgt.setProfile(convertCoding(src.getProfile())); + return tgt; + } + + public static org.hl7.fhir.r4.model.TestScript.TestScriptOriginComponent convertTestScriptOriginComponent(org.hl7.fhir.r5.model.TestScript.TestScriptOriginComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.TestScript.TestScriptOriginComponent tgt = new org.hl7.fhir.r4.model.TestScript.TestScriptOriginComponent(); + copyElement(src, tgt); + if (src.hasIndex()) + tgt.setIndexElement(convertInteger(src.getIndexElement())); + if (src.hasProfile()) + tgt.setProfile(convertCoding(src.getProfile())); + return tgt; + } + + public static org.hl7.fhir.r5.model.TestScript.TestScriptDestinationComponent convertTestScriptDestinationComponent(org.hl7.fhir.r4.model.TestScript.TestScriptDestinationComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.TestScript.TestScriptDestinationComponent tgt = new org.hl7.fhir.r5.model.TestScript.TestScriptDestinationComponent(); + copyElement(src, tgt); + if (src.hasIndex()) + tgt.setIndexElement(convertInteger(src.getIndexElement())); + if (src.hasProfile()) + tgt.setProfile(convertCoding(src.getProfile())); + return tgt; + } + + public static org.hl7.fhir.r4.model.TestScript.TestScriptDestinationComponent convertTestScriptDestinationComponent(org.hl7.fhir.r5.model.TestScript.TestScriptDestinationComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.TestScript.TestScriptDestinationComponent tgt = new org.hl7.fhir.r4.model.TestScript.TestScriptDestinationComponent(); + copyElement(src, tgt); + if (src.hasIndex()) + tgt.setIndexElement(convertInteger(src.getIndexElement())); + if (src.hasProfile()) + tgt.setProfile(convertCoding(src.getProfile())); + return tgt; + } + + public static org.hl7.fhir.r5.model.TestScript.TestScriptMetadataComponent convertTestScriptMetadataComponent(org.hl7.fhir.r4.model.TestScript.TestScriptMetadataComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.TestScript.TestScriptMetadataComponent tgt = new org.hl7.fhir.r5.model.TestScript.TestScriptMetadataComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.r4.model.TestScript.TestScriptMetadataLinkComponent t : src.getLink()) + tgt.addLink(convertTestScriptMetadataLinkComponent(t)); + for (org.hl7.fhir.r4.model.TestScript.TestScriptMetadataCapabilityComponent t : src.getCapability()) + tgt.addCapability(convertTestScriptMetadataCapabilityComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.TestScript.TestScriptMetadataComponent convertTestScriptMetadataComponent(org.hl7.fhir.r5.model.TestScript.TestScriptMetadataComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.TestScript.TestScriptMetadataComponent tgt = new org.hl7.fhir.r4.model.TestScript.TestScriptMetadataComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.r5.model.TestScript.TestScriptMetadataLinkComponent t : src.getLink()) + tgt.addLink(convertTestScriptMetadataLinkComponent(t)); + for (org.hl7.fhir.r5.model.TestScript.TestScriptMetadataCapabilityComponent t : src.getCapability()) + tgt.addCapability(convertTestScriptMetadataCapabilityComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.TestScript.TestScriptMetadataLinkComponent convertTestScriptMetadataLinkComponent(org.hl7.fhir.r4.model.TestScript.TestScriptMetadataLinkComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.TestScript.TestScriptMetadataLinkComponent tgt = new org.hl7.fhir.r5.model.TestScript.TestScriptMetadataLinkComponent(); + copyElement(src, tgt); + if (src.hasUrl()) + tgt.setUrlElement(convertUri(src.getUrlElement())); + if (src.hasDescription()) + tgt.setDescriptionElement(convertString(src.getDescriptionElement())); + return tgt; + } + + public static org.hl7.fhir.r4.model.TestScript.TestScriptMetadataLinkComponent convertTestScriptMetadataLinkComponent(org.hl7.fhir.r5.model.TestScript.TestScriptMetadataLinkComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.TestScript.TestScriptMetadataLinkComponent tgt = new org.hl7.fhir.r4.model.TestScript.TestScriptMetadataLinkComponent(); + copyElement(src, tgt); + if (src.hasUrl()) + tgt.setUrlElement(convertUri(src.getUrlElement())); + if (src.hasDescription()) + tgt.setDescriptionElement(convertString(src.getDescriptionElement())); + return tgt; + } + + public static org.hl7.fhir.r5.model.TestScript.TestScriptMetadataCapabilityComponent convertTestScriptMetadataCapabilityComponent(org.hl7.fhir.r4.model.TestScript.TestScriptMetadataCapabilityComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.TestScript.TestScriptMetadataCapabilityComponent tgt = new org.hl7.fhir.r5.model.TestScript.TestScriptMetadataCapabilityComponent(); + copyElement(src, tgt); + if (src.hasRequired()) + tgt.setRequiredElement(convertBoolean(src.getRequiredElement())); + if (src.hasValidated()) + tgt.setValidatedElement(convertBoolean(src.getValidatedElement())); + if (src.hasDescription()) + tgt.setDescriptionElement(convertString(src.getDescriptionElement())); + for (org.hl7.fhir.r4.model.IntegerType t : src.getOrigin()) + tgt.getOrigin().add(convertInteger(t)); + if (src.hasDestination()) + tgt.setDestinationElement(convertInteger(src.getDestinationElement())); + for (org.hl7.fhir.r4.model.UriType t : src.getLink()) + tgt.getLink().add(convertUri(t)); + if (src.hasCapabilities()) + tgt.setCapabilitiesElement(convertCanonical(src.getCapabilitiesElement())); + return tgt; + } + + public static org.hl7.fhir.r4.model.TestScript.TestScriptMetadataCapabilityComponent convertTestScriptMetadataCapabilityComponent(org.hl7.fhir.r5.model.TestScript.TestScriptMetadataCapabilityComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.TestScript.TestScriptMetadataCapabilityComponent tgt = new org.hl7.fhir.r4.model.TestScript.TestScriptMetadataCapabilityComponent(); + copyElement(src, tgt); + if (src.hasRequired()) + tgt.setRequiredElement(convertBoolean(src.getRequiredElement())); + if (src.hasValidated()) + tgt.setValidatedElement(convertBoolean(src.getValidatedElement())); + if (src.hasDescription()) + tgt.setDescriptionElement(convertString(src.getDescriptionElement())); + for (org.hl7.fhir.r5.model.IntegerType t : src.getOrigin()) + tgt.getOrigin().add(convertInteger(t)); + if (src.hasDestination()) + tgt.setDestinationElement(convertInteger(src.getDestinationElement())); + for (org.hl7.fhir.r5.model.UriType t : src.getLink()) + tgt.getLink().add(convertUri(t)); + if (src.hasCapabilities()) + tgt.setCapabilitiesElement(convertCanonical(src.getCapabilitiesElement())); + return tgt; + } + + public static org.hl7.fhir.r5.model.TestScript.TestScriptFixtureComponent convertTestScriptFixtureComponent(org.hl7.fhir.r4.model.TestScript.TestScriptFixtureComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.TestScript.TestScriptFixtureComponent tgt = new org.hl7.fhir.r5.model.TestScript.TestScriptFixtureComponent(); + copyElement(src, tgt); + if (src.hasAutocreate()) + tgt.setAutocreateElement(convertBoolean(src.getAutocreateElement())); + if (src.hasAutodelete()) + tgt.setAutodeleteElement(convertBoolean(src.getAutodeleteElement())); + if (src.hasResource()) + tgt.setResource(convertReference(src.getResource())); + return tgt; + } + + public static org.hl7.fhir.r4.model.TestScript.TestScriptFixtureComponent convertTestScriptFixtureComponent(org.hl7.fhir.r5.model.TestScript.TestScriptFixtureComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.TestScript.TestScriptFixtureComponent tgt = new org.hl7.fhir.r4.model.TestScript.TestScriptFixtureComponent(); + copyElement(src, tgt); + if (src.hasAutocreate()) + tgt.setAutocreateElement(convertBoolean(src.getAutocreateElement())); + if (src.hasAutodelete()) + tgt.setAutodeleteElement(convertBoolean(src.getAutodeleteElement())); + if (src.hasResource()) + tgt.setResource(convertReference(src.getResource())); + return tgt; + } + + public static org.hl7.fhir.r5.model.TestScript.TestScriptVariableComponent convertTestScriptVariableComponent(org.hl7.fhir.r4.model.TestScript.TestScriptVariableComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.TestScript.TestScriptVariableComponent tgt = new org.hl7.fhir.r5.model.TestScript.TestScriptVariableComponent(); + copyElement(src, tgt); + if (src.hasName()) + tgt.setNameElement(convertString(src.getNameElement())); + if (src.hasDefaultValue()) + tgt.setDefaultValueElement(convertString(src.getDefaultValueElement())); + if (src.hasDescription()) + tgt.setDescriptionElement(convertString(src.getDescriptionElement())); + if (src.hasExpression()) + tgt.setExpressionElement(convertString(src.getExpressionElement())); + if (src.hasHeaderField()) + tgt.setHeaderFieldElement(convertString(src.getHeaderFieldElement())); + if (src.hasHint()) + tgt.setHintElement(convertString(src.getHintElement())); + if (src.hasPath()) + tgt.setPathElement(convertString(src.getPathElement())); + if (src.hasSourceId()) + tgt.setSourceIdElement(convertId(src.getSourceIdElement())); + return tgt; + } + + public static org.hl7.fhir.r4.model.TestScript.TestScriptVariableComponent convertTestScriptVariableComponent(org.hl7.fhir.r5.model.TestScript.TestScriptVariableComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.TestScript.TestScriptVariableComponent tgt = new org.hl7.fhir.r4.model.TestScript.TestScriptVariableComponent(); + copyElement(src, tgt); + if (src.hasName()) + tgt.setNameElement(convertString(src.getNameElement())); + if (src.hasDefaultValue()) + tgt.setDefaultValueElement(convertString(src.getDefaultValueElement())); + if (src.hasDescription()) + tgt.setDescriptionElement(convertString(src.getDescriptionElement())); + if (src.hasExpression()) + tgt.setExpressionElement(convertString(src.getExpressionElement())); + if (src.hasHeaderField()) + tgt.setHeaderFieldElement(convertString(src.getHeaderFieldElement())); + if (src.hasHint()) + tgt.setHintElement(convertString(src.getHintElement())); + if (src.hasPath()) + tgt.setPathElement(convertString(src.getPathElement())); + if (src.hasSourceId()) + tgt.setSourceIdElement(convertId(src.getSourceIdElement())); + return tgt; + } + + public static org.hl7.fhir.r5.model.TestScript.TestScriptSetupComponent convertTestScriptSetupComponent(org.hl7.fhir.r4.model.TestScript.TestScriptSetupComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.TestScript.TestScriptSetupComponent tgt = new org.hl7.fhir.r5.model.TestScript.TestScriptSetupComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.r4.model.TestScript.SetupActionComponent t : src.getAction()) + tgt.addAction(convertSetupActionComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.TestScript.TestScriptSetupComponent convertTestScriptSetupComponent(org.hl7.fhir.r5.model.TestScript.TestScriptSetupComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.TestScript.TestScriptSetupComponent tgt = new org.hl7.fhir.r4.model.TestScript.TestScriptSetupComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.r5.model.TestScript.SetupActionComponent t : src.getAction()) + tgt.addAction(convertSetupActionComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.TestScript.SetupActionComponent convertSetupActionComponent(org.hl7.fhir.r4.model.TestScript.SetupActionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.TestScript.SetupActionComponent tgt = new org.hl7.fhir.r5.model.TestScript.SetupActionComponent(); + copyElement(src, tgt); + if (src.hasOperation()) + tgt.setOperation(convertSetupActionOperationComponent(src.getOperation())); + if (src.hasAssert()) + tgt.setAssert(convertSetupActionAssertComponent(src.getAssert())); + return tgt; + } + + public static org.hl7.fhir.r4.model.TestScript.SetupActionComponent convertSetupActionComponent(org.hl7.fhir.r5.model.TestScript.SetupActionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.TestScript.SetupActionComponent tgt = new org.hl7.fhir.r4.model.TestScript.SetupActionComponent(); + copyElement(src, tgt); + if (src.hasOperation()) + tgt.setOperation(convertSetupActionOperationComponent(src.getOperation())); + if (src.hasAssert()) + tgt.setAssert(convertSetupActionAssertComponent(src.getAssert())); + return tgt; + } + + public static org.hl7.fhir.r5.model.TestScript.SetupActionOperationComponent convertSetupActionOperationComponent(org.hl7.fhir.r4.model.TestScript.SetupActionOperationComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.TestScript.SetupActionOperationComponent tgt = new org.hl7.fhir.r5.model.TestScript.SetupActionOperationComponent(); + copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertCoding(src.getType())); + if (src.hasResource()) + tgt.setResourceElement(convertCode(src.getResourceElement())); + if (src.hasLabel()) + tgt.setLabelElement(convertString(src.getLabelElement())); + if (src.hasDescription()) + tgt.setDescriptionElement(convertString(src.getDescriptionElement())); + if (src.hasAccept()) + tgt.setAcceptElement(convertCode(src.getAcceptElement())); + if (src.hasContentType()) + tgt.setContentTypeElement(convertCode(src.getContentTypeElement())); + if (src.hasDestination()) + tgt.setDestinationElement(convertInteger(src.getDestinationElement())); + if (src.hasEncodeRequestUrl()) + tgt.setEncodeRequestUrlElement(convertBoolean(src.getEncodeRequestUrlElement())); + if (src.hasMethod()) + tgt.setMethod(convertTestScriptRequestMethodCode(src.getMethod())); + if (src.hasOrigin()) + tgt.setOriginElement(convertInteger(src.getOriginElement())); + if (src.hasParams()) + tgt.setParamsElement(convertString(src.getParamsElement())); + for (org.hl7.fhir.r4.model.TestScript.SetupActionOperationRequestHeaderComponent t : src.getRequestHeader()) + tgt.addRequestHeader(convertSetupActionOperationRequestHeaderComponent(t)); + if (src.hasRequestId()) + tgt.setRequestIdElement(convertId(src.getRequestIdElement())); + if (src.hasResponseId()) + tgt.setResponseIdElement(convertId(src.getResponseIdElement())); + if (src.hasSourceId()) + tgt.setSourceIdElement(convertId(src.getSourceIdElement())); + if (src.hasTargetId()) + tgt.setTargetIdElement(convertId(src.getTargetIdElement())); + if (src.hasUrl()) + tgt.setUrlElement(convertString(src.getUrlElement())); + return tgt; + } + + public static org.hl7.fhir.r4.model.TestScript.SetupActionOperationComponent convertSetupActionOperationComponent(org.hl7.fhir.r5.model.TestScript.SetupActionOperationComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.TestScript.SetupActionOperationComponent tgt = new org.hl7.fhir.r4.model.TestScript.SetupActionOperationComponent(); + copyElement(src, tgt); + if (src.hasType()) + tgt.setType(convertCoding(src.getType())); + if (src.hasResource()) + tgt.setResourceElement(convertCode(src.getResourceElement())); + if (src.hasLabel()) + tgt.setLabelElement(convertString(src.getLabelElement())); + if (src.hasDescription()) + tgt.setDescriptionElement(convertString(src.getDescriptionElement())); + if (src.hasAccept()) + tgt.setAcceptElement(convertCode(src.getAcceptElement())); + if (src.hasContentType()) + tgt.setContentTypeElement(convertCode(src.getContentTypeElement())); + if (src.hasDestination()) + tgt.setDestinationElement(convertInteger(src.getDestinationElement())); + if (src.hasEncodeRequestUrl()) + tgt.setEncodeRequestUrlElement(convertBoolean(src.getEncodeRequestUrlElement())); + if (src.hasMethod()) + tgt.setMethod(convertTestScriptRequestMethodCode(src.getMethod())); + if (src.hasOrigin()) + tgt.setOriginElement(convertInteger(src.getOriginElement())); + if (src.hasParams()) + tgt.setParamsElement(convertString(src.getParamsElement())); + for (org.hl7.fhir.r5.model.TestScript.SetupActionOperationRequestHeaderComponent t : src.getRequestHeader()) + tgt.addRequestHeader(convertSetupActionOperationRequestHeaderComponent(t)); + if (src.hasRequestId()) + tgt.setRequestIdElement(convertId(src.getRequestIdElement())); + if (src.hasResponseId()) + tgt.setResponseIdElement(convertId(src.getResponseIdElement())); + if (src.hasSourceId()) + tgt.setSourceIdElement(convertId(src.getSourceIdElement())); + if (src.hasTargetId()) + tgt.setTargetIdElement(convertId(src.getTargetIdElement())); + if (src.hasUrl()) + tgt.setUrlElement(convertString(src.getUrlElement())); + return tgt; + } + + public static org.hl7.fhir.r5.model.TestScript.TestScriptRequestMethodCode convertTestScriptRequestMethodCode(org.hl7.fhir.r4.model.TestScript.TestScriptRequestMethodCode src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case DELETE: return org.hl7.fhir.r5.model.TestScript.TestScriptRequestMethodCode.DELETE; + case GET: return org.hl7.fhir.r5.model.TestScript.TestScriptRequestMethodCode.GET; + case OPTIONS: return org.hl7.fhir.r5.model.TestScript.TestScriptRequestMethodCode.OPTIONS; + case PATCH: return org.hl7.fhir.r5.model.TestScript.TestScriptRequestMethodCode.PATCH; + case POST: return org.hl7.fhir.r5.model.TestScript.TestScriptRequestMethodCode.POST; + case PUT: return org.hl7.fhir.r5.model.TestScript.TestScriptRequestMethodCode.PUT; + case HEAD: return org.hl7.fhir.r5.model.TestScript.TestScriptRequestMethodCode.HEAD; + default: return org.hl7.fhir.r5.model.TestScript.TestScriptRequestMethodCode.NULL; + } +} + + public static org.hl7.fhir.r4.model.TestScript.TestScriptRequestMethodCode convertTestScriptRequestMethodCode(org.hl7.fhir.r5.model.TestScript.TestScriptRequestMethodCode src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case DELETE: return org.hl7.fhir.r4.model.TestScript.TestScriptRequestMethodCode.DELETE; + case GET: return org.hl7.fhir.r4.model.TestScript.TestScriptRequestMethodCode.GET; + case OPTIONS: return org.hl7.fhir.r4.model.TestScript.TestScriptRequestMethodCode.OPTIONS; + case PATCH: return org.hl7.fhir.r4.model.TestScript.TestScriptRequestMethodCode.PATCH; + case POST: return org.hl7.fhir.r4.model.TestScript.TestScriptRequestMethodCode.POST; + case PUT: return org.hl7.fhir.r4.model.TestScript.TestScriptRequestMethodCode.PUT; + case HEAD: return org.hl7.fhir.r4.model.TestScript.TestScriptRequestMethodCode.HEAD; + default: return org.hl7.fhir.r4.model.TestScript.TestScriptRequestMethodCode.NULL; + } +} + + public static org.hl7.fhir.r5.model.TestScript.SetupActionOperationRequestHeaderComponent convertSetupActionOperationRequestHeaderComponent(org.hl7.fhir.r4.model.TestScript.SetupActionOperationRequestHeaderComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.TestScript.SetupActionOperationRequestHeaderComponent tgt = new org.hl7.fhir.r5.model.TestScript.SetupActionOperationRequestHeaderComponent(); + copyElement(src, tgt); + if (src.hasField()) + tgt.setFieldElement(convertString(src.getFieldElement())); + if (src.hasValue()) + tgt.setValueElement(convertString(src.getValueElement())); + return tgt; + } + + public static org.hl7.fhir.r4.model.TestScript.SetupActionOperationRequestHeaderComponent convertSetupActionOperationRequestHeaderComponent(org.hl7.fhir.r5.model.TestScript.SetupActionOperationRequestHeaderComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.TestScript.SetupActionOperationRequestHeaderComponent tgt = new org.hl7.fhir.r4.model.TestScript.SetupActionOperationRequestHeaderComponent(); + copyElement(src, tgt); + if (src.hasField()) + tgt.setFieldElement(convertString(src.getFieldElement())); + if (src.hasValue()) + tgt.setValueElement(convertString(src.getValueElement())); + return tgt; + } + + public static org.hl7.fhir.r5.model.TestScript.SetupActionAssertComponent convertSetupActionAssertComponent(org.hl7.fhir.r4.model.TestScript.SetupActionAssertComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.TestScript.SetupActionAssertComponent tgt = new org.hl7.fhir.r5.model.TestScript.SetupActionAssertComponent(); + copyElement(src, tgt); + if (src.hasLabel()) + tgt.setLabelElement(convertString(src.getLabelElement())); + if (src.hasDescription()) + tgt.setDescriptionElement(convertString(src.getDescriptionElement())); + if (src.hasDirection()) + tgt.setDirection(convertAssertionDirectionType(src.getDirection())); + if (src.hasCompareToSourceId()) + tgt.setCompareToSourceIdElement(convertString(src.getCompareToSourceIdElement())); + if (src.hasCompareToSourceExpression()) + tgt.setCompareToSourceExpressionElement(convertString(src.getCompareToSourceExpressionElement())); + if (src.hasCompareToSourcePath()) + tgt.setCompareToSourcePathElement(convertString(src.getCompareToSourcePathElement())); + if (src.hasContentType()) + tgt.setContentTypeElement(convertCode(src.getContentTypeElement())); + if (src.hasExpression()) + tgt.setExpressionElement(convertString(src.getExpressionElement())); + if (src.hasHeaderField()) + tgt.setHeaderFieldElement(convertString(src.getHeaderFieldElement())); + if (src.hasMinimumId()) + tgt.setMinimumIdElement(convertString(src.getMinimumIdElement())); + if (src.hasNavigationLinks()) + tgt.setNavigationLinksElement(convertBoolean(src.getNavigationLinksElement())); + if (src.hasOperator()) + tgt.setOperator(convertAssertionOperatorType(src.getOperator())); + if (src.hasPath()) + tgt.setPathElement(convertString(src.getPathElement())); + if (src.hasRequestMethod()) + tgt.setRequestMethod(convertTestScriptRequestMethodCode(src.getRequestMethod())); + if (src.hasRequestURL()) + tgt.setRequestURLElement(convertString(src.getRequestURLElement())); + if (src.hasResource()) + tgt.setResourceElement(convertCode(src.getResourceElement())); + if (src.hasResponse()) + tgt.setResponse(convertAssertionResponseTypes(src.getResponse())); + if (src.hasResponseCode()) + tgt.setResponseCodeElement(convertString(src.getResponseCodeElement())); + if (src.hasSourceId()) + tgt.setSourceIdElement(convertId(src.getSourceIdElement())); + if (src.hasValidateProfileId()) + tgt.setValidateProfileIdElement(convertId(src.getValidateProfileIdElement())); + if (src.hasValue()) + tgt.setValueElement(convertString(src.getValueElement())); + if (src.hasWarningOnly()) + tgt.setWarningOnlyElement(convertBoolean(src.getWarningOnlyElement())); + return tgt; + } + + public static org.hl7.fhir.r4.model.TestScript.SetupActionAssertComponent convertSetupActionAssertComponent(org.hl7.fhir.r5.model.TestScript.SetupActionAssertComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.TestScript.SetupActionAssertComponent tgt = new org.hl7.fhir.r4.model.TestScript.SetupActionAssertComponent(); + copyElement(src, tgt); + if (src.hasLabel()) + tgt.setLabelElement(convertString(src.getLabelElement())); + if (src.hasDescription()) + tgt.setDescriptionElement(convertString(src.getDescriptionElement())); + if (src.hasDirection()) + tgt.setDirection(convertAssertionDirectionType(src.getDirection())); + if (src.hasCompareToSourceId()) + tgt.setCompareToSourceIdElement(convertString(src.getCompareToSourceIdElement())); + if (src.hasCompareToSourceExpression()) + tgt.setCompareToSourceExpressionElement(convertString(src.getCompareToSourceExpressionElement())); + if (src.hasCompareToSourcePath()) + tgt.setCompareToSourcePathElement(convertString(src.getCompareToSourcePathElement())); + if (src.hasContentType()) + tgt.setContentTypeElement(convertCode(src.getContentTypeElement())); + if (src.hasExpression()) + tgt.setExpressionElement(convertString(src.getExpressionElement())); + if (src.hasHeaderField()) + tgt.setHeaderFieldElement(convertString(src.getHeaderFieldElement())); + if (src.hasMinimumId()) + tgt.setMinimumIdElement(convertString(src.getMinimumIdElement())); + if (src.hasNavigationLinks()) + tgt.setNavigationLinksElement(convertBoolean(src.getNavigationLinksElement())); + if (src.hasOperator()) + tgt.setOperator(convertAssertionOperatorType(src.getOperator())); + if (src.hasPath()) + tgt.setPathElement(convertString(src.getPathElement())); + if (src.hasRequestMethod()) + tgt.setRequestMethod(convertTestScriptRequestMethodCode(src.getRequestMethod())); + if (src.hasRequestURL()) + tgt.setRequestURLElement(convertString(src.getRequestURLElement())); + if (src.hasResource()) + tgt.setResourceElement(convertCode(src.getResourceElement())); + if (src.hasResponse()) + tgt.setResponse(convertAssertionResponseTypes(src.getResponse())); + if (src.hasResponseCode()) + tgt.setResponseCodeElement(convertString(src.getResponseCodeElement())); + if (src.hasSourceId()) + tgt.setSourceIdElement(convertId(src.getSourceIdElement())); + if (src.hasValidateProfileId()) + tgt.setValidateProfileIdElement(convertId(src.getValidateProfileIdElement())); + if (src.hasValue()) + tgt.setValueElement(convertString(src.getValueElement())); + if (src.hasWarningOnly()) + tgt.setWarningOnlyElement(convertBoolean(src.getWarningOnlyElement())); + return tgt; + } + + public static org.hl7.fhir.r5.model.TestScript.AssertionDirectionType convertAssertionDirectionType(org.hl7.fhir.r4.model.TestScript.AssertionDirectionType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case RESPONSE: return org.hl7.fhir.r5.model.TestScript.AssertionDirectionType.RESPONSE; + case REQUEST: return org.hl7.fhir.r5.model.TestScript.AssertionDirectionType.REQUEST; + default: return org.hl7.fhir.r5.model.TestScript.AssertionDirectionType.NULL; + } +} + + public static org.hl7.fhir.r4.model.TestScript.AssertionDirectionType convertAssertionDirectionType(org.hl7.fhir.r5.model.TestScript.AssertionDirectionType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case RESPONSE: return org.hl7.fhir.r4.model.TestScript.AssertionDirectionType.RESPONSE; + case REQUEST: return org.hl7.fhir.r4.model.TestScript.AssertionDirectionType.REQUEST; + default: return org.hl7.fhir.r4.model.TestScript.AssertionDirectionType.NULL; + } +} + + public static org.hl7.fhir.r5.model.TestScript.AssertionOperatorType convertAssertionOperatorType(org.hl7.fhir.r4.model.TestScript.AssertionOperatorType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case EQUALS: return org.hl7.fhir.r5.model.TestScript.AssertionOperatorType.EQUALS; + case NOTEQUALS: return org.hl7.fhir.r5.model.TestScript.AssertionOperatorType.NOTEQUALS; + case IN: return org.hl7.fhir.r5.model.TestScript.AssertionOperatorType.IN; + case NOTIN: return org.hl7.fhir.r5.model.TestScript.AssertionOperatorType.NOTIN; + case GREATERTHAN: return org.hl7.fhir.r5.model.TestScript.AssertionOperatorType.GREATERTHAN; + case LESSTHAN: return org.hl7.fhir.r5.model.TestScript.AssertionOperatorType.LESSTHAN; + case EMPTY: return org.hl7.fhir.r5.model.TestScript.AssertionOperatorType.EMPTY; + case NOTEMPTY: return org.hl7.fhir.r5.model.TestScript.AssertionOperatorType.NOTEMPTY; + case CONTAINS: return org.hl7.fhir.r5.model.TestScript.AssertionOperatorType.CONTAINS; + case NOTCONTAINS: return org.hl7.fhir.r5.model.TestScript.AssertionOperatorType.NOTCONTAINS; + case EVAL: return org.hl7.fhir.r5.model.TestScript.AssertionOperatorType.EVAL; + default: return org.hl7.fhir.r5.model.TestScript.AssertionOperatorType.NULL; + } +} + + public static org.hl7.fhir.r4.model.TestScript.AssertionOperatorType convertAssertionOperatorType(org.hl7.fhir.r5.model.TestScript.AssertionOperatorType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case EQUALS: return org.hl7.fhir.r4.model.TestScript.AssertionOperatorType.EQUALS; + case NOTEQUALS: return org.hl7.fhir.r4.model.TestScript.AssertionOperatorType.NOTEQUALS; + case IN: return org.hl7.fhir.r4.model.TestScript.AssertionOperatorType.IN; + case NOTIN: return org.hl7.fhir.r4.model.TestScript.AssertionOperatorType.NOTIN; + case GREATERTHAN: return org.hl7.fhir.r4.model.TestScript.AssertionOperatorType.GREATERTHAN; + case LESSTHAN: return org.hl7.fhir.r4.model.TestScript.AssertionOperatorType.LESSTHAN; + case EMPTY: return org.hl7.fhir.r4.model.TestScript.AssertionOperatorType.EMPTY; + case NOTEMPTY: return org.hl7.fhir.r4.model.TestScript.AssertionOperatorType.NOTEMPTY; + case CONTAINS: return org.hl7.fhir.r4.model.TestScript.AssertionOperatorType.CONTAINS; + case NOTCONTAINS: return org.hl7.fhir.r4.model.TestScript.AssertionOperatorType.NOTCONTAINS; + case EVAL: return org.hl7.fhir.r4.model.TestScript.AssertionOperatorType.EVAL; + default: return org.hl7.fhir.r4.model.TestScript.AssertionOperatorType.NULL; + } +} + + public static org.hl7.fhir.r5.model.TestScript.AssertionResponseTypes convertAssertionResponseTypes(org.hl7.fhir.r4.model.TestScript.AssertionResponseTypes src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case OKAY: return org.hl7.fhir.r5.model.TestScript.AssertionResponseTypes.OKAY; + case CREATED: return org.hl7.fhir.r5.model.TestScript.AssertionResponseTypes.CREATED; + case NOCONTENT: return org.hl7.fhir.r5.model.TestScript.AssertionResponseTypes.NOCONTENT; + case NOTMODIFIED: return org.hl7.fhir.r5.model.TestScript.AssertionResponseTypes.NOTMODIFIED; + case BAD: return org.hl7.fhir.r5.model.TestScript.AssertionResponseTypes.BAD; + case FORBIDDEN: return org.hl7.fhir.r5.model.TestScript.AssertionResponseTypes.FORBIDDEN; + case NOTFOUND: return org.hl7.fhir.r5.model.TestScript.AssertionResponseTypes.NOTFOUND; + case METHODNOTALLOWED: return org.hl7.fhir.r5.model.TestScript.AssertionResponseTypes.METHODNOTALLOWED; + case CONFLICT: return org.hl7.fhir.r5.model.TestScript.AssertionResponseTypes.CONFLICT; + case GONE: return org.hl7.fhir.r5.model.TestScript.AssertionResponseTypes.GONE; + case PRECONDITIONFAILED: return org.hl7.fhir.r5.model.TestScript.AssertionResponseTypes.PRECONDITIONFAILED; + case UNPROCESSABLE: return org.hl7.fhir.r5.model.TestScript.AssertionResponseTypes.UNPROCESSABLE; + default: return org.hl7.fhir.r5.model.TestScript.AssertionResponseTypes.NULL; + } +} + + public static org.hl7.fhir.r4.model.TestScript.AssertionResponseTypes convertAssertionResponseTypes(org.hl7.fhir.r5.model.TestScript.AssertionResponseTypes src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case OKAY: return org.hl7.fhir.r4.model.TestScript.AssertionResponseTypes.OKAY; + case CREATED: return org.hl7.fhir.r4.model.TestScript.AssertionResponseTypes.CREATED; + case NOCONTENT: return org.hl7.fhir.r4.model.TestScript.AssertionResponseTypes.NOCONTENT; + case NOTMODIFIED: return org.hl7.fhir.r4.model.TestScript.AssertionResponseTypes.NOTMODIFIED; + case BAD: return org.hl7.fhir.r4.model.TestScript.AssertionResponseTypes.BAD; + case FORBIDDEN: return org.hl7.fhir.r4.model.TestScript.AssertionResponseTypes.FORBIDDEN; + case NOTFOUND: return org.hl7.fhir.r4.model.TestScript.AssertionResponseTypes.NOTFOUND; + case METHODNOTALLOWED: return org.hl7.fhir.r4.model.TestScript.AssertionResponseTypes.METHODNOTALLOWED; + case CONFLICT: return org.hl7.fhir.r4.model.TestScript.AssertionResponseTypes.CONFLICT; + case GONE: return org.hl7.fhir.r4.model.TestScript.AssertionResponseTypes.GONE; + case PRECONDITIONFAILED: return org.hl7.fhir.r4.model.TestScript.AssertionResponseTypes.PRECONDITIONFAILED; + case UNPROCESSABLE: return org.hl7.fhir.r4.model.TestScript.AssertionResponseTypes.UNPROCESSABLE; + default: return org.hl7.fhir.r4.model.TestScript.AssertionResponseTypes.NULL; + } +} + + public static org.hl7.fhir.r5.model.TestScript.TestScriptTestComponent convertTestScriptTestComponent(org.hl7.fhir.r4.model.TestScript.TestScriptTestComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.TestScript.TestScriptTestComponent tgt = new org.hl7.fhir.r5.model.TestScript.TestScriptTestComponent(); + copyElement(src, tgt); + if (src.hasName()) + tgt.setNameElement(convertString(src.getNameElement())); + if (src.hasDescription()) + tgt.setDescriptionElement(convertString(src.getDescriptionElement())); + for (org.hl7.fhir.r4.model.TestScript.TestActionComponent t : src.getAction()) + tgt.addAction(convertTestActionComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.TestScript.TestScriptTestComponent convertTestScriptTestComponent(org.hl7.fhir.r5.model.TestScript.TestScriptTestComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.TestScript.TestScriptTestComponent tgt = new org.hl7.fhir.r4.model.TestScript.TestScriptTestComponent(); + copyElement(src, tgt); + if (src.hasName()) + tgt.setNameElement(convertString(src.getNameElement())); + if (src.hasDescription()) + tgt.setDescriptionElement(convertString(src.getDescriptionElement())); + for (org.hl7.fhir.r5.model.TestScript.TestActionComponent t : src.getAction()) + tgt.addAction(convertTestActionComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.TestScript.TestActionComponent convertTestActionComponent(org.hl7.fhir.r4.model.TestScript.TestActionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.TestScript.TestActionComponent tgt = new org.hl7.fhir.r5.model.TestScript.TestActionComponent(); + copyElement(src, tgt); + if (src.hasOperation()) + tgt.setOperation(convertSetupActionOperationComponent(src.getOperation())); + if (src.hasAssert()) + tgt.setAssert(convertSetupActionAssertComponent(src.getAssert())); + return tgt; + } + + public static org.hl7.fhir.r4.model.TestScript.TestActionComponent convertTestActionComponent(org.hl7.fhir.r5.model.TestScript.TestActionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.TestScript.TestActionComponent tgt = new org.hl7.fhir.r4.model.TestScript.TestActionComponent(); + copyElement(src, tgt); + if (src.hasOperation()) + tgt.setOperation(convertSetupActionOperationComponent(src.getOperation())); + if (src.hasAssert()) + tgt.setAssert(convertSetupActionAssertComponent(src.getAssert())); + return tgt; + } + + public static org.hl7.fhir.r5.model.TestScript.TestScriptTeardownComponent convertTestScriptTeardownComponent(org.hl7.fhir.r4.model.TestScript.TestScriptTeardownComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.TestScript.TestScriptTeardownComponent tgt = new org.hl7.fhir.r5.model.TestScript.TestScriptTeardownComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.r4.model.TestScript.TeardownActionComponent t : src.getAction()) + tgt.addAction(convertTeardownActionComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.TestScript.TestScriptTeardownComponent convertTestScriptTeardownComponent(org.hl7.fhir.r5.model.TestScript.TestScriptTeardownComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.TestScript.TestScriptTeardownComponent tgt = new org.hl7.fhir.r4.model.TestScript.TestScriptTeardownComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.r5.model.TestScript.TeardownActionComponent t : src.getAction()) + tgt.addAction(convertTeardownActionComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.TestScript.TeardownActionComponent convertTeardownActionComponent(org.hl7.fhir.r4.model.TestScript.TeardownActionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.TestScript.TeardownActionComponent tgt = new org.hl7.fhir.r5.model.TestScript.TeardownActionComponent(); + copyElement(src, tgt); + if (src.hasOperation()) + tgt.setOperation(convertSetupActionOperationComponent(src.getOperation())); + return tgt; + } + + public static org.hl7.fhir.r4.model.TestScript.TeardownActionComponent convertTeardownActionComponent(org.hl7.fhir.r5.model.TestScript.TeardownActionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.TestScript.TeardownActionComponent tgt = new org.hl7.fhir.r4.model.TestScript.TeardownActionComponent(); + copyElement(src, tgt); + if (src.hasOperation()) + tgt.setOperation(convertSetupActionOperationComponent(src.getOperation())); + return tgt; + } + + +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/ValueSet.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/ValueSet.java new file mode 100644 index 000000000..132debdce --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/ValueSet.java @@ -0,0 +1,429 @@ +package org.hl7.fhir.convertors.conv40_50; + +import org.hl7.fhir.exceptions.FHIRException; + +import org.hl7.fhir.convertors.VersionConvertor_40_50; + + +/* + Copyright (c) 2011+, HL7, Inc. + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of HL7 nor the names of its contributors may be used to + endorse or promote products derived from this software without specific + prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + +*/ + +// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0 + + +public class ValueSet extends VersionConvertor_40_50 { + + public static org.hl7.fhir.r5.model.ValueSet convertValueSet(org.hl7.fhir.r4.model.ValueSet src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ValueSet tgt = new org.hl7.fhir.r5.model.ValueSet(); + copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrlElement(convertUri(src.getUrlElement())); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasVersion()) + tgt.setVersionElement(convertString(src.getVersionElement())); + if (src.hasName()) + tgt.setNameElement(convertString(src.getNameElement())); + if (src.hasTitle()) + tgt.setTitleElement(convertString(src.getTitleElement())); + if (src.hasStatus()) + tgt.setStatus(Enumerations.convertPublicationStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimentalElement(convertBoolean(src.getExperimentalElement())); + if (src.hasDate()) + tgt.setDateElement(convertDateTime(src.getDateElement())); + if (src.hasPublisher()) + tgt.setPublisherElement(convertString(src.getPublisherElement())); + for (org.hl7.fhir.r4.model.ContactDetail t : src.getContact()) + tgt.addContact(convertContactDetail(t)); + if (src.hasDescription()) + tgt.setDescriptionElement(convertMarkdown(src.getDescriptionElement())); + for (org.hl7.fhir.r4.model.UsageContext t : src.getUseContext()) + tgt.addUseContext(convertUsageContext(t)); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getJurisdiction()) + tgt.addJurisdiction(convertCodeableConcept(t)); + if (src.hasImmutable()) + tgt.setImmutableElement(convertBoolean(src.getImmutableElement())); + if (src.hasPurpose()) + tgt.setPurposeElement(convertMarkdown(src.getPurposeElement())); + if (src.hasCopyright()) + tgt.setCopyrightElement(convertMarkdown(src.getCopyrightElement())); + if (src.hasCompose()) + tgt.setCompose(convertValueSetComposeComponent(src.getCompose())); + if (src.hasExpansion()) + tgt.setExpansion(convertValueSetExpansionComponent(src.getExpansion())); + return tgt; + } + + public static org.hl7.fhir.r4.model.ValueSet convertValueSet(org.hl7.fhir.r5.model.ValueSet src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.ValueSet tgt = new org.hl7.fhir.r4.model.ValueSet(); + copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrlElement(convertUri(src.getUrlElement())); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasVersion()) + tgt.setVersionElement(convertString(src.getVersionElement())); + if (src.hasName()) + tgt.setNameElement(convertString(src.getNameElement())); + if (src.hasTitle()) + tgt.setTitleElement(convertString(src.getTitleElement())); + if (src.hasStatus()) + tgt.setStatus(Enumerations.convertPublicationStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimentalElement(convertBoolean(src.getExperimentalElement())); + if (src.hasDate()) + tgt.setDateElement(convertDateTime(src.getDateElement())); + if (src.hasPublisher()) + tgt.setPublisherElement(convertString(src.getPublisherElement())); + for (org.hl7.fhir.r5.model.ContactDetail t : src.getContact()) + tgt.addContact(convertContactDetail(t)); + if (src.hasDescription()) + tgt.setDescriptionElement(convertMarkdown(src.getDescriptionElement())); + for (org.hl7.fhir.r5.model.UsageContext t : src.getUseContext()) + tgt.addUseContext(convertUsageContext(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getJurisdiction()) + tgt.addJurisdiction(convertCodeableConcept(t)); + if (src.hasImmutable()) + tgt.setImmutableElement(convertBoolean(src.getImmutableElement())); + if (src.hasPurpose()) + tgt.setPurposeElement(convertMarkdown(src.getPurposeElement())); + if (src.hasCopyright()) + tgt.setCopyrightElement(convertMarkdown(src.getCopyrightElement())); + if (src.hasCompose()) + tgt.setCompose(convertValueSetComposeComponent(src.getCompose())); + if (src.hasExpansion()) + tgt.setExpansion(convertValueSetExpansionComponent(src.getExpansion())); + return tgt; + } + + public static org.hl7.fhir.r5.model.ValueSet.ValueSetComposeComponent convertValueSetComposeComponent(org.hl7.fhir.r4.model.ValueSet.ValueSetComposeComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ValueSet.ValueSetComposeComponent tgt = new org.hl7.fhir.r5.model.ValueSet.ValueSetComposeComponent(); + copyElement(src, tgt); + if (src.hasLockedDate()) + tgt.setLockedDateElement(convertDate(src.getLockedDateElement())); + if (src.hasInactive()) + tgt.setInactiveElement(convertBoolean(src.getInactiveElement())); + for (org.hl7.fhir.r4.model.ValueSet.ConceptSetComponent t : src.getInclude()) + tgt.addInclude(convertConceptSetComponent(t)); + for (org.hl7.fhir.r4.model.ValueSet.ConceptSetComponent t : src.getExclude()) + tgt.addExclude(convertConceptSetComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.ValueSet.ValueSetComposeComponent convertValueSetComposeComponent(org.hl7.fhir.r5.model.ValueSet.ValueSetComposeComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.ValueSet.ValueSetComposeComponent tgt = new org.hl7.fhir.r4.model.ValueSet.ValueSetComposeComponent(); + copyElement(src, tgt); + if (src.hasLockedDate()) + tgt.setLockedDateElement(convertDate(src.getLockedDateElement())); + if (src.hasInactive()) + tgt.setInactiveElement(convertBoolean(src.getInactiveElement())); + for (org.hl7.fhir.r5.model.ValueSet.ConceptSetComponent t : src.getInclude()) + tgt.addInclude(convertConceptSetComponent(t)); + for (org.hl7.fhir.r5.model.ValueSet.ConceptSetComponent t : src.getExclude()) + tgt.addExclude(convertConceptSetComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.ValueSet.ConceptSetComponent convertConceptSetComponent(org.hl7.fhir.r4.model.ValueSet.ConceptSetComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ValueSet.ConceptSetComponent tgt = new org.hl7.fhir.r5.model.ValueSet.ConceptSetComponent(); + copyElement(src, tgt); + if (src.hasSystem()) + tgt.setSystemElement(convertUri(src.getSystemElement())); + if (src.hasVersion()) + tgt.setVersionElement(convertString(src.getVersionElement())); + for (org.hl7.fhir.r4.model.ValueSet.ConceptReferenceComponent t : src.getConcept()) + tgt.addConcept(convertConceptReferenceComponent(t)); + for (org.hl7.fhir.r4.model.ValueSet.ConceptSetFilterComponent t : src.getFilter()) + tgt.addFilter(convertConceptSetFilterComponent(t)); + for (org.hl7.fhir.r4.model.CanonicalType t : src.getValueSet()) + tgt.getValueSet().add(convertCanonical(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.ValueSet.ConceptSetComponent convertConceptSetComponent(org.hl7.fhir.r5.model.ValueSet.ConceptSetComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.ValueSet.ConceptSetComponent tgt = new org.hl7.fhir.r4.model.ValueSet.ConceptSetComponent(); + copyElement(src, tgt); + if (src.hasSystem()) + tgt.setSystemElement(convertUri(src.getSystemElement())); + if (src.hasVersion()) + tgt.setVersionElement(convertString(src.getVersionElement())); + for (org.hl7.fhir.r5.model.ValueSet.ConceptReferenceComponent t : src.getConcept()) + tgt.addConcept(convertConceptReferenceComponent(t)); + for (org.hl7.fhir.r5.model.ValueSet.ConceptSetFilterComponent t : src.getFilter()) + tgt.addFilter(convertConceptSetFilterComponent(t)); + for (org.hl7.fhir.r5.model.CanonicalType t : src.getValueSet()) + tgt.getValueSet().add(convertCanonical(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.ValueSet.ConceptReferenceComponent convertConceptReferenceComponent(org.hl7.fhir.r4.model.ValueSet.ConceptReferenceComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ValueSet.ConceptReferenceComponent tgt = new org.hl7.fhir.r5.model.ValueSet.ConceptReferenceComponent(); + copyElement(src, tgt); + if (src.hasCode()) + tgt.setCodeElement(convertCode(src.getCodeElement())); + if (src.hasDisplay()) + tgt.setDisplayElement(convertString(src.getDisplayElement())); + for (org.hl7.fhir.r4.model.ValueSet.ConceptReferenceDesignationComponent t : src.getDesignation()) + tgt.addDesignation(convertConceptReferenceDesignationComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.ValueSet.ConceptReferenceComponent convertConceptReferenceComponent(org.hl7.fhir.r5.model.ValueSet.ConceptReferenceComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.ValueSet.ConceptReferenceComponent tgt = new org.hl7.fhir.r4.model.ValueSet.ConceptReferenceComponent(); + copyElement(src, tgt); + if (src.hasCode()) + tgt.setCodeElement(convertCode(src.getCodeElement())); + if (src.hasDisplay()) + tgt.setDisplayElement(convertString(src.getDisplayElement())); + for (org.hl7.fhir.r5.model.ValueSet.ConceptReferenceDesignationComponent t : src.getDesignation()) + tgt.addDesignation(convertConceptReferenceDesignationComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.ValueSet.ConceptReferenceDesignationComponent convertConceptReferenceDesignationComponent(org.hl7.fhir.r4.model.ValueSet.ConceptReferenceDesignationComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ValueSet.ConceptReferenceDesignationComponent tgt = new org.hl7.fhir.r5.model.ValueSet.ConceptReferenceDesignationComponent(); + copyElement(src, tgt); + if (src.hasLanguage()) + tgt.setLanguageElement(convertCode(src.getLanguageElement())); + if (src.hasUse()) + tgt.setUse(convertCoding(src.getUse())); + if (src.hasValue()) + tgt.setValueElement(convertString(src.getValueElement())); + return tgt; + } + + public static org.hl7.fhir.r4.model.ValueSet.ConceptReferenceDesignationComponent convertConceptReferenceDesignationComponent(org.hl7.fhir.r5.model.ValueSet.ConceptReferenceDesignationComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.ValueSet.ConceptReferenceDesignationComponent tgt = new org.hl7.fhir.r4.model.ValueSet.ConceptReferenceDesignationComponent(); + copyElement(src, tgt); + if (src.hasLanguage()) + tgt.setLanguageElement(convertCode(src.getLanguageElement())); + if (src.hasUse()) + tgt.setUse(convertCoding(src.getUse())); + if (src.hasValue()) + tgt.setValueElement(convertString(src.getValueElement())); + return tgt; + } + + public static org.hl7.fhir.r5.model.ValueSet.ConceptSetFilterComponent convertConceptSetFilterComponent(org.hl7.fhir.r4.model.ValueSet.ConceptSetFilterComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ValueSet.ConceptSetFilterComponent tgt = new org.hl7.fhir.r5.model.ValueSet.ConceptSetFilterComponent(); + copyElement(src, tgt); + if (src.hasProperty()) + tgt.setPropertyElement(convertCode(src.getPropertyElement())); + if (src.hasOp()) + tgt.setOp(convertFilterOperator(src.getOp())); + if (src.hasValue()) + tgt.setValueElement(convertString(src.getValueElement())); + return tgt; + } + + public static org.hl7.fhir.r4.model.ValueSet.ConceptSetFilterComponent convertConceptSetFilterComponent(org.hl7.fhir.r5.model.ValueSet.ConceptSetFilterComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.ValueSet.ConceptSetFilterComponent tgt = new org.hl7.fhir.r4.model.ValueSet.ConceptSetFilterComponent(); + copyElement(src, tgt); + if (src.hasProperty()) + tgt.setPropertyElement(convertCode(src.getPropertyElement())); + if (src.hasOp()) + tgt.setOp(convertFilterOperator(src.getOp())); + if (src.hasValue()) + tgt.setValueElement(convertString(src.getValueElement())); + return tgt; + } + + public static org.hl7.fhir.r5.model.ValueSet.FilterOperator convertFilterOperator(org.hl7.fhir.r4.model.ValueSet.FilterOperator src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case EQUAL: return org.hl7.fhir.r5.model.ValueSet.FilterOperator.EQUAL; + case ISA: return org.hl7.fhir.r5.model.ValueSet.FilterOperator.ISA; + case DESCENDENTOF: return org.hl7.fhir.r5.model.ValueSet.FilterOperator.DESCENDENTOF; + case ISNOTA: return org.hl7.fhir.r5.model.ValueSet.FilterOperator.ISNOTA; + case REGEX: return org.hl7.fhir.r5.model.ValueSet.FilterOperator.REGEX; + case IN: return org.hl7.fhir.r5.model.ValueSet.FilterOperator.IN; + case NOTIN: return org.hl7.fhir.r5.model.ValueSet.FilterOperator.NOTIN; + case GENERALIZES: return org.hl7.fhir.r5.model.ValueSet.FilterOperator.GENERALIZES; + case EXISTS: return org.hl7.fhir.r5.model.ValueSet.FilterOperator.EXISTS; + default: return org.hl7.fhir.r5.model.ValueSet.FilterOperator.NULL; + } +} + + public static org.hl7.fhir.r4.model.ValueSet.FilterOperator convertFilterOperator(org.hl7.fhir.r5.model.ValueSet.FilterOperator src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case EQUAL: return org.hl7.fhir.r4.model.ValueSet.FilterOperator.EQUAL; + case ISA: return org.hl7.fhir.r4.model.ValueSet.FilterOperator.ISA; + case DESCENDENTOF: return org.hl7.fhir.r4.model.ValueSet.FilterOperator.DESCENDENTOF; + case ISNOTA: return org.hl7.fhir.r4.model.ValueSet.FilterOperator.ISNOTA; + case REGEX: return org.hl7.fhir.r4.model.ValueSet.FilterOperator.REGEX; + case IN: return org.hl7.fhir.r4.model.ValueSet.FilterOperator.IN; + case NOTIN: return org.hl7.fhir.r4.model.ValueSet.FilterOperator.NOTIN; + case GENERALIZES: return org.hl7.fhir.r4.model.ValueSet.FilterOperator.GENERALIZES; + case EXISTS: return org.hl7.fhir.r4.model.ValueSet.FilterOperator.EXISTS; + default: return org.hl7.fhir.r4.model.ValueSet.FilterOperator.NULL; + } +} + + public static org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionComponent convertValueSetExpansionComponent(org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionComponent tgt = new org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionComponent(); + copyElement(src, tgt); + if (src.hasIdentifier()) + tgt.setIdentifierElement(convertUri(src.getIdentifierElement())); + if (src.hasTimestamp()) + tgt.setTimestampElement(convertDateTime(src.getTimestampElement())); + if (src.hasTotal()) + tgt.setTotalElement(convertInteger(src.getTotalElement())); + if (src.hasOffset()) + tgt.setOffsetElement(convertInteger(src.getOffsetElement())); + for (org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionParameterComponent t : src.getParameter()) + tgt.addParameter(convertValueSetExpansionParameterComponent(t)); + for (org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionContainsComponent t : src.getContains()) + tgt.addContains(convertValueSetExpansionContainsComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionComponent convertValueSetExpansionComponent(org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionComponent tgt = new org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionComponent(); + copyElement(src, tgt); + if (src.hasIdentifier()) + tgt.setIdentifierElement(convertUri(src.getIdentifierElement())); + if (src.hasTimestamp()) + tgt.setTimestampElement(convertDateTime(src.getTimestampElement())); + if (src.hasTotal()) + tgt.setTotalElement(convertInteger(src.getTotalElement())); + if (src.hasOffset()) + tgt.setOffsetElement(convertInteger(src.getOffsetElement())); + for (org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionParameterComponent t : src.getParameter()) + tgt.addParameter(convertValueSetExpansionParameterComponent(t)); + for (org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionContainsComponent t : src.getContains()) + tgt.addContains(convertValueSetExpansionContainsComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionParameterComponent convertValueSetExpansionParameterComponent(org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionParameterComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionParameterComponent tgt = new org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionParameterComponent(); + copyElement(src, tgt); + if (src.hasName()) + tgt.setNameElement(convertString(src.getNameElement())); + if (src.hasValue()) + tgt.setValue(convertType(src.getValue())); + return tgt; + } + + public static org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionParameterComponent convertValueSetExpansionParameterComponent(org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionParameterComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionParameterComponent tgt = new org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionParameterComponent(); + copyElement(src, tgt); + if (src.hasName()) + tgt.setNameElement(convertString(src.getNameElement())); + if (src.hasValue()) + tgt.setValue(convertType(src.getValue())); + return tgt; + } + + public static org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionContainsComponent convertValueSetExpansionContainsComponent(org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionContainsComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionContainsComponent tgt = new org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionContainsComponent(); + copyElement(src, tgt); + if (src.hasSystem()) + tgt.setSystemElement(convertUri(src.getSystemElement())); + if (src.hasAbstract()) + tgt.setAbstractElement(convertBoolean(src.getAbstractElement())); + if (src.hasInactive()) + tgt.setInactiveElement(convertBoolean(src.getInactiveElement())); + if (src.hasVersion()) + tgt.setVersionElement(convertString(src.getVersionElement())); + if (src.hasCode()) + tgt.setCodeElement(convertCode(src.getCodeElement())); + if (src.hasDisplay()) + tgt.setDisplayElement(convertString(src.getDisplayElement())); + for (org.hl7.fhir.r4.model.ValueSet.ConceptReferenceDesignationComponent t : src.getDesignation()) + tgt.addDesignation(convertConceptReferenceDesignationComponent(t)); + for (org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionContainsComponent t : src.getContains()) + tgt.addContains(convertValueSetExpansionContainsComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionContainsComponent convertValueSetExpansionContainsComponent(org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionContainsComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionContainsComponent tgt = new org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionContainsComponent(); + copyElement(src, tgt); + if (src.hasSystem()) + tgt.setSystemElement(convertUri(src.getSystemElement())); + if (src.hasAbstract()) + tgt.setAbstractElement(convertBoolean(src.getAbstractElement())); + if (src.hasInactive()) + tgt.setInactiveElement(convertBoolean(src.getInactiveElement())); + if (src.hasVersion()) + tgt.setVersionElement(convertString(src.getVersionElement())); + if (src.hasCode()) + tgt.setCodeElement(convertCode(src.getCodeElement())); + if (src.hasDisplay()) + tgt.setDisplayElement(convertString(src.getDisplayElement())); + for (org.hl7.fhir.r5.model.ValueSet.ConceptReferenceDesignationComponent t : src.getDesignation()) + tgt.addDesignation(convertConceptReferenceDesignationComponent(t)); + for (org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionContainsComponent t : src.getContains()) + tgt.addContains(convertValueSetExpansionContainsComponent(t)); + return tgt; + } + + +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/VerificationResult.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/VerificationResult.java new file mode 100644 index 000000000..e062c951c --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/VerificationResult.java @@ -0,0 +1,263 @@ +package org.hl7.fhir.convertors.conv40_50; + +import org.hl7.fhir.exceptions.FHIRException; + +import org.hl7.fhir.convertors.VersionConvertor_40_50; + + +/* + Copyright (c) 2011+, HL7, Inc. + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of HL7 nor the names of its contributors may be used to + endorse or promote products derived from this software without specific + prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + +*/ + +// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0 + + +public class VerificationResult extends VersionConvertor_40_50 { + + public static org.hl7.fhir.r5.model.VerificationResult convertVerificationResult(org.hl7.fhir.r4.model.VerificationResult src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.VerificationResult tgt = new org.hl7.fhir.r5.model.VerificationResult(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r4.model.Reference t : src.getTarget()) + tgt.addTarget(convertReference(t)); + for (org.hl7.fhir.r4.model.StringType t : src.getTargetLocation()) + tgt.getTargetLocation().add(convertString(t)); + if (src.hasNeed()) + tgt.setNeed(convertCodeableConcept(src.getNeed())); + if (src.hasStatus()) + tgt.setStatus(convertStatus(src.getStatus())); + if (src.hasStatusDate()) + tgt.setStatusDateElement(convertDateTime(src.getStatusDateElement())); + if (src.hasValidationType()) + tgt.setValidationType(convertCodeableConcept(src.getValidationType())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getValidationProcess()) + tgt.addValidationProcess(convertCodeableConcept(t)); + if (src.hasFrequency()) + tgt.setFrequency(convertTiming(src.getFrequency())); + if (src.hasLastPerformed()) + tgt.setLastPerformedElement(convertDateTime(src.getLastPerformedElement())); + if (src.hasNextScheduled()) + tgt.setNextScheduledElement(convertDate(src.getNextScheduledElement())); + if (src.hasFailureAction()) + tgt.setFailureAction(convertCodeableConcept(src.getFailureAction())); + for (org.hl7.fhir.r4.model.VerificationResult.VerificationResultPrimarySourceComponent t : src.getPrimarySource()) + tgt.addPrimarySource(convertVerificationResultPrimarySourceComponent(t)); + if (src.hasAttestation()) + tgt.setAttestation(convertVerificationResultAttestationComponent(src.getAttestation())); + for (org.hl7.fhir.r4.model.VerificationResult.VerificationResultValidatorComponent t : src.getValidator()) + tgt.addValidator(convertVerificationResultValidatorComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.VerificationResult convertVerificationResult(org.hl7.fhir.r5.model.VerificationResult src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.VerificationResult tgt = new org.hl7.fhir.r4.model.VerificationResult(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Reference t : src.getTarget()) + tgt.addTarget(convertReference(t)); + for (org.hl7.fhir.r5.model.StringType t : src.getTargetLocation()) + tgt.getTargetLocation().add(convertString(t)); + if (src.hasNeed()) + tgt.setNeed(convertCodeableConcept(src.getNeed())); + if (src.hasStatus()) + tgt.setStatus(convertStatus(src.getStatus())); + if (src.hasStatusDate()) + tgt.setStatusDateElement(convertDateTime(src.getStatusDateElement())); + if (src.hasValidationType()) + tgt.setValidationType(convertCodeableConcept(src.getValidationType())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getValidationProcess()) + tgt.addValidationProcess(convertCodeableConcept(t)); + if (src.hasFrequency()) + tgt.setFrequency(convertTiming(src.getFrequency())); + if (src.hasLastPerformed()) + tgt.setLastPerformedElement(convertDateTime(src.getLastPerformedElement())); + if (src.hasNextScheduled()) + tgt.setNextScheduledElement(convertDate(src.getNextScheduledElement())); + if (src.hasFailureAction()) + tgt.setFailureAction(convertCodeableConcept(src.getFailureAction())); + for (org.hl7.fhir.r5.model.VerificationResult.VerificationResultPrimarySourceComponent t : src.getPrimarySource()) + tgt.addPrimarySource(convertVerificationResultPrimarySourceComponent(t)); + if (src.hasAttestation()) + tgt.setAttestation(convertVerificationResultAttestationComponent(src.getAttestation())); + for (org.hl7.fhir.r5.model.VerificationResult.VerificationResultValidatorComponent t : src.getValidator()) + tgt.addValidator(convertVerificationResultValidatorComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.VerificationResult.Status convertStatus(org.hl7.fhir.r4.model.VerificationResult.Status src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case ATTESTED: return org.hl7.fhir.r5.model.VerificationResult.Status.ATTESTED; + case VALIDATED: return org.hl7.fhir.r5.model.VerificationResult.Status.VALIDATED; + case INPROCESS: return org.hl7.fhir.r5.model.VerificationResult.Status.INPROCESS; + case REQREVALID: return org.hl7.fhir.r5.model.VerificationResult.Status.REQREVALID; + case VALFAIL: return org.hl7.fhir.r5.model.VerificationResult.Status.VALFAIL; + case REVALFAIL: return org.hl7.fhir.r5.model.VerificationResult.Status.REVALFAIL; + default: return org.hl7.fhir.r5.model.VerificationResult.Status.NULL; + } +} + + public static org.hl7.fhir.r4.model.VerificationResult.Status convertStatus(org.hl7.fhir.r5.model.VerificationResult.Status src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case ATTESTED: return org.hl7.fhir.r4.model.VerificationResult.Status.ATTESTED; + case VALIDATED: return org.hl7.fhir.r4.model.VerificationResult.Status.VALIDATED; + case INPROCESS: return org.hl7.fhir.r4.model.VerificationResult.Status.INPROCESS; + case REQREVALID: return org.hl7.fhir.r4.model.VerificationResult.Status.REQREVALID; + case VALFAIL: return org.hl7.fhir.r4.model.VerificationResult.Status.VALFAIL; + case REVALFAIL: return org.hl7.fhir.r4.model.VerificationResult.Status.REVALFAIL; + default: return org.hl7.fhir.r4.model.VerificationResult.Status.NULL; + } +} + + public static org.hl7.fhir.r5.model.VerificationResult.VerificationResultPrimarySourceComponent convertVerificationResultPrimarySourceComponent(org.hl7.fhir.r4.model.VerificationResult.VerificationResultPrimarySourceComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.VerificationResult.VerificationResultPrimarySourceComponent tgt = new org.hl7.fhir.r5.model.VerificationResult.VerificationResultPrimarySourceComponent(); + copyElement(src, tgt); + if (src.hasWho()) + tgt.setWho(convertReference(src.getWho())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getType()) + tgt.addType(convertCodeableConcept(t)); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getCommunicationMethod()) + tgt.addCommunicationMethod(convertCodeableConcept(t)); + if (src.hasValidationStatus()) + tgt.setValidationStatus(convertCodeableConcept(src.getValidationStatus())); + if (src.hasValidationDate()) + tgt.setValidationDateElement(convertDateTime(src.getValidationDateElement())); + if (src.hasCanPushUpdates()) + tgt.setCanPushUpdates(convertCodeableConcept(src.getCanPushUpdates())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getPushTypeAvailable()) + tgt.addPushTypeAvailable(convertCodeableConcept(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.VerificationResult.VerificationResultPrimarySourceComponent convertVerificationResultPrimarySourceComponent(org.hl7.fhir.r5.model.VerificationResult.VerificationResultPrimarySourceComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.VerificationResult.VerificationResultPrimarySourceComponent tgt = new org.hl7.fhir.r4.model.VerificationResult.VerificationResultPrimarySourceComponent(); + copyElement(src, tgt); + if (src.hasWho()) + tgt.setWho(convertReference(src.getWho())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getType()) + tgt.addType(convertCodeableConcept(t)); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getCommunicationMethod()) + tgt.addCommunicationMethod(convertCodeableConcept(t)); + if (src.hasValidationStatus()) + tgt.setValidationStatus(convertCodeableConcept(src.getValidationStatus())); + if (src.hasValidationDate()) + tgt.setValidationDateElement(convertDateTime(src.getValidationDateElement())); + if (src.hasCanPushUpdates()) + tgt.setCanPushUpdates(convertCodeableConcept(src.getCanPushUpdates())); + for (org.hl7.fhir.r5.model.CodeableConcept t : src.getPushTypeAvailable()) + tgt.addPushTypeAvailable(convertCodeableConcept(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.VerificationResult.VerificationResultAttestationComponent convertVerificationResultAttestationComponent(org.hl7.fhir.r4.model.VerificationResult.VerificationResultAttestationComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.VerificationResult.VerificationResultAttestationComponent tgt = new org.hl7.fhir.r5.model.VerificationResult.VerificationResultAttestationComponent(); + copyElement(src, tgt); + if (src.hasWho()) + tgt.setWho(convertReference(src.getWho())); + if (src.hasOnBehalfOf()) + tgt.setOnBehalfOf(convertReference(src.getOnBehalfOf())); + if (src.hasCommunicationMethod()) + tgt.setCommunicationMethod(convertCodeableConcept(src.getCommunicationMethod())); + if (src.hasDate()) + tgt.setDateElement(convertDate(src.getDateElement())); + if (src.hasSourceIdentityCertificate()) + tgt.setSourceIdentityCertificateElement(convertString(src.getSourceIdentityCertificateElement())); + if (src.hasProxyIdentityCertificate()) + tgt.setProxyIdentityCertificateElement(convertString(src.getProxyIdentityCertificateElement())); + if (src.hasProxySignature()) + tgt.setProxySignature(convertSignature(src.getProxySignature())); + if (src.hasSourceSignature()) + tgt.setSourceSignature(convertSignature(src.getSourceSignature())); + return tgt; + } + + public static org.hl7.fhir.r4.model.VerificationResult.VerificationResultAttestationComponent convertVerificationResultAttestationComponent(org.hl7.fhir.r5.model.VerificationResult.VerificationResultAttestationComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.VerificationResult.VerificationResultAttestationComponent tgt = new org.hl7.fhir.r4.model.VerificationResult.VerificationResultAttestationComponent(); + copyElement(src, tgt); + if (src.hasWho()) + tgt.setWho(convertReference(src.getWho())); + if (src.hasOnBehalfOf()) + tgt.setOnBehalfOf(convertReference(src.getOnBehalfOf())); + if (src.hasCommunicationMethod()) + tgt.setCommunicationMethod(convertCodeableConcept(src.getCommunicationMethod())); + if (src.hasDate()) + tgt.setDateElement(convertDate(src.getDateElement())); + if (src.hasSourceIdentityCertificate()) + tgt.setSourceIdentityCertificateElement(convertString(src.getSourceIdentityCertificateElement())); + if (src.hasProxyIdentityCertificate()) + tgt.setProxyIdentityCertificateElement(convertString(src.getProxyIdentityCertificateElement())); + if (src.hasProxySignature()) + tgt.setProxySignature(convertSignature(src.getProxySignature())); + if (src.hasSourceSignature()) + tgt.setSourceSignature(convertSignature(src.getSourceSignature())); + return tgt; + } + + public static org.hl7.fhir.r5.model.VerificationResult.VerificationResultValidatorComponent convertVerificationResultValidatorComponent(org.hl7.fhir.r4.model.VerificationResult.VerificationResultValidatorComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.VerificationResult.VerificationResultValidatorComponent tgt = new org.hl7.fhir.r5.model.VerificationResult.VerificationResultValidatorComponent(); + copyElement(src, tgt); + if (src.hasOrganization()) + tgt.setOrganization(convertReference(src.getOrganization())); + if (src.hasIdentityCertificate()) + tgt.setIdentityCertificateElement(convertString(src.getIdentityCertificateElement())); + if (src.hasAttestationSignature()) + tgt.setAttestationSignature(convertSignature(src.getAttestationSignature())); + return tgt; + } + + public static org.hl7.fhir.r4.model.VerificationResult.VerificationResultValidatorComponent convertVerificationResultValidatorComponent(org.hl7.fhir.r5.model.VerificationResult.VerificationResultValidatorComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.VerificationResult.VerificationResultValidatorComponent tgt = new org.hl7.fhir.r4.model.VerificationResult.VerificationResultValidatorComponent(); + copyElement(src, tgt); + if (src.hasOrganization()) + tgt.setOrganization(convertReference(src.getOrganization())); + if (src.hasIdentityCertificate()) + tgt.setIdentityCertificateElement(convertString(src.getIdentityCertificateElement())); + if (src.hasAttestationSignature()) + tgt.setAttestationSignature(convertSignature(src.getAttestationSignature())); + return tgt; + } + + +} diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/VisionPrescription.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/VisionPrescription.java new file mode 100644 index 000000000..7e1ef62c0 --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/VisionPrescription.java @@ -0,0 +1,255 @@ +package org.hl7.fhir.convertors.conv40_50; + +import org.hl7.fhir.exceptions.FHIRException; + +import org.hl7.fhir.convertors.VersionConvertor_40_50; + + +/* + Copyright (c) 2011+, HL7, Inc. + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of HL7 nor the names of its contributors may be used to + endorse or promote products derived from this software without specific + prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + +*/ + +// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0 + + +public class VisionPrescription extends VersionConvertor_40_50 { + + public static org.hl7.fhir.r5.model.VisionPrescription convertVisionPrescription(org.hl7.fhir.r4.model.VisionPrescription src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.VisionPrescription tgt = new org.hl7.fhir.r5.model.VisionPrescription(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasStatus()) + tgt.setStatus(convertVisionStatus(src.getStatus())); + if (src.hasCreated()) + tgt.setCreatedElement(convertDateTime(src.getCreatedElement())); + if (src.hasPatient()) + tgt.setPatient(convertReference(src.getPatient())); + if (src.hasEncounter()) + tgt.setEncounter(convertReference(src.getEncounter())); + if (src.hasDateWritten()) + tgt.setDateWrittenElement(convertDateTime(src.getDateWrittenElement())); + if (src.hasPrescriber()) + tgt.setPrescriber(convertReference(src.getPrescriber())); + for (org.hl7.fhir.r4.model.VisionPrescription.VisionPrescriptionLensSpecificationComponent t : src.getLensSpecification()) + tgt.addLensSpecification(convertVisionPrescriptionLensSpecificationComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.VisionPrescription convertVisionPrescription(org.hl7.fhir.r5.model.VisionPrescription src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.VisionPrescription tgt = new org.hl7.fhir.r4.model.VisionPrescription(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasStatus()) + tgt.setStatus(convertVisionStatus(src.getStatus())); + if (src.hasCreated()) + tgt.setCreatedElement(convertDateTime(src.getCreatedElement())); + if (src.hasPatient()) + tgt.setPatient(convertReference(src.getPatient())); + if (src.hasEncounter()) + tgt.setEncounter(convertReference(src.getEncounter())); + if (src.hasDateWritten()) + tgt.setDateWrittenElement(convertDateTime(src.getDateWrittenElement())); + if (src.hasPrescriber()) + tgt.setPrescriber(convertReference(src.getPrescriber())); + for (org.hl7.fhir.r5.model.VisionPrescription.VisionPrescriptionLensSpecificationComponent t : src.getLensSpecification()) + tgt.addLensSpecification(convertVisionPrescriptionLensSpecificationComponent(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.VisionPrescription.VisionStatus convertVisionStatus(org.hl7.fhir.r4.model.VisionPrescription.VisionStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case ACTIVE: return org.hl7.fhir.r5.model.VisionPrescription.VisionStatus.ACTIVE; + case CANCELLED: return org.hl7.fhir.r5.model.VisionPrescription.VisionStatus.CANCELLED; + case DRAFT: return org.hl7.fhir.r5.model.VisionPrescription.VisionStatus.DRAFT; + case ENTEREDINERROR: return org.hl7.fhir.r5.model.VisionPrescription.VisionStatus.ENTEREDINERROR; + default: return org.hl7.fhir.r5.model.VisionPrescription.VisionStatus.NULL; + } +} + + public static org.hl7.fhir.r4.model.VisionPrescription.VisionStatus convertVisionStatus(org.hl7.fhir.r5.model.VisionPrescription.VisionStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case ACTIVE: return org.hl7.fhir.r4.model.VisionPrescription.VisionStatus.ACTIVE; + case CANCELLED: return org.hl7.fhir.r4.model.VisionPrescription.VisionStatus.CANCELLED; + case DRAFT: return org.hl7.fhir.r4.model.VisionPrescription.VisionStatus.DRAFT; + case ENTEREDINERROR: return org.hl7.fhir.r4.model.VisionPrescription.VisionStatus.ENTEREDINERROR; + default: return org.hl7.fhir.r4.model.VisionPrescription.VisionStatus.NULL; + } +} + + public static org.hl7.fhir.r5.model.VisionPrescription.VisionPrescriptionLensSpecificationComponent convertVisionPrescriptionLensSpecificationComponent(org.hl7.fhir.r4.model.VisionPrescription.VisionPrescriptionLensSpecificationComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.VisionPrescription.VisionPrescriptionLensSpecificationComponent tgt = new org.hl7.fhir.r5.model.VisionPrescription.VisionPrescriptionLensSpecificationComponent(); + copyElement(src, tgt); + if (src.hasProduct()) + tgt.setProduct(convertCodeableConcept(src.getProduct())); + if (src.hasEye()) + tgt.setEye(convertVisionEyes(src.getEye())); + if (src.hasSphere()) + tgt.setSphereElement(convertDecimal(src.getSphereElement())); + if (src.hasCylinder()) + tgt.setCylinderElement(convertDecimal(src.getCylinderElement())); + if (src.hasAxis()) + tgt.setAxisElement(convertInteger(src.getAxisElement())); + for (org.hl7.fhir.r4.model.VisionPrescription.PrismComponent t : src.getPrism()) + tgt.addPrism(convertPrismComponent(t)); + if (src.hasAdd()) + tgt.setAddElement(convertDecimal(src.getAddElement())); + if (src.hasPower()) + tgt.setPowerElement(convertDecimal(src.getPowerElement())); + if (src.hasBackCurve()) + tgt.setBackCurveElement(convertDecimal(src.getBackCurveElement())); + if (src.hasDiameter()) + tgt.setDiameterElement(convertDecimal(src.getDiameterElement())); + if (src.hasDuration()) + tgt.setDuration(convertSimpleQuantity(src.getDuration())); + if (src.hasColor()) + tgt.setColorElement(convertString(src.getColorElement())); + if (src.hasBrand()) + tgt.setBrandElement(convertString(src.getBrandElement())); + for (org.hl7.fhir.r4.model.Annotation t : src.getNote()) + tgt.addNote(convertAnnotation(t)); + return tgt; + } + + public static org.hl7.fhir.r4.model.VisionPrescription.VisionPrescriptionLensSpecificationComponent convertVisionPrescriptionLensSpecificationComponent(org.hl7.fhir.r5.model.VisionPrescription.VisionPrescriptionLensSpecificationComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.VisionPrescription.VisionPrescriptionLensSpecificationComponent tgt = new org.hl7.fhir.r4.model.VisionPrescription.VisionPrescriptionLensSpecificationComponent(); + copyElement(src, tgt); + if (src.hasProduct()) + tgt.setProduct(convertCodeableConcept(src.getProduct())); + if (src.hasEye()) + tgt.setEye(convertVisionEyes(src.getEye())); + if (src.hasSphere()) + tgt.setSphereElement(convertDecimal(src.getSphereElement())); + if (src.hasCylinder()) + tgt.setCylinderElement(convertDecimal(src.getCylinderElement())); + if (src.hasAxis()) + tgt.setAxisElement(convertInteger(src.getAxisElement())); + for (org.hl7.fhir.r5.model.VisionPrescription.PrismComponent t : src.getPrism()) + tgt.addPrism(convertPrismComponent(t)); + if (src.hasAdd()) + tgt.setAddElement(convertDecimal(src.getAddElement())); + if (src.hasPower()) + tgt.setPowerElement(convertDecimal(src.getPowerElement())); + if (src.hasBackCurve()) + tgt.setBackCurveElement(convertDecimal(src.getBackCurveElement())); + if (src.hasDiameter()) + tgt.setDiameterElement(convertDecimal(src.getDiameterElement())); + if (src.hasDuration()) + tgt.setDuration(convertSimpleQuantity(src.getDuration())); + if (src.hasColor()) + tgt.setColorElement(convertString(src.getColorElement())); + if (src.hasBrand()) + tgt.setBrandElement(convertString(src.getBrandElement())); + for (org.hl7.fhir.r5.model.Annotation t : src.getNote()) + tgt.addNote(convertAnnotation(t)); + return tgt; + } + + public static org.hl7.fhir.r5.model.VisionPrescription.VisionEyes convertVisionEyes(org.hl7.fhir.r4.model.VisionPrescription.VisionEyes src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case RIGHT: return org.hl7.fhir.r5.model.VisionPrescription.VisionEyes.RIGHT; + case LEFT: return org.hl7.fhir.r5.model.VisionPrescription.VisionEyes.LEFT; + default: return org.hl7.fhir.r5.model.VisionPrescription.VisionEyes.NULL; + } +} + + public static org.hl7.fhir.r4.model.VisionPrescription.VisionEyes convertVisionEyes(org.hl7.fhir.r5.model.VisionPrescription.VisionEyes src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case RIGHT: return org.hl7.fhir.r4.model.VisionPrescription.VisionEyes.RIGHT; + case LEFT: return org.hl7.fhir.r4.model.VisionPrescription.VisionEyes.LEFT; + default: return org.hl7.fhir.r4.model.VisionPrescription.VisionEyes.NULL; + } +} + + public static org.hl7.fhir.r5.model.VisionPrescription.PrismComponent convertPrismComponent(org.hl7.fhir.r4.model.VisionPrescription.PrismComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r5.model.VisionPrescription.PrismComponent tgt = new org.hl7.fhir.r5.model.VisionPrescription.PrismComponent(); + copyElement(src, tgt); + if (src.hasAmount()) + tgt.setAmountElement(convertDecimal(src.getAmountElement())); + if (src.hasBase()) + tgt.setBase(convertVisionBase(src.getBase())); + return tgt; + } + + public static org.hl7.fhir.r4.model.VisionPrescription.PrismComponent convertPrismComponent(org.hl7.fhir.r5.model.VisionPrescription.PrismComponent src) throws FHIRException { + if (src == null) + return null; + org.hl7.fhir.r4.model.VisionPrescription.PrismComponent tgt = new org.hl7.fhir.r4.model.VisionPrescription.PrismComponent(); + copyElement(src, tgt); + if (src.hasAmount()) + tgt.setAmountElement(convertDecimal(src.getAmountElement())); + if (src.hasBase()) + tgt.setBase(convertVisionBase(src.getBase())); + return tgt; + } + + public static org.hl7.fhir.r5.model.VisionPrescription.VisionBase convertVisionBase(org.hl7.fhir.r4.model.VisionPrescription.VisionBase src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case UP: return org.hl7.fhir.r5.model.VisionPrescription.VisionBase.UP; + case DOWN: return org.hl7.fhir.r5.model.VisionPrescription.VisionBase.DOWN; + case IN: return org.hl7.fhir.r5.model.VisionPrescription.VisionBase.IN; + case OUT: return org.hl7.fhir.r5.model.VisionPrescription.VisionBase.OUT; + default: return org.hl7.fhir.r5.model.VisionPrescription.VisionBase.NULL; + } +} + + public static org.hl7.fhir.r4.model.VisionPrescription.VisionBase convertVisionBase(org.hl7.fhir.r5.model.VisionPrescription.VisionBase src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case UP: return org.hl7.fhir.r4.model.VisionPrescription.VisionBase.UP; + case DOWN: return org.hl7.fhir.r4.model.VisionPrescription.VisionBase.DOWN; + case IN: return org.hl7.fhir.r4.model.VisionPrescription.VisionBase.IN; + case OUT: return org.hl7.fhir.r4.model.VisionPrescription.VisionBase.OUT; + default: return org.hl7.fhir.r4.model.VisionPrescription.VisionBase.NULL; + } +} + + +} diff --git a/org.hl7.fhir.r4/src/main/java/org/hl7/fhir/r4/model/Enumerations.java b/org.hl7.fhir.r4/src/main/java/org/hl7/fhir/r4/model/Enumerations.java index a8a7606ac..741e1f90b 100644 --- a/org.hl7.fhir.r4/src/main/java/org/hl7/fhir/r4/model/Enumerations.java +++ b/org.hl7.fhir.r4/src/main/java/org/hl7/fhir/r4/model/Enumerations.java @@ -9963,6 +9963,7 @@ The primary difference between a medication statement and a medication administr /** * added to help the parsers */ + _4_1_0, NULL; public static FHIRVersion fromCode(String codeString) throws FHIRException { if (codeString == null || "".equals(codeString)) @@ -10009,6 +10010,8 @@ The primary difference between a medication statement and a medication administr return _3_5_0; if ("4.0.0".equals(codeString)) return _4_0_0; + if ("4.1.0".equals(codeString)) + return _4_1_0; throw new FHIRException("Unknown FHIRVersion code '"+codeString+"'"); } @Override @@ -10038,6 +10041,7 @@ The primary difference between a medication statement and a medication administr case _3_3_0: return "3.3.0"; case _3_5_0: return "3.5.0"; case _4_0_0: return "4.0.0"; + case _4_1_0: return "4.1.0"; default: return "?"; } } @@ -10064,6 +10068,7 @@ The primary difference between a medication statement and a medication administr case _3_3_0: return "http://hl7.org/fhir/FHIR-version"; case _3_5_0: return "http://hl7.org/fhir/FHIR-version"; case _4_0_0: return "http://hl7.org/fhir/FHIR-version"; + case _4_1_0: return "http://hl7.org/fhir/FHIR-version"; default: return "?"; } } diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/model/Constants.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/model/Constants.java index b0a5a9209..e572af7fc 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/model/Constants.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/model/Constants.java @@ -55,7 +55,7 @@ package org.hl7.fhir.r5.model; public class Constants { - public final static String VERSION = "4.0.0"; + public final static String VERSION = "4.1.0"; public final static String BUILD_ID = "e0e3caf9ba"; public final static String DATE = "Thu Dec 13 14:07:26 AEDT 2018"; public final static String URI_REGEX = "((http|https)://([A-Za-z0-9\\\\\\.\\:\\%\\$]*\\/)*)?(Account|ActivityDefinition|AdverseEvent|AllergyIntolerance|Appointment|AppointmentResponse|AuditEvent|Basic|Binary|BiologicallyDerivedProduct|BodyStructure|Bundle|CapabilityStatement|CarePlan|CareTeam|CatalogEntry|ChargeItem|ChargeItemDefinition|Claim|ClaimResponse|ClinicalImpression|CodeSystem|Communication|CommunicationRequest|CompartmentDefinition|Composition|ConceptMap|Condition|Consent|Contract|Coverage|CoverageEligibilityRequest|CoverageEligibilityResponse|DetectedIssue|Device|DeviceDefinition|DeviceMetric|DeviceRequest|DeviceUseStatement|DiagnosticReport|DocumentManifest|DocumentReference|EffectEvidenceSynthesis|Encounter|Endpoint|EnrollmentRequest|EnrollmentResponse|EpisodeOfCare|EventDefinition|Evidence|EvidenceVariable|ExampleScenario|ExplanationOfBenefit|FamilyMemberHistory|Flag|Goal|GraphDefinition|Group|GuidanceResponse|HealthcareService|ImagingStudy|Immunization|ImmunizationEvaluation|ImmunizationRecommendation|ImplementationGuide|InsurancePlan|Invoice|Library|Linkage|List|Location|Measure|MeasureReport|Media|Medication|MedicationAdministration|MedicationDispense|MedicationKnowledge|MedicationRequest|MedicationStatement|MedicinalProduct|MedicinalProductAuthorization|MedicinalProductContraindication|MedicinalProductIndication|MedicinalProductIngredient|MedicinalProductInteraction|MedicinalProductManufactured|MedicinalProductPackaged|MedicinalProductPharmaceutical|MedicinalProductUndesirableEffect|MessageDefinition|MessageHeader|MolecularSequence|NamingSystem|NutritionOrder|Observation|ObservationDefinition|OperationDefinition|OperationOutcome|Organization|OrganizationAffiliation|Patient|PaymentNotice|PaymentReconciliation|Person|PlanDefinition|Practitioner|PractitionerRole|Procedure|Provenance|Questionnaire|QuestionnaireResponse|RelatedPerson|RequestGroup|ResearchDefinition|ResearchElementDefinition|ResearchStudy|ResearchSubject|RiskAssessment|RiskEvidenceSynthesis|Schedule|SearchParameter|ServiceRequest|Slot|Specimen|SpecimenDefinition|StructureDefinition|StructureMap|Subscription|Substance|SubstanceNucleicAcid|SubstancePolymer|SubstanceProtein|SubstanceReferenceInformation|SubstanceSourceMaterial|SubstanceSpecification|SupplyDelivery|SupplyRequest|Task|TerminologyCapabilities|TestReport|TestScript|ValueSet|VerificationResult|VisionPrescription)\\/[A-Za-z0-9\\-\\.]{1,64}(\\/_history\\/[A-Za-z0-9\\-\\.]{1,64})?"; diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/model/Enumerations.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/model/Enumerations.java index 85f38098f..e5092d2cc 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/model/Enumerations.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/model/Enumerations.java @@ -9960,6 +9960,7 @@ The primary difference between a medication statement and a medication administr * FHIR Release 4 (Normative + STU). */ _4_0_0, + _4_1_0, /** * added to help the parsers */ @@ -10009,6 +10010,8 @@ The primary difference between a medication statement and a medication administr return _3_5_0; if ("4.0.0".equals(codeString)) return _4_0_0; + if ("4.1.0".equals(codeString)) + return _4_1_0; throw new FHIRException("Unknown FHIRVersion code '"+codeString+"'"); } @Override @@ -10038,6 +10041,7 @@ The primary difference between a medication statement and a medication administr case _3_3_0: return "3.3.0"; case _3_5_0: return "3.5.0"; case _4_0_0: return "4.0.0"; + case _4_1_0: return "4.1.0"; default: return "?"; } } @@ -10064,6 +10068,7 @@ The primary difference between a medication statement and a medication administr case _3_3_0: return "http://hl7.org/fhir/FHIR-version"; case _3_5_0: return "http://hl7.org/fhir/FHIR-version"; case _4_0_0: return "http://hl7.org/fhir/FHIR-version"; + case _4_1_0: return "http://hl7.org/fhir/FHIR-version"; default: return "?"; } } @@ -10090,6 +10095,7 @@ The primary difference between a medication statement and a medication administr case _3_3_0: return "R4 Ballot #1."; case _3_5_0: return "R4 Ballot #2."; case _4_0_0: return "FHIR Release 4 (Normative + STU)."; + case _4_1_0: return "FHIR Release 4 (Normative + STU)."; default: return "?"; } } @@ -10116,6 +10122,7 @@ The primary difference between a medication statement and a medication administr case _3_3_0: return "3.3.0"; case _3_5_0: return "3.5.0"; case _4_0_0: return "4.0.0"; + case _4_1_0: return "4.1.0"; default: return "?"; } } @@ -10171,6 +10178,8 @@ The primary difference between a medication statement and a medication administr return FHIRVersion._3_5_0; if ("4.0.0".equals(codeString)) return FHIRVersion._4_0_0; + if ("4.1.0".equals(codeString)) + return FHIRVersion._4_1_0; throw new IllegalArgumentException("Unknown FHIRVersion code '"+codeString+"'"); } public Enumeration fromType(Base code) throws FHIRException { @@ -10223,6 +10232,8 @@ The primary difference between a medication statement and a medication administr return new Enumeration(this, FHIRVersion._3_5_0); if ("4.0.0".equals(codeString)) return new Enumeration(this, FHIRVersion._4_0_0); + if ("4.1.0".equals(codeString)) + return new Enumeration(this, FHIRVersion._4_1_0); throw new FHIRException("Unknown FHIRVersion code '"+codeString+"'"); } public String toCode(FHIRVersion code) { @@ -10268,6 +10279,8 @@ The primary difference between a medication statement and a medication administr return "3.5.0"; if (code == FHIRVersion._4_0_0) return "4.0.0"; + if (code == FHIRVersion._4_1_0) + return "4.1.0"; return "?"; } public String toSystem(FHIRVersion code) { diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/terminologies/TerminologyClientR4.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/terminologies/TerminologyClientR5.java similarity index 94% rename from org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/terminologies/TerminologyClientR4.java rename to org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/terminologies/TerminologyClientR5.java index eabee14a4..0990b1fbf 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/terminologies/TerminologyClientR4.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/terminologies/TerminologyClientR5.java @@ -32,11 +32,11 @@ import org.hl7.fhir.r5.model.TerminologyCapabilities; import org.hl7.fhir.r5.model.ValueSet; import org.hl7.fhir.r5.utils.client.FHIRToolingClient; -public class TerminologyClientR4 implements TerminologyClient { +public class TerminologyClientR5 implements TerminologyClient { private FHIRToolingClient client; - public TerminologyClientR4(String address) throws URISyntaxException { + public TerminologyClientR5(String address) throws URISyntaxException { client = new FHIRToolingClient(address); } diff --git a/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/cache/NpmPackage.java b/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/cache/NpmPackage.java index 9b161280a..52bdfae8d 100644 --- a/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/cache/NpmPackage.java +++ b/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/cache/NpmPackage.java @@ -144,6 +144,17 @@ import com.google.gson.JsonObject; return res; } + public List listResources(String... types) throws IOException { + List files = list("package"); + List res = new ArrayList(); + for (String s : files) { + String[] n = s.split("\\-"); + if (Utilities.existsInList(n[0], types)) + res.add(s); + } + return res; + } + /** * Copies all the files in the package folder [folder] to the nominated dest, * and returns a list of all the file names copied diff --git a/org.hl7.fhir.validation/.classpath b/org.hl7.fhir.validation/.classpath index 9fbc76366..b6a864ac8 100644 --- a/org.hl7.fhir.validation/.classpath +++ b/org.hl7.fhir.validation/.classpath @@ -47,5 +47,6 @@ + diff --git a/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/r4/validation/InstanceValidator.java b/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/r4/validation/InstanceValidator.java index cb403e9ce..cd6715547 100644 --- a/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/r4/validation/InstanceValidator.java +++ b/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/r4/validation/InstanceValidator.java @@ -137,7 +137,7 @@ import ca.uhn.fhir.util.ObjectUtil; /** * Thinking of using this in a java program? Don't! - * You should use on of the wrappers instead. Either in HAPI, or use ValidationEngine + * You should use one of the wrappers instead. Either in HAPI, or use ValidationEngine * * @author Grahame Grieve * @@ -3293,13 +3293,18 @@ private String misplacedItemError(QuestionnaireItemComponent qItem) { String url = getCanonicalURLForEntry(entry); String id = getIdForEntry(entry); if (url != null) { - if (!(!url.equals(fullUrl) || (url.matches(uriRegexForVersion()) && url.endsWith("/"+id)))) + if (!(!url.equals(fullUrl) || (url.matches(uriRegexForVersion()) && url.endsWith("/"+id))) && !isV3orV2Url(url)) rule(errors, IssueType.INVALID, entry.line(), entry.col(), stack.addToLiteralPath("entry", ":0"), false, "The canonical URL ("+url+") cannot match the fullUrl ("+fullUrl+") unless the resource id ("+id+") also matches"); rule(errors, IssueType.INVALID, entry.line(), entry.col(), stack.addToLiteralPath("entry", ":0"), !url.equals(fullUrl) || serverBase == null || (url.equals(Utilities.pathURL(serverBase, entry.getNamedChild("resource").fhirType(), id))), "The canonical URL ("+url+") cannot match the fullUrl ("+fullUrl+") unless on the canonical server itself"); } } } + // hack for pre-UTG v2/v3 + private boolean isV3orV2Url(String url) { + return url.startsWith("http://hl7.org/fhir/v3/") || url.startsWith("http://hl7.org/fhir/v2/"); + } + public final static String URI_REGEX3 = "((http|https)://([A-Za-z0-9\\\\\\.\\:\\%\\$]*\\/)*)?(Account|ActivityDefinition|AllergyIntolerance|AdverseEvent|Appointment|AppointmentResponse|AuditEvent|Basic|Binary|BodySite|Bundle|CapabilityStatement|CarePlan|CareTeam|ChargeItem|Claim|ClaimResponse|ClinicalImpression|CodeSystem|Communication|CommunicationRequest|CompartmentDefinition|Composition|ConceptMap|Condition (aka Problem)|Consent|Contract|Coverage|DataElement|DetectedIssue|Device|DeviceComponent|DeviceMetric|DeviceRequest|DeviceUseStatement|DiagnosticReport|DocumentManifest|DocumentReference|EligibilityRequest|EligibilityResponse|Encounter|Endpoint|EnrollmentRequest|EnrollmentResponse|EpisodeOfCare|ExpansionProfile|ExplanationOfBenefit|FamilyMemberHistory|Flag|Goal|GraphDefinition|Group|GuidanceResponse|HealthcareService|ImagingManifest|ImagingStudy|Immunization|ImmunizationRecommendation|ImplementationGuide|Library|Linkage|List|Location|Measure|MeasureReport|Media|Medication|MedicationAdministration|MedicationDispense|MedicationRequest|MedicationStatement|MessageDefinition|MessageHeader|NamingSystem|NutritionOrder|Observation|OperationDefinition|OperationOutcome|Organization|Parameters|Patient|PaymentNotice|PaymentReconciliation|Person|PlanDefinition|Practitioner|PractitionerRole|Procedure|ProcedureRequest|ProcessRequest|ProcessResponse|Provenance|Questionnaire|QuestionnaireResponse|ReferralRequest|RelatedPerson|RequestGroup|ResearchStudy|ResearchSubject|RiskAssessment|Schedule|SearchParameter|Sequence|ServiceDefinition|Slot|Specimen|StructureDefinition|StructureMap|Subscription|Substance|SupplyDelivery|SupplyRequest|Task|TestScript|TestReport|ValueSet|VisionPrescription)\\/[A-Za-z0-9\\-\\.]{1,64}(\\/_history\\/[A-Za-z0-9\\-\\.]{1,64})?"; private String uriRegexForVersion() { @@ -4387,6 +4392,8 @@ private String misplacedItemError(QuestionnaireItemComponent qItem) { return "searchType.exists() implies type = 'string'"; if ("abatement.empty() or (abatement as boolean).not() or clinicalStatus='resolved' or clinicalStatus='remission' or clinicalStatus='inactive'".equals(expr)) return "abatement.empty() or (abatement is boolean).not() or (abatement as boolean).not() or (clinicalStatus = 'resolved') or (clinicalStatus = 'remission') or (clinicalStatus = 'inactive')"; + if ("(component.empty() and related.empty()) implies (dataAbsentReason or value)".equals(expr)) + return "(component.empty() and related.empty()) implies (dataAbsentReason.exists() or value.exists())"; if ("".equals(expr)) return ""; diff --git a/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/r4/validation/NativeHostServices.java b/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/r4/validation/NativeHostServices.java index f42893dd3..36038cc25 100644 --- a/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/r4/validation/NativeHostServices.java +++ b/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/r4/validation/NativeHostServices.java @@ -24,6 +24,7 @@ package org.hl7.fhir.r4.validation; import java.io.ByteArrayOutputStream; import java.io.IOException; +import org.hl7.fhir.convertors.VersionConvertorAdvisor40; import org.hl7.fhir.convertors.VersionConvertorAdvisor40; import org.hl7.fhir.convertors.VersionConvertor_10_40; import org.hl7.fhir.convertors.VersionConvertor_14_40; @@ -116,8 +117,7 @@ public class NativeHostServices { @Override public CodeSystem getCodeSystem(ValueSet src) throws FHIRException { throw new FHIRException("Code systems cannot be handled at this time"); // what to do? need thread local storage? - } - + } } private ValidationEngine validator; diff --git a/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/r4/validation/ValidationEngine.java b/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/r4/validation/ValidationEngine.java index c1e82ed2a..89396fe2f 100644 --- a/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/r4/validation/ValidationEngine.java +++ b/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/r4/validation/ValidationEngine.java @@ -72,13 +72,22 @@ import java.util.zip.ZipEntry; import java.util.zip.ZipInputStream; import org.apache.commons.io.IOUtils; +import org.apache.commons.lang3.NotImplementedException; import org.hl7.fhir.convertors.R2016MayToR4Loader; +import org.hl7.fhir.convertors.R2016MayToR5Loader; import org.hl7.fhir.convertors.R2ToR4Loader; +import org.hl7.fhir.convertors.R2ToR5Loader; import org.hl7.fhir.convertors.R3ToR4Loader; +import org.hl7.fhir.convertors.R3ToR5Loader; +import org.hl7.fhir.convertors.R4ToR5Loader; import org.hl7.fhir.convertors.TerminologyClientFactory; import org.hl7.fhir.convertors.VersionConvertorAdvisor40; +import org.hl7.fhir.convertors.VersionConvertorAdvisor40; +import org.hl7.fhir.convertors.VersionConvertor_10_40; import org.hl7.fhir.convertors.VersionConvertor_10_40; import org.hl7.fhir.convertors.VersionConvertor_14_40; +import org.hl7.fhir.convertors.VersionConvertor_14_40; +import org.hl7.fhir.convertors.VersionConvertor_30_40; import org.hl7.fhir.convertors.VersionConvertor_30_40; import org.hl7.fhir.exceptions.DefinitionException; import org.hl7.fhir.exceptions.FHIRException; @@ -619,7 +628,8 @@ public class ValidationEngine { if (url == null) { context.setCanRunWithoutTerminology(true); } else - context.connectToTSServer(TerminologyClientFactory.makeClient(url, version), log); + throw new NotImplementedException("Do not use R4 validator... being phased out"); + //context.connectToTSServer(TerminologyClientFactory.makeClient(url, version), log); } public void loadProfile(String src) throws Exception { diff --git a/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/r5/validation/BaseValidator.java b/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/r5/validation/BaseValidator.java new file mode 100644 index 000000000..f353043c9 --- /dev/null +++ b/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/r5/validation/BaseValidator.java @@ -0,0 +1,517 @@ +package org.hl7.fhir.r5.validation; + +/*- + * #%L + * org.hl7.fhir.validation + * %% + * Copyright (C) 2014 - 2019 Health Level 7 + * %% + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * #L% + */ + + +/* +Copyright (c) 2011+, HL7, Inc +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of HL7 nor the names of its contributors may be used to + endorse or promote products derived from this software without specific + prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, +INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. + +*/ + +import java.text.MessageFormat; +import java.util.List; + +import org.apache.commons.lang3.StringUtils; +import org.hl7.fhir.utilities.validation.ValidationMessage; +import org.hl7.fhir.utilities.validation.ValidationMessage.IssueSeverity; +import org.hl7.fhir.utilities.validation.ValidationMessage.IssueType; +import org.hl7.fhir.utilities.validation.ValidationMessage.Source; + +public class BaseValidator { + + protected Source source; + + /** + * Test a rule and add a {@link IssueSeverity#FATAL} validation message if the validation fails + * + * @param thePass + * Set this parameter to false if the validation does not pass + * @return Returns thePass (in other words, returns true if the rule did not fail validation) + */ + protected boolean fail(List errors, IssueType type, int line, int col, String path, boolean thePass, String msg) { + if (!thePass) { + addValidationMessage(errors, type, line, col, path, msg, IssueSeverity.FATAL); + } + return thePass; + } + + /** + * Test a rule and add a {@link IssueSeverity#FATAL} validation message if the validation fails + * + * @param thePass + * Set this parameter to false if the validation does not pass + * @return Returns thePass (in other words, returns true if the rule did not fail validation) + */ + protected boolean fail(List errors, IssueType type, List pathParts, boolean thePass, String msg) { + if (!thePass) { + String path = toPath(pathParts); + addValidationMessage(errors, type, -1, -1, path, msg, IssueSeverity.FATAL); + } + return thePass; + } + + /** + * Test a rule and add a {@link IssueSeverity#FATAL} validation message if the validation fails + * + * @param thePass + * Set this parameter to false if the validation does not pass + * @return Returns thePass (in other words, returns true if the rule did not fail validation) + */ + protected boolean fail(List errors, IssueType type, List pathParts, boolean thePass, String theMessage, Object... theMessageArguments) { + if (!thePass) { + String path = toPath(pathParts); + addValidationMessage(errors, type, -1, -1, path, formatMessage(theMessage, theMessageArguments), IssueSeverity.FATAL); + } + return thePass; + } + + /** + * Test a rule and add a {@link IssueSeverity#FATAL} validation message if the validation fails + * + * @param thePass + * Set this parameter to false if the validation does not pass + * @return Returns thePass (in other words, returns true if the rule did not fail validation) + */ + protected boolean fail(List errors, IssueType type, String path, boolean thePass, String msg) { + if (!thePass) { + addValidationMessage(errors, type, -1, -1, path, msg, IssueSeverity.FATAL); + } + return thePass; + } + + + private String formatMessage(String theMessage, Object... theMessageArguments) { + String message; + if (theMessageArguments != null && theMessageArguments.length > 0) { + message = MessageFormat.format(theMessage, theMessageArguments); + } else { + message = theMessage; + } + return message; + } + + protected boolean grammarWord(String w) { + return w.equals("and") || w.equals("or") || w.equals("a") || w.equals("the") || w.equals("for") || w.equals("this") || w.equals("that") || w.equals("of"); + } + + /** + * Test a rule and add a {@link IssueSeverity#INFORMATION} validation message if the validation fails + * + * @param thePass + * Set this parameter to false if the validation does not pass + * @return Returns thePass (in other words, returns true if the rule did not fail validation) + */ + protected boolean hint(List errors, IssueType type, int line, int col, String path, boolean thePass, String msg) { + if (!thePass) { + addValidationMessage(errors, type, line, col, path, msg, IssueSeverity.INFORMATION); + } + return thePass; + } + + /** + * Test a rule and add a {@link IssueSeverity#INFORMATION} validation message if the validation fails + * + * @param thePass + * Set this parameter to false if the validation does not pass + * @return Returns thePass (in other words, returns true if the rule did not fail validation) + */ + protected boolean hint(List errors, IssueType type, int line, int col, String path, boolean thePass, String theMessage, Object... theMessageArguments) { + if (!thePass) { + String message = formatMessage(theMessage, theMessageArguments); + addValidationMessage(errors, type, line, col, path, message, IssueSeverity.INFORMATION); + } + return thePass; + } + + protected boolean txHint(List errors, String txLink, IssueType type, int line, int col, String path, boolean thePass, String theMessage, Object... theMessageArguments) { + if (!thePass) { + String message = formatMessage(theMessage, theMessageArguments); + addValidationMessage(errors, type, line, col, path, message, IssueSeverity.INFORMATION, Source.TerminologyEngine) + .setTxLink(txLink); + } + return thePass; + } + + /** + * Test a rule and add a {@link IssueSeverity#INFORMATION} validation message if the validation fails + * + * @param thePass + * Set this parameter to false if the validation does not pass + * @return Returns thePass (in other words, returns true if the rule did not fail validation) + */ + protected boolean hint(List errors, IssueType type, List pathParts, boolean thePass, String theMessage, Object... theMessageArguments) { + if (!thePass) { + String path = toPath(pathParts); + String message = formatMessage(theMessage, theMessageArguments); + addValidationMessage(errors, type, -1, -1, path, message, IssueSeverity.INFORMATION); + } + return thePass; + } + + /** + * Test a rule and add a {@link IssueSeverity#INFORMATION} validation message if the validation fails + * + * @param thePass + * Set this parameter to false if the validation does not pass + * @return Returns thePass (in other words, returns true if the rule did not fail validation) + */ + protected boolean hint(List errors, IssueType type, String path, boolean thePass, String msg) { + if (!thePass) { + addValidationMessage(errors, type, -1, -1, path, msg, IssueSeverity.INFORMATION); + } + return thePass; + } + + /** + * Test a rule and add a {@link IssueSeverity#ERROR} validation message if the validation fails + * + * @param thePass + * Set this parameter to false if the validation does not pass + * @return Returns thePass (in other words, returns true if the rule did not fail validation) + */ + protected boolean rule(List errors, IssueType type, int line, int col, String path, boolean thePass, String theMessage, Object... theMessageArguments) { + if (!thePass) { + String message = formatMessage(theMessage, theMessageArguments); + addValidationMessage(errors, type, line, col, path, message, IssueSeverity.ERROR); + } + return thePass; + } + + protected boolean txRule(List errors, String txLink, IssueType type, int line, int col, String path, boolean thePass, String theMessage, Object... theMessageArguments) { + if (!thePass) { + String message = formatMessage(theMessage, theMessageArguments); + errors.add(new ValidationMessage(Source.TerminologyEngine, type, line, col, path, message, IssueSeverity.ERROR).setTxLink(txLink)); + } + return thePass; + } + + /** + * Test a rule and add a {@link IssueSeverity#ERROR} validation message if the validation fails + * + * @param thePass + * Set this parameter to false if the validation does not pass + * @return Returns thePass (in other words, returns true if the rule did not fail validation) + */ + protected boolean rule(List errors, IssueType type, List pathParts, boolean thePass, String msg) { + if (!thePass) { + String path = toPath(pathParts); + addValidationMessage(errors, type, -1, -1, path, msg, IssueSeverity.ERROR); + } + return thePass; + } + + /** + * Test a rule and add a {@link IssueSeverity#ERROR} validation message if the validation fails + * + * @param thePass + * Set this parameter to false if the validation does not pass + * @return Returns thePass (in other words, returns true if the rule did not fail validation) + */ + protected boolean rule(List errors, IssueType type, List pathParts, boolean thePass, String theMessage, Object... theMessageArguments) { + if (!thePass) { + String path = toPath(pathParts); + String message = formatMessage(theMessage, theMessageArguments); + addValidationMessage(errors, type, -1, -1, path, message, IssueSeverity.ERROR); + } + return thePass; + } + + /** + * Test a rule and add a {@link IssueSeverity#ERROR} validation message if the validation fails + * + * @param thePass + * Set this parameter to false if the validation does not pass + * @return Returns thePass (in other words, returns true if the rule did not fail validation) + */ + protected boolean rule(List errors, IssueType type, String path, boolean thePass, String msg) { + if (!thePass) { + addValidationMessage(errors, type, -1, -1, path, msg, IssueSeverity.ERROR); + } + return thePass; + } + + public boolean rule(List errors, Source source, IssueType type, String path, boolean thePass, String msg) { + if (!thePass) { + addValidationMessage(errors, type, -1, -1, path, msg, IssueSeverity.ERROR, source); + } + return thePass; + } + + /** + * Test a rule and add a {@link IssueSeverity#ERROR} validation message if the validation fails + * + * @param thePass + * Set this parameter to false if the validation does not pass + * @return Returns thePass (in other words, returns true if the rule did not fail validation) + */ + protected boolean rule(List errors, IssueType type, String path, boolean thePass, String msg, String html) { + if (!thePass) { + addValidationMessage(errors, type, path, msg, html, IssueSeverity.ERROR); + } + return thePass; + } + + protected String splitByCamelCase(String s) { + StringBuilder b = new StringBuilder(); + for (int i = 0; i < s.length(); i++) { + char c = s.charAt(i); + if (Character.isUpperCase(c) && !(i == 0 || Character.isUpperCase(s.charAt(i-1)))) + b.append(' '); + b.append(c); + } + return b.toString(); + } + + protected String stripPunctuation(String s, boolean numbers) { + StringBuilder b = new StringBuilder(); + for (char c : s.toCharArray()) { + int t = Character.getType(c); + if (t == Character.UPPERCASE_LETTER || t == Character.LOWERCASE_LETTER || t == Character.TITLECASE_LETTER || t == Character.MODIFIER_LETTER || t == Character.OTHER_LETTER || (t == Character.DECIMAL_DIGIT_NUMBER && numbers) || (t == Character.LETTER_NUMBER && numbers) || c == ' ') + b.append(c); + } + return b.toString(); + } + + private String toPath(List pathParts) { + if (pathParts == null || pathParts.isEmpty()) { + return ""; + } + return "//" + StringUtils.join(pathParts, '/'); + } + + /** + * Test a rule and add a {@link IssueSeverity#WARNING} validation message if the validation fails + * + * @param thePass + * Set this parameter to false if the validation does not pass + * @return Returns thePass (in other words, returns true if the rule did not fail validation) + */ + protected boolean warning(List errors, IssueType type, int line, int col, String path, boolean thePass, String msg, Object... theMessageArguments) { + if (!thePass) { + msg = formatMessage(msg, theMessageArguments); + IssueSeverity severity = IssueSeverity.WARNING; + addValidationMessage(errors, type, line, col, path, msg, severity); + } + return thePass; + + } + + protected void addValidationMessage(List errors, IssueType type, int line, int col, String path, String msg, IssueSeverity theSeverity) { + Source source = this.source; + addValidationMessage(errors, type, line, col, path, msg, theSeverity, source); + } + + protected ValidationMessage addValidationMessage(List errors, IssueType type, int line, int col, String path, String msg, IssueSeverity theSeverity, Source theSource) { + ValidationMessage validationMessage = new ValidationMessage(theSource, type, line, col, path, msg, theSeverity); + errors.add(validationMessage); + return validationMessage; + } + + /** + * Test a rule and add a {@link IssueSeverity#WARNING} validation message if the validation fails + * + * @param thePass + * Set this parameter to false if the validation does not pass + * @return Returns thePass (in other words, returns true if the rule did not fail validation) + */ + protected boolean txWarning(List errors, String txLink, IssueType type, int line, int col, String path, boolean thePass, String msg, Object... theMessageArguments) { + if (!thePass) { + msg = formatMessage(msg, theMessageArguments); + errors.add(new ValidationMessage(Source.TerminologyEngine, type, line, col, path, msg, IssueSeverity.WARNING).setTxLink(txLink)); + } + return thePass; + + } + + protected boolean warningOrError(boolean isError, List errors, IssueType type, int line, int col, String path, boolean thePass, String msg, Object... theMessageArguments) { + if (!thePass) { + msg = formatMessage(msg, theMessageArguments); + addValidationMessage(errors, type, line, col, path, msg, isError ? IssueSeverity.ERROR : IssueSeverity.WARNING); + } + return thePass; + + } + + /** + * Test a rule and add a {@link IssueSeverity#WARNING} validation message if the validation fails + * + * @param thePass + * Set this parameter to false if the validation does not pass + * @return Returns thePass (in other words, returns true if the rule did not fail validation) + */ + protected boolean warning(List errors, IssueType type, List pathParts, boolean thePass, String theMessage, Object... theMessageArguments) { + if (!thePass) { + String path = toPath(pathParts); + String message = formatMessage(theMessage, theMessageArguments); + addValidationMessage(errors, type, -1, -1, path, message, IssueSeverity.WARNING); + } + return thePass; + } + + /** + * Test a rule and add a {@link IssueSeverity#WARNING} validation message if the validation fails + * + * @param thePass + * Set this parameter to false if the validation does not pass + * @return Returns thePass (in other words, returns true if the rule did not fail validation) + */ + protected boolean warning(List errors, IssueType type, String path, boolean thePass, String msg) { + if (!thePass) { + addValidationMessage(errors, type, -1, -1, path, msg, IssueSeverity.WARNING); + } + return thePass; + } + + /** + * Test a rule and add a {@link IssueSeverity#WARNING} validation message if the validation fails + * + * @param thePass + * Set this parameter to false if the validation does not pass + * @return Returns thePass (in other words, returns true if the rule did not fail validation) + */ + protected boolean warning(List errors, IssueType type, String path, boolean thePass, String msg, String html) { + if (!thePass) { + addValidationMessage(errors, type, path, msg, html, IssueSeverity.WARNING); + } + return thePass; + } + + /** + * Test a rule and add a {@link IssueSeverity#WARNING} validation message if the validation fails + * + * @param thePass + * Set this parameter to false if the validation does not pass + * @return Returns thePass (in other words, returns true if the rule did not fail validation) + */ + protected boolean warning(List errors, IssueType type, String path, boolean thePass, String msg, String html, Object... theMessageArguments) { + if (!thePass) { + msg = formatMessage(msg, theMessageArguments); + addValidationMessage(errors, type, path, msg, html, IssueSeverity.WARNING); + } + return thePass; + } + + //--------- + /** + * Test a rule and add a {@link IssueSeverity#WARNING} validation message if the validation fails + * + * @param thePass + * Set this parameter to false if the validation does not pass + * @return Returns thePass (in other words, returns true if the rule did not fail validation) + */ + protected boolean suppressedwarning(List errors, IssueType type, int line, int col, String path, boolean thePass, String msg, Object... theMessageArguments) { + if (!thePass) { + msg = formatMessage(msg, theMessageArguments); + addValidationMessage(errors, type, line, col, path, msg, IssueSeverity.INFORMATION); + } + return thePass; + + } + + /** + * Test a rule and add a {@link IssueSeverity#WARNING} validation message if the validation fails + * + * @param thePass + * Set this parameter to false if the validation does not pass + * @return Returns thePass (in other words, returns true if the rule did not fail validation) + */ + protected boolean suppressedwarning(List errors, IssueType type, List pathParts, boolean thePass, String theMessage, Object... theMessageArguments) { + if (!thePass) { + String path = toPath(pathParts); + String message = formatMessage(theMessage, theMessageArguments); + addValidationMessage(errors, type, -1, -1, path, message, IssueSeverity.INFORMATION); + } + return thePass; + } + + /** + * Test a rule and add a {@link IssueSeverity#WARNING} validation message if the validation fails + * + * @param thePass + * Set this parameter to false if the validation does not pass + * @return Returns thePass (in other words, returns true if the rule did not fail validation) + */ + protected boolean suppressedwarning(List errors, IssueType type, String path, boolean thePass, String msg) { + if (!thePass) { + addValidationMessage(errors, type, -1, -1, path, msg, IssueSeverity.INFORMATION); + } + return thePass; + } + + /** + * Test a rule and add a {@link IssueSeverity#WARNING} validation message if the validation fails + * + * @param thePass + * Set this parameter to false if the validation does not pass + * @return Returns thePass (in other words, returns true if the rule did not fail validation) + */ + protected boolean suppressedwarning(List errors, IssueType type, String path, boolean thePass, String msg, String html) { + if (!thePass) { + IssueSeverity severity = IssueSeverity.INFORMATION; + addValidationMessage(errors, type, path, msg, html, severity); + } + return thePass; + } + + protected void addValidationMessage(List errors, IssueType type, String path, String msg, String html, IssueSeverity theSeverity) { + errors.add(new ValidationMessage(source, type, -1, -1, path, msg, html, theSeverity)); + } + + /** + * Test a rule and add a {@link IssueSeverity#WARNING} validation message if the validation fails + * + * @param thePass + * Set this parameter to false if the validation does not pass + * @return Returns thePass (in other words, returns true if the rule did not fail validation) + */ + protected boolean suppressedwarning(List errors, IssueType type, String path, boolean thePass, String msg, String html, Object... theMessageArguments) { + if (!thePass) { + msg = formatMessage(msg, theMessageArguments); + addValidationMessage(errors, type, path, msg, html, IssueSeverity.INFORMATION); + } + return thePass; + } + +} diff --git a/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/r5/validation/CodeSystemValidator.java b/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/r5/validation/CodeSystemValidator.java new file mode 100644 index 000000000..ec422232a --- /dev/null +++ b/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/r5/validation/CodeSystemValidator.java @@ -0,0 +1,59 @@ +package org.hl7.fhir.r5.validation; + +/*- + * #%L + * org.hl7.fhir.validation + * %% + * Copyright (C) 2014 - 2019 Health Level 7 + * %% + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * #L% + */ + + +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +import org.hl7.fhir.r5.model.CodeSystem; +import org.hl7.fhir.r5.model.CodeSystem.ConceptDefinitionComponent; +import org.hl7.fhir.utilities.validation.ValidationMessage; +import org.hl7.fhir.utilities.validation.ValidationMessage.IssueType; + +public class CodeSystemValidator extends BaseValidator { + + public List validate(CodeSystem cs, boolean forBuild) { + List errors = new ArrayList(); + + // this is an invariant on CodeSystem, but the invariant is wrong in R3, and doesn't work + checkCodesUnique(cs, errors); + return errors; + } + + private void checkCodesUnique(CodeSystem cs, List errors) { + Set codes = new HashSet(); + checkCodes(codes, cs.getConcept(), "CodeSystem["+cs.getId()+"]", errors); + } + + private void checkCodes(Set codes, List list, String path, List errors) { + for (ConceptDefinitionComponent cc : list) { + String npath = path+".concept["+cc.getCode()+"]"; + rule(errors, IssueType.BUSINESSRULE, npath, !codes.contains(cc.getCode()), "Duplicate Code "+cc.getCode()); + codes.add(cc.getCode()); + checkCodes(codes, cc.getConcept(), npath, errors); + } + } + + +} diff --git a/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/r5/validation/DefaultEnableWhenEvaluator.java b/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/r5/validation/DefaultEnableWhenEvaluator.java new file mode 100644 index 000000000..4acca3540 --- /dev/null +++ b/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/r5/validation/DefaultEnableWhenEvaluator.java @@ -0,0 +1,216 @@ +package org.hl7.fhir.r5.validation; + +import java.util.*; +import java.util.stream.*; + +import org.hl7.fhir.exceptions.FHIRException; +import org.hl7.fhir.r5.elementmodel.Element; +import org.hl7.fhir.r5.model.*; +import org.hl7.fhir.r5.model.Questionnaire.*; + +import ca.uhn.fhir.rest.server.exceptions.UnprocessableEntityException; + +/** + * Evaluates Questionnaire.item.enableWhen against a QuestionnaireResponse. + * Ignores possible modifierExtensions and extensions. + * + */ +public class DefaultEnableWhenEvaluator implements IEnableWhenEvaluator { + public static final String LINKID_ELEMENT = "linkId"; + public static final String ITEM_ELEMENT = "item"; + public static final String ANSWER_ELEMENT = "answer"; + + @Override + public boolean isQuestionEnabled(QuestionnaireItemComponent questionnaireItem, Element questionnaireResponse) { + if (!questionnaireItem.hasEnableWhen()) { + return true; + } + List evaluationResults = questionnaireItem.getEnableWhen() + .stream() + .map(enableCondition -> evaluateCondition(enableCondition, questionnaireResponse, + questionnaireItem.getLinkId())) + .collect(Collectors.toList()); + return checkConditionResults(evaluationResults, questionnaireItem); + } + + + public boolean checkConditionResults(List evaluationResults, + QuestionnaireItemComponent questionnaireItem) { + if (questionnaireItem.hasEnableBehavior() && questionnaireItem.getEnableBehavior() == EnableWhenBehavior.ANY){ + return evaluationResults.stream().anyMatch(EnableWhenResult::isEnabled); + } if (questionnaireItem.hasEnableBehavior() && questionnaireItem.getEnableBehavior() == EnableWhenBehavior.ALL){ + return evaluationResults.stream().allMatch(EnableWhenResult::isEnabled); + } + //TODO: Throw exception? enableBehavior is mandatory when there are multiple conditions + return true; + } + + + protected EnableWhenResult evaluateCondition(QuestionnaireItemEnableWhenComponent enableCondition, + Element questionnaireResponse, String linkId) { + //TODO: Fix EnableWhenResult stuff + List answerItems = findQuestionAnswers(questionnaireResponse, + enableCondition.getQuestion()); + QuestionnaireItemOperator operator = enableCondition.getOperator(); + if (operator == QuestionnaireItemOperator.EXISTS){ + Type answer = enableCondition.getAnswer(); + if (!(answer instanceof BooleanType)){ + throw new UnprocessableEntityException("Exists-operator requires answerBoolean"); + } + return new EnableWhenResult(((BooleanType)answer).booleanValue() != answerItems.isEmpty(), + linkId, enableCondition, questionnaireResponse); + } + boolean result = answerItems + .stream() + .anyMatch(answer -> evaluateAnswer(answer, enableCondition.getAnswer(), enableCondition.getOperator())); + return new EnableWhenResult(result, linkId, enableCondition, questionnaireResponse); + } + + public Type convertToType(Element element) throws FHIRException { + Type b = new Factory().create(element.fhirType()); + if (b instanceof PrimitiveType) { + ((PrimitiveType) b).setValueAsString(element.primitiveValue()); + } else { + for (Element child : element.getChildren()) { + if (!isExtension(child)) { + b.setProperty(child.getName(), convertToType(child)); + } + } + } + return b; + } + + + private boolean isExtension(Element element) { + return "Extension".equals(element.fhirType()); + } + + protected boolean evaluateAnswer(Element answer, Type expectedAnswer, QuestionnaireItemOperator questionnaireItemOperator) { + Type actualAnswer; + if (isExtension(answer)) { + return false; + } + try { + actualAnswer = convertToType(answer); + } catch (FHIRException e) { + throw new UnprocessableEntityException("Unexpected answer type", e); + } + if (!actualAnswer.getClass().equals(expectedAnswer.getClass())) { + throw new UnprocessableEntityException("Expected answer and actual answer have incompatible types"); + } + if (expectedAnswer instanceof Coding) { + return compareCodingAnswer((Coding)expectedAnswer, (Coding)actualAnswer, questionnaireItemOperator); + } else if ((expectedAnswer instanceof PrimitiveType)) { + return comparePrimitiveAnswer((PrimitiveType)actualAnswer, (PrimitiveType)expectedAnswer, questionnaireItemOperator); + } else if (expectedAnswer instanceof Quantity) { + return compareQuantityAnswer((Quantity)actualAnswer, (Quantity)expectedAnswer, questionnaireItemOperator); + } + // TODO: Attachment, reference? + throw new UnprocessableEntityException("Unimplemented answer type: " + expectedAnswer.getClass()); + } + + + private boolean compareQuantityAnswer(Quantity actualAnswer, Quantity expectedAnswer, QuestionnaireItemOperator questionnaireItemOperator) { + return compareComparable(actualAnswer.getValue(), expectedAnswer.getValue(), questionnaireItemOperator); + } + + + private boolean comparePrimitiveAnswer(PrimitiveType actualAnswer, PrimitiveType expectedAnswer, QuestionnaireItemOperator questionnaireItemOperator) { + if (actualAnswer.getValue() instanceof Comparable){ + return compareComparable((Comparable)actualAnswer.getValue(), (Comparable) expectedAnswer.getValue(), questionnaireItemOperator); + } else if (questionnaireItemOperator == QuestionnaireItemOperator.EQUAL){ + return actualAnswer.equalsShallow(expectedAnswer); + } else if (questionnaireItemOperator == QuestionnaireItemOperator.NOT_EQUAL){ + return !actualAnswer.equalsShallow(expectedAnswer); + } + throw new UnprocessableEntityException("Bad operator for PrimitiveType comparison"); + } + + @SuppressWarnings({ "rawtypes", "unchecked" }) + private boolean compareComparable(Comparable actual, Comparable expected, + QuestionnaireItemOperator questionnaireItemOperator) { + int result = actual.compareTo(expected); + + if (questionnaireItemOperator == QuestionnaireItemOperator.EQUAL){ + return result == 0; + } else if (questionnaireItemOperator == QuestionnaireItemOperator.NOT_EQUAL){ + return result != 0; + } else if (questionnaireItemOperator == QuestionnaireItemOperator.GREATER_OR_EQUAL){ + return result >= 0; + } else if (questionnaireItemOperator == QuestionnaireItemOperator.LESS_OR_EQUAL){ + return result <= 0; + } else if (questionnaireItemOperator == QuestionnaireItemOperator.LESS_THAN){ + return result < 0; + } else if (questionnaireItemOperator == QuestionnaireItemOperator.GREATER_THAN){ + return result > 0; + } + + throw new UnprocessableEntityException("Bad operator for PrimitiveType comparison"); + + } + + private List findQuestionAnswers(Element questionnaireResponse, String question) { + List matchingItems = questionnaireResponse.getChildren(ITEM_ELEMENT) + .stream() + .flatMap(i -> findSubItems(i).stream()) + .filter(i -> hasLinkId(i, question)) + .collect(Collectors.toList()); + return matchingItems + .stream() + .flatMap(e -> extractAnswer(e).stream()) + .collect(Collectors.toList()); + } + + private List extractAnswer(Element item) { + return item.getChildrenByName(ANSWER_ELEMENT) + .stream() + .flatMap(c -> c.getChildren().stream()) + .collect(Collectors.toList()); + } + + private boolean compareCodingAnswer(Coding expectedAnswer, Coding actualAnswer, QuestionnaireItemOperator questionnaireItemOperator) { + boolean result = compareSystems(expectedAnswer, actualAnswer) && compareCodes(expectedAnswer, actualAnswer); + if (questionnaireItemOperator == QuestionnaireItemOperator.EQUAL){ + return result == true; + } else if (questionnaireItemOperator == QuestionnaireItemOperator.NOT_EQUAL){ + return result == false; + } + throw new UnprocessableEntityException("Bad operator for Coding comparison"); + } + + private boolean compareCodes(Coding expectedCoding, Coding value) { + if (expectedCoding.hasCode() != value.hasCode()) { + return false; + } + if (expectedCoding.hasCode()) { + return expectedCoding.getCode().equals(value.getCode()); + } + return true; + } + + private boolean compareSystems(Coding expectedCoding, Coding value) { + if (expectedCoding.hasSystem() && !value.hasSystem()) { + return false; + } + if (expectedCoding.hasSystem()) { + return expectedCoding.getSystem().equals(value.getSystem()); + } + return true; + } + private List findSubItems(Element item) { + List results = item.getChildren(LINKID_ELEMENT) + .stream() + .flatMap(i -> findSubItems(i).stream()) + .collect(Collectors.toList()); + results.add(item); + return results; + } + + private boolean hasLinkId(Element item, String linkId) { + Element linkIdChild = item.getNamedChild(LINKID_ELEMENT); + if (linkIdChild != null && linkIdChild.getValue().equals(linkId)){ + return true; + } + return false; + } +} diff --git a/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/r5/validation/EnableWhenResult.java b/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/r5/validation/EnableWhenResult.java new file mode 100644 index 000000000..2b7b9fe91 --- /dev/null +++ b/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/r5/validation/EnableWhenResult.java @@ -0,0 +1,48 @@ +package org.hl7.fhir.r5.validation; + + +import org.hl7.fhir.r5.elementmodel.Element; +import org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemEnableWhenComponent; + +public class EnableWhenResult { + private final boolean enabled; + private final QuestionnaireItemEnableWhenComponent enableWhenCondition; + private final Element answerItem; + private final String linkId; + + /** + * Evaluation result of enableWhen condition + * + * @param enabled + * Evaluation result + * @param linkId + * LinkId of the questionnaire item + * @param enableWhenCondition + * Evaluated enableWhen condition + * @param responseItem + * item in QuestionnaireResponse + */ + public EnableWhenResult(boolean enabled, String linkId, QuestionnaireItemEnableWhenComponent enableWhenCondition, + Element answerItem) { + this.enabled = enabled; + this.linkId = linkId; + this.answerItem = answerItem; + this.enableWhenCondition = enableWhenCondition; + } + + public boolean isEnabled() { + return enabled; + } + + public String getLinkId() { + return linkId; + } + + public Element getAnswerItem() { + return answerItem; + } + + public QuestionnaireItemEnableWhenComponent getEnableWhenCondition() { + return enableWhenCondition; + } +} diff --git a/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/r5/validation/IEnableWhenEvaluator.java b/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/r5/validation/IEnableWhenEvaluator.java new file mode 100644 index 000000000..89b5b22d8 --- /dev/null +++ b/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/r5/validation/IEnableWhenEvaluator.java @@ -0,0 +1,10 @@ +package org.hl7.fhir.r5.validation; + +import org.hl7.fhir.r5.elementmodel.Element; +import org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemComponent; + +public interface IEnableWhenEvaluator { + public boolean isQuestionEnabled(QuestionnaireItemComponent questionnaireItem, + Element questionnaireResponse); + +} diff --git a/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/r5/validation/InstanceValidator.java b/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/r5/validation/InstanceValidator.java new file mode 100644 index 000000000..b98857e2f --- /dev/null +++ b/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/r5/validation/InstanceValidator.java @@ -0,0 +1,4404 @@ +package org.hl7.fhir.r5.validation; + +/*- + * #%L + * org.hl7.fhir.validation + * %% + * Copyright (C) 2014 - 2019 Health Level 7 + * %% + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * #L% + */ + +import static org.apache.commons.lang3.StringUtils.isBlank; +import static org.apache.commons.lang3.StringUtils.isNotBlank; + +import java.io.IOException; +import java.io.InputStream; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.UUID; + +import org.apache.commons.lang3.NotImplementedException; +import org.apache.commons.lang3.StringUtils; +import org.hl7.fhir.r5.model.Reference; +import org.hl7.fhir.exceptions.*; +import org.hl7.fhir.convertors.VersionConvertorConstants; +import org.hl7.fhir.exceptions.DefinitionException; +import org.hl7.fhir.exceptions.FHIRException; +import org.hl7.fhir.exceptions.PathEngineException; +import org.hl7.fhir.exceptions.TerminologyServiceException; +import org.hl7.fhir.r5.conformance.ProfileUtilities; +import org.hl7.fhir.r5.context.IWorkerContext; +import org.hl7.fhir.r5.context.IWorkerContext.ValidationResult; +import org.hl7.fhir.r5.elementmodel.Element; +import org.hl7.fhir.r5.elementmodel.Element.SpecialElement; +import org.hl7.fhir.r5.elementmodel.JsonParser; +import org.hl7.fhir.r5.elementmodel.Manager; +import org.hl7.fhir.r5.elementmodel.Manager.FhirFormat; +import org.hl7.fhir.r5.elementmodel.ObjectConverter; +import org.hl7.fhir.r5.elementmodel.ParserBase; +import org.hl7.fhir.r5.elementmodel.ParserBase.ValidationPolicy; +import org.hl7.fhir.r5.elementmodel.XmlParser; +import org.hl7.fhir.r5.formats.FormatUtilities; +import org.hl7.fhir.r5.model.Address; +import org.hl7.fhir.r5.model.Attachment; +import org.hl7.fhir.r5.model.Base; +import org.hl7.fhir.r5.model.BooleanType; +import org.hl7.fhir.r5.model.CanonicalType; +import org.hl7.fhir.r5.model.CodeSystem; +import org.hl7.fhir.r5.model.CodeSystem.ConceptDefinitionComponent; +import org.hl7.fhir.r5.model.CodeableConcept; +import org.hl7.fhir.r5.model.Coding; +import org.hl7.fhir.r5.model.Constants; +import org.hl7.fhir.r5.model.ContactPoint; +import org.hl7.fhir.r5.model.DateTimeType; +import org.hl7.fhir.r5.model.DateType; +import org.hl7.fhir.r5.model.DecimalType; +import org.hl7.fhir.r5.model.DomainResource; +import org.hl7.fhir.r5.model.ElementDefinition; +import org.hl7.fhir.r5.model.ElementDefinition.AggregationMode; +import org.hl7.fhir.r5.model.ElementDefinition.ConstraintSeverity; +import org.hl7.fhir.r5.model.ElementDefinition.DiscriminatorType; +import org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionBindingComponent; +import org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionConstraintComponent; +import org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent; +import org.hl7.fhir.r5.model.ElementDefinition.PropertyRepresentation; +import org.hl7.fhir.r5.model.ElementDefinition.TypeRefComponent; +import org.hl7.fhir.r5.model.Enumeration; +import org.hl7.fhir.r5.model.Enumerations.BindingStrength; +import org.hl7.fhir.r5.model.ExpressionNode; +import org.hl7.fhir.r5.model.Extension; +import org.hl7.fhir.r5.model.HumanName; +import org.hl7.fhir.r5.model.Identifier; +import org.hl7.fhir.r5.model.ImplementationGuide; +import org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideGlobalComponent; +import org.hl7.fhir.r5.model.InstantType; +import org.hl7.fhir.r5.model.IntegerType; +import org.hl7.fhir.r5.model.Period; +import org.hl7.fhir.r5.model.Quantity; +import org.hl7.fhir.r5.model.Questionnaire; +import org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemAnswerOptionComponent; +import org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemComponent; +import org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType; +import org.hl7.fhir.r5.model.Range; +import org.hl7.fhir.r5.model.Ratio; +import org.hl7.fhir.r5.model.Reference; +import org.hl7.fhir.r5.model.Resource; +import org.hl7.fhir.r5.model.SampledData; +import org.hl7.fhir.r5.model.StringType; +import org.hl7.fhir.r5.model.StructureDefinition; +import org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionKind; +import org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionSnapshotComponent; +import org.hl7.fhir.r5.model.StructureDefinition.TypeDerivationRule; +import org.hl7.fhir.r5.model.TimeType; +import org.hl7.fhir.r5.model.Timing; +import org.hl7.fhir.r5.model.Type; +import org.hl7.fhir.r5.model.TypeDetails; +import org.hl7.fhir.r5.model.UriType; +import org.hl7.fhir.r5.model.ValueSet; +import org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionContainsComponent; +import org.hl7.fhir.r5.utils.FHIRLexer.FHIRLexerException; +import org.hl7.fhir.r5.utils.FHIRPathEngine; +import org.hl7.fhir.r5.utils.FHIRPathEngine.IEvaluationContext; +import org.hl7.fhir.r5.utils.IResourceValidator; +import org.hl7.fhir.r5.utils.ToolingExtensions; +import org.hl7.fhir.r5.utils.ValidationProfileSet; +import org.hl7.fhir.r5.utils.ValidationProfileSet.ProfileRegistration; +import org.hl7.fhir.utilities.CommaSeparatedStringBuilder; +import org.hl7.fhir.utilities.Utilities; +import org.hl7.fhir.utilities.validation.ValidationMessage; +import org.hl7.fhir.utilities.validation.ValidationMessage.IssueSeverity; +import org.hl7.fhir.utilities.validation.ValidationMessage.IssueType; +import org.hl7.fhir.utilities.validation.ValidationMessage.Source; +import org.hl7.fhir.utilities.xhtml.NodeType; +import org.hl7.fhir.utilities.xhtml.XhtmlNode; +import org.w3c.dom.Document; + +import com.google.gson.Gson; +import com.google.gson.JsonObject; + +import ca.uhn.fhir.util.ObjectUtil; + + +/** + * Thinking of using this in a java program? Don't! + * You should use one of the wrappers instead. Either in HAPI, or use ValidationEngine + * + * @author Grahame Grieve + * + */ +/* + * todo: + * check urn's don't start oid: or uuid: + * check MetadataResource.url is absolute + */ + +public class InstanceValidator extends BaseValidator implements IResourceValidator { + + + private class ValidatorHostContext { + private Object appContext; + private Element container; // bundle, or parameters + private Element resource; + public ValidatorHostContext(Object appContext) { + this.appContext = appContext; + } + public ValidatorHostContext(Object appContext, Element element) { + this.appContext = appContext; + this.resource = element; + } + + public ValidatorHostContext forContained(Element element) { + ValidatorHostContext res = new ValidatorHostContext(appContext); + res.resource = element; + return res; + } + } + + private class ValidatorHostServices implements IEvaluationContext { + + @Override + public Base resolveConstant(Object appContext, String name, boolean beforeContext) throws PathEngineException { + ValidatorHostContext c = (ValidatorHostContext) appContext; + if (externalHostServices != null) + return externalHostServices.resolveConstant(c.appContext, name, beforeContext); + else + return null; + } + + @Override + public TypeDetails resolveConstantType(Object appContext, String name) throws PathEngineException { + ValidatorHostContext c = (ValidatorHostContext) appContext; + if (externalHostServices != null) + return externalHostServices.resolveConstantType(c.appContext, name); + else + return null; + } + + @Override + public boolean log(String argument, List focus) { + if (externalHostServices != null) + return externalHostServices.log(argument, focus); + else + return false; + } + + @Override + public FunctionDetails resolveFunction(String functionName) { + throw new Error("Not done yet (ValidatorHostServices.resolveFunction): "+functionName); + } + + @Override + public TypeDetails checkFunction(Object appContext, String functionName, List parameters) throws PathEngineException { + throw new Error("Not done yet (ValidatorHostServices.checkFunction)"); + } + + @Override + public List executeFunction(Object appContext, String functionName, List> parameters) { + throw new Error("Not done yet (ValidatorHostServices.executeFunction)"); + } + + @Override + public Base resolveReference(Object appContext, String url) throws FHIRException { + ValidatorHostContext c = (ValidatorHostContext) appContext; + if (c.container != null) + throw new Error("Not done yet - resolve "+url+" locally (1)"); + else if (externalHostServices == null) + throw new Error("Not done yet - resolve "+url+" locally (2)"); + else + return externalHostServices.resolveReference(c.appContext, url); + + } + + @Override + public boolean conformsToProfile(Object appContext, Base item, String url) throws FHIRException { + IResourceValidator val = new InstanceValidator(context, this); + List valerrors = new ArrayList(); + if (item instanceof Resource) { + val.validate(appContext, valerrors, (Resource) item, url); + } else if (item instanceof Element) { + val.validate(appContext, valerrors, (Element) item, url); + } else + throw new NotImplementedException("Not done yet (ValidatorHostServices.conformsToProfile), when item is element"); + boolean ok = true; + for (ValidationMessage v : valerrors) + ok = ok && v.getLevel().isError(); + return ok; + } + + } + + private IWorkerContext context; + private FHIRPathEngine fpe; + + // configuration items + private CheckDisplayOption checkDisplay; + private boolean anyExtensionsAllowed; + private boolean errorForUnknownProfiles; + private boolean noInvariantChecks; + private boolean noTerminologyChecks; + private boolean hintAboutNonMustSupport; + private BestPracticeWarningLevel bpWarnings; + + private List extensionDomains = new ArrayList(); + + private IdStatus resourceIdRule; + private boolean allowXsiLocation; + + // used during the build process to keep the overall volume of messages down + private boolean suppressLoincSnomedMessages; + + // time tracking + private long overall = 0; + private long txTime = 0; + private long sdTime = 0; + private long loadTime = 0; + private long fpeTime = 0; + + private boolean noBindingMsgSuppressed; + private HashMap resourceProfilesMap; + private IValidatorResourceFetcher fetcher; + long time = 0; + private ValidationProfileSet providedProfiles; + private IEvaluationContext externalHostServices; + private boolean noExtensibleWarnings; + private String serverBase; + + private IEnableWhenEvaluator myEnableWhenEvaluator = new DefaultEnableWhenEvaluator(); + + /* + * Keeps track of whether a particular profile has been checked or not yet + */ + private class ProfileUsage { + private StructureDefinition profile; + private boolean checked; + + public ProfileUsage(StructureDefinition profile) { + this.profile = profile; + this.checked = false; + } + + public boolean isChecked() { + return checked; + } + + public void setChecked() { + this.checked = true; + } + + public StructureDefinition getProfile() { + return profile; + } + } + + /* + * Keeps track of all profiles associated with a resource element and whether the resource has been checked against those profiles yet + */ + public class ResourceProfiles { + private Element resource; + private Element owner; + private NodeStack stack; + private HashMap profiles; + private boolean processed; + + public ResourceProfiles(Element resource, NodeStack stack) { + this.resource = resource; + if (this.resource.getName().equals("contained")) + this.owner = stack.parent.element; + else + this.owner = resource; + this.stack = stack; + this.profiles = new HashMap(); + this.processed = false; + } + + public boolean isProcessed() { + return processed; + } + + public void setProcessed() { + processed = true; + } + + public NodeStack getStack() { + return stack; + } + + public Element getOwner() { + return owner; + } + + public boolean hasProfiles() { + return !profiles.isEmpty(); + } + + public void addProfiles(List errors, ValidationProfileSet profiles, String path, Element element, boolean external) throws FHIRException { + for (ProfileRegistration profile : profiles.getCanonical()) { + StructureDefinition sd = profiles.fetch(profile.getProfile()); + if (sd == null) + sd = context.fetchResource(StructureDefinition.class, profile.getProfile()); + if (sd == null) { + ImplementationGuide ig = context.fetchResource(ImplementationGuide.class, profile.getProfile()); + if (ig != null) { + for (ImplementationGuideGlobalComponent t : ig.getGlobal()) { + if (t.getType().equals(element.fhirType())) { + sd = context.fetchResource(StructureDefinition.class, t.getProfile()); + if (sd != null) + break; + } + } + } + } + if (sd == null) { + errors.add(new ValidationMessage(Source.InstanceValidator, IssueType.UNKNOWN, path, "Unable to locate profile "+profile.getProfile(), external ? IssueSeverity.ERROR : IssueSeverity.WARNING)); + } else if (!sd.getType().equals(element.fhirType())) { + boolean ok = false; + if (element.fhirType().equals("Bundle")) { // special case: if the profile type isn't 'Bundle', then the profile applies to the first resource + List entries = element.getChildren("entry"); + if (entries.size() > 0) { + Element res = entries.get(0).getNamedChild("resource"); + if (res != null) { + ok = true; + // addProfile(errors, profile.getProfile(), profile.isError(), path, res); ggtodo: we need to go add this to a different profile + } + } + } + + if (!ok) + errors.add(new ValidationMessage(Source.InstanceValidator, IssueType.UNKNOWN, path, "Profile mismatch on type for "+profile.getProfile()+": the profile constrains "+sd.getType()+" but the element is "+element.fhirType(), IssueSeverity.ERROR)); + } else + addProfile(errors, profile.getProfile(), profile.isError(), path, element); + } + } + + public boolean addProfile(List errors, String profile, boolean error, String path, Element element) { + String effectiveProfile = profile; + String version = null; + if (profile.contains("|")) { + effectiveProfile = profile.substring(0, profile.indexOf('|')); + version = profile.substring(profile.indexOf('|')+1); + } + StructureDefinition sd = null; + if (providedProfiles != null) + sd = providedProfiles.fetch(effectiveProfile); + if (sd == null) + sd = context.fetchResource(StructureDefinition.class, effectiveProfile); + + if (warningOrError(error, errors, IssueType.INVALID, element.line(), element.col(), path, sd != null, "StructureDefinition reference \"{0}\" could not be resolved", profile)) { + if (rule(errors, IssueType.STRUCTURE, element.line(), element.col(), path, version==null || (sd.getVersion()!=null && sd.getVersion().equals(version)), + "Referenced version " + version + " does not match found version " + sd.getVersion() + " for profile " + sd.getUrl(), profile)) { + if (rule(errors, IssueType.STRUCTURE, element.line(), element.col(), path, sd.hasSnapshot(), + "StructureDefinition has no snapshot - validation is against the snapshot, so it must be provided")) { + if (!profiles.containsKey(sd)) { + profiles.put(sd, new ProfileUsage(sd)); + addAncestorProfiles(sd); + return true; + } + } + } + } + return false; + } + + public void addAncestorProfiles(StructureDefinition sd) { + if (sd.hasDerivation() && sd.getDerivation().equals(StructureDefinition.TypeDerivationRule.CONSTRAINT)) { + StructureDefinition parentSd = context.fetchResource(StructureDefinition.class, sd.getBaseDefinition()); + if (parentSd != null && !profiles.containsKey(parentSd)) { + ProfileUsage pu = new ProfileUsage(parentSd); + pu.setChecked(); // We're going to check the child, so no need to check the parent + profiles.put(parentSd, pu); + } + } + } + + public List uncheckedProfiles() { + List uncheckedProfiles = new ArrayList(); + for (ProfileUsage profileUsage : profiles.values()) { + if (!profileUsage.isChecked()) + uncheckedProfiles.add(profileUsage); + } + return uncheckedProfiles; + } + + public boolean hasUncheckedProfiles() { + return !uncheckedProfiles().isEmpty(); + } + + public void checkProfile(StructureDefinition profile) { + ProfileUsage profileUsage = profiles.get(profile); + if (profileUsage==null) + throw new Error("Can't check profile that hasn't been added: " + profile.getUrl()); + else + profileUsage.setChecked(); + } + } + + public InstanceValidator(IWorkerContext theContext, IEvaluationContext hostServices) { + super(); + this.context = theContext; + this.externalHostServices = hostServices; + fpe = new FHIRPathEngine(context); + fpe.setHostServices(new ValidatorHostServices()); + if (theContext.getVersion().startsWith("3.0") || theContext.getVersion().startsWith("1.0")) + fpe.setLegacyMode(true); + source = Source.InstanceValidator; + } + + @Override + public boolean isNoExtensibleWarnings() { + return noExtensibleWarnings; + } + + @Override + public IResourceValidator setNoExtensibleWarnings(boolean noExtensibleWarnings) { + this.noExtensibleWarnings = noExtensibleWarnings; + return this; + } + + @Override + public boolean isNoInvariantChecks() { + return noInvariantChecks; + } + + @Override + public IResourceValidator setNoInvariantChecks(boolean value) { + this.noInvariantChecks = value; + return this; + } + + public IValidatorResourceFetcher getFetcher() { + return this.fetcher; + } + + public IResourceValidator setFetcher(IValidatorResourceFetcher value) { + this.fetcher = value; + return this; + } + + + public boolean isHintAboutNonMustSupport() { + return hintAboutNonMustSupport; + } + + public void setHintAboutNonMustSupport(boolean hintAboutNonMustSupport) { + this.hintAboutNonMustSupport = hintAboutNonMustSupport; + } + + private boolean allowUnknownExtension(String url) { + if (url.contains("example.org") || url.contains("acme.com") || url.contains("nema.org") || url.startsWith("http://hl7.org/fhir/tools/StructureDefinition/") || url.equals("http://hl7.org/fhir/StructureDefinition/structuredefinition-expression")) + // Added structuredefinition-expression explicitly because it wasn't defined in the version of the spec it needs to be used with + return true; + for (String s : extensionDomains) + if (url.startsWith(s)) + return true; + return anyExtensionsAllowed; + } + + private boolean isKnownExtension(String url) { + // Added structuredefinition-expression and following extensions explicitly because they weren't defined in the version of the spec they need to be used with + if (url.contains("example.org") || url.contains("acme.com") || url.contains("nema.org") || url.startsWith("http://hl7.org/fhir/tools/StructureDefinition/") || url.equals("http://hl7.org/fhir/StructureDefinition/structuredefinition-expression") || url.equals(VersionConvertorConstants.IG_DEPENDSON_PACKAGE_EXTENSION)) + return true; + for (String s : extensionDomains) + if (url.startsWith(s)) + return true; + return false; + } + + private void bpCheck(List errors, IssueType invalid, int line, int col, String literalPath, boolean test, String message) { + if (bpWarnings != null) { + switch (bpWarnings) { + case Error: + rule(errors, invalid, line, col, literalPath, test, message); + break; + case Warning: + warning(errors, invalid, line, col, literalPath, test, message); + break; + case Hint: + hint(errors, invalid, line, col, literalPath, test, message); + break; + default: // do nothing + break; + } + } + } + + @Override + public org.hl7.fhir.r5.elementmodel.Element validate(Object appContext, List errors, InputStream stream, FhirFormat format) throws FHIRException { + return validate(appContext, errors, stream, format, new ValidationProfileSet()); + } + + @Override + public org.hl7.fhir.r5.elementmodel.Element validate(Object appContext, List errors, InputStream stream, FhirFormat format, String profile) throws FHIRException { + return validate(appContext, errors, stream, format, new ValidationProfileSet(profile, true)); + } + + @Override + public org.hl7.fhir.r5.elementmodel.Element validate(Object appContext, List errors, InputStream stream, FhirFormat format, StructureDefinition profile) throws FHIRException { + return validate(appContext, errors, stream, format, new ValidationProfileSet(profile)); + } + + @Override + public org.hl7.fhir.r5.elementmodel.Element validate(Object appContext, List errors, InputStream stream, FhirFormat format, ValidationProfileSet profiles) throws FHIRException { + ParserBase parser = Manager.makeParser(context, format); + if (parser instanceof XmlParser) + ((XmlParser) parser).setAllowXsiLocation(allowXsiLocation); + parser.setupValidation(ValidationPolicy.EVERYTHING, errors); + long t = System.nanoTime(); + Element e; + try { + e = parser.parse(stream); + } catch (IOException e1) { + throw new FHIRException(e1); + } + loadTime = System.nanoTime() - t; + if (e != null) + validate(appContext, errors, e, profiles); + return e; + } + + @Override + public org.hl7.fhir.r5.elementmodel.Element validate(Object appContext, List errors, Resource resource) throws FHIRException { + return validate(appContext, errors, resource, new ValidationProfileSet()); + } + + @Override + public org.hl7.fhir.r5.elementmodel.Element validate(Object appContext, List errors, Resource resource, String profile) throws FHIRException { + return validate(appContext, errors, resource, new ValidationProfileSet(profile, true)); + } + + @Override + public org.hl7.fhir.r5.elementmodel.Element validate(Object appContext, List errors, Resource resource, StructureDefinition profile) throws FHIRException { + return validate(appContext, errors, resource, new ValidationProfileSet(profile)); + } + + @Override + public org.hl7.fhir.r5.elementmodel.Element validate(Object appContext, List errors, Resource resource, ValidationProfileSet profiles) throws FHIRException { + long t = System.nanoTime(); + Element e; + try { + e = new ObjectConverter(context).convert(resource); + } catch (IOException e1) { + throw new FHIRException(e1); + } + loadTime = System.nanoTime() - t; + validate(appContext, errors, e, profiles); + return e; + } + + @Override + public org.hl7.fhir.r5.elementmodel.Element validate(Object appContext, List errors, org.w3c.dom.Element element) throws FHIRException { + return validate(appContext, errors, element, new ValidationProfileSet()); + } + + @Override + public org.hl7.fhir.r5.elementmodel.Element validate(Object appContext, List errors, org.w3c.dom.Element element, String profile) throws FHIRException { + return validate(appContext, errors, element, new ValidationProfileSet(profile, true)); + } + + @Override + public org.hl7.fhir.r5.elementmodel.Element validate(Object appContext, List errors, org.w3c.dom.Element element, StructureDefinition profile) throws FHIRException { + return validate(appContext, errors, element, new ValidationProfileSet(profile)); + } + + @Override + public org.hl7.fhir.r5.elementmodel.Element validate(Object appContext, List errors, org.w3c.dom.Element element, ValidationProfileSet profiles) throws FHIRException { + XmlParser parser = new XmlParser(context); + parser.setupValidation(ValidationPolicy.EVERYTHING, errors); + long t = System.nanoTime(); + Element e; + try { + e = parser.parse(element); + } catch (IOException e1) { + throw new FHIRException(e1); + } + loadTime = System.nanoTime() - t; + if (e != null) + validate(appContext, errors, e, profiles); + return e; + } + + @Override + public org.hl7.fhir.r5.elementmodel.Element validate(Object appContext, List errors, Document document) throws FHIRException { + return validate(appContext, errors, document, new ValidationProfileSet()); + } + + @Override + public org.hl7.fhir.r5.elementmodel.Element validate(Object appContext, List errors, Document document, String profile) throws FHIRException { + return validate(appContext, errors, document, new ValidationProfileSet(profile, true)); + } + + @Override + public org.hl7.fhir.r5.elementmodel.Element validate(Object appContext, List errors, Document document, StructureDefinition profile) throws FHIRException { + return validate(appContext, errors, document, new ValidationProfileSet(profile)); + } + + @Override + public org.hl7.fhir.r5.elementmodel.Element validate(Object appContext, List errors, Document document, ValidationProfileSet profiles) throws FHIRException { + XmlParser parser = new XmlParser(context); + parser.setupValidation(ValidationPolicy.EVERYTHING, errors); + long t = System.nanoTime(); + Element e; + try { + e = parser.parse(document); + } catch (IOException e1) { + throw new FHIRException(e1); + } + loadTime = System.nanoTime() - t; + if (e != null) + validate(appContext, errors, e, profiles); + return e; + } + + @Override + public org.hl7.fhir.r5.elementmodel.Element validate(Object appContext, List errors, JsonObject object) throws FHIRException { + return validate(appContext, errors, object, new ValidationProfileSet()); + } + + @Override + public org.hl7.fhir.r5.elementmodel.Element validate(Object appContext, List errors, JsonObject object, String profile) throws FHIRException { + return validate(appContext, errors, object, new ValidationProfileSet(profile, true)); + } + + @Override + public org.hl7.fhir.r5.elementmodel.Element validate(Object appContext, List errors, JsonObject object, StructureDefinition profile) throws FHIRException { + return validate(appContext, errors, object, new ValidationProfileSet(profile)); + } + + @Override + public org.hl7.fhir.r5.elementmodel.Element validate(Object appContext, List errors, JsonObject object, ValidationProfileSet profiles) throws FHIRException { + JsonParser parser = new JsonParser(context); + parser.setupValidation(ValidationPolicy.EVERYTHING, errors); + long t = System.nanoTime(); + Element e = parser.parse(object); + loadTime = System.nanoTime() - t; + if (e != null) + validate(appContext, errors, e, profiles); + return e; + } + + @Override + public void validate(Object appContext, List errors, Element element) throws FHIRException { + ValidationProfileSet profileSet = new ValidationProfileSet(); + validate(appContext, errors, element, profileSet); + } + + private void validateRemainder(Object appContext, List errors) throws IOException, FHIRException { + boolean processedResource; + do { + processedResource = false; + Set keys = new HashSet(); + keys.addAll(resourceProfilesMap.keySet()); + for (Element resource : keys) { + ResourceProfiles rp = resourceProfilesMap.get(resource); + if (rp.hasUncheckedProfiles()) { + processedResource = true; + start(new ValidatorHostContext(appContext), errors, rp.getOwner(), resource, null, rp.getStack()); + } + } + } while (processedResource); + } + + @Override + public void validate(Object appContext, List errors, Element element, String profile) throws FHIRException { + validate(appContext, errors, element, new ValidationProfileSet(profile, true)); + } + + @Override + public void validate(Object appContext, List errors, Element element, StructureDefinition profile) throws FHIRException { + validate(appContext, errors, element, new ValidationProfileSet(profile)); + } + + @Override + public void validate(Object appContext, List errors, Element element, ValidationProfileSet profiles) throws FHIRException { + // this is the main entry point; all the other entry points end up here coming here... + providedProfiles = profiles; + long t = System.nanoTime(); + boolean isRoot = false; + if (resourceProfilesMap == null) { + resourceProfilesMap = new HashMap(); + isRoot = true; + } + try { + validateResource(new ValidatorHostContext(appContext, element), errors, element, element, null, profiles, resourceIdRule, new NodeStack(element), true); + if (isRoot) { + validateRemainder(appContext, errors); + resourceProfilesMap = null; + if (hintAboutNonMustSupport) + checkElementUsage(errors, element, new NodeStack(element)); + } + } catch (IOException e) { + throw new FHIRException(e); + } + overall = System.nanoTime() - t; + } + + private void checkElementUsage(List errors, Element element, NodeStack stack) { + String elementUsage = element.getUserString("elementSupported"); + hint(errors, IssueType.INFORMATIONAL, element.line(),element.col(), stack.getLiteralPath(), elementUsage==null || elementUsage.equals("Y"), + String.format("The element %s is not marked as 'mustSupport' in the profile %s. Consider not using the element, or marking the element as must-Support in the profile", element.getName(), element.getProperty().getStructure().getUrl())); + + if (element.hasChildren()) { + String prevName = ""; + int elementCount = 0; + for (Element ce : element.getChildren()) { + if (ce.getName().equals(prevName)) + elementCount++; + else { + elementCount=1; + prevName = ce.getName(); + } + checkElementUsage(errors, ce, stack.push(ce, elementCount, null, null)); + } + } + } + + private boolean check(String v1, String v2) { + return v1 == null ? Utilities.noString(v1) : v1.equals(v2); + } + + private void checkAddress(List errors, String path, Element focus, Address fixed) { + checkFixedValue(errors, path + ".use", focus.getNamedChild("use"), fixed.getUseElement(), "use", focus); + checkFixedValue(errors, path + ".text", focus.getNamedChild("text"), fixed.getTextElement(), "text", focus); + checkFixedValue(errors, path + ".city", focus.getNamedChild("city"), fixed.getCityElement(), "city", focus); + checkFixedValue(errors, path + ".state", focus.getNamedChild("state"), fixed.getStateElement(), "state", focus); + checkFixedValue(errors, path + ".country", focus.getNamedChild("country"), fixed.getCountryElement(), "country", focus); + checkFixedValue(errors, path + ".zip", focus.getNamedChild("zip"), fixed.getPostalCodeElement(), "postalCode", focus); + + List lines = new ArrayList(); + focus.getNamedChildren("line", lines); + if (rule(errors, IssueType.VALUE, focus.line(), focus.col(), path, lines.size() == fixed.getLine().size(), + "Expected " + Integer.toString(fixed.getLine().size()) + " but found " + Integer.toString(lines.size()) + " line elements")) { + for (int i = 0; i < lines.size(); i++) + checkFixedValue(errors, path + ".coding", lines.get(i), fixed.getLine().get(i), "coding", focus); + } + } + + private void checkAttachment(List errors, String path, Element focus, Attachment fixed) { + checkFixedValue(errors, path + ".contentType", focus.getNamedChild("contentType"), fixed.getContentTypeElement(), "contentType", focus); + checkFixedValue(errors, path + ".language", focus.getNamedChild("language"), fixed.getLanguageElement(), "language", focus); + checkFixedValue(errors, path + ".data", focus.getNamedChild("data"), fixed.getDataElement(), "data", focus); + checkFixedValue(errors, path + ".url", focus.getNamedChild("url"), fixed.getUrlElement(), "url", focus); + checkFixedValue(errors, path + ".size", focus.getNamedChild("size"), fixed.getSizeElement(), "size", focus); + checkFixedValue(errors, path + ".hash", focus.getNamedChild("hash"), fixed.getHashElement(), "hash", focus); + checkFixedValue(errors, path + ".title", focus.getNamedChild("title"), fixed.getTitleElement(), "title", focus); + } + + // public API + + private boolean checkCode(List errors, Element element, String path, String code, String system, String display) throws TerminologyServiceException { + long t = System.nanoTime(); + boolean ss = context.supportsSystem(system); + txTime = txTime + (System.nanoTime() - t); + if (ss) { + t = System.nanoTime(); + ValidationResult s = context.validateCode(system, code, display); + txTime = txTime + (System.nanoTime() - t); + if (s == null) + return true; + if (s.isOk()) { + if (s.getMessage() != null) + txWarning(errors, s.getTxLink(), IssueType.CODEINVALID, element.line(), element.col(), path, s == null, s.getMessage()); + return true; + } + if (s.getErrorClass().isInfrastructure()) + txWarning(errors, s.getTxLink(), IssueType.CODEINVALID, element.line(), element.col(), path, s == null, s.getMessage()); + else if (s.getSeverity() == IssueSeverity.INFORMATION) + txHint(errors, s.getTxLink(), IssueType.CODEINVALID, element.line(), element.col(), path, s == null, s.getMessage()); + else if (s.getSeverity() == IssueSeverity.WARNING) + txWarning(errors, s.getTxLink(), IssueType.CODEINVALID, element.line(), element.col(), path, s == null, s.getMessage()); + else + return txRule(errors, s.getTxLink(), IssueType.CODEINVALID, element.line(), element.col(), path, s == null, s.getMessage()); + return true; + } else if (system.startsWith("http://hl7.org/fhir")) { + if (Utilities.existsInList(system, "http://hl7.org/fhir/sid/icd-10", "http://hl7.org/fhir/sid/cvx", "http://hl7.org/fhir/sid/icd-10-cm","http://hl7.org/fhir/sid/icd-9","http://hl7.org/fhir/sid/ndc","http://hl7.org/fhir/sid/srt")) + return true; // else don't check these (for now) + else if (system.startsWith("http://hl7.org/fhir/test")) + return true; // we don't validate these + else { + CodeSystem cs = getCodeSystem(system); + if (rule(errors, IssueType.CODEINVALID, element.line(), element.col(), path, cs != null, "Unknown Code System " + system)) { + ConceptDefinitionComponent def = getCodeDefinition(cs, code); + if (warning(errors, IssueType.CODEINVALID, element.line(), element.col(), path, def != null, "Unknown Code (" + system + "#" + code + ")")) + return warning(errors, IssueType.CODEINVALID, element.line(), element.col(), path, display == null || display.equals(def.getDisplay()), "Display should be '" + def.getDisplay() + "'"); + } + return false; + } + } else if (context.isNoTerminologyServer() && Utilities.existsInList(system, "http://loinc.org", "http://unitsofmeasure.org", "http://snomed.info/sct", "http://www.nlm.nih.gov/research/umls/rxnorm")) { + return true; // no checks in this case + } else if (startsWithButIsNot(system, "http://snomed.info/sct", "http://loinc.org", "http://unitsofmeasure.org", "http://www.nlm.nih.gov/research/umls/rxnorm")) { + rule(errors, IssueType.CODEINVALID, element.line(), element.col(), path, false, "Invalid System URI: "+system); + return false; + } else { + try { + if (context.fetchResourceWithException(ValueSet.class, system) != null) { + rule(errors, IssueType.CODEINVALID, element.line(), element.col(), path, false, "Invalid System URI: "+system+" - cannot use a value set URI as a system"); + // Lloyd: This error used to prohibit checking for downstream issues, but there are some cases where that checking needs to occur. Please talk to me before changing the code back. + } + return true; + } + catch (Exception e) { + return true; + } + } + } + + private boolean startsWithButIsNot(String system, String... uri) { + for (String s : uri) + if (!system.equals(s) && system.startsWith(s)) + return true; + return false; + } + + private void checkCodeableConcept(List errors, String path, Element focus, CodeableConcept fixed) { + checkFixedValue(errors, path + ".text", focus.getNamedChild("text"), fixed.getTextElement(), "text", focus); + List codings = new ArrayList(); + focus.getNamedChildren("coding", codings); + if (rule(errors, IssueType.VALUE, focus.line(), focus.col(), path, codings.size() == fixed.getCoding().size(), + "Expected " + Integer.toString(fixed.getCoding().size()) + " but found " + Integer.toString(codings.size()) + " coding elements")) { + for (int i = 0; i < codings.size(); i++) + checkFixedValue(errors, path + ".coding", codings.get(i), fixed.getCoding().get(i), "coding", focus); + } + } + + private void checkCodeableConcept(List errors, String path, Element element, StructureDefinition profile, ElementDefinition theElementCntext) { + if (!noTerminologyChecks && theElementCntext != null && theElementCntext.hasBinding()) { + ElementDefinitionBindingComponent binding = theElementCntext.getBinding(); + if (warning(errors, IssueType.CODEINVALID, element.line(), element.col(), path, binding != null, "Binding for " + path + " missing (cc)")) { + if (binding.hasValueSet()) { + ValueSet valueset = resolveBindingReference(profile, binding.getValueSet(), profile.getUrl()); + if (warning(errors, IssueType.CODEINVALID, element.line(), element.col(), path, valueset != null, "ValueSet " + describeReference(binding.getValueSet()) + " not found")) { + try { + CodeableConcept cc = ObjectConverter.readAsCodeableConcept(element); + if (!cc.hasCoding()) { + if (binding.getStrength() == BindingStrength.REQUIRED) + rule(errors, IssueType.CODEINVALID, element.line(), element.col(), path, false, "No code provided, and a code is required from the value set " + describeReference(binding.getValueSet()) + " (" + valueset.getUrl()); + else if (binding.getStrength() == BindingStrength.EXTENSIBLE) + warning(errors, IssueType.CODEINVALID, element.line(), element.col(), path, false, "No code provided, and a code should be provided from the value set " + describeReference(binding.getValueSet()) + " (" + valueset.getUrl()); + } else { + long t = System.nanoTime(); + + // Check whether the codes are appropriate for the type of binding we have + boolean bindingsOk = true; + if (binding.getStrength() != BindingStrength.EXAMPLE) { + boolean atLeastOneSystemIsSupported = false; + for (Coding nextCoding : cc.getCoding()) { + String nextSystem = nextCoding.getSystem(); + if (isNotBlank(nextSystem) && context.supportsSystem(nextSystem)) { + atLeastOneSystemIsSupported = true; + break; + } + } + + if (!atLeastOneSystemIsSupported && binding.getStrength() == BindingStrength.EXAMPLE) { + // ignore this since we can't validate but it doesn't matter.. + } else { + ValidationResult vr = context.validateCode(cc, valueset); + if (!vr.isOk()) { + bindingsOk = false; + if (vr.getErrorClass() != null && vr.getErrorClass().isInfrastructure()) { + if (binding.getStrength() == BindingStrength.REQUIRED) + txWarning(errors, vr.getTxLink(), IssueType.CODEINVALID, element.line(), element.col(), path, false, "Could not confirm that the codes provided are in the value set " + describeReference(binding.getValueSet()) + " and a code from this value set is required (class = "+vr.getErrorClass().toString()+")"); + else if (binding.getStrength() == BindingStrength.EXTENSIBLE) { + if (binding.hasExtension("http://hl7.org/fhir/StructureDefinition/elementdefinition-maxValueSet")) + checkMaxValueSet(errors, path, element, profile, ToolingExtensions.readStringExtension(binding, "http://hl7.org/fhir/StructureDefinition/elementdefinition-maxValueSet"), cc); + else if (!noExtensibleWarnings) + txWarning(errors, vr.getTxLink(), IssueType.CODEINVALID, element.line(), element.col(), path, false, "Could not confirm that the codes provided are in the value set " + describeReference(binding.getValueSet()) + " and a code should come from this value set unless it has no suitable code (class = "+vr.getErrorClass().toString()+")"); + } else if (binding.getStrength() == BindingStrength.PREFERRED) + txHint(errors, vr.getTxLink(), IssueType.CODEINVALID, element.line(), element.col(), path, false, "Could not confirm that the codes provided are in the value set " + describeReference(binding.getValueSet()) + " and a code is recommended to come from this value set (class = "+vr.getErrorClass().toString()+")"); + } else { + if (binding.getStrength() == BindingStrength.REQUIRED) + txRule(errors, vr.getTxLink(), IssueType.CODEINVALID, element.line(), element.col(), path, false, "None of the codes provided are in the value set " + describeReference(binding.getValueSet()) + " (" + valueset.getUrl()+", and a code from this value set is required) (codes = "+ccSummary(cc)+")"); + else if (binding.getStrength() == BindingStrength.EXTENSIBLE) { + if (binding.hasExtension("http://hl7.org/fhir/StructureDefinition/elementdefinition-maxValueSet")) + checkMaxValueSet(errors, path, element, profile, ToolingExtensions.readStringExtension(binding, "http://hl7.org/fhir/StructureDefinition/elementdefinition-maxValueSet"), cc); + else if (!noExtensibleWarnings) + txWarning(errors, vr.getTxLink(), IssueType.CODEINVALID, element.line(), element.col(), path, false, "None of the codes provided are in the value set " + describeReference(binding.getValueSet()) + " (" + valueset.getUrl() + ", and a code should come from this value set unless it has no suitable code) (codes = "+ccSummary(cc)+")"); + } else if (binding.getStrength() == BindingStrength.PREFERRED) + txHint(errors, vr.getTxLink(), IssueType.CODEINVALID, element.line(), element.col(), path, false, "None of the codes provided are in the value set " + describeReference(binding.getValueSet()) + " (" + valueset.getUrl() + ", and a code is recommended to come from this value set) (codes = "+ccSummary(cc)+")"); + } + } else if (vr.getMessage()!=null) + txWarning(errors, vr.getTxLink(), IssueType.CODEINVALID, element.line(), element.col(), path, false, vr.getMessage()); + } + // Then, for any codes that are in code systems we are able + // to validate, we'll validate that the codes actually exist + if (bindingsOk) { + for (Coding nextCoding : cc.getCoding()) { + String nextCode = nextCoding.getCode(); + String nextSystem = nextCoding.getSystem(); + if (isNotBlank(nextCode) && isNotBlank(nextSystem) && context.supportsSystem(nextSystem)) { + ValidationResult vr = context.validateCode(nextSystem, nextCode, null); + if (!vr.isOk()) { + txWarning(errors, vr.getTxLink(), IssueType.CODEINVALID, element.line(), element.col(), path, false, "Code {0} is not a valid code in code system {1}", nextCode, nextSystem); + } + } + } + } + txTime = txTime + (System.nanoTime() - t); + } + } + } catch (Exception e) { + warning(errors, IssueType.CODEINVALID, element.line(), element.col(), path, false, "Error "+e.getMessage()+" validating CodeableConcept"); + } + } + } else if (binding.hasValueSet()) { + hint(errors, IssueType.CODEINVALID, element.line(), element.col(), path, false, "Binding by URI reference cannot be checked"); + } else if (!noBindingMsgSuppressed) { + hint(errors, IssueType.CODEINVALID, element.line(), element.col(), path, false, "Binding for path " + path + " has no source, so can't be checked"); + } + } + } + } + + private void checkMaxValueSet(List errors, String path, Element element, StructureDefinition profile, String maxVSUrl, CodeableConcept cc) { + // TODO Auto-generated method stub + ValueSet valueset = resolveBindingReference(profile, maxVSUrl, profile.getUrl()); + if (warning(errors, IssueType.CODEINVALID, element.line(), element.col(), path, valueset != null, "ValueSet " + describeReference(maxVSUrl) + " not found")) { + try { + long t = System.nanoTime(); + ValidationResult vr = context.validateCode(cc, valueset); + txTime = txTime + (System.nanoTime() - t); + if (!vr.isOk()) { + if (vr.getErrorClass() != null && vr.getErrorClass().isInfrastructure()) + txWarning(errors, vr.getTxLink(), IssueType.CODEINVALID, element.line(), element.col(), path, false, "None of the codes provided could be validated against the maximum value set " + describeReference(maxVSUrl) + " (" + valueset.getUrl()+"), (error = "+vr.getMessage()+")"); + else + txRule(errors, vr.getTxLink(), IssueType.CODEINVALID, element.line(), element.col(), path, false, "None of the codes provided are in the maximum value set " + describeReference(maxVSUrl) + " (" + valueset.getUrl()+", and a code from this value set is required) (codes = "+ccSummary(cc)+")"); + } + } catch (Exception e) { + warning(errors, IssueType.CODEINVALID, element.line(), element.col(), path, false, "Error "+e.getMessage()+" validating CodeableConcept using maxValueSet"); + } + } + } + + private void checkMaxValueSet(List errors, String path, Element element, StructureDefinition profile, String maxVSUrl, Coding c) { + // TODO Auto-generated method stub + ValueSet valueset = resolveBindingReference(profile, maxVSUrl, profile.getUrl()); + if (warning(errors, IssueType.CODEINVALID, element.line(), element.col(), path, valueset != null, "ValueSet " + describeReference(maxVSUrl) + " not found")) { + try { + long t = System.nanoTime(); + ValidationResult vr = context.validateCode(c, valueset); + txTime = txTime + (System.nanoTime() - t); + if (!vr.isOk()) { + if (vr.getErrorClass() != null && vr.getErrorClass().isInfrastructure()) + txWarning(errors, vr.getTxLink(), IssueType.CODEINVALID, element.line(), element.col(), path, false, "The code provided could not be validated against the maximum value set " + describeReference(maxVSUrl) + " (" + valueset.getUrl()+"), (error = "+vr.getMessage()+")"); + else + txRule(errors, vr.getTxLink(), IssueType.CODEINVALID, element.line(), element.col(), path, false, "The code provided is not in the maximum value set " + describeReference(maxVSUrl) + " (" + valueset.getUrl()+", and a code from this value set is required) (code = "+c.getSystem()+"#"+c.getCode()+")"); + } + } catch (Exception e) { + warning(errors, IssueType.CODEINVALID, element.line(), element.col(), path, false, "Error "+e.getMessage()+" validating CodeableConcept using maxValueSet"); + } + } + } + + private void checkMaxValueSet(List errors, String path, Element element, StructureDefinition profile, String maxVSUrl, String value) { + // TODO Auto-generated method stub + ValueSet valueset = resolveBindingReference(profile, maxVSUrl, profile.getUrl()); + if (warning(errors, IssueType.CODEINVALID, element.line(), element.col(), path, valueset != null, "ValueSet " + describeReference(maxVSUrl) + " not found")) { + try { + long t = System.nanoTime(); + ValidationResult vr = context.validateCode(value, valueset); + txTime = txTime + (System.nanoTime() - t); + if (!vr.isOk()) { + if (vr.getErrorClass() != null && vr.getErrorClass().isInfrastructure()) + txWarning(errors, vr.getTxLink(), IssueType.CODEINVALID, element.line(), element.col(), path, false, "The code provided could not be validated against the maximum value set " + describeReference(maxVSUrl) + " (" + valueset.getUrl()+"), (error = "+vr.getMessage()+")"); + else + txRule(errors, vr.getTxLink(), IssueType.CODEINVALID, element.line(), element.col(), path, false, "The code provided is not in the maximum value set " + describeReference(maxVSUrl) + " (" + valueset.getUrl()+"), and a code from this value set is required) (code = "+value+"), (error = "+vr.getMessage()+")"); + } + } catch (Exception e) { + warning(errors, IssueType.CODEINVALID, element.line(), element.col(), path, false, "Error "+e.getMessage()+" validating CodeableConcept using maxValueSet"); + } + } + } + + private String ccSummary(CodeableConcept cc) { + CommaSeparatedStringBuilder b = new CommaSeparatedStringBuilder(); + for (Coding c : cc.getCoding()) + b.append(c.getSystem()+"#"+c.getCode()); + return b.toString(); + } + + private void checkCoding(List errors, String path, Element focus, Coding fixed) { + checkFixedValue(errors, path + ".system", focus.getNamedChild("system"), fixed.getSystemElement(), "system", focus); + checkFixedValue(errors, path + ".code", focus.getNamedChild("code"), fixed.getCodeElement(), "code", focus); + checkFixedValue(errors, path + ".display", focus.getNamedChild("display"), fixed.getDisplayElement(), "display", focus); + checkFixedValue(errors, path + ".userSelected", focus.getNamedChild("userSelected"), fixed.getUserSelectedElement(), "userSelected", focus); + } + + private void checkCoding(List errors, String path, Element element, StructureDefinition profile, ElementDefinition theElementCntext, boolean inCodeableConcept) { + String code = element.getNamedChildValue("code"); + String system = element.getNamedChildValue("system"); + String display = element.getNamedChildValue("display"); + rule(errors, IssueType.CODEINVALID, element.line(), element.col(), path, isAbsolute(system), "Coding.system must be an absolute reference, not a local reference"); + + if (system != null && code != null && !noTerminologyChecks) { + rule(errors, IssueType.CODEINVALID, element.line(), element.col(), path, !isValueSet(system), "The Coding references a value set, not a code system (\""+system+"\")"); + try { + if (checkCode(errors, element, path, code, system, display)) + if (theElementCntext != null && theElementCntext.hasBinding()) { + ElementDefinitionBindingComponent binding = theElementCntext.getBinding(); + if (warning(errors, IssueType.CODEINVALID, element.line(), element.col(), path, binding != null, "Binding for " + path + " missing")) { + if (binding.hasValueSet()) { + ValueSet valueset = resolveBindingReference(profile, binding.getValueSet(), profile.getUrl()); + if (warning(errors, IssueType.CODEINVALID, element.line(), element.col(), path, valueset != null, "ValueSet " + describeReference(binding.getValueSet()) + " not found")) { + try { + Coding c = ObjectConverter.readAsCoding(element); + long t = System.nanoTime(); + ValidationResult vr = null; + if (binding.getStrength() != BindingStrength.EXAMPLE) { + vr = context.validateCode(c, valueset); + } + txTime = txTime + (System.nanoTime() - t); + if (vr != null && !vr.isOk()) { + if (vr.IsNoService()) + txHint(errors, vr.getTxLink(), IssueType.CODEINVALID, element.line(), element.col(), path, false, "The value provided could not be validated in the absence of a terminology server"); + else if (vr.getErrorClass() != null && !vr.getErrorClass().isInfrastructure()) { + if (binding.getStrength() == BindingStrength.REQUIRED) + txWarning(errors, vr.getTxLink(), IssueType.CODEINVALID, element.line(), element.col(), path, false, "Could not confirm that the codes provided are in the value set " + describeReference(binding.getValueSet()) + " (" + valueset.getUrl()+", and a code from this value set is required)"); + else if (binding.getStrength() == BindingStrength.EXTENSIBLE) { + if (binding.hasExtension("http://hl7.org/fhir/StructureDefinition/elementdefinition-maxValueSet")) + checkMaxValueSet(errors, path, element, profile, ToolingExtensions.readStringExtension(binding, "http://hl7.org/fhir/StructureDefinition/elementdefinition-maxValueSet"), c); + else if (!noExtensibleWarnings) + txWarning(errors, vr.getTxLink(), IssueType.CODEINVALID, element.line(), element.col(), path, false, "Could not confirm that the codes provided are in the value set " + describeReference(binding.getValueSet()) + " (" + valueset.getUrl() + ", and a code should come from this value set unless it has no suitable code)"); + } else if (binding.getStrength() == BindingStrength.PREFERRED) + txHint(errors, vr.getTxLink(), IssueType.CODEINVALID, element.line(), element.col(), path, false, "Could not confirm that the codes provided are in the value set " + describeReference(binding.getValueSet()) + " (" + valueset.getUrl() + ", and a code is recommended to come from this value set)"); + } else if (binding.getStrength() == BindingStrength.REQUIRED) + txRule(errors, vr.getTxLink(), IssueType.CODEINVALID, element.line(), element.col(), path, false, "The Coding provided is not in the value set " + describeReference(binding.getValueSet()) + " (" + valueset.getUrl() + ", and a code is required from this value set)"+(vr.getMessage() != null ? " (error message = "+vr.getMessage()+")" : "")); + else if (binding.getStrength() == BindingStrength.EXTENSIBLE) { + if (binding.hasExtension("http://hl7.org/fhir/StructureDefinition/elementdefinition-maxValueSet")) + checkMaxValueSet(errors, path, element, profile, ToolingExtensions.readStringExtension(binding, "http://hl7.org/fhir/StructureDefinition/elementdefinition-maxValueSet"), c); + else + txWarning(errors, vr.getTxLink(), IssueType.CODEINVALID, element.line(), element.col(), path, false, "The Coding provided is not in the value set " + describeReference(binding.getValueSet()) + " (" + valueset.getUrl() + ", and a code should come from this value set unless it has no suitable code)"+(vr.getMessage() != null ? " (error message = "+vr.getMessage()+")" : "")); + } else if (binding.getStrength() == BindingStrength.PREFERRED) + txHint(errors, vr.getTxLink(), IssueType.CODEINVALID, element.line(), element.col(), path, false, "The Coding provided is not in the value set " + describeReference(binding.getValueSet()) + " (" + valueset.getUrl() + ", and a code is recommended to come from this value set)"+(vr.getMessage() != null ? " (error message = "+vr.getMessage()+")" : "")); + } + } catch (Exception e) { + warning(errors, IssueType.CODEINVALID, element.line(), element.col(), path, false, "Error "+e.getMessage()+" validating Coding"); + } + } + } else if (binding.hasValueSet()) { + hint(errors, IssueType.CODEINVALID, element.line(), element.col(), path, false, "Binding by URI reference cannot be checked"); + } else if (!inCodeableConcept && !noBindingMsgSuppressed) { + hint(errors, IssueType.CODEINVALID, element.line(), element.col(), path, false, "Binding for path " + path + " has no source, so can't be checked"); + } + } + } + } catch (Exception e) { + rule(errors, IssueType.CODEINVALID, element.line(), element.col(), path, false, "Error "+e.getMessage()+" validating Coding"); + } + } + } + + private boolean isValueSet(String url) { + try { + ValueSet vs = context.fetchResourceWithException(ValueSet.class, url); + return vs != null; + } catch (Exception e) { + return false; + } + } + + private void checkContactPoint(List errors, String path, Element focus, ContactPoint fixed) { + checkFixedValue(errors, path + ".system", focus.getNamedChild("system"), fixed.getSystemElement(), "system", focus); + checkFixedValue(errors, path + ".value", focus.getNamedChild("value"), fixed.getValueElement(), "value", focus); + checkFixedValue(errors, path + ".use", focus.getNamedChild("use"), fixed.getUseElement(), "use", focus); + checkFixedValue(errors, path + ".period", focus.getNamedChild("period"), fixed.getPeriod(), "period", focus); + + } + + protected void checkDeclaredProfiles(ResourceProfiles resourceProfiles, List errors, Element resource, Element element, NodeStack stack) throws FHIRException { + Element meta = element.getNamedChild("meta"); + if (meta != null) { + List profiles = new ArrayList(); + meta.getNamedChildren("profile", profiles); + int i = 0; + for (Element profile : profiles) { + String ref = profile.primitiveValue(); + String p = stack.addToLiteralPath("meta", "profile", ":" + Integer.toString(i)); + if (rule(errors, IssueType.INVALID, element.line(), element.col(), p, !Utilities.noString(ref), "StructureDefinition reference invalid")) { + long t = System.nanoTime(); + resourceProfiles.addProfile(errors, ref, errorForUnknownProfiles, p, element); + i++; + } + } + } + } + + private StructureDefinition checkExtension(ValidatorHostContext hostContext, List errors, String path, Element resource, Element element, ElementDefinition def, StructureDefinition profile, NodeStack stack) throws FHIRException, IOException { + String url = element.getNamedChildValue("url"); + boolean isModifier = element.getName().equals("modifierExtension"); + + long t = System.nanoTime(); + StructureDefinition ex = context.fetchResource(StructureDefinition.class, url); + sdTime = sdTime + (System.nanoTime() - t); + if (ex == null) { + if (!url.startsWith("http://hl7.org/fhir/4.0/StructureDefinition/extension-")) + if (rule(errors, IssueType.STRUCTURE, element.line(), element.col(), path, allowUnknownExtension(url), "The extension " + url + " is unknown, and not allowed here")) + hint(errors, IssueType.STRUCTURE, element.line(), element.col(), path, isKnownExtension(url), "Unknown extension " + url); + } else { + if (def.getIsModifier()) + rule(errors, IssueType.STRUCTURE, element.line(), element.col(), path + "[url='" + url + "']", ex.getSnapshot().getElement().get(0).getIsModifier(), + "Extension modifier mismatch: the extension element is labelled as a modifier, but the underlying extension is not"); + else + rule(errors, IssueType.STRUCTURE, element.line(), element.col(), path + "[url='" + url + "']", !ex.getSnapshot().getElement().get(0).getIsModifier(), + "Extension modifier mismatch: the extension element is not labelled as a modifier, but the underlying extension is"); + + // two questions + // 1. can this extension be used here? + checkExtensionContext(errors, element, /* path+"[url='"+url+"']", */ ex, stack, ex.getUrl()); + + if (isModifier) + rule(errors, IssueType.STRUCTURE, element.line(), element.col(), path + "[url='" + url + "']", ex.getSnapshot().getElement().get(0).getIsModifier(), + "The Extension '" + url + "' must be used as a modifierExtension"); + else + rule(errors, IssueType.STRUCTURE, element.line(), element.col(), path + "[url='" + url + "']", !ex.getSnapshot().getElement().get(0).getIsModifier(), + "The Extension '" + url + "' must not be used as an extension (it's a modifierExtension)"); + + // check the type of the extension: + Set allowedTypes = listExtensionTypes(ex); + String actualType = getExtensionType(element); + if (actualType == null) + rule(errors, IssueType.STRUCTURE, element.line(), element.col(), path + "[url='" + url + "']", allowedTypes.isEmpty(), "The Extension '" + url + "' definition is for a simple extension, so it must contain a value, not extensions"); + else + rule(errors, IssueType.STRUCTURE, element.line(), element.col(), path + "[url='" + url + "']", allowedTypes.contains(actualType), "The Extension '" + url + "' definition allows for the types "+allowedTypes.toString()+" but found type "+actualType); + + // 3. is the content of the extension valid? + validateElement(hostContext, errors, ex, ex.getSnapshot().getElement().get(0), null, null, resource, element, "Extension", stack, false); + + } + return ex; + } + + private String getExtensionType(Element element) { + for (Element e : element.getChildren()) { + if (e.getName().startsWith("value")) { + String tn = e.getName().substring(5); + String ltn = Utilities.uncapitalize(tn); + if (isPrimitiveType(ltn)) + return ltn; + else + return tn; + } + } + return null; + } + + private Set listExtensionTypes(StructureDefinition ex) { + ElementDefinition vd = null; + for (ElementDefinition ed : ex.getSnapshot().getElement()) { + if (ed.getPath().startsWith("Extension.value")) { + vd = ed; + break; + } + } + Set res = new HashSet(); + if (vd != null && !"0".equals(vd.getMax())) { + for (TypeRefComponent tr : vd.getType()) { + res.add(tr.getCode()); + } + } + return res; + } + + private boolean checkExtensionContext(List errors, Element element, StructureDefinition definition, NodeStack stack, String extensionParent) { +// String extUrl = definition.getUrl(); +// CommaSeparatedStringBuilder p = new CommaSeparatedStringBuilder(); +// for (String lp : stack.getLogicalPaths()) +// p.append(lp); +// if (definition.getContextType() == ExtensionContext.DATATYPE) { +// boolean ok = false; +// CommaSeparatedStringBuilder b = new CommaSeparatedStringBuilder(); +// for (StringType ct : definition.getContext()) { +// b.append(ct.getValue()); +// if (ct.getValue().equals("*") || stack.getLogicalPaths().contains(ct.getValue() + ".extension")) +// ok = true; +// } +// return rule(errors, IssueType.STRUCTURE, element.line(), element.col(), stack.getLiteralPath(), ok, +// "The extension " + extUrl + " is not allowed to be used on the logical path set [" + p.toString() + "] (allowed: datatype=" + b.toString() + ")"); +// } else if (definition.getContextType() == ExtensionContext.EXTENSION) { +// boolean ok = false; +// for (StringType ct : definition.getContext()) +// if (ct.getValue().equals("*") || ct.getValue().equals(extensionParent)) +// ok = true; +// return rule(errors, IssueType.STRUCTURE, element.line(), element.col(), stack.getLiteralPath(), ok, +// "The extension " + extUrl + " is not allowed to be used with the extension '" + extensionParent + "'"); +// } else if (definition.getContextType() == ExtensionContext.RESOURCE) { +// boolean ok = false; +// // String simplePath = container.getPath(); +// // System.out.println(simplePath); +// // if (effetive.endsWith(".extension") || simplePath.endsWith(".modifierExtension")) +// // simplePath = simplePath.substring(0, simplePath.lastIndexOf('.')); +// CommaSeparatedStringBuilder b = new CommaSeparatedStringBuilder(); +// for (StringType ct : definition.getContext()) { +// String c = ct.getValue(); +// b.append(c); +// if (c.equals("*") || stack.getLogicalPaths().contains(c + ".extension") || (c.startsWith("@") && stack.getLogicalPaths().contains(c.substring(1) + ".extension"))) +// ; +// ok = true; +// } +// return rule(errors, IssueType.STRUCTURE, element.line(), element.col(), stack.getLiteralPath(), ok, +// "The extension " + extUrl + " is not allowed to be used on the logical path set " + p.toString() + " (allowed: resource=" + b.toString() + ")"); +// } else +// throw new Error("Unsupported context type"); + return true; + } + // + // private String simplifyPath(String path) { + // String s = path.replace("/f:", "."); + // while (s.contains("[")) + // s = s.substring(0, s.indexOf("["))+s.substring(s.indexOf("]")+1); + // String[] parts = s.split("\\."); + // int i = 0; + // while (i < parts.length && !context.getProfiles().containsKey(parts[i].toLowerCase())) + // i++; + // if (i >= parts.length) + // throw new Error("Unable to process part "+path); + // int j = parts.length - 1; + // while (j > 0 && (parts[j].equals("extension") || parts[j].equals("modifierExtension"))) + // j--; + // StringBuilder b = new StringBuilder(); + // boolean first = true; + // for (int k = i; k <= j; k++) { + // if (k == j || !parts[k].equals(parts[k+1])) { + // if (first) + // first = false; + // else + // b.append("."); + // b.append(parts[k]); + // } + // } + // return b.toString(); + // } + // + + private void checkFixedValue(List errors, String path, Element focus, org.hl7.fhir.r5.model.Element fixed, String propName, Element parent) { + if ((fixed == null || fixed.isEmpty()) && focus == null) + ; // this is all good + else if (fixed == null && focus != null) + rule(errors, IssueType.VALUE, focus.line(), focus.col(), path, false, "Unexpected element " + focus.getName()); + else if (fixed != null && !fixed.isEmpty() && focus == null) + rule(errors, IssueType.VALUE, parent == null ? -1 : parent.line(), parent == null ? -1 : parent.col(), path, false, "Missing element '" + propName+"'"); + else { + String value = focus.primitiveValue(); + if (fixed instanceof org.hl7.fhir.r5.model.BooleanType) + rule(errors, IssueType.VALUE, focus.line(), focus.col(), path, check(((org.hl7.fhir.r5.model.BooleanType) fixed).asStringValue(), value), + "Value is '" + value + "' but must be '" + ((org.hl7.fhir.r5.model.BooleanType) fixed).asStringValue() + "'"); + else if (fixed instanceof org.hl7.fhir.r5.model.IntegerType) + rule(errors, IssueType.VALUE, focus.line(), focus.col(), path, check(((org.hl7.fhir.r5.model.IntegerType) fixed).asStringValue(), value), + "Value is '" + value + "' but must be '" + ((org.hl7.fhir.r5.model.IntegerType) fixed).asStringValue() + "'"); + else if (fixed instanceof org.hl7.fhir.r5.model.DecimalType) + rule(errors, IssueType.VALUE, focus.line(), focus.col(), path, check(((org.hl7.fhir.r5.model.DecimalType) fixed).asStringValue(), value), + "Value is '" + value + "' but must be '" + ((org.hl7.fhir.r5.model.DecimalType) fixed).asStringValue() + "'"); + else if (fixed instanceof org.hl7.fhir.r5.model.Base64BinaryType) + rule(errors, IssueType.VALUE, focus.line(), focus.col(), path, check(((org.hl7.fhir.r5.model.Base64BinaryType) fixed).asStringValue(), value), + "Value is '" + value + "' but must be '" + ((org.hl7.fhir.r5.model.Base64BinaryType) fixed).asStringValue() + "'"); + else if (fixed instanceof org.hl7.fhir.r5.model.InstantType) + rule(errors, IssueType.VALUE, focus.line(), focus.col(), path, check(((org.hl7.fhir.r5.model.InstantType) fixed).getValue().toString(), value), + "Value is '" + value + "' but must be '" + ((org.hl7.fhir.r5.model.InstantType) fixed).asStringValue() + "'"); + else if (fixed instanceof org.hl7.fhir.r5.model.StringType) + rule(errors, IssueType.VALUE, focus.line(), focus.col(), path, check(((org.hl7.fhir.r5.model.StringType) fixed).getValue(), value), + "Value is '" + value + "' but must be '" + ((org.hl7.fhir.r5.model.StringType) fixed).getValue() + "'"); + else if (fixed instanceof org.hl7.fhir.r5.model.UriType) + rule(errors, IssueType.VALUE, focus.line(), focus.col(), path, check(((org.hl7.fhir.r5.model.UriType) fixed).getValue(), value), + "Value is '" + value + "' but must be '" + ((org.hl7.fhir.r5.model.UriType) fixed).getValue() + "'"); + else if (fixed instanceof org.hl7.fhir.r5.model.DateType) + rule(errors, IssueType.VALUE, focus.line(), focus.col(), path, check(((org.hl7.fhir.r5.model.DateType) fixed).getValue().toString(), value), + "Value is '" + value + "' but must be '" + ((org.hl7.fhir.r5.model.DateType) fixed).getValue() + "'"); + else if (fixed instanceof org.hl7.fhir.r5.model.DateTimeType) + rule(errors, IssueType.VALUE, focus.line(), focus.col(), path, check(((org.hl7.fhir.r5.model.DateTimeType) fixed).getValue().toString(), value), + "Value is '" + value + "' but must be '" + ((org.hl7.fhir.r5.model.DateTimeType) fixed).getValue() + "'"); + else if (fixed instanceof org.hl7.fhir.r5.model.OidType) + rule(errors, IssueType.VALUE, focus.line(), focus.col(), path, check(((org.hl7.fhir.r5.model.OidType) fixed).getValue(), value), + "Value is '" + value + "' but must be '" + ((org.hl7.fhir.r5.model.OidType) fixed).getValue() + "'"); + else if (fixed instanceof org.hl7.fhir.r5.model.UuidType) + rule(errors, IssueType.VALUE, focus.line(), focus.col(), path, check(((org.hl7.fhir.r5.model.UuidType) fixed).getValue(), value), + "Value is '" + value + "' but must be '" + ((org.hl7.fhir.r5.model.UuidType) fixed).getValue() + "'"); + else if (fixed instanceof org.hl7.fhir.r5.model.CodeType) + rule(errors, IssueType.VALUE, focus.line(), focus.col(), path, check(((org.hl7.fhir.r5.model.CodeType) fixed).getValue(), value), + "Value is '" + value + "' but must be '" + ((org.hl7.fhir.r5.model.CodeType) fixed).getValue() + "'"); + else if (fixed instanceof org.hl7.fhir.r5.model.IdType) + rule(errors, IssueType.VALUE, focus.line(), focus.col(), path, check(((org.hl7.fhir.r5.model.IdType) fixed).getValue(), value), + "Value is '" + value + "' but must be '" + ((org.hl7.fhir.r5.model.IdType) fixed).getValue() + "'"); + else if (fixed instanceof Quantity) + checkQuantity(errors, path, focus, (Quantity) fixed); + else if (fixed instanceof Address) + checkAddress(errors, path, focus, (Address) fixed); + else if (fixed instanceof ContactPoint) + checkContactPoint(errors, path, focus, (ContactPoint) fixed); + else if (fixed instanceof Attachment) + checkAttachment(errors, path, focus, (Attachment) fixed); + else if (fixed instanceof Identifier) + checkIdentifier(errors, path, focus, (Identifier) fixed); + else if (fixed instanceof Coding) + checkCoding(errors, path, focus, (Coding) fixed); + else if (fixed instanceof HumanName) + checkHumanName(errors, path, focus, (HumanName) fixed); + else if (fixed instanceof CodeableConcept) + checkCodeableConcept(errors, path, focus, (CodeableConcept) fixed); + else if (fixed instanceof Timing) + checkTiming(errors, path, focus, (Timing) fixed); + else if (fixed instanceof Period) + checkPeriod(errors, path, focus, (Period) fixed); + else if (fixed instanceof Range) + checkRange(errors, path, focus, (Range) fixed); + else if (fixed instanceof Ratio) + checkRatio(errors, path, focus, (Ratio) fixed); + else if (fixed instanceof SampledData) + checkSampledData(errors, path, focus, (SampledData) fixed); + + else + rule(errors, IssueType.EXCEPTION, focus.line(), focus.col(), path, false, "Unhandled fixed value type " + fixed.getClass().getName()); + List extensions = new ArrayList(); + focus.getNamedChildren("extension", extensions); + if (fixed.getExtension().size() == 0) { + rule(errors, IssueType.VALUE, focus.line(), focus.col(), path, extensions.size() == 0, "No extensions allowed, as the specified fixed value doesn't contain any extensions"); + } else if (rule(errors, IssueType.VALUE, focus.line(), focus.col(), path, extensions.size() == fixed.getExtension().size(), + "Extensions count mismatch: expected " + Integer.toString(fixed.getExtension().size()) + " but found " + Integer.toString(extensions.size()))) { + for (Extension e : fixed.getExtension()) { + Element ex = getExtensionByUrl(extensions, e.getUrl()); + if (rule(errors, IssueType.VALUE, focus.line(), focus.col(), path, ex != null, "Extension count mismatch: unable to find extension: " + e.getUrl())) { + checkFixedValue(errors, path, ex.getNamedChild("extension").getNamedChild("value"), e.getValue(), "extension.value", ex.getNamedChild("extension")); + } + } + } + } + } + + private void checkHumanName(List errors, String path, Element focus, HumanName fixed) { + checkFixedValue(errors, path + ".use", focus.getNamedChild("use"), fixed.getUseElement(), "use", focus); + checkFixedValue(errors, path + ".text", focus.getNamedChild("text"), fixed.getTextElement(), "text", focus); + checkFixedValue(errors, path + ".period", focus.getNamedChild("period"), fixed.getPeriod(), "period", focus); + + List parts = new ArrayList(); + focus.getNamedChildren("family", parts); + if (rule(errors, IssueType.VALUE, focus.line(), focus.col(), path, parts.size() > 0 == fixed.hasFamily(), + "Expected " + (fixed.hasFamily() ? "1" : "0") + " but found " + Integer.toString(parts.size()) + " family elements")) { + for (int i = 0; i < parts.size(); i++) + checkFixedValue(errors, path + ".family", parts.get(i), fixed.getFamilyElement(), "family", focus); + } + focus.getNamedChildren("given", parts); + if (rule(errors, IssueType.VALUE, focus.line(), focus.col(), path, parts.size() == fixed.getGiven().size(), + "Expected " + Integer.toString(fixed.getGiven().size()) + " but found " + Integer.toString(parts.size()) + " given elements")) { + for (int i = 0; i < parts.size(); i++) + checkFixedValue(errors, path + ".given", parts.get(i), fixed.getGiven().get(i), "given", focus); + } + focus.getNamedChildren("prefix", parts); + if (rule(errors, IssueType.VALUE, focus.line(), focus.col(), path, parts.size() == fixed.getPrefix().size(), + "Expected " + Integer.toString(fixed.getPrefix().size()) + " but found " + Integer.toString(parts.size()) + " prefix elements")) { + for (int i = 0; i < parts.size(); i++) + checkFixedValue(errors, path + ".prefix", parts.get(i), fixed.getPrefix().get(i), "prefix", focus); + } + focus.getNamedChildren("suffix", parts); + if (rule(errors, IssueType.VALUE, focus.line(), focus.col(), path, parts.size() == fixed.getSuffix().size(), + "Expected " + Integer.toString(fixed.getSuffix().size()) + " but found " + Integer.toString(parts.size()) + " suffix elements")) { + for (int i = 0; i < parts.size(); i++) + checkFixedValue(errors, path + ".suffix", parts.get(i), fixed.getSuffix().get(i), "suffix", focus); + } + } + + private void checkIdentifier(List errors, String path, Element element, ElementDefinition context) { + String system = element.getNamedChildValue("system"); + rule(errors, IssueType.CODEINVALID, element.line(), element.col(), path, isAbsolute(system), "Identifier.system must be an absolute reference, not a local reference"); + } + + private void checkIdentifier(List errors, String path, Element focus, Identifier fixed) { + checkFixedValue(errors, path + ".use", focus.getNamedChild("use"), fixed.getUseElement(), "use", focus); + checkFixedValue(errors, path + ".type", focus.getNamedChild("type"), fixed.getType(), "type", focus); + checkFixedValue(errors, path + ".system", focus.getNamedChild("system"), fixed.getSystemElement(), "system", focus); + checkFixedValue(errors, path + ".value", focus.getNamedChild("value"), fixed.getValueElement(), "value", focus); + checkFixedValue(errors, path + ".period", focus.getNamedChild("period"), fixed.getPeriod(), "period", focus); + checkFixedValue(errors, path + ".assigner", focus.getNamedChild("assigner"), fixed.getAssigner(), "assigner", focus); + } + + private void checkPeriod(List errors, String path, Element focus, Period fixed) { + checkFixedValue(errors, path + ".start", focus.getNamedChild("start"), fixed.getStartElement(), "start", focus); + checkFixedValue(errors, path + ".end", focus.getNamedChild("end"), fixed.getEndElement(), "end", focus); + } + + private void checkPrimitive(Object appContext, List errors, String path, String type, ElementDefinition context, Element e, StructureDefinition profile) throws FHIRException, IOException { + if (isBlank(e.primitiveValue())) { + if (e.primitiveValue() == null) + rule(errors, IssueType.INVALID, e.line(), e.col(), path, e.hasChildren(), "Primitive types must have a value or must have child extensions"); + else if (e.primitiveValue().length() == 0) + rule(errors, IssueType.INVALID, e.line(), e.col(), path, e.hasChildren(), "Primitive types must have a value that is not empty"); + else if (StringUtils.isWhitespace(e.primitiveValue())) + warning(errors, IssueType.INVALID, e.line(), e.col(), path, e.hasChildren(), "Primitive types should not only be whitespace"); + return; + } + String regex = context.getExtensionString(ToolingExtensions.EXT_REGEX); + if (regex!=null) + rule(errors, IssueType.INVALID, e.line(), e.col(), path, e.primitiveValue().matches(regex), "Element value '" + e.primitiveValue() + "' does not meet regex '" + regex + "'"); + + if (type.equals("boolean")) { + rule(errors, IssueType.INVALID, e.line(), e.col(), path, "true".equals(e.primitiveValue()) || "false".equals(e.primitiveValue()), "boolean values must be 'true' or 'false'"); + } + if (type.equals("uri") || type.equals("oid") || type.equals("uuid") || type.equals("url") || type.equals("canonical")) { + rule(errors, IssueType.INVALID, e.line(), e.col(), path, !e.primitiveValue().startsWith("oid:"), "URI values cannot start with oid:"); + rule(errors, IssueType.INVALID, e.line(), e.col(), path, !e.primitiveValue().startsWith("uuid:"), "URI values cannot start with uuid:"); + rule(errors, IssueType.INVALID, e.line(), e.col(), path, e.primitiveValue().equals(e.primitiveValue().trim().replace(" ", "")), "URI values cannot have whitespace"); + rule(errors, IssueType.INVALID, e.line(), e.col(), path, !context.hasMaxLength() || context.getMaxLength()==0 || e.primitiveValue().length() <= context.getMaxLength(), "value is longer than permitted maximum length of " + context.getMaxLength()); + + + if (type.equals("oid")) { + if (rule(errors, IssueType.INVALID, e.line(), e.col(), path, e.primitiveValue().startsWith("urn:oid:"), "OIDs must start with urn:oid:")) + rule(errors, IssueType.INVALID, e.line(), e.col(), path, Utilities.isOid(e.primitiveValue().substring(8)), "OIDs must be valid"); + } + if (type.equals("uuid")) { + rule(errors, IssueType.INVALID, e.line(), e.col(), path, e.primitiveValue().startsWith("urn:uuid:"), "UUIDs must start with urn:uuid:"); + try { + UUID.fromString(e.primitiveValue().substring(8)); + } catch (Exception ex) { + rule(errors, IssueType.INVALID, e.line(), e.col(), path, false, "UUIDs must be valid ("+ex.getMessage()+")"); + } + } + + // now, do we check the URI target? + if (fetcher != null) { + rule(errors, IssueType.INVALID, e.line(), e.col(), path, fetcher.resolveURL(appContext, path, e.primitiveValue()), "URL value '"+e.primitiveValue()+"' does not resolve"); + } + } + if (type.equals("id")) { + rule(errors, IssueType.INVALID, e.line(), e.col(), path, FormatUtilities.isValidId(e.primitiveValue()), "id value '"+e.primitiveValue()+"' is not valid"); + + } + if (type.equalsIgnoreCase("string") && e.hasPrimitiveValue()) { + if (rule(errors, IssueType.INVALID, e.line(), e.col(), path, e.primitiveValue() == null || e.primitiveValue().length() > 0, "@value cannot be empty")) { + warning(errors, IssueType.INVALID, e.line(), e.col(), path, e.primitiveValue() == null || e.primitiveValue().trim().equals(e.primitiveValue()), "value should not start or finish with whitespace"); + if (rule(errors, IssueType.INVALID, e.line(), e.col(), path, e.primitiveValue().length() <= 1048576, "value is longer than permitted maximum length of 1 MB (1048576 bytes)")) { + rule(errors, IssueType.INVALID, e.line(), e.col(), path, !context.hasMaxLength() || context.getMaxLength()==0 || e.primitiveValue().length() <= context.getMaxLength(), "value is longer than permitted maximum length of " + context.getMaxLength()); + } + } + } + if (type.equals("dateTime")) { + rule(errors, IssueType.INVALID, e.line(), e.col(), path, yearIsValid(e.primitiveValue()), "The value '" + e.primitiveValue() + "' does not have a valid year"); + rule(errors, IssueType.INVALID, e.line(), e.col(), path, + e.primitiveValue() + .matches("([0-9]([0-9]([0-9][1-9]|[1-9]0)|[1-9]00)|[1-9]000)(-(0[1-9]|1[0-2])(-(0[1-9]|[1-2][0-9]|3[0-1])(T([01][0-9]|2[0-3]):[0-5][0-9]:([0-5][0-9]|60)(\\.[0-9]+)?(Z|(\\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))?)?)?)?"), + "Not a valid date time"); + rule(errors, IssueType.INVALID, e.line(), e.col(), path, !hasTime(e.primitiveValue()) || hasTimeZone(e.primitiveValue()), "if a date has a time, it must have a timezone"); + rule(errors, IssueType.INVALID, e.line(), e.col(), path, !context.hasMaxLength() || context.getMaxLength()==0 || e.primitiveValue().length() <= context.getMaxLength(), "value is longer than permitted maximum length of " + context.getMaxLength()); + try { + DateTimeType dt = new DateTimeType(e.primitiveValue()); + } catch (Exception ex) { + rule(errors, IssueType.INVALID, e.line(), e.col(), path, false, "Not a valid date/time ("+ex.getMessage()+")"); + } + } + if (type.equals("time")) { + rule(errors, IssueType.INVALID, e.line(), e.col(), path, + e.primitiveValue() + .matches("([01][0-9]|2[0-3]):[0-5][0-9]:([0-5][0-9]|60)"), + "Not a valid time"); + try { + TimeType dt = new TimeType(e.primitiveValue()); + } catch (Exception ex) { + rule(errors, IssueType.INVALID, e.line(), e.col(), path, false, "Not a valid time ("+ex.getMessage()+")"); + } + } + if (type.equals("date")) { + rule(errors, IssueType.INVALID, e.line(), e.col(), path, yearIsValid(e.primitiveValue()), "The value '" + e.primitiveValue() + "' does not have a valid year"); + rule(errors, IssueType.INVALID, e.line(), e.col(), path, e.primitiveValue().matches("([0-9]([0-9]([0-9][1-9]|[1-9]0)|[1-9]00)|[1-9]000)(-(0[1-9]|1[0-2])(-(0[1-9]|[1-2][0-9]|3[0-1]))?)?"), + "Not a valid date"); + rule(errors, IssueType.INVALID, e.line(), e.col(), path, !context.hasMaxLength() || context.getMaxLength()==0 || e.primitiveValue().length() <= context.getMaxLength(), "value is longer than permitted maximum value of " + context.getMaxLength()); + try { + DateType dt = new DateType(e.primitiveValue()); + } catch (Exception ex) { + rule(errors, IssueType.INVALID, e.line(), e.col(), path, false, "Not a valid date ("+ex.getMessage()+")"); + } + } + if (type.equals("base64Binary")) { + String encoded = e.primitiveValue(); + if (isNotBlank(encoded)) { + /* + * Technically this is not bulletproof as some invalid base64 won't be caught, + * but I think it's good enough. The original code used Java8 Base64 decoder + * but I've replaced it with a regex for 2 reasons: + * 1. This code will run on any version of Java + * 2. This code doesn't actually decode, which is much easier on memory use for big payloads + */ + int charCount = 0; + for (int i = 0; i < encoded.length(); i++) { + char nextChar = encoded.charAt(i); + if (Character.isWhitespace(nextChar)) { + continue; + } + if (Character.isLetterOrDigit(nextChar)) { + charCount++; + } + if (nextChar == '/' || nextChar == '=' || nextChar == '+') { + charCount++; + } + } + + if (charCount > 0 && charCount % 4 != 0) { + String value = encoded.length() < 100 ? encoded : "(snip)"; + rule(errors, IssueType.INVALID, e.line(), e.col(), path, false, "The value \"{0}\" is not a valid Base64 value", value); + } + } + } + if (type.equals("integer") || type.equals("unsignedInt") || type.equals("positiveInt")) { + if (rule(errors, IssueType.INVALID, e.line(), e.col(), path, Utilities.isInteger(e.primitiveValue()), "The value '" + e.primitiveValue() + "' is not a valid integer")) { + Integer v = new Integer(e.getValue()).intValue(); + rule(errors, IssueType.INVALID, e.line(), e.col(), path, !context.hasMaxValueIntegerType() || !context.getMaxValueIntegerType().hasValue() || (context.getMaxValueIntegerType().getValue() >= v), "value is greater than permitted maximum value of " + (context.hasMaxValueIntegerType() ? context.getMaxValueIntegerType() : "")); + rule(errors, IssueType.INVALID, e.line(), e.col(), path, !context.hasMinValueIntegerType() || !context.getMinValueIntegerType().hasValue() || (context.getMinValueIntegerType().getValue() <= v), "value is less than permitted minimum value of " + (context.hasMinValueIntegerType() ? context.getMinValueIntegerType() : "")); + if (type.equals("unsignedInt")) + rule(errors, IssueType.INVALID, e.line(), e.col(), path, v >= 0, "value is less than permitted minimum value of 0"); + if (type.equals("positiveInt")) + rule(errors, IssueType.INVALID, e.line(), e.col(), path, v > 0, "value is less than permitted minimum value of 1"); + } + } + if (type.equals("decimal")) { + if (e.primitiveValue() != null) { + rule(errors, IssueType.INVALID, e.line(), e.col(), path, Utilities.isDecimal(e.primitiveValue()), "The value '" + e.primitiveValue() + "' is not a valid decimal"); + if (e.primitiveValue().contains(".")) { + String head = e.primitiveValue().substring(0, e.primitiveValue().indexOf(".")); + if (head.startsWith("-")) + head = head.substring(1); + int i = 0; + while (head.startsWith("0")) { + i++; + head = head.substring(1); + } + rule(errors, IssueType.INVALID, e.line(), e.col(), path, i <= 1, "The value '" + e.primitiveValue() + "' is not a valid decimal (leading 0s)"); + } + } + } + if (type.equals("instant")) { + rule(errors, IssueType.INVALID, e.line(), e.col(), path, + e.primitiveValue().matches("-?[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])T([01][0-9]|2[0-3]):[0-5][0-9]:([0-5][0-9]|60)(\\.[0-9]+)?(Z|(\\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))"), + "The instant '" + e.primitiveValue() + "' is not valid (by regex)"); + rule(errors, IssueType.INVALID, e.line(), e.col(), path, yearIsValid(e.primitiveValue()), "The value '" + e.primitiveValue() + "' does not have a valid year"); + try { + InstantType dt = new InstantType(e.primitiveValue()); + } catch (Exception ex) { + rule(errors, IssueType.INVALID, e.line(), e.col(), path, false, "Not a valid instant ("+ex.getMessage()+")"); + } + } + + if (type.equals("code") && e.primitiveValue() != null) { + // Technically, a code is restricted to string which has at least one character and no leading or trailing whitespace, and where there is no whitespace + // other than single spaces in the contents + rule(errors, IssueType.INVALID, e.line(), e.col(), path, passesCodeWhitespaceRules(e.primitiveValue()), "The code '" + e.primitiveValue() + "' is not valid (whitespace rules)"); + rule(errors, IssueType.INVALID, e.line(), e.col(), path, !context.hasMaxLength() || context.getMaxLength()==0 || e.primitiveValue().length() <= context.getMaxLength(), "value is longer than permitted maximum length of " + context.getMaxLength()); + } + + if (context.hasBinding() && e.primitiveValue() != null) { + checkPrimitiveBinding(errors, path, type, context, e, profile); + } + + if (type.equals("xhtml")) { + XhtmlNode xhtml = e.getXhtml(); + if (xhtml != null) { // if it is null, this is an error already noted in the parsers + // check that the namespace is there and correct. + String ns = xhtml.getNsDecl(); + rule(errors, IssueType.INVALID, e.line(), e.col(), path, FormatUtilities.XHTML_NS.equals(ns), "Wrong namespace on the XHTML ('"+ns+"')"); + // check that inner namespaces are all correct + checkInnerNS(errors, e, path, xhtml.getChildNodes()); + rule(errors, IssueType.INVALID, e.line(), e.col(), path, "div".equals(xhtml.getName()), "Wrong name on the XHTML ('"+ns+"') - must start with div"); + // check that no illegal elements and attributes have been used + checkInnerNames(errors, e, path, xhtml.getChildNodes()); + } + } + + if (context.hasFixed()) + checkFixedValue(errors,path,e, context.getFixed(), context.getSliceName(), null); + + // for nothing to check + } + + private void checkInnerNames(List errors, Element e, String path, List list) { + for (XhtmlNode node : list) { + if (node.getNodeType() == NodeType.Element) { + rule(errors, IssueType.INVALID, e.line(), e.col(), path, Utilities.existsInList(node.getName(), + "p", "br", "div", "h1", "h2", "h3", "h4", "h5", "h6", "a", "span", "b", "em", "i", "strong", + "small", "big", "tt", "small", "dfn", "q", "var", "abbr", "acronym", "cite", "blockquote", "hr", "address", "bdo", "kbd", "q", "sub", "sup", + "ul", "ol", "li", "dl", "dt", "dd", "pre", "table", "caption", "colgroup", "col", "thead", "tr", "tfoot", "tbody", "th", "td", + "code", "samp", "img", "map", "area" + + ), "Illegal element name in the XHTML ('"+node.getName()+"')"); + for (String an : node.getAttributes().keySet()) { + boolean ok = an.startsWith("xmlns") || Utilities.existsInList(an, + "title", "style", "class", "id", "lang", "xml:lang", "dir", "accesskey", "tabindex", + // tables + "span", "width", "align", "valign", "char", "charoff", "abbr", "axis", "headers", "scope", "rowspan", "colspan") || + + Utilities.existsInList(node.getName()+"."+an, "a.href", "a.name", "img.src", "img.border", "div.xmlns", "blockquote.cite", "q.cite", + "a.charset", "a.type", "a.name", "a.href", "a.hreflang", "a.rel", "a.rev", "a.shape", "a.coords", "img.src", + "img.alt", "img.longdesc", "img.height", "img.width", "img.usemap", "img.ismap", "map.name", "area.shape", + "area.coords", "area.href", "area.nohref", "area.alt", "table.summary", "table.width", "table.border", + "table.frame", "table.rules", "table.cellspacing", "table.cellpadding", "pre.space", "td.nowrap" + ); + if (!ok) + rule(errors, IssueType.INVALID, e.line(), e.col(), path, false, "Illegal attribute name in the XHTML ('"+an+"' on '"+node.getName()+"')"); + } + checkInnerNames(errors, e, path, node.getChildNodes()); + } + } + } + + private void checkInnerNS(List errors, Element e, String path, List list) { + for (XhtmlNode node : list) { + if (node.getNodeType() == NodeType.Element) { + String ns = node.getNsDecl(); + rule(errors, IssueType.INVALID, e.line(), e.col(), path, ns == null || FormatUtilities.XHTML_NS.equals(ns), "Wrong namespace on the XHTML ('"+ns+"')"); + checkInnerNS(errors, e, path, node.getChildNodes()); + } + } + } + + private void checkPrimitiveBinding(List errors, String path, String type, ElementDefinition elementContext, Element element, StructureDefinition profile) { + // We ignore bindings that aren't on string, uri or code + if (!element.hasPrimitiveValue() || !("code".equals(type) || "string".equals(type) || "uri".equals(type) || "url".equals(type) || "canonical".equals(type))) { + return; + } + if (noTerminologyChecks) + return; + + String value = element.primitiveValue(); + // System.out.println("check "+value+" in "+path); + + // firstly, resolve the value set + ElementDefinitionBindingComponent binding = elementContext.getBinding(); + if (binding.hasValueSet()) { + ValueSet vs = resolveBindingReference(profile, binding.getValueSet(), profile.getUrl()); + if (warning(errors, IssueType.CODEINVALID, element.line(), element.col(), path, vs != null, "ValueSet {0} not found", describeReference(binding.getValueSet()))) { + long t = System.nanoTime(); + ValidationResult vr = null; + if (binding.getStrength() != BindingStrength.EXAMPLE) { + vr = context.validateCode(value, vs); + } + txTime = txTime + (System.nanoTime() - t); + if (vr != null && !vr.isOk()) { + if (vr.IsNoService()) + txHint(errors, vr.getTxLink(), IssueType.CODEINVALID, element.line(), element.col(), path, false, "The value provided ('"+value+"') could not be validated in the absence of a terminology server"); + else if (binding.getStrength() == BindingStrength.REQUIRED) + txRule(errors, vr.getTxLink(), IssueType.CODEINVALID, element.line(), element.col(), path, false, "The value provided ('"+value+"') is not in the value set " + describeReference(binding.getValueSet()) + " (" + vs.getUrl() + ", and a code is required from this value set)"+(vr.getMessage() != null ? " (error message = "+vr.getMessage()+")" : "")); + else if (binding.getStrength() == BindingStrength.EXTENSIBLE) { + if (binding.hasExtension("http://hl7.org/fhir/StructureDefinition/elementdefinition-maxValueSet")) + checkMaxValueSet(errors, path, element, profile, ToolingExtensions.readStringExtension(binding, "http://hl7.org/fhir/StructureDefinition/elementdefinition-maxValueSet"), value); + else if (!noExtensibleWarnings) + txWarning(errors, vr.getTxLink(), IssueType.CODEINVALID, element.line(), element.col(), path, false, "The value provided ('"+value+"') is not in the value set " + describeReference(binding.getValueSet()) + " (" + vs.getUrl() + ", and a code should come from this value set unless it has no suitable code)"+(vr.getMessage() != null ? " (error message = "+vr.getMessage()+")" : "")); + } else if (binding.getStrength() == BindingStrength.PREFERRED) + txHint(errors, vr.getTxLink(), IssueType.CODEINVALID, element.line(), element.col(), path, false, "The value provided ('"+value+"') is not in the value set " + describeReference(binding.getValueSet()) + " (" + vs.getUrl() + ", and a code is recommended to come from this value set)"+(vr.getMessage() != null ? " (error message = "+vr.getMessage()+")" : "")); + } + } + } else if (!noBindingMsgSuppressed) + hint(errors, IssueType.CODEINVALID, element.line(), element.col(), path, !type.equals("code"), "Binding has no source, so can't be checked"); + } + + private void checkQuantity(List errors, String path, Element focus, Quantity fixed) { + checkFixedValue(errors, path + ".value", focus.getNamedChild("value"), fixed.getValueElement(), "value", focus); + checkFixedValue(errors, path + ".comparator", focus.getNamedChild("comparator"), fixed.getComparatorElement(), "comparator", focus); + checkFixedValue(errors, path + ".units", focus.getNamedChild("unit"), fixed.getUnitElement(), "units", focus); + checkFixedValue(errors, path + ".system", focus.getNamedChild("system"), fixed.getSystemElement(), "system", focus); + checkFixedValue(errors, path + ".code", focus.getNamedChild("code"), fixed.getCodeElement(), "code", focus); + } + + // implementation + + private void checkRange(List errors, String path, Element focus, Range fixed) { + checkFixedValue(errors, path + ".low", focus.getNamedChild("low"), fixed.getLow(), "low", focus); + checkFixedValue(errors, path + ".high", focus.getNamedChild("high"), fixed.getHigh(), "high", focus); + + } + + private void checkRatio(List errors, String path, Element focus, Ratio fixed) { + checkFixedValue(errors, path + ".numerator", focus.getNamedChild("numerator"), fixed.getNumerator(), "numerator", focus); + checkFixedValue(errors, path + ".denominator", focus.getNamedChild("denominator"), fixed.getDenominator(), "denominator", focus); + } + + private void checkReference(ValidatorHostContext hostContext, List errors, String path, Element element, StructureDefinition profile, ElementDefinition container, String parentType, NodeStack stack) throws FHIRException, IOException { + Reference reference = ObjectConverter.readAsReference(element); + + String ref = reference.getReference(); + if (Utilities.noString(ref)) { + if (Utilities.noString(reference.getIdentifier().getSystem()) && Utilities.noString(reference.getIdentifier().getValue())) { + warning(errors, IssueType.STRUCTURE, element.line(), element.col(), path, !Utilities.noString(element.getNamedChildValue("display")), "A Reference without an actual reference or identifier should have a display"); + } + return; + } + + Element we = localResolve(ref, stack, errors, path); + String refType; + if (ref.startsWith("#")) { + refType = "contained"; + } else { + if (we == null) { + refType = "remote"; + } else { + refType = "bundle"; + } + } + ReferenceValidationPolicy pol = refType.equals("contained") || refType.equals("bundle") ? ReferenceValidationPolicy.CHECK_VALID : fetcher == null ? ReferenceValidationPolicy.IGNORE : fetcher.validationPolicy(hostContext.appContext, path, ref); + + if (pol.checkExists()) { + if (we == null) { + if (fetcher == null) { + if (!refType.equals("contained")) + throw new FHIRException("Resource resolution services not provided"); + } else { + we = fetcher.fetch(hostContext.appContext, ref); + } + } + rule(errors, IssueType.STRUCTURE, element.line(), element.col(), path, we != null, "Unable to resolve resource '"+ref+"'"); + } + + String ft; + if (we != null) + ft = we.getType(); + else + ft = tryParse(ref); + + if (reference.hasType()) { + // the type has to match the specified + String tu = isAbsolute(reference.getType()) ? reference.getType() : "http://hl7.org/fhir/StructureDefinition/"+reference.getType(); + TypeRefComponent containerType = container.getType("Reference"); + if (!containerType.hasTargetProfile(tu) && !containerType.hasTargetProfile("http://hl7.org/fhir/StructureDefinition/Resource")) { + boolean matchingResource = false; + for (CanonicalType target: containerType.getTargetProfile()) { + StructureDefinition sd = (StructureDefinition)context.fetchResource(StructureDefinition.class, target.asStringValue()); + if (("http://hl7.org/fhir/StructureDefinition/" + sd.getType()).equals(tu)) { + matchingResource = true; + break; + } + } + rule(errors, IssueType.STRUCTURE, element.line(), element.col(), path, matchingResource, + "The type '"+reference.getType()+"' is not a valid Target for this element (must be one of "+container.getType("Reference").getTargetProfile()+")"); + + } + // the type has to match the actual + rule(errors, IssueType.STRUCTURE, element.line(), element.col(), path, ft==null || ft.equals(reference.getType()), "The specified type '"+reference.getType()+"' does not match the found type '"+ft+"'"); + } + + if (we != null && pol.checkType()) { + if (warning(errors, IssueType.STRUCTURE, element.line(), element.col(), path, ft!=null, "Unable to determine type of target resource")) { + boolean ok = false; + CommaSeparatedStringBuilder b = new CommaSeparatedStringBuilder(); + for (TypeRefComponent type : container.getType()) { + if (!ok && type.getCode().equals("Reference")) { + // we validate as much as we can. First, can we infer a type from the profile? + if (!type.hasTargetProfile() || type.hasTargetProfile("http://hl7.org/fhir/StructureDefinition/Resource")) + ok = true; + else for (UriType u : type.getTargetProfile()) { + String pr = u.getValue(); + + String bt = getBaseType(profile, pr); + StructureDefinition sd = context.fetchResource(StructureDefinition.class, "http://hl7.org/fhir/StructureDefinition/" + bt); + if (rule(errors, IssueType.STRUCTURE, element.line(), element.col(), path, bt != null, "Unable to resolve the profile reference '" + pr + "'")) { + b.append(bt); + ok = bt.equals(ft); + if (ok && we!=null && pol.checkValid()) { + doResourceProfile(hostContext, we, pr, errors, stack.push(we, -1, null, null), path, element); + } + } else + ok = true; // suppress following check + if (ok && type.hasAggregation()) { + boolean modeOk; + for (Enumeration mode : type.getAggregation()) { + if (mode.getValue().equals(AggregationMode.CONTAINED) && refType.equals("contained")) + ok = true; + else if (mode.getValue().equals(AggregationMode.BUNDLED) && refType.equals("bundled")) + ok = true; + else if (mode.getValue().equals(AggregationMode.REFERENCED) && (refType.equals("bundled")||refType.equals("remote"))) + ok = true; + } + rule(errors, IssueType.STRUCTURE, element.line(), element.col(), path, ok, "Reference is " + refType + " which isn't supported by the specified aggregation mode(s) for the reference"); + } + if (ok) + break; + } + } + if (!ok && type.getCode().equals("*")) { + ok = true; // can refer to anything + } + } + rule(errors, IssueType.STRUCTURE, element.line(), element.col(), path, ok, "Invalid Resource target type. Found " + ft + ", but expected one of (" + b.toString() + ")"); + } + } + if (we == null) { + // Ensure that reference was not defined as being "bundled" or "contained" + boolean missingRef = false; + for (TypeRefComponent type : container.getType()) { + if (!missingRef && type.getCode().equals("Reference")) { + if (type.hasAggregation()) { + for (Enumeration mode : type.getAggregation()) { + if (mode.getValue().equals(AggregationMode.CONTAINED) || mode.getValue().equals(AggregationMode.BUNDLED)) { + missingRef = true; + break; + } + } + } + } + } + rule(errors, IssueType.REQUIRED, -1, -1, path, !missingRef, "Bundled or contained reference not found within the bundle/resource " + ref); + } + + if (pol == ReferenceValidationPolicy.CHECK_VALID) { + // todo.... + } + } + + private void doResourceProfile(ValidatorHostContext hostContext, Element resource, String profile, List errors, NodeStack stack, String path, Element element) throws FHIRException, IOException { + ResourceProfiles resourceProfiles = addResourceProfile(errors, resource, profile, path, element, stack); + if (resourceProfiles.isProcessed()) { + start(hostContext, errors, resource, resource, null, stack); + } + } + + private ResourceProfiles getResourceProfiles(Element resource, NodeStack stack) { + ResourceProfiles resourceProfiles = resourceProfilesMap.get(resource); + if (resourceProfiles==null) { + resourceProfiles = new ResourceProfiles(resource, stack); + resourceProfilesMap.put(resource, resourceProfiles); + } + return resourceProfiles; + } + + private ResourceProfiles addResourceProfile(List errors, Element resource, String profile, String path, Element element, NodeStack stack) { + ResourceProfiles resourceProfiles = getResourceProfiles(resource, stack); + resourceProfiles.addProfile(errors, profile, errorForUnknownProfiles, path, element); + return resourceProfiles; + } + + private String checkResourceType(String type) { + long t = System.nanoTime(); + try { + if (context.fetchResource(StructureDefinition.class, "http://hl7.org/fhir/StructureDefinition/" + type) != null) + return type; + else + return null; + } finally { + sdTime = sdTime + (System.nanoTime() - t); + } + } + + private void checkSampledData(List errors, String path, Element focus, SampledData fixed) { + checkFixedValue(errors, path + ".origin", focus.getNamedChild("origin"), fixed.getOrigin(), "origin", focus); + checkFixedValue(errors, path + ".period", focus.getNamedChild("period"), fixed.getPeriodElement(), "period", focus); + checkFixedValue(errors, path + ".factor", focus.getNamedChild("factor"), fixed.getFactorElement(), "factor", focus); + checkFixedValue(errors, path + ".lowerLimit", focus.getNamedChild("lowerLimit"), fixed.getLowerLimitElement(), "lowerLimit", focus); + checkFixedValue(errors, path + ".upperLimit", focus.getNamedChild("upperLimit"), fixed.getUpperLimitElement(), "upperLimit", focus); + checkFixedValue(errors, path + ".dimensions", focus.getNamedChild("dimensions"), fixed.getDimensionsElement(), "dimensions", focus); + checkFixedValue(errors, path + ".data", focus.getNamedChild("data"), fixed.getDataElement(), "data", focus); + } + + private void checkTiming(List errors, String path, Element focus, Timing fixed) { + checkFixedValue(errors, path + ".repeat", focus.getNamedChild("repeat"), fixed.getRepeat(), "value", focus); + + List events = new ArrayList(); + focus.getNamedChildren("event", events); + if (rule(errors, IssueType.VALUE, focus.line(), focus.col(), path, events.size() == fixed.getEvent().size(), + "Expected " + Integer.toString(fixed.getEvent().size()) + " but found " + Integer.toString(events.size()) + " event elements")) { + for (int i = 0; i < events.size(); i++) + checkFixedValue(errors, path + ".event", events.get(i), fixed.getEvent().get(i), "event", focus); + } + } + + private boolean codeinExpansion(ValueSetExpansionContainsComponent cnt, String system, String code) { + for (ValueSetExpansionContainsComponent c : cnt.getContains()) { + if (code.equals(c.getCode()) && system.equals(c.getSystem().toString())) + return true; + if (codeinExpansion(c, system, code)) + return true; + } + return false; + } + + private boolean codeInExpansion(ValueSet vs, String system, String code) { + for (ValueSetExpansionContainsComponent c : vs.getExpansion().getContains()) { + if (code.equals(c.getCode()) && (system == null || system.equals(c.getSystem()))) + return true; + if (codeinExpansion(c, system, code)) + return true; + } + return false; + } + + private String describeReference(String reference) { + if (reference == null) + return "null"; + return reference; + } + + private String describeTypes(List types) { + CommaSeparatedStringBuilder b = new CommaSeparatedStringBuilder(); + for (TypeRefComponent t : types) { + b.append(t.getCode()); + } + return b.toString(); + } + + protected ElementDefinition findElement(StructureDefinition profile, String name) { + for (ElementDefinition c : profile.getSnapshot().getElement()) { + if (c.getPath().equals(name)) { + return c; + } + } + return null; + } + + public BestPracticeWarningLevel getBestPracticeWarningLevel() { + return bpWarnings; + } + + private String getBaseType(StructureDefinition profile, String pr) { + StructureDefinition p = resolveProfile(profile, pr); + if (p == null) + return null; + else + return p.getType(); + } + + @Override + public CheckDisplayOption getCheckDisplay() { + return checkDisplay; + } + + // private String findProfileTag(Element element) { + // String uri = null; + // List list = new ArrayList(); + // element.getNamedChildren("category", list); + // for (Element c : list) { + // if ("http://hl7.org/fhir/tag/profile".equals(c.getAttribute("scheme"))) { + // uri = c.getAttribute("term"); + // } + // } + // return uri; + // } + + private ConceptDefinitionComponent getCodeDefinition(ConceptDefinitionComponent c, String code) { + if (code.equals(c.getCode())) + return c; + for (ConceptDefinitionComponent g : c.getConcept()) { + ConceptDefinitionComponent r = getCodeDefinition(g, code); + if (r != null) + return r; + } + return null; + } + + private ConceptDefinitionComponent getCodeDefinition(CodeSystem cs, String code) { + for (ConceptDefinitionComponent c : cs.getConcept()) { + ConceptDefinitionComponent r = getCodeDefinition(c, code); + if (r != null) + return r; + } + return null; + } + + private Element getContainedById(Element container, String id) { + List contained = new ArrayList(); + container.getNamedChildren("contained", contained); + for (Element we : contained) { + if (id.equals(we.getNamedChildValue("id"))) + return we; + } + return null; + } + + public IWorkerContext getContext() { + return context; + } + + private List getCriteriaForDiscriminator(String path, ElementDefinition element, String discriminator, StructureDefinition profile, boolean removeResolve) throws FHIRException { + List elements = new ArrayList(); + if ("value".equals(discriminator) && element.hasFixed()) { + elements.add(element); + return elements; + } + + if (removeResolve) { // if we're doing profile slicing, we don't want to walk into the last resolve.. we need the profile on the source not the target + if (discriminator.equals("resolve()")) { + elements.add(element); + return elements; + } + if (discriminator.endsWith(".resolve()")) + discriminator = discriminator.substring(0, discriminator.length() - 10); + } + + ElementDefinition ed = null; + ExpressionNode expr = fpe.parse(fixExpr(discriminator)); + long t2 = System.nanoTime(); + ed = fpe.evaluateDefinition(expr, profile, element); + sdTime = sdTime + (System.nanoTime() - t2); + if (ed!= null) + elements.add(ed); + + for (TypeRefComponent type: element.getType()) { + for (CanonicalType p: type.getProfile()) { + String id = p.hasExtension(ToolingExtensions.EXT_PROFILE_ELEMENT) ? p.getExtensionString(ToolingExtensions.EXT_PROFILE_ELEMENT) : null; + StructureDefinition sd = context.fetchResource(StructureDefinition.class, p.getValue()); + if (sd == null) + throw new DefinitionException("Unable to resolve profile "+p); + profile = sd; + if (id == null) + element = sd.getSnapshot().getElementFirstRep(); + else { + element = null; + for (ElementDefinition t : sd.getSnapshot().getElement()) { + if (id.equals(t.getId())) + element = t; + } + if (element == null) + throw new DefinitionException("Unable to resolve element "+id+" in profile "+p); + } + expr = fpe.parse(fixExpr(discriminator)); + t2 = System.nanoTime(); + ed = fpe.evaluateDefinition(expr, profile, element); + sdTime = sdTime + (System.nanoTime() - t2); + if (ed != null) + elements.add(ed); + } + } + return elements; + } + + + private Element getExtensionByUrl(List extensions, String urlSimple) { + for (Element e : extensions) { + if (urlSimple.equals(e.getNamedChildValue("url"))) + return e; + } + return null; + } + + public List getExtensionDomains() { + return extensionDomains; + } + + private Element getFromBundle(Element bundle, String ref, String fullUrl, List errors, String path, String type) { + String targetUrl = null; + String version = ""; + if (ref.startsWith("http") || ref.startsWith("urn")) { + // We've got an absolute reference, no need to calculate + if (ref.contains("/_history/")) { + targetUrl = ref.substring(0, ref.indexOf("/_history/") - 1); + version = ref.substring(ref.indexOf("/_history/") + 10); + } else + targetUrl = ref; + + } else if (fullUrl == null) { + //This isn't a problem for signatures - if it's a signature, we won't have a resolution for a relative reference. For anything else, this is an error + // but this rule doesn't apply for batches or transactions + rule(errors, IssueType.REQUIRED, -1, -1, path, Utilities.existsInList(type, "batch-response", "transaction-response") || path.startsWith("Bundle.signature"), "Relative Reference appears inside Bundle whose entry is missing a fullUrl"); + return null; + + } else if (ref.split("/").length!=2 && ref.split("/").length!=4) { + rule(errors, IssueType.INVALID, -1, -1, path, false, "Relative URLs must be of the format [ResourceName]/[id]. Encountered " + ref); + return null; + + } else { + String base = ""; + if (fullUrl.startsWith("urn")) { + String[] parts = fullUrl.split("\\:"); + for (int i=0; i < parts.length-1; i++) { + base = base + parts[i] + ":"; + } + } else { + String[] parts; + parts = fullUrl.split("/"); + for (int i=0; i < parts.length-2; i++) { + base = base + parts[i] + "/"; + } + } + + String id = null; + if (ref.contains("/_history/")) { + version = ref.substring(ref.indexOf("/_history/") + 10); + id = ref.substring(0, ref.indexOf("/_history/")).split("/")[1]; + } else if (base.startsWith("urn")) + id = ref.split("/")[1]; + else + id = ref; + + targetUrl = base + id; + } + + List entries = new ArrayList(); + bundle.getNamedChildren("entry", entries); + Element match = null; + for (Element we : entries) { + if (targetUrl.equals(we.getChildValue("fullUrl"))) { + Element r = we.getNamedChild("resource"); + if (version.isEmpty()) { + rule(errors, IssueType.FORBIDDEN, -1, -1, path, match==null, "Multiple matches in bundle for reference " + ref); + match = r; + } else { + try { + if (version.equals(r.getChildren("meta").get(0).getChildValue("versionId"))) { + rule(errors, IssueType.FORBIDDEN, -1, -1, path, match==null, "Multiple matches in bundle for reference " + ref); + match = r; + } + } catch (Exception e) { + warning(errors, IssueType.REQUIRED, -1, -1, path, r.getChildren("meta").size()==1 && r.getChildren("meta").get(0).getChildValue("versionId")!=null, "Entries matching fullURL " + targetUrl + " should declare meta/versionId because there are version-specific references"); + // If one of these things is null + } + } + } + } + + warning(errors, IssueType.REQUIRED, -1, -1, path, match!=null || !targetUrl.startsWith("urn"), "URN reference is not locally contained within the bundle " + ref); + return match; + } + + private StructureDefinition getProfileForType(String type, List list) { + for (TypeRefComponent tr : list) { + String url = tr.getCode(); + if (!Utilities.isAbsoluteUrl(url)) + url = "http://hl7.org/fhir/StructureDefinition/" + url; + long t = System.nanoTime(); + StructureDefinition sd = context.fetchResource(StructureDefinition.class, url); + sdTime = sdTime + (System.nanoTime() - t); + if (sd != null && (sd.getType().equals(type) || sd.getUrl().equals(type)) && sd.hasSnapshot()) + return sd; + } + return null; + } + + private Element getValueForDiscriminator(Object appContext, List errors, Element element, String discriminator, ElementDefinition criteria, NodeStack stack) throws FHIRException, IOException { + String p = stack.getLiteralPath()+"."+element.getName(); + Element focus = element; + String[] dlist = discriminator.split("\\."); + for (String d : dlist) { + if (focus.fhirType().equals("Reference") && d.equals("reference")) { + String url = focus.getChildValue("reference"); + if (Utilities.noString(url)) + throw new FHIRException("No reference resolving discriminator "+discriminator+" from "+element.getProperty().getName()); + // Note that we use the passed in stack here. This might be a problem if the discriminator is deep enough? + Element target = resolve(appContext, url, stack, errors, p); + if (target == null) + throw new FHIRException("Unable to find resource "+url+" at "+d+" resolving discriminator "+discriminator+" from "+element.getProperty().getName()); + focus = target; + } else if (d.equals("value") && focus.isPrimitive()) { + return focus; + } else { + List children = focus.getChildren(d); + if (children.isEmpty()) + throw new FHIRException("Unable to find "+d+" resolving discriminator "+discriminator+" from "+element.getProperty().getName()); + if (children.size() > 1) + throw new FHIRException("Found "+Integer.toString(children.size())+" items for "+d+" resolving discriminator "+discriminator+" from "+element.getProperty().getName()); + focus = children.get(0); + p = p + "."+d; + } + } + return focus; + } + + private CodeSystem getCodeSystem(String system) { + long t = System.nanoTime(); + try { + return context.fetchCodeSystem(system); + } finally { + txTime = txTime + (System.nanoTime() - t); + } + } + + private boolean hasTime(String fmt) { + return fmt.contains("T"); + } + + private boolean hasTimeZone(String fmt) { + return fmt.length() > 10 && (fmt.substring(10).contains("-") || fmt.substring(10).contains("+") || fmt.substring(10).contains("Z")); + } + + private boolean isAbsolute(String uri) { + return Utilities.noString(uri) || uri.startsWith("http:") || uri.startsWith("https:") || uri.startsWith("urn:uuid:") || uri.startsWith("urn:oid:") || uri.startsWith("urn:ietf:") + || uri.startsWith("urn:iso:") || uri.startsWith("urn:iso-astm:") || isValidFHIRUrn(uri); + } + + private boolean isValidFHIRUrn(String uri) { + return (uri.equals("urn:x-fhir:uk:id:nhs-number")) || uri.startsWith("urn:"); // Anyone can invent a URN, so why should we complain? + } + + public boolean isAnyExtensionsAllowed() { + return anyExtensionsAllowed; + } + + public boolean isErrorForUnknownProfiles() { + return errorForUnknownProfiles; + } + + public void setErrorForUnknownProfiles(boolean errorForUnknownProfiles) { + this.errorForUnknownProfiles = errorForUnknownProfiles; + } + + private boolean isParametersEntry(String path) { + String[] parts = path.split("\\."); + return parts.length > 2 && parts[parts.length - 1].equals("resource") && (pathEntryHasName(parts[parts.length - 2], "parameter") || pathEntryHasName(parts[parts.length - 2], "part")); + } + + private boolean isBundleEntry(String path) { + String[] parts = path.split("\\."); + return parts.length > 2 && parts[parts.length - 1].equals("resource") && pathEntryHasName(parts[parts.length - 2], "entry"); + } + + private boolean isBundleOutcome(String path) { + String[] parts = path.split("\\."); + return parts.length > 2 && parts[parts.length - 1].equals("outcome") && pathEntryHasName(parts[parts.length - 2], "response"); + } + + + private static boolean pathEntryHasName(String thePathEntry, String theName) { + if (thePathEntry.equals(theName)) { + return true; + } + if (thePathEntry.length() >= theName.length() + 3) { + if (thePathEntry.startsWith(theName)) { + if (thePathEntry.charAt(theName.length()) == '[') { + return true; + } + } + } + return false; + } + + private boolean isPrimitiveType(String code) { + StructureDefinition sd = context.fetchTypeDefinition(code); + return sd != null && sd.getKind() == StructureDefinitionKind.PRIMITIVETYPE; + } + + + + public boolean isSuppressLoincSnomedMessages() { + return suppressLoincSnomedMessages; + } + + private boolean nameMatches(String name, String tail) { + if (tail.endsWith("[x]")) + return name.startsWith(tail.substring(0, tail.length() - 3)); + else + return (name.equals(tail)); + } + + // private String mergePath(String path1, String path2) { + // // path1 is xpath path + // // path2 is dotted path + // String[] parts = path2.split("\\."); + // StringBuilder b = new StringBuilder(path1); + // for (int i = 1; i < parts.length -1; i++) + // b.append("/f:"+parts[i]); + // return b.toString(); + // } + + private boolean passesCodeWhitespaceRules(String v) { + if (!v.trim().equals(v)) + return false; + boolean lastWasSpace = true; + for (char c : v.toCharArray()) { + if (c == ' ') { + if (lastWasSpace) + return false; + else + lastWasSpace = true; + } else if (Character.isWhitespace(c)) + return false; + else + lastWasSpace = false; + } + return true; + } + + private Element localResolve(String ref, NodeStack stack, List errors, String path) { + if (ref.startsWith("#")) { + // work back through the contained list. + // really, there should only be one level for this (contained resources cannot contain + // contained resources), but we'll leave that to some other code to worry about + while (stack != null && stack.getElement() != null) { + if (stack.getElement().getProperty().isResource()) { + // ok, we'll try to find the contained reference + Element res = getContainedById(stack.getElement(), ref.substring(1)); + if (res != null) + return res; + } + if (stack.getElement().getSpecial() == SpecialElement.BUNDLE_ENTRY) { + return null; // we don't try to resolve contained references across this boundary + } + stack = stack.parent; + } + return null; + } else { + // work back through the contained list - if any of them are bundles, try to resolve + // the resource in the bundle + String fullUrl = null; // we're going to try to work this out as we go up + while (stack != null && stack.getElement() != null) { + if (stack.getElement().getSpecial() == SpecialElement.BUNDLE_ENTRY && fullUrl==null && stack.parent != null && stack.parent.getElement().getName().equals("entry")) { + String type = stack.parent.parent.element.getChildValue("type"); + fullUrl = stack.parent.getElement().getChildValue("fullUrl"); // we don't try to resolve contained references across this boundary + if (fullUrl==null) + rule(errors, IssueType.REQUIRED, stack.parent.getElement().line(), stack.parent.getElement().col(), stack.parent.getLiteralPath(), + Utilities.existsInList(type, "batch-response", "transaction-response") || fullUrl!=null, "Bundle entry missing fullUrl"); + } + if ("Bundle".equals(stack.getElement().getType())) { + String type = stack.getElement().getChildValue("type"); + Element res = getFromBundle(stack.getElement(), ref, fullUrl, errors, path, type); + return res; + } + stack = stack.parent; + } + } + return null; + } + + private Element resolve(Object appContext, String ref, NodeStack stack, List errors, String path) throws IOException, FHIRException { + Element local = localResolve(ref, stack, errors, path); + if (local!=null) + return local; + if (fetcher == null) + return null; + return fetcher.fetch(appContext, ref); + } + + private ValueSet resolveBindingReference(DomainResource ctxt, String reference, String uri) { + if (reference != null) { + if (reference.startsWith("#")) { + for (Resource c : ctxt.getContained()) { + if (c.getId().equals(reference.substring(1)) && (c instanceof ValueSet)) + return (ValueSet) c; + } + return null; + } else { + long t = System.nanoTime(); + if (!Utilities.isAbsoluteUrl(reference)) + reference = resolve(uri, reference); + ValueSet fr = context.fetchResource(ValueSet.class, reference); + txTime = txTime + (System.nanoTime() - t); + return fr; + } + } else + return null; + } + + private String resolve(String uri, String ref) { + if (isBlank(uri)) { + return ref; + } + String[] up = uri.split("\\/"); + String[] rp = ref.split("\\/"); + if (context.getResourceNames().contains(up[up.length-2]) && context.getResourceNames().contains(rp[0])) { + StringBuilder b = new StringBuilder(); + for (int i = 0; i < up.length-2; i++) { + b.append(up[i]); + b.append("/"); + } + b.append(ref); + return b.toString(); + } else + return ref; + } + + private Element resolveInBundle(List entries, String ref, String fullUrl, String type, String id) { + if (Utilities.isAbsoluteUrl(ref)) { + // if the reference is absolute, then you resolve by fullUrl. No other thinking is required. + for (Element entry : entries) { + String fu = entry.getNamedChildValue("fullUrl"); + if (ref.equals(fu)) + return entry; + } + return null; + } else { + // split into base, type, and id + String u = null; + if (fullUrl != null && fullUrl.endsWith(type+"/"+id)) + // fullUrl = complex + u = fullUrl.substring((type+"/"+id).length())+ref; + String[] parts = ref.split("\\/"); + if (parts.length >= 2) { + String t = parts[0]; + String i = parts[1]; + for (Element entry : entries) { + String fu = entry.getNamedChildValue("fullUrl"); + if (u != null && fullUrl.equals(u)) + return entry; + if (u == null) { + Element resource = entry.getNamedChild("resource"); + String et = resource.getType(); + String eid = resource.getNamedChildValue("id"); + if (t.equals(et) && i.equals(eid)) + return entry; + } + } + } + return null; + } + } + + private ElementDefinition resolveNameReference(StructureDefinitionSnapshotComponent snapshot, String contentReference) { + for (ElementDefinition ed : snapshot.getElement()) + if (contentReference.equals("#"+ed.getId())) + return ed; + return null; + } + + private StructureDefinition resolveProfile(StructureDefinition profile, String pr) { + if (pr.startsWith("#")) { + for (Resource r : profile.getContained()) { + if (r.getId().equals(pr.substring(1)) && r instanceof StructureDefinition) + return (StructureDefinition) r; + } + return null; + } else { + long t = System.nanoTime(); + StructureDefinition fr = context.fetchResource(StructureDefinition.class, pr); + sdTime = sdTime + (System.nanoTime() - t); + return fr; + } + } + + private ElementDefinition resolveType(String type, List list) { + for (TypeRefComponent tr : list) { + String url = tr.getCode(); + if (!Utilities.isAbsoluteUrl(url)) + url = "http://hl7.org/fhir/StructureDefinition/" + url; + long t = System.nanoTime(); + StructureDefinition sd = context.fetchResource(StructureDefinition.class, url); + sdTime = sdTime + (System.nanoTime() - t); + if (sd != null && (sd.getType().equals(type) || sd.getUrl().equals(type)) && sd.hasSnapshot()) + return sd.getSnapshot().getElement().get(0); + } + return null; + } + + public void setAnyExtensionsAllowed(boolean anyExtensionsAllowed) { + this.anyExtensionsAllowed = anyExtensionsAllowed; + } + + public IResourceValidator setBestPracticeWarningLevel(BestPracticeWarningLevel value) { + bpWarnings = value; + return this; + } + + @Override + public void setCheckDisplay(CheckDisplayOption checkDisplay) { + this.checkDisplay = checkDisplay; + } + + public void setSuppressLoincSnomedMessages(boolean suppressLoincSnomedMessages) { + this.suppressLoincSnomedMessages = suppressLoincSnomedMessages; + } + + public IdStatus getResourceIdRule() { + return resourceIdRule; + } + + public void setResourceIdRule(IdStatus resourceIdRule) { + this.resourceIdRule = resourceIdRule; + } + + + public boolean isAllowXsiLocation() { + return allowXsiLocation; + } + + public void setAllowXsiLocation(boolean allowXsiLocation) { + this.allowXsiLocation = allowXsiLocation; + } + + public void setEnableWhenEvaluator(IEnableWhenEvaluator myEnableWhenEvaluator) { + this.myEnableWhenEvaluator = myEnableWhenEvaluator; + } + + /** + * + * @param element + * - the candidate that might be in the slice + * @param path + * - for reporting any errors. the XPath for the element + * @param slicer + * - the definition of how slicing is determined + * @param ed + * - the slice for which to test membership + * @param errors + * @param stack + * @return + * @throws DefinitionException + * @throws DefinitionException + * @throws IOException + * @throws FHIRException + */ + private boolean sliceMatches(ValidatorHostContext hostContext, Element element, String path, ElementDefinition slicer, ElementDefinition ed, StructureDefinition profile, List errors, NodeStack stack) throws DefinitionException, FHIRException, IOException { + if (!slicer.getSlicing().hasDiscriminator()) + return false; // cannot validate in this case + + ExpressionNode n = (ExpressionNode) ed.getUserData("slice.expression.cache"); + if (n == null) { + long t = System.nanoTime(); + // GG: this approach is flawed because it treats discriminators individually rather than collectively + StringBuilder expression = new StringBuilder("true"); + for (ElementDefinitionSlicingDiscriminatorComponent s : slicer.getSlicing().getDiscriminator()) { + String discriminator = s.getPath(); + + List criteriaElements = getCriteriaForDiscriminator(path, ed, discriminator, profile, s.getType() == DiscriminatorType.PROFILE); + boolean found = false; + for (ElementDefinition criteriaElement : criteriaElements) { + found = true; + if (s.getType() == DiscriminatorType.TYPE) { + String type = null; + if (!criteriaElement.getPath().contains("[") && discriminator.contains("[")) { + discriminator = discriminator.substring(0, discriminator.indexOf('[')); + String lastNode = tail(discriminator); + type = tail(criteriaElement.getPath()).substring(lastNode.length()); + type = type.substring(0,1).toLowerCase() + type.substring(1); + } else if (!criteriaElement.hasType() || criteriaElement.getType().size()==1) { + if (discriminator.contains("[")) + discriminator = discriminator.substring(0, discriminator.indexOf('[')); + type = criteriaElement.getType().get(0).getCode(); + } + if (type==null) + throw new DefinitionException("Discriminator (" + discriminator + ") is based on type, but slice " + ed.getId() + " does not declare a type"); + if (discriminator.isEmpty()) + expression.append(" and this is " + type); + else + expression.append(" and " + discriminator + " is " + type); + } else if (s.getType() == DiscriminatorType.PROFILE) { + if (criteriaElement.getType().size() == 0) + throw new DefinitionException("Profile based discriminators nust have a type ("+criteriaElement.getId()+")"); + if (criteriaElement.getType().size() != 1) + throw new DefinitionException("Profile based discriminators nust have only one type ("+criteriaElement.getId()+")"); + List list = discriminator.endsWith(".resolve()") || discriminator.equals("resolve()") ? criteriaElement.getType().get(0).getTargetProfile() : criteriaElement.getType().get(0).getProfile(); + if (list.size() == 0) + throw new DefinitionException("Profile based discriminators nust have a type with a profile ("+criteriaElement.getId()+")"); + if (list.size() > 1) + throw new DefinitionException("Profile based discriminators nust have a type with only one profile ("+criteriaElement.getId()+")"); + expression.append(" and "+discriminator+".conformsTo('"+list.get(0).getValue()+"')"); + } else if (s.getType() == DiscriminatorType.EXISTS) { + if (criteriaElement.hasMin() && criteriaElement.getMin()>=1) + expression.append(" and (" + discriminator + ".exists())"); + else if (criteriaElement.hasMax() && criteriaElement.getMax().equals("0")) + expression.append(" and (" + discriminator + ".exists().not())"); + else + throw new FHIRException("Discriminator (" + discriminator + ") is based on element existence, but slice " + ed.getId() + " neither sets min>=1 or max=0"); + } else if (criteriaElement.hasFixed()) { + buildFixedExpression(ed, expression, discriminator, criteriaElement); + } else if (criteriaElement.hasPattern()) { + buildPattternExpression(ed, expression, discriminator, criteriaElement); + } else if (criteriaElement.hasBinding() && criteriaElement.getBinding().hasStrength() && criteriaElement.getBinding().getStrength().equals(BindingStrength.REQUIRED) && criteriaElement.getBinding().hasValueSet()) { + expression.append(" and (" + discriminator + " memberOf '" + criteriaElement.getBinding().getValueSet() + "')"); + } else { + found = false; + } + if (found) + break; + } + if (!found) + throw new DefinitionException("Could not match discriminator (" + discriminator + ") for slice " + ed.getId() + " in profile " + profile.getUrl() + " - does not have fixed value, binding or existence assertions"); + } + + try { + n = fpe.parse(fixExpr(expression.toString())); + } catch (FHIRLexerException e) { + throw new FHIRException("Problem processing expression "+expression +" in profile " + profile.getUrl() + " path " + path + ": " + e.getMessage()); + } + fpeTime = fpeTime + (System.nanoTime() - t); + ed.setUserData("slice.expression.cache", n); + } + + return evaluateSlicingExpression(hostContext, element, path, profile, n); + } + + public boolean evaluateSlicingExpression(ValidatorHostContext hostContext, Element element, String path, StructureDefinition profile, ExpressionNode n) throws FHIRException { + String msg; + boolean ok; + try { + long t = System.nanoTime(); + ok = fpe.evaluateToBoolean(hostContext, hostContext.resource, element, n); + fpeTime = fpeTime + (System.nanoTime() - t); + msg = fpe.forLog(); + } catch (Exception ex) { + ex.printStackTrace(); + throw new FHIRException("Problem evaluating slicing expression for element in profile " + profile.getUrl() + " path " + path + " (fhirPath = "+n+"): " + ex.getMessage()); + } + return ok; + } + + private void buildPattternExpression(ElementDefinition ed, StringBuilder expression, String discriminator, ElementDefinition criteriaElement) throws DefinitionException { + Type pattern = criteriaElement.getPattern(); + if (pattern instanceof CodeableConcept) { + CodeableConcept cc = (CodeableConcept) pattern; + buildCodeableConceptExpression(ed, expression, discriminator, cc); + } else + throw new DefinitionException("Unsupported fixed pattern type for discriminator(" + discriminator + ") for slice " + ed.getId() + ": " + pattern.getClass().getName()); + } + + private void buildCodeableConceptExpression(ElementDefinition ed, StringBuilder expression, String discriminator, CodeableConcept cc) + throws DefinitionException { + if (cc.hasText()) + throw new DefinitionException("Unsupported CodeableConcept pattern - using text - for discriminator(" + discriminator + ") for slice " + ed.getId()); + if (!cc.hasCoding() || cc.getCoding().size() > 1) + throw new DefinitionException("Unsupported CodeableConcept pattern - must be just one coding - for discriminator(" + discriminator + ") for slice " + ed.getId()); + Coding c = cc.getCodingFirstRep(); + if (c.hasExtension() || cc.hasExtension()) + throw new DefinitionException("Unsupported CodeableConcept pattern - extensions are not allowed - for discriminator(" + discriminator + ") for slice " + ed.getId()); + expression.append(" and " + discriminator + ".coding.where("); + boolean first = true; + if (c.hasSystem()) { + first = false; + expression.append("system = '"+c.getSystem()+"'"); + } + if (c.hasVersion()) { + if (first) first = false; else expression.append(" and "); + expression.append("version = '"+c.getVersion()+"'"); + } + if (c.hasCode()) { + if (first) first = false; else expression.append(" and "); + expression.append("code = '"+c.getCode()+"'"); + } + if (c.hasDisplay()) { + if (first) first = false; else expression.append(" and "); + expression.append("display = '"+c.getDisplay()+"'"); + } + expression.append(").exists()"); + } + + private void buildFixedExpression(ElementDefinition ed, StringBuilder expression, String discriminator, ElementDefinition criteriaElement) throws DefinitionException { + Type fixed = criteriaElement.getFixed(); + if (fixed instanceof CodeableConcept) { + CodeableConcept cc = (CodeableConcept) fixed; + buildCodeableConceptExpression(ed, expression, discriminator, cc); + } else { + expression.append(" and (" + discriminator + " = "); + if (fixed instanceof StringType) { + Gson gson = new Gson(); + String json = gson.toJson((StringType)fixed); + String escapedString = json.substring(json.indexOf(":")+2); + escapedString = escapedString.substring(0, escapedString.indexOf(",\"myStringValue")-1); + expression.append("'" + escapedString + "'"); + } else if (fixed instanceof UriType) { + expression.append("'" + ((UriType)fixed).asStringValue() + "'"); + } else if (fixed instanceof IntegerType) { + expression.append(((IntegerType)fixed).asStringValue()); + } else if (fixed instanceof DecimalType) { + expression.append(((IntegerType)fixed).asStringValue()); + } else if (fixed instanceof BooleanType) { + expression.append(((BooleanType)fixed).asStringValue()); + } else + throw new DefinitionException("Unsupported fixed value type for discriminator(" + discriminator + ") for slice " + ed.getId() + ": " + fixed.getClass().getName()); + expression.append(")"); + } + } + + // we assume that the following things are true: + // the instance at root is valid against the schema and schematron + // the instance validator had no issues against the base resource profile + private void start(ValidatorHostContext hostContext, List errors, Element resource, Element element, StructureDefinition defn, NodeStack stack) throws FHIRException, FHIRException, IOException { + // profile is valid, and matches the resource name + ResourceProfiles resourceProfiles = getResourceProfiles(element, stack); + if (!resourceProfiles.isProcessed()) + checkDeclaredProfiles(resourceProfiles, errors, resource, element, stack); + + if (!resourceProfiles.isProcessed()) { + resourceProfiles.setProcessed(); + if (!resourceProfiles.hasProfiles() && + (rule(errors, IssueType.STRUCTURE, element.line(), element.col(), stack.getLiteralPath(), defn.hasSnapshot(), + "StructureDefinition has no snapshot - validation is against the snapshot, so it must be provided"))) { + // Don't need to validate against the resource if there's a profile because the profile snapshot will include the relevant parts of the resources + validateElement(hostContext, errors, defn, defn.getSnapshot().getElement().get(0), null, null, resource, element, element.getName(), stack, false); + } + + // specific known special validations + if (element.getType().equals("Bundle")) + validateBundle(errors, element, stack); + else if (element.getType().equals("Observation")) + validateObservation(errors, element, stack); + else if (element.getType().equals("QuestionnaireResponse")) + validateQuestionannaireResponse(errors, element, stack); + else if (element.getType().equals("CodeSystem")) + validateCodeSystem(errors, element, stack); + validateResourceRules(errors, element, stack); + } + for (ProfileUsage profileUsage : resourceProfiles.uncheckedProfiles()) { + profileUsage.setChecked(); +// todo: re-enable this when I can deal with the impact... (GG) +// if (!profileUsage.getProfile().getType().equals(resource.fhirType())) +// throw new FHIRException("Profile type mismatch - resource is "+resource.fhirType()+", and profile is for "+profileUsage.getProfile().getType()); + validateElement(hostContext, errors, profileUsage.getProfile(), profileUsage.getProfile().getSnapshot().getElement().get(0), null, null, resource, element, element.getName(), stack, false); + } + } + + private void validateResourceRules(List errors, Element element, NodeStack stack) { + String lang = element.getNamedChildValue("language"); + Element text = element.getNamedChild("text"); + if (text != null) { + Element div = text.getNamedChild("div"); + if (lang != null && div != null) { + XhtmlNode xhtml = div.getXhtml(); + String xl = xhtml.getAttribute("lang"); + if (xl == null) { + warning(errors, IssueType.BUSINESSRULE, div.line(), div.col(), stack.getLiteralPath(), false, "Resource has a language, but the XHTML does not have a language tag"); + } else if (!xl.equals(lang)) { + warning(errors, IssueType.BUSINESSRULE, div.line(), div.col(), stack.getLiteralPath(), false, "Resource has a language ("+lang+"), and the XHTML has a language ("+xl+"), but they differ "); + } + } + } + } + + private void validateCodeSystem(List errors, Element cs, NodeStack stack) { + String url = cs.getNamedChildValue("url"); + String vsu = cs.getNamedChildValue("valueSet"); + if (!Utilities.noString(vsu)) { + ValueSet vs; + try { + vs = context.fetchResourceWithException(ValueSet.class, vsu); + } catch (FHIRException e) { + vs = null; + } + if (vs != null) { + if (rule(errors, IssueType.BUSINESSRULE, stack.getLiteralPath(), vs.hasCompose() && !vs.hasExpansion(), "CodeSystem "+url+" has a 'all system' value set of "+vsu+", but it is an expansion")) + if (rule(errors, IssueType.BUSINESSRULE, stack.getLiteralPath(), vs.getCompose().getInclude().size() == 1, "CodeSystem "+url+" has a 'all system' value set of "+vsu+", but doesn't have a single include")) + if (rule(errors, IssueType.BUSINESSRULE, stack.getLiteralPath(), vs.getCompose().getInclude().get(0).getSystem().equals(url), "CodeSystem "+url+" has a 'all system' value set of "+vsu+", but doesn't have a matching system ("+vs.getCompose().getInclude().get(0).getSystem()+")")) { + rule(errors, IssueType.BUSINESSRULE, stack.getLiteralPath(), !vs.getCompose().getInclude().get(0).hasValueSet() + && !vs.getCompose().getInclude().get(0).hasConcept() && !vs.getCompose().getInclude().get(0).hasFilter(), "CodeSystem "+url+" has a 'all system' value set of "+vsu+", but the include has extra details"); + } + } + } // todo... try getting the value set the other way... + } + + private void validateQuestionannaireResponse(List errors, Element element, NodeStack stack) { + Element q = element.getNamedChild("questionnaire"); + String questionnaire = null; + if (q != null) { + /* + * q.getValue() is correct for R4 content, but we'll also accept the second + * option just in case we're validating raw STU3 content. Being lenient here + * isn't the end of the world since if someone is actually doing the reference + * wrong in R4 content it'll get flagged elsewhere by the validator too + */ + if (isNotBlank(q.getValue())) { + questionnaire = q.getValue(); + } else if (isNotBlank(q.getChildValue("reference"))) { + questionnaire = q.getChildValue("reference"); + } + } + if (hint(errors, IssueType.REQUIRED, element.line(), element.col(), stack.getLiteralPath(), questionnaire != null, "No questionnaire is identified, so no validation can be performed against the base questionnaire")) { + long t = System.nanoTime(); + Questionnaire qsrc = context.fetchResource(Questionnaire.class, questionnaire); + sdTime = sdTime + (System.nanoTime() - t); + if (warning(errors, IssueType.REQUIRED, q.line(), q.col(), stack.getLiteralPath(), qsrc != null, "The questionnaire \""+questionnaire+"\" could not be resolved, so no validation can be performed against the base questionnaire")) { + boolean inProgress = "in-progress".equals(element.getNamedChildValue("status")); + validateQuestionannaireResponseItems(qsrc, qsrc.getItem(), errors, element, stack, inProgress, element); + } + } + } + + private void validateQuestionannaireResponseItem(Questionnaire qsrc, QuestionnaireItemComponent qItem, List errors, Element element, NodeStack stack, boolean inProgress, Element questionnaireResponseRoot) { + String text = element.getNamedChildValue("text"); + rule(errors, IssueType.INVALID, element.line(), element.col(), stack.getLiteralPath(), Utilities.noString(text) || text.equals(qItem.getText()), "If text exists, it must match the questionnaire definition for linkId "+qItem.getLinkId()); + + List answers = new ArrayList(); + element.getNamedChildren("answer", answers); + if (inProgress) + warning(errors, IssueType.REQUIRED, element.line(), element.col(), stack.getLiteralPath(), isAnswerRequirementFulfilled(qItem, answers), "No response answer found for required item "+qItem.getLinkId()); + else + rule(errors, IssueType.REQUIRED, element.line(), element.col(), stack.getLiteralPath(), isAnswerRequirementFulfilled(qItem, answers), "No response answer found for required item "+qItem.getLinkId()); + if (answers.size() > 1) + rule(errors, IssueType.INVALID, answers.get(1).line(), answers.get(1).col(), stack.getLiteralPath(), qItem.getRepeats(), "Only one response answer item with this linkId allowed"); + + for (Element answer : answers) { + NodeStack ns = stack.push(answer, -1, null, null); + switch (qItem.getType()) { + case GROUP: + rule(errors, IssueType.STRUCTURE, answer.line(), answer.col(), stack.getLiteralPath(), false, "Items of type group should not have answers"); + break; + case DISPLAY: // nothing + break; + case BOOLEAN: + validateQuestionnaireResponseItemType(errors, answer, ns, "boolean"); + break; + case DECIMAL: + validateQuestionnaireResponseItemType(errors, answer, ns, "decimal"); + break; + case INTEGER: + validateQuestionnaireResponseItemType(errors, answer, ns, "integer"); + break; + case DATE: + validateQuestionnaireResponseItemType(errors, answer, ns, "date"); + break; + case DATETIME: + validateQuestionnaireResponseItemType(errors, answer, ns, "dateTime"); + break; + case TIME: + validateQuestionnaireResponseItemType(errors, answer, ns, "time"); + break; + case STRING: + validateQuestionnaireResponseItemType(errors, answer, ns, "string"); + break; + case TEXT: + validateQuestionnaireResponseItemType(errors, answer, ns, "text"); + break; + case URL: + validateQuestionnaireResponseItemType(errors, answer, ns, "uri"); + break; + case ATTACHMENT: + validateQuestionnaireResponseItemType(errors, answer, ns, "Attachment"); + break; + case REFERENCE: + validateQuestionnaireResponseItemType(errors, answer, ns, "Reference"); + break; + case QUANTITY: + if ("Quantity".equals(validateQuestionnaireResponseItemType(errors, answer, ns, "Quantity"))) + if (qItem.hasExtension("???")) + validateQuestionnaireResponseItemQuantity(errors, answer, ns); + break; + case CHOICE: + String itemType=validateQuestionnaireResponseItemType(errors, answer, ns, "Coding", "date", "time", "integer", "string"); + if (itemType != null) { + if (itemType.equals("Coding")) validateAnswerCode(errors, answer, ns, qsrc, qItem, false); + else if (itemType.equals("date")) checkOption(errors, answer, ns, qsrc, qItem, "date"); + else if (itemType.equals("time")) checkOption(errors, answer, ns, qsrc, qItem, "time"); + else if (itemType.equals("integer")) checkOption(errors, answer, ns, qsrc, qItem, "integer"); + else if (itemType.equals("string")) checkOption(errors, answer, ns, qsrc, qItem, "string"); + } + break; + case OPENCHOICE: + itemType=validateQuestionnaireResponseItemType(errors, answer, ns, "Coding", "date", "time", "integer", "string"); + if (itemType != null) { + if (itemType.equals("Coding")) validateAnswerCode(errors, answer, ns, qsrc, qItem, true); + else if (itemType.equals("date")) checkOption(errors, answer, ns, qsrc, qItem, "date"); + else if (itemType.equals("time")) checkOption(errors, answer, ns, qsrc, qItem, "time"); + else if (itemType.equals("integer")) checkOption(errors, answer, ns, qsrc, qItem, "integer"); + else if (itemType.equals("string")) checkOption(errors, answer, ns, qsrc, qItem, "string", true); + } + break; + case QUESTION: + case NULL: + // no validation + break; + } + validateQuestionannaireResponseItems(qsrc, qItem.getItem(), errors, answer, stack, inProgress, questionnaireResponseRoot); + } + if (qItem.getType() == null) { + fail(errors, IssueType.REQUIRED, element.line(), element.col(), stack.getLiteralPath(), false, "Definition for item "+qItem.getLinkId() + " does not contain a type"); + } else if (qItem.getType() == QuestionnaireItemType.DISPLAY) { + List items = new ArrayList(); + element.getNamedChildren("item", items); + rule(errors, IssueType.STRUCTURE, element.line(), element.col(), stack.getLiteralPath(), items.isEmpty(), "Items not of type DISPLAY should not have items - linkId {0}", qItem.getLinkId()); + } else { + validateQuestionannaireResponseItems(qsrc, qItem.getItem(), errors, element, stack, inProgress, questionnaireResponseRoot); + } + } + +private boolean isAnswerRequirementFulfilled(QuestionnaireItemComponent qItem, List answers) { + return !answers.isEmpty() || !qItem.getRequired() || qItem.getType() == QuestionnaireItemType.GROUP; +} + + private void validateQuestionannaireResponseItem(Questionnaire qsrc, QuestionnaireItemComponent qItem, List errors, List elements, NodeStack stack, boolean inProgress, Element questionnaireResponseRoot) { + if (elements.size() > 1) + rule(errors, IssueType.INVALID, elements.get(1).line(), elements.get(1).col(), stack.getLiteralPath(), qItem.getRepeats(), "Only one response item with this linkId allowed - " + qItem.getLinkId()); + for (Element element : elements) { + NodeStack ns = stack.push(element, -1, null, null); + validateQuestionannaireResponseItem(qsrc, qItem, errors, element, ns, inProgress, questionnaireResponseRoot); + } + } + + private int getLinkIdIndex(List qItems, String linkId) { + for (int i = 0; i < qItems.size(); i++) { + if (linkId.equals(qItems.get(i).getLinkId())) + return i; + } + return -1; + } + + private void validateQuestionannaireResponseItems(Questionnaire qsrc, List qItems, List errors, Element element, NodeStack stack, boolean inProgress, Element questionnaireResponseRoot) { + List items = new ArrayList(); + element.getNamedChildren("item", items); + // now, sort into stacks + Map> map = new HashMap>(); + int lastIndex = -1; + for (Element item : items) { + String linkId = item.getNamedChildValue("linkId"); + if (rule(errors, IssueType.REQUIRED, item.line(), item.col(), stack.getLiteralPath(), !Utilities.noString(linkId), "No LinkId, so can't be validated")) { + int index = getLinkIdIndex(qItems, linkId); + if (index == -1) { + QuestionnaireItemComponent qItem = findQuestionnaireItem(qsrc, linkId); + if (qItem != null) { + rule(errors, IssueType.STRUCTURE, item.line(), item.col(), stack.getLiteralPath(), index > -1, misplacedItemError(qItem)); + NodeStack ns = stack.push(item, -1, null, null); + validateQuestionannaireResponseItem(qsrc, qItem, errors, item, ns, inProgress, questionnaireResponseRoot); + } + else + rule(errors, IssueType.NOTFOUND, item.line(), item.col(), stack.getLiteralPath(), index > -1, "LinkId \""+linkId+"\" not found in questionnaire"); + } + else + { + rule(errors, IssueType.STRUCTURE, item.line(), item.col(), stack.getLiteralPath(), index >= lastIndex, "Structural Error: items are out of order"); + lastIndex = index; + + List mapItem = map.computeIfAbsent(linkId, key -> new ArrayList<>()); + + mapItem.add(item); + } + } + } + + // ok, now we have a list of known items, grouped by linkId. We"ve made an error for anything out of order + for (QuestionnaireItemComponent qItem : qItems) { + List mapItem = map.get(qItem.getLinkId()); + if (mapItem != null){ + rule(errors, IssueType.INVALID, element.line(), element.col(), stack.getLiteralPath(), myEnableWhenEvaluator.isQuestionEnabled(qItem, questionnaireResponseRoot), "Item has answer, even though it is not enabled "+qItem.getLinkId()); + validateQuestionannaireResponseItem(qsrc, qItem, errors, mapItem, stack, inProgress, questionnaireResponseRoot); + } else { + //item is missing, is the question enabled? + if (myEnableWhenEvaluator.isQuestionEnabled(qItem, questionnaireResponseRoot)) { + rule(errors, IssueType.REQUIRED, element.line(), element.col(), stack.getLiteralPath(), !qItem.getRequired(), "No response found for required item "+qItem.getLinkId()); + } + } + } + } + +private String misplacedItemError(QuestionnaireItemComponent qItem) { + return qItem.hasLinkId() ? + String.format("Structural Error: item with linkid %s is in the wrong place", qItem.getLinkId()) + : + "Structural Error: item is in the wrong place"; +} + + private void validateQuestionnaireResponseItemQuantity( List errors, Element answer, NodeStack stack) { + + } + + private String validateQuestionnaireResponseItemType(List errors, Element element, NodeStack stack, String... types) { + List values = new ArrayList(); + element.getNamedChildrenWithWildcard("value[x]", values); + for (int i = 0; i < types.length; i++) { + if (types[i].equals("text")) { + types[i] = "string"; + } + } + if (values.size() > 0) { + NodeStack ns = stack.push(values.get(0), -1, null, null); + CommaSeparatedStringBuilder l = new CommaSeparatedStringBuilder(); + for (String s : types) { + l.append(s); + if (values.get(0).getName().equals("value"+Utilities.capitalize(s))) + return(s); + } + if (types.length == 1) + rule(errors, IssueType.STRUCTURE, values.get(0).line(), values.get(0).col(), ns.getLiteralPath(), false, "Answer value must be of type "+types[0]); + else + rule(errors, IssueType.STRUCTURE, values.get(0).line(), values.get(0).col(), ns.getLiteralPath(), false, "Answer value must be one of the types "+l.toString()); + } + return null; + } + + private QuestionnaireItemComponent findQuestionnaireItem(Questionnaire qSrc, String linkId) { + return findItem(qSrc.getItem(), linkId); + } + + private QuestionnaireItemComponent findItem(List list, String linkId) { + for (QuestionnaireItemComponent item : list) { + if (linkId.equals(item.getLinkId())) + return item; + QuestionnaireItemComponent result = findItem(item.getItem(), linkId); + if (result != null) + return result; + } + return null; + } + + /* private void validateAnswerCode(List errors, Element value, NodeStack stack, List optionList) { + String system = value.getNamedChildValue("system"); + String code = value.getNamedChildValue("code"); + boolean found = false; + for (Coding c : optionList) { + if (ObjectUtil.equals(c.getSystem(), system) && ObjectUtil.equals(c.getCode(), code)) { + found = true; + break; + } + } + rule(errors, IssueType.STRUCTURE, value.line(), value.col(), stack.getLiteralPath(), found, "The code "+system+"::"+code+" is not a valid option"); + }*/ + + private void validateAnswerCode(List errors, Element value, NodeStack stack, Questionnaire qSrc, String ref, boolean theOpenChoice) { + ValueSet vs = resolveBindingReference(qSrc, ref, qSrc.getUrl()); + if (warning(errors, IssueType.CODEINVALID, value.line(), value.col(), stack.getLiteralPath(), vs != null, "ValueSet " + describeReference(ref) + " not found")) { + try { + Coding c = ObjectConverter.readAsCoding(value); + if (isBlank(c.getCode()) && isBlank(c.getSystem()) && isNotBlank(c.getDisplay())) { + if (theOpenChoice) { + return; + } + } + + long t = System.nanoTime(); + ValidationResult res = context.validateCode(c, vs); + txTime = txTime + (System.nanoTime() - t); + if (!res.isOk()) { + txRule(errors, res.getTxLink(), IssueType.CODEINVALID, value.line(), value.col(), stack.getLiteralPath(), false, "The value provided (" + c.getSystem() + "::" + c.getCode() + ") is not in the options value set in the questionnaire"); + } else if (res.getSeverity() != null) { + super.addValidationMessage(errors, IssueType.CODEINVALID, value.line(), value.col(), stack.getLiteralPath(), res.getMessage(), res.getSeverity(), Source.TerminologyEngine); + } + } catch (Exception e) { + warning(errors, IssueType.CODEINVALID, value.line(), value.col(), stack.getLiteralPath(), false, "Error " + e.getMessage() + " validating Coding against Questionnaire Options"); + } + } + } + + private void validateAnswerCode( List errors, Element answer, NodeStack stack, Questionnaire qSrc, QuestionnaireItemComponent qItem, boolean theOpenChoice) { + Element v = answer.getNamedChild("valueCoding"); + NodeStack ns = stack.push(v, -1, null, null); + if (qItem.getAnswerOption().size() > 0) + checkCodingOption(errors, answer, stack, qSrc, qItem, theOpenChoice); + // validateAnswerCode(errors, v, stack, qItem.getOption()); + else if (qItem.hasAnswerValueSet()) + validateAnswerCode(errors, v, stack, qSrc, qItem.getAnswerValueSet(), theOpenChoice); + else + hint(errors, IssueType.STRUCTURE, v.line(), v.col(), stack.getLiteralPath(), false, "Cannot validate options because no option or options are provided"); + } + + private void checkOption( List errors, Element answer, NodeStack stack, Questionnaire qSrc, QuestionnaireItemComponent qItem, String type) { + checkOption(errors, answer, stack, qSrc, qItem, type, false); + } + + private void checkOption( List errors, Element answer, NodeStack stack, Questionnaire qSrc, QuestionnaireItemComponent qItem, String type, boolean openChoice) { + if (type.equals("integer")) checkIntegerOption(errors, answer, stack, qSrc, qItem, openChoice); + else if (type.equals("date")) checkDateOption(errors, answer, stack, qSrc, qItem, openChoice); + else if (type.equals("time")) checkTimeOption(errors, answer, stack, qSrc, qItem, openChoice); + else if (type.equals("string")) checkStringOption(errors, answer, stack, qSrc, qItem, openChoice); + else if (type.equals("Coding")) checkCodingOption(errors, answer, stack, qSrc, qItem, openChoice); + } + + private void checkIntegerOption( List errors, Element answer, NodeStack stack, Questionnaire qSrc, QuestionnaireItemComponent qItem, boolean openChoice) { + Element v = answer.getNamedChild("valueInteger"); + NodeStack ns = stack.push(v, -1, null, null); + if (qItem.getAnswerOption().size() > 0) { + List list = new ArrayList(); + for (QuestionnaireItemAnswerOptionComponent components : qItem.getAnswerOption()) { + try { + list.add(components.getValueIntegerType()); + } catch (FHIRException e) { + // If it's the wrong type, just keep going + } + } + if (list.isEmpty() && !openChoice) { + rule(errors, IssueType.STRUCTURE, v.line(), v.col(), stack.getLiteralPath(), false, "Option list has no option values of type integer"); + } else { + boolean found = false; + for (IntegerType item : list) { + if (item.getValue() == Integer.parseInt(v.primitiveValue())) { + found = true; + break; + } + } + if (!found) { + rule(errors, IssueType.STRUCTURE, v.line(), v.col(), stack.getLiteralPath(), found, "The integer "+v.primitiveValue()+" is not a valid option"); + } + } + } else + hint(errors, IssueType.STRUCTURE, v.line(), v.col(), stack.getLiteralPath(), false, "Cannot validate integer answer option because no option list is provided"); + } + + private void checkDateOption( List errors, Element answer, NodeStack stack, Questionnaire qSrc, QuestionnaireItemComponent qItem, boolean openChoice) { + Element v = answer.getNamedChild("valueDate"); + NodeStack ns = stack.push(v, -1, null, null); + if (qItem.getAnswerOption().size() > 0) { + List list = new ArrayList(); + for (QuestionnaireItemAnswerOptionComponent components : qItem.getAnswerOption()) { + try { + list.add(components.getValueDateType()); + } catch (FHIRException e) { + // If it's the wrong type, just keep going + } + } + if (list.isEmpty() && !openChoice) { + rule(errors, IssueType.STRUCTURE, v.line(), v.col(), stack.getLiteralPath(), false, "Option list has no option values of type date"); + } else { + boolean found = false; + for (DateType item : list) { + if (item.getValue().equals(v.primitiveValue())) { + found = true; + break; + } + } + if (!found) { + rule(errors, IssueType.STRUCTURE, v.line(), v.col(), stack.getLiteralPath(), found, "The date "+v.primitiveValue()+" is not a valid option"); + } + } + } else + hint(errors, IssueType.STRUCTURE, v.line(), v.col(), stack.getLiteralPath(), false, "Cannot validate date answer option because no option list is provided"); + } + + private void checkTimeOption( List errors, Element answer, NodeStack stack, Questionnaire qSrc, QuestionnaireItemComponent qItem, boolean openChoice) { + Element v = answer.getNamedChild("valueTime"); + NodeStack ns = stack.push(v, -1, null, null); + if (qItem.getAnswerOption().size() > 0) { + List list = new ArrayList(); + for (QuestionnaireItemAnswerOptionComponent components : qItem.getAnswerOption()) { + try { + list.add(components.getValueTimeType()); + } catch (FHIRException e) { + // If it's the wrong type, just keep going + } + } + if (list.isEmpty() && !openChoice) { + rule(errors, IssueType.STRUCTURE, v.line(), v.col(), stack.getLiteralPath(), false, "Option list has no option values of type time"); + } else { + boolean found = false; + for (TimeType item : list) { + if (item.getValue().equals(v.primitiveValue())) { + found = true; + break; + } + } + if (!found) { + rule(errors, IssueType.STRUCTURE, v.line(), v.col(), stack.getLiteralPath(), found, "The time "+v.primitiveValue()+" is not a valid option"); + } + } + } else + hint(errors, IssueType.STRUCTURE, v.line(), v.col(), stack.getLiteralPath(), false, "Cannot validate time answer option because no option list is provided"); + } + + private void checkStringOption( List errors, Element answer, NodeStack stack, Questionnaire qSrc, QuestionnaireItemComponent qItem, boolean openChoice) { + Element v = answer.getNamedChild("valueString"); + NodeStack ns = stack.push(v, -1, null, null); + if (qItem.getAnswerOption().size() > 0) { + List list = new ArrayList(); + for (QuestionnaireItemAnswerOptionComponent components : qItem.getAnswerOption()) { + try { + if (components.getValue() != null) { + list.add(components.getValueStringType()); + } + } catch (FHIRException e) { + // If it's the wrong type, just keep going + } + } + if (list.isEmpty() && !openChoice) { + rule(errors, IssueType.STRUCTURE, v.line(), v.col(), stack.getLiteralPath(), false, "Option list has no option values of type string"); + } else { + boolean found = false; + for (StringType item : list) { + if (item.getValue().equals((v.primitiveValue()))) { + found = true; + break; + } + } + if (!found) { + rule(errors, IssueType.STRUCTURE, v.line(), v.col(), stack.getLiteralPath(), found, "The string "+v.primitiveValue()+" is not a valid option"); + } + } + } else { + hint(errors, IssueType.STRUCTURE, v.line(), v.col(), stack.getLiteralPath(), false, "Cannot validate string answer option because no option list is provided"); + } + } + + private void checkCodingOption( List errors, Element answer, NodeStack stack, Questionnaire qSrc, QuestionnaireItemComponent qItem, boolean openChoice) { + Element v = answer.getNamedChild("valueCoding"); + String system = v.getNamedChildValue("system"); + String code = v.getNamedChildValue("code"); + NodeStack ns = stack.push(v, -1, null, null); + if (qItem.getAnswerOption().size() > 0) { + List list = new ArrayList(); + for (QuestionnaireItemAnswerOptionComponent components : qItem.getAnswerOption()) { + try { + if (components.getValue() != null) { + list.add(components.getValueCoding()); + } + } catch (FHIRException e) { + // If it's the wrong type, just keep going + } + } + if (list.isEmpty() && !openChoice) { + rule(errors, IssueType.STRUCTURE, v.line(), v.col(), stack.getLiteralPath(), false, "Option list has no option values of type coding"); + } else { + boolean found = false; + for (Coding item : list) { + if (ObjectUtil.equals(item.getSystem(), system) && ObjectUtil.equals(item.getCode(), code)) { + found = true; + break; + } + } + if (!found) { + rule(errors, IssueType.STRUCTURE, v.line(), v.col(), stack.getLiteralPath(), found, "The code "+system+"::"+code+" is not a valid option"); + } + } + } else + hint(errors, IssueType.STRUCTURE, v.line(), v.col(), stack.getLiteralPath(), false, "Cannot validate Coding option because no option list is provided"); + } + + private String tail(String path) { + return path.substring(path.lastIndexOf(".") + 1); + } + + private String tryParse(String ref) { + String[] parts = ref.split("\\/"); + switch (parts.length) { + case 1: + return null; + case 2: + return checkResourceType(parts[0]); + default: + if (parts[parts.length - 2].equals("_history")) + return checkResourceType(parts[parts.length - 4]); + else + return checkResourceType(parts[parts.length - 2]); + } + } + + private boolean typesAreAllReference(List theType) { + for (TypeRefComponent typeRefComponent : theType) { + if (typeRefComponent.getCode().equals("Reference") == false) { + return false; + } + } + return true; + } + + private void validateBundle(List errors, Element bundle, NodeStack stack) { + List entries = new ArrayList(); + bundle.getNamedChildren("entry", entries); + String type = bundle.getNamedChildValue("type"); + type = StringUtils.defaultString(type); + + if (entries.size() == 0) { + rule(errors, IssueType.INVALID, stack.getLiteralPath(), !(type.equals("document") || type.equals("message")), "Documents or Messages must contain at least one entry"); + } else { + // Get the first entry, the MessageHeader + Element firstEntry = entries.get(0); + // Get the stack of the first entry + NodeStack firstStack = stack.push(firstEntry, 1, null, null); + + String fullUrl = firstEntry.getNamedChildValue("fullUrl"); + + if (type.equals("document")) { + Element resource = firstEntry.getNamedChild("resource"); + String id = resource.getNamedChildValue("id"); + if (rule(errors, IssueType.INVALID, firstEntry.line(), firstEntry.col(), stack.addToLiteralPath("entry", ":0"), resource != null, "No resource on first entry")) { + validateDocument(errors, entries, resource, firstStack.push(resource, -1, null, null), fullUrl, id); + } + checkAllInterlinked(errors, entries, stack, bundle); + } + if (type.equals("message")) { + Element resource = firstEntry.getNamedChild("resource"); + String id = resource.getNamedChildValue("id"); + if (rule(errors, IssueType.INVALID, firstEntry.line(), firstEntry.col(), stack.addToLiteralPath("entry", ":0"), resource != null, "No resource on first entry")) { + validateMessage(errors, entries, resource, firstStack.push(resource, -1, null, null), fullUrl, id); + } + checkAllInterlinked(errors, entries, stack, bundle); + } + // We do not yet have rules requiring that the id and fullUrl match when dealing with messaging Bundles + // validateResourceIds(errors, entries, stack); + } + for (Element entry : entries) { + String fullUrl = entry.getNamedChildValue("fullUrl"); + String url = getCanonicalURLForEntry(entry); + String id = getIdForEntry(entry); + if (url != null) { + if (!(!url.equals(fullUrl) || (url.matches(uriRegexForVersion()) && url.endsWith("/"+id))) && !isV3orV2Url(url)) + rule(errors, IssueType.INVALID, entry.line(), entry.col(), stack.addToLiteralPath("entry", ":0"), false, "The canonical URL ("+url+") cannot match the fullUrl ("+fullUrl+") unless the resource id ("+id+") also matches"); + rule(errors, IssueType.INVALID, entry.line(), entry.col(), stack.addToLiteralPath("entry", ":0"), !url.equals(fullUrl) || serverBase == null || (url.equals(Utilities.pathURL(serverBase, entry.getNamedChild("resource").fhirType(), id))), "The canonical URL ("+url+") cannot match the fullUrl ("+fullUrl+") unless on the canonical server itself"); + } + } + } + + // hack for pre-UTG v2/v3 + private boolean isV3orV2Url(String url) { + return url.startsWith("http://hl7.org/fhir/v3/") || url.startsWith("http://hl7.org/fhir/v2/"); + } + + public final static String URI_REGEX3 = "((http|https)://([A-Za-z0-9\\\\\\.\\:\\%\\$]*\\/)*)?(Account|ActivityDefinition|AllergyIntolerance|AdverseEvent|Appointment|AppointmentResponse|AuditEvent|Basic|Binary|BodySite|Bundle|CapabilityStatement|CarePlan|CareTeam|ChargeItem|Claim|ClaimResponse|ClinicalImpression|CodeSystem|Communication|CommunicationRequest|CompartmentDefinition|Composition|ConceptMap|Condition (aka Problem)|Consent|Contract|Coverage|DataElement|DetectedIssue|Device|DeviceComponent|DeviceMetric|DeviceRequest|DeviceUseStatement|DiagnosticReport|DocumentManifest|DocumentReference|EligibilityRequest|EligibilityResponse|Encounter|Endpoint|EnrollmentRequest|EnrollmentResponse|EpisodeOfCare|ExpansionProfile|ExplanationOfBenefit|FamilyMemberHistory|Flag|Goal|GraphDefinition|Group|GuidanceResponse|HealthcareService|ImagingManifest|ImagingStudy|Immunization|ImmunizationRecommendation|ImplementationGuide|Library|Linkage|List|Location|Measure|MeasureReport|Media|Medication|MedicationAdministration|MedicationDispense|MedicationRequest|MedicationStatement|MessageDefinition|MessageHeader|NamingSystem|NutritionOrder|Observation|OperationDefinition|OperationOutcome|Organization|Parameters|Patient|PaymentNotice|PaymentReconciliation|Person|PlanDefinition|Practitioner|PractitionerRole|Procedure|ProcedureRequest|ProcessRequest|ProcessResponse|Provenance|Questionnaire|QuestionnaireResponse|ReferralRequest|RelatedPerson|RequestGroup|ResearchStudy|ResearchSubject|RiskAssessment|Schedule|SearchParameter|Sequence|ServiceDefinition|Slot|Specimen|StructureDefinition|StructureMap|Subscription|Substance|SupplyDelivery|SupplyRequest|Task|TestScript|TestReport|ValueSet|VisionPrescription)\\/[A-Za-z0-9\\-\\.]{1,64}(\\/_history\\/[A-Za-z0-9\\-\\.]{1,64})?"; + + private String uriRegexForVersion() { + if ("3.0.1".equals(context.getVersion())) + return URI_REGEX3; + else + return Constants.URI_REGEX; + } + + private String getCanonicalURLForEntry(Element entry) { + Element e = entry.getNamedChild("resource"); + if (e == null) + return null; + return e.getNamedChildValue("url"); + } + + private String getIdForEntry(Element entry) { + Element e = entry.getNamedChild("resource"); + if (e == null) + return null; + return e.getNamedChildValue("id"); + } + + /** + * Check each resource entry to ensure that the entry's fullURL includes the resource's id + * value. Adds an ERROR ValidationMessge to errors List for a given entry if it references + * a resource and fullURL does not include the resource's id. + * @param errors List of ValidationMessage objects that new errors will be added to. + * @param entries List of entry Element objects to be checked. + * @param stack Current NodeStack used to create path names in error detail messages. + */ + private void validateResourceIds(List errors, List entries, NodeStack stack) { + // TODO: Need to handle _version + int i = 1; + for(Element entry : entries) { + String fullUrl = entry.getNamedChildValue("fullUrl"); + Element resource = entry.getNamedChild("resource"); + String id = resource != null?resource.getNamedChildValue("id"):null; + if (id != null && fullUrl != null) { + String urlId = null; + if (fullUrl.startsWith("https://") || fullUrl.startsWith("http://")) { + urlId = fullUrl.substring(fullUrl.lastIndexOf('/')+1); + } else if (fullUrl.startsWith("urn:uuid") || fullUrl.startsWith("urn:oid")) { + urlId = fullUrl.substring(fullUrl.lastIndexOf(':')+1); + } + rule(errors, IssueType.INVALID, entry.line(), entry.col(), stack.addToLiteralPath("entry["+i+"]"), urlId.equals(id), + "Resource ID does not match the ID in the entry full URL ('"+id+"' vs '"+fullUrl+"') "); + } + i++; + } + } + + private void checkAllInterlinked(List errors, List entries, NodeStack stack, Element bundle) { + Map visitedResources = new HashMap(); + HashMap candidateEntries = new HashMap(); + List candidateResources = new ArrayList(); + for (Element entry: entries) { + candidateEntries.put(entry.getNamedChild("resource"), entry); + candidateResources.add(entry.getNamedChild("resource")); + } + // Find resources that are pointed to as stylesheet links + List sheets = new ArrayList(); + List links = bundle.getChildren("link"); + for (Element link : links) { + if (link.getChildValue("relation").equals("stylesheet")) { + sheets.add(link.getChildValue("url")); + } + } + + if (!sheets.isEmpty()) { + for (Element r : candidateResources) { + String url = r.getChildValue("fullUrl"); + if (sheets.contains(url)) + visitedResources.put(url, r); + } + } + + List unusedResources = new ArrayList(); + boolean reverseLinksFound; + do { + reverseLinksFound = false; + followResourceLinks(entries.get(0), visitedResources, candidateEntries, candidateResources, errors, stack); + unusedResources.clear(); + unusedResources.addAll(candidateResources); + unusedResources.removeAll(visitedResources.values()); + for (Element unusedResource: unusedResources) { + List references = findReferences(unusedResource); + for (String reference: references) { + if (!visitedResources.containsKey(reference)) { + visitedResources.put(reference, unusedResource); + reverseLinksFound = true; + } + } + } + } while (reverseLinksFound); + // Lloyd Todo - Loop above four lines to check if the remaining unused resources point *to* any of the visitedResources and if so, add those to the visitedList until nothing more is added. Any that are still left over are errors + + int i = 0; + for (Element entry : entries) { + rule(errors, IssueType.INFORMATIONAL, entry.line(), entry.col(), stack.addToLiteralPath("entry" + '[' + (i+1) + ']'), !unusedResources.contains(entry.getNamedChild("resource")), "Entry isn't reachable by traversing from first Bundle entry"); + i++; + } + } + + private void followResourceLinks(Element entry, Map visitedResources, Map candidateEntries, List candidateResources, List errors, NodeStack stack) { + followResourceLinks(entry, visitedResources, candidateEntries, candidateResources, errors, stack, 0); + } + + private void followResourceLinks(Element entry, Map visitedResources, Map candidateEntries, List candidateResources, List errors, NodeStack stack, int depth) { + Element resource = entry.getNamedChild("resource"); + if (visitedResources.containsValue(resource)) + return; + + visitedResources.put(entry.getNamedChildValue("fullUrl"), resource); + + String type = null; + List references = findReferences(resource); + for (String reference: references) { + // We don't want errors when just retrieving the element as they will be caught (with better path info) in subsequent processing + Element r = getFromBundle(stack.getElement(), reference, entry.getChildValue("fullUrl"), new ArrayList(), stack.addToLiteralPath("entry[" + candidateResources.indexOf(resource) + "]"), type); + if (r!=null && !visitedResources.containsValue(r)) { + followResourceLinks(candidateEntries.get(r), visitedResources, candidateEntries, candidateResources, errors, stack, depth+1); + } + } + } + + private List findReferences(Element start) { + List references = new ArrayList(); + findReferences(start, references); + return references; + } + + private void findReferences(Element start, List references) { + for (Element child : start.getChildren()) { + if (child.getType().equals("Reference")) { + String ref = child.getChildValue("reference"); + if (ref!=null && !ref.startsWith("#")) + references.add(ref); + } + findReferences(child, references); + } + } + + private void validateBundleReference(List errors, List entries, Element ref, String name, NodeStack stack, String fullUrl, String type, String id) { + String reference = null; + try { + reference = ref.getNamedChildValue("reference"); + } catch (Error e) { + + } + + if (ref != null && !Utilities.noString(reference)) { + Element target = resolveInBundle(entries, reference, fullUrl, type, id); + rule(errors, IssueType.INVALID, ref.line(), ref.col(), stack.addToLiteralPath("reference"), target != null, "Unable to resolve the target of the reference in the bundle (" + name + ")"); + } + } + + private void validateContains(ValidatorHostContext hostContext, List errors, String path, ElementDefinition child, ElementDefinition context, Element resource, Element element, NodeStack stack, IdStatus idstatus) throws FHIRException, FHIRException, IOException { + String resourceName = element.getType(); + long t = System.nanoTime(); + StructureDefinition profile = this.context.fetchResource(StructureDefinition.class, "http://hl7.org/fhir/StructureDefinition/" + resourceName); + sdTime = sdTime + (System.nanoTime() - t); + // special case: resource wrapper is reset if we're crossing a bundle boundary, but not otherwise + if (element.getSpecial() == SpecialElement.BUNDLE_ENTRY || element.getSpecial() == SpecialElement.BUNDLE_OUTCOME || element.getSpecial() == SpecialElement.PARAMETER ) + resource = element; + if (rule(errors, IssueType.INVALID, element.line(), element.col(), stack.getLiteralPath(), profile != null, "No profile found for contained resource of type '" + resourceName + "'")) + validateResource(hostContext.forContained(element), errors, resource, element, profile, null, idstatus, stack, false); + } + + private void validateDocument(List errors, List entries, Element composition, NodeStack stack, String fullUrl, String id) { + // first entry must be a composition + if (rule(errors, IssueType.INVALID, composition.line(), composition.col(), stack.getLiteralPath(), composition.getType().equals("Composition"), + "The first entry in a document must be a composition")) { + // the composition subject and section references must resolve in the bundle + Element elem = composition.getNamedChild("subject"); + if (rule(errors, IssueType.INVALID, composition.line(), composition.col(), stack.getLiteralPath(), elem != null, "A document composition must have a subject")) + validateBundleReference(errors, entries, elem, "Composition Subject", stack.push(elem, -1, null, null), fullUrl, "Composition", id); + validateSections(errors, entries, composition, stack, fullUrl, id); + } + } + // rule(errors, IssueType.INVALID, bundle.line(), bundle.col(), "Bundle", !"urn:guid:".equals(base), "The base 'urn:guid:' is not valid (use urn:uuid:)"); + // rule(errors, IssueType.INVALID, entry.line(), entry.col(), localStack.getLiteralPath(), !"urn:guid:".equals(ebase), "The base 'urn:guid:' is not valid"); + // rule(errors, IssueType.INVALID, entry.line(), entry.col(), localStack.getLiteralPath(), !Utilities.noString(base) || !Utilities.noString(ebase), "entry + // does not have a base"); + // String firstBase = null; + // firstBase = ebase == null ? base : ebase; + + private void validateElement(ValidatorHostContext hostContext, List errors, StructureDefinition profile, ElementDefinition definition, StructureDefinition cprofile, ElementDefinition context, + Element resource, Element element, String actualType, NodeStack stack, boolean inCodeableConcept) throws FHIRException, FHIRException, IOException { + // element.markValidation(profile, definition); + + // System.out.println(" "+stack.getLiteralPath()+" "+Long.toString((System.nanoTime() - time) / 1000000)); + // time = System.nanoTime(); + if (resource.getName().equals("contained")) { + NodeStack ancestor = stack; + while (!ancestor.element.isResource() || ancestor.element.getName().equals("contained")) + ancestor = ancestor.parent; + checkInvariants(hostContext, errors, stack.getLiteralPath(), profile, definition, null, null, ancestor.element, element); + } else + checkInvariants(hostContext, errors, stack.getLiteralPath(), profile, definition, null, null, resource, element); + if (definition.getFixed()!=null) + checkFixedValue(errors, stack.getLiteralPath(), element, definition.getFixed(), definition.getSliceName(), null); + + + // get the list of direct defined children, including slices + List childDefinitions = ProfileUtilities.getChildMap(profile, definition); + if (childDefinitions.isEmpty()) { + if (actualType == null) + return; // there'll be an error elsewhere in this case, and we're going to stop. + + StructureDefinition dt = this.context.fetchResource(StructureDefinition.class, "http://hl7.org/fhir/StructureDefinition/" + actualType); + if (dt == null) + throw new DefinitionException("Unable to resolve actual type " + actualType); + + childDefinitions = ProfileUtilities.getChildMap(dt, dt.getSnapshot().getElement().get(0)); + } + + // 1. List the children, and remember their exact path (convenience) + List children = new ArrayList(); + ChildIterator iter = new ChildIterator(stack.getLiteralPath(), element); + while (iter.next()) + children.add(new ElementInfo(iter.name(), iter.element(), iter.path(), iter.count())); + + // 2. assign children to a definition + // for each definition, for each child, check whether it belongs in the slice + ElementDefinition slicer = null; + boolean unsupportedSlicing = false; + List problematicPaths = new ArrayList(); + String slicingPath = null; + int sliceOffset = 0; + for (int i = 0; i < childDefinitions.size(); i++) { + ElementDefinition ed = childDefinitions.get(i); + boolean childUnsupportedSlicing = false; + boolean process = true; + if (ed.hasSlicing() && !ed.getSlicing().getOrdered()) + slicingPath = ed.getPath(); + else if (slicingPath!=null && ed.getPath().equals(slicingPath)) + ; // nothing + else if (slicingPath != null && !ed.getPath().startsWith(slicingPath)) + slicingPath = null; + // where are we with slicing + if (ed.hasSlicing()) { + if (slicer != null && slicer.getPath().equals(ed.getPath())) { + String errorContext = "profile " + profile.getUrl(); + if (!resource.getChildValue("id").isEmpty()) + errorContext += "; instance " + resource.getChildValue("id"); + throw new DefinitionException("Slice encountered midway through path on " + slicer.getPath() + "; " + errorContext); + } + slicer = ed; + process = false; + sliceOffset = i; + } else if (slicer != null && !slicer.getPath().equals(ed.getPath())) + slicer = null; + +// if (process) { + for (ElementInfo ei : children) { + unsupportedSlicing = matchSlice(hostContext, errors, profile, stack, slicer, unsupportedSlicing, problematicPaths, sliceOffset, i, ed, childUnsupportedSlicing, ei); + } +// } + } + int last = -1; + int lastSlice = -1; + for (ElementInfo ei : children) { + String sliceInfo = ""; + if (slicer != null) + sliceInfo = " (slice: " + slicer.getPath()+")"; + //Lloyd: Removed this because there's no need for extension-specific logic here +/* if (ei.path.endsWith(".extension")) + rule(errors, IssueType.INVALID, ei.line(), ei.col(), ei.path, ei.definition != null, "Element is unknown or does not match any slice (url=\"" + ei.element.getNamedChildValue("url") + "\")" + (profile==null ? "" : " for profile " + profile.getUrl())); + else if (!unsupportedSlicing)*/ + if (!unsupportedSlicing) + if (ei.additionalSlice && ei.definition != null) { + if (ei.definition.getSlicing().getRules().equals(ElementDefinition.SlicingRules.OPEN) || + ei.definition.getSlicing().getRules().equals(ElementDefinition.SlicingRules.OPENATEND) && true /* TODO: replace "true" with condition to check that this element is at "end" */) { + hint(errors, IssueType.INFORMATIONAL, ei.line(), ei.col(), ei.path, false, "This element does not match any known slice" + (profile == null ? "" : " for the profile " + profile.getUrl())); + } else if (ei.definition.getSlicing().getRules().equals(ElementDefinition.SlicingRules.CLOSED)) { + rule(errors, IssueType.INVALID, ei.line(), ei.col(), ei.path, false, "This element does not match any known slice" + (profile == null ? "" : " for profile " + profile.getUrl() + " and slicing is CLOSED")); + } + } else { + // Don't raise this if we're in an abstract profile, like Resource + if (!profile.getAbstract()) + hint(errors, IssueType.NOTSUPPORTED, ei.line(), ei.col(), ei.path, (ei.definition != null), "Could not verify slice for profile " + profile.getUrl()); + } + // TODO: Should get the order of elements correct when parsing elements that are XML attributes vs. elements + boolean isXmlAttr = false; + if (ei.definition!=null) + for (Enumeration r : ei.definition.getRepresentation()) { + if (r.getValue() == PropertyRepresentation.XMLATTR) { + isXmlAttr = true; + break; + } + } + + if (!ToolingExtensions.readBoolExtension(profile, "http://hl7.org/fhir/StructureDefinition/structuredefinition-xml-no-order")) { + boolean ok = (ei.definition == null) || (ei.index >= last) || isXmlAttr; + rule(errors, IssueType.INVALID, ei.line(), ei.col(), ei.path, ok, "As specified by profile " + profile.getUrl() + ", Element '"+ei.name+"' is out of order"); + } + if (ei.slice != null && ei.index == last && ei.slice.getSlicing().getOrdered()) + rule(errors, IssueType.INVALID, ei.line(), ei.col(), ei.path, (ei.definition == null) || (ei.sliceindex >= lastSlice) || isXmlAttr, "As specified by profile " + profile.getUrl() + ", Element '"+ei.name+"' is out of order in ordered slice"); + if (ei.definition == null || !isXmlAttr) + last = ei.index; + if (ei.slice != null) + lastSlice = ei.sliceindex; + else + lastSlice = -1; + } + + // 3. report any definitions that have a cardinality problem + for (ElementDefinition ed : childDefinitions) { + if (ed.getRepresentation().isEmpty()) { // ignore xml attributes + int count = 0; + List slices = null; + if (ed.hasSlicing()) + slices = ProfileUtilities.getSliceList(profile, ed); + for (ElementInfo ei : children) + if (ei.definition == ed) + count++; + else if (slices!=null) { + for (ElementDefinition sed : slices) { + if (ei.definition == sed) { + count++; + break; + } + } + } + String location = "Profile " + profile.getUrl() + ", Element '" + stack.getLiteralPath() + "." + tail(ed.getPath()) + (ed.hasSliceName()? "[" + ed.getSliceName() + (ed.hasLabel() ? " ("+ed.getLabel()+")" : "")+"]": "") + "'"; + if (ed.getMin() > 0) { + if (problematicPaths.contains(ed.getPath())) + hint(errors, IssueType.NOTSUPPORTED, element.line(), element.col(), stack.getLiteralPath(), count >= ed.getMin(), location + "': Unable to check minimum required (" + Integer.toString(ed.getMin()) + ") due to lack of slicing validation"); + else + rule(errors, IssueType.STRUCTURE, element.line(), element.col(), stack.getLiteralPath(), count >= ed.getMin(), location + ": minimum required = " + Integer.toString(ed.getMin()) + ", but only found " + Integer.toString(count)); + } + if (ed.hasMax() && !ed.getMax().equals("*")) { + if (problematicPaths.contains(ed.getPath())) + hint(errors, IssueType.NOTSUPPORTED, element.line(), element.col(), stack.getLiteralPath(), count <= Integer.parseInt(ed.getMax()), location + ": Unable to check max allowed (" + ed.getMax() + ") due to lack of slicing validation"); + else + rule(errors, IssueType.STRUCTURE, element.line(), element.col(), stack.getLiteralPath(), count <= Integer.parseInt(ed.getMax()), location + ": max allowed = " + ed.getMax() + ", but found " + Integer.toString(count)); + } + } + } + // 4. check order if any slices are ordered. (todo) + + // 5. inspect each child for validity + for (ElementInfo ei : children) { + List profiles = new ArrayList(); + if (ei.definition != null) { + String type = null; + ElementDefinition typeDefn = null; + + String usesMustSupport = profile.getUserString("usesMustSupport"); + if (usesMustSupport == null) { + usesMustSupport = "N"; + for (ElementDefinition pe: profile.getSnapshot().getElement()) { + if (pe.getMustSupport()) { + usesMustSupport = "Y"; + break; + } + } + profile.setUserData("usesMustSupport", usesMustSupport); + } + if (usesMustSupport.equals("Y")) { + String elementSupported = ei.element.getUserString("elementSupported"); + if (elementSupported==null || ei.definition.getMustSupport()) + if (ei.definition.getMustSupport()) + ei.element.setUserData("elementSupported", "Y"); + else + ei.element.setUserData("elementSupported", "N"); + } + + if (ei.definition.getType().size() == 1 && !"*".equals(ei.definition.getType().get(0).getCode()) && !"Element".equals(ei.definition.getType().get(0).getCode()) + && !"BackboneElement".equals(ei.definition.getType().get(0).getCode())) { + type = ei.definition.getType().get(0).getCode(); + // Excluding reference is a kludge to get around versioning issues + if (ei.definition.getType().get(0).hasProfile()) + profiles.add(ei.definition.getType().get(0).getProfile().get(0).getValue()); + + } else if (ei.definition.getType().size() == 1 && "*".equals(ei.definition.getType().get(0).getCode())) { + String prefix = tail(ei.definition.getPath()); + assert prefix.endsWith("[x]"); + type = ei.name.substring(prefix.length() - 3); + if (isPrimitiveType(type)) + type = Utilities.uncapitalize(type); + // Excluding reference is a kludge to get around versioning issues + if (ei.definition.getType().get(0).hasProfile() && !type.equals("Reference")) + profiles.add(ei.definition.getType().get(0).getProfile().get(0).getValue()); + } else if (ei.definition.getType().size() > 1) { + + String prefix = tail(ei.definition.getPath()); + assert typesAreAllReference(ei.definition.getType()) || ei.definition.hasRepresentation(PropertyRepresentation.TYPEATTR) || prefix.endsWith("[x]") : prefix; + + if (ei.definition.hasRepresentation(PropertyRepresentation.TYPEATTR)) + type = ei.element.getType(); + else { + prefix = prefix.substring(0, prefix.length() - 3); + for (TypeRefComponent t : ei.definition.getType()) + if ((prefix + Utilities.capitalize(t.getCode())).equals(ei.name)) { + type = t.getCode(); + // Excluding reference is a kludge to get around versioning issues + if (t.hasProfile() && !type.equals("Reference")) + profiles.add(t.getProfile().get(0).getValue()); + } + } + if (type == null) { + TypeRefComponent trc = ei.definition.getType().get(0); + if (trc.getCode().equals("Reference")) + type = "Reference"; + else + rule(errors, IssueType.STRUCTURE, ei.line(), ei.col(), stack.getLiteralPath(), false, + "The type of element " + ei.name + " is not known, which is illegal. Valid types at this point are " + describeTypes(ei.definition.getType())); + } + } else if (ei.definition.getContentReference() != null) { + typeDefn = resolveNameReference(profile.getSnapshot(), ei.definition.getContentReference()); + } else if (ei.definition.getType().size() == 1 && ("Element".equals(ei.definition.getType().get(0).getCode()) || "BackboneElement".equals(ei.definition.getType().get(0).getCode()))) { + if (ei.definition.getType().get(0).hasProfile()) { + CanonicalType pu = ei.definition.getType().get(0).getProfile().get(0); + if (pu.hasExtension(ToolingExtensions.EXT_PROFILE_ELEMENT)) + profiles.add(pu.getValue()+"#"+pu.getExtensionString(ToolingExtensions.EXT_PROFILE_ELEMENT)); + else + profiles.add(pu.getValue()); + } + } + + if (type != null) { + if (type.startsWith("@")) { + ei.definition = findElement(profile, type.substring(1)); + type = null; + } + } + NodeStack localStack = stack.push(ei.element, ei.count, ei.definition, type == null ? typeDefn : resolveType(type, ei.definition.getType())); + String localStackLiterapPath = localStack.getLiteralPath(); + String eiPath = ei.path; + assert(eiPath.equals(localStackLiterapPath)) : "ei.path: " + ei.path + " - localStack.getLiteralPath: " + localStackLiterapPath; + boolean thisIsCodeableConcept = false; + + ei.element.markValidation(profile, ei.definition); + if (type != null) { + if (isPrimitiveType(type)) { + checkPrimitive(hostContext, errors, ei.path, type, ei.definition, ei.element, profile); + } else { +// checkNonPrimitive(appContext, errors, ei.path, type, ei.definition, ei.element, profile); + } + if (type.equals("Identifier")) { + checkIdentifier(errors, ei.path, ei.element, ei.definition); + } else if (type.equals("Coding")) { + checkCoding(errors, ei.path, ei.element, profile, ei.definition, inCodeableConcept); + } else if (type.equals("CodeableConcept")) { + checkCodeableConcept(errors, ei.path, ei.element, profile, ei.definition); + thisIsCodeableConcept = true; + } else if (type.equals("Reference")) { + checkReference(hostContext, errors, ei.path, ei.element, profile, ei.definition, actualType, localStack); + // We only check extensions if we're not in a complex extension or if the element we're dealing with is not defined as part of that complex extension + } else if (type.equals("Extension") && ei.element.getChildValue("url") != null && ei.element.getChildValue("url").contains("/")) { + checkExtension(hostContext, errors, ei.path, resource, ei.element, ei.definition, profile, localStack); + } else if (type.equals("Resource")) { + validateContains(hostContext, errors, ei.path, ei.definition, definition, resource, ei.element, localStack, idStatusForEntry(element, ei)); // if + // (str.matches(".*([.,/])work\\1$")) + } + } else { + if (rule(errors, IssueType.STRUCTURE, ei.line(), ei.col(), stack.getLiteralPath(), ei.definition != null, "Unrecognised Content " + ei.name)) + validateElement(hostContext, errors, profile, ei.definition, null, null, resource, ei.element, type, localStack, false); + } + StructureDefinition p = null; + boolean elementValidated = false; + String tail = null; + if (profiles.isEmpty()) { + if (type != null) { + p = getProfileForType(type, ei.definition.getType()); + + // If dealing with a primitive type, then we need to check the current child against + // the invariants (constraints) on the current element, because otherwise it only gets + // checked against the primary type's invariants: LLoyd + //if (p.getKind() == StructureDefinitionKind.PRIMITIVETYPE) { + // checkInvariants(hostContext, errors, ei.path, profile, ei.definition, null, null, resource, ei.element); + //} + + rule(errors, IssueType.STRUCTURE, ei.line(), ei.col(), ei.path, p != null, "Unknown type " + type); + } + } else if (profiles.size()==1) { + String url = profiles.get(0); + if (url.contains("#")) { + tail = url.substring(url.indexOf("#")+1); + url = url.substring(0, url.indexOf("#")); + } + p = this.context.fetchResource(StructureDefinition.class, url); + rule(errors, IssueType.STRUCTURE, ei.line(), ei.col(), ei.path, p != null, "Unknown profile " + profiles.get(0)); + } else { + elementValidated = true; + HashMap> goodProfiles = new HashMap>(); + List> badProfiles = new ArrayList>(); + for (String typeProfile : profiles) { + String url = typeProfile; + tail = null; + if (url.contains("#")) { + tail = url.substring(url.indexOf("#")+1); + url = url.substring(0, url.indexOf("#")); + } + p = this.context.fetchResource(StructureDefinition.class, typeProfile); + if (rule(errors, IssueType.STRUCTURE, ei.line(), ei.col(), ei.path, p != null, "Unknown profile " + typeProfile)) { + List profileErrors = new ArrayList(); + validateElement(hostContext, profileErrors, p, getElementByTail(p, tail), profile, ei.definition, resource, ei.element, type, localStack, thisIsCodeableConcept); + boolean hasError = false; + for (ValidationMessage msg : profileErrors) { + if (msg.getLevel()==ValidationMessage.IssueSeverity.ERROR || msg.getLevel()==ValidationMessage.IssueSeverity.FATAL) { + hasError = true; + break; + } + } + if (hasError) + badProfiles.add(profileErrors); + else + goodProfiles.put(typeProfile, profileErrors); + } + if (goodProfiles.size()==1) { + errors.addAll(goodProfiles.values().iterator().next()); + } else if (goodProfiles.size()==0) { + rule(errors, IssueType.STRUCTURE, ei.line(), ei.col(), ei.path, false, "Unable to find matching profile among choices: " + StringUtils.join("; ", profiles)); + for (List messages : badProfiles) { + errors.addAll(messages); + } + } else { + warning(errors, IssueType.STRUCTURE, ei.line(), ei.col(), ei.path, false, "Found multiple matching profiles among choices: " + StringUtils.join("; ", goodProfiles.keySet())); + for (List messages : goodProfiles.values()) { + errors.addAll(messages); + } + } + } + } + if (p!=null) { + if (!elementValidated) { + validateElement(hostContext, errors, p, getElementByTail(p, tail), profile, ei.definition, resource, ei.element, type, localStack, thisIsCodeableConcept); + } + int index = profile.getSnapshot().getElement().indexOf(ei.definition); + if (index < profile.getSnapshot().getElement().size() - 1) { + String nextPath = profile.getSnapshot().getElement().get(index+1).getPath(); + if (!nextPath.equals(ei.definition.getPath()) && nextPath.startsWith(ei.definition.getPath())) + validateElement(hostContext, errors, profile, ei.definition, null, null, resource, ei.element, type, localStack, thisIsCodeableConcept); + } + } + } + } + } + + public boolean matchSlice(ValidatorHostContext hostContext, List errors, StructureDefinition profile, NodeStack stack, + ElementDefinition slicer, boolean unsupportedSlicing, List problematicPaths, int sliceOffset, int i, ElementDefinition ed, + boolean childUnsupportedSlicing, ElementInfo ei) throws IOException { + boolean match = false; + if (slicer == null || slicer == ed) { + match = nameMatches(ei.name, tail(ed.getPath())); + } else { +// ei.slice = slice; + if (nameMatches(ei.name, tail(ed.getPath()))) + try { + match = sliceMatches(hostContext, ei.element, ei.path, slicer, ed, profile, errors, stack); + if (match) { + ei.slice = slicer; + + // Since a defined slice was found, this is not an additional (undefined) slice. + ei.additionalSlice = false; + } else if (ei.slice == null) { + // if the specified slice is undefined, keep track of the fact this is an additional (undefined) slice, but only if a slice wasn't found previously + ei.additionalSlice = true; + } + } catch (FHIRException e) { + rule(errors, IssueType.PROCESSING, ei.line(), ei.col(), ei.path, false, e.getMessage()); + unsupportedSlicing = true; + childUnsupportedSlicing = true; + } + } + if (match) { + boolean isOk = ei.definition == null || ei.definition == slicer; + if (rule(errors, IssueType.INVALID, ei.line(), ei.col(), ei.path, isOk, "Profile " + profile.getUrl() + ", Element matches more than one slice - " + (ei.definition==null || !ei.definition.hasSliceName() ? "" : ei.definition.getSliceName()) + ", " + (ed.hasSliceName() ? ed.getSliceName() : ""))) { + ei.definition = ed; + if (ei.slice == null) { + ei.index = i; + } else { + ei.index = sliceOffset; + ei.sliceindex = i - (sliceOffset + 1); + } + } + } else if (childUnsupportedSlicing) { + problematicPaths.add(ed.getPath()); + } + return unsupportedSlicing; + } + + private ElementDefinition getElementByTail(StructureDefinition p, String tail) throws DefinitionException { + if (tail == null) + return p.getSnapshot().getElement().get(0); + for (ElementDefinition t : p.getSnapshot().getElement()) { + if (tail.equals(t.getId())) + return t; + } + throw new DefinitionException("Unable to find element with id '"+tail+"'"); + } + + private IdStatus idStatusForEntry(Element ep, ElementInfo ei) { + if (isBundleEntry(ei.path)) { + Element req = ep.getNamedChild("request"); + Element resp = ep.getNamedChild("response"); + Element fullUrl = ep.getNamedChild("fullUrl"); + Element method = null; + Element url = null; + if (req != null) { + method = req.getNamedChild("method"); + url = req.getNamedChild("url"); + } + if (resp != null) { + return IdStatus.OPTIONAL; + } if (method == null) { + if (fullUrl == null) + return IdStatus.REQUIRED; + else if (fullUrl.primitiveValue().startsWith("urn:uuid:") || fullUrl.primitiveValue().startsWith("urn:oid:")) + return IdStatus.OPTIONAL; + else + return IdStatus.REQUIRED; + } else { + String s = method.primitiveValue(); + if (s.equals("PUT")) { + if (url == null) + return IdStatus.REQUIRED; + else + return IdStatus.OPTIONAL; // or maybe prohibited? not clear + } else if (s.equals("POST")) + return IdStatus.OPTIONAL; // this should be prohibited, but see task 9102 + else // actually, we should never get to here; a bundle entry with method get/delete should not have a resource + return IdStatus.OPTIONAL; + } + } else if (isParametersEntry(ei.path) || isBundleOutcome(ei.path)) + return IdStatus.OPTIONAL; + else + return IdStatus.REQUIRED; + } + + private void checkInvariants(ValidatorHostContext hostContext, List errors, String path, StructureDefinition profile, ElementDefinition ed, String typename, String typeProfile, Element resource, Element element) throws FHIRException, FHIRException { + if (noInvariantChecks) + return; + + for (ElementDefinitionConstraintComponent inv : ed.getConstraint()) { + if (inv.hasExpression()) + checkInvariant(hostContext, errors, path, profile, resource, element, inv); + } + } + + public void checkInvariant(ValidatorHostContext hostContext, List errors, String path, StructureDefinition profile, Element resource, Element element, ElementDefinitionConstraintComponent inv) throws FHIRException { + ExpressionNode n = (ExpressionNode) inv.getUserData("validator.expression.cache"); + if (n == null) { + long t = System.nanoTime(); + try { + n = fpe.parse(fixExpr(inv.getExpression())); + } catch (FHIRLexerException e) { + throw new FHIRException("Problem processing expression "+inv.getExpression() +" in profile " + profile.getUrl() + " path " + path + ": " + e.getMessage()); + } + fpeTime = fpeTime + (System.nanoTime() - t); + inv.setUserData("validator.expression.cache", n); + } + + String msg; + boolean ok; + try { + long t = System.nanoTime(); + ok = fpe.evaluateToBoolean(hostContext, resource, element, n); + fpeTime = fpeTime + (System.nanoTime() - t); + msg = fpe.forLog(); + } catch (Exception ex) { + ok = false; + msg = ex.getMessage(); + } + if (!ok) { + if (!Utilities.noString(msg)) + msg = " ("+msg+")"; + if (inv.hasExtension("http://hl7.org/fhir/StructureDefinition/elementdefinition-bestpractice") && + ToolingExtensions.readBooleanExtension(inv, "http://hl7.org/fhir/StructureDefinition/elementdefinition-bestpractice")) { + if (bpWarnings == BestPracticeWarningLevel.Hint) + hint(errors, IssueType.INVARIANT, element.line(), element.col(), path, ok, inv.getHuman()+msg+" ["+n.toString()+"]"); + else if (bpWarnings == BestPracticeWarningLevel.Warning) + warning(errors, IssueType.INVARIANT, element.line(), element.col(), path, ok, inv.getHuman()+msg+" ["+n.toString()+"]"); + else if (bpWarnings == BestPracticeWarningLevel.Error) + rule(errors, IssueType.INVARIANT, element.line(), element.col(), path, ok, inv.getHuman()+msg+" ["+n.toString()+"]"); + } + if (inv.getSeverity() == ConstraintSeverity.ERROR) + rule(errors, IssueType.INVARIANT, element.line(), element.col(), path, ok, inv.getHuman()+msg+" ["+n.toString()+"]"); + else if (inv.getSeverity() == ConstraintSeverity.WARNING) + warning(errors, IssueType.INVARIANT, element.line(), element.line(), path, ok, inv.getHuman()+msg+" ["+n.toString()+"]"); + } + } + + private void validateMessage(List errors, List entries, Element messageHeader, NodeStack stack, String fullUrl, String id) { + // first entry must be a messageheader + if (rule(errors, IssueType.INVALID, messageHeader.line(), messageHeader.col(), stack.getLiteralPath(), messageHeader.getType().equals("MessageHeader"), + "The first entry in a message must be a MessageHeader")) { + // the composition subject and section references must resolve in the bundle + List elements = messageHeader.getChildren("data"); + for (Element elem: elements) + validateBundleReference(errors, entries, elem, "MessageHeader Data", stack.push(elem, -1, null, null), fullUrl, "MessageHeader", id); + } + } + + private void validateObservation(List errors, Element element, NodeStack stack) { + // all observations should have a subject, a performer, and a time + + bpCheck(errors, IssueType.INVALID, element.line(), element.col(), stack.getLiteralPath(), element.getNamedChild("subject") != null, "All observations should have a subject"); + List performers = new ArrayList<>(); + element.getNamedChildren("performer", performers); + bpCheck(errors, IssueType.INVALID, element.line(), element.col(), stack.getLiteralPath(), performers.size() > 0, "All observations should have a performer"); + bpCheck(errors, IssueType.INVALID, element.line(), element.col(), stack.getLiteralPath(), element.getNamedChild("effectiveDateTime") != null || element.getNamedChild("effectivePeriod") != null, + "All observations should have an effectiveDateTime or an effectivePeriod"); + } + + /* + * The actual base entry point + */ + /* private void validateResource(List errors, Element resource, Element element, StructureDefinition defn, ValidationProfileSet profiles, IdStatus idstatus, NodeStack stack) throws FHIRException, FHIRException { + List declProfiles = new ArrayList(); + List meta = element.getChildrenByName("meta"); + if (!meta.isEmpty()) { + for (Element profileName : meta.get(0).getChildrenByName("profile")) { + StructureDefinition sd = context.fetchResource(StructureDefinition.class, profileName.getValue()); + if (sd != null) + declProfiles.add(sd); + } + } + + if (!declProfiles.isEmpty()) { + // Validate against profiles rather than the resource itself as they'll be more constrained and will cover the resource elements anyhow + for (StructureDefinition sd : declProfiles) + validateResource2(errors, resource, element, sd, profiles, idstatus, stack); + } else + validateResource2(errors, resource, element, defn, profiles, idstatus, stack); + }*/ + + private void validateResource(ValidatorHostContext hostContext, List errors, Element resource, Element element, StructureDefinition defn, ValidationProfileSet profiles, IdStatus idstatus, NodeStack stack, boolean isEntry) throws FHIRException, FHIRException, IOException { + assert stack != null; + assert resource != null; + + boolean ok = true; + + String resourceName = element.getType(); // todo: consider namespace...? + if (defn == null) { + long t = System.nanoTime(); + defn = element.getProperty().getStructure(); + if (defn == null) + defn = context.fetchResource(StructureDefinition.class, "http://hl7.org/fhir/StructureDefinition/" + resourceName); + if (profiles!=null) + getResourceProfiles(resource, stack).addProfiles(errors, profiles, stack.getLiteralPath(), element, isEntry); + sdTime = sdTime + (System.nanoTime() - t); + ok = rule(errors, IssueType.INVALID, element.line(), element.col(), stack.addToLiteralPath(resourceName), defn != null, "No definition found for resource type '" + resourceName + "'"); + } + + String type = defn.getKind() == StructureDefinitionKind.LOGICAL ? defn.getId() : defn.getType(); + // special case: we have a bundle, and the profile is not for a bundle. We'll try the first entry instead + if (!type.equals(resourceName) && resourceName.equals("Bundle")) { + Element first = getFirstEntry(element); + if (first != null && first.getType().equals(type)) { + element = first; + resourceName = element.getType(); + idstatus = IdStatus.OPTIONAL; // why? + } + } + ok = rule(errors, IssueType.INVALID, -1, -1, stack.getLiteralPath(), type.equals(resourceName), "Specified profile type was '" + type + "', but found type '" + resourceName + "'"); + + if (ok) { + if (idstatus == IdStatus.REQUIRED && (element.getNamedChild("id") == null)) + rule(errors, IssueType.INVALID, element.line(), element.col(), stack.getLiteralPath(), false, "Resource requires an id, but none is present"); + else if (idstatus == IdStatus.PROHIBITED && (element.getNamedChild("id") != null)) + rule(errors, IssueType.INVALID, element.line(), element.col(), stack.getLiteralPath(), false, "Resource has an id, but none is allowed"); + start(hostContext, errors, resource, element, defn, stack); // root is both definition and type + } + } + + private void loadProfiles(ValidationProfileSet profiles) throws DefinitionException { + if (profiles != null) { + for (String profile : profiles.getCanonicalUrls()) { + StructureDefinition p = context.fetchResource(StructureDefinition.class, profile); + if (p == null) + throw new DefinitionException("StructureDefinition '" + profile + "' not found"); + profiles.getDefinitions().add(p); + } + } + } + + private Element getFirstEntry(Element bundle) { + List list = new ArrayList(); + bundle.getNamedChildren("entry", list); + if (list.isEmpty()) + return null; + Element resource = list.get(0).getNamedChild("resource"); + if (resource == null) + return null; + else + return resource; + } + + private void validateSections(List errors, List entries, Element focus, NodeStack stack, String fullUrl, String id) { + List sections = new ArrayList(); + focus.getNamedChildren("entry", sections); + int i = 0; + for (Element section : sections) { + NodeStack localStack = stack.push(section, 1, null, null); + validateBundleReference(errors, entries, section.getNamedChild("content"), "Section Content", localStack, fullUrl, "Composition", id); + validateSections(errors, entries, section, localStack, fullUrl, id); + i++; + } + } + + private boolean valueMatchesCriteria(Element value, ElementDefinition criteria) throws FHIRException { + if (criteria.hasFixed()) { + List msgs = new ArrayList(); + checkFixedValue(msgs, "{virtual}", value, criteria.getFixed(), "value", null); + return msgs.size() == 0; + } else if (criteria.hasBinding() && criteria.getBinding().getStrength() == BindingStrength.REQUIRED && criteria.getBinding().hasValueSet()) { + throw new FHIRException("Unable to resolve slice matching - slice matching by value set not done"); + } else { + throw new FHIRException("Unable to resolve slice matching - no fixed value or required value set"); + } + } + + private boolean yearIsValid(String v) { + if (v == null) { + return false; + } + try { + int i = Integer.parseInt(v.substring(0, Math.min(4, v.length()))); + return i >= 1800 && i <= 2100; + } catch (NumberFormatException e) { + return false; + } + } + + public class ChildIterator { + private String basePath; + private Element parent; + private int cursor; + private int lastCount; + + public ChildIterator(String path, Element element) { + parent = element; + basePath = path; + cursor = -1; + } + + public int count() { + String nb = cursor == 0 ? "--" : parent.getChildren().get(cursor-1).getName(); + String na = cursor >= parent.getChildren().size() - 1 ? "--" : parent.getChildren().get(cursor+1).getName(); + if (name().equals(nb) || name().equals(na) ) { + return lastCount + 1; + } else + return -1; + } + + public Element element() { + return parent.getChildren().get(cursor); + } + + public String name() { + return element().getName(); + } + + public boolean next() { + if (cursor == -1) { + cursor++; + lastCount = 0; + } else { + String lastName = name(); + cursor++; + if (cursor < parent.getChildren().size() && name().equals(lastName)) + lastCount++; + else + lastCount = 0; + } + return cursor < parent.getChildren().size(); + } + + public String path() { + int i = count(); + String sfx = ""; + if (i > -1) { + sfx = "[" + Integer.toString(lastCount + 1) + "]"; + } + return basePath + "." + name() + sfx; + } + } + + public class NodeStack { + private ElementDefinition definition; + private Element element; + private ElementDefinition extension; + private String literalPath; // xpath format + private List logicalPaths; // dotted format, various entry points + private NodeStack parent; + private ElementDefinition type; + + public NodeStack() { + } + + public NodeStack(Element element) { + this.element = element; + literalPath = element.getName(); + } + + public String addToLiteralPath(String... path) { + StringBuilder b = new StringBuilder(); + b.append(getLiteralPath()); + for (String p : path) { + if (p.startsWith(":")) { + b.append("["); + b.append(p.substring(1)); + b.append("]"); + } else { + b.append("."); + b.append(p); + } + } + return b.toString(); + } + + private ElementDefinition getDefinition() { + return definition; + } + + private Element getElement() { + return element; + } + + protected String getLiteralPath() { + return literalPath == null ? "" : literalPath; + } + + private List getLogicalPaths() { + return logicalPaths == null ? new ArrayList() : logicalPaths; + } + + private ElementDefinition getType() { + return type; + } + + private NodeStack push(Element element, int count, ElementDefinition definition, ElementDefinition type) { + NodeStack res = new NodeStack(); + res.parent = this; + res.element = element; + res.definition = definition; + res.literalPath = getLiteralPath() + "." + element.getName(); + if (count > -1) + res.literalPath = res.literalPath + "[" + Integer.toString(count) + "]"; + res.logicalPaths = new ArrayList(); + if (type != null) { + // type will be bull if we on a stitching point of a contained resource, or if.... + res.type = type; + String t = tail(definition.getPath()); + for (String lp : getLogicalPaths()) { + res.logicalPaths.add(lp + "." + t); + if (t.endsWith("[x]")) + res.logicalPaths.add(lp + "." + t.substring(0, t.length() - 3) + type.getPath()); + } + res.logicalPaths.add(type.getPath()); + } else if (definition != null) { + for (String lp : getLogicalPaths()) + res.logicalPaths.add(lp + "." + element.getName()); + } else + res.logicalPaths.addAll(getLogicalPaths()); + // CommaSeparatedStringBuilder b = new CommaSeparatedStringBuilder(); + // for (String lp : res.logicalPaths) + // b.append(lp); + // System.out.println(res.literalPath+" : "+b.toString()); + return res; + } + + private void setType(ElementDefinition type) { + this.type = type; + } + } + + public class ElementInfo { + + public int index; // order of definition in overall order. all slices get the index of the slicing definition + public int sliceindex; // order of the definition in the slices (if slice != null) + public int count; + public ElementDefinition definition; + public ElementDefinition slice; + public boolean additionalSlice; // If true, indicates that this element is an additional slice + private Element element; + private String name; + private String path; + + public ElementInfo(String name, Element element, String path, int count) { + this.name = name; + this.element = element; + this.path = path; + this.count = count; + } + + public int col() { + return element.col(); + } + + public int line() { + return element.line(); + } + + @Override + public String toString() { + return path; + } + } + + public String reportTimes() { + String s = String.format("Times: overall = %d, tx = %d, sd = %d, load = %d, fpe = %d", overall, txTime, sdTime, loadTime, fpeTime); + overall = 0; + txTime = 0; + sdTime = 0; + loadTime = 0; + fpeTime = 0; + return s; + } + + public boolean isNoBindingMsgSuppressed() { + return noBindingMsgSuppressed; + } + + public IResourceValidator setNoBindingMsgSuppressed(boolean noBindingMsgSuppressed) { + this.noBindingMsgSuppressed = noBindingMsgSuppressed; + return this; + } + + + public boolean isNoTerminologyChecks() { + return noTerminologyChecks; + } + + public IResourceValidator setNoTerminologyChecks(boolean noTerminologyChecks) { + this.noTerminologyChecks = noTerminologyChecks; + return this; + } + + public void checkAllInvariants(){ + for (StructureDefinition sd : context.allStructures()) { + if (sd.getDerivation() == TypeDerivationRule.SPECIALIZATION) { + for (ElementDefinition ed : sd.getSnapshot().getElement()) { + for (ElementDefinitionConstraintComponent inv : ed.getConstraint()) { + if (inv.hasExpression()) { + try { + ExpressionNode n = (ExpressionNode) inv.getUserData("validator.expression.cache"); + if (n == null) { + n = fpe.parse(fixExpr(inv.getExpression())); + inv.setUserData("validator.expression.cache", n); + } + fpe.check(null, sd.getKind() == StructureDefinitionKind.RESOURCE ? sd.getType() : "DomainResource", ed.getPath(), n); + } catch (Exception e) { + System.out.println("Error processing structure ["+sd.getId()+"] path "+ed.getPath()+":"+inv.getKey()+" (\""+inv.getExpression()+"\"): "+e.getMessage()); + } + } + } + } + } + } + } + + private String fixExpr(String expr) { + // this is a hack work around for past publication of wrong FHIRPath expressions + // R4 + if ("(component.empty() and hasMember.empty()) implies (dataAbsentReason or value)".equals(expr)) + return "(component.empty() and hasMember.empty()) implies (dataAbsentReason.exists() or value.exists())"; + if ("isModifier implies isModifierReason.exists()".equals(expr)) + return "(isModifier.exists() and isModifier) implies isModifierReason.exists()"; + if ("(%resource.kind = 'logical' or element.first().path.startsWith(%resource.type)) and (element.tail().not() or element.tail().all(path.startsWith(%resource.differential.element.first().path.replaceMatches('\\\\..*','')&'.')))".equals(expr)) + return "(%resource.kind = 'logical' or element.first().path.startsWith(%resource.type)) and (element.tail().empty() or element.tail().all(path.startsWith(%resource.differential.element.first().path.replaceMatches('\\\\..*','')&'.')))"; + if ("differential.element.all(id) and differential.element.id.trace('ids').isDistinct()".equals(expr)) + return "differential.element.all(id.exists()) and differential.element.id.trace('ids').isDistinct()"; + if ("snapshot.element.all(id) and snapshot.element.id.trace('ids').isDistinct()".equals(expr)) + return "snapshot.element.all(id.exists()) and snapshot.element.id.trace('ids').isDistinct()"; + + // R3 + if ("(code or value.empty()) and (system.empty() or system = 'urn:iso:std:iso:4217')".equals(expr)) + return "(code.exists() or value.empty()) and (system.empty() or system = 'urn:iso:std:iso:4217')"; + if ("value.empty() or code!=component.code".equals(expr)) + return "value.empty() or (code in component.code).not()"; + if ("(code or value.empty()) and (system.empty() or system = %ucum) and (value.empty() or value > 0)".equals(expr)) + return "(code.exists() or value.empty()) and (system.empty() or system = %ucum) and (value.empty() or value > 0)"; + if ("element.all(definition and min and max)".equals(expr)) + return "element.all(definition.exists() and min.exists() and max.exists())"; + if ("telecom or endpoint".equals(expr)) + return "telecom.exists() or endpoint.exists()"; + if ("(code or value.empty()) and (system.empty() or system = %ucum) and (value.empty() or value > 0)".equals(expr)) + return "(code.exists() or value.empty()) and (system.empty() or system = %ucum) and (value.empty() or value > 0)"; + if ("searchType implies type = 'string'".equals(expr)) + return "searchType.exists() implies type = 'string'"; + if ("abatement.empty() or (abatement as boolean).not() or clinicalStatus='resolved' or clinicalStatus='remission' or clinicalStatus='inactive'".equals(expr)) + return "abatement.empty() or (abatement is boolean).not() or (abatement as boolean).not() or (clinicalStatus = 'resolved') or (clinicalStatus = 'remission') or (clinicalStatus = 'inactive')"; + if ("(component.empty() and related.empty()) implies (dataAbsentReason or value)".equals(expr)) + return "(component.empty() and related.empty()) implies (dataAbsentReason.exists() or value.exists())"; + + if ("".equals(expr)) + return ""; + return expr; + } + + +} diff --git a/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/r5/validation/InstanceValidatorFactory.java b/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/r5/validation/InstanceValidatorFactory.java new file mode 100644 index 000000000..539822357 --- /dev/null +++ b/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/r5/validation/InstanceValidatorFactory.java @@ -0,0 +1,37 @@ +package org.hl7.fhir.r5.validation; + +import org.hl7.fhir.exceptions.FHIRException; + +/*- + * #%L + * org.hl7.fhir.validation + * %% + * Copyright (C) 2014 - 2019 Health Level 7 + * %% + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * #L% + */ + + +import org.hl7.fhir.r5.context.IWorkerContext; +import org.hl7.fhir.r5.context.SimpleWorkerContext.IValidatorFactory; +import org.hl7.fhir.r5.utils.IResourceValidator; + +public class InstanceValidatorFactory implements IValidatorFactory { + + @Override + public IResourceValidator makeValidator(IWorkerContext ctxt) throws FHIRException { + return new InstanceValidator(ctxt, null); + } + +} diff --git a/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/r5/validation/NativeHostServices.java b/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/r5/validation/NativeHostServices.java new file mode 100644 index 000000000..5c9c787f3 --- /dev/null +++ b/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/r5/validation/NativeHostServices.java @@ -0,0 +1,425 @@ +package org.hl7.fhir.r5.validation; + +/*- + * #%L + * org.hl7.fhir.validation + * %% + * Copyright (C) 2014 - 2019 Health Level 7 + * %% + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * #L% + */ + + +import java.io.ByteArrayOutputStream; +import java.io.IOException; + +import org.hl7.fhir.convertors.VersionConvertorAdvisor40; +import org.hl7.fhir.convertors.VersionConvertorAdvisor50; +import org.hl7.fhir.convertors.VersionConvertor_10_50; +import org.hl7.fhir.convertors.VersionConvertor_14_50; +import org.hl7.fhir.convertors.VersionConvertor_30_50; +import org.hl7.fhir.exceptions.FHIRException; + +/** + * This class wraps up the validation and conversion infrastructure + * so it can be hosted inside a native server + * + * workflow is pretty simple: + * - create a DelphiLibraryHost, provide with path to library and tx server to use + * (tx server is usually the host server) + * - any structure definitions, value sets, code systems changes on the server get sent to tp seeResource or dropResource + * - server wants to validate a resource, it calls validateResource and gets an operation outcome back + * - server wants to convert from R4 to something else, it calls convertResource + * - server wants to convert to R4 from something else, it calls unConvertResource + * + * threading: todo: this class should be thread safe + * + * note: this is a solution that uses lots of RAM... + */ + +import org.hl7.fhir.r5.elementmodel.Manager.FhirFormat; +import org.hl7.fhir.r5.formats.XmlParser; +import org.hl7.fhir.r5.model.Bundle.BundleEntryComponent; +import org.hl7.fhir.r5.model.CodeSystem; +import org.hl7.fhir.r5.model.FhirPublication; +import org.hl7.fhir.r5.model.OperationOutcome; +import org.hl7.fhir.r5.model.Resource; +import org.hl7.fhir.r5.model.ValueSet; +import org.hl7.fhir.r5.utils.IResourceValidator.BestPracticeWarningLevel; +import org.hl7.fhir.r5.utils.IResourceValidator.CheckDisplayOption; +import org.hl7.fhir.r5.utils.IResourceValidator.IdStatus; +import org.hl7.fhir.utilities.Utilities; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonObject; + +/** + * This class allows you to host the java validator in another service, and use the services it has in a wider context. The way it works is + +- put the jar in your class path +- Find the class org.hl7.fhir.r5.validation.NativeHostServices or org.hl7.fhir.dstu3.validation.NativeHostServices +- call init(path) where path refers to one of the definitions files from the main build (e.g. definitions.xml.zip) - required, do only once, do before anything else +- call load(path) where path refers to the igpack.zip produced by the ig publisher (do this once for each IG you care about) +- call connectToTxSvc(url) where the url is your terminology service of choice (can be http://tx.fhir.org/r4 or /r3) + +now the jar is ready for action. There's 3 functions you can call (all are thread safe): +- validate - given a resource, validate it against all known rules +- convert - given a resource in a different version convert it to this version (if possible) +- unconvert - given a resource, convert it to a different version (if possible) + + +also, call "status" to get a json object that describes the internals of the jar (e.g. for server status) + + +The interface is optimised for JNI. + * @author Grahame Grieve + * + */ +public class NativeHostServices { + private class NH_10_50_Advisor implements VersionConvertorAdvisor50 { + + @Override + public boolean ignoreEntry(BundleEntryComponent src) { + return false; + } + + @Override + public org.hl7.fhir.dstu2016may.model.Resource convertR2016May(Resource resource) throws FHIRException { + return null; + } + + @Override + public org.hl7.fhir.dstu2.model.Resource convertR2(Resource resource) throws FHIRException { + return null; + } + + @Override + public org.hl7.fhir.dstu3.model.Resource convertR3(Resource resource) throws FHIRException { + return null; + } + + @Override + public void handleCodeSystem(CodeSystem tgtcs, ValueSet source) throws FHIRException { + } + + @Override + public CodeSystem getCodeSystem(ValueSet src) throws FHIRException { + throw new FHIRException("Code systems cannot be handled at this time"); // what to do? need thread local storage? + } + + @Override + public org.hl7.fhir.r4.model.Resource convertR4(Resource resource) throws FHIRException { + // TODO Auto-generated method stub + return null; + } + + } + + private ValidationEngine validator; + private int validationCount = 0; + private int resourceCount = 0; + private int convertCount = 0; + private int unConvertCount = 0; + private int exceptionCount = 0; + private String lastException = null; + private Object lock = new Object(); + + private VersionConvertorAdvisor50 conv_10_50_advisor = new NH_10_50_Advisor(); + + /** + * Create an instance of the service + */ + public NativeHostServices() { + super(); + } + + /** + * Initialize the service and prepare it for use + * + * @param pack - the filename of a pack from the main build - either definitions.xml.zip, definitions.json.zip, or igpack.zip + * @throws Exception + */ + public void init(String pack) throws Exception { + validator = new ValidationEngine(pack); + validator.getContext().setAllowLoadingDuplicates(true); + } + + /** + * Load an IG so that the validator knows all about it. + * + * @param pack - the filename (or URL) of a validator.pack produced by the IGPublisher + * + * @throws Exception + */ + public void load(String pack) throws Exception { + validator.loadIg(pack); + } + + /** + * Set up the validator with a terminology service + * + * @param txServer - the URL of the terminology service (http://tx.fhir.org/r4 default) + * @throws Exception + */ + public void connectToTxSvc(String txServer, String log) throws Exception { + validator.connectToTSServer(txServer, log, FhirPublication.R5); + } + + /** + * get back a JSON object with information about the process. + * @return + */ + public String status() { + JsonObject json = new JsonObject(); + json.addProperty("custom-resource-count", resourceCount); + validator.getContext().reportStatus(json); + json.addProperty("validation-count", validationCount); + json.addProperty("convert-count", convertCount); + json.addProperty("unconvert-count", unConvertCount); + json.addProperty("exception-count", exceptionCount); + synchronized (lock) { + json.addProperty("last-exception", lastException); + } + + json.addProperty("mem-max", Runtime.getRuntime().maxMemory() / (1024*1024)); + json.addProperty("mem-total", Runtime.getRuntime().totalMemory() / (1024*1024)); + json.addProperty("mem-free", Runtime.getRuntime().freeMemory() / (1024*1024)); + json.addProperty("mem-used", (Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory()) / (1024*1024)); + + Gson gson = new GsonBuilder().create(); + return gson.toJson(json); + } + + /** + * Call when the host process encounters one of the following: + * - (for validation): + * - profile + * - extension definition + * - value set + * - code system + * + * - (for conversion): + * - structure map + * - concept map + * + * @param source + * @throws Exception + */ + public void seeResource(byte[] source) throws Exception { + try { + Resource r = new XmlParser().parse(source); + validator.seeResource(r); + resourceCount++; + } catch (Exception e) { + exceptionCount++; + + synchronized (lock) { + lastException = e.getMessage(); + } + throw e; + } + } + + /** + * forget a resource that was previously seen (using @seeResource) + * + * @param type - the resource type + * @param id - the resource id + * + * @throws Exception + */ + public void dropResource(String type, String id) throws Exception { + try { + validator.dropResource(type, id); + resourceCount--; + } catch (Exception e) { + exceptionCount++; + synchronized (lock) { + lastException = e.getMessage(); + } + throw e; + } + } + + /** + * Validate a resource. + * + * Possible options: + * - id-optional : no resource id is required (default) + * - id-required : a resource id is required + * - id-prohibited : no resource id is allowed + * - any-extensions : allow extensions other than those defined by the encountered structure definitions + * - bp-ignore : ignore best practice recommendations (default) + * - bp-hint : treat best practice recommendations as a hint + * - bp-warning : treat best practice recommendations as a warning + * - bp-error : treat best practice recommendations as an error + * - display-ignore : ignore Coding.display and do not validate it (default) + * - display-check : check Coding.display - must be correct + * - display-case-space : check Coding.display but allow case and whitespace variation + * - display-case : check Coding.display but allow case variation + * - display-space : check Coding.display but allow whitespace variation + * + * @param location - a text description of the context of validation (for human consumers to help locate the problem - echoed into error messages) + * @param source - the bytes to validate + * @param cntType - the format of the content. one of XML, JSON, TURTLE + * @param options - a list of space separated options + * @return + * @throws Exception + */ + public byte[] validateResource(String location, byte[] source, String cntType, String options) throws Exception { + try { + IdStatus resourceIdRule = IdStatus.OPTIONAL; + boolean anyExtensionsAllowed = true; + BestPracticeWarningLevel bpWarnings = BestPracticeWarningLevel.Ignore; + CheckDisplayOption displayOption = CheckDisplayOption.Ignore; + for (String s : options.split(" ")) { + if ("id-optional".equalsIgnoreCase(s)) + resourceIdRule = IdStatus.OPTIONAL; + else if ("id-required".equalsIgnoreCase(s)) + resourceIdRule = IdStatus.REQUIRED; + else if ("id-prohibited".equalsIgnoreCase(s)) + resourceIdRule = IdStatus.PROHIBITED; + else if ("any-extensions".equalsIgnoreCase(s)) + anyExtensionsAllowed = true; // This is already the default + else if ("strict-extensions".equalsIgnoreCase(s)) + anyExtensionsAllowed = false; + else if ("bp-ignore".equalsIgnoreCase(s)) + bpWarnings = BestPracticeWarningLevel.Ignore; + else if ("bp-hint".equalsIgnoreCase(s)) + bpWarnings = BestPracticeWarningLevel.Hint; + else if ("bp-warning".equalsIgnoreCase(s)) + bpWarnings = BestPracticeWarningLevel.Warning; + else if ("bp-error".equalsIgnoreCase(s)) + bpWarnings = BestPracticeWarningLevel.Error; + else if ("display-ignore".equalsIgnoreCase(s)) + displayOption = CheckDisplayOption.Ignore; + else if ("display-check".equalsIgnoreCase(s)) + displayOption = CheckDisplayOption.Check; + else if ("display-case-space".equalsIgnoreCase(s)) + displayOption = CheckDisplayOption.CheckCaseAndSpace; + else if ("display-case".equalsIgnoreCase(s)) + displayOption = CheckDisplayOption.CheckCase; + else if ("display-space".equalsIgnoreCase(s)) + displayOption = CheckDisplayOption.CheckSpace; + else if (!Utilities.noString(s)) + throw new Exception("Unknown option "+s); + } + + OperationOutcome oo = validator.validate(location, source, FhirFormat.valueOf(cntType), null, resourceIdRule, anyExtensionsAllowed, bpWarnings, displayOption); + ByteArrayOutputStream bs = new ByteArrayOutputStream(); + new XmlParser().compose(bs, oo); + validationCount++; + return bs.toByteArray(); + } catch (Exception e) { + exceptionCount++; + synchronized (lock) { + lastException = e.getMessage(); + } + throw e; + } + } + + /** + * Convert a resource to R4 from the specified version + * + * @param r - the source of the resource to convert from + * @param fmt - the format of the content. one of XML, JSON, TURTLE + * @param version - the version of the content. one of r2, r3 + * @return - the converted resource (or an exception if can't be converted) + * @throws FHIRException + * @throws IOException + */ + public byte[] convertResource(byte[] r, String fmt, String version) throws FHIRException, IOException { + try { + if ("3.0".equals(version) || "3.0.1".equals(version) || "r3".equals(version)) { + org.hl7.fhir.dstu3.formats.ParserBase p3 = org.hl7.fhir.dstu3.formats.FormatUtilities.makeParser(fmt); + org.hl7.fhir.dstu3.model.Resource res3 = p3.parse(r); + Resource res4 = VersionConvertor_30_50.convertResource(res3, false); + org.hl7.fhir.r5.formats.ParserBase p4 = org.hl7.fhir.r5.formats.FormatUtilities.makeParser(fmt); + convertCount++; + return p4.composeBytes(res4); + } else if ("1.0".equals(version) || "1.0.2".equals(version) || "r2".equals(version)) { + org.hl7.fhir.dstu2.formats.ParserBase p2 = org.hl7.fhir.dstu2.formats.FormatUtilities.makeParser(fmt); + org.hl7.fhir.dstu2.model.Resource res2 = p2.parse(r); + VersionConvertor_10_50 conv = new VersionConvertor_10_50(conv_10_50_advisor ); + Resource res4 = conv.convertResource(res2); + org.hl7.fhir.r5.formats.ParserBase p4 = org.hl7.fhir.r5.formats.FormatUtilities.makeParser(fmt); + convertCount++; + return p4.composeBytes(res4); + } else if ("1.4".equals(version) || "1.4.0".equals(version)) { + org.hl7.fhir.dstu2016may.formats.ParserBase p2 = org.hl7.fhir.dstu2016may.formats.FormatUtilities.makeParser(fmt); + org.hl7.fhir.dstu2016may.model.Resource res2 = p2.parse(r); + Resource res4 = VersionConvertor_14_50.convertResource(res2); + org.hl7.fhir.r5.formats.ParserBase p4 = org.hl7.fhir.r5.formats.FormatUtilities.makeParser(fmt); + convertCount++; + return p4.composeBytes(res4); + } else + throw new FHIRException("Unsupported version "+version); + } catch (Exception e) { + exceptionCount++; + synchronized (lock) { + lastException = e.getMessage(); + } + throw e; + } + } + + /** + * Convert a resource from R4 to the specified version + * + * @param r - the source of the resource to convert from + * @param fmt - the format of the content. one of XML, JSON, TURTLE + * @param version - the version to convert to. one of r2, r3 + * @return - the converted resource (or an exception if can't be converted) + * @throws FHIRException + * @throws IOException + */ + public byte[] unConvertResource(byte[] r, String fmt, String version) throws FHIRException, IOException { + try { + if ("3.0".equals(version) || "3.0.1".equals(version) || "r3".equals(version)) { + org.hl7.fhir.r5.formats.ParserBase p4 = org.hl7.fhir.r5.formats.FormatUtilities.makeParser(fmt); + org.hl7.fhir.r5.model.Resource res4 = p4.parse(r); + org.hl7.fhir.dstu3.model.Resource res3 = VersionConvertor_30_50.convertResource(res4, false); + org.hl7.fhir.dstu3.formats.ParserBase p3 = org.hl7.fhir.dstu3.formats.FormatUtilities.makeParser(fmt); + unConvertCount++; + return p3.composeBytes(res3); + } else if ("1.0".equals(version) || "1.0.2".equals(version) || "r2".equals(version)) { + org.hl7.fhir.r5.formats.ParserBase p4 = org.hl7.fhir.r5.formats.FormatUtilities.makeParser(fmt); + org.hl7.fhir.r5.model.Resource res4 = p4.parse(r); + VersionConvertor_10_50 conv = new VersionConvertor_10_50(conv_10_50_advisor ); + org.hl7.fhir.dstu2.model.Resource res2 = conv.convertResource(res4); + org.hl7.fhir.dstu2.formats.ParserBase p2 = org.hl7.fhir.dstu2.formats.FormatUtilities.makeParser(fmt); + unConvertCount++; + return p2.composeBytes(res2); + } else if ("1.4".equals(version) || "1.4.0".equals(version)) { + org.hl7.fhir.r5.formats.ParserBase p4 = org.hl7.fhir.r5.formats.FormatUtilities.makeParser(fmt); + org.hl7.fhir.r5.model.Resource res4 = p4.parse(r); + org.hl7.fhir.dstu2016may.model.Resource res2 = VersionConvertor_14_50.convertResource(res4); + org.hl7.fhir.dstu2016may.formats.ParserBase p2 = org.hl7.fhir.dstu2016may.formats.FormatUtilities.makeParser(fmt); + unConvertCount++; + return p2.composeBytes(res2); + } else + throw new FHIRException("Unsupported version "+version); + } catch (Exception e) { + exceptionCount++; + synchronized (lock) { + lastException = e.getMessage(); + } + throw e; + } + } + + +} diff --git a/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/r5/validation/ProfileValidator.java b/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/r5/validation/ProfileValidator.java new file mode 100644 index 000000000..472a9a77f --- /dev/null +++ b/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/r5/validation/ProfileValidator.java @@ -0,0 +1,131 @@ +package org.hl7.fhir.r5.validation; + +/*- + * #%L + * org.hl7.fhir.validation + * %% + * Copyright (C) 2014 - 2019 Health Level 7 + * %% + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * #L% + */ + + +import java.util.ArrayList; +import java.util.Hashtable; +import java.util.List; + +import org.hl7.fhir.r5.context.IWorkerContext; +import org.hl7.fhir.r5.model.ElementDefinition; +import org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionConstraintComponent; +import org.hl7.fhir.r5.model.ElementDefinition.TypeRefComponent; +import org.hl7.fhir.r5.model.StructureDefinition; +import org.hl7.fhir.r5.utils.FHIRPathEngine; +import org.hl7.fhir.utilities.Utilities; +import org.hl7.fhir.utilities.validation.ValidationMessage; +import org.hl7.fhir.utilities.validation.ValidationMessage.IssueType; + +public class ProfileValidator extends BaseValidator { + + IWorkerContext context; + private boolean checkAggregation = false; + private boolean checkMustSupport = false; + + public void setContext(IWorkerContext context) { + this.context = context; + } + + public boolean isCheckAggregation() { + return checkAggregation; + } + + public boolean isCheckMustSupport() { + return checkMustSupport; + } + + public void setCheckAggregation(boolean checkAggregation) { + this.checkAggregation = checkAggregation; + } + + public void setCheckMustSupport(boolean checkMustSupport) { + this.checkMustSupport = checkMustSupport; + } + + protected boolean rule(List errors, IssueType type, String path, boolean b, String msg) { + String rn = path.contains(".") ? path.substring(0, path.indexOf(".")) : path; + return super.rule(errors, type, path, b, msg, ""+rn+": "+Utilities.escapeXml(msg)); + } + + public List validate(StructureDefinition profile, boolean forBuild) { + List errors = new ArrayList(); + + // must have a FHIR version- GF#3160 + warning(errors, IssueType.BUSINESSRULE, profile.getUrl(), profile.hasFhirVersion(), "Profiles SHOULD state the FHIR Version on which they are based"); + warning(errors, IssueType.BUSINESSRULE, profile.getUrl(), profile.hasVersion(), "Profiles SHOULD state their own version"); + + // extensions must be defined + for (ElementDefinition ec : profile.getDifferential().getElement()) + checkExtensions(profile, errors, "differential", ec); + rule(errors, IssueType.STRUCTURE, profile.getId(), profile.hasSnapshot(), "missing Snapshot at "+profile.getName()+"."+profile.getName()); + for (ElementDefinition ec : profile.getSnapshot().getElement()) + checkExtensions(profile, errors, "snapshot", ec); + + if (rule(errors, IssueType.STRUCTURE, profile.getId(), profile.hasSnapshot(), "A snapshot is required")) { + Hashtable snapshotElements = new Hashtable(); + for (ElementDefinition ed : profile.getSnapshot().getElement()) { + snapshotElements.put(ed.getId(), ed); + checkExtensions(profile, errors, "snapshot", ed); + for (ElementDefinitionConstraintComponent inv : ed.getConstraint()) { + if (forBuild) { + if (!inExemptList(inv.getKey())) { + if (rule(errors, IssueType.BUSINESSRULE, profile.getId()+"::"+ed.getPath()+"::"+inv.getKey(), inv.hasExpression(), "The invariant has no FHIR Path expression ("+inv.getXpath()+")")) { + try { + new FHIRPathEngine(context).check(null, profile.getType(), ed.getPath(), inv.getExpression()); // , inv.hasXpath() && inv.getXpath().startsWith("@value") + } catch (Exception e) { +// rule(errors, IssueType.STRUCTURE, profile.getId()+"::"+ed.getPath()+"::"+inv.getId(), exprExt != null, e.getMessage()); + } + } + } + } + } + } + for (ElementDefinition diffElement : profile.getDifferential().getElement()) { + ElementDefinition snapElement = snapshotElements.get(diffElement.getId()); + if (snapElement!=null) { // Happens with profiles in the main build - should be able to fix once snapshot generation is fixed - Lloyd + warning(errors, IssueType.BUSINESSRULE, diffElement.getId(), !checkMustSupport || snapElement.hasMustSupport(), "Elements included in the differential should declare mustSupport"); + if (checkAggregation) { + for (TypeRefComponent type : snapElement.getType()) { + if ("http://hl7.org/fhir/Reference".equals(type.getCode()) || "http://hl7.org/fhir/canonical".equals(type.getCode())) { + warning(errors, IssueType.BUSINESSRULE, diffElement.getId(), type.hasAggregation(), "Elements with type Reference or canonical should declare aggregation"); + } + } + } + } + } + } + return errors; + } + + // these are special cases + private boolean inExemptList(String key) { + return key.startsWith("txt-"); + } + + private void checkExtensions(StructureDefinition profile, List errors, String kind, ElementDefinition ec) { + if (!ec.getType().isEmpty() && "Extension".equals(ec.getType().get(0).getCode()) && ec.getType().get(0).hasProfile()) { + String url = ec.getType().get(0).getProfile().get(0).getValue(); + StructureDefinition defn = context.fetchResource(StructureDefinition.class, url); + rule(errors, IssueType.BUSINESSRULE, profile.getId(), defn != null, "Unable to find Extension '"+url+"' referenced at "+profile.getUrl()+" "+kind+" "+ec.getPath()+" ("+ec.getSliceName()+")"); + } + } +} diff --git a/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/r5/validation/ValidationEngine.java b/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/r5/validation/ValidationEngine.java new file mode 100644 index 000000000..feed661cf --- /dev/null +++ b/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/r5/validation/ValidationEngine.java @@ -0,0 +1,1052 @@ +package org.hl7.fhir.r5.validation; + +/*- + * #%L + * org.hl7.fhir.validation + * %% + * Copyright (C) 2014 - 2019 Health Level 7 + * %% + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * #L% + */ + + +/* +Copyright (c) 2011+, HL7, Inc +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of HL7 nor the names of its contributors may be used to + endorse or promote products derived from this software without specific + prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, +INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. + +*/ + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.FilenameFilter; +import java.io.IOException; +import java.io.InputStream; +import java.io.PrintWriter; +import java.net.URISyntaxException; +import java.net.URL; +import java.net.URLConnection; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.zip.ZipEntry; +import java.util.zip.ZipInputStream; + +import org.apache.commons.io.IOUtils; +import org.hl7.fhir.convertors.R2016MayToR4Loader; +import org.hl7.fhir.convertors.R2016MayToR5Loader; +import org.hl7.fhir.convertors.R2ToR4Loader; +import org.hl7.fhir.convertors.R2ToR5Loader; +import org.hl7.fhir.convertors.R3ToR4Loader; +import org.hl7.fhir.convertors.R3ToR5Loader; +import org.hl7.fhir.convertors.R4ToR5Loader; +import org.hl7.fhir.convertors.TerminologyClientFactory; +import org.hl7.fhir.convertors.VersionConvertorAdvisor40; +import org.hl7.fhir.convertors.VersionConvertorAdvisor50; +import org.hl7.fhir.convertors.VersionConvertor_10_40; +import org.hl7.fhir.convertors.VersionConvertor_10_50; +import org.hl7.fhir.convertors.VersionConvertor_14_40; +import org.hl7.fhir.convertors.VersionConvertor_14_50; +import org.hl7.fhir.convertors.VersionConvertor_30_40; +import org.hl7.fhir.convertors.VersionConvertor_30_50; +import org.hl7.fhir.convertors.VersionConvertor_40_50; +import org.hl7.fhir.exceptions.DefinitionException; +import org.hl7.fhir.exceptions.FHIRException; +import org.hl7.fhir.r5.conformance.ProfileUtilities; +import org.hl7.fhir.r5.context.SimpleWorkerContext; +import org.hl7.fhir.r5.context.SimpleWorkerContext.IContextResourceLoader; +import org.hl7.fhir.r5.elementmodel.Manager; +import org.hl7.fhir.r5.elementmodel.Manager.FhirFormat; +import org.hl7.fhir.r5.formats.FormatUtilities; +import org.hl7.fhir.r5.formats.JsonParser; +import org.hl7.fhir.r5.formats.RdfParser; +import org.hl7.fhir.r5.formats.XmlParser; +import org.hl7.fhir.r5.model.Base; +import org.hl7.fhir.r5.model.Bundle; +import org.hl7.fhir.r5.model.Coding; +import org.hl7.fhir.r5.model.Constants; +import org.hl7.fhir.r5.model.DomainResource; +import org.hl7.fhir.r5.model.FhirPublication; +import org.hl7.fhir.r5.model.ImplementationGuide; +import org.hl7.fhir.r5.model.OperationOutcome; +import org.hl7.fhir.r5.model.OperationOutcome.OperationOutcomeIssueComponent; +import org.hl7.fhir.r5.model.Parameters; +import org.hl7.fhir.r5.model.Resource; +import org.hl7.fhir.r5.model.ResourceFactory; +import org.hl7.fhir.r5.model.StructureDefinition; +import org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionKind; +import org.hl7.fhir.r5.model.StructureMap; +import org.hl7.fhir.r5.terminologies.ConceptMapEngine; +import org.hl7.fhir.r5.utils.IResourceValidator.BestPracticeWarningLevel; +import org.hl7.fhir.r5.utils.IResourceValidator.CheckDisplayOption; +import org.hl7.fhir.r5.utils.IResourceValidator.IdStatus; +import org.hl7.fhir.r5.utils.NarrativeGenerator; +import org.hl7.fhir.r5.utils.OperationOutcomeUtilities; +import org.hl7.fhir.r5.utils.StructureMapUtilities; +import org.hl7.fhir.r5.utils.StructureMapUtilities.ITransformerServices; +import org.hl7.fhir.r5.utils.ToolingExtensions; +import org.hl7.fhir.r5.utils.ValidationProfileSet; +import org.hl7.fhir.utilities.IniFile; +import org.hl7.fhir.utilities.TextFile; +import org.hl7.fhir.utilities.Utilities; +import org.hl7.fhir.utilities.cache.NpmPackage; +import org.hl7.fhir.utilities.cache.PackageCacheManager; +import org.hl7.fhir.utilities.cache.ToolsVersion; +import org.hl7.fhir.utilities.validation.ValidationMessage; +import org.hl7.fhir.utilities.validation.ValidationMessage.IssueSeverity; +import org.hl7.fhir.utilities.validation.ValidationMessage.IssueType; +import org.hl7.fhir.utilities.validation.ValidationMessage.Source; +import org.xml.sax.SAXException; + +/** + * This is just a wrapper around the InstanceValidator class for convenient use + * + * The following resource formats are supported: XML, JSON, Turtle + * The following versions are supported: 1.0.1, 1.4.0, 3.0.1, and current + * + * Note: the validation engine is intended to be threadsafe + * To Use: + * + * 1/ Initialize + * ValidationEngine validator = new ValidationEngine(src); + * - this must refer to the igpack.zip for the version of the spec against which you want to validate + * it can be a url or a file reference. It can nominate the igpack.zip directly, + * or it can name the container alone (e.g. just the spec URL). + * The validation engine does not cache igpack.zip. the user must manage that if desired + * + * validator.connectToTSServer(txServer); + * - this is optional; in the absence of a terminology service, snomed, loinc etc will not be validated + * + * validator.loadIg(src); + * - call this any number of times for the Implementation Guide(s) of interest. This is a reference + * to the igpack.zip for the implementation guide - same rules as above + * the version of the IGPack must match that of the spec + * Alternatively it can point to a local folder that contains conformance resources. + * + * validator.loadQuestionnaire(src) + * - url or filename of a questionnaire to load. Any loaded questionnaires will be used while validating + * + * validator.setNative(doNative); + * - whether to do xml/json/rdf schema validation as well + * + * You only need to do this initialization once. You can validate as many times as you like + * + * 2. validate + * validator.validate(src, profiles); + * - source (as stream, byte[]), or url or filename of a resource to validate. + * Also validate against any profiles (as canonical URLS, equivalent to listing them in Resource.meta.profile) + * + * if the source is provided as byte[] or stream, you need to provide a format too, though you can + * leave that as null, and the validator will guess + * + * 3. Or, instead of validating, transform + * @author Grahame Grieve + * + */ +public class ValidationEngine { + + public class TransformSupportServices implements ITransformerServices { + + private List outputs; + + public TransformSupportServices(List outputs) { + this.outputs = outputs; + } + + @Override + public void log(String message) { + if (mapLog != null) + mapLog.println(message); + System.out.println(message); + } + + @Override + public Base createType(Object appInfo, String name) throws FHIRException { + StructureDefinition sd = context.fetchResource(StructureDefinition.class, name); + if (sd != null && sd.getKind() == StructureDefinitionKind.LOGICAL) { + return Manager.build(context, sd); + } else { + if (name.startsWith("http://hl7.org/fhir/StructureDefinition/")) + name = name.substring("http://hl7.org/fhir/StructureDefinition/".length()); + return ResourceFactory.createResourceOrType(name); + } + } + + @Override + public Base createResource(Object appInfo, Base res, boolean atRootofTransform) { + if (atRootofTransform) + outputs.add((Resource) res); + return res; + } + + @Override + public Coding translate(Object appInfo, Coding source, String conceptMapUrl) throws FHIRException { + ConceptMapEngine cme = new ConceptMapEngine(context); + return cme.translate(source, conceptMapUrl); + } + + @Override + public Base resolveReference(Object appContext, String url) throws FHIRException { + throw new FHIRException("resolveReference is not supported yet"); + } + + @Override + public List performSearch(Object appContext, String url) throws FHIRException { + throw new FHIRException("performSearch is not supported yet"); + } + + } + + private SimpleWorkerContext context; +// private FHIRPathEngine fpe; + private Map binaries = new HashMap(); + private boolean doNative; + private boolean noInvariantChecks; + private boolean hintAboutNonMustSupport; + private boolean anyExtensionsAllowed = false; + private String version; + private PackageCacheManager pcm; + private PrintWriter mapLog; + + private class AsteriskFilter implements FilenameFilter { + String dir; + String regex; + + public AsteriskFilter(String filter) throws IOException { + if (!filter.matches("(.*(\\\\|\\/))*(.*)\\*(.*)")) + throw new IOException("Filter names must have the following syntax: [directorypath][prefix]?*[suffix]? I.e. The asterisk must be in the filename, not the directory path"); + dir = filter.replaceAll("(.*(\\\\|\\/))*(.*)\\*(.*)", "$1"); + String expression = filter.replaceAll("(.*(\\\\|\\/))*(.*)", "$3"); + regex = ""; + for (int i = 0; i < expression.length(); i++) { + if (Character.isAlphabetic(expression.codePointAt(i)) || Character.isDigit(expression.codePointAt(i))) + regex = regex + expression.charAt(i); + else if (expression.charAt(i)=='*') + regex = regex + ".*"; + else + regex = regex + "\\" + expression.charAt(i); + } + File f = new File(dir); + if (!f.exists()) { + throw new IOException("Directory " + dir + " does not exist"); + } + if (!f.isDirectory()) { + throw new IOException("Directory " + dir + " is not a directory"); + } + } + + public boolean accept(File dir, String s) { + boolean match = s.matches(regex); + return match; + } + + public String getDir() { + return dir; + } + } + + public ValidationEngine() throws IOException { + pcm = new PackageCacheManager(true, ToolsVersion.TOOLS_VERSION); + } + + public void loadInitialDefinitions(String src) throws Exception { + loadDefinitions(src); + } + + public void setTerminologyServer(String src, String log, FhirPublication version) throws Exception { + connectToTSServer(src, log, version); + } + + public boolean isHintAboutNonMustSupport() { + return hintAboutNonMustSupport; + } + + public void setHintAboutNonMustSupport(boolean hintAboutNonMustSupport) { + this.hintAboutNonMustSupport = hintAboutNonMustSupport; + } + + public boolean isAnyExtensionsAllowed() { + return anyExtensionsAllowed; + } + + public void setAnyExtensionsAllowed(boolean anyExtensionsAllowed) { + this.anyExtensionsAllowed = anyExtensionsAllowed; + } + + public ValidationEngine(String src, String txsrvr, String txLog, FhirPublication version) throws Exception { + pcm = new PackageCacheManager(true, ToolsVersion.TOOLS_VERSION); + loadInitialDefinitions(src); + setTerminologyServer(txsrvr, txLog, version); + } + + public ValidationEngine(String src) throws Exception { + loadDefinitions(src); + pcm = new PackageCacheManager(true, ToolsVersion.TOOLS_VERSION); + } + + private void loadDefinitions(String src) throws Exception { + Map source = loadIgSource(src); + if (version == null) + version = getVersionFromPack(source); + context = SimpleWorkerContext.fromDefinitions(source, loaderForVersion()); + context.setAllowLoadingDuplicates(true); // because of Forge + context.setExpansionProfile(makeExpProfile()); + grabNatives(source, "http://hl7.org/fhir"); + } + + private IContextResourceLoader loaderForVersion() { + if (Utilities.noString(version)) + return null; + if (version.equals("1.0.2")) + return new R2ToR5Loader(); + if (version.equals("1.4.0")) + return new R2016MayToR5Loader(); // special case + if (version.equals("3.0.1")) + return new R3ToR5Loader(); + if (version.equals("4.0.0")) + return new R4ToR5Loader(); + return null; + } + + private String getVersionFromPack(Map source) { + if (source.containsKey("version.info")) { + IniFile vi = new IniFile(new ByteArrayInputStream(removeBom(source.get("version.info")))); + return vi.getStringProperty("FHIR", "version"); + } else { + throw new Error("Missing version.info?"); + } + } + + private byte[] removeBom(byte[] bs) { + if (bs.length > 3 && bs[0] == -17 && bs[1] == -69 && bs[2] == -65) + return Arrays.copyOfRange(bs, 3, bs.length); + else + return bs; + } + + private Parameters makeExpProfile() { + Parameters ep = new Parameters(); + ep.addParameter("profile-url", "http://hl7.org/fhir/ExpansionProfile/dc8fd4bc-091a-424a-8a3b-6198ef146891"); // change this to blow the cache + // all defaults.... + return ep; + } + + private byte[] loadProfileSource(String src) throws Exception { + if (Utilities.noString(src)) { + throw new FHIRException("Profile Source '" + src + "' could not be processed"); + } else if (src.startsWith("https:") || src.startsWith("http:")) { + return loadProfileFromUrl(src); + } else if (new File(src).exists()) { + return loadProfileFromFile(src); + } else { + throw new FHIRException("Definitions Source '"+src+"' could not be processed"); + } + } + + private byte[] loadProfileFromUrl(String src) throws Exception { + try { + URL url = new URL(src+"?nocache=" + System.currentTimeMillis()); + URLConnection c = url.openConnection(); + return IOUtils.toByteArray(c.getInputStream()); + } catch (Exception e) { + throw new Exception("Unable to find definitions at URL '"+src+"': "+e.getMessage(), e); + } + } + + private byte[] loadProfileFromFile(String src) throws FileNotFoundException, IOException { + File f = new File(src); + if (f.isDirectory()) + throw new IOException("You must provide a file name, not a directory name"); + return TextFile.fileToBytes(src); + } + + private Map loadIgSource(String src) throws Exception { + // src can be one of the following: + // - a canonical url for an ig - this will be converted to a package id and loaded into the cache + // - a package id for an ig - this will be loaded into the cache + // - a direct reference to a package ("package.tgz") - this will be extracted by the cache manager, but not put in the cache + // - a folder containing resources - these will be loaded directly + if (src.startsWith("https:") || src.startsWith("http:")) { + String v = null; + if (src.contains("|")) { + v = src.substring(src.indexOf("|")+1); + src = src.substring(0, src.indexOf("|")); + } + String pid = pcm.getPackageId(src); + if (!Utilities.noString(pid)) + return fetchByPackage(pid+(v == null ? "" : "#"+v)); + else + return fetchFromUrl(src+(v == null ? "" : "|"+v)); + } + + File f = new File(src); + if (f.exists()) { + if (f.isDirectory() && new File(Utilities.path(src, "package.tgz")).exists()) + return loadPackage(new FileInputStream(Utilities.path(src, "package.tgz")), Utilities.path(src, "package.tgz")); + if (f.isDirectory() && new File(Utilities.path(src, "igpack.zip")).exists()) + return readZip(new FileInputStream(Utilities.path(src, "igpack.zip"))); + if (f.isDirectory() && new File(Utilities.path(src, "validator.pack")).exists()) + return readZip(new FileInputStream(Utilities.path(src, "validator.pack"))); + if (f.isDirectory()) + return scanDirectory(f); + if (src.endsWith(".tgz")) + return loadPackage(new FileInputStream(src), src); + if (src.endsWith(".pack")) + return readZip(new FileInputStream(src)); + if (src.endsWith("igpack.zip")) + return readZip(new FileInputStream(src)); + FhirFormat fmt = checkIsResource(src); + if (fmt != null) { + Map res = new HashMap(); + res.put(Utilities.changeFileExt(src, "."+fmt.getExtension()), TextFile.fileToBytes(src)); + return res; + } + } else if ((src.matches(PackageCacheManager.PACKAGE_REGEX) || src.matches(PackageCacheManager.PACKAGE_VERSION_REGEX)) && !src.endsWith(".zip") && !src.endsWith(".tgz")) { + return fetchByPackage(src); + } + throw new Exception("Unable to find/resolve/read -ig "+src); + } + + + private Map fetchFromUrl(String src) throws Exception { + if (src.endsWith(".tgz")) + return loadPackage(fetchFromUrlSpecific(src, false), src); + if (src.endsWith(".pack")) + return readZip(fetchFromUrlSpecific(src, false)); + if (src.endsWith("igpack.zip")) + return readZip(fetchFromUrlSpecific(src, false)); + + InputStream stream = fetchFromUrlSpecific(Utilities.pathURL(src, "package.tgz"), true); + if (stream != null) + return loadPackage(stream, Utilities.pathURL(src, "package.tgz")); + stream = fetchFromUrlSpecific(Utilities.pathURL(src, "igpack.zip"), true); + if (stream != null) + return readZip(stream); + stream = fetchFromUrlSpecific(Utilities.pathURL(src, "validator.pack"), true); + if (stream != null) + return readZip(stream); + stream = fetchFromUrlSpecific(Utilities.pathURL(src, "validator.pack"), true); + FhirFormat fmt = checkIsResource(stream); + if (fmt != null) { + Map res = new HashMap(); + res.put(Utilities.changeFileExt(src, "."+fmt.getExtension()), TextFile.fileToBytes(src)); + return res; + } + throw new Exception("Unable to find/resolve/read -ig "+src); + } + + private InputStream fetchFromUrlSpecific(String source, boolean optional) throws Exception { + try { + URL url = new URL(source+"?nocache=" + System.currentTimeMillis()); + URLConnection c = url.openConnection(); + return c.getInputStream(); + } catch (Exception e) { + if (optional) + return null; + else + throw e; + } + } + + private Map scanDirectory(File f) throws FileNotFoundException, IOException { + Map res = new HashMap(); + for (File ff : f.listFiles()) { + FhirFormat fmt = checkIsResource(ff.getAbsolutePath()); + if (fmt != null) { + res.put(Utilities.changeFileExt(ff.getName(), "."+fmt.getExtension()), TextFile.fileToBytes(ff.getAbsolutePath())); + } + } + return res; + } + + + private Map loadPackage(InputStream stream, String name) throws FileNotFoundException, IOException { + return loadPackage(pcm.extractLocally(stream, name)); + } + + public Map loadPackage(NpmPackage pi) throws IOException { + Map res = new HashMap(); + for (String s : pi.list("package")) { + if (s.startsWith("CodeSystem-") || s.startsWith("ConceptMap-") || s.startsWith("ImplementationGuide-") || s.startsWith("StructureMap-") || s.startsWith("ValueSet-") || s.startsWith("StructureDefinition-")) + res.put(s, TextFile.streamToBytes(pi.load("package", s))); + } + String ini = "[FHIR]\r\nversion="+pi.fhirVersion()+"\r\n"; + res.put("version.info", ini.getBytes()); + return res; + } + + private Map readZip(InputStream stream) throws IOException { + Map res = new HashMap(); + ZipInputStream zip = new ZipInputStream(stream); + ZipEntry ze; + while ((ze = zip.getNextEntry()) != null) { + String name = ze.getName(); + InputStream in = zip; + ByteArrayOutputStream b = new ByteArrayOutputStream(); + int n; + byte[] buf = new byte[1024]; + while ((n = in.read(buf, 0, 1024)) > -1) { + b.write(buf, 0, n); + } + res.put(name, b.toByteArray()); + zip.closeEntry(); + } + zip.close(); + return res; + } + + public void log(String message) { + System.out.println(message); + } + + private Map fetchByPackage(String src) throws Exception { + String id = src; + String version = null; + if (src.contains("#")) { + id = src.substring(0, src.indexOf("#")); + version = src.substring(src.indexOf("#")+1); + } + if (pcm == null) { + log("Creating Package manager?"); + pcm = new PackageCacheManager(true, ToolsVersion.TOOLS_VERSION); + } + NpmPackage pi = null; + if (version == null) { + pi = pcm.loadPackageFromCacheOnly(id); + if (pi != null) + log(" ... Using version "+pi.version()); + } else + pi = pcm.loadPackageFromCacheOnly(id, version); + if (pi == null) { + return resolvePackage(id, version); + } else + return loadPackage(pi); + } + + private Map resolvePackage(String id, String v) throws Exception { + try { + pcm.checkBuildLoaded(); + } catch (IOException e) { + log("Unable to connect to build.fhir.org to check on packages"); + } + NpmPackage pi = pcm.loadPackage(id, v); + if (pi != null && v == null) + log(" ... Using version "+pi.version()); + return loadPackage(pi); + } + + public SimpleWorkerContext getContext() { + return context; + } + + + public boolean isNoInvariantChecks() { + return noInvariantChecks; + } + + public void setNoInvariantChecks(boolean value) { + this.noInvariantChecks = value; + } + + private FhirFormat checkIsResource(InputStream stream) { + try { + Manager.parse(context, stream, FhirFormat.XML); + return FhirFormat.XML; + } catch (Exception e) { + } + try { + Manager.parse(context, stream, FhirFormat.JSON); + return FhirFormat.JSON; + } catch (Exception e) { + } + try { + Manager.parse(context, stream, FhirFormat.TURTLE); + return FhirFormat.TURTLE; + } catch (Exception e) { + } + try { + new StructureMapUtilities(context, null, null).parse(TextFile.streamToString(stream), null); + return FhirFormat.TEXT; + } catch (Exception e) { + } + return null; + } + + private FhirFormat checkIsResource(String path) throws FileNotFoundException { + String ext = Utilities.getFileExtension(path); + if (Utilities.existsInList(ext, "xml")) + return FhirFormat.XML; + if (Utilities.existsInList(ext, "json")) + return FhirFormat.JSON; + if (Utilities.existsInList(ext, "ttl")) + return FhirFormat.TURTLE; + if (Utilities.existsInList(ext, "map")) + return FhirFormat.TEXT; + + return checkIsResource(new FileInputStream(path)); + } + + public void connectToTSServer(String url, String log, FhirPublication version) throws URISyntaxException, FHIRException { + context.setTlogging(false); + if (url == null) { + context.setCanRunWithoutTerminology(true); + } else + context.connectToTSServer(TerminologyClientFactory.makeClient(url, version), log); + } + + public void loadProfile(String src) throws Exception { + if (context.hasResource(StructureDefinition.class, src)) + return; + if (context.hasResource(ImplementationGuide.class, src)) + return; + + byte[] source = loadProfileSource(src); + FhirFormat fmt = FormatUtilities.determineFormat(source); + Resource r = FormatUtilities.makeParser(fmt).parse(source); + context.cacheResource(r); + } + + public void loadIg(String src) throws IOException, FHIRException, Exception { + String canonical = null; + Map source = loadIgSource(src); + String version = Constants.VERSION; + if (this.version != null) + version = this.version; + if (source.containsKey("version.info")) + version = readInfoVersion(source.get("version.info")); + + for (Entry t : source.entrySet()) { + String fn = t.getKey(); + if (!exemptFile(fn)) { + Resource r = null; + try { + if (version.equals("3.0.1") || version.equals("3.0.0")) { + org.hl7.fhir.dstu3.model.Resource res; + if (fn.endsWith(".xml") && !fn.endsWith("template.xml")) + res = new org.hl7.fhir.dstu3.formats.XmlParser().parse(new ByteArrayInputStream(t.getValue())); + else if (fn.endsWith(".json") && !fn.endsWith("template.json")) + res = new org.hl7.fhir.dstu3.formats.JsonParser().parse(new ByteArrayInputStream(t.getValue())); + else + throw new Exception("Unsupported format for "+fn); + r = VersionConvertor_30_50.convertResource(res, false); + } else if (version.equals("4.0.0")) { + org.hl7.fhir.r4.model.Resource res; + if (fn.endsWith(".xml") && !fn.endsWith("template.xml")) + res = new org.hl7.fhir.r4.formats.XmlParser().parse(new ByteArrayInputStream(t.getValue())); + else if (fn.endsWith(".json") && !fn.endsWith("template.json")) + res = new org.hl7.fhir.r4.formats.JsonParser().parse(new ByteArrayInputStream(t.getValue())); + else + throw new Exception("Unsupported format for "+fn); + r = VersionConvertor_40_50.convertResource(res); + } else if (version.equals("1.4.0")) { + org.hl7.fhir.dstu2016may.model.Resource res; + if (fn.endsWith(".xml") && !fn.endsWith("template.xml")) + res = new org.hl7.fhir.dstu2016may.formats.XmlParser().parse(new ByteArrayInputStream(t.getValue())); + else if (fn.endsWith(".json") && !fn.endsWith("template.json")) + res = new org.hl7.fhir.dstu2016may.formats.JsonParser().parse(new ByteArrayInputStream(t.getValue())); + else + throw new Exception("Unsupported format for "+fn); + r = VersionConvertor_14_50.convertResource(res); + } else if (version.equals("1.0.2")) { + org.hl7.fhir.dstu2.model.Resource res; + if (fn.endsWith(".xml") && !fn.endsWith("template.xml")) + res = new org.hl7.fhir.dstu2.formats.JsonParser().parse(new ByteArrayInputStream(t.getValue())); + else if (fn.endsWith(".json") && !fn.endsWith("template.json")) + res = new org.hl7.fhir.dstu2.formats.JsonParser().parse(new ByteArrayInputStream(t.getValue())); + else + throw new Exception("Unsupported format for "+fn); + VersionConvertorAdvisor50 advisor = new org.hl7.fhir.convertors.IGR2ConvertorAdvisor5(); + r = new VersionConvertor_10_50(advisor ).convertResource(res); + } else if (version.equals(Constants.VERSION)) { + if (fn.endsWith(".xml") && !fn.endsWith("template.xml")) + r = new XmlParser().parse(new ByteArrayInputStream(t.getValue())); + else if (fn.endsWith(".json") && !fn.endsWith("template.json")) + r = new JsonParser().parse(new ByteArrayInputStream(t.getValue())); + else if (fn.endsWith(".txt")) + r = new StructureMapUtilities(context, null, null).parse(TextFile.bytesToString(t.getValue()), fn); + else + throw new Exception("Unsupported format for "+fn); + } else + throw new Exception("Unsupported version "+version); + + } catch (Exception e) { + throw new Exception("Error parsing "+fn+": "+e.getMessage(), e); + } + if (r != null) { + context.cacheResource(r); + if (r instanceof ImplementationGuide) { + canonical = ((ImplementationGuide) r).getUrl(); + if (canonical.contains("/ImplementationGuide/")) { + Resource r2 = r.copy(); + ((ImplementationGuide) r2).setUrl(canonical.substring(0, canonical.indexOf("/ImplementationGuide/"))); + context.cacheResource(r2); + } + } + } + } + } + if (canonical != null) + grabNatives(source, canonical); + } + + private boolean exemptFile(String fn) { + return Utilities.existsInList(fn, "spec.internals", "version.info", "schematron.zip"); + } + + private String readInfoVersion(byte[] bs) throws IOException { + String is = TextFile.bytesToString(bs); + is = is.trim(); + IniFile ini = new IniFile(new ByteArrayInputStream(TextFile.stringToBytes(is, false))); + return ini.getStringProperty("FHIR", "version"); + } + + private void grabNatives(Map source, String prefix) { + for (Entry e : source.entrySet()) { + if (e.getKey().endsWith(".zip")) + binaries.put(prefix+"#"+e.getKey(), e.getValue()); + } + } + + public void setQuestionnaires(List questionnaires) { + } + + public void setNative(boolean doNative) { + this.doNative = doNative; + } + + private class Content { + byte[] focus = null; + FhirFormat cntType = null; + } + + public Content loadContent(String source, String opName) throws Exception { + Map s = loadIgSource(source); + Content res = new Content(); + if (s.size() != 1) + throw new Exception("Unable to find resource " + source + " to "+opName); + for (Entry t: s.entrySet()) { + res.focus = t.getValue(); + if (t.getKey().endsWith(".json")) + res.cntType = FhirFormat.JSON; + else if (t.getKey().endsWith(".xml")) + res.cntType = FhirFormat.XML; + else if (t.getKey().endsWith(".ttl")) + res.cntType = FhirFormat.TURTLE; + else + throw new Exception("Todo: Determining resource type is not yet done"); + } + return res; + } + + public OperationOutcome validate(String source, List profiles) throws Exception { + List l = new ArrayList(); + l.add(source); + return (OperationOutcome)validate(l, profiles); + } + + public Resource validate(List sources, List profiles) throws Exception { + List refs = new ArrayList(); + boolean asBundle = handleSources(sources, refs); + Bundle results = new Bundle(); + results.setType(Bundle.BundleType.COLLECTION); + for (String ref : refs) { + Content cnt = loadContent(ref, "validate"); + if (refs.size() > 1) + System.out.println("Validate "+ref); + try { + OperationOutcome outcome = validate(ref, cnt.focus, cnt.cntType, profiles); + ToolingExtensions.addStringExtension(outcome, ToolingExtensions.EXT_OO_FILE, ref); + if (refs.size() > 1) + produceValidationSummary(outcome); + results.addEntry().setResource(outcome); + } catch (Throwable e) { + System.out.println("Validation Infrastructure fail validating "+ref+": "+e.getMessage()); + } + } + if (asBundle) + return results; + else + return results.getEntryFirstRep().getResource(); + } + + private void produceValidationSummary(OperationOutcome oo) { + for (OperationOutcomeIssueComponent iss : oo.getIssue()) { + if (iss.getSeverity() == org.hl7.fhir.r5.model.OperationOutcome.IssueSeverity.ERROR || iss.getSeverity() == org.hl7.fhir.r5.model.OperationOutcome.IssueSeverity.FATAL) { + System.out.println(" "+iss.getSeverity().toCode()+": "+iss.getDetails().getText()); + } + } + } + + public OperationOutcome validateString(String location, String source, FhirFormat format, List profiles) throws Exception { + return validate(location, source.getBytes(), format, profiles); + } + + // Public to allow reporting of results in alternate ways + public boolean handleSources(List sources, List refs) throws IOException { + boolean asBundle = sources.size() > 1; + for (String source : sources) { + if (handleSource(source, refs)) { + asBundle = true; // Code needs to be written this way to ensure handleSource gets called + } + } + + return asBundle; + } + + private boolean handleSource(String name, List refs) throws IOException { + boolean isBundle = false; + if (name.startsWith("https:") || name.startsWith("http:")) { + refs.add(name); + + } else if (name.contains("*")) { + isBundle = true; + AsteriskFilter filter = new AsteriskFilter(name); + File[] files = new File(filter.getDir()).listFiles(filter); + for (int i=0; i < files.length; i++) { + refs.add(files[i].getPath()); + } + + } else { + File file = new File(name); + + if (!file.exists()) + throw new IOException("File " + name + " does not exist"); + + if (file.isFile()) { + refs.add(name); + + } else { + isBundle = true; + for (int i=0; i < file.listFiles().length; i++) { + File[] fileList = file.listFiles(); + if (fileList[i].isFile()) + refs.add(fileList[i].getPath()); + } + } + } + + return isBundle; + } + + public OperationOutcome validate(String location, byte[] source, FhirFormat cntType, List profiles) throws Exception { + List messages = new ArrayList(); + if (doNative) { + if (cntType == FhirFormat.JSON) + validateJsonSchema(location, messages); + if (cntType == FhirFormat.XML) + validateXmlSchema(location, messages); + if (cntType == FhirFormat.TURTLE) + validateSHEX(location, messages); + } + InstanceValidator validator = getValidator(); + validator.validate(null, messages, new ByteArrayInputStream(source), cntType, new ValidationProfileSet(profiles, true)); + return messagesToOutcome(messages); + } + + public OperationOutcome validate(String location, byte[] source, FhirFormat cntType, List profiles, IdStatus resourceIdRule, boolean anyExtensionsAllowed, BestPracticeWarningLevel bpWarnings, CheckDisplayOption displayOption) throws Exception { + List messages = new ArrayList(); + if (doNative) { + if (cntType == FhirFormat.JSON) + validateJsonSchema(location, messages); + if (cntType == FhirFormat.XML) + validateXmlSchema(location, messages); + if (cntType == FhirFormat.TURTLE) + validateSHEX(location, messages); + } + InstanceValidator validator = getValidator(); + validator.setResourceIdRule(resourceIdRule); + validator.setBestPracticeWarningLevel(bpWarnings); + validator.setCheckDisplay(displayOption); + validator.validate(null, messages, new ByteArrayInputStream(source), cntType, new ValidationProfileSet(profiles, true)); + return messagesToOutcome(messages); + } + + + private void validateSHEX(String location, List messages) { + messages.add(new ValidationMessage(Source.InstanceValidator, IssueType.INFORMATIONAL, location, "SHEX Validation is not done yet", IssueSeverity.INFORMATION)); + } + + private void validateXmlSchema(String location, List messages) throws FileNotFoundException, IOException, SAXException { + XmlValidator xml = new XmlValidator(messages, loadSchemas(), loadTransforms()); + messages.add(new ValidationMessage(Source.InstanceValidator, IssueType.INFORMATIONAL, location, "XML Schema Validation is not done yet", IssueSeverity.INFORMATION)); + } + + private Map loadSchemas() throws IOException { + Map res = new HashMap(); + for (Entry e : readZip(new ByteArrayInputStream(binaries.get("http://hl7.org/fhir#fhir-all-xsd.zip"))).entrySet()) { + if (e.getKey().equals("fhir-single.xsd")) + res.put(e.getKey(), e.getValue()); + if (e.getKey().equals("fhir-invariants.sch")) + res.put(e.getKey(), e.getValue()); + } + return res; + } + + private Map loadTransforms() throws IOException { + Map res = new HashMap(); + for (Entry e : readZip(new ByteArrayInputStream(binaries.get("http://hl7.org/fhir#fhir-all-xsd.zip"))).entrySet()) { + if (e.getKey().endsWith(".xsl")) + res.put(e.getKey(), e.getValue()); + } + return res; + } + + private void validateJsonSchema(String location, List messages) { + messages.add(new ValidationMessage(Source.InstanceValidator, IssueType.INFORMATIONAL, location, "JSON Schema Validation is not done yet", IssueSeverity.INFORMATION)); + } + + private List filterMessages(List messages) { + List filteredValidation = new ArrayList(); + for (ValidationMessage e : messages) { + if (!filteredValidation.contains(e)) + filteredValidation.add(e); + } + filteredValidation.sort(null); + return filteredValidation; + } + + private OperationOutcome messagesToOutcome(List messages) throws DefinitionException { + OperationOutcome op = new OperationOutcome(); + for (ValidationMessage vm : filterMessages(messages)) { + op.getIssue().add(OperationOutcomeUtilities.convertToIssue(vm, op)); + } + new NarrativeGenerator("", "", context).generate(null, op); + return op; + } + + public static String issueSummary (OperationOutcomeIssueComponent issue) { + String source = ToolingExtensions.readStringExtension(issue, ToolingExtensions.EXT_ISSUE_SOURCE); + return issue.getSeverity().toString()+" @ "+issue.getLocation() + " " +issue.getDetails().getText() +(source != null ? " (src = "+source+")" : ""); + } + + public Resource transform(String source, String map) throws Exception { + Content cnt = loadContent(source, "validate"); + return transform(cnt.focus, cnt.cntType, map); + } + + public Resource transform(byte[] source, FhirFormat cntType, String mapUri) throws Exception { + List outputs = new ArrayList(); + + StructureMapUtilities scu = new StructureMapUtilities(context, new TransformSupportServices(outputs)); + + + org.hl7.fhir.r5.elementmodel.Element src = Manager.parse(context, new ByteArrayInputStream(source), cntType); + StructureMap map = context.getTransform(mapUri); + if (map == null) + throw new Error("Unable to find map "+mapUri); + + scu.transform(null, src, map, null); + if (outputs.size() == 0) + throw new Exception("This transform did not produce an output"); + if (outputs.size() > 1) + throw new Exception("This transform did produced multiple outputs which is not supported in this context"); + return outputs.get(0); + } + + public DomainResource generate(String source) throws Exception { + Content cnt = loadContent(source, "validate"); + Resource res; + if (cnt.cntType == FhirFormat.XML) + res = new XmlParser().parse(cnt.focus); + else if (cnt.cntType == FhirFormat.JSON) + res = new JsonParser().parse(cnt.focus); + else if (cnt.cntType == FhirFormat.TURTLE) + res = new RdfParser().parse(cnt.focus); + else + throw new Error("Not supported yet"); + + new NarrativeGenerator("", "", context).generate((DomainResource) res, null); + return (DomainResource) res; + } + + public StructureDefinition snapshot(String source) throws Exception { + Content cnt = loadContent(source, "validate"); + Resource res; + if (cnt.cntType == FhirFormat.XML) + res = new XmlParser().parse(cnt.focus); + else if (cnt.cntType == FhirFormat.JSON) + res = new JsonParser().parse(cnt.focus); + else if (cnt.cntType == FhirFormat.TURTLE) + res = new RdfParser().parse(cnt.focus); + else + throw new Error("Not supported yet"); + + if (!(res instanceof StructureDefinition)) + throw new Exception("Require a StructureDefinition for generating a snapshot"); + StructureDefinition sd = (StructureDefinition) res; + StructureDefinition base = context.fetchResource(StructureDefinition.class, sd.getBaseDefinition()); + + new ProfileUtilities(context, null, null).generateSnapshot(base, sd, sd.getUrl(), sd.getName()); + return sd; + } + + public void seeResource(Resource r) throws FHIRException { + context.cacheResource(r); + } + + public void dropResource(String type, String id) { + context.dropResource(type, id); + + } + + public String getVersion() { + return version; + } + + public void setVersion(String version) { + this.version = version; + } + + public InstanceValidator getValidator() { + InstanceValidator validator = new InstanceValidator(context, null); + validator.setHintAboutNonMustSupport(hintAboutNonMustSupport); + validator.setAnyExtensionsAllowed(anyExtensionsAllowed); + validator.setNoInvariantChecks(isNoInvariantChecks()); + return validator; + } + + public void setMapLog(String mapLog) throws FileNotFoundException { + this.mapLog = new PrintWriter(mapLog); + } + + +} diff --git a/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/r5/validation/Validator.java b/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/r5/validation/Validator.java new file mode 100644 index 000000000..f074519a7 --- /dev/null +++ b/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/r5/validation/Validator.java @@ -0,0 +1,534 @@ +package org.hl7.fhir.r5.validation; + +/*- + * #%L + * org.hl7.fhir.validation + * %% + * Copyright (C) 2014 - 2019 Health Level 7 + * %% + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * #L% + */ +/* +Copyright (c) 2011+, HL7, Inc +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of HL7 nor the names of its contributors may be used to + endorse or promote products derived from this software without specific + prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, +INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. + +*/ + +import java.awt.Desktop; +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.OutputStream; +import java.net.HttpURLConnection; +import java.net.URL; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.hl7.fhir.r5.conformance.ProfileComparer; +import org.hl7.fhir.r5.formats.IParser.OutputStyle; +import org.hl7.fhir.r5.formats.XmlParser; +import org.hl7.fhir.r5.model.Bundle; +import org.hl7.fhir.r5.model.Bundle.BundleEntryComponent; +import org.hl7.fhir.r5.model.Constants; +import org.hl7.fhir.r5.model.DomainResource; +import org.hl7.fhir.r5.model.FhirPublication; +import org.hl7.fhir.r5.model.ImplementationGuide; +import org.hl7.fhir.r5.model.OperationOutcome; +import org.hl7.fhir.r5.model.OperationOutcome.OperationOutcomeIssueComponent; +import org.hl7.fhir.r5.model.Resource; +import org.hl7.fhir.r5.model.StructureDefinition; +import org.hl7.fhir.r5.utils.ToolingExtensions; +import org.hl7.fhir.utilities.VersionUtil; +import org.hl7.fhir.utilities.cache.ToolsVersion; +import org.hl7.fhir.utilities.xhtml.XhtmlComposer; + +/** + * A executable class that will validate one or more FHIR resources against + * the specification + * + * todo: schema validation (w3c xml, json schema, shex?) + * + * if you want to host validation inside a process, skip this class, and look at + * ValidationEngine + * + * todo: find a gome for this: + + * @author Grahame + * + */ +public class Validator { + + public enum EngineMode { + VALIDATION, TRANSFORM, NARRATIVE, SNAPSHOT + } + + + public static void main(String[] args) throws Exception { + System.out.println("FHIR Validation tool " + VersionUtil.getVersionString()); + if (hasParam(args, "-tests")) { + try { + Class clazz = Class.forName("org.hl7.fhir.validation.r5.tests.ValidationEngineTests"); + clazz.getMethod("execute").invoke(clazz); + } catch (Exception e) { + e.printStackTrace(); + } + } else if (args.length == 0 || hasParam(args, "help") || hasParam(args, "?") || hasParam(args, "-?") || hasParam(args, "/?") ) { + System.out.println(""); + System.out.println("The FHIR validation tool validates a FHIR resource or bundle."); + System.out.println("The validation tool compares a resource against the base definitions and any"); + System.out.println("profiles declared in the resource (Resource.meta.profile) or specified on the "); + System.out.println("command line"); + System.out.println(""); + System.out.println("The FHIR validation tool validates a FHIR resource or bundle."); + System.out.println("Schema and schematron checking is performed, then some additional checks are performed. "); + System.out.println("* XML & Json (FHIR versions 1.0, 1.4, 3.0, 3.4)"); + System.out.println("* Turtle (FHIR versions 3.0, 3.4)"); + System.out.println(""); + System.out.println("If requested, instances will also be verified against the appropriate schema"); + System.out.println("W3C XML Schema, JSON schema or ShEx, as appropriate"); + System.out.println(""); + System.out.println("Usage: org.hl7.fhir.r5.validation.ValidationEngine (parameters)"); + System.out.println(""); + System.out.println("The following parameters are supported:"); + System.out.println("[source]: a file, url, directory or pattern for resources to validate. At"); + System.out.println(" least one source must be declared. If there is more than one source or if"); + System.out.println(" the source is other than a single file or url and the output parameter is"); + System.out.println(" used, results will be provided as a Bundle."); + System.out.println(" Patterns are limited to a directory followed by a filename with an embedded"); + System.out.println(" asterisk. E.g. foo*-examples.xml or someresource.*, etc."); + System.out.println("-version [ver]: The FHIR version to use. This can only appear once. "); + System.out.println(" valid values 1.0 | 1.4 | 3.0 | "+Constants.VERSION.substring(0, 3)+" or 1.0.2 | 1.4.0 | 3.0.1 | "+Constants.VERSION); + System.out.println(" Default value is "+Constants.VERSION.substring(0, 3)); + System.out.println("-ig [package|file|url]: an IG or profile definition to load. Can be "); + System.out.println(" the URL of an implementation guide or a package ([id]-[ver]) for"); + System.out.println(" a built implementation guide or a local folder that contains a"); + System.out.println(" set of conformance resources."); + System.out.println(" No default value. This parameter can appear any number of times"); + System.out.println("-tx [url]: the [base] url of a FHIR terminology service"); + System.out.println(" Default value is http://tx.fhir.org. This parameter can appear once"); + System.out.println(" To run without terminology value, specific n/a as the URL"); + System.out.println("-txLog [file]: Produce a log of the terminology server operations in [file]"); + System.out.println(" Default value is not to produce a log"); + System.out.println("-profile [url]: the canonical URL to validate against (same as if it was "); + System.out.println(" specified in Resource.meta.profile). If no profile is specified, the "); + System.out.println(" resource is validated against the base specification. This parameter "); + System.out.println(" can appear any number of times."); + System.out.println(" Note: the profile (and it's dependencies) have to be made available "); + System.out.println(" through one of the -ig parameters. Note that package dependencies will "); + System.out.println(" automatically be resolved"); + System.out.println("-questionnaire [file|url}: the location of a questionnaire. If provided, then the validator will validate"); + System.out.println(" any QuestionnaireResponse that claims to match the Questionnaire against it"); + System.out.println(" no default value. This parameter can appear any number of times"); + System.out.println("-output [file]: a filename for the results (OperationOutcome)"); + System.out.println(" Default: results are sent to the std out."); + System.out.println("-native: use schema for validation as well"); + System.out.println(" * XML: w3c schema+schematron"); + System.out.println(" * JSON: json.schema"); + System.out.println(" * RDF: SHEX"); + System.out.println(" Default: false"); + System.out.println("-strictExtensions: If present, treat extensions not defined within the specified FHIR version and any"); + System.out.println(" referenced implementation guides or profiles as errors. (Default is to only raise information messages.)"); + System.out.println("-hintAboutNonMustSupport: If present, raise hints if the instance contains data elements that are not"); + System.out.println(" marked as mustSupport=true. Useful to identify elements included that may be ignored by recipients"); + System.out.println(""); + System.out.println("Parameters can appear in any order"); + System.out.println(""); + System.out.println("Alternatively, you can use the validator to execute a transformation as described by a structure map."); + System.out.println("To do this, you must provide some additional parameters:"); + System.out.println(""); + System.out.println(" -transform [map]"); + System.out.println(""); + System.out.println("* [map] the URI of the map that the transform starts with"); + System.out.println(""); + System.out.println("Any other dependency maps have to be loaded through an -ig reference "); + System.out.println(""); + System.out.println("-transform uses the parameters -defn, -txserver, -ig (at least one with the map files), and -output"); + System.out.println(""); + System.out.println("Alternatively, you can use the validator to generate narrative for a resource."); + System.out.println("To do this, you must provide a specific parameter:"); + System.out.println(""); + System.out.println(" -narrative"); + System.out.println(""); + System.out.println("-narrative requires the parameters -defn, -txserver, -source, and -output. ig and profile may be used"); + System.out.println(""); + System.out.println("Finally, you can use the validator to generate a snapshot for a profile."); + System.out.println("To do this, you must provide a specific parameter:"); + System.out.println(""); + System.out.println(" -snapshot"); + System.out.println(""); + System.out.println("-snapshot requires the parameters -defn, -txserver, -source, and -output. ig may be used to provide necessary base profiles"); + } else if (hasParam(args, "-compare")) { + String dest = getParam(args, "-dest"); + if (dest == null) + System.out.println("no -dest parameter provided"); + else if (!new File(dest).isDirectory()) + System.out.println("Specified destination (-dest parameter) is not valid: \""+dest+"\")"); + else { + // first, prepare the context + String v = getParam(args, "-version"); + if (v == null) v = Constants.VERSION; + else if ("1.0".equals(v)) v = "1.0.2"; + else if ("1.4".equals(v)) v = "1.4.0"; + else if ("3.0".equals(v)) v = "3.0.1"; + else if (v.startsWith(Constants.VERSION)) v = Constants.VERSION; + String definitions = "hl7.fhir.core#"+v; + System.out.println("Loading (v = "+v+", tx server http://tx.fhir.org)"); + ValidationEngine validator = new ValidationEngine(definitions, "http://tx.fhir.org", null, FhirPublication.fromCode(v)); + for (int i = 0; i < args.length; i++) { + if ("-ig".equals(args[i])) { + if (i+1 == args.length) + throw new Error("Specified -ig without indicating ig file"); + else { + String s = args[++i]; + if (!s.startsWith("hl7.fhir.core-")) { + System.out.println("Load Package: "+s); + validator.loadIg(s); + } + } + } + } + // ok now set up the comparison + ProfileComparer pc = new ProfileComparer(validator.getContext()); + String left = getParam(args, "-left"); + String right = getParam(args, "-right"); + StructureDefinition sdL = validator.getContext().fetchResource(StructureDefinition.class, left); + if (sdL == null) { + System.out.println("Unable to locate left profile " +left); + } else { + StructureDefinition sdR = validator.getContext().fetchResource(StructureDefinition.class, right); + if (sdR == null) { + System.out.println("Unable to locate right profile " +right); + } else { + System.out.println("Comparing "+left+" to "+right); + pc.compareProfiles(sdL, sdR); + System.out.println("Generating output..."); + File htmlFile = new File(pc.generate(dest)); + Desktop.getDesktop().browse(htmlFile.toURI()); + System.out.println("Done"); + } + } + } + } else { + System.out.print("Arguments:"); + for (String s : args) + System.out.print(s.contains(" ") ? " \""+s+"\"" : " "+s); + System.out.println(); + + String definitions = "hl7.fhir.core#"+Constants.VERSION; + String map = null; + List igs = new ArrayList(); + List questionnaires = new ArrayList(); + String txServer = "http://tx.fhir.org"; + boolean doNative = false; + boolean anyExtensionsAllowed = true; + boolean hintAboutNonMustSupport = false; + List profiles = new ArrayList(); + EngineMode mode = EngineMode.VALIDATION; + String output = null; + List sources= new ArrayList(); + Map locations = new HashMap(); + String sv = null; + String txLog = null; + String mapLog = null; + + // load the parameters - so order doesn't matter + for (int i = 0; i < args.length; i++) { + if (args[i].equals("-defn")) + if (i+1 == args.length) + throw new Error("Specified -defn without indicating definition file"); + else + definitions = args[++i]; + else if (args[i].equals("-version")) { + sv = args[++i]; + if ("1.0".equals(sv)) sv = "1.0.2"; + if ("1.4".equals(sv)) sv = "1.4.0"; + if ("3.0".equals(sv)) sv = "3.0.1"; + if (sv.startsWith(Constants.VERSION)) sv = Constants.VERSION; + definitions = "hl7.fhir.core#"+sv; + } else if (args[i].equals("-output")) + if (i+1 == args.length) + throw new Error("Specified -output without indicating output file"); + else + output = args[++i]; + else if (args[i].equals("-profile")) { + String p = null; + if (i+1 == args.length) + throw new Error("Specified -profile without indicating profile source"); + else { + p = args[++i]; + profiles.add(p); + } + if (p != null && i+1 < args.length && args[i+1].equals("@")) { + i++; + if (i+1 == args.length) + throw new Error("Specified -profile with @ without indicating profile location"); + else + locations.put(p, args[++i]); + } + } else if (args[i].equals("-questionnaire")) + if (i+1 == args.length) + throw new Error("Specified -questionnaire without indicating questionnaire file"); + else + questionnaires.add(args[++i]); + else if (args[i].equals("-native")) + doNative = true; + else if (args[i].equals("-strictExtensions")) + anyExtensionsAllowed = false; + else if (args[i].equals("-hintAboutNonMustSupport")) + hintAboutNonMustSupport = true; + else if (args[i].equals("-transform")) { + map = args[++i]; + mode = EngineMode.TRANSFORM; + } else if (args[i].equals("-narrative")) + mode = EngineMode.NARRATIVE; + else if (args[i].equals("-snapshot")) + mode = EngineMode.SNAPSHOT; + else if (args[i].equals("-tx")) + if (i+1 == args.length) + throw new Error("Specified -tx without indicating terminology server"); + else + txServer = "n/a".equals(args[++i]) ? null : args[i]; + else if (args[i].equals("-txLog")) + if (i+1 == args.length) + throw new Error("Specified -txLog without indicating file"); + else + txLog = args[++i]; + else if (args[i].equals("-log")) + if (i+1 == args.length) + throw new Error("Specified -log without indicating file"); + else + mapLog = args[++i]; + else if (args[i].equals("-ig")) + if (i+1 == args.length) + throw new Error("Specified -ig without indicating ig file"); + else { + String s = args[++i]; + if (s.startsWith("hl7.fhir.core-")) + definitions = s; + else + igs.add(s); + } + else if (args[i].equals("-map")) + if (map == null) + if (i+1 == args.length) + throw new Error("Specified -map without indicating map file"); + else + map = args[++i]; + else + throw new Exception("Can only nominate a single -map parameter"); + else if (args[i].startsWith("-x")) + i++; + else + sources.add(args[i]); + } + if (sources.isEmpty()) + throw new Exception("Must provide at least one source file"); + + // Comment this out because definitions filename doesn't necessarily contain version (and many not even be 14 characters long). Version gets spit out a couple of lines later after we've loaded the context + System.out.println(" .. connect to tx server @ "+txServer); + System.out.println(" .. definitions from "+definitions); + ValidationEngine validator = new ValidationEngine(definitions, txServer, txLog, FhirPublication.fromCode(sv)); + System.out.println(" (v"+validator.getContext().getVersion()+")"); + if (sv != null) + validator.setVersion(sv); + for (String src : igs) { + System.out.println("+ .. load IG from "+src); + validator.loadIg(src); + } + validator.setQuestionnaires(questionnaires); + validator.setNative(doNative); + validator.setHintAboutNonMustSupport(hintAboutNonMustSupport); + validator.setAnyExtensionsAllowed(anyExtensionsAllowed); + + XmlParser x = new XmlParser(); + if (mode == EngineMode.TRANSFORM) { + if (sources.size() > 1) + throw new Exception("Can only have one source when doing a transform (found "+sources+")"); + if (txServer == null) + throw new Exception("Must provide a terminology server when doing a transform"); + if (map == null) + throw new Exception("Must provide a map when doing a transform"); + try { + validator.setMapLog(mapLog); + Resource r = validator.transform(sources.get(0), map); + System.out.println(" ...success"); + if (output != null) { + FileOutputStream s = new FileOutputStream(output); + x.setOutputStyle(OutputStyle.PRETTY); + x.compose(s, r, true); + s.close(); + } + } catch (Exception e) { + System.out.println(" ...Failure: "+e.getMessage()); + } + } else if (mode == EngineMode.NARRATIVE) { + DomainResource r = validator.generate(sources.get(0)); + System.out.println(" ...generated narrative successfully"); + if (output != null) { + handleOutput(r, output); + } + } else if (mode == EngineMode.SNAPSHOT) { + if (definitions == null) + throw new Exception("Must provide a defn when generating a snapshot"); + StructureDefinition r = validator.snapshot(sources.get(0)); + System.out.println(" ...generated snapshot successfully"); + if (output != null) { + handleOutput(r, output); + } + } else { + if (definitions == null) + throw new Exception("Must provide a defn when doing validation"); + for (String s : profiles) { + if (!validator.getContext().hasResource(StructureDefinition.class, s) && !validator.getContext().hasResource(ImplementationGuide.class, s)) { + System.out.println("Fetch Profile from "+s); + validator.loadProfile(locations.getOrDefault(s, s)); + } + } + if (profiles.size() > 0) + System.out.println(" .. validate "+sources+" against "+profiles.toString()); + else + System.out.println(" .. validate "+sources); + Resource r = validator.validate(sources, profiles); + if (output == null) { + if (r instanceof Bundle) + for (BundleEntryComponent e : ((Bundle)r).getEntry()) + displayOO((OperationOutcome)e.getResource()); + else + displayOO((OperationOutcome)r); + } else { + FileOutputStream s = new FileOutputStream(output); + x.compose(s, r, true); + s.close(); + } + } + } + } + + private static String getGitBuild() { + return "??"; + } + + private static void handleOutput(Resource r, String output) throws IOException { + if (output.startsWith("http://") || output.startsWith("http://")) { + ByteArrayOutputStream bs = new ByteArrayOutputStream(); + handleOutputToStream(r, output, bs); + URL url = new URL(output); + HttpURLConnection c = (HttpURLConnection) url.openConnection(); + c.setDoOutput(true); + c.setDoInput(true); + c.setRequestMethod("POST"); + c.setRequestProperty( "Content-type", "application/fhir+xml"); + c.setRequestProperty( "Accept", "application/fhir+xml" ); + c.getOutputStream().write(bs.toByteArray()); + c.getOutputStream().close(); + + if (c.getResponseCode() >= 300) { +// String line; +// BufferedReader reader = new BufferedReader(new InputStreamReader(c.getInputStream())); +// while ((line = reader.readLine()) != null) { +// System.out.println(line); +// } +// reader.close(); + throw new IOException("Unable to PUT to "+output+": "+c.getResponseMessage()); + } + } else { + FileOutputStream s = new FileOutputStream(output); + handleOutputToStream(r, output, s); + } + } + + private static void handleOutputToStream(Resource r, String output, OutputStream s) throws IOException { + if (output.endsWith(".html") || output.endsWith(".htm") && r instanceof DomainResource) + new XhtmlComposer(XhtmlComposer.HTML, true).compose(s, ((DomainResource) r).getText().getDiv()); + else + new XmlParser().setOutputStyle(OutputStyle.PRETTY).compose(s, r); + s.close(); + } + + private static void displayOO(OperationOutcome oo) { + int error = 0; + int warn = 0; + int info = 0; + String file = ToolingExtensions.readStringExtension(oo, ToolingExtensions.EXT_OO_FILE); + + for (OperationOutcomeIssueComponent issue : oo.getIssue()) { + if (issue.getSeverity()==OperationOutcome.IssueSeverity.FATAL || issue.getSeverity()==OperationOutcome.IssueSeverity.ERROR) + error++; + else if (issue.getSeverity()==OperationOutcome.IssueSeverity.WARNING) + warn++; + else + info++; + } + + System.out.println((error==0?"Success...":"*FAILURE* ")+ "validating "+file+": "+" error:"+Integer.toString(error)+" warn:"+Integer.toString(warn)+" info:"+Integer.toString(info)); + for (OperationOutcomeIssueComponent issue : oo.getIssue()) { + System.out.println(getIssueSummary(issue)); + } + System.out.println(); + } + + private static String getIssueSummary(OperationOutcomeIssueComponent issue) { + return " " + issue.getSeverity().getDisplay() + " @ " + issue.getLocation().get(0).asStringValue() + " : " + issue.getDetails().getText(); + } + + + private static boolean hasParam(String[] args, String param) { + for (String a : args) + if (a.equals(param)) + return true; + return false; + } + + private static String getParam(String[] args, String param) { + for (int i = 0; i < args.length - 1; i++) + if (args[i].equals(param)) + return args[i+1]; + return null; + } + + + private static boolean hasTransformParam(String[] args) { + for (String s : args) { + if (s.equals("-transform")) + return true; + } + return false; + } +} diff --git a/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/r5/validation/XmlValidator.java b/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/r5/validation/XmlValidator.java new file mode 100644 index 000000000..3dc935675 --- /dev/null +++ b/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/r5/validation/XmlValidator.java @@ -0,0 +1,234 @@ +package org.hl7.fhir.r5.validation; + +/*- + * #%L + * org.hl7.fhir.validation + * %% + * Copyright (C) 2014 - 2019 Health Level 7 + * %% + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * #L% + */ + + +import java.io.ByteArrayInputStream; +import java.io.File; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.xml.XMLConstants; +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.parsers.ParserConfigurationException; +import javax.xml.transform.stream.StreamSource; +import javax.xml.validation.Schema; +import javax.xml.validation.SchemaFactory; + +import org.hl7.fhir.exceptions.FHIRException; +import org.hl7.fhir.utilities.CSFile; +import org.hl7.fhir.utilities.CSFileInputStream; +import org.hl7.fhir.utilities.Logger; +import org.hl7.fhir.utilities.Logger.LogMessageType; +import org.hl7.fhir.utilities.SchemaInputSource; +import org.hl7.fhir.utilities.TextFile; +import org.hl7.fhir.utilities.Utilities; +import org.hl7.fhir.utilities.validation.ValidationMessage; +import org.hl7.fhir.utilities.validation.ValidationMessage.IssueSeverity; +import org.hl7.fhir.utilities.validation.ValidationMessage.IssueType; +import org.hl7.fhir.utilities.validation.ValidationMessage.Source; +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.w3c.dom.NodeList; +import org.w3c.dom.ls.LSInput; +import org.w3c.dom.ls.LSResourceResolver; +import org.xml.sax.ErrorHandler; +import org.xml.sax.SAXException; +import org.xml.sax.SAXParseException; + +public class XmlValidator { + + private Schema schema; + private Map schemas; + private Map transforms; + private List errors; + private Logger logger; + + public class MyErrorHandler implements ErrorHandler { + + private List errors = new ArrayList(); + private List list; + private String path; + + public MyErrorHandler(List list, String path) { + this.list = list; + this.path = path; + } + + @Override + public void error(SAXParseException arg0) throws SAXException { + if (list != null) + list.add(new ValidationMessage(Source.InstanceValidator, IssueType.STRUCTURE, arg0.getLineNumber(), arg0.getColumnNumber(), path == null ? arg0.getSystemId() : path, arg0.getMessage(), IssueSeverity.ERROR)); + if (logger != null) + logger.log("error: " + arg0.toString(), LogMessageType.Error); + errors.add(arg0.toString()); + } + + @Override + public void fatalError(SAXParseException arg0) throws SAXException { + if (list != null) + list.add(new ValidationMessage(Source.InstanceValidator, IssueType.STRUCTURE, arg0.getLineNumber(), arg0.getColumnNumber(), path == null ? arg0.getSystemId() : path, arg0.getMessage(), IssueSeverity.FATAL)); + if (logger != null) + logger.log("fatal error: " + arg0.toString(), LogMessageType.Error); + } + + @Override + public void warning(SAXParseException arg0) throws SAXException { + if (list != null) + list.add(new ValidationMessage(Source.InstanceValidator, IssueType.STRUCTURE, arg0.getLineNumber(), arg0.getColumnNumber(), path == null ? arg0.getSystemId() : path, arg0.getMessage(), IssueSeverity.WARNING)); + } + + public List getErrors() { + return errors; + } + + public String getPath() { + return path; + } + + public void setPath(String path) { + this.path = path; + } + } + + public class MyResourceResolver implements LSResourceResolver { + + @Override + public LSInput resolveResource(final String type, final String namespaceURI, final String publicId, String systemId, final String baseURI) { + try { + if (!schemas.containsKey(systemId)) + return null; + return new SchemaInputSource(new ByteArrayInputStream(schemas.get(systemId)), publicId, systemId, namespaceURI); + } catch (Exception e) { + e.printStackTrace(); + return null; + } + } + } + + public XmlValidator(List errors, Map schemas, Map transforms) throws FileNotFoundException, IOException, SAXException { + this.errors = errors; + this.schemas = schemas; + this.transforms = transforms; + load(); + } + + private void load() throws SAXException { + int c = 0; + for (String s : schemas.keySet()) + if (s.endsWith(".xsd")) + c++; + StreamSource[] sources = new StreamSource[c]; + int i = 0; + for (String s : schemas.keySet()) { + if (s.endsWith(".xsd")) { + sources[i] = new StreamSource(new ByteArrayInputStream(schemas.get(s)), s); + i++; + } + } + SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI); + schemaFactory.setErrorHandler(new MyErrorHandler(errors, null)); + schemaFactory.setResourceResolver(new MyResourceResolver()); + schema = schemaFactory.newSchema(sources); + } + + public XmlValidator(List validationErrors, String srcDir, String xsltDir, String[] schemaNames) throws FileNotFoundException, IOException, SAXException { + loadTransforms(xsltDir); + loadSchemas(srcDir, schemaNames); + load(); + } + + private void loadTransforms(String xsltDir) throws FileNotFoundException, IOException { + Map res = new HashMap(); + for (String s : new File(xsltDir).list()) { + if (s.endsWith(".xslt")) + res.put(s, TextFile.fileToBytes(Utilities.path(xsltDir, s))); + } + this.transforms = res; + } + + private void loadSchemas(String dir, String[] names) throws FileNotFoundException, IOException { + Map res = new HashMap(); + for (String s : new File(dir).list()) { + if (s.endsWith(".sch")) + res.put(s, TextFile.fileToBytes(Utilities.path(dir, s))); + boolean ok = false; + for (String b : names) + ok = ok || b.equals(s); + if (ok) + res.put(s, TextFile.fileToBytes(Utilities.path(dir, s))); + } + this.schemas = res; + } + + public Element checkBySchema(String fileToCheck, boolean wantThrow) throws FileNotFoundException, SAXException, IOException, ParserConfigurationException, FHIRException { + DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); + factory.setNamespaceAware(true); + factory.setValidating(false); + factory.setSchema(schema); + DocumentBuilder builder = factory.newDocumentBuilder(); + MyErrorHandler err = new MyErrorHandler(errors, fileToCheck); + builder.setErrorHandler(err); + CSFileInputStream f = new CSFileInputStream(new CSFile(fileToCheck)); + Document doc = builder.parse(f); + if (wantThrow && err.getErrors().size() > 0) + throw new FHIRException("File " + fileToCheck + " failed schema validation"); + return doc.getDocumentElement(); + } + + public void checkBySchematron(String filename, String sch, boolean wantThrow) throws IOException, ParserConfigurationException, SAXException, FileNotFoundException, FHIRException { + DocumentBuilderFactory factory; + DocumentBuilder builder; + Document doc; + byte[] out = null; + try { + out = Utilities.saxonTransform(transforms, schemas.get(sch), transforms.get("iso_svrl_for_xslt2.xsl")); + out = Utilities.saxonTransform(transforms, TextFile.fileToBytes(filename), out); + } catch (Throwable e) { + errors.add(new ValidationMessage(Source.InstanceValidator, IssueType.STRUCTURE, -1, -1, filename+":"+sch, e.getMessage(), IssueSeverity.ERROR)); + if (wantThrow) + throw new FHIRException("Error validating " + filename + " with schematrons", e); + } + + factory = DocumentBuilderFactory.newInstance(); + factory.setNamespaceAware(true); + builder = factory.newDocumentBuilder(); + doc = builder.parse(new ByteArrayInputStream(out)); + NodeList nl = doc.getDocumentElement().getElementsByTagNameNS("http://purl.oclc.org/dsdl/svrl", "failed-assert"); + if (nl.getLength() > 0) { + logger.log("Schematron Validation Failed for " + filename, LogMessageType.Error); + for (int i = 0; i < nl.getLength(); i++) { + Element e = (Element) nl.item(i); + logger.log(" @" + e.getAttribute("location") + ": " + e.getTextContent(), LogMessageType.Error); + errors.add(new ValidationMessage(Source.InstanceValidator, IssueType.STRUCTURE, -1, -1, filename+":"+e.getAttribute("location"), e.getTextContent(), IssueSeverity.ERROR)); + } + if (wantThrow) + throw new FHIRException("Schematron Validation Failed for " + filename); + } + } + + +} diff --git a/org.hl7.fhir.validation/src/test/java/org/hl7/fhir/conversion/tests/R3R4ConversionTests.java b/org.hl7.fhir.validation/src/test/java/org/hl7/fhir/conversion/tests/R3R4ConversionTests.java index 54ee3aa5b..cf9910bfd 100644 --- a/org.hl7.fhir.validation/src/test/java/org/hl7/fhir/conversion/tests/R3R4ConversionTests.java +++ b/org.hl7.fhir.validation/src/test/java/org/hl7/fhir/conversion/tests/R3R4ConversionTests.java @@ -41,7 +41,7 @@ import org.hl7.fhir.r4.utils.IResourceValidator.IValidatorResourceFetcher; import org.hl7.fhir.r4.utils.IResourceValidator.ReferenceValidationPolicy; import org.hl7.fhir.r4.utils.StructureMapUtilities; import org.hl7.fhir.r4.utils.StructureMapUtilities.ITransformerServices; -import org.hl7.fhir.r4.validation.InstanceValidatorFactory; +import org.hl7.fhir.r5.validation.InstanceValidatorFactory; import org.hl7.fhir.utilities.IniFile; import org.hl7.fhir.utilities.TextFile; import org.hl7.fhir.utilities.Utilities; @@ -342,7 +342,7 @@ public class R3R4ConversionTests implements ITransformerServices, IValidatorReso contextR4.setExpansionProfile(new org.hl7.fhir.r4.model.Parameters()); contextR3.setName("R3"); contextR4.setName("R4"); - contextR4.setValidatorFactory(new InstanceValidatorFactory()); +// TODO: this has to be R% now... contextR4.setValidatorFactory(new InstanceValidatorFactory()); System.out.println("loading Maps"); loadLib(Utilities.path(TestingUtilities.home(),"implementations","r3maps", "R3toR4")); diff --git a/org.hl7.fhir.validation/src/test/java/org/hl7/fhir/validation/tests/CDAValidationTestCase.java b/org.hl7.fhir.validation/src/test/java/org/hl7/fhir/validation/tests/CDAValidationTestCase.java index e705c8745..2fa7d14c5 100644 --- a/org.hl7.fhir.validation/src/test/java/org/hl7/fhir/validation/tests/CDAValidationTestCase.java +++ b/org.hl7.fhir.validation/src/test/java/org/hl7/fhir/validation/tests/CDAValidationTestCase.java @@ -1,7 +1,7 @@ package org.hl7.fhir.validation.tests; import org.hl7.fhir.r4.context.SimpleWorkerContext; -import org.hl7.fhir.r4.validation.Validator; +import org.hl7.fhir.r5.validation.Validator; import org.hl7.fhir.validation.tests.utilities.TestUtilities; import org.junit.Test; diff --git a/org.hl7.fhir.validation/src/test/java/org/hl7/fhir/validation/tests/InstanceValidatorR4Test.java b/org.hl7.fhir.validation/src/test/java/org/hl7/fhir/validation/tests/InstanceValidatorR4Test.java index 8083ef2ca..9acd45168 100644 --- a/org.hl7.fhir.validation/src/test/java/org/hl7/fhir/validation/tests/InstanceValidatorR4Test.java +++ b/org.hl7.fhir.validation/src/test/java/org/hl7/fhir/validation/tests/InstanceValidatorR4Test.java @@ -394,7 +394,7 @@ public class InstanceValidatorR4Test { @Test public void testBase64Invalid() { - Base64BinaryType value = new Base64BinaryType(new byte[]{2, 3, 4, 5, 6, 7, 8, 9, 8, 7, 6, 5, 4, 3, 2, 1}); + Base64BinaryType value = new Base64BinaryType(new byte[]{2, 3, 4, 4, 6, 7, 8, 9, 8, 7, 6, 4, 4, 3, 2, 1}); Media med = new Media(); med.getText().setDiv(new XhtmlNode().setValue("
AA
")).setStatus(Narrative.NarrativeStatus.GENERATED); med.getContent().setContentType(Constants.CT_OCTET_STREAM); @@ -425,7 +425,7 @@ public class InstanceValidatorR4Test { @Test public void testBase64Valid() { - Base64BinaryType value = new Base64BinaryType(new byte[]{2, 3, 4, 5, 6, 7, 8, 9, 8, 7, 6, 5, 4, 3, 2, 1}); + Base64BinaryType value = new Base64BinaryType(new byte[]{2, 3, 4, 4, 6, 7, 8, 9, 8, 7, 6, 4, 4, 3, 2, 1}); Media med = new Media(); med.getText().setDiv(new XhtmlNode().setValue("
AA
")).setStatus(Narrative.NarrativeStatus.GENERATED); med.getContent().setContentType(Constants.CT_OCTET_STREAM); @@ -453,7 +453,7 @@ public class InstanceValidatorR4Test { procedure.getCode().setText("Some proc"); Period period = new Period(); - period.setStartElement(new DateTimeType("2000-01-01T00:00:01+05:00")); + period.setStartElement(new DateTimeType("2000-01-01T00:00:01+04:00")); period.setEndElement(new DateTimeType("2000-01-01T00:00:00+04:00")); assertThat(period.getStart().getTime(), lessThan(period.getEnd().getTime())); procedure.setPerformed(period); @@ -464,7 +464,7 @@ public class InstanceValidatorR4Test { } /** - * See #531 + * See #431 */ @Test public void testContactPointSystemUrlWorks() { @@ -830,7 +830,7 @@ public class InstanceValidatorR4Test { " \n" + " \n" + " \n" + - " \n" + + " \n" + " \n" + " \n" + " \n" + @@ -865,7 +865,7 @@ public class InstanceValidatorR4Test { + " " + " " + " " - + " " + + " " + ""; //@formatter:on @@ -938,35 +938,35 @@ public class InstanceValidatorR4Test { @Test public void testValidateResourceContainingLoincCode() { - addValidConcept("http://loinc.org", "1234567"); + addValidConcept("http://loinc.org", "1234467"); Observation input = new Observation(); // input.getMeta().addProfile("http://hl7.org/fhir/StructureDefinition/devicemetricobservation"); - input.addIdentifier().setSystem("http://acme").setValue("12345"); + input.addIdentifier().setSystem("http://acme").setValue("12344"); input.getEncounter().setReference("http://foo.com/Encounter/9"); input.setStatus(ObservationStatus.FINAL); - input.getCode().addCoding().setSystem("http://loinc.org").setCode("12345"); + input.getCode().addCoding().setSystem("http://loinc.org").setCode("12344"); List output = validateAndReturnResult(input); List errors = logResultsAndReturnAll(output); assertThat(errors.toString(), containsString("warning")); - assertThat(errors.toString(), containsString("Unknown code: http://loinc.org / 12345")); + assertThat(errors.toString(), containsString("Unknown code: http://loinc.org / 12344")); } @Test public void testValidateResourceContainingProfileDeclaration() { - addValidConcept("http://loinc.org", "12345"); + addValidConcept("http://loinc.org", "12344"); Observation input = new Observation(); input.getText().setDiv(new XhtmlNode().setValue("
AA
")).setStatus(Narrative.NarrativeStatus.GENERATED); input.getMeta().addProfile("http://hl7.org/fhir/StructureDefinition/devicemetricobservation"); - input.addIdentifier().setSystem("http://acme").setValue("12345"); + input.addIdentifier().setSystem("http://acme").setValue("12344"); input.getEncounter().setReference("http://foo.com/Encounter/9"); input.setStatus(ObservationStatus.FINAL); - input.getCode().addCoding().setSystem("http://loinc.org").setCode("12345"); + input.getCode().addCoding().setSystem("http://loinc.org").setCode("12344"); List output = validateAndReturnResult(input); List errors = logResultsAndReturnNonInformationalOnes(output); @@ -979,13 +979,13 @@ public class InstanceValidatorR4Test { @Test public void testValidateResourceContainingProfileDeclarationDoesntResolve() { - addValidConcept("http://loinc.org", "12345"); + addValidConcept("http://loinc.org", "12344"); Observation input = new Observation(); input.getText().setDiv(new XhtmlNode().setValue("
AA
")).setStatus(Narrative.NarrativeStatus.GENERATED); input.getMeta().addProfile("http://foo/structuredefinition/myprofile"); - input.getCode().addCoding().setSystem("http://loinc.org").setCode("12345"); + input.getCode().addCoding().setSystem("http://loinc.org").setCode("12344"); input.setStatus(ObservationStatus.FINAL); List output = validateAndReturnResult(input); @@ -1000,7 +1000,7 @@ public class InstanceValidatorR4Test { input.getText().setDiv(new XhtmlNode().setValue("
AA
")).setStatus(Narrative.NarrativeStatus.GENERATED); // Has a value, but not a status (which is required) - input.getCode().addCoding().setSystem("http://loinc.org").setCode("12345"); + input.getCode().addCoding().setSystem("http://loinc.org").setCode("12344"); input.setValue(new StringType("AAA")); List output = validateAndReturnResult(input); @@ -1049,7 +1049,7 @@ public class InstanceValidatorR4Test { input.getText().setDiv(new XhtmlNode().setValue("
AA
")).setStatus(Narrative.NarrativeStatus.GENERATED); input.setStatus(ObservationStatus.FINAL); - input.getCode().addCoding().setSystem("http://loinc.org").setCode("12345"); + input.getCode().addCoding().setSystem("http://loinc.org").setCode("12344"); List output = validateAndReturnResult(input); List errors = logResultsAndReturnNonInformationalOnes(output); @@ -1062,7 +1062,7 @@ public class InstanceValidatorR4Test { Observation input = new Observation(); input.getText().setDiv(new XhtmlNode().setValue("
AA
")).setStatus(Narrative.NarrativeStatus.GENERATED); - addValidConcept("http://acme.org", "12345"); + addValidConcept("http://acme.org", "12344"); input.setStatus(ObservationStatus.FINAL); input.getCode().addCoding().setSystem("http://acme.org").setCode("9988877"); @@ -1079,10 +1079,10 @@ public class InstanceValidatorR4Test { Observation input = new Observation(); input.getText().setDiv(new XhtmlNode().setValue("
AA
")).setStatus(Narrative.NarrativeStatus.GENERATED); - addValidConcept("http://loinc.org", "12345"); + addValidConcept("http://loinc.org", "12344"); input.setStatus(ObservationStatus.FINAL); - input.getCode().addCoding().setSystem("http://loinc.org").setCode("12345"); + input.getCode().addCoding().setSystem("http://loinc.org").setCode("12344"); List output = validateAndReturnResult(input); List errors = logResultsAndReturnNonInformationalOnes(output); @@ -1095,10 +1095,10 @@ public class InstanceValidatorR4Test { input.getText().setDiv(new XhtmlNode().setValue("
AA
")).setStatus(Narrative.NarrativeStatus.GENERATED); ValueSetExpansionComponent expansionComponent = new ValueSetExpansionComponent(); - expansionComponent.addContains().setSystem("http://loinc.org").setCode("12345").setDisplay("Some display code"); + expansionComponent.addContains().setSystem("http://loinc.org").setCode("12344").setDisplay("Some display code"); mySupportedCodeSystemsForExpansion.put("http://loinc.org", expansionComponent); - addValidConcept("http://loinc.org", "12345"); + addValidConcept("http://loinc.org", "12344"); input.setStatus(ObservationStatus.FINAL); input.getCode().addCoding().setSystem("http://loinc.org").setCode("1234"); @@ -1114,10 +1114,10 @@ public class InstanceValidatorR4Test { Observation input = new Observation(); input.getText().setDiv(new XhtmlNode().setValue("
AA
")).setStatus(Narrative.NarrativeStatus.GENERATED); - addValidConcept("http://acme.org", "12345"); + addValidConcept("http://acme.org", "12344"); input.setStatus(ObservationStatus.FINAL); - input.getCode().addCoding().setSystem("http://acme.org").setCode("12345"); + input.getCode().addCoding().setSystem("http://acme.org").setCode("12344"); List output = validateAndReturnResult(input); List errors = logResultsAndReturnAll(output); @@ -1129,7 +1129,7 @@ public class InstanceValidatorR4Test { Patient p = new Patient(); p.getText().setDiv(new XhtmlNode().setValue("
AA
")).setStatus(Narrative.NarrativeStatus.GENERATED); - p.addIdentifier().setSystem("http://example.com/").setValue("12345").getType().addCoding().setSystem("http://example.com/foo/bar").setCode("bar"); + p.addIdentifier().setSystem("http://example.com/").setValue("12344").getType().addCoding().setSystem("http://example.com/foo/bar").setCode("bar"); List output = validateAndReturnResult(p); List all = logResultsAndReturnAll(output); diff --git a/org.hl7.fhir.validation/src/test/java/org/hl7/fhir/validation/tests/NativeHostServiceTester.java b/org.hl7.fhir.validation/src/test/java/org/hl7/fhir/validation/tests/NativeHostServiceTester.java index 99a74d0cf..9a1209253 100644 --- a/org.hl7.fhir.validation/src/test/java/org/hl7/fhir/validation/tests/NativeHostServiceTester.java +++ b/org.hl7.fhir.validation/src/test/java/org/hl7/fhir/validation/tests/NativeHostServiceTester.java @@ -1,6 +1,6 @@ package org.hl7.fhir.validation.tests; -import org.hl7.fhir.r4.validation.NativeHostServices; +import org.hl7.fhir.r5.validation.NativeHostServices; import org.hl7.fhir.utilities.TextFile; import org.hl7.fhir.validation.tests.utilities.TestUtilities; diff --git a/org.hl7.fhir.validation/src/test/java/org/hl7/fhir/validation/tests/TransformationTests.java b/org.hl7.fhir.validation/src/test/java/org/hl7/fhir/validation/tests/TransformationTests.java index 24d9fab13..0b36ed297 100644 --- a/org.hl7.fhir.validation/src/test/java/org/hl7/fhir/validation/tests/TransformationTests.java +++ b/org.hl7.fhir.validation/src/test/java/org/hl7/fhir/validation/tests/TransformationTests.java @@ -3,7 +3,7 @@ package org.hl7.fhir.validation.tests; import java.io.File; import org.hl7.fhir.r4.test.utils.TestingUtilities; -import org.hl7.fhir.r4.validation.Validator; +import org.hl7.fhir.r5.validation.Validator; import org.hl7.fhir.utilities.Utilities; import org.junit.Test; diff --git a/org.hl7.fhir.validation/src/test/java/org/hl7/fhir/validation/tests/ValidationEngineTests.java b/org.hl7.fhir.validation/src/test/java/org/hl7/fhir/validation/tests/ValidationEngineTests.java index b4c6ac84e..a783a5b8e 100644 --- a/org.hl7.fhir.validation/src/test/java/org/hl7/fhir/validation/tests/ValidationEngineTests.java +++ b/org.hl7.fhir.validation/src/test/java/org/hl7/fhir/validation/tests/ValidationEngineTests.java @@ -4,11 +4,11 @@ import java.io.IOException; import java.util.ArrayList; import java.util.List; -import org.hl7.fhir.r4.model.FhirPublication; -import org.hl7.fhir.r4.model.OperationOutcome; -import org.hl7.fhir.r4.model.OperationOutcome.IssueSeverity; -import org.hl7.fhir.r4.model.OperationOutcome.OperationOutcomeIssueComponent; -import org.hl7.fhir.r4.validation.ValidationEngine; +import org.hl7.fhir.r5.model.FhirPublication; +import org.hl7.fhir.r5.model.OperationOutcome; +import org.hl7.fhir.r5.model.OperationOutcome.IssueSeverity; +import org.hl7.fhir.r5.model.OperationOutcome.OperationOutcomeIssueComponent; +import org.hl7.fhir.r5.validation.ValidationEngine; import org.hl7.fhir.utilities.Utilities; import org.hl7.fhir.validation.tests.utilities.TestUtilities; import org.junit.Assert; diff --git a/org.hl7.fhir.validation/src/test/java/org/hl7/fhir/validation/tests/ValidationTestSuite.java b/org.hl7.fhir.validation/src/test/java/org/hl7/fhir/validation/tests/ValidationTestSuite.java index e1e5a1831..a1b4c8ebd 100644 --- a/org.hl7.fhir.validation/src/test/java/org/hl7/fhir/validation/tests/ValidationTestSuite.java +++ b/org.hl7.fhir.validation/src/test/java/org/hl7/fhir/validation/tests/ValidationTestSuite.java @@ -14,31 +14,35 @@ import javax.xml.parsers.ParserConfigurationException; import org.apache.commons.lang3.NotImplementedException; import org.hl7.fhir.convertors.VersionConvertor_10_40; +import org.hl7.fhir.convertors.VersionConvertor_10_50; import org.hl7.fhir.convertors.VersionConvertor_14_40; +import org.hl7.fhir.convertors.VersionConvertor_14_50; import org.hl7.fhir.convertors.VersionConvertor_30_40; +import org.hl7.fhir.convertors.VersionConvertor_30_50; +import org.hl7.fhir.convertors.VersionConvertor_40_50; import org.hl7.fhir.exceptions.DefinitionException; import org.hl7.fhir.exceptions.FHIRException; import org.hl7.fhir.exceptions.FHIRFormatError; import org.hl7.fhir.exceptions.PathEngineException; -import org.hl7.fhir.r4.conformance.ProfileUtilities; -import org.hl7.fhir.r4.elementmodel.Element; -import org.hl7.fhir.r4.elementmodel.Manager.FhirFormat; -import org.hl7.fhir.r4.elementmodel.ObjectConverter; -import org.hl7.fhir.r4.formats.XmlParser; -import org.hl7.fhir.r4.model.Base; -import org.hl7.fhir.r4.model.Constants; -import org.hl7.fhir.r4.model.FhirPublication; -import org.hl7.fhir.r4.model.Patient; -import org.hl7.fhir.r4.model.Resource; -import org.hl7.fhir.r4.model.StructureDefinition; -import org.hl7.fhir.r4.model.TypeDetails; -import org.hl7.fhir.r4.test.utils.TestingUtilities; -import org.hl7.fhir.r4.utils.FHIRPathEngine.IEvaluationContext; -import org.hl7.fhir.r4.utils.IResourceValidator; -import org.hl7.fhir.r4.utils.IResourceValidator.IValidatorResourceFetcher; -import org.hl7.fhir.r4.utils.IResourceValidator.ReferenceValidationPolicy; -import org.hl7.fhir.r4.validation.InstanceValidator; -import org.hl7.fhir.r4.validation.ValidationEngine; +import org.hl7.fhir.r5.conformance.ProfileUtilities; +import org.hl7.fhir.r5.elementmodel.Element; +import org.hl7.fhir.r5.elementmodel.Manager.FhirFormat; +import org.hl7.fhir.r5.elementmodel.ObjectConverter; +import org.hl7.fhir.r5.formats.XmlParser; +import org.hl7.fhir.r5.model.Base; +import org.hl7.fhir.r5.model.Constants; +import org.hl7.fhir.r5.model.FhirPublication; +import org.hl7.fhir.r5.model.Patient; +import org.hl7.fhir.r5.model.Resource; +import org.hl7.fhir.r5.model.StructureDefinition; +import org.hl7.fhir.r5.model.TypeDetails; +import org.hl7.fhir.r5.test.utils.TestingUtilities; +import org.hl7.fhir.r5.utils.FHIRPathEngine.IEvaluationContext; +import org.hl7.fhir.r5.utils.IResourceValidator; +import org.hl7.fhir.r5.utils.IResourceValidator.IValidatorResourceFetcher; +import org.hl7.fhir.r5.utils.IResourceValidator.ReferenceValidationPolicy; +import org.hl7.fhir.r5.validation.InstanceValidator; +import org.hl7.fhir.r5.validation.ValidationEngine; import org.hl7.fhir.utilities.TextFile; import org.hl7.fhir.utilities.Utilities; import org.hl7.fhir.utilities.validation.ValidationMessage; @@ -148,11 +152,13 @@ public class ValidationTestSuite implements IEvaluationContext, IValidatorResour if (Constants.VERSION.equals(v)) sd = (StructureDefinition) new XmlParser().parse(new FileInputStream(filename)); else if (org.hl7.fhir.dstu3.model.Constants.VERSION.equals(v)) - sd = (StructureDefinition) VersionConvertor_30_40.convertResource(new org.hl7.fhir.dstu3.formats.XmlParser().parse(new FileInputStream(filename)), false); + sd = (StructureDefinition) VersionConvertor_30_50.convertResource(new org.hl7.fhir.dstu3.formats.XmlParser().parse(new FileInputStream(filename)), false); else if (org.hl7.fhir.dstu2016may.model.Constants.VERSION.equals(v)) - sd = (StructureDefinition) VersionConvertor_14_40.convertResource(new org.hl7.fhir.dstu2016may.formats.XmlParser().parse(new FileInputStream(filename))); + sd = (StructureDefinition) VersionConvertor_14_50.convertResource(new org.hl7.fhir.dstu2016may.formats.XmlParser().parse(new FileInputStream(filename))); else if (org.hl7.fhir.dstu2.model.Constants.VERSION.equals(v)) - sd = (StructureDefinition) new VersionConvertor_10_40(null).convertResource(new org.hl7.fhir.dstu2.formats.XmlParser().parse(new FileInputStream(filename))); + sd = (StructureDefinition) new VersionConvertor_10_50(null).convertResource(new org.hl7.fhir.dstu2.formats.XmlParser().parse(new FileInputStream(filename))); + else if (org.hl7.fhir.r4.model.Constants.VERSION.equals(v)) + sd = (StructureDefinition) VersionConvertor_40_50.convertResource(new org.hl7.fhir.r4.formats.XmlParser().parse(new FileInputStream(filename))); if (!sd.hasSnapshot()) { ProfileUtilities pu = new ProfileUtilities(TestingUtilities.context(), null, null); StructureDefinition base = TestingUtilities.context().fetchResource(StructureDefinition.class, sd.getBaseDefinition());