Search in sources :

Example 16 with PlanDefinition

use of org.hl7.fhir.dstu3.model.PlanDefinition in project org.hl7.fhir.core by hapifhir.

the class RdfParser method composePlanDefinitionPlanDefinitionActionConditionComponent.

protected void composePlanDefinitionPlanDefinitionActionConditionComponent(Complex parent, String parentType, String name, PlanDefinition.PlanDefinitionActionConditionComponent element, int index) {
    if (element == null)
        return;
    Complex t;
    if (Utilities.noString(parentType))
        t = parent;
    else {
        t = parent.predicate("fhir:" + parentType + '.' + name);
    }
    composeBackboneElement(t, "condition", name, element, index);
    if (element.hasKindElement())
        composeEnum(t, "PlanDefinition", "kind", element.getKindElement(), -1);
    if (element.hasExpression())
        composeExpression(t, "PlanDefinition", "expression", element.getExpression(), -1);
}
Also used : Complex(org.hl7.fhir.r4.utils.formats.Turtle.Complex)

Example 17 with PlanDefinition

use of org.hl7.fhir.dstu3.model.PlanDefinition in project org.hl7.fhir.core by hapifhir.

the class RdfParser method composePlanDefinitionPlanDefinitionActionDynamicValueComponent.

protected void composePlanDefinitionPlanDefinitionActionDynamicValueComponent(Complex parent, String parentType, String name, PlanDefinition.PlanDefinitionActionDynamicValueComponent element, int index) {
    if (element == null)
        return;
    Complex t;
    if (Utilities.noString(parentType))
        t = parent;
    else {
        t = parent.predicate("fhir:" + parentType + '.' + name);
    }
    composeBackboneElement(t, "dynamicValue", name, element, index);
    if (element.hasPathElement())
        composeString(t, "PlanDefinition", "path", element.getPathElement(), -1);
    if (element.hasExpression())
        composeExpression(t, "PlanDefinition", "expression", element.getExpression(), -1);
}
Also used : Complex(org.hl7.fhir.r4.utils.formats.Turtle.Complex)

Example 18 with PlanDefinition

use of org.hl7.fhir.dstu3.model.PlanDefinition in project org.hl7.fhir.core by hapifhir.

the class RdfParser method composePlanDefinitionPlanDefinitionGoalTargetComponent.

protected void composePlanDefinitionPlanDefinitionGoalTargetComponent(Complex parent, String parentType, String name, PlanDefinition.PlanDefinitionGoalTargetComponent element, int index) {
    if (element == null)
        return;
    Complex t;
    if (Utilities.noString(parentType))
        t = parent;
    else {
        t = parent.predicate("fhir:" + parentType + '.' + name);
    }
    composeBackboneElement(t, "target", name, element, index);
    if (element.hasMeasure())
        composeCodeableConcept(t, "PlanDefinition", "measure", element.getMeasure(), -1);
    if (element.hasDetail())
        composeType(t, "PlanDefinition", "detail", element.getDetail(), -1);
    if (element.hasDue())
        composeDuration(t, "PlanDefinition", "due", element.getDue(), -1);
}
Also used : Complex(org.hl7.fhir.r4.utils.formats.Turtle.Complex)

Example 19 with PlanDefinition

use of org.hl7.fhir.dstu3.model.PlanDefinition in project org.hl7.fhir.core by hapifhir.

the class BaseWorkerContext method fetchResourceWithException.

