Search in sources :

Example 26 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.hasValueSetElement())
        composeCanonical(t, "OperationDefinition", "valueSet", element.getValueSetElement(), -1);
}
Also used : Complex(org.hl7.fhir.r4.utils.formats.Turtle.Complex)

Example 27 with OperationDefinition

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

the class NarrativeGenerator method generate.

public boolean generate(ResourceContext rcontext, OperationDefinition opd) throws EOperationOutcome, FHIRException, IOException {
    XhtmlNode x = new XhtmlNode(NodeType.Element, "div");
    x.h2().addText(opd.getName());
    x.para().addText(Utilities.capitalize(opd.getKind().toString()) + ": " + opd.getName());
    x.para().tx("The official URL for this operation definition is: ");
    x.pre().tx(opd.getUrl());
    addMarkdown(x, opd.getDescription());
    if (opd.getSystem())
        x.para().tx("URL: [base]/$" + opd.getCode());
    for (CodeType c : opd.getResource()) {
        if (opd.getType())
            x.para().tx("URL: [base]/" + c.getValue() + "/$" + opd.getCode());
        if (opd.getInstance())
            x.para().tx("URL: [base]/" + c.getValue() + "/[id]/$" + opd.getCode());
    }
    x.para().tx("Parameters");
    XhtmlNode tbl = x.table("grid");
    XhtmlNode tr = tbl.tr();
    tr.td().b().tx("Use");
    tr.td().b().tx("Name");
    tr.td().b().tx("Cardinality");
    tr.td().b().tx("Type");
    tr.td().b().tx("Binding");
    tr.td().b().tx("Documentation");
    for (OperationDefinitionParameterComponent p : opd.getParameter()) {
        genOpParam(rcontext, tbl, "", p);
    }
    addMarkdown(x, opd.getComment());
    inject(opd, x, NarrativeStatus.GENERATED);
    return true;
}
Also used : CodeType(org.hl7.fhir.dstu3.model.CodeType) XhtmlNode(org.hl7.fhir.utilities.xhtml.XhtmlNode) OperationDefinitionParameterComponent(org.hl7.fhir.dstu3.model.OperationDefinition.OperationDefinitionParameterComponent)

Example 28 with OperationDefinition

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

the class TurtleTests method test_operationdefinition_example.

@Test
public void test_operationdefinition_example() throws FileNotFoundException, IOException, Exception {
    System.out.println("operationdefinition-example.ttl");
    new Turtle().parse(TextFile.fileToString("C:\\work\\org.hl7.fhir\\build\\publish\\operationdefinition-example.ttl"));
}
Also used : Turtle(org.hl7.fhir.dstu3.utils.formats.Turtle) Test(org.junit.jupiter.api.Test)

Example 29 with OperationDefinition

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

the class NarrativeGenerator method generate.

public boolean generate(ResourceContext rcontext, OperationDefinition opd) throws EOperationOutcome, FHIRException, IOException {
    XhtmlNode x = new XhtmlNode(NodeType.Element, "div");
    x.h2().addText(opd.getName());
    x.para().addText(Utilities.capitalize(opd.getKind().toString()) + ": " + opd.getName());
    x.para().tx("The official URL for this operation definition is: ");
    x.pre().tx(opd.getUrl());
    addMarkdown(x, opd.getDescription());
    if (opd.getSystem())
        x.para().tx("URL: [base]/$" + opd.getCode());
    for (CodeType c : opd.getResource()) {
        if (opd.getType())
            x.para().tx("URL: [base]/" + c.getValue() + "/$" + opd.getCode());
        if (opd.getInstance())
            x.para().tx("URL: [base]/" + c.getValue() + "/[id]/$" + opd.getCode());
    }
    x.para().tx("Parameters");
    XhtmlNode tbl = x.table("grid");
    XhtmlNode tr = tbl.tr();
    tr.td().b().tx("Use");
    tr.td().b().tx("Name");
    tr.td().b().tx("Cardinality");
    tr.td().b().tx("Type");
    tr.td().b().tx("Binding");
    tr.td().b().tx("Documentation");
    for (OperationDefinitionParameterComponent p : opd.getParameter()) {
        genOpParam(rcontext, tbl, "", p);
    }
    addMarkdown(x, opd.getComment());
    inject(opd, x, NarrativeStatus.GENERATED);
    return true;
}
Also used : XhtmlNode(org.hl7.fhir.utilities.xhtml.XhtmlNode) OperationDefinitionParameterComponent(org.hl7.fhir.r4.model.OperationDefinition.OperationDefinitionParameterComponent)

Example 30 with OperationDefinition

use of org.hl7.fhir.r4.model.OperationDefinition in project pathling by aehrc.

the class ExtractResponse method toParameters.

/**
 * Converts this to a {@link Parameters} resource, based on the definition of the result of the
 * "extract" operation within the OperationDefinition.
 *
 * @return a new {@link Parameters} object
 */
public Parameters toParameters() {
    final Parameters parameters = new Parameters();
    final ParametersParameterComponent urlParameter = new ParametersParameterComponent();
    urlParameter.setName("url");
    urlParameter.setValue(new UrlType(url));
    parameters.getParameter().add(urlParameter);
    return parameters;
}
Also used : Parameters(org.hl7.fhir.r4.model.Parameters) UrlType(org.hl7.fhir.r4.model.UrlType) ParametersParameterComponent(org.hl7.fhir.r4.model.Parameters.ParametersParameterComponent)

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