19 package org.turro.web.funnel.graph;
21 import java.io.Writer;
22 import java.util.LinkedHashMap;
24 import org.jgrapht.Graphs;
25 import org.jgrapht.graph.DefaultEdge;
26 import org.jgrapht.graph.SimpleDirectedGraph;
27 import org.jgrapht.nio.Attribute;
28 import org.jgrapht.nio.DefaultAttribute;
29 import org.turro.elephant.db.ElephantPU;
30 import org.turro.elephant.entities.web.WebGoal;
31 import org.turro.elephant.entities.web.WebItem;
32 import org.turro.graph.GraphUtil;
33 import org.turro.jpa.Dao;
34 import org.turro.sql.SqlClause;
35 import org.turro.string.Strings;
36 import org.turro.util.Cached;
42 public class FunnelGraphDOT extends SimpleDirectedGraph<FunnelVertexDOT, DefaultEdge> {
46 private void addVertices() {
47 SqlClause.select(
"wi").from(
"WebItem wi")
54 SqlClause.select(
"wg").from(
"WebGoal wg")
63 private void addEdges() {
64 vertexSet().stream().sorted().forEach(vertex -> {
65 vertex.getNexts().forEach(item -> {
67 if(containsVertex(vitem)) {
68 Graphs.addEdgeWithVertices(
this, vertex, vitem);
76 public static void DOT(Writer writer) {
78 fi -> Strings.identifier(fi.getIdentifier()),
80 Map<String, Attribute> map = new LinkedHashMap<>();
81 map.put(
"color", DefaultAttribute.createAttribute(fi.getColor()));
82 map.put(
"fontcolor", DefaultAttribute.createAttribute(
"#FFFFFF"));
83 map.put(
"label", DefaultAttribute.createAttribute(fi.getCaption()));
95 super(DefaultEdge.class);
static void DOT(Writer writer)
static FunnelGraphDOT load()