@SuppressWarnings("unchecked")
public <T extends Resource> T fetchResourceWithException(String cls, String uri, CanonicalResource source) throws FHIRException {
    if (uri == null) {
        return null;
    }
    if ("StructureDefinition".equals(cls)) {
        uri = ProfileUtilities.sdNs(uri, getOverrideVersionNs());
    }
    synchronized (lock) {
        String version = null;
        if (uri.contains("|")) {
            version = uri.substring(uri.lastIndexOf("|") + 1);
            uri = uri.substring(0, uri.lastIndexOf("|"));
        }
        if (uri.contains("#")) {
            uri = uri.substring(0, uri.indexOf("#"));
        }
        if (cls == null || "Resource".equals(cls)) {
            if (structures.has(uri)) {
                return (T) structures.get(uri, version);
            }
            if (guides.has(uri)) {
                return (T) guides.get(uri, version);
            }
            if (capstmts.has(uri)) {
                return (T) capstmts.get(uri, version);
            }
            if (measures.has(uri)) {
                return (T) measures.get(uri, version);
            }
            if (libraries.has(uri)) {
                return (T) libraries.get(uri, version);
            }
            if (valueSets.has(uri)) {
                return (T) valueSets.get(uri, version);
            }
            if (codeSystems.has(uri)) {
                return (T) codeSystems.get(uri, version);
            }
            if (operations.has(uri)) {
                return (T) operations.get(uri, version);
            }
            if (searchParameters.has(uri)) {
                return (T) searchParameters.get(uri, version);
            }
            if (plans.has(uri)) {
                return (T) plans.get(uri, version);
            }
            if (maps.has(uri)) {
                return (T) maps.get(uri, version);
            }
            if (transforms.has(uri)) {
                return (T) transforms.get(uri, version);
            }
            if (questionnaires.has(uri)) {
                return (T) questionnaires.get(uri, version);
            }
            for (Map<String, ResourceProxy> rt : allResourcesById.values()) {
                for (ResourceProxy r : rt.values()) {
                    if (uri.equals(r.getUrl())) {
                        return (T) r.getResource();
                    }
                }
            }
        } else if ("ImplementationGuide".equals(cls)) {
            return (T) guides.get(uri, version);
        } else if ("CapabilityStatement".equals(cls)) {
            return (T) capstmts.get(uri, version);
        } else if ("Measure".equals(cls)) {
            return (T) measures.get(uri, version);
        } else if ("Library".equals(cls)) {
            return (T) libraries.get(uri, version);
        } else if ("StructureDefinition".equals(cls)) {
            return (T) structures.get(uri, version);
        } else if ("StructureMap".equals(cls)) {
            return (T) transforms.get(uri, version);
        } else if ("ValueSet".equals(cls)) {
            return (T) valueSets.get(uri, version);
        } else if ("CodeSystem".equals(cls)) {
            return (T) codeSystems.get(uri, version);
        } else if ("ConceptMap".equals(cls)) {
            return (T) maps.get(uri, version);
        } else if ("PlanDefinition".equals(cls)) {
            return (T) plans.get(uri, version);
        } else if ("OperationDefinition".equals(cls)) {
            OperationDefinition od = operations.get(uri, version);
            return (T) od;
        } else if ("Questionnaire.class".equals(cls)) {
            return (T) questionnaires.get(uri, version);
        } else if ("SearchParameter.class".equals(cls)) {
            SearchParameter res = searchParameters.get(uri, version);
            return (T) res;
        }
        if ("CodeSystem".equals(cls) && codeSystems.has(uri)) {
            return (T) codeSystems.get(uri, version);
        }
        if ("ValueSet".equals(cls) && valueSets.has(uri)) {
            return (T) valueSets.get(uri, version);
        }
        if ("Questionnaire".equals(cls)) {
            return (T) questionnaires.get(uri, version);
        }
        if (cls == null) {
            if (uri.matches(Constants.URI_REGEX) && !uri.contains("ValueSet")) {
                return null;
            }
            // it might be a special URL.
            if (Utilities.isAbsoluteUrl(uri) || uri.startsWith("ValueSet/")) {
                // findTxValueSet(uri);
                Resource res = null;
                if (res != null) {
                    return (T) res;
                }
            }
            return null;
        }
        if (supportedCodeSystems.contains(uri)) {
            return null;
        }
        throw new FHIRException(formatMessage(I18nConstants.NOT_DONE_YET_CANT_FETCH_, uri));
    }
}
Also used : CanonicalResource(org.hl7.fhir.r4b.model.CanonicalResource) Resource(org.hl7.fhir.r4b.model.Resource) SearchParameter(org.hl7.fhir.r4b.model.SearchParameter) OperationDefinition(org.hl7.fhir.r4b.model.OperationDefinition) FHIRException(org.hl7.fhir.exceptions.FHIRException) CanonicalResourceProxy(org.hl7.fhir.r4b.context.CanonicalResourceManager.CanonicalResourceProxy) ResourceProxy(org.hl7.fhir.r4b.context.BaseWorkerContext.ResourceProxy)

Example 20 with PlanDefinition

use of org.hl7.fhir.dstu3.model.PlanDefinition in project org.hl7.fhir.core by hapifhir.

the class BaseWorkerContext method fetchResourceWithException.

