package graphql; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; /** * * Following the relay specification, together with the requested information (edges) * we are going to receive a pageInfo that contains cursor information for the pagination. * * Result set example: * "edges": [ * { * "node": { * "TotalCost": 1.5, * "Status": "delivered", * "OrderId": "ORD-1023", * "OrderDate": null, * "id": "Postgres_MyOrder-ORD\\-1023" * } * }, * { * "node": { * "TotalCost": 1.5, * "Status": "delivered", * "OrderId": "ORD-1024", * "OrderDate": null, * "id": "Postgres_MyOrder-ORD\\-1024" * } * } * ], * "pageInfo": { * "hasNextPage": true, * "endCursor": "ZW5kQ3Vyc29y" * } * } * } */ public class QueryResultSet { private List> edges; private Map pageInfo; /** * @param edges List of nodes, where each node is a map from columnName to value * @param pageInfo pagination info map, including hasNextPage (boolean) and endCursor (String) */ public QueryResultSet(List> edges, Map pageInfo) { this.edges = edges; this.pageInfo = pageInfo; } /** * @return pageInfo pagination info map, including hasNextPage (boolean) and endCursor (String) */ public Map getPageInfo() { return pageInfo; } /** * @param pageInfo pagination info map, including hasNextPage (boolean) and endCursor (String) */ public void setPageInfo(Map pageInfo) { this.pageInfo = pageInfo; } /** * @return edges List of nodes, where each node is a map from columnName to value */ public List> getEdges() { return edges; } /** * @param edges List of nodes, where each node is a map from columnName to value */ public void setEdges(List> edges) { this.edges = edges; } @Override public String toString() { return "QueryResultSet{" + "edges=" + edges + ", pageInfo='" + pageInfo.toString() + '\'' + '}'; } }