Search in sources :

Example 1 with R2ToR4Loader

use of org.hl7.fhir.convertors.loaders.loaderR4.R2ToR4Loader in project org.hl7.fhir.core by hapifhir.

the class ExtensionDefinitionGenerator method loadSource.

private List<StructureDefinition> loadSource() throws IOException, FHIRException {
    List<StructureDefinition> list = new ArrayList<>();
    FilesystemPackageCacheManager pcm = new FilesystemPackageCacheManager(true, ToolsVersion.TOOLS_VERSION);
    NpmPackage npm = pcm.loadPackage("hl7.fhir.core", sourceVersion.toCode());
    if (sourceVersion == FHIRVersion._4_0_0)
        context = SimpleWorkerContext.fromPackage(npm);
    else if (sourceVersion == FHIRVersion._3_0_1)
        context = SimpleWorkerContext.fromPackage(npm, new R3ToR4Loader());
    else if (sourceVersion == FHIRVersion._1_4_0)
        context = SimpleWorkerContext.fromPackage(npm, new R2016MayToR4Loader());
    else if (sourceVersion == FHIRVersion._1_0_2)
        context = SimpleWorkerContext.fromPackage(npm, new R2ToR4Loader());
    pu = new ProfileUtilities(context, null, null);
    for (String fn : npm.listResources("StructureDefinition")) {
        list.add((StructureDefinition) loadResource(npm.load("package", fn), sourceVersion));
    }
    for (StructureDefinition sd : list) if (sd.getName().equals("Extension")) {
        extbase = sd;
        extv = extbase.getSnapshot().getElement().get(extbase.getSnapshot().getElement().size() - 1);
    }
    return list;
}
Also used : FilesystemPackageCacheManager(org.hl7.fhir.utilities.npm.FilesystemPackageCacheManager) StructureDefinition(org.hl7.fhir.r4.model.StructureDefinition) NpmPackage(org.hl7.fhir.utilities.npm.NpmPackage) R2ToR4Loader(org.hl7.fhir.convertors.loaders.loaderR4.R2ToR4Loader) ProfileUtilities(org.hl7.fhir.r4.conformance.ProfileUtilities) R3ToR4Loader(org.hl7.fhir.convertors.loaders.loaderR4.R3ToR4Loader) R2016MayToR4Loader(org.hl7.fhir.convertors.loaders.loaderR4.R2016MayToR4Loader)

Aggregations

R2016MayToR4Loader (org.hl7.fhir.convertors.loaders.loaderR4.R2016MayToR4Loader)1 R2ToR4Loader (org.hl7.fhir.convertors.loaders.loaderR4.R2ToR4Loader)1 R3ToR4Loader (org.hl7.fhir.convertors.loaders.loaderR4.R3ToR4Loader)1 ProfileUtilities (org.hl7.fhir.r4.conformance.ProfileUtilities)1 StructureDefinition (org.hl7.fhir.r4.model.StructureDefinition)1 FilesystemPackageCacheManager (org.hl7.fhir.utilities.npm.FilesystemPackageCacheManager)1 NpmPackage (org.hl7.fhir.utilities.npm.NpmPackage)1