diff --git a/src/main/java/de/hsh/inform/orientdb_project/Main.java b/src/main/java/de/hsh/inform/orientdb_project/Main.java index 405d629..782d3c2 100644 --- a/src/main/java/de/hsh/inform/orientdb_project/Main.java +++ b/src/main/java/de/hsh/inform/orientdb_project/Main.java @@ -1,7 +1,10 @@ package de.hsh.inform.orientdb_project; +import java.util.List; + import com.tinkerpop.blueprints.impls.orient.OrientGraphNoTx; +import de.hsh.inform.orientdb_project.model.TcpConnectionModel; import de.hsh.inform.orientdb_project.orientdb.OrientDbHelperService; import de.hsh.inform.orientdb_project.repository.TcpConnectionRepository; import de.hsh.inform.orientdb_project.util.ConfigPropertiesReader; @@ -18,7 +21,10 @@ public class Main { OrientGraphNoTx ogf = odhs.getOrientGraphNoTx(); TcpConnectionRepository tcr = new TcpConnectionRepository(ogf); - tcr.findByActiveWhen(901713642); + List result = tcr.findByActiveWhen(901713642); + for(TcpConnectionModel m : result) { + System.out.println(m.toString()); + } // Done odhs.close(); diff --git a/src/main/java/de/hsh/inform/orientdb_project/repository/TcpConnectionRepository.java b/src/main/java/de/hsh/inform/orientdb_project/repository/TcpConnectionRepository.java index c64a7df..beacefb 100644 --- a/src/main/java/de/hsh/inform/orientdb_project/repository/TcpConnectionRepository.java +++ b/src/main/java/de/hsh/inform/orientdb_project/repository/TcpConnectionRepository.java @@ -3,8 +3,9 @@ package de.hsh.inform.orientdb_project.repository; import java.util.ArrayList; import java.util.List; +import com.orientechnologies.orient.core.command.OCommandRequest; +import com.orientechnologies.orient.core.sql.OCommandSQL; import com.tinkerpop.blueprints.GraphQuery; -import com.tinkerpop.blueprints.Predicate; import com.tinkerpop.blueprints.Vertex; import com.tinkerpop.blueprints.impls.orient.OrientGraphNoTx; @@ -19,6 +20,7 @@ public class TcpConnectionRepository { } public List findByActiveWhen(long ts) { + /* GraphQuery gq = this.ogf.query(); gq = gq.has("@class", "TcpConnection"); @@ -36,7 +38,12 @@ public class TcpConnectionRepository { } }, ts); - return this.getListFromVertices(gq.vertices()); + return this.getListFromVertices(gq.vertices());*/ + + String sql = "SELECT FROM TcpConnection WHERE startTs <= " + ts + " AND endTs >= " + ts + ""; + @SuppressWarnings("unchecked") // We know. + Iterable vertices = (Iterable) this.ogf.command(new OCommandSQL(sql)).execute(); + return this.getListFromVertices(vertices); } public List getTotalDataVolumeBetweenHosts(String ipA, String ipB) {