use of org.hl7.fhir.r5.utils.BuildExtensions in project org.hl7.fhir.core by hapifhir.
the class ExtensionDefinitionGenerator method buildExtensions.
private void buildExtensions(StructureDefinition type, List<StructureDefinition> list) throws FHIRException {
for (ElementDefinition ed : type.getDifferential().getElement()) {
if (ed.getPath().contains(".")) {
if (!ed.getPath().endsWith(".extension") && !ed.getPath().endsWith(".modifierExtension")) {
StructureDefinition ext = generateExtension(type, ed);
if (ext != null) {
list.add(ext);
context.cacheResource(ext);
}
}
}
}
}
use of org.hl7.fhir.r5.utils.BuildExtensions in project org.hl7.fhir.core by hapifhir.
the class ExtensionDefinitionGenerator method buildExtensions.
private List<StructureDefinition> buildExtensions(List<StructureDefinition> definitions) throws FHIRException {
Set<String> types = new HashSet<>();
List<StructureDefinition> list = new ArrayList<>();
for (StructureDefinition type : definitions) if (type.getDerivation() == TypeDerivationRule.SPECIALIZATION && !type.getName().contains(".") && !types.contains(type.getName()) && type.getKind() != StructureDefinitionKind.PRIMITIVETYPE && !Utilities.existsInList(type.getName(), "Extension", "Narrative")) {
types.add(type.getName());
buildExtensions(type, list);
}
return list;
}
use of org.hl7.fhir.r5.utils.BuildExtensions in project org.hl7.fhir.core by hapifhir.
the class ExtensionDefinitionGenerator method generate.
private void generate() throws IOException, FHIRException {
List<StructureDefinition> definitions = loadSource();
List<StructureDefinition> extensions = buildExtensions(definitions);
for (StructureDefinition ext : extensions) pu.generateSnapshot(extbase, ext, ext.getUrl(), "http://hl7.org/fhir/R4", ext.getName());
savePackage(extensions);
}
Aggregations