Fix conversion issue associated with ConceptMap.element.target.equivalence in versions previous to R5 (use proper extension URL, and move extension so it can be a modifier. And fix for modifierExtension handling)

This commit is contained in:
Grahame Grieve 2023-10-09 17:41:26 +11:00
parent 0140fa1ad1
commit f860af857d
18 changed files with 774 additions and 214 deletions

View File

@ -41,7 +41,7 @@ public class VersionConvertorConstants {
public final static String MODIFIER_REASON_LEGACY = "No Modifier Reason provideed in previous versions of FHIR";
public final static String PROFILE_EXTENSION = "http://hl7.org/fhir/4.0/StructureDefinition/extension-ElementDefinition.type.profile";
public final static String IG_CONFORMANCE_MESSAGE_EVENT = "http://hl7.org/fhir/1.0/StructureDefinition/extension-Conformance.messaging.event";
public static final String EXT_OLD_CONCEPTMAP_EQUIVALENCE = "http://hl7.org/fhir/1.0/StructureDefinition/extension-ConceptMap.element.target.equivalence";
public static final String EXT_OLD_CONCEPTMAP_EQUIVALENCE = "http://hl7.org/fhir/1.0/StructureDefinition/extension-ConceptMap.group.element.target.equivalence";
public static final String EXT_ACTUAL_RESOURCE_NAME = "http://hl7.org/fhir/tools/StructureDefinition/original-resource-name";
public static final String EXT_QUESTIONNAIRE_ITEM_TYPE_ORIGINAL = QuestionnaireRenderer.EXT_QUESTIONNAIRE_ITEM_TYPE_ORIGINAL;
public static final String EXT_NAMINGSYSTEM_TITLE = "http://hl7.org/fhir/5.0/StructureDefinition/extension-NamingSystem.title";

View File

@ -148,13 +148,13 @@ public class ConceptMap10_50 {
return tgt;
}
public static org.hl7.fhir.dstu2.model.Enumeration<ConceptMapEquivalence> convertConceptMapEquivalence(Enumeration<ConceptMapRelationship> src) throws FHIRException {
public static org.hl7.fhir.dstu2.model.Enumeration<ConceptMapEquivalence> convertConceptMapEquivalence(Enumeration<ConceptMapRelationship> src, org.hl7.fhir.r5.model.ConceptMap.TargetElementComponent ccm) throws FHIRException {
if (src == null || src.isEmpty())
return null;
org.hl7.fhir.dstu2.model.Enumeration<ConceptMapEquivalence> tgt = new org.hl7.fhir.dstu2.model.Enumeration<ConceptMapEquivalence>(new org.hl7.fhir.dstu2.model.Enumerations.ConceptMapEquivalenceEnumFactory());
ConversionContext10_50.INSTANCE.getVersionConvertor_10_50().copyElement(src, tgt, VersionConvertorConstants.EXT_OLD_CONCEPTMAP_EQUIVALENCE);
if (src.hasExtension(VersionConvertorConstants.EXT_OLD_CONCEPTMAP_EQUIVALENCE)) {
tgt.setValueAsString(src.getExtensionString(VersionConvertorConstants.EXT_OLD_CONCEPTMAP_EQUIVALENCE));
ConversionContext10_50.INSTANCE.getVersionConvertor_10_50().copyElement(src, tgt);
if (ccm.hasExtension(VersionConvertorConstants.EXT_OLD_CONCEPTMAP_EQUIVALENCE)) {
tgt.setValueAsString(ccm.getExtensionString(VersionConvertorConstants.EXT_OLD_CONCEPTMAP_EQUIVALENCE));
} else {
switch (src.getValue()) {
case EQUIVALENT:
@ -177,12 +177,12 @@ public class ConceptMap10_50 {
return tgt;
}
public static Enumeration<ConceptMapRelationship> convertConceptMapRelationship(org.hl7.fhir.dstu2.model.Enumeration<ConceptMapEquivalence> src) throws FHIRException {
public static Enumeration<ConceptMapRelationship> convertConceptMapRelationship(org.hl7.fhir.dstu2.model.Enumeration<ConceptMapEquivalence> src, org.hl7.fhir.r5.model.ConceptMap.TargetElementComponent tgtCtxt) throws FHIRException {
if (src == null || src.isEmpty())
return null;
Enumeration<ConceptMapRelationship> tgt = new Enumeration<ConceptMapRelationship>(new Enumerations.ConceptMapRelationshipEnumFactory());
ConversionContext10_50.INSTANCE.getVersionConvertor_10_50().copyElement(src, tgt);
ToolingExtensions.setCodeExtension(tgt, VersionConvertorConstants.EXT_OLD_CONCEPTMAP_EQUIVALENCE, src.getValueAsString());
ToolingExtensions.setCodeExtensionMod(tgtCtxt, VersionConvertorConstants.EXT_OLD_CONCEPTMAP_EQUIVALENCE, src.getValueAsString());
switch (src.getValue()) {
case EQUIVALENT:
tgt.setValue(org.hl7.fhir.r5.model.Enumerations.ConceptMapRelationship.EQUIVALENT);
@ -283,12 +283,12 @@ public class ConceptMap10_50 {
if (src == null || src.isEmpty())
return null;
org.hl7.fhir.dstu2.model.ConceptMap.TargetElementComponent tgt = new org.hl7.fhir.dstu2.model.ConceptMap.TargetElementComponent();
ConversionContext10_50.INSTANCE.getVersionConvertor_10_50().copyBackboneElement(src,tgt);
ConversionContext10_50.INSTANCE.getVersionConvertor_10_50().copyBackboneElement(src,tgt, VersionConvertorConstants.EXT_OLD_CONCEPTMAP_EQUIVALENCE);
tgt.setCodeSystem(g.getTarget());
if (src.hasCodeElement())
tgt.setCodeElement(Code10_50.convertCode(src.getCodeElement()));
if (src.hasRelationship())
tgt.setEquivalenceElement(convertConceptMapEquivalence(src.getRelationshipElement()));
tgt.setEquivalenceElement(convertConceptMapEquivalence(src.getRelationshipElement(), src));
if (src.hasCommentElement())
tgt.setCommentsElement(String10_50.convertString(src.getCommentElement()));
for (org.hl7.fhir.r5.model.ConceptMap.OtherElementComponent t : src.getDependsOn())
@ -306,7 +306,7 @@ public class ConceptMap10_50 {
if (src.hasCodeElement())
tgt.setCodeElement(Code10_50.convertCode(src.getCodeElement()));
if (src.hasEquivalence())
tgt.setRelationshipElement(convertConceptMapRelationship(src.getEquivalenceElement()));
tgt.setRelationshipElement(convertConceptMapRelationship(src.getEquivalenceElement(), tgt));
if (src.hasCommentsElement())
tgt.setCommentElement(String10_50.convertString(src.getCommentsElement()));
for (org.hl7.fhir.dstu2.model.ConceptMap.OtherElementComponent t : src.getDependsOn())

View File

@ -151,13 +151,13 @@ public class ConceptMap14_50 {
return tgt;
}
public static org.hl7.fhir.dstu2016may.model.Enumeration<ConceptMapEquivalence> convertConceptMapEquivalence(Enumeration<ConceptMapRelationship> src) throws FHIRException {
public static org.hl7.fhir.dstu2016may.model.Enumeration<ConceptMapEquivalence> convertConceptMapEquivalence(Enumeration<ConceptMapRelationship> src, org.hl7.fhir.r5.model.ConceptMap.TargetElementComponent ccm) throws FHIRException {
if (src == null || src.isEmpty())
return null;
org.hl7.fhir.dstu2016may.model.Enumeration<ConceptMapEquivalence> tgt = new org.hl7.fhir.dstu2016may.model.Enumeration<ConceptMapEquivalence>(new org.hl7.fhir.dstu2016may.model.Enumerations.ConceptMapEquivalenceEnumFactory());
ConversionContext14_50.INSTANCE.getVersionConvertor_14_50().copyElement(src, tgt, VersionConvertorConstants.EXT_OLD_CONCEPTMAP_EQUIVALENCE);
if (src.hasExtension(VersionConvertorConstants.EXT_OLD_CONCEPTMAP_EQUIVALENCE)) {
tgt.setValueAsString(src.getExtensionString(VersionConvertorConstants.EXT_OLD_CONCEPTMAP_EQUIVALENCE));
ConversionContext14_50.INSTANCE.getVersionConvertor_14_50().copyElement(src, tgt);
if (ccm.hasExtension(VersionConvertorConstants.EXT_OLD_CONCEPTMAP_EQUIVALENCE)) {
tgt.setValueAsString(ccm.getExtensionString(VersionConvertorConstants.EXT_OLD_CONCEPTMAP_EQUIVALENCE));
} else {
switch (src.getValue()) {
case EQUIVALENT:
@ -180,12 +180,12 @@ public class ConceptMap14_50 {
return tgt;
}
public static Enumeration<ConceptMapRelationship> convertConceptMapRelationship(org.hl7.fhir.dstu2016may.model.Enumeration<ConceptMapEquivalence> src) throws FHIRException {
public static Enumeration<ConceptMapRelationship> convertConceptMapRelationship(org.hl7.fhir.dstu2016may.model.Enumeration<ConceptMapEquivalence> src, org.hl7.fhir.r5.model.ConceptMap.TargetElementComponent tgtCtxt) throws FHIRException {
if (src == null || src.isEmpty())
return null;
Enumeration<ConceptMapRelationship> tgt = new Enumeration<ConceptMapRelationship>(new Enumerations.ConceptMapRelationshipEnumFactory());
ConversionContext14_50.INSTANCE.getVersionConvertor_14_50().copyElement(src, tgt);
ToolingExtensions.setCodeExtension(tgt, VersionConvertorConstants.EXT_OLD_CONCEPTMAP_EQUIVALENCE, src.getValueAsString());
ToolingExtensions.setCodeExtensionMod(tgtCtxt, VersionConvertorConstants.EXT_OLD_CONCEPTMAP_EQUIVALENCE, src.getValueAsString());
switch (src.getValue()) {
case EQUIVALENT:
tgt.setValue(org.hl7.fhir.r5.model.Enumerations.ConceptMapRelationship.EQUIVALENT);
@ -293,13 +293,13 @@ public class ConceptMap14_50 {
if (src == null || src.isEmpty())
return null;
org.hl7.fhir.dstu2016may.model.ConceptMap.TargetElementComponent tgt = new org.hl7.fhir.dstu2016may.model.ConceptMap.TargetElementComponent();
ConversionContext14_50.INSTANCE.getVersionConvertor_14_50().copyBackboneElement(src,tgt);
ConversionContext14_50.INSTANCE.getVersionConvertor_14_50().copyBackboneElement(src,tgt, VersionConvertorConstants.EXT_OLD_CONCEPTMAP_EQUIVALENCE);
if (g.hasTarget())
tgt.setSystem(g.getTarget());
if (src.hasCode())
tgt.setCodeElement(Code14_50.convertCode(src.getCodeElement()));
if (src.hasRelationship())
tgt.setEquivalenceElement(convertConceptMapEquivalence(src.getRelationshipElement()));
tgt.setEquivalenceElement(convertConceptMapEquivalence(src.getRelationshipElement(), src));
if (src.hasComment())
tgt.setCommentsElement(String14_50.convertString(src.getCommentElement()));
for (org.hl7.fhir.r5.model.ConceptMap.OtherElementComponent t : src.getDependsOn())
@ -317,7 +317,7 @@ public class ConceptMap14_50 {
if (src.hasCode())
tgt.setCodeElement(Code14_50.convertCode(src.getCodeElement()));
if (src.hasEquivalence())
tgt.setRelationshipElement(convertConceptMapRelationship(src.getEquivalenceElement()));
tgt.setRelationshipElement(convertConceptMapRelationship(src.getEquivalenceElement(), tgt));
if (src.hasComments())
tgt.setCommentElement(String14_50.convertString(src.getCommentsElement()));
for (org.hl7.fhir.dstu2016may.model.ConceptMap.OtherElementComponent t : src.getDependsOn())

View File

@ -247,13 +247,13 @@ public class ConceptMap30_50 {
return tgt;
}
public static org.hl7.fhir.dstu3.model.Enumeration<ConceptMapEquivalence> convertConceptMapEquivalence(Enumeration<ConceptMapRelationship> src) throws FHIRException {
public static org.hl7.fhir.dstu3.model.Enumeration<ConceptMapEquivalence> convertConceptMapEquivalence(Enumeration<ConceptMapRelationship> src, org.hl7.fhir.r5.model.ConceptMap.TargetElementComponent ccm) throws FHIRException {
if (src == null || src.isEmpty())
return null;
org.hl7.fhir.dstu3.model.Enumeration<ConceptMapEquivalence> tgt = new org.hl7.fhir.dstu3.model.Enumeration<ConceptMapEquivalence>(new org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalenceEnumFactory());
ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyElement(src, tgt, VersionConvertorConstants.EXT_OLD_CONCEPTMAP_EQUIVALENCE);
if (src.hasExtension(VersionConvertorConstants.EXT_OLD_CONCEPTMAP_EQUIVALENCE)) {
tgt.setValueAsString(src.getExtensionString(VersionConvertorConstants.EXT_OLD_CONCEPTMAP_EQUIVALENCE));
ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyElement(src, tgt);
if (ccm.hasExtension(VersionConvertorConstants.EXT_OLD_CONCEPTMAP_EQUIVALENCE)) {
tgt.setValueAsString(ccm.getExtensionString(VersionConvertorConstants.EXT_OLD_CONCEPTMAP_EQUIVALENCE));
} else {
switch (src.getValue()) {
case EQUIVALENT:
@ -279,12 +279,12 @@ public class ConceptMap30_50 {
return tgt;
}
public static Enumeration<ConceptMapRelationship> convertConceptMapRelationship(org.hl7.fhir.dstu3.model.Enumeration<ConceptMapEquivalence> src) throws FHIRException {
public static Enumeration<ConceptMapRelationship> convertConceptMapRelationship(org.hl7.fhir.dstu3.model.Enumeration<ConceptMapEquivalence> src, org.hl7.fhir.r5.model.ConceptMap.TargetElementComponent tgtCtxt) throws FHIRException {
if (src == null || src.isEmpty())
return null;
Enumeration<ConceptMapRelationship> tgt = new Enumeration<ConceptMapRelationship>(new Enumerations.ConceptMapRelationshipEnumFactory());
ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyElement(src, tgt);
ToolingExtensions.setCodeExtension(tgt, VersionConvertorConstants.EXT_OLD_CONCEPTMAP_EQUIVALENCE, src.getValueAsString());
ToolingExtensions.setCodeExtensionMod(tgtCtxt, VersionConvertorConstants.EXT_OLD_CONCEPTMAP_EQUIVALENCE, src.getValueAsString());
switch (src.getValue()) {
case EQUIVALENT:
tgt.setValue(org.hl7.fhir.r5.model.Enumerations.ConceptMapRelationship.EQUIVALENT);
@ -402,7 +402,7 @@ public class ConceptMap30_50 {
if (src.hasDisplay())
tgt.setDisplayElement(String30_50.convertString(src.getDisplayElement()));
if (src.hasEquivalence())
tgt.setRelationshipElement(convertConceptMapRelationship(src.getEquivalenceElement()));
tgt.setRelationshipElement(convertConceptMapRelationship(src.getEquivalenceElement(), tgt));
if (src.hasComment())
tgt.setCommentElement(String30_50.convertString(src.getCommentElement()));
for (org.hl7.fhir.dstu3.model.ConceptMap.OtherElementComponent t : src.getDependsOn())
@ -416,13 +416,13 @@ public class ConceptMap30_50 {
if (src == null)
return null;
org.hl7.fhir.dstu3.model.ConceptMap.TargetElementComponent tgt = new org.hl7.fhir.dstu3.model.ConceptMap.TargetElementComponent();
ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyBackboneElement(src,tgt);
ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyBackboneElement(src,tgt, VersionConvertorConstants.EXT_OLD_CONCEPTMAP_EQUIVALENCE);
if (src.hasCode())
tgt.setCodeElement(Code30_50.convertCode(src.getCodeElement()));
if (src.hasDisplay())
tgt.setDisplayElement(String30_50.convertString(src.getDisplayElement()));
if (src.hasRelationship())
tgt.setEquivalenceElement(convertConceptMapEquivalence(src.getRelationshipElement()));
tgt.setEquivalenceElement(convertConceptMapEquivalence(src.getRelationshipElement(), src));
if (src.hasComment())
tgt.setCommentElement(String30_50.convertString(src.getCommentElement()));
for (org.hl7.fhir.r5.model.ConceptMap.OtherElementComponent t : src.getDependsOn())

View File

@ -242,7 +242,7 @@ public class ConceptMap40_50 {
if (src.hasDisplay())
tgt.setDisplayElement(String40_50.convertString(src.getDisplayElement()));
if (src.hasEquivalence())
tgt.setRelationshipElement(convertConceptMapRelationship(src.getEquivalenceElement()));
tgt.setRelationshipElement(convertConceptMapRelationship(src.getEquivalenceElement(), tgt));
if (src.hasComment())
tgt.setCommentElement(String40_50.convertString(src.getCommentElement()));
for (org.hl7.fhir.r4.model.ConceptMap.OtherElementComponent t : src.getDependsOn())
@ -256,13 +256,13 @@ public class ConceptMap40_50 {
if (src == null)
return null;
org.hl7.fhir.r4.model.ConceptMap.TargetElementComponent tgt = new org.hl7.fhir.r4.model.ConceptMap.TargetElementComponent();
ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyBackboneElement(src, tgt);
ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyBackboneElement(src, tgt, VersionConvertorConstants.EXT_OLD_CONCEPTMAP_EQUIVALENCE);
if (src.hasCode())
tgt.setCodeElement(Code40_50.convertCode(src.getCodeElement()));
if (src.hasDisplay())
tgt.setDisplayElement(String40_50.convertString(src.getDisplayElement()));
if (src.hasRelationship())
tgt.setEquivalenceElement(convertConceptMapEquivalence(src.getRelationshipElement()));
tgt.setEquivalenceElement(convertConceptMapEquivalence(src.getRelationshipElement(), src));
else
tgt.setEquivalence(ConceptMapEquivalence.RELATEDTO);
if (src.hasComment())
@ -274,13 +274,13 @@ public class ConceptMap40_50 {
return tgt;
}
public static org.hl7.fhir.r4.model.Enumeration<ConceptMapEquivalence> convertConceptMapEquivalence(Enumeration<ConceptMapRelationship> src) throws FHIRException {
public static org.hl7.fhir.r4.model.Enumeration<ConceptMapEquivalence> convertConceptMapEquivalence(Enumeration<ConceptMapRelationship> src, org.hl7.fhir.r5.model.ConceptMap.TargetElementComponent ccm) throws FHIRException {
if (src == null || src.isEmpty())
return null;
org.hl7.fhir.r4.model.Enumeration<ConceptMapEquivalence> tgt = new org.hl7.fhir.r4.model.Enumeration<ConceptMapEquivalence>(new org.hl7.fhir.r4.model.Enumerations.ConceptMapEquivalenceEnumFactory());
ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt, VersionConvertorConstants.EXT_OLD_CONCEPTMAP_EQUIVALENCE);
if (src.hasExtension(VersionConvertorConstants.EXT_OLD_CONCEPTMAP_EQUIVALENCE)) {
tgt.setValueAsString(src.getExtensionString(VersionConvertorConstants.EXT_OLD_CONCEPTMAP_EQUIVALENCE));
ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt);
if (ccm.hasExtension(VersionConvertorConstants.EXT_OLD_CONCEPTMAP_EQUIVALENCE)) {
tgt.setValueAsString(ccm.getExtensionString(VersionConvertorConstants.EXT_OLD_CONCEPTMAP_EQUIVALENCE));
} else {
switch (src.getValue()) {
case RELATEDTO:
@ -306,12 +306,12 @@ public class ConceptMap40_50 {
return tgt;
}
public static Enumeration<ConceptMapRelationship> convertConceptMapRelationship(org.hl7.fhir.r4.model.Enumeration<ConceptMapEquivalence> src) throws FHIRException {
public static Enumeration<ConceptMapRelationship> convertConceptMapRelationship(org.hl7.fhir.r4.model.Enumeration<ConceptMapEquivalence> src, org.hl7.fhir.r5.model.ConceptMap.TargetElementComponent tgtCtxt) throws FHIRException {
if (src == null || src.isEmpty())
return null;
Enumeration<ConceptMapRelationship> tgt = new Enumeration<ConceptMapRelationship>(new Enumerations.ConceptMapRelationshipEnumFactory());
ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt);
ToolingExtensions.setCodeExtension(tgt, VersionConvertorConstants.EXT_OLD_CONCEPTMAP_EQUIVALENCE, src.getValueAsString());
ToolingExtensions.setCodeExtensionMod(tgtCtxt, VersionConvertorConstants.EXT_OLD_CONCEPTMAP_EQUIVALENCE, src.getValueAsString());
switch (src.getValue()) {
case EQUIVALENT:
tgt.setValue(org.hl7.fhir.r5.model.Enumerations.ConceptMapRelationship.EQUIVALENT);

View File

@ -241,7 +241,7 @@ public class ConceptMap43_50 {
if (src.hasDisplay())
tgt.setDisplayElement(String43_50.convertString(src.getDisplayElement()));
if (src.hasEquivalence())
tgt.setRelationshipElement(convertConceptMapRelationship(src.getEquivalenceElement()));
tgt.setRelationshipElement(convertConceptMapRelationship(src.getEquivalenceElement(), tgt));
if (src.hasComment())
tgt.setCommentElement(String43_50.convertString(src.getCommentElement()));
for (org.hl7.fhir.r4b.model.ConceptMap.OtherElementComponent t : src.getDependsOn())
@ -255,13 +255,13 @@ public class ConceptMap43_50 {
if (src == null)
return null;
org.hl7.fhir.r4b.model.ConceptMap.TargetElementComponent tgt = new org.hl7.fhir.r4b.model.ConceptMap.TargetElementComponent();
ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyBackboneElement(src, tgt);
ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyBackboneElement(src, tgt, VersionConvertorConstants.EXT_OLD_CONCEPTMAP_EQUIVALENCE);
if (src.hasCode())
tgt.setCodeElement(Code43_50.convertCode(src.getCodeElement()));
if (src.hasDisplay())
tgt.setDisplayElement(String43_50.convertString(src.getDisplayElement()));
if (src.hasRelationship())
tgt.setEquivalenceElement(convertConceptMapEquivalence(src.getRelationshipElement()));
tgt.setEquivalenceElement(convertConceptMapEquivalence(src.getRelationshipElement(), src));
else
tgt.setEquivalence(org.hl7.fhir.r4b.model.ConceptMap.ConceptMapEquivalence.RELATEDTO);
if (src.hasComment())
@ -273,13 +273,13 @@ public class ConceptMap43_50 {
return tgt;
}
public static org.hl7.fhir.r4b.model.Enumeration<org.hl7.fhir.r4b.model.ConceptMap.ConceptMapEquivalence> convertConceptMapEquivalence(Enumeration<ConceptMapRelationship> src) throws FHIRException {
public static org.hl7.fhir.r4b.model.Enumeration<org.hl7.fhir.r4b.model.ConceptMap.ConceptMapEquivalence> convertConceptMapEquivalence(Enumeration<ConceptMapRelationship> src, org.hl7.fhir.r5.model.ConceptMap.TargetElementComponent ccm) throws FHIRException {
if (src == null || src.isEmpty())
return null;
org.hl7.fhir.r4b.model.Enumeration<org.hl7.fhir.r4b.model.ConceptMap.ConceptMapEquivalence> tgt = new org.hl7.fhir.r4b.model.Enumeration<org.hl7.fhir.r4b.model.ConceptMap.ConceptMapEquivalence>(new org.hl7.fhir.r4b.model.ConceptMap.ConceptMapEquivalenceEnumFactory());
ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyElement(src, tgt, VersionConvertorConstants.EXT_OLD_CONCEPTMAP_EQUIVALENCE);
if (src.hasExtension(VersionConvertorConstants.EXT_OLD_CONCEPTMAP_EQUIVALENCE)) {
tgt.setValueAsString(src.getExtensionString(VersionConvertorConstants.EXT_OLD_CONCEPTMAP_EQUIVALENCE));
ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyElement(src, tgt);
if (ccm.hasExtension(VersionConvertorConstants.EXT_OLD_CONCEPTMAP_EQUIVALENCE)) {
tgt.setValueAsString(ccm.getExtensionString(VersionConvertorConstants.EXT_OLD_CONCEPTMAP_EQUIVALENCE));
} else {
switch (src.getValue()) {
case RELATEDTO:
@ -305,12 +305,12 @@ public class ConceptMap43_50 {
return tgt;
}
public static Enumeration<ConceptMapRelationship> convertConceptMapRelationship(org.hl7.fhir.r4b.model.Enumeration<org.hl7.fhir.r4b.model.ConceptMap.ConceptMapEquivalence> src) throws FHIRException {
public static Enumeration<ConceptMapRelationship> convertConceptMapRelationship(org.hl7.fhir.r4b.model.Enumeration<org.hl7.fhir.r4b.model.ConceptMap.ConceptMapEquivalence> src, org.hl7.fhir.r5.model.ConceptMap.TargetElementComponent tgtCtxt) throws FHIRException {
if (src == null || src.isEmpty())
return null;
Enumeration<ConceptMapRelationship> tgt = new Enumeration<ConceptMapRelationship>(new Enumerations.ConceptMapRelationshipEnumFactory());
ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyElement(src, tgt);
ToolingExtensions.setCodeExtension(tgt, VersionConvertorConstants.EXT_OLD_CONCEPTMAP_EQUIVALENCE, src.getValueAsString());
ToolingExtensions.setCodeExtensionMod(tgtCtxt, VersionConvertorConstants.EXT_OLD_CONCEPTMAP_EQUIVALENCE, src.getValueAsString());
switch (src.getValue()) {
case EQUIVALENT:
tgt.setValue(org.hl7.fhir.r5.model.Enumerations.ConceptMapRelationship.EQUIVALENT);

View File

@ -88,6 +88,8 @@ import org.hl7.fhir.dstu3.model.Type;
import org.hl7.fhir.dstu3.model.UriType;
import org.hl7.fhir.dstu3.model.ValueSet.ConceptReferenceComponent;
import org.hl7.fhir.dstu3.model.ValueSet.ConceptSetComponent;
import org.hl7.fhir.dstu3.model.BackboneElement;
import org.hl7.fhir.utilities.Utilities;
import org.hl7.fhir.utilities.validation.ValidationMessage.Source;
@ -434,6 +436,29 @@ public class ToolingExtensions {
resource.getExtension().add(new Extension(new UriType(uri)).setValue(new IntegerType(value)));
}
public static void setCodeExtensionMod(DomainResource resource, String uri, String value) {
if (Utilities.noString(value))
return;
Extension ext = getExtension(resource, uri);
if (ext != null)
ext.setValue(new CodeType(value));
else
resource.getModifierExtension().add(new Extension(uri).setValue(new CodeType(value)));
}
public static void setCodeExtensionMod(BackboneElement resource, String uri, String value) {
if (Utilities.noString(value))
return;
Extension ext = getExtension(resource, uri);
if (ext != null)
ext.setValue(new CodeType(value));
else
resource.getModifierExtension().add(new Extension(uri).setValue(new CodeType(value)));
}
// public static String getOID(CodeSystem define) {
// return readStringExtension(define, EXT_OID);
// }

View File

@ -27,7 +27,7 @@ package org.hl7.fhir.r4.model;
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
*/
// Generated on Tue, May 12, 2020 07:26+1000 for FHIR v4.0.1
import java.util.ArrayList;
@ -35,6 +35,7 @@ import java.util.List;
import org.hl7.fhir.exceptions.FHIRException;
import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
import org.hl7.fhir.utilities.Utilities;
import ca.uhn.fhir.model.api.annotation.Child;
import ca.uhn.fhir.model.api.annotation.DatatypeDef;
@ -277,7 +278,7 @@ public abstract class BackboneElement extends Element implements IBaseBackboneEl
return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(modifierExtension);
}
// added from java-adornments.txt:
// added from java-adornments.txt:
public void checkNoModifiers(String noun, String verb) throws FHIRException {
if (hasModifierExtension()) {
@ -286,6 +287,120 @@ public abstract class BackboneElement extends Element implements IBaseBackboneEl
}
// end addition
public void addModifierExtension(String url, Type value) {
if (isDisallowExtensions())
throw new Error("Extensions are not allowed in this context");
Extension ex = new Extension();
ex.setUrl(url);
ex.setValue(value);
getModifierExtension().add(ex);
}
@Override
public Extension getExtensionByUrl(String theUrl) {
org.apache.commons.lang3.Validate.notBlank(theUrl, "theUrl must not be blank or null");
ArrayList<Extension> retVal = new ArrayList<Extension>();
Extension res = super.getExtensionByUrl(theUrl);
if (res != null) {
retVal.add(res);
}
for (Extension next : getModifierExtension()) {
if (theUrl.equals(next.getUrl())) {
retVal.add(next);
}
}
if (retVal.size() == 0)
return null;
else {
org.apache.commons.lang3.Validate.isTrue(retVal.size() == 1, "Url "+theUrl+" must have only one match");
return retVal.get(0);
}
}
@Override
public void removeExtension(String theUrl) {
for (int i = getModifierExtension().size()-1; i >= 0; i--) {
if (theUrl.equals(getExtension().get(i).getUrl()))
getExtension().remove(i);
}
super.removeExtension(theUrl);
}
/**
* Returns an unmodifiable list containing all extensions on this element which
* match the given URL.
*
* @param theUrl The URL. Must not be blank or null.
* @return an unmodifiable list containing all extensions on this element which
* match the given URL
*/
@Override
public List<Extension> getExtensionsByUrl(String theUrl) {
org.apache.commons.lang3.Validate.notBlank(theUrl, "theUrl must not be blank or null");
ArrayList<Extension> retVal = new ArrayList<Extension>();
retVal.addAll(super.getExtensionsByUrl(theUrl));
for (Extension next : getModifierExtension()) {
if (theUrl.equals(next.getUrl())) {
retVal.add(next);
}
}
return java.util.Collections.unmodifiableList(retVal);
}
public void copyExtensions(org.hl7.fhir.r4.model.BackboneElement src, String... urls) {
super.copyExtensions(src,urls);
for (Extension e : src.getModifierExtension()) {
if (Utilities.existsInList(e.getUrl(), urls)) {
addModifierExtension(e.copy());
}
}
}
public List<Extension> getExtensionsByUrl(String... theUrls) {
ArrayList<Extension> retVal = new ArrayList<>();
for (Extension next : getModifierExtension()) {
if (Utilities.existsInList(next.getUrl(), theUrls)) {
retVal.add(next);
}
}
List<Extension> sv = super.getExtensionsByUrl(theUrls);
sv.addAll(retVal);
return sv;
}
public boolean hasExtension(String... theUrls) {
for (Extension next : getModifierExtension()) {
if (Utilities.existsInList(next.getUrl(), theUrls)) {
return true;
}
}
return super.hasExtension(theUrls);
}
public boolean hasExtension(String theUrl) {
for (Extension ext : getModifierExtension()) {
if (theUrl.equals(ext.getUrl())) {
return true;
}
}
return super.hasExtension(theUrl);
}
public void copyNewExtensions(org.hl7.fhir.r4.model.BackboneElement src, String... urls) {
for (Extension e : src.getModifierExtension()) {
if (Utilities.existsInList(e.getUrl(), urls) && !!hasExtension(e.getUrl())) {
addExtension(e.copy());
}
}
super.copyNewExtensions(src, urls);
}
// end addition
}

View File

@ -27,7 +27,7 @@ package org.hl7.fhir.r4.model;
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
*/
// Generated on Mon, Mar 5, 2018 18:26+1100 for FHIR v3.2.0
import java.util.ArrayList;
@ -35,6 +35,7 @@ import java.util.List;
import org.hl7.fhir.exceptions.FHIRException;
import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
import org.hl7.fhir.utilities.Utilities;
import ca.uhn.fhir.model.api.annotation.Child;
import ca.uhn.fhir.model.api.annotation.DatatypeDef;
@ -267,15 +268,66 @@ public abstract class BackboneType extends Type implements IBaseBackboneElement
return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(modifierExtension);
}
// added from java-adornments.txt:
// added from java-adornments.txt:
public void checkNoModifiers(String noun, String verb) throws FHIRException {
if (hasModifierExtension()) {
throw new FHIRException("Found unknown Modifier Exceptions on " + noun + " doing " + verb);
}
}
// end addition
public void copyExtensions(org.hl7.fhir.r4.model.BackboneElement src, String... urls) {
super.copyExtensions(src,urls);
for (Extension e : src.getModifierExtension()) {
if (Utilities.existsInList(e.getUrl(), urls)) {
addModifierExtension(e.copy());
}
}
}
public List<Extension> getExtensionsByUrl(String... theUrls) {
ArrayList<Extension> retVal = new ArrayList<>();
for (Extension next : getModifierExtension()) {
if (Utilities.existsInList(next.getUrl(), theUrls)) {
retVal.add(next);
}
}
List<Extension> sv = super.getExtensionsByUrl(theUrls);
sv.addAll(retVal);
return sv;
}
public boolean hasExtension(String... theUrls) {
for (Extension next : getModifierExtension()) {
if (Utilities.existsInList(next.getUrl(), theUrls)) {
return true;
}
}
return super.hasExtension(theUrls);
}
public boolean hasExtension(String theUrl) {
for (Extension ext : getModifierExtension()) {
if (theUrl.equals(ext.getUrl())) {
return true;
}
}
return super.hasExtension(theUrl);
}
public void copyNewExtensions(org.hl7.fhir.r4.model.BackboneElement src, String... urls) {
for (Extension e : src.getModifierExtension()) {
if (Utilities.existsInList(e.getUrl(), urls) && !!hasExtension(e.getUrl())) {
addExtension(e.copy());
}
}
super.copyNewExtensions(src, urls);
}
// end addition
}

View File

@ -27,7 +27,7 @@ package org.hl7.fhir.r4.model;
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
*/
// Generated on Tue, May 12, 2020 07:26+1000 for FHIR v4.0.1
import java.util.ArrayList;
@ -36,6 +36,7 @@ import java.util.List;
import org.hl7.fhir.exceptions.FHIRException;
import org.hl7.fhir.instance.model.api.IBaseElement;
import org.hl7.fhir.instance.model.api.IBaseHasExtensions;
import org.hl7.fhir.utilities.StandardsStatus;
import org.hl7.fhir.utilities.Utilities;
import ca.uhn.fhir.model.api.annotation.Child;
@ -393,7 +394,7 @@ public abstract class Element extends Base implements IBaseHasExtensions, IBaseE
setId(value);
}
// added from java-adornments.txt:
// added from java-adornments.txt:
public void addExtension(String url, Type value) {
if (disallowExtensions)
throw new Error("Extensions are not allowed in this context");
@ -446,6 +447,58 @@ public abstract class Element extends Base implements IBaseHasExtensions, IBaseE
return this;
}
// end addition
public List<Extension> getExtensionsByUrl(String... theUrls) {
ArrayList<Extension> retVal = new ArrayList<>();
for (Extension next : getExtension()) {
if (Utilities.existsInList(next.getUrl(), theUrls)) {
retVal.add(next);
}
}
return java.util.Collections.unmodifiableList(retVal);
}
public boolean hasExtension(String... theUrls) {
for (Extension next : getExtension()) {
if (Utilities.existsInList(next.getUrl(), theUrls)) {
return true;
}
}
return false;
}
public boolean hasExtension(Extension ext) {
if (hasExtension()) {
for (Extension t : getExtension()) {
if (Base.compareDeep(t, ext, false)) {
return true;
}
}
}
return false;
}
public void copyExtensions(org.hl7.fhir.r4.model.Element src, String... urls) {
for (Extension e : src.getExtension()) {
if (Utilities.existsInList(e.getUrl(), urls)) {
addExtension(e.copy());
}
}
}
public void copyNewExtensions(org.hl7.fhir.r4.model.Element src, String... urls) {
for (Extension e : src.getExtension()) {
if (Utilities.existsInList(e.getUrl(), urls) && !!hasExtension(e.getUrl())) {
addExtension(e.copy());
}
}
}
// end addition
}

View File

@ -92,6 +92,7 @@ import org.hl7.fhir.r4.model.UriType;
import org.hl7.fhir.r4.model.UrlType;
import org.hl7.fhir.r4.model.ValueSet.ConceptReferenceComponent;
import org.hl7.fhir.r4.model.ValueSet.ConceptSetComponent;
import org.hl7.fhir.r4.model.BackboneElement;
import org.hl7.fhir.utilities.StandardsStatus;
import org.hl7.fhir.utilities.validation.ValidationMessage;
import org.hl7.fhir.utilities.validation.ValidationMessage.IssueSeverity;
@ -551,6 +552,30 @@ public class ToolingExtensions {
element.getExtension().add(new Extension(new UriType(uri)).setValue(new CodeType(value)));
}
public static void setCodeExtensionMod(DomainResource resource, String uri, String value) {
if (Utilities.noString(value))
return;
Extension ext = getExtension(resource, uri);
if (ext != null)
ext.setValue(new CodeType(value));
else
resource.getModifierExtension().add(new Extension(uri).setValue(new CodeType(value)));
}
public static void setCodeExtensionMod(BackboneElement resource, String uri, String value) {
if (Utilities.noString(value))
return;
Extension ext = getExtension(resource, uri);
if (ext != null)
ext.setValue(new CodeType(value));
else
resource.getModifierExtension().add(new Extension(uri).setValue(new CodeType(value)));
}
public static void setIntegerExtension(DomainResource resource, String uri, int value) {
Extension ext = getExtension(resource, uri);
if (ext != null)

View File

@ -34,6 +34,7 @@ import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import org.hl7.fhir.r4b.model.Enumerations.*;
import org.hl7.fhir.utilities.Utilities;
import org.hl7.fhir.instance.model.api.IBaseDatatypeElement;
import org.hl7.fhir.exceptions.FHIRException;
import org.hl7.fhir.instance.model.api.ICompositeType;
@ -349,6 +350,58 @@ public abstract class BackboneElement extends DataType implements IBaseBackboneE
return java.util.Collections.unmodifiableList(retVal);
}
public void copyExtensions(org.hl7.fhir.r4b.model.BackboneElement src, String... urls) {
super.copyExtensions(src,urls);
for (Extension e : src.getModifierExtension()) {
if (Utilities.existsInList(e.getUrl(), urls)) {
addModifierExtension(e.copy());
}
}
}
public List<Extension> getExtensionsByUrl(String... theUrls) {
ArrayList<Extension> retVal = new ArrayList<>();
for (Extension next : getModifierExtension()) {
if (Utilities.existsInList(next.getUrl(), theUrls)) {
retVal.add(next);
}
}
List<Extension> sv = super.getExtensionsByUrl(theUrls);
sv.addAll(retVal);
return sv;
}
public boolean hasExtension(String... theUrls) {
for (Extension next : getModifierExtension()) {
if (Utilities.existsInList(next.getUrl(), theUrls)) {
return true;
}
}
return super.hasExtension(theUrls);
}
public boolean hasExtension(String theUrl) {
for (Extension ext : getModifierExtension()) {
if (theUrl.equals(ext.getUrl())) {
return true;
}
}
return super.hasExtension(theUrl);
}
public void copyNewExtensions(org.hl7.fhir.r4b.model.BackboneElement src, String... urls) {
for (Extension e : src.getModifierExtension()) {
if (Utilities.existsInList(e.getUrl(), urls) && !!hasExtension(e.getUrl())) {
addExtension(e.copy());
}
}
super.copyNewExtensions(src, urls);
}
// end addition
}

View File

@ -34,6 +34,7 @@ import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import org.hl7.fhir.r4b.model.Enumerations.*;
import org.hl7.fhir.utilities.Utilities;
import org.hl7.fhir.instance.model.api.IBaseDatatypeElement;
import org.hl7.fhir.exceptions.FHIRException;
import org.hl7.fhir.instance.model.api.ICompositeType;
@ -288,6 +289,59 @@ public abstract class BackboneType extends DataType implements IBaseBackboneElem
}
}
public void copyExtensions(org.hl7.fhir.r4b.model.BackboneElement src, String... urls) {
super.copyExtensions(src,urls);
for (Extension e : src.getModifierExtension()) {
if (Utilities.existsInList(e.getUrl(), urls)) {
addModifierExtension(e.copy());
}
}
}
public List<Extension> getExtensionsByUrl(String... theUrls) {
ArrayList<Extension> retVal = new ArrayList<>();
for (Extension next : getModifierExtension()) {
if (Utilities.existsInList(next.getUrl(), theUrls)) {
retVal.add(next);
}
}
List<Extension> sv = super.getExtensionsByUrl(theUrls);
sv.addAll(retVal);
return sv;
}
public boolean hasExtension(String... theUrls) {
for (Extension next : getModifierExtension()) {
if (Utilities.existsInList(next.getUrl(), theUrls)) {
return true;
}
}
return super.hasExtension(theUrls);
}
public boolean hasExtension(String theUrl) {
for (Extension ext : getModifierExtension()) {
if (theUrl.equals(ext.getUrl())) {
return true;
}
}
return super.hasExtension(theUrl);
}
public void copyNewExtensions(org.hl7.fhir.r4b.model.BackboneElement src, String... urls) {
for (Extension e : src.getModifierExtension()) {
if (Utilities.existsInList(e.getUrl(), urls) && !!hasExtension(e.getUrl())) {
addExtension(e.copy());
}
}
super.copyNewExtensions(src, urls);
}
// end addition
}

View File

@ -445,12 +445,15 @@ public abstract class Element extends Base implements IBaseHasExtensions, IBaseE
* Note: BackbdoneElements override this to add matching Modifier Extensions too
*
* @param theUrl The URL. Must not be blank or null.
* @return an unmodifiable list containing all extensions on this element which
* match the given URL
* @return an unmodifiable list containing all extensions on this element which match the given URL
*/
public List<Extension> getExtensionsByUrl(String theUrl) {
org.apache.commons.lang3.Validate.notBlank(theUrl, "theUrl must not be blank or null");
ArrayList<Extension> retVal = new ArrayList<Extension>();
if (theUrl == null) {
throw new NullPointerException("theUrl must not be null");
} else if (theUrl.length() == 0) {
throw new IllegalArgumentException("theUrl must not be empty");
}
ArrayList<Extension> retVal = new ArrayList<>();
for (Extension next : getExtension()) {
if (theUrl.equals(next.getUrl())) {
retVal.add(next);
@ -459,6 +462,28 @@ public abstract class Element extends Base implements IBaseHasExtensions, IBaseE
return java.util.Collections.unmodifiableList(retVal);
}
public List<Extension> getExtensionsByUrl(String... theUrls) {
ArrayList<Extension> retVal = new ArrayList<>();
for (Extension next : getExtension()) {
if (Utilities.existsInList(next.getUrl(), theUrls)) {
retVal.add(next);
}
}
return java.util.Collections.unmodifiableList(retVal);
}
public boolean hasExtension(String... theUrls) {
for (Extension next : getExtension()) {
if (Utilities.existsInList(next.getUrl(), theUrls)) {
return true;
}
}
return false;
}
/**
* Returns an true if this element has an extension that matchs the given URL.
*
@ -467,12 +492,21 @@ public abstract class Element extends Base implements IBaseHasExtensions, IBaseE
* @param theUrl The URL. Must not be blank or null.
*/
public boolean hasExtension(String theUrl) {
return !getExtensionsByUrl(theUrl).isEmpty();
if (extension == null || extension.size() == 0) {
return false;
}
for (Extension ext : extension) {
if (theUrl.equals(ext.getUrl())) {
return true;
}
}
return false;
}
/**
* Returns the value as a string if this element has only one extension that
* matches the given URL, and that can be converted to a string.
* Returns the value as a string if this element has only one extension that matches the given URL, and that can be converted to a string.
*
* Note: BackbdoneElements override this to check Modifier Extensions too
*
@ -483,12 +517,42 @@ public abstract class Element extends Base implements IBaseHasExtensions, IBaseE
if (ext.isEmpty())
return null;
if (ext.size() > 1)
throw new FHIRException("Multiple matching extensions found");
throw new FHIRException("Multiple matching extensions found for extension '"+theUrl+"'");
if (!ext.get(0).hasValue())
return null;
if (!ext.get(0).getValue().isPrimitive())
throw new FHIRException("Extension could not be converted to a string");
throw new FHIRException("Extension '"+theUrl+"' could not be converted to a string");
return ext.get(0).getValue().primitiveValue();
}
public boolean hasExtension(Extension ext) {
if (hasExtension()) {
for (Extension t : getExtension()) {
if (Base.compareDeep(t, ext, false)) {
return true;
}
}
}
return false;
}
public void copyExtensions(org.hl7.fhir.r4b.model.Element src, String... urls) {
for (Extension e : src.getExtension()) {
if (Utilities.existsInList(e.getUrl(), urls)) {
addExtension(e.copy());
}
}
}
public void copyNewExtensions(org.hl7.fhir.r4b.model.Element src, String... urls) {
for (Extension e : src.getExtension()) {
if (Utilities.existsInList(e.getUrl(), urls) && !!hasExtension(e.getUrl())) {
addExtension(e.copy());
}
}
}
// end addition
}

View File

@ -97,6 +97,7 @@ import org.hl7.fhir.r4b.model.UriType;
import org.hl7.fhir.r4b.model.UrlType;
import org.hl7.fhir.r4b.model.ValueSet.ConceptReferenceComponent;
import org.hl7.fhir.r4b.model.ValueSet.ConceptSetComponent;
import org.hl7.fhir.r4b.model.BackboneElement;
import org.hl7.fhir.utilities.StandardsStatus;
import org.hl7.fhir.utilities.validation.ValidationMessage;
import org.hl7.fhir.utilities.validation.ValidationMessage.IssueSeverity;
@ -106,8 +107,8 @@ import org.hl7.fhir.utilities.validation.ValidationMessage.Source;
public class ToolingExtensions {
// validated
// private static final String EXT_OID = "http://hl7.org/fhir/StructureDefinition/valueset-oid";
// public static final String EXT_DEPRECATED = "http://hl7.org/fhir/StructureDefinition/codesystem-deprecated";
// private static final String EXT_OID = "http://hl7.org/fhir/StructureDefinition/valueset-oid";
// public static final String EXT_DEPRECATED = "http://hl7.org/fhir/StructureDefinition/codesystem-deprecated";
public static final String EXT_DEFINITION = "http://hl7.org/fhir/StructureDefinition/valueset-concept-definition";
public static final String EXT_CS_COMMENT = "http://hl7.org/fhir/StructureDefinition/codesystem-concept-comments";
public static final String EXT_VS_COMMENT = "http://hl7.org/fhir/StructureDefinition/valueset-concept-comments";
@ -134,12 +135,12 @@ public class ToolingExtensions {
public static final String EXT_MAPPING_PREFIX = "http://hl7.org/fhir/tools/StructureDefinition/logical-mapping-prefix";
public static final String EXT_MAPPING_SUFFIX = "http://hl7.org/fhir/tools/StructureDefinition/logical-mapping-suffix";
// public static final String EXT_FLYOVER = "http://hl7.org/fhir/Profile/questionnaire-extensions#flyover";
// public static final String EXT_FLYOVER = "http://hl7.org/fhir/Profile/questionnaire-extensions#flyover";
public static final String EXT_QTYPE = "http://hl7.org/fhir/StructureDefinition/questionnnaire-baseType";
// private static final String EXT_QREF = "http://www.healthintersections.com.au/fhir/Profile/metadata#reference";
// private static final String EXTENSION_FILTER_ONLY = "http://www.healthintersections.com.au/fhir/Profile/metadata#expandNeedsFilter";
// private static final String EXT_TYPE = "http://www.healthintersections.com.au/fhir/Profile/metadata#type";
// private static final String EXT_REFERENCE = "http://www.healthintersections.com.au/fhir/Profile/metadata#reference";
// private static final String EXT_QREF = "http://www.healthintersections.com.au/fhir/Profile/metadata#reference";
// private static final String EXTENSION_FILTER_ONLY = "http://www.healthintersections.com.au/fhir/Profile/metadata#expandNeedsFilter";
// private static final String EXT_TYPE = "http://www.healthintersections.com.au/fhir/Profile/metadata#type";
// private static final String EXT_REFERENCE = "http://www.healthintersections.com.au/fhir/Profile/metadata#reference";
private static final String EXT_FHIRTYPE = "http://hl7.org/fhir/StructureDefinition/questionnaire-fhirType";
private static final String EXT_ALLOWABLE_UNITS = "http://hl7.org/fhir/StructureDefinition/elementdefinition-allowedUnits";
public static final String EXT_CIMI_REFERENCE = "http://hl7.org/fhir/StructureDefinition/cimi-reference";
@ -166,8 +167,8 @@ public class ToolingExtensions {
public static final String EXT_IGP_MAPPING_CSV = "http://hl7.org/fhir/StructureDefinition/igpublisher-mapping-csv";
public static final String EXT_IGP_BUNDLE = "http://hl7.org/fhir/StructureDefinition/igpublisher-bundle";
public static final String EXT_IGP_RESOURCE_INFO = "http://hl7.org/fhir/tools/StructureDefinition/resource-information";
// public static final String EXT_IGP_CONTAINED_RESOURCE_INFO = "http://hl7.org/fhir/tools/StructureDefinition/contained-resource-information";
// public static final String EXT_IGP_LOADVERSION = "http://hl7.org/fhir/StructureDefinition/igpublisher-loadversion";
// public static final String EXT_IGP_CONTAINED_RESOURCE_INFO = "http://hl7.org/fhir/tools/StructureDefinition/contained-resource-information";
// public static final String EXT_IGP_LOADVERSION = "http://hl7.org/fhir/StructureDefinition/igpublisher-loadversion";
public static final String EXT_MAX_VALUESET = "http://hl7.org/fhir/StructureDefinition/elementdefinition-maxValueSet";
public static final String EXT_MIN_VALUESET = "http://hl7.org/fhir/StructureDefinition/elementdefinition-minValueSet";
public static final String EXT_PROFILE_ELEMENT = "http://hl7.org/fhir/StructureDefinition/elementdefinition-profile-element";
@ -182,7 +183,7 @@ public class ToolingExtensions {
public static final String EXT_FHIR_TYPE = "http://hl7.org/fhir/StructureDefinition/structuredefinition-fhir-type";
public static final String EXT_XML_TYPE = "http://hl7.org/fhir/StructureDefinition/structuredefinition-xml-type";
public static final String EXT_RENDERED_VALUE = "http://hl7.org/fhir/StructureDefinition/rendered-value";
public static final String EXT_OLD_CONCEPTMAP_EQUIVALENCE = "http://hl7.org/fhir/1.0/StructureDefinition/extension-ConceptMap.element.target.equivalence";
public static final String EXT_OLD_CONCEPTMAP_EQUIVALENCE = "http://hl7.org/fhir/1.0/StructureDefinition/extension-ConceptMap.group.element.target.equivalence";
public static final String EXT_EXP_TOOCOSTLY = "http://hl7.org/fhir/StructureDefinition/valueset-toocostly";
public static final String EXT_MUST_SUPPORT = "http://hl7.org/fhir/StructureDefinition/elementdefinition-type-must-support";
public static final String EXT_TRANSLATABLE = "http://hl7.org/fhir/StructureDefinition/elementdefinition-translatable";
@ -223,15 +224,15 @@ public class ToolingExtensions {
return getExtension(e, url) != null;
}
// public static void addStringExtension(DomainResource dr, String url, String content) {
// if (!StringUtils.isBlank(content)) {
// Extension ex = getExtension(dr, url);
// if (ex != null)
// ex.setValue(new StringType(content));
// else
// dr.getExtension().add(Factory.newExtension(url, new StringType(content), true));
// }
// }
// public static void addStringExtension(DomainResource dr, String url, String content) {
// if (!StringUtils.isBlank(content)) {
// Extension ex = getExtension(dr, url);
// if (ex != null)
// ex.setValue(new StringType(content));
// else
// dr.getExtension().add(Factory.newExtension(url, new StringType(content), true));
// }
// }
public static void addMarkdownExtension(DomainResource dr, String url, String content) {
if (!StringUtils.isBlank(content)) {
@ -320,10 +321,10 @@ public class ToolingExtensions {
nc.getExtension().add(Factory.newExtension(EXT_CS_COMMENT, Factory.newString_(comment), true));
}
// public static void markDeprecated(Element nc) {
// setDeprecated(nc);
// }
//
// public static void markDeprecated(Element nc) {
// setDeprecated(nc);
// }
//
public static void addDefinition(Element nc, String definition) {
if (!StringUtils.isBlank(definition))
@ -459,18 +460,18 @@ public class ToolingExtensions {
public static String getCSComment(ConceptDefinitionComponent c) {
return readStringExtension(c, EXT_CS_COMMENT);
}
//
// public static Boolean getDeprecated(Element c) {
// return readBooleanExtension(c, EXT_DEPRECATED);
// }
//
// public static Boolean getDeprecated(Element c) {
// return readBooleanExtension(c, EXT_DEPRECATED);
// }
public static boolean hasCSComment(ConceptDefinitionComponent c) {
return findStringExtension(c, EXT_CS_COMMENT);
}
// public static boolean hasDeprecated(Element c) {
// return findBooleanExtension(c, EXT_DEPRECATED);
// }
// public static boolean hasDeprecated(Element c) {
// return findBooleanExtension(c, EXT_DEPRECATED);
// }
public static void addFlyOver(QuestionnaireItemComponent item, String text, String linkId) {
if (!StringUtils.isBlank(text)) {
@ -582,6 +583,28 @@ public class ToolingExtensions {
element.getExtension().add(new Extension(uri).setValue(new CodeType(value)));
}
public static void setCodeExtensionMod(DomainResource resource, String uri, String value) {
if (Utilities.noString(value))
return;
Extension ext = getExtension(resource, uri);
if (ext != null)
ext.setValue(new CodeType(value));
else
resource.getModifierExtension().add(new Extension(uri).setValue(new CodeType(value)));
}
public static void setCodeExtensionMod(BackboneElement resource, String uri, String value) {
if (Utilities.noString(value))
return;
Extension ext = getExtension(resource, uri);
if (ext != null)
ext.setValue(new CodeType(value));
else
resource.getModifierExtension().add(new Extension(uri).setValue(new CodeType(value)));
}
public static void setIntegerExtension(DomainResource resource, String uri, int value) {
Extension ext = getExtension(resource, uri);
if (ext != null)
@ -590,34 +613,34 @@ public class ToolingExtensions {
resource.getExtension().add(new Extension(uri).setValue(new IntegerType(value)));
}
// public static String getOID(CodeSystem define) {
// return readStringExtension(define, EXT_OID);
// }
//
// public static String getOID(ValueSet vs) {
// return readStringExtension(vs, EXT_OID);
// }
//
// public static void setOID(CodeSystem define, String oid) throws FHIRFormatError, URISyntaxException {
// if (!oid.startsWith("urn:oid:"))
// throw new FHIRFormatError("Error in OID format");
// if (oid.startsWith("urn:oid:urn:oid:"))
// throw new FHIRFormatError("Error in OID format");
// if (!hasExtension(define, EXT_OID))
// define.getExtension().add(Factory.newExtension(EXT_OID, Factory.newUri(oid), false));
// else if (!oid.equals(readStringExtension(define, EXT_OID)))
// throw new Error("Attempt to assign multiple OIDs to a code system");
// }
// public static void setOID(ValueSet vs, String oid) throws FHIRFormatError, URISyntaxException {
// if (!oid.startsWith("urn:oid:"))
// throw new FHIRFormatError("Error in OID format");
// if (oid.startsWith("urn:oid:urn:oid:"))
// throw new FHIRFormatError("Error in OID format");
// if (!hasExtension(vs, EXT_OID))
// vs.getExtension().add(Factory.newExtension(EXT_OID, Factory.newUri(oid), false));
// else if (!oid.equals(readStringExtension(vs, EXT_OID)))
// throw new Error("Attempt to assign multiple OIDs to value set "+vs.getName()+" ("+vs.getUrl()+"). Has "+readStringExtension(vs, EXT_OID)+", trying to add "+oid);
// }
// public static String getOID(CodeSystem define) {
// return readStringExtension(define, EXT_OID);
// }
//
// public static String getOID(ValueSet vs) {
// return readStringExtension(vs, EXT_OID);
// }
//
// public static void setOID(CodeSystem define, String oid) throws FHIRFormatError, URISyntaxException {
// if (!oid.startsWith("urn:oid:"))
// throw new FHIRFormatError("Error in OID format");
// if (oid.startsWith("urn:oid:urn:oid:"))
// throw new FHIRFormatError("Error in OID format");
// if (!hasExtension(define, EXT_OID))
// define.getExtension().add(Factory.newExtension(EXT_OID, Factory.newUri(oid), false));
// else if (!oid.equals(readStringExtension(define, EXT_OID)))
// throw new Error("Attempt to assign multiple OIDs to a code system");
// }
// public static void setOID(ValueSet vs, String oid) throws FHIRFormatError, URISyntaxException {
// if (!oid.startsWith("urn:oid:"))
// throw new FHIRFormatError("Error in OID format");
// if (oid.startsWith("urn:oid:urn:oid:"))
// throw new FHIRFormatError("Error in OID format");
// if (!hasExtension(vs, EXT_OID))
// vs.getExtension().add(Factory.newExtension(EXT_OID, Factory.newUri(oid), false));
// else if (!oid.equals(readStringExtension(vs, EXT_OID)))
// throw new Error("Attempt to assign multiple OIDs to value set "+vs.getName()+" ("+vs.getUrl()+"). Has "+readStringExtension(vs, EXT_OID)+", trying to add "+oid);
// }
public static boolean hasLanguageTranslation(Element element, String lang) {
for (Extension e : element.getExtension()) {
@ -687,23 +710,23 @@ public class ToolingExtensions {
return results;
}
// public static void addDEReference(DataElement de, String value) {
// for (Extension e : de.getExtension())
// if (e.getUrl().equals(EXT_CIMI_REFERENCE)) {
// e.setValue(new UriType(value));
// return;
// }
// de.getExtension().add(new Extension().setUrl(EXT_CIMI_REFERENCE).setValue(new UriType(value)));
// }
// public static void addDEReference(DataElement de, String value) {
// for (Extension e : de.getExtension())
// if (e.getUrl().equals(EXT_CIMI_REFERENCE)) {
// e.setValue(new UriType(value));
// return;
// }
// de.getExtension().add(new Extension().setUrl(EXT_CIMI_REFERENCE).setValue(new UriType(value)));
// }
// public static void setDeprecated(Element nc) {
// for (Extension e : nc.getExtension())
// if (e.getUrl().equals(EXT_DEPRECATED)) {
// e.setValue(new BooleanType(true));
// return;
// }
// nc.getExtension().add(new Extension().setUrl(EXT_DEPRECATED).setValue(new BooleanType(true)));
// }
// public static void setDeprecated(Element nc) {
// for (Extension e : nc.getExtension())
// if (e.getUrl().equals(EXT_DEPRECATED)) {
// e.setValue(new BooleanType(true));
// return;
// }
// nc.getExtension().add(new Extension().setUrl(EXT_DEPRECATED).setValue(new BooleanType(true)));
// }
public static void setExtension(Element focus, String url, Coding c) {
for (Extension e : focus.getExtension())
@ -908,14 +931,14 @@ public class ToolingExtensions {
return type.primitiveValue();
}
// public static boolean hasOID(ValueSet vs) {
// return hasExtension(vs, EXT_OID);
// }
//
// public static boolean hasOID(CodeSystem cs) {
// return hasExtension(cs, EXT_OID);
// }
//
// public static boolean hasOID(ValueSet vs) {
// return hasExtension(vs, EXT_OID);
// }
//
// public static boolean hasOID(CodeSystem cs) {
// return hasExtension(cs, EXT_OID);
// }
//
public static void addUrlExtension(Element e, String url, String content) {
if (!StringUtils.isBlank(content)) {
Extension ex = getExtension(e, url);

View File

@ -323,7 +323,49 @@ Modifier extensions SHALL NOT change the meaning of any elements on Resource or
}
}
public List<Extension> getExtensionsByUrl(String... theUrls) {
ArrayList<Extension> retVal = new ArrayList<>();
for (Extension next : getModifierExtension()) {
if (Utilities.existsInList(next.getUrl(), theUrls)) {
retVal.add(next);
}
}
List<Extension> sv = super.getExtensionsByUrl(theUrls);
sv.addAll(retVal);
return sv;
}
public boolean hasExtension(String... theUrls) {
for (Extension next : getModifierExtension()) {
if (Utilities.existsInList(next.getUrl(), theUrls)) {
return true;
}
}
return super.hasExtension(theUrls);
}
public boolean hasExtension(String theUrl) {
for (Extension ext : getModifierExtension()) {
if (theUrl.equals(ext.getUrl())) {
return true;
}
}
return super.hasExtension(theUrl);
}
public void copyNewExtensions(org.hl7.fhir.r5.model.BackboneElement src, String... urls) {
for (Extension e : src.getModifierExtension()) {
if (Utilities.existsInList(e.getUrl(), urls) && !!hasExtension(e.getUrl())) {
addExtension(e.copy());
}
}
super.copyNewExtensions(src, urls);
}
// end addition

View File

@ -250,6 +250,60 @@ public void checkNoModifiers(String noun, String verb) throws FHIRException {
}
}
public void copyExtensions(org.hl7.fhir.r5.model.BackboneElement src, String... urls) {
super.copyExtensions(src,urls);
for (Extension e : src.getModifierExtension()) {
if (Utilities.existsInList(e.getUrl(), urls)) {
addModifierExtension(e.copy());
}
}
}
public List<Extension> getExtensionsByUrl(String... theUrls) {
ArrayList<Extension> retVal = new ArrayList<>();
for (Extension next : getModifierExtension()) {
if (Utilities.existsInList(next.getUrl(), theUrls)) {
retVal.add(next);
}
}
List<Extension> sv = super.getExtensionsByUrl(theUrls);
sv.addAll(retVal);
return sv;
}
public boolean hasExtension(String... theUrls) {
for (Extension next : getModifierExtension()) {
if (Utilities.existsInList(next.getUrl(), theUrls)) {
return true;
}
}
return super.hasExtension(theUrls);
}
public boolean hasExtension(String theUrl) {
for (Extension ext : getModifierExtension()) {
if (theUrl.equals(ext.getUrl())) {
return true;
}
}
return super.hasExtension(theUrl);
}
public void copyNewExtensions(org.hl7.fhir.r5.model.BackboneElement src, String... urls) {
for (Extension e : src.getModifierExtension()) {
if (Utilities.existsInList(e.getUrl(), urls) && !!hasExtension(e.getUrl())) {
addExtension(e.copy());
}
}
super.copyNewExtensions(src, urls);
}
// end addition
}

View File

@ -169,8 +169,8 @@ public class ConceptMapRenderer extends TerminologyRenderer {
if (!ccm.hasRelationship())
tr.td().tx(":"+"("+ConceptMapRelationship.EQUIVALENT.toCode()+")");
else {
if (ccm.getRelationshipElement().hasExtension(ToolingExtensions.EXT_OLD_CONCEPTMAP_EQUIVALENCE)) {
String code = ToolingExtensions.readStringExtension(ccm.getRelationshipElement(), ToolingExtensions.EXT_OLD_CONCEPTMAP_EQUIVALENCE);
if (ccm.hasExtension(ToolingExtensions.EXT_OLD_CONCEPTMAP_EQUIVALENCE)) {
String code = ToolingExtensions.readStringExtension(ccm, ToolingExtensions.EXT_OLD_CONCEPTMAP_EQUIVALENCE);
tr.td().ah(eqpath+"#"+code, code).tx(presentEquivalenceCode(code));
} else {
tr.td().ah(eqpath+"#"+ccm.getRelationship().toCode(), ccm.getRelationship().toCode()).tx(presentRelationshipCode(ccm.getRelationship().toCode()));