Search in sources :

Example 1 with ExecutionResultNode

use of graphql.execution.nextgen.result.ExecutionResultNode in project graphql-java by graphql-java.

the class BatchedExecutionStrategy method resolveZipper.

private NodeZipper<ExecutionResultNode> resolveZipper(NodeZipper<ExecutionResultNode> unresolvedNodeZipper, List<FetchedValueAnalysis> fetchedValuesForNode) {
    UnresolvedObjectResultNode unresolvedNode = (UnresolvedObjectResultNode) unresolvedNodeZipper.getCurNode();
    List<ExecutionResultNode> newChildren = util.fetchedValueAnalysisToNodes(fetchedValuesForNode);
    ObjectExecutionResultNode newNode = unresolvedNode.withNewChildren(newChildren);
    return unresolvedNodeZipper.withNewNode(newNode);
}
Also used : ExecutionResultNode(graphql.execution.nextgen.result.ExecutionResultNode) ObjectExecutionResultNode(graphql.execution.nextgen.result.ObjectExecutionResultNode) RootExecutionResultNode(graphql.execution.nextgen.result.RootExecutionResultNode) ObjectExecutionResultNode(graphql.execution.nextgen.result.ObjectExecutionResultNode) UnresolvedObjectResultNode(graphql.execution.nextgen.result.UnresolvedObjectResultNode)

Example 2 with ExecutionResultNode

use of graphql.execution.nextgen.result.ExecutionResultNode in project graphql-java by graphql-java.

the class BatchedExecutionStrategy method resolveNodes.

// all multizipper have the same root
private CompletableFuture<NodeMultiZipper<ExecutionResultNode>> resolveNodes(ExecutionContext executionContext, List<NodeMultiZipper<ExecutionResultNode>> unresolvedNodes) {
    assertNotEmpty(unresolvedNodes, () -> "unresolvedNodes can't be empty");
    ExecutionResultNode commonRoot = unresolvedNodes.get(0).getCommonRoot();
    CompletableFuture<List<List<NodeZipper<ExecutionResultNode>>>> listListCF = Async.flatMap(unresolvedNodes, executionResultMultiZipper -> fetchAndAnalyze(executionContext, executionResultMultiZipper.getZippers()));
    return flatList(listListCF).thenApply(zippers -> new NodeMultiZipper<ExecutionResultNode>(commonRoot, zippers, RESULT_NODE_ADAPTER));
}
Also used : ExecutionResultNode(graphql.execution.nextgen.result.ExecutionResultNode) ObjectExecutionResultNode(graphql.execution.nextgen.result.ObjectExecutionResultNode) RootExecutionResultNode(graphql.execution.nextgen.result.RootExecutionResultNode) NodeZipper(graphql.util.NodeZipper) ArrayList(java.util.ArrayList) FpKit.flatList(graphql.util.FpKit.flatList) ImmutableList(com.google.common.collect.ImmutableList) List(java.util.List)

Aggregations

ExecutionResultNode (graphql.execution.nextgen.result.ExecutionResultNode)2 ObjectExecutionResultNode (graphql.execution.nextgen.result.ObjectExecutionResultNode)2 RootExecutionResultNode (graphql.execution.nextgen.result.RootExecutionResultNode)2 ImmutableList (com.google.common.collect.ImmutableList)1 UnresolvedObjectResultNode (graphql.execution.nextgen.result.UnresolvedObjectResultNode)1 FpKit.flatList (graphql.util.FpKit.flatList)1 NodeZipper (graphql.util.NodeZipper)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1