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;
}
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();
}
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);
}
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");
}
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();
}
Aggregations