SI graph: Not all nodes have stats.

So allow 'stats' to be null/missing in parsing SI graph data.
This commit is contained in:
Kris De Volder
2019-09-03 11:50:33 -07:00
parent 470db2019b
commit 60c8209eaf
4 changed files with 7 additions and 7 deletions

View File

@@ -15,9 +15,7 @@ public class SprottySiViewApplication {
@Bean @Bean
GraphDataProvider graphDataProvider() { GraphDataProvider graphDataProvider() {
// return new MockGraphData();
// return GraphDataProvider.fromClasspathResource("/sample.json"); // return GraphDataProvider.fromClasspathResource("/sample.json");
return GraphDataProvider.fromUrlOption("target"); return GraphDataProvider.fromUrlOption("target");
} }
@@ -26,8 +24,8 @@ public class SprottySiViewApplication {
SprottyLayoutConfigurator configurator = new SprottyLayoutConfigurator(); SprottyLayoutConfigurator configurator = new SprottyLayoutConfigurator();
IPropertyHolder holder = configurator.configureByType(SIDiagramGenerator.TYPE_INTEGRATION_GRAPH); IPropertyHolder holder = configurator.configureByType(SIDiagramGenerator.TYPE_INTEGRATION_GRAPH);
holder.setProperty(LayeredOptions.SPACING_COMPONENT_COMPONENT, 40.0); holder.setProperty(LayeredOptions.SPACING_COMPONENT_COMPONENT, 60.0);
holder.setProperty(LayeredOptions.SPACING_NODE_NODE_BETWEEN_LAYERS, 40.0); holder.setProperty(LayeredOptions.SPACING_NODE_NODE_BETWEEN_LAYERS, 60.0);
holder = configurator.configureByType("output-port"); holder = configurator.configureByType("output-port");
holder.setProperty(LayeredOptions.PORT_SIDE, PortSide.EAST); holder.setProperty(LayeredOptions.PORT_SIDE, PortSide.EAST);

View File

@@ -34,6 +34,7 @@ public class SpringIntegrationGraphJson extends PrettyJson {
} }
public static SpringIntegrationGraphJson readFrom(URL resource) throws IOException { public static SpringIntegrationGraphJson readFrom(URL resource) throws IOException {
String jsonString = IOUtils.toString(resource); String jsonString = IOUtils.toString(resource);
System.out.println(jsonString);
return new Gson().fromJson(jsonString, SpringIntegrationGraphJson.class); return new Gson().fromJson(jsonString, SpringIntegrationGraphJson.class);
} }
} }

View File

@@ -1,12 +1,13 @@
package org.springframework.ide.si.view.json; package org.springframework.ide.si.view.json;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject; import com.google.gson.JsonObject;
public class SpringIntegrationNodeJson extends PrettyJson { public class SpringIntegrationNodeJson extends PrettyJson {
private int nodeId; private int nodeId;
private String name; private String name;
private JsonObject stats; private JsonElement stats;
private String componentType; private String componentType;
private JsonObject properties; private JsonObject properties;
@@ -22,7 +23,7 @@ public class SpringIntegrationNodeJson extends PrettyJson {
public void setName(String name) { public void setName(String name) {
this.name = name; this.name = name;
} }
public JsonObject getStats() { public JsonElement getStats() {
return stats; return stats;
} }
public void setStats(JsonObject stats) { public void setStats(JsonObject stats) {

View File

@@ -283,7 +283,7 @@
"links": [ "links": [
{ {
"from": 5, "from": 5,
"to": 4, "to": 8,
"type": "error" "type": "error"
}, },
{ {