Skip to content

Commit 9716a15

Browse files
authored
Merge pull request #11 from openworm/development
Release 0.3.3
2 parents 5323f3a + 360f9a8 commit 9716a15

2 files changed

Lines changed: 31 additions & 4 deletions

File tree

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<groupId>org.geppetto</groupId>
66
<artifactId>datasources</artifactId>
77
<name>Geppetto Data Sources bundle</name>
8-
<version>0.3.2</version>
8+
<version>0.3.3</version>
99
<packaging>bundle</packaging>
1010
<properties>
1111
<spring.version>3.1.3.RELEASE</spring.version>

src/main/java/org/geppetto/datasources/ExecuteMultipleQueriesVisitor.java

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,7 @@ public QueryResults getResults() throws GeppettoDataSourceException
148148

149149
if(results.keySet().size() > 1)
150150
{
151+
boolean first = true;
151152
for(QueryResults result : results.keySet())
152153
{
153154
if(finalResults.getHeader().isEmpty())
@@ -165,13 +166,38 @@ public QueryResults getResults() throws GeppettoDataSourceException
165166
switch(o)
166167
{
167168
case AND:
168-
System.out.println("IDs " + ids.get(result).size());
169-
System.out.println("Results " + result.getResults().size());
169+
if(first)
170+
{
171+
for(String id : ids.get(result))
172+
{
173+
174+
finalResults.getResults().add(result.getResults().get(0)); // Note this will move the element from one list to another (EMF implementation) so although we always access
175+
// the 0th element it's always a different one
176+
finalIds.add(id);
177+
178+
}
179+
}
180+
List<String> toRemove = new ArrayList<String>();
181+
for(String id : finalIds)
182+
{
183+
if(!ids.get(result).contains(id))
184+
{
185+
toRemove.add(id);
186+
}
187+
}
188+
for(String id : toRemove)
189+
{
190+
finalResults.getResults().remove(finalIds.indexOf(id));
191+
finalIds.remove(id);
192+
}
193+
break;
194+
case OR:
170195
for(String id : ids.get(result))
171196
{
172197
if(!finalIds.contains(id))
173198
{
174-
finalResults.getResults().add(result.getResults().get(0)); //Note this will move the element from one list to another (EMF implementation) so although we always access the 0th element it's always a different one
199+
finalResults.getResults().add(result.getResults().get(0)); // Note this will move the element from one list to another (EMF implementation) so although we always access
200+
// the 0th element it's always a different one
175201
finalIds.add(id);
176202
}
177203
}
@@ -187,6 +213,7 @@ public QueryResults getResults() throws GeppettoDataSourceException
187213
}
188214
break;
189215
}
216+
first = false;
190217
}
191218
}
192219
else

0 commit comments

Comments
 (0)