Search in sources :

Example 1 with CanonicalParts

use of org.opencds.cqf.ruler.utility.CanonicalParts in project cqf-ruler by DBCG.

the class DataOperationsProvider method visitLibrary.

private void visitLibrary(Library library, List<Library> queue, Map<String, Library> resources, RequestDetails theRequestDetails) {
    for (RelatedArtifact relatedArtifact : library.getRelatedArtifact()) {
        if (relatedArtifact.getType().equals(RelatedArtifact.RelatedArtifactType.DEPENDSON) && relatedArtifact.hasResource()) {
            // FHIR R4+, resource is defined as a canonical
            String resourceString = relatedArtifact.getResource();
            CanonicalParts parts = Canonicals.getParts(resourceString);
            if (parts.resourceType().equals("Library")) {
                Library lib = search(Library.class, Searches.byCanonical(resourceString), theRequestDetails).firstOrNull();
                if (lib != null) {
                    resources.putIfAbsent(lib.getId(), lib);
                    queue.add(lib);
                }
            }
        }
    }
}
Also used : Library(org.hl7.fhir.r4.model.Library) RelatedArtifact(org.hl7.fhir.r4.model.RelatedArtifact) CanonicalParts(org.opencds.cqf.ruler.utility.CanonicalParts)

Aggregations

Library (org.hl7.fhir.r4.model.Library)1 RelatedArtifact (org.hl7.fhir.r4.model.RelatedArtifact)1 CanonicalParts (org.opencds.cqf.ruler.utility.CanonicalParts)1