- protected NodeConnector source;
- protected NodeConnector destination;
- protected Map<String, String> data;
- protected Long hostId;
-
- public EdgeBean() {
- data = new HashMap<String, String>();
- }
-
- public EdgeBean(Edge link, Bandwidth bandwidth) {
- this();
- this.source = link.getHeadNodeConnector();
- this.destination = link.getTailNodeConnector();
-
- // data
- data.put("$bandwidth", bandwidth.toString());
- data.put("$color", bandwidthColor(bandwidth));
- data.put("$nodeToPort", destination.getID().toString());
- data.put("$nodeFromPort", source.getID().toString());
- data.put("$descFrom", source.getNode().toString());
- data.put("$descTo", destination.getNode().toString());
- data.put("$nodeFromPortName", source.toString());
- data.put("$nodeToPortName", destination.toString());
- }
-
- public EdgeBean(NodeConnector connector, Long hostId) {
- this();
- this.source = null;
- this.destination = connector;
- this.hostId = hostId;
-
- data.put("$bandwidth", "N/A");
- data.put("$color", bandwidthColor(new Bandwidth(0)));
- data.put("$nodeToPort", connector.getNodeConnectorIDString());
- data.put("$nodeFromPort", connector.getNodeConnectorIDString());
- data.put("$descTo", "");
- data.put("$descFrom", "");
- data.put("$nodeToPortName", "");
- data.put("$nodeFromPortName", "");
- }
-
- public Map<String, Object> out() {
- Map<String, Object> edge = new HashMap<String, Object>();
-
- edge.put("data", data);
- if (source == null) {
- edge.put("nodeFrom", String.valueOf(this.hostId));
- } else {
- edge.put("nodeFrom", source.getNode().toString());
- }
- edge.put("nodeTo", destination.getNode().toString());
-
-
- return edge;
- }
-
- private String bandwidthColor(Bandwidth bandwidth) {
- String color = null;
- long bandwidthValue = bandwidth.getValue();
-
- if (bandwidthValue == 0) {
+ protected NodeConnector source;
+ protected NodeConnector destination;
+ protected Map<String, String> data;
+ protected Long hostId;
+
+ public EdgeBean() {
+ data = new HashMap<String, String>();
+ }
+
+ public EdgeBean(Edge link, Bandwidth bandwidth) {
+ this();
+ this.source = link.getHeadNodeConnector();
+ this.destination = link.getTailNodeConnector();
+
+ // data
+ data.put("$bandwidth", bandwidth.toString());
+ data.put("$color", bandwidthColor(bandwidth));
+ data.put("$nodeToPort", destination.getID().toString());
+ data.put("$nodeFromPort", source.getID().toString());
+ data.put("$descFrom", source.getNode().toString());
+ data.put("$descTo", destination.getNode().toString());
+ data.put("$nodeFromPortName", source.toString());
+ data.put("$nodeToPortName", destination.toString());
+ }
+
+ public EdgeBean(NodeConnector connector, Long hostId) {
+ this();
+ this.source = null;
+ this.destination = connector;
+ this.hostId = hostId;
+
+ data.put("$bandwidth", "N/A");
+ data.put("$color", bandwidthColor(new Bandwidth(0)));
+ data.put("$nodeToPort", connector.getNodeConnectorIDString());
+ data.put("$nodeFromPort", connector.getNodeConnectorIDString());
+ data.put("$descTo", "");
+ data.put("$descFrom", "");
+ data.put("$nodeToPortName", "");
+ data.put("$nodeFromPortName", "");
+ }
+
+ public Map<String, Object> out() {
+ Map<String, Object> edge = new HashMap<String, Object>();
+
+ edge.put("data", data);
+ if (source == null) {
+ edge.put("nodeFrom", String.valueOf(this.hostId));
+ } else {
+ edge.put("nodeFrom", source.getNode().toString());
+ }
+ edge.put("nodeTo", destination.getNode().toString());
+
+
+ return edge;
+ }
+
+ private String bandwidthColor(Bandwidth bandwidth) {
+ String color = null;
+ long bandwidthValue = bandwidth.getValue();
+
+ if (bandwidthValue == 0) {