@SuppressWarnings("unchecked")
public <T extends Resource> T fetchResourceWithException(String cls, String uri, CanonicalResource source) throws FHIRException {
    if (uri == null) {
        return null;
    }
    if ("StructureDefinition".equals(cls)) {
        uri = ProfileUtilities.sdNs(uri, getOverrideVersionNs());
    }
    synchronized (lock) {
        String version = null;
        if (uri.contains("|")) {
            version = uri.substring(uri.lastIndexOf("|") + 1);
            uri = uri.substring(0, uri.lastIndexOf("|"));
        }
        if (uri.contains("#")) {
            uri = uri.substring(0, uri.indexOf("#"));
        }
        if (cls == null || "Resource".equals(cls)) {
            if (structures.has(uri)) {
                return (T) structures.get(uri, version);
            }
            if (guides.has(uri)) {
                return (T) guides.get(uri, version);
            }
            if (capstmts.has(uri)) {
                return (T) capstmts.get(uri, version);
            }
            if (measures.has(uri)) {
                return (T) measures.get(uri, version);
            }
            if (libraries.has(uri)) {
                return (T) libraries.get(uri, version);
            }
            if (valueSets.has(uri)) {
                return (T) valueSets.get(uri, version);
            }
            if (codeSystems.has(uri)) {
                return (T) codeSystems.get(uri, version);
            }
            if (operations.has(uri)) {
                return (T) operations.get(uri, version);
            }
            if (searchParameters.has(uri)) {
                return (T) searchParameters.get(uri, version);
            }
            if (plans.has(uri)) {
                return (T) plans.get(uri, version);
            }
            if (maps.has(uri)) {
                return (T) maps.get(uri, version);
            }
            if (transforms.has(uri)) {
                return (T) transforms.get(uri, version);
            }
            if (questionnaires.has(uri)) {
                return (T) questionnaires.get(uri, version);
            }
            for (Map<String, ResourceProxy> rt : allResourcesById.values()) {
                for (ResourceProxy r : rt.values()) {
                    if (uri.equals(r.getUrl())) {
                        return (T) r.getResource();
                    }
                }
            }
        } else if ("ImplementationGuide".equals(cls)) {
            return (T) guides.get(uri, version);
        } else if ("CapabilityStatement".equals(cls)) {
            return (T) capstmts.get(uri, version);
        } else if ("Measure".equals(cls)) {
            return (T) measures.get(uri, version);
        } else if ("Library".equals(cls)) {
            return (T) libraries.get(uri, version);
        } else if ("StructureDefinition".equals(cls)) {
            return (T) structures.get(uri, version);
        } else if ("StructureMap".equals(cls)) {
            return (T) transforms.get(uri, version);
        } else if ("ValueSet".equals(cls)) {
            return (T) valueSets.get(uri, version);
        } else if ("CodeSystem".equals(cls)) {
            return (T) codeSystems.get(uri, version);
        } else if ("ConceptMap".equals(cls)) {
            return (T) maps.get(uri, version);
        } else if ("PlanDefinition".equals(cls)) {
            return (T) plans.get(uri, version);
        } else if ("OperationDefinition".equals(cls)) {
            OperationDefinition od = operations.get(uri, version);
            return (T) od;
        } else if ("Questionnaire.class".equals(cls)) {
            return (T) questionnaires.get(uri, version);
        } else if ("SearchParameter.class".equals(cls)) {
            SearchParameter res = searchParameters.get(uri, version);
            return (T) res;
        }
        if ("CodeSystem".equals(cls) && codeSystems.has(uri)) {
            return (T) codeSystems.get(uri, version);
        }
        if ("ValueSet".equals(cls) && valueSets.has(uri)) {
            return (T) valueSets.get(uri, version);
        }
        if ("Questionnaire".equals(cls)) {
            return (T) questionnaires.get(uri, version);
        }
        if (cls == null) {
            if (uri.matches(Constants.URI_REGEX) && !uri.contains("ValueSet")) {
                return null;
            }
            // it might be a special URL.
            if (Utilities.isAbsoluteUrl(uri) || uri.startsWith("ValueSet/")) {
                // findTxValueSet(uri);
                Resource res = null;
                if (res != null) {
                    return (T) res;
                }
            }
            return null;
        }
        if (supportedCodeSystems.contains(uri)) {
            return null;
        }
        throw new FHIRException(formatMessage(I18nConstants.NOT_DONE_YET_CANT_FETCH_, uri));
    }
}
Also used : CanonicalResource(org.hl7.fhir.r5.model.CanonicalResource) Resource(org.hl7.fhir.r5.model.Resource) SearchParameter(org.hl7.fhir.r5.model.SearchParameter) OperationDefinition(org.hl7.fhir.r5.model.OperationDefinition) FHIRException(org.hl7.fhir.exceptions.FHIRException) CanonicalResourceProxy(org.hl7.fhir.r5.context.CanonicalResourceManager.CanonicalResourceProxy)

Aggregations

Complex (org.hl7.fhir.dstu3.utils.formats.Turtle.Complex)8 Complex (org.hl7.fhir.r4.utils.formats.Turtle.Complex)8 PlanDefinition (org.hl7.fhir.dstu3.model.PlanDefinition)7 PlanDefinition (org.hl7.fhir.r4.model.PlanDefinition)7 SystemRequestDetails (ca.uhn.fhir.jpa.partition.SystemRequestDetails)6 Test (org.junit.jupiter.api.Test)6 RestIntegrationTest (org.opencds.cqf.ruler.test.RestIntegrationTest)6 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)6 ArrayList (java.util.ArrayList)5 DefinitionException (org.hl7.fhir.exceptions.DefinitionException)5 JsonObject (com.google.gson.JsonObject)4 DomainResource (org.hl7.fhir.dstu3.model.DomainResource)4 IBaseResource (org.hl7.fhir.instance.model.api.IBaseResource)3 Library (org.hl7.fhir.r4.model.Library)3 StructureDefinition (org.hl7.fhir.r4b.model.StructureDefinition)3 CanonicalResourceProxy (org.hl7.fhir.r5.context.CanonicalResourceManager.CanonicalResourceProxy)3 StructureDefinition (org.hl7.fhir.r5.model.StructureDefinition)3 FhirContext (ca.uhn.fhir.context.FhirContext)2 Operation (ca.uhn.fhir.rest.annotation.Operation)2 RequestDetails (ca.uhn.fhir.rest.api.server.RequestDetails)2