All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.neo4j.jdbc.http.driver.Neo4jResult Maven / Gradle / Ivy

There is a newer version: 4.0.10
Show newest version
/*
 * Copyright (c) 2016 LARUS Business Automation [http://www.larus-ba.it]
 * 

* This file is part of the "LARUS Integration Framework for Neo4j". *

* The "LARUS Integration Framework for Neo4j" is licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at *

* http://www.apache.org/licenses/LICENSE-2.0 *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. *

* Created on 15/4/2016 */ package org.neo4j.jdbc.http.driver; import java.util.List; import java.util.Map; /** * A POJO that store a Neo4j query result that match the cypher endpoint. */ @SuppressWarnings({"rawtypes", "unchecked"}) public class Neo4jResult { /** * List of columns. */ private List columns; /** * List of data row. */ private List rows; /** * List fof stats */ private Map stats; /** * Constructor. * * @param map JSON Map */ public Neo4jResult(Map map) { this.columns = (List) map.get("columns"); this.rows = (List) map.get("data"); if (map.containsKey("stats")) { this.stats = (Map) map.get("stats"); } } /** * @return the column names in the result */ public List getColumns() { return columns; } /** * @return the rows in the result set */ public List getRows() { return rows; } /** * @return the statistics for the statement */ public Map getStats() { return stats; } /** * Compute updated elements number. * * @return the number of updated elements */ public int getUpdateCount() { int updated = 0; if (this.stats != null && (boolean) this.stats.get("contains_updates")) { updated += ((Long) stats.get("nodes_created")).intValue(); updated += ((Long) stats.get("nodes_deleted")).intValue(); updated += ((Long) stats.get("relationships_created")).intValue(); updated += ((Long) stats.get("relationship_deleted")).intValue(); } return updated; } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy