Search in sources :

Example 46 with OperationDefinition

use of org.hl7.fhir.r4.model.OperationDefinition in project org.hl7.fhir.core by hapifhir.

the class RdfParser method composeOperationDefinitionOperationDefinitionOverloadComponent.

protected void composeOperationDefinitionOperationDefinitionOverloadComponent(Complex parent, String parentType, String name, OperationDefinition.OperationDefinitionOverloadComponent element, int index) {
    if (element == null)
        return;
    Complex t;
    if (Utilities.noString(parentType))
        t = parent;
    else {
        t = parent.predicate("fhir:" + parentType + '.' + name);
    }
    composeBackboneElement(t, "overload", name, element, index);
    for (int i = 0; i < element.getParameterName().size(); i++) composeString(t, "OperationDefinition", "parameterName", element.getParameterName().get(i), i);
    if (element.hasCommentElement())
        composeString(t, "OperationDefinition", "comment", element.getCommentElement(), -1);
}
Also used : Complex(org.hl7.fhir.dstu3.utils.formats.Turtle.Complex)

Example 47 with OperationDefinition

use of org.hl7.fhir.r4.model.OperationDefinition in project org.hl7.fhir.core by hapifhir.

the class RdfParser method composeOperationDefinitionOperationDefinitionParameterBindingComponent.

protected void composeOperationDefinitionOperationDefinitionParameterBindingComponent(Complex parent, String parentType, String name, OperationDefinition.OperationDefinitionParameterBindingComponent element, int index) {
    if (element == null)
        return;
    Complex t;
    if (Utilities.noString(parentType))
        t = parent;
    else {
        t = parent.predicate("fhir:" + parentType + '.' + name);
    }
    composeBackboneElement(t, "binding", name, element, index);
    if (element.hasStrengthElement())
        composeEnum(t, "OperationDefinition", "strength", element.getStrengthElement(), -1);
    if (element.hasValueSet())
        composeType(t, "OperationDefinition", "valueSet", element.getValueSet(), -1);
}
Also used : Complex(org.hl7.fhir.dstu3.utils.formats.Turtle.Complex)

Example 48 with OperationDefinition

use of org.hl7.fhir.r4.model.OperationDefinition in project org.hl7.fhir.core by hapifhir.

the class BaseWorkerContext method cacheResource.

public void cacheResource(Resource r) throws FHIRException {
    synchronized (lock) {
        Map<String, Resource> map = allResourcesById.get(r.fhirType());
        if (map == null) {
            map = new HashMap<String, Resource>();
            allResourcesById.put(r.fhirType(), map);
        }
        map.put(r.getId(), r);
        if (r instanceof MetadataResource) {
            MetadataResource m = (MetadataResource) r;
            String url = m.getUrl();
            if (!allowLoadingDuplicates && hasResource(r.getClass(), url))
                throw new DefinitionException("Duplicate Resource " + url);
            if (r instanceof StructureDefinition)
                seeMetadataResource((StructureDefinition) m, structures, false);
            else if (r instanceof ValueSet)
                seeMetadataResource((ValueSet) m, valueSets, false);
            else if (r instanceof CodeSystem)
                seeMetadataResource((CodeSystem) m, codeSystems, false);
            else if (r instanceof ImplementationGuide)
                seeMetadataResource((ImplementationGuide) m, guides, false);
            else if (r instanceof CapabilityStatement)
                seeMetadataResource((CapabilityStatement) m, capstmts, false);
            else if (r instanceof SearchParameter)
                seeMetadataResource((SearchParameter) m, searchParameters, false);
            else if (r instanceof PlanDefinition)
                seeMetadataResource((PlanDefinition) m, plans, false);
            else if (r instanceof OperationDefinition)
                seeMetadataResource((OperationDefinition) m, operations, false);
            else if (r instanceof Questionnaire)
                seeMetadataResource((Questionnaire) m, questionnaires, true);
            else if (r instanceof ConceptMap)
                seeMetadataResource((ConceptMap) m, maps, false);
            else if (r instanceof StructureMap)
                seeMetadataResource((StructureMap) m, transforms, false);
            else if (r instanceof NamingSystem)
                systems.add((NamingSystem) r);
        }
    }
}
Also used : DefinitionException(org.hl7.fhir.exceptions.DefinitionException)

