Commit ba6730d6 authored by Björn Richerzhagen's avatar Björn Richerzhagen
Browse files

Include hostGroup in DAO

to enable easy filtering for postprocessing without relying on host IDs
parent 1d84fab6
...@@ -54,12 +54,12 @@ public class HostMetricDAO extends DAO { ...@@ -54,12 +54,12 @@ public class HostMetricDAO extends DAO {
if (hostId != -1) { if (hostId != -1) {
List<SimHost> allPeers = GlobalOracle.getHosts(); List<SimHost> allPeers = GlobalOracle.getHosts();
for (SimHost h : allPeers) { for (SimHost h : allPeers) {
HostMetric hostMetric = new HostMetric(metric, h.getHostId()); HostMetric hostMetric = new HostMetric(metric, h.getHostId(), h.getProperties().getGroupID());
metricMap.put(h.getHostId(), hostMetric); metricMap.put(h.getHostId(), hostMetric);
addToPersistQueue(hostMetric); addToPersistQueue(hostMetric);
} }
} else{ } else{
HostMetric hostMetric = new HostMetric(metric, hostId); HostMetric hostMetric = new HostMetric(metric, hostId, "__GLOBAL__");
metricMap.put(hostId, hostMetric); metricMap.put(hostId, hostMetric);
addToPersistQueue(hostMetric); addToPersistQueue(hostMetric);
} }
......
package de.tud.kom.p2psim.impl.util.db.metric; package de.tud.kom.p2psim.impl.util.db.metric;
import javax.persistence.Column;
import javax.persistence.Entity; import javax.persistence.Entity;
import javax.persistence.GeneratedValue; import javax.persistence.GeneratedValue;
import javax.persistence.Id; import javax.persistence.Id;
...@@ -28,6 +29,12 @@ public class HostMetric { ...@@ -28,6 +29,12 @@ public class HostMetric {
private int id; private int id;
private long hostId; private long hostId;
/**
* GroupName of the host
*/
@Column(length = 1023)
private String groupName;
@ManyToOne @ManyToOne
@JoinColumn(name = "metricId") @JoinColumn(name = "metricId")
...@@ -37,9 +44,10 @@ public class HostMetric { ...@@ -37,9 +44,10 @@ public class HostMetric {
} }
public HostMetric(Metric metric, long hostId) { public HostMetric(Metric metric, long hostId, String groupName) {
this.metric = metric; this.metric = metric;
this.hostId = hostId; this.hostId = hostId;
this.groupName = groupName;
} }
public long getHostId() { public long getHostId() {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment