fix conversion of contexts invariant for resources

This commit is contained in:
Grahame Grieve 2020-01-19 16:52:22 +11:00
parent 06b413f028
commit fa3c8305bf
6 changed files with 136 additions and 27 deletions

View File

@ -10406,7 +10406,7 @@ public class VersionConvertor_10_40 {
tgt.setAbstract(src.getAbstract()); tgt.setAbstract(src.getAbstract());
for (org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionContextComponent t : src.getContext()) { for (org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionContextComponent t : src.getContext()) {
if (!tgt.hasContextType()) if (!tgt.hasContextType())
tgt.setContextType(convertExtensionContext(t.getType())); tgt.setContextType(convertExtensionContext(t.getType(), t.getExpression()));
tgt.addContext(t.getExpression()); tgt.addContext(t.getExpression());
} }
tgt.setConstrainedType(src.getType()); tgt.setConstrainedType(src.getType());
@ -10457,25 +10457,42 @@ public class VersionConvertor_10_40 {
if (src == null) if (src == null)
return null; return null;
switch (src) { switch (src) {
case RESOURCE: return org.hl7.fhir.r4.model.StructureDefinition.ExtensionContextType.FHIRPATH; case RESOURCE: return org.hl7.fhir.r4.model.StructureDefinition.ExtensionContextType.ELEMENT;
case DATATYPE: return org.hl7.fhir.r4.model.StructureDefinition.ExtensionContextType.ELEMENT; case DATATYPE: return org.hl7.fhir.r4.model.StructureDefinition.ExtensionContextType.ELEMENT;
case EXTENSION: return org.hl7.fhir.r4.model.StructureDefinition.ExtensionContextType.EXTENSION; case EXTENSION: return org.hl7.fhir.r4.model.StructureDefinition.ExtensionContextType.EXTENSION;
default: return org.hl7.fhir.r4.model.StructureDefinition.ExtensionContextType.NULL; default: return org.hl7.fhir.r4.model.StructureDefinition.ExtensionContextType.NULL;
} }
} }
private static org.hl7.fhir.dstu2.model.StructureDefinition.ExtensionContext convertExtensionContext(org.hl7.fhir.r4.model.StructureDefinition.ExtensionContextType src) throws FHIRException { private static org.hl7.fhir.dstu2.model.StructureDefinition.ExtensionContext convertExtensionContext(org.hl7.fhir.r4.model.StructureDefinition.ExtensionContextType src, String expression) throws FHIRException {
if (src == null) if (src == null)
return null; return null;
switch (src) { switch (src) {
case FHIRPATH: return org.hl7.fhir.dstu2.model.StructureDefinition.ExtensionContext.RESOURCE; case FHIRPATH: return org.hl7.fhir.dstu2.model.StructureDefinition.ExtensionContext.RESOURCE;
case ELEMENT: return org.hl7.fhir.dstu2.model.StructureDefinition.ExtensionContext.DATATYPE; case ELEMENT:
String tn = expression.contains(".") ? expression.substring(0, expression.indexOf(".")) : expression;
if (isResource102(tn)) {
return org.hl7.fhir.dstu2.model.StructureDefinition.ExtensionContext.RESOURCE;
} else {
return org.hl7.fhir.dstu2.model.StructureDefinition.ExtensionContext.DATATYPE;
}
case EXTENSION: return org.hl7.fhir.dstu2.model.StructureDefinition.ExtensionContext.EXTENSION; case EXTENSION: return org.hl7.fhir.dstu2.model.StructureDefinition.ExtensionContext.EXTENSION;
default: return org.hl7.fhir.dstu2.model.StructureDefinition.ExtensionContext.NULL; default: return org.hl7.fhir.dstu2.model.StructureDefinition.ExtensionContext.NULL;
} }
} }
private static boolean isResource102(String tn) {
return Utilities.existsInList(tn, "AllergyIntolerance", "Appointment", "AppointmentResponse", "AuditEvent", "Basic", "Binary", "BodySite", "Bundle", "CarePlan", "Claim", "ClaimResponse", "ClinicalImpression",
"Communication", "CommunicationRequest", "Composition", "ConceptMap", "Condition", "Conformance", "Contract", "DetectedIssue", "Coverage", "DataElement", "Device", "DeviceComponent",
"DeviceMetric", "DeviceUseRequest", "DeviceUseStatement", "DiagnosticOrder", "DiagnosticReport", "DocumentManifest", "DocumentReference", "EligibilityRequest", "EligibilityResponse",
"Encounter", "EnrollmentRequest", "EnrollmentResponse", "EpisodeOfCare", "ExplanationOfBenefit", "FamilyMemberHistory", "Flag", "Goal", "Group", "HealthcareService", "ImagingObjectSelection",
"ImagingStudy", "Immunization", "ImmunizationRecommendation", "ImplementationGuide", "List", "Location", "Media", "Medication", "MedicationAdministration", "MedicationDispense", "MedicationOrder",
"MedicationStatement", "MessageHeader", "NamingSystem", "NutritionOrder", "Observation", "OperationDefinition", "OperationOutcome", "Order", "OrderResponse", "Organization",
"Parameters", "Patient", "PaymentNotice", "PaymentReconciliation", "Person", "Practitioner", "Procedure", "ProcessRequest", "ProcessResponse", "ProcedureRequest", "Provenance", "Questionnaire",
"QuestionnaireResponse", "ReferralRequest", "RelatedPerson", "RiskAssessment", "Schedule", "SearchParameter", "Slot", "Specimen", "StructureDefinition", "Subscription", "Substance",
"SupplyRequest", "SupplyDelivery", "TestScript", "ValueSet", "VisionPrescription");
}
public org.hl7.fhir.r4.model.ContactDetail convertStructureDefinitionContactComponent(org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionContactComponent src) throws FHIRException { public org.hl7.fhir.r4.model.ContactDetail convertStructureDefinitionContactComponent(org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionContactComponent src) throws FHIRException {
if (src == null || src.isEmpty()) if (src == null || src.isEmpty())
return null; return null;

View File

@ -10465,7 +10465,7 @@ public class VersionConvertor_10_50 {
tgt.setAbstract(src.getAbstract()); tgt.setAbstract(src.getAbstract());
for (org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionContextComponent t : src.getContext()) { for (org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionContextComponent t : src.getContext()) {
if (!tgt.hasContextType()) if (!tgt.hasContextType())
tgt.setContextType(convertExtensionContext(t.getType())); tgt.setContextType(convertExtensionContext(t.getType(), t.getExpression()));
tgt.addContext(t.getExpression()); tgt.addContext(t.getExpression());
} }
tgt.setConstrainedType(src.getType()); tgt.setConstrainedType(src.getType());
@ -10516,24 +10516,41 @@ public class VersionConvertor_10_50 {
if (src == null) if (src == null)
return null; return null;
switch (src) { switch (src) {
case RESOURCE: return org.hl7.fhir.r5.model.StructureDefinition.ExtensionContextType.FHIRPATH; case RESOURCE: return org.hl7.fhir.r5.model.StructureDefinition.ExtensionContextType.ELEMENT;
case DATATYPE: return org.hl7.fhir.r5.model.StructureDefinition.ExtensionContextType.ELEMENT; case DATATYPE: return org.hl7.fhir.r5.model.StructureDefinition.ExtensionContextType.ELEMENT;
case EXTENSION: return org.hl7.fhir.r5.model.StructureDefinition.ExtensionContextType.EXTENSION; case EXTENSION: return org.hl7.fhir.r5.model.StructureDefinition.ExtensionContextType.EXTENSION;
default: return org.hl7.fhir.r5.model.StructureDefinition.ExtensionContextType.NULL; 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 { private static org.hl7.fhir.dstu2.model.StructureDefinition.ExtensionContext convertExtensionContext(org.hl7.fhir.r5.model.StructureDefinition.ExtensionContextType src, String expression) throws FHIRException {
if (src == null) if (src == null)
return null; return null;
switch (src) { switch (src) {
case FHIRPATH: return org.hl7.fhir.dstu2.model.StructureDefinition.ExtensionContext.RESOURCE; case FHIRPATH: return org.hl7.fhir.dstu2.model.StructureDefinition.ExtensionContext.RESOURCE;
case ELEMENT: return org.hl7.fhir.dstu2.model.StructureDefinition.ExtensionContext.DATATYPE; case ELEMENT:
String tn = expression.contains(".") ? expression.substring(0, expression.indexOf(".")) : expression;
if (isResource102(tn)) {
return org.hl7.fhir.dstu2.model.StructureDefinition.ExtensionContext.RESOURCE;
} else {
return org.hl7.fhir.dstu2.model.StructureDefinition.ExtensionContext.DATATYPE;
}
case EXTENSION: return org.hl7.fhir.dstu2.model.StructureDefinition.ExtensionContext.EXTENSION; case EXTENSION: return org.hl7.fhir.dstu2.model.StructureDefinition.ExtensionContext.EXTENSION;
default: return org.hl7.fhir.dstu2.model.StructureDefinition.ExtensionContext.NULL; default: return org.hl7.fhir.dstu2.model.StructureDefinition.ExtensionContext.NULL;
} }
} }
private static boolean isResource102(String tn) {
return Utilities.existsInList(tn, "AllergyIntolerance", "Appointment", "AppointmentResponse", "AuditEvent", "Basic", "Binary", "BodySite", "Bundle", "CarePlan", "Claim", "ClaimResponse", "ClinicalImpression",
"Communication", "CommunicationRequest", "Composition", "ConceptMap", "Condition", "Conformance", "Contract", "DetectedIssue", "Coverage", "DataElement", "Device", "DeviceComponent",
"DeviceMetric", "DeviceUseRequest", "DeviceUseStatement", "DiagnosticOrder", "DiagnosticReport", "DocumentManifest", "DocumentReference", "EligibilityRequest", "EligibilityResponse",
"Encounter", "EnrollmentRequest", "EnrollmentResponse", "EpisodeOfCare", "ExplanationOfBenefit", "FamilyMemberHistory", "Flag", "Goal", "Group", "HealthcareService", "ImagingObjectSelection",
"ImagingStudy", "Immunization", "ImmunizationRecommendation", "ImplementationGuide", "List", "Location", "Media", "Medication", "MedicationAdministration", "MedicationDispense", "MedicationOrder",
"MedicationStatement", "MessageHeader", "NamingSystem", "NutritionOrder", "Observation", "OperationDefinition", "OperationOutcome", "Order", "OrderResponse", "Organization",
"Parameters", "Patient", "PaymentNotice", "PaymentReconciliation", "Person", "Practitioner", "Procedure", "ProcessRequest", "ProcessResponse", "ProcedureRequest", "Provenance", "Questionnaire",
"QuestionnaireResponse", "ReferralRequest", "RelatedPerson", "RiskAssessment", "Schedule", "SearchParameter", "Slot", "Specimen", "StructureDefinition", "Subscription", "Substance",
"SupplyRequest", "SupplyDelivery", "TestScript", "ValueSet", "VisionPrescription");
}
public org.hl7.fhir.r5.model.ContactDetail convertStructureDefinitionContactComponent(org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionContactComponent src) throws FHIRException { public org.hl7.fhir.r5.model.ContactDetail convertStructureDefinitionContactComponent(org.hl7.fhir.dstu2.model.StructureDefinition.StructureDefinitionContactComponent src) throws FHIRException {
if (src == null || src.isEmpty()) if (src == null || src.isEmpty())

View File

@ -5748,7 +5748,7 @@ public class VersionConvertor_14_40 {
tgt.setAbstract(src.getAbstract()); tgt.setAbstract(src.getAbstract());
for (org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionContextComponent t : src.getContext()) { for (org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionContextComponent t : src.getContext()) {
if (!tgt.hasContextType()) if (!tgt.hasContextType())
tgt.setContextType(convertExtensionContext(t.getType())); tgt.setContextType(convertExtensionContext(t.getType(), t.getExpression()));
tgt.addContext(convertTo2016MayExpression(t.getExpression())); tgt.addContext(convertTo2016MayExpression(t.getExpression()));
} }
if (src.hasBaseDefinition()) if (src.hasBaseDefinition())
@ -5793,24 +5793,42 @@ public class VersionConvertor_14_40 {
if (src == null) if (src == null)
return null; return null;
switch (src) { switch (src) {
case RESOURCE: return org.hl7.fhir.r4.model.StructureDefinition.ExtensionContextType.FHIRPATH; case RESOURCE: return org.hl7.fhir.r4.model.StructureDefinition.ExtensionContextType.ELEMENT;
case DATATYPE: return org.hl7.fhir.r4.model.StructureDefinition.ExtensionContextType.ELEMENT; case DATATYPE: return org.hl7.fhir.r4.model.StructureDefinition.ExtensionContextType.ELEMENT;
case EXTENSION: return org.hl7.fhir.r4.model.StructureDefinition.ExtensionContextType.EXTENSION; case EXTENSION: return org.hl7.fhir.r4.model.StructureDefinition.ExtensionContextType.EXTENSION;
default: return org.hl7.fhir.r4.model.StructureDefinition.ExtensionContextType.NULL; default: return org.hl7.fhir.r4.model.StructureDefinition.ExtensionContextType.NULL;
} }
} }
private static org.hl7.fhir.dstu2016may.model.StructureDefinition.ExtensionContext convertExtensionContext(org.hl7.fhir.r4.model.StructureDefinition.ExtensionContextType src) throws FHIRException { private static org.hl7.fhir.dstu2016may.model.StructureDefinition.ExtensionContext convertExtensionContext(org.hl7.fhir.r4.model.StructureDefinition.ExtensionContextType src, String expression) throws FHIRException {
if (src == null) if (src == null)
return null; return null;
switch (src) { switch (src) {
case FHIRPATH: return org.hl7.fhir.dstu2016may.model.StructureDefinition.ExtensionContext.RESOURCE; case FHIRPATH: return org.hl7.fhir.dstu2016may.model.StructureDefinition.ExtensionContext.RESOURCE;
case ELEMENT: return org.hl7.fhir.dstu2016may.model.StructureDefinition.ExtensionContext.DATATYPE; case ELEMENT:
String tn = expression.contains(".") ? expression.substring(0, expression.indexOf(".")) : expression;
if (isResource140(tn)) {
return org.hl7.fhir.dstu2016may.model.StructureDefinition.ExtensionContext.RESOURCE;
} else {
return org.hl7.fhir.dstu2016may.model.StructureDefinition.ExtensionContext.DATATYPE;
}
case EXTENSION: return org.hl7.fhir.dstu2016may.model.StructureDefinition.ExtensionContext.EXTENSION; case EXTENSION: return org.hl7.fhir.dstu2016may.model.StructureDefinition.ExtensionContext.EXTENSION;
default: return org.hl7.fhir.dstu2016may.model.StructureDefinition.ExtensionContext.NULL; default: return org.hl7.fhir.dstu2016may.model.StructureDefinition.ExtensionContext.NULL;
} }
} }
private static boolean isResource140(String tn) {
return Utilities.existsInList(tn, "Account", "AllergyIntolerance", "Appointment", "AppointmentResponse", "AuditEvent", "Basic", "Binary", "BodySite", "Bundle", "CarePlan", "CareTeam", "Claim", "ClaimResponse", "ClinicalImpression", "CodeSystem", "Communication", "CommunicationRequest", "CompartmentDefinition", "Composition", "ConceptMap", "Condition", "Conformance", "Contract",
"Coverage", "DataElement", "DecisionSupportRule", "DecisionSupportServiceModule", "DetectedIssue", "Device", "DeviceComponent", "DeviceMetric", "DeviceUseRequest", "DeviceUseStatement", "DiagnosticOrder",
"DiagnosticReport", "DocumentManifest", "DocumentReference", "EligibilityRequest", "EligibilityResponse", "Encounter", "EnrollmentRequest", "EnrollmentResponse", "EpisodeOfCare", "ExpansionProfile",
"ExplanationOfBenefit", "FamilyMemberHistory", "Flag", "Goal", "Group", "GuidanceResponse", "HealthcareService", "ImagingExcerpt", "ImagingObjectSelection", "ImagingStudy", "Immunization",
"ImmunizationRecommendation", "ImplementationGuide", "Library", "Linkage", "List", "Location", "Measure", "MeasureReport", "Media", "Medication", "MedicationAdministration", "MedicationDispense",
"MedicationOrder", "MedicationStatement", "MessageHeader", "ModuleDefinition", "NamingSystem", "NutritionOrder", "Observation", "OperationDefinition", "OperationOutcome", "Order", "OrderResponse",
"OrderSet", "Organization", "Parameters", "Patient", "PaymentNotice", "PaymentReconciliation", "Person", "Practitioner", "PractitionerRole", "Procedure", "ProcedureRequest", "ProcessRequest", "ProcessResponse",
"Protocol", "Provenance", "Questionnaire", "QuestionnaireResponse", "ReferralRequest", "RelatedPerson", "RiskAssessment", "Schedule", "SearchParameter", "Sequence", "Slot", "Sequence", "Specimen",
"StructureDefinition", "StructureMap", "Subscription", "Substance", "SupplyDelivery", "SupplyRequest", "Task", "TestScript", "ValueSet", "VisionPrescription");
}
private static org.hl7.fhir.r4.model.StructureDefinition.TypeDerivationRule convertTypeDerivationRule(org.hl7.fhir.dstu2016may.model.StructureDefinition.TypeDerivationRule src) throws FHIRException { private static org.hl7.fhir.r4.model.StructureDefinition.TypeDerivationRule convertTypeDerivationRule(org.hl7.fhir.dstu2016may.model.StructureDefinition.TypeDerivationRule src) throws FHIRException {
if (src == null) if (src == null)
return null; return null;

View File

@ -5772,7 +5772,7 @@ public class VersionConvertor_14_50 {
tgt.setAbstract(src.getAbstract()); tgt.setAbstract(src.getAbstract());
for (org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionContextComponent t : src.getContext()) { for (org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionContextComponent t : src.getContext()) {
if (!tgt.hasContextType()) if (!tgt.hasContextType())
tgt.setContextType(convertExtensionContext(t.getType())); tgt.setContextType(convertExtensionContext(t.getType(), t.getExpression()));
tgt.addContext(convertTo2016MayExpression(t.getExpression())); tgt.addContext(convertTo2016MayExpression(t.getExpression()));
} }
if (src.hasBaseDefinition()) if (src.hasBaseDefinition())
@ -5817,24 +5817,44 @@ public class VersionConvertor_14_50 {
if (src == null) if (src == null)
return null; return null;
switch (src) { switch (src) {
case RESOURCE: return org.hl7.fhir.r5.model.StructureDefinition.ExtensionContextType.FHIRPATH; case RESOURCE: return org.hl7.fhir.r5.model.StructureDefinition.ExtensionContextType.ELEMENT;
case DATATYPE: return org.hl7.fhir.r5.model.StructureDefinition.ExtensionContextType.ELEMENT; case DATATYPE: return org.hl7.fhir.r5.model.StructureDefinition.ExtensionContextType.ELEMENT;
case EXTENSION: return org.hl7.fhir.r5.model.StructureDefinition.ExtensionContextType.EXTENSION; case EXTENSION: return org.hl7.fhir.r5.model.StructureDefinition.ExtensionContextType.EXTENSION;
default: return org.hl7.fhir.r5.model.StructureDefinition.ExtensionContextType.NULL; 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 { private static org.hl7.fhir.dstu2016may.model.StructureDefinition.ExtensionContext convertExtensionContext(org.hl7.fhir.r5.model.StructureDefinition.ExtensionContextType src, String expression) throws FHIRException {
if (src == null) if (src == null)
return null; return null;
switch (src) { switch (src) {
case FHIRPATH: return org.hl7.fhir.dstu2016may.model.StructureDefinition.ExtensionContext.RESOURCE; case FHIRPATH: return org.hl7.fhir.dstu2016may.model.StructureDefinition.ExtensionContext.RESOURCE;
case ELEMENT: return org.hl7.fhir.dstu2016may.model.StructureDefinition.ExtensionContext.DATATYPE; case ELEMENT:
String tn = expression.contains(".") ? expression.substring(0, expression.indexOf(".")) : expression;
if (isResource140(tn)) {
return org.hl7.fhir.dstu2016may.model.StructureDefinition.ExtensionContext.RESOURCE;
} else {
return org.hl7.fhir.dstu2016may.model.StructureDefinition.ExtensionContext.DATATYPE;
}
case EXTENSION: return org.hl7.fhir.dstu2016may.model.StructureDefinition.ExtensionContext.EXTENSION; case EXTENSION: return org.hl7.fhir.dstu2016may.model.StructureDefinition.ExtensionContext.EXTENSION;
default: return org.hl7.fhir.dstu2016may.model.StructureDefinition.ExtensionContext.NULL; default: return org.hl7.fhir.dstu2016may.model.StructureDefinition.ExtensionContext.NULL;
} }
} }
private static boolean isResource140(String tn) {
return Utilities.existsInList(tn, "Account", "AllergyIntolerance", "Appointment", "AppointmentResponse", "AuditEvent", "Basic", "Binary", "BodySite", "Bundle", "CarePlan", "CareTeam", "Claim", "ClaimResponse", "ClinicalImpression", "CodeSystem", "Communication", "CommunicationRequest", "CompartmentDefinition", "Composition", "ConceptMap", "Condition", "Conformance", "Contract",
"Coverage", "DataElement", "DecisionSupportRule", "DecisionSupportServiceModule", "DetectedIssue", "Device", "DeviceComponent", "DeviceMetric", "DeviceUseRequest", "DeviceUseStatement", "DiagnosticOrder",
"DiagnosticReport", "DocumentManifest", "DocumentReference", "EligibilityRequest", "EligibilityResponse", "Encounter", "EnrollmentRequest", "EnrollmentResponse", "EpisodeOfCare", "ExpansionProfile",
"ExplanationOfBenefit", "FamilyMemberHistory", "Flag", "Goal", "Group", "GuidanceResponse", "HealthcareService", "ImagingExcerpt", "ImagingObjectSelection", "ImagingStudy", "Immunization",
"ImmunizationRecommendation", "ImplementationGuide", "Library", "Linkage", "List", "Location", "Measure", "MeasureReport", "Media", "Medication", "MedicationAdministration", "MedicationDispense",
"MedicationOrder", "MedicationStatement", "MessageHeader", "ModuleDefinition", "NamingSystem", "NutritionOrder", "Observation", "OperationDefinition", "OperationOutcome", "Order", "OrderResponse",
"OrderSet", "Organization", "Parameters", "Patient", "PaymentNotice", "PaymentReconciliation", "Person", "Practitioner", "PractitionerRole", "Procedure", "ProcedureRequest", "ProcessRequest", "ProcessResponse",
"Protocol", "Provenance", "Questionnaire", "QuestionnaireResponse", "ReferralRequest", "RelatedPerson", "RiskAssessment", "Schedule", "SearchParameter", "Sequence", "Slot", "Sequence", "Specimen",
"StructureDefinition", "StructureMap", "Subscription", "Substance", "SupplyDelivery", "SupplyRequest", "Task", "TestScript", "ValueSet", "VisionPrescription");
}
private static org.hl7.fhir.r5.model.StructureDefinition.TypeDerivationRule convertTypeDerivationRule(org.hl7.fhir.dstu2016may.model.StructureDefinition.TypeDerivationRule src) throws FHIRException { private static org.hl7.fhir.r5.model.StructureDefinition.TypeDerivationRule convertTypeDerivationRule(org.hl7.fhir.dstu2016may.model.StructureDefinition.TypeDerivationRule src) throws FHIRException {
if (src == null) if (src == null)
return null; return null;

View File

@ -19287,7 +19287,7 @@ public class VersionConvertor_30_40 {
tgt.setAbstract(src.getAbstract()); tgt.setAbstract(src.getAbstract());
for (org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionContextComponent t : src.getContext()) { for (org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionContextComponent t : src.getContext()) {
if (!tgt.hasContextType()) if (!tgt.hasContextType())
tgt.setContextType(convertExtensionContext(t.getType())); tgt.setContextType(convertExtensionContext(t.getType(), t.getExpression()));
tgt.addContext(t.getExpression()); tgt.addContext(t.getExpression());
} }
for (org.hl7.fhir.r4.model.StringType t : src.getContextInvariant()) for (org.hl7.fhir.r4.model.StringType t : src.getContextInvariant())
@ -19333,25 +19333,43 @@ public class VersionConvertor_30_40 {
if (src == null) if (src == null)
return null; return null;
switch (src) { switch (src) {
case RESOURCE: return org.hl7.fhir.r4.model.StructureDefinition.ExtensionContextType.FHIRPATH; case RESOURCE: return org.hl7.fhir.r4.model.StructureDefinition.ExtensionContextType.ELEMENT;
case DATATYPE: return org.hl7.fhir.r4.model.StructureDefinition.ExtensionContextType.ELEMENT; case DATATYPE: return org.hl7.fhir.r4.model.StructureDefinition.ExtensionContextType.ELEMENT;
case EXTENSION: return org.hl7.fhir.r4.model.StructureDefinition.ExtensionContextType.EXTENSION; case EXTENSION: return org.hl7.fhir.r4.model.StructureDefinition.ExtensionContextType.EXTENSION;
default: return org.hl7.fhir.r4.model.StructureDefinition.ExtensionContextType.NULL; default: return org.hl7.fhir.r4.model.StructureDefinition.ExtensionContextType.NULL;
} }
} }
private static org.hl7.fhir.dstu3.model.StructureDefinition.ExtensionContext convertExtensionContext(org.hl7.fhir.r4.model.StructureDefinition.ExtensionContextType src) throws FHIRException { private static org.hl7.fhir.dstu3.model.StructureDefinition.ExtensionContext convertExtensionContext(org.hl7.fhir.r4.model.StructureDefinition.ExtensionContextType src, String expression) throws FHIRException {
if (src == null) if (src == null)
return null; return null;
switch (src) { switch (src) {
case FHIRPATH: return org.hl7.fhir.dstu3.model.StructureDefinition.ExtensionContext.RESOURCE; case FHIRPATH: return org.hl7.fhir.dstu3.model.StructureDefinition.ExtensionContext.RESOURCE;
case ELEMENT: return org.hl7.fhir.dstu3.model.StructureDefinition.ExtensionContext.DATATYPE; case ELEMENT:
String tn = expression.contains(".") ? expression.substring(0, expression.indexOf(".")) : expression;
if (isResource300(tn)) {
return org.hl7.fhir.dstu3.model.StructureDefinition.ExtensionContext.RESOURCE;
} else {
return org.hl7.fhir.dstu3.model.StructureDefinition.ExtensionContext.DATATYPE;
}
case EXTENSION: return org.hl7.fhir.dstu3.model.StructureDefinition.ExtensionContext.EXTENSION; case EXTENSION: return org.hl7.fhir.dstu3.model.StructureDefinition.ExtensionContext.EXTENSION;
default: return org.hl7.fhir.dstu3.model.StructureDefinition.ExtensionContext.NULL; default: return org.hl7.fhir.dstu3.model.StructureDefinition.ExtensionContext.NULL;
} }
} }
private static boolean isResource300(String tn) {
return Utilities.existsInList(tn, "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", "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");
}
private static org.hl7.fhir.r4.model.StructureDefinition.TypeDerivationRule convertTypeDerivationRule(org.hl7.fhir.dstu3.model.StructureDefinition.TypeDerivationRule src) throws FHIRException { private static org.hl7.fhir.r4.model.StructureDefinition.TypeDerivationRule convertTypeDerivationRule(org.hl7.fhir.dstu3.model.StructureDefinition.TypeDerivationRule src) throws FHIRException {
if (src == null) if (src == null)
return null; return null;

View File

@ -18658,7 +18658,7 @@ public class VersionConvertor_30_50 {
tgt.setAbstract(src.getAbstract()); tgt.setAbstract(src.getAbstract());
for (org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionContextComponent t : src.getContext()) { for (org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionContextComponent t : src.getContext()) {
if (!tgt.hasContextType()) if (!tgt.hasContextType())
tgt.setContextType(convertExtensionContext(t.getType())); tgt.setContextType(convertExtensionContext(t.getType(), t.getExpression()));
tgt.addContext(t.getExpression()); tgt.addContext(t.getExpression());
} }
for (org.hl7.fhir.r5.model.StringType t : src.getContextInvariant()) for (org.hl7.fhir.r5.model.StringType t : src.getContextInvariant())
@ -18704,25 +18704,44 @@ public class VersionConvertor_30_50 {
if (src == null) if (src == null)
return null; return null;
switch (src) { switch (src) {
case RESOURCE: return org.hl7.fhir.r5.model.StructureDefinition.ExtensionContextType.FHIRPATH; case RESOURCE: return org.hl7.fhir.r5.model.StructureDefinition.ExtensionContextType.ELEMENT;
case DATATYPE: return org.hl7.fhir.r5.model.StructureDefinition.ExtensionContextType.ELEMENT; case DATATYPE: return org.hl7.fhir.r5.model.StructureDefinition.ExtensionContextType.ELEMENT;
case EXTENSION: return org.hl7.fhir.r5.model.StructureDefinition.ExtensionContextType.EXTENSION; case EXTENSION: return org.hl7.fhir.r5.model.StructureDefinition.ExtensionContextType.EXTENSION;
default: return org.hl7.fhir.r5.model.StructureDefinition.ExtensionContextType.NULL; 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 { private static org.hl7.fhir.dstu3.model.StructureDefinition.ExtensionContext convertExtensionContext(org.hl7.fhir.r5.model.StructureDefinition.ExtensionContextType src, String expression) throws FHIRException {
if (src == null) if (src == null)
return null; return null;
switch (src) { switch (src) {
case FHIRPATH: return org.hl7.fhir.dstu3.model.StructureDefinition.ExtensionContext.RESOURCE; case FHIRPATH: return org.hl7.fhir.dstu3.model.StructureDefinition.ExtensionContext.RESOURCE;
case ELEMENT: return org.hl7.fhir.dstu3.model.StructureDefinition.ExtensionContext.DATATYPE; case ELEMENT:
String tn = expression.contains(".") ? expression.substring(0, expression.indexOf(".")) : expression;
if (isResource300(tn)) {
return org.hl7.fhir.dstu3.model.StructureDefinition.ExtensionContext.RESOURCE;
} else {
return org.hl7.fhir.dstu3.model.StructureDefinition.ExtensionContext.DATATYPE;
}
case EXTENSION: return org.hl7.fhir.dstu3.model.StructureDefinition.ExtensionContext.EXTENSION; case EXTENSION: return org.hl7.fhir.dstu3.model.StructureDefinition.ExtensionContext.EXTENSION;
default: return org.hl7.fhir.dstu3.model.StructureDefinition.ExtensionContext.NULL; default: return org.hl7.fhir.dstu3.model.StructureDefinition.ExtensionContext.NULL;
} }
} }
private static boolean isResource300(String tn) {
return Utilities.existsInList(tn, "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", "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");
}
private static org.hl7.fhir.r5.model.StructureDefinition.TypeDerivationRule convertTypeDerivationRule(org.hl7.fhir.dstu3.model.StructureDefinition.TypeDerivationRule src) throws FHIRException { private static org.hl7.fhir.r5.model.StructureDefinition.TypeDerivationRule convertTypeDerivationRule(org.hl7.fhir.dstu3.model.StructureDefinition.TypeDerivationRule src) throws FHIRException {
if (src == null) if (src == null)
return null; return null;