Search in sources :

Example 91 with Parameters

use of org.hl7.fhir.r5.model.Parameters in project org.hl7.fhir.core by hapifhir.

the class Parameters method copy.

public Parameters copy() {
    Parameters dst = new Parameters();
    copyValues(dst);
    if (parameter != null) {
        dst.parameter = new ArrayList<ParametersParameterComponent>();
        for (ParametersParameterComponent i : parameter) dst.parameter.add(i.copy());
    }
    ;
    return dst;
}
Also used : IBaseParameters(org.hl7.fhir.instance.model.api.IBaseParameters)

Example 92 with Parameters

use of org.hl7.fhir.r5.model.Parameters in project org.hl7.fhir.core by hapifhir.

the class ByteUtils method encodeFormSubmission.

public static byte[] encodeFormSubmission(Map<String, String> parameters, String resourceName, Resource resource, String boundary) throws IOException {
    ByteArrayOutputStream b = new ByteArrayOutputStream();
    OutputStreamWriter w = new OutputStreamWriter(b, StandardCharsets.UTF_8);
    for (String name : parameters.keySet()) {
        w.write("--");
        w.write(boundary);
        w.write("\r\nContent-Disposition: form-data; name=\"" + name + "\"\r\n\r\n");
        w.write(parameters.get(name) + "\r\n");
    }
    w.write("--");
    w.write(boundary);
    w.write("\r\nContent-Disposition: form-data; name=\"" + resourceName + "\"\r\n\r\n");
    w.close();
    JsonParser json = new JsonParser();
    json.setOutputStyle(IParser.OutputStyle.NORMAL);
    json.compose(b, resource);
    b.close();
    w = new OutputStreamWriter(b, StandardCharsets.UTF_8);
    w.write("\r\n--");
    w.write(boundary);
    w.write("--");
    w.close();
    return b.toByteArray();
}
Also used : OutputStreamWriter(java.io.OutputStreamWriter) ByteArrayOutputStream(java.io.ByteArrayOutputStream) JsonParser(org.hl7.fhir.dstu3.formats.JsonParser)

Example 93 with Parameters

use of org.hl7.fhir.r5.model.Parameters in project org.hl7.fhir.core by hapifhir.

the class RdfParser method composeParametersParametersParameterComponent.

protected void composeParametersParametersParameterComponent(Complex parent, String parentType, String name, Parameters.ParametersParameterComponent element, int index) {
    if (element == null)
        return;
    Complex t;
    if (Utilities.noString(parentType))
        t = parent;
    else {
        t = parent.predicate("fhir:" + parentType + '.' + name);
    }
    composeBackboneElement(t, "parameter", name, element, index);
    if (element.hasNameElement())
        composeString(t, "Parameters", "name", element.getNameElement(), -1);
    if (element.hasValue())
        composeType(t, "Parameters", "value", element.getValue(), -1);
    if (element.hasResource())
        composeResource(t, "Parameters", "resource", element.getResource(), -1);
    for (int i = 0; i < element.getPart().size(); i++) composeParametersParametersParameterComponent(t, "Parameters", "part", element.getPart().get(i), i);
}
Also used : Complex(org.hl7.fhir.r4.utils.formats.Turtle.Complex)

Example 94 with Parameters

use of org.hl7.fhir.r5.model.Parameters in project org.hl7.fhir.core by hapifhir.

the class GraphQLSchemaGenerator method generateListAccess.

private void generateListAccess(BufferedWriter writer, List<SearchParameter> parameters, String name) throws IOException {
    writer.write("type " + name + "ListType {\r\n");
    writer.write("  " + name + "List(");
    param(writer, "_filter", "String", false, false);
    for (SearchParameter sp : parameters) param(writer, sp.getName().replace("-", "_"), getGqlname(sp.getType().toCode()), true, true);
    param(writer, "_sort", "String", false, true);
    param(writer, "_count", "Int", false, true);
    param(writer, "_cursor", "String", false, true);
    writer.write(") : [" + name + "]\r\n");
    writer.write("}\r\n");
    writer.write("\r\n");
}
Also used : SearchParameter(org.hl7.fhir.r4.model.SearchParameter)

Example 95 with Parameters

use of org.hl7.fhir.r5.model.Parameters in project org.hl7.fhir.core by hapifhir.

the class ValueSetExpanderSimple method importValueSet.

private ValueSet importValueSet(String value, List<ValueSetExpansionParameterComponent> params, Parameters expParams) throws ETooCostly, TerminologyServiceException, FileNotFoundException, IOException, FHIRFormatError {
    if (value == null)
        throw new TerminologyServiceException("unable to find value set with no identity");
    ValueSet vs = context.fetchResource(ValueSet.class, value);
    if (vs == null)
        throw new TerminologyServiceException("Unable to find imported value set " + value);
    ValueSetExpansionOutcome vso = new ValueSetExpanderSimple(context).expand(vs, expParams);
    if (vso.getError() != null)
        throw new TerminologyServiceException("Unable to expand imported value set: " + vso.getError());
    if (vs.hasVersion())
        if (!existsInParams(params, "version", new UriType(vs.getUrl() + "|" + vs.getVersion())))
            params.add(new ValueSetExpansionParameterComponent().setName("version").setValue(new UriType(vs.getUrl() + "|" + vs.getVersion())));
    for (ValueSetExpansionParameterComponent p : vso.getValueset().getExpansion().getParameter()) {
        if (!existsInParams(params, p.getName(), p.getValue()))
            params.add(p);
    }
    // if we're importing a value set, we have to be combining, so we won't try for a heirarchy
    canBeHeirarchy = false;
    return vso.getValueset();
}
Also used : ValueSetExpansionParameterComponent(org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionParameterComponent) NoTerminologyServiceException(org.hl7.fhir.exceptions.NoTerminologyServiceException) TerminologyServiceException(org.hl7.fhir.exceptions.TerminologyServiceException) ValueSet(org.hl7.fhir.r4.model.ValueSet) UriType(org.hl7.fhir.r4.model.UriType)

Aggregations

Parameters (org.hl7.fhir.r4.model.Parameters)105 Test (org.junit.jupiter.api.Test)96 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)71 StringType (org.hl7.fhir.r4.model.StringType)68 RestIntegrationTest (org.opencds.cqf.ruler.test.RestIntegrationTest)61 HashMap (java.util.HashMap)58 ArrayList (java.util.ArrayList)53 FHIRException (org.hl7.fhir.exceptions.FHIRException)48 IOException (java.io.IOException)44 Parameters (org.hl7.fhir.dstu3.model.Parameters)41 Bundle (org.hl7.fhir.r4.model.Bundle)34 Measure (org.hl7.fhir.r4.model.Measure)31 Path (javax.ws.rs.Path)25 Produces (javax.ws.rs.Produces)25 Patient (org.hl7.fhir.r4.model.Patient)25 FileNotFoundException (java.io.FileNotFoundException)24 List (java.util.List)24 JsonObject (javax.json.JsonObject)23 GET (javax.ws.rs.GET)23 ExtraParameters (org.apache.camel.component.fhir.api.ExtraParameters)23