use of org.hl7.fhir.utilities.graphql.VariableValue in project org.hl7.fhir.core by hapifhir.
the class GraphQLEngine method resolveValues.
private List<Value> resolveValues(Argument arg, int max, String vars) throws EGraphQLException {
List<Value> result = new ArrayList<Value>();
for (Value v : arg.getValues()) {
if (!(v instanceof VariableValue))
result.add(v);
else {
if (vars.contains(":" + v.toString() + ":"))
throw new EGraphQLException("Recursive reference to variable " + v.toString());
Argument a = workingVariables.get(v.toString());
if (a == null)
throw new EGraphQLException("No value found for variable \"" + v.toString() + "\" in \"" + arg.getName() + "\"");
List<Value> vl = resolveValues(a, -1, vars + ":" + v.toString() + ":");
result.addAll(vl);
}
}
if ((max != -1 && result.size() > max))
throw new EGraphQLException("Only " + Integer.toString(max) + " values are allowed for \"" + arg.getName() + "\", but " + Integer.toString(result.size()) + " enoucntered");
return result;
}
use of org.hl7.fhir.utilities.graphql.VariableValue in project org.hl7.fhir.core by hapifhir.
the class GraphQLEngine method resolveValues.
private List<Value> resolveValues(Argument arg, int max, String vars) throws EGraphQLException {
List<Value> result = new ArrayList<Value>();
for (Value v : arg.getValues()) {
if (!(v instanceof VariableValue))
result.add(v);
else {
if (vars.contains(":" + v.toString() + ":"))
throw new EGraphQLException("Recursive reference to variable " + v.toString());
Argument a = workingVariables.get(v.toString());
if (a == null)
throw new EGraphQLException("No value found for variable \"" + v.toString() + "\" in \"" + arg.getName() + "\"");
List<Value> vl = resolveValues(a, -1, vars + ":" + v.toString() + ":");
result.addAll(vl);
}
}
if ((max != -1 && result.size() > max))
throw new EGraphQLException("Only " + Integer.toString(max) + " values are allowed for \"" + arg.getName() + "\", but " + Integer.toString(result.size()) + " enoucntered");
return result;
}
Aggregations