Example 49 with OperationDefinition

use of org.hl7.fhir.r4.model.OperationDefinition in project org.hl7.fhir.core by hapifhir.

the class NarrativeGenerator method generate.

public void generate(OperationDefinition opd) throws EOperationOutcome, FHIRException, IOException {
    XhtmlNode x = new XhtmlNode(NodeType.Element, "div");
    x.addTag("h2").addText(opd.getName());
    x.addTag("p").addText(Utilities.capitalize(opd.getKind().toString()) + ": " + opd.getName());
    addMarkdown(x, opd.getDescription());
    if (opd.getSystem())
        x.addTag("p").addText("URL: [base]/$" + opd.getCode());
    for (CodeType c : opd.getType()) {
        x.addTag("p").addText("URL: [base]/" + c.getValue() + "/$" + opd.getCode());
        if (opd.getInstance())
            x.addTag("p").addText("URL: [base]/" + c.getValue() + "/[id]/$" + opd.getCode());
    }
    x.addTag("p").addText("Parameters");
    XhtmlNode tbl = x.addTag("table").setAttribute("class", "grid");
    XhtmlNode tr = tbl.addTag("tr");
    tr.addTag("td").addTag("b").addText("Use");
    tr.addTag("td").addTag("b").addText("Name");
    tr.addTag("td").addTag("b").addText("Cardinality");
    tr.addTag("td").addTag("b").addText("Type");
    tr.addTag("td").addTag("b").addText("Binding");
    tr.addTag("td").addTag("b").addText("Documentation");
    for (OperationDefinitionParameterComponent p : opd.getParameter()) {
        genOpParam(tbl, "", p);
    }
    addMarkdown(x, opd.getNotes());
    inject(opd, x, NarrativeStatus.GENERATED);
}
Also used : CodeType(org.hl7.fhir.dstu2.model.CodeType) XhtmlNode(org.hl7.fhir.utilities.xhtml.XhtmlNode) OperationDefinitionParameterComponent(org.hl7.fhir.dstu2.model.OperationDefinition.OperationDefinitionParameterComponent)

Example 50 with OperationDefinition

use of org.hl7.fhir.r4.model.OperationDefinition in project org.hl7.fhir.core by hapifhir.

the class RdfParser method composeOperationDefinition.

protected void composeOperationDefinition(Complex parent, String parentType, String name, OperationDefinition element, int index) {
    if (element == null)
        return;
    Complex t;
    if (Utilities.noString(parentType))
        t = parent;
    else {
        t = parent.predicate("fhir:" + parentType + '.' + name);
    }
    composeDomainResource(t, "OperationDefinition", name, element, index);
    if (element.hasUrlElement())
        composeUri(t, "OperationDefinition", "url", element.getUrlElement(), -1);
    if (element.hasVersionElement())
        composeString(t, "OperationDefinition", "version", element.getVersionElement(), -1);
    if (element.hasNameElement())
        composeString(t, "OperationDefinition", "name", element.getNameElement(), -1);
    if (element.hasStatusElement())
        composeEnum(t, "OperationDefinition", "status", element.getStatusElement(), -1);
    if (element.hasKindElement())
        composeEnum(t, "OperationDefinition", "kind", element.getKindElement(), -1);
    if (element.hasExperimentalElement())
        composeBoolean(t, "OperationDefinition", "experimental", element.getExperimentalElement(), -1);
    if (element.hasDateElement())
        composeDateTime(t, "OperationDefinition", "date", element.getDateElement(), -1);
    if (element.hasPublisherElement())
        composeString(t, "OperationDefinition", "publisher", element.getPublisherElement(), -1);
    for (int i = 0; i < element.getContact().size(); i++) composeContactDetail(t, "OperationDefinition", "contact", element.getContact().get(i), i);
    if (element.hasDescriptionElement())
        composeMarkdown(t, "OperationDefinition", "description", element.getDescriptionElement(), -1);
    for (int i = 0; i < element.getUseContext().size(); i++) composeUsageContext(t, "OperationDefinition", "useContext", element.getUseContext().get(i), i);
    for (int i = 0; i < element.getJurisdiction().size(); i++) composeCodeableConcept(t, "OperationDefinition", "jurisdiction", element.getJurisdiction().get(i), i);
    if (element.hasPurposeElement())
        composeMarkdown(t, "OperationDefinition", "purpose", element.getPurposeElement(), -1);
    if (element.hasIdempotentElement())
        composeBoolean(t, "OperationDefinition", "idempotent", element.getIdempotentElement(), -1);
    if (element.hasCodeElement())
        composeCode(t, "OperationDefinition", "code", element.getCodeElement(), -1);
    if (element.hasCommentElement())
        composeString(t, "OperationDefinition", "comment", element.getCommentElement(), -1);
    if (element.hasBase())
        composeReference(t, "OperationDefinition", "base", element.getBase(), -1);
    for (int i = 0; i < element.getResource().size(); i++) composeCode(t, "OperationDefinition", "resource", element.getResource().get(i), i);
    if (element.hasSystemElement())
        composeBoolean(t, "OperationDefinition", "system", element.getSystemElement(), -1);
    if (element.hasTypeElement())
        composeBoolean(t, "OperationDefinition", "type", element.getTypeElement(), -1);
    if (element.hasInstanceElement())
        composeBoolean(t, "OperationDefinition", "instance", element.getInstanceElement(), -1);
    for (int i = 0; i < element.getParameter().size(); i++) composeOperationDefinitionOperationDefinitionParameterComponent(t, "OperationDefinition", "parameter", element.getParameter().get(i), i);
    for (int i = 0; i < element.getOverload().size(); i++) composeOperationDefinitionOperationDefinitionOverloadComponent(t, "OperationDefinition", "overload", element.getOverload().get(i), i);
}
Also used : Complex(org.hl7.fhir.dstu3.utils.formats.Turtle.Complex)

Aggregations

OperationDefinition (org.hl7.fhir.r5.model.OperationDefinition)10 FHIRException (org.hl7.fhir.exceptions.FHIRException)9 DefinitionException (org.hl7.fhir.exceptions.DefinitionException)8 OperationDefinitionParameterComponent (org.hl7.fhir.r5.model.OperationDefinition.OperationDefinitionParameterComponent)7 XhtmlNode (org.hl7.fhir.utilities.xhtml.XhtmlNode)6 File (java.io.File)5 ArrayList (java.util.ArrayList)5 Complex (org.hl7.fhir.dstu3.utils.formats.Turtle.Complex)5 XmlParser (org.hl7.fhir.r5.formats.XmlParser)5 StructureDefinition (org.hl7.fhir.r5.model.StructureDefinition)5 Description (ca.uhn.fhir.model.api.annotation.Description)4 Operation (ca.uhn.fhir.rest.annotation.Operation)4 FileOutputStream (java.io.FileOutputStream)4 Complex (org.hl7.fhir.dstu2016may.formats.RdfGenerator.Complex)4 Parameters (org.hl7.fhir.r4.model.Parameters)4 Complex (org.hl7.fhir.r4.utils.formats.Turtle.Complex)4 StructureDefinition (org.hl7.fhir.r4b.model.StructureDefinition)4 CanonicalResource (org.hl7.fhir.r5.model.CanonicalResource)4 Extension (org.hl7.fhir.r5.model.Extension)4 ListResource (org.hl7.fhir.r5.model.ListResource)4