diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/conformance/profile/ProfileUtilities.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/conformance/profile/ProfileUtilities.java index 25a19cc83..554dc8608 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/conformance/profile/ProfileUtilities.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/conformance/profile/ProfileUtilities.java @@ -3864,5 +3864,9 @@ public class ProfileUtilities extends TranslatingUtilities { return null; } + public static boolean isExtensionDefinition(StructureDefinition sd) { + return sd.getDerivation() == TypeDerivationRule.CONSTRAINT && sd.getType().equals("Extension"); + } + } diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/context/ContextUtilities.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/context/ContextUtilities.java index fe714306e..822efd798 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/context/ContextUtilities.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/context/ContextUtilities.java @@ -136,12 +136,24 @@ public class ContextUtilities implements ProfileKnowledgeProvider { * @return a list of the resource and type names defined for this version */ public List getTypeNames() { - List result = new ArrayList(); + Set result = new HashSet(); + for (StructureDefinition sd : context.fetchResourcesByType(StructureDefinition.class)) { + if (sd.getKind() != StructureDefinitionKind.LOGICAL && sd.getDerivation() == TypeDerivationRule.SPECIALIZATION) + result.add(sd.getName()); + } + return Utilities.sorted(result); + } + + + /** + * @return a set of the resource and type names defined for this version + */ + public Set getTypeNameSet() { + Set result = new HashSet(); for (StructureDefinition sd : context.fetchResourcesByType(StructureDefinition.class)) { if (sd.getKind() != StructureDefinitionKind.LOGICAL && sd.getDerivation() == TypeDerivationRule.SPECIALIZATION) result.add(sd.getName()); } - Collections.sort(result); return result; }