GraphResultV2Bean result = new GraphResultV2Bean();
List<VertexV2Bean> vertices = new ArrayList<VertexV2Bean>();
for (VertexBean vertex : list) {
VertexV2Bean bean = new VertexV2Bean();
bean.setId(vertex.getId());
bean.setLocation(vertex.getLocation());
Map<String, String> tags = getTags(vertex.getTags());
bean.setTags(tags);
vertices.add(bean);
}
if (!vertices.isEmpty())
result.setVertices(vertices);
List<EdgeV2Bean> edges = new ArrayList<EdgeV2Bean>();
for (VertexBean vertex : list) {
List<EdgeNarrativeBean> out = vertex.getOutgoing();
if (out != null) {
for (EdgeNarrativeBean narrative : out) {
EdgeV2Bean bean = new EdgeV2Bean();
bean.setFromId(narrative.getFrom().getId());
bean.setToId(narrative.getTo().getId());
bean.setName(narrative.getName());
bean.setPath(narrative.getPath());
Map<String, String> tags = getTags(narrative.getTags());
bean.setTags(tags);
edges.add(bean);
}
}
}