use of org.hl7.fhir.utilities.graphql.GraphQLResponse in project org.hl7.fhir.core by hapifhir.
the class GraphQLEngine method execute.
@Override
public void execute() throws EGraphEngine, EGraphQLException, FHIRException {
if (graphQL == null)
throw new EGraphEngine("Unable to process graphql - graphql document missing");
fpe = new FHIRPathEngine(this.context);
magicExpression = new ExpressionNode(0);
output = new GraphQLResponse();
Operation op = null;
// todo: initial conditions
if (!Utilities.noString(graphQL.getOperationName())) {
op = graphQL.getDocument().operation(graphQL.getOperationName());
if (op == null)
throw new EGraphEngine("Unable to find operation \"" + graphQL.getOperationName() + "\"");
} else if ((graphQL.getDocument().getOperations().size() == 1))
op = graphQL.getDocument().getOperations().get(0);
else
throw new EGraphQLException("No operation name provided, so expected to find a single operation");
if (op.getOperationType() == OperationType.qglotMutation)
throw new EGraphQLException("Mutation operations are not supported (yet)");
checkNoDirectives(op.getDirectives());
processVariables(op);
if (focus == null)
processSearch(output, op.getSelectionSet(), false, "");
else
processObject(focus, focus, output, op.getSelectionSet(), false, "");
}
use of org.hl7.fhir.utilities.graphql.GraphQLResponse in project org.hl7.fhir.core by hapifhir.
the class GraphQLEngine method execute.
@Override
public void execute() throws EGraphEngine, EGraphQLException, FHIRException {
if (graphQL == null)
throw new EGraphEngine("Unable to process graphql - graphql document missing");
fpe = new FHIRPathEngine(this.context);
magicExpression = new ExpressionNode(0);
output = new GraphQLResponse();
Operation op = null;
// todo: initial conditions
if (!Utilities.noString(graphQL.getOperationName())) {
op = graphQL.getDocument().operation(graphQL.getOperationName());
if (op == null)
throw new EGraphEngine("Unable to find operation \"" + graphQL.getOperationName() + "\"");
} else if ((graphQL.getDocument().getOperations().size() == 1))
op = graphQL.getDocument().getOperations().get(0);
else
throw new EGraphQLException("No operation name provided, so expected to find a single operation");
if (op.getOperationType() == OperationType.qglotMutation)
throw new EGraphQLException("Mutation operations are not supported (yet)");
checkNoDirectives(op.getDirectives());
processVariables(op);
if (focus == null)
processSearch(output, op.getSelectionSet(), false, "");
else
processObject(focus, focus, output, op.getSelectionSet(), false, "");
}
Aggregations