From 50bb564fd0303cdd369621a4d55867e0f30e8026 Mon Sep 17 00:00:00 2001 From: johnidol Date: Tue, 3 Jan 2017 12:02:55 +0000 Subject: [PATCH 01/13] duplicated bin entry --- .gitignore | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 18044a4..afb01c6 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,5 @@ src/main/java/META-INF/MANIFEST.MF /.externalToolBuilders/ /.settings/ .classpath -bin/ geppettoTmp/ -/bin/ +/bin \ No newline at end of file From 63ebd405a724dede6452f218654f5c131ce1f046 Mon Sep 17 00:00:00 2001 From: Rob Court Date: Mon, 9 Jan 2017 19:23:50 +0000 Subject: [PATCH 02/13] adding error debug in response processing --- .../datasources/ExecuteQueryVisitor.java | 27 +++++++++++-------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/src/main/java/org/geppetto/datasources/ExecuteQueryVisitor.java b/src/main/java/org/geppetto/datasources/ExecuteQueryVisitor.java index 8c00b59..5563bda 100644 --- a/src/main/java/org/geppetto/datasources/ExecuteQueryVisitor.java +++ b/src/main/java/org/geppetto/datasources/ExecuteQueryVisitor.java @@ -242,18 +242,23 @@ public Object caseSimpleQuery(SimpleQuery query) */ private void processResponse(String response, ADataSourceService dataSourceService) throws GeppettoDataSourceException { - if(count) - { - Map responseMap = JSONUtility.getAsMap(response); - results = dataSourceService.getQueryResponseProcessor().processResponse(responseMap); - // TODO How to get the count if it is actually specified? - } - else - { - Map responseMap = JSONUtility.getAsMap(response); - results = dataSourceService.getQueryResponseProcessor().processResponse(responseMap); + try{ + if(count) + { + Map responseMap = JSONUtility.getAsMap(response); + results = dataSourceService.getQueryResponseProcessor().processResponse(responseMap); + // TODO How to get the count if it is actually specified? + } + else + { + Map responseMap = JSONUtility.getAsMap(response); + results = dataSourceService.getQueryResponseProcessor().processResponse(responseMap); + } + }catch (JsonSyntaxException e){ + System.out.println("JsonSyntaxException handling: " + responce); + System.out.println(e); + throw new GeppettoDataSourceException(e); } - } /** From 55ee94a35ff0dd9cc047a6c71affcbdf33f41291 Mon Sep 17 00:00:00 2001 From: Rob Court Date: Mon, 9 Jan 2017 19:29:16 +0000 Subject: [PATCH 03/13] missed import --- src/main/java/org/geppetto/datasources/ExecuteQueryVisitor.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/org/geppetto/datasources/ExecuteQueryVisitor.java b/src/main/java/org/geppetto/datasources/ExecuteQueryVisitor.java index 5563bda..7cf2e53 100644 --- a/src/main/java/org/geppetto/datasources/ExecuteQueryVisitor.java +++ b/src/main/java/org/geppetto/datasources/ExecuteQueryVisitor.java @@ -58,6 +58,7 @@ import org.geppetto.model.util.GeppettoModelTraversal; import org.geppetto.model.util.GeppettoVisitingException; import org.geppetto.model.variables.Variable; +import com.google.gson.JsonSyntaxException /** * @author matteocantarelli From 5441e2fee886becbdad867e354d620d8d291c007 Mon Sep 17 00:00:00 2001 From: Rob Court Date: Mon, 9 Jan 2017 19:32:44 +0000 Subject: [PATCH 04/13] typo fix --- src/main/java/org/geppetto/datasources/ExecuteQueryVisitor.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/org/geppetto/datasources/ExecuteQueryVisitor.java b/src/main/java/org/geppetto/datasources/ExecuteQueryVisitor.java index 7cf2e53..fb28894 100644 --- a/src/main/java/org/geppetto/datasources/ExecuteQueryVisitor.java +++ b/src/main/java/org/geppetto/datasources/ExecuteQueryVisitor.java @@ -58,7 +58,7 @@ import org.geppetto.model.util.GeppettoModelTraversal; import org.geppetto.model.util.GeppettoVisitingException; import org.geppetto.model.variables.Variable; -import com.google.gson.JsonSyntaxException +import com.google.gson.JsonSyntaxException; /** * @author matteocantarelli From 9751331a3ad351b2e56a4ba4cc88ccdb255c09f9 Mon Sep 17 00:00:00 2001 From: Rob Court Date: Mon, 9 Jan 2017 19:36:36 +0000 Subject: [PATCH 05/13] typo fix --- src/main/java/org/geppetto/datasources/ExecuteQueryVisitor.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/org/geppetto/datasources/ExecuteQueryVisitor.java b/src/main/java/org/geppetto/datasources/ExecuteQueryVisitor.java index fb28894..16f0e4c 100644 --- a/src/main/java/org/geppetto/datasources/ExecuteQueryVisitor.java +++ b/src/main/java/org/geppetto/datasources/ExecuteQueryVisitor.java @@ -256,7 +256,7 @@ private void processResponse(String response, ADataSourceService dataSourceServi results = dataSourceService.getQueryResponseProcessor().processResponse(responseMap); } }catch (JsonSyntaxException e){ - System.out.println("JsonSyntaxException handling: " + responce); + System.out.println("JsonSyntaxException handling: " + response); System.out.println(e); throw new GeppettoDataSourceException(e); } From 3bbd03b912ef7513f87bcd035374397b9a9e0cc8 Mon Sep 17 00:00:00 2001 From: Rob Court Date: Mon, 9 Jan 2017 21:12:10 +0000 Subject: [PATCH 06/13] reporting query request on error --- .../java/org/geppetto/datasources/ExecuteQueryVisitor.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/geppetto/datasources/ExecuteQueryVisitor.java b/src/main/java/org/geppetto/datasources/ExecuteQueryVisitor.java index 16f0e4c..ddd791f 100644 --- a/src/main/java/org/geppetto/datasources/ExecuteQueryVisitor.java +++ b/src/main/java/org/geppetto/datasources/ExecuteQueryVisitor.java @@ -227,6 +227,7 @@ public Object caseSimpleQuery(SimpleQuery query) } catch(GeppettoDataSourceException e) { + System.out.println("Query request: " + url + processedQueryString); return new GeppettoVisitingException(e); } catch(GeppettoInitializationException e) @@ -258,7 +259,7 @@ private void processResponse(String response, ADataSourceService dataSourceServi }catch (JsonSyntaxException e){ System.out.println("JsonSyntaxException handling: " + response); System.out.println(e); - throw new GeppettoDataSourceException(e); + return new GeppettoDataSourceException(e); } } From f50edd74d86833c2d054b480a76fecae1ac12165 Mon Sep 17 00:00:00 2001 From: Rob Court Date: Mon, 9 Jan 2017 21:20:28 +0000 Subject: [PATCH 07/13] moving variable --- .../java/org/geppetto/datasources/ExecuteQueryVisitor.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/geppetto/datasources/ExecuteQueryVisitor.java b/src/main/java/org/geppetto/datasources/ExecuteQueryVisitor.java index ddd791f..ae1626f 100644 --- a/src/main/java/org/geppetto/datasources/ExecuteQueryVisitor.java +++ b/src/main/java/org/geppetto/datasources/ExecuteQueryVisitor.java @@ -184,12 +184,14 @@ public Object caseSimpleQuery(SimpleQuery query) { if(!count || (count && query.isRunForCount())) { + String processedQueryString = ""; + String url = ""; try { if(QueryChecker.check(query, getVariable())) { ADataSourceService dataSourceService = getDataSourceService(query); - String url = getDataSource(query).getUrl(); + url = getDataSource(query).getUrl(); String queryString = null; if(count) { @@ -209,7 +211,7 @@ public Object caseSimpleQuery(SimpleQuery query) properties.putAll(processingOutputMap); } - String processedQueryString = VelocityUtils.processTemplate(dataSourceService.getTemplate(), properties); + processedQueryString = VelocityUtils.processTemplate(dataSourceService.getTemplate(), properties); String response = null; switch(dataSourceService.getConnectionType()) From 26ac4c756abf7ccc27e0695d844820633d6e822b Mon Sep 17 00:00:00 2001 From: Rob Court Date: Mon, 9 Jan 2017 21:26:31 +0000 Subject: [PATCH 08/13] revert change --- src/main/java/org/geppetto/datasources/ExecuteQueryVisitor.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/org/geppetto/datasources/ExecuteQueryVisitor.java b/src/main/java/org/geppetto/datasources/ExecuteQueryVisitor.java index ae1626f..45606a8 100644 --- a/src/main/java/org/geppetto/datasources/ExecuteQueryVisitor.java +++ b/src/main/java/org/geppetto/datasources/ExecuteQueryVisitor.java @@ -261,7 +261,7 @@ private void processResponse(String response, ADataSourceService dataSourceServi }catch (JsonSyntaxException e){ System.out.println("JsonSyntaxException handling: " + response); System.out.println(e); - return new GeppettoDataSourceException(e); + throw new GeppettoDataSourceException(e); } } From 7c710e54ada83f70cb9c27ec89dd1741eb08176c Mon Sep 17 00:00:00 2001 From: Rob Court Date: Mon, 9 Jan 2017 23:34:34 +0000 Subject: [PATCH 09/13] tidying message --- src/main/java/org/geppetto/datasources/ExecuteQueryVisitor.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/org/geppetto/datasources/ExecuteQueryVisitor.java b/src/main/java/org/geppetto/datasources/ExecuteQueryVisitor.java index 45606a8..8d0583d 100644 --- a/src/main/java/org/geppetto/datasources/ExecuteQueryVisitor.java +++ b/src/main/java/org/geppetto/datasources/ExecuteQueryVisitor.java @@ -229,7 +229,7 @@ public Object caseSimpleQuery(SimpleQuery query) } catch(GeppettoDataSourceException e) { - System.out.println("Query request: " + url + processedQueryString); + System.out.println("Query request: " + url + "?" + processedQueryString); return new GeppettoVisitingException(e); } catch(GeppettoInitializationException e) From 9ac6c9444352332472908a4829e0701333b04242 Mon Sep 17 00:00:00 2001 From: Robert Court Date: Wed, 11 Jan 2017 14:20:00 +0000 Subject: [PATCH 10/13] reducing unused data returned --- src/main/resources/templates/neo4j/queryTemplate.vm | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/main/resources/templates/neo4j/queryTemplate.vm b/src/main/resources/templates/neo4j/queryTemplate.vm index 692020d..d0e0e55 100644 --- a/src/main/resources/templates/neo4j/queryTemplate.vm +++ b/src/main/resources/templates/neo4j/queryTemplate.vm @@ -3,10 +3,9 @@ { "statement":"$QUERY", "resultDataContents":[ - "row", - "graph" + "row" ], - "includeStats":true + "includeStats":false } ] } \ No newline at end of file From 6614e9dbb7e33238ab15b0680de1f53834975f32 Mon Sep 17 00:00:00 2001 From: Rob Court Date: Wed, 18 Jan 2017 18:05:14 +0000 Subject: [PATCH 11/13] handling blank list --- .../neo4j/Neo4jResponseProcessor.java | 28 +++++++++++-------- 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/src/main/java/org/geppetto/datasources/neo4j/Neo4jResponseProcessor.java b/src/main/java/org/geppetto/datasources/neo4j/Neo4jResponseProcessor.java index 945f8e9..de1ac82 100644 --- a/src/main/java/org/geppetto/datasources/neo4j/Neo4jResponseProcessor.java +++ b/src/main/java/org/geppetto/datasources/neo4j/Neo4jResponseProcessor.java @@ -27,22 +27,26 @@ public class Neo4jResponseProcessor implements IQueryResponseProcessor public QueryResults processResponse(Map response) { QueryResults results = DatasourcesFactory.eINSTANCE.createQueryResults(); - List headers = (List) ((List) ((Map) ((List) response.get("results")).get(0)).get("columns")); + if (response.get("results")).size() > 0){ + List headers = (List) ((List) ((Map) ((List) response.get("results")).get(0)).get("columns")); - results.getHeader().addAll(headers); + results.getHeader().addAll(headers); - results.getResults().clear(); - List> data = (List>) ((List) ((Map) ((List) response.get("results")).get(0)).get("data")); - for(Map rowObject : data) - { - QueryResult resultRow = DatasourcesFactory.eINSTANCE.createQueryResult(); - List row = (List) rowObject.get("row"); - for(Object value : row) + results.getResults().clear(); + List> data = (List>) ((List) ((Map) ((List) response.get("results")).get(0)).get("data")); + for(Map rowObject : data) { - resultRow.getValues().add(value); + QueryResult resultRow = DatasourcesFactory.eINSTANCE.createQueryResult(); + List row = (List) rowObject.get("row"); + for(Object value : row) + { + resultRow.getValues().add(value); + } + results.getResults().add(resultRow); } - results.getResults().add(resultRow); - } + }else{ + //TODO: report reponse to log + } return results; } From 4267470617bc2703b4c6f09098702b3b54c1028c Mon Sep 17 00:00:00 2001 From: Matteo Cantarelli Date: Wed, 18 Jan 2017 18:17:27 +0000 Subject: [PATCH 12/13] Fix, adding cast --- .../datasources/neo4j/Neo4jResponseProcessor.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/main/java/org/geppetto/datasources/neo4j/Neo4jResponseProcessor.java b/src/main/java/org/geppetto/datasources/neo4j/Neo4jResponseProcessor.java index de1ac82..4286d24 100644 --- a/src/main/java/org/geppetto/datasources/neo4j/Neo4jResponseProcessor.java +++ b/src/main/java/org/geppetto/datasources/neo4j/Neo4jResponseProcessor.java @@ -27,7 +27,8 @@ public class Neo4jResponseProcessor implements IQueryResponseProcessor public QueryResults processResponse(Map response) { QueryResults results = DatasourcesFactory.eINSTANCE.createQueryResults(); - if (response.get("results")).size() > 0){ + if(((List) response.get("results")).size() > 0) + { List headers = (List) ((List) ((Map) ((List) response.get("results")).get(0)).get("columns")); results.getHeader().addAll(headers); @@ -44,9 +45,11 @@ public QueryResults processResponse(Map response) } results.getResults().add(resultRow); } - }else{ - //TODO: report reponse to log - } + } + else + { + // TODO: report reponse to log + } return results; } From 81968db46078736ce20bf88d19dcaa002809a327 Mon Sep 17 00:00:00 2001 From: Matteo Cantarelli Date: Wed, 8 Feb 2017 12:39:00 +0000 Subject: [PATCH 13/13] Release 0.3.4 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index bc52f6b..a541f98 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ org.geppetto datasources Geppetto Data Sources bundle - 0.3.3 + 0.3.4 bundle 3.1.3.RELEASE