builder.append(r.getType().toLowerCase());
builder.append("[");
builder.append(r.getTitle().toLowerCase());
builder.append("]");
Vertex v = createVertexFor(r, root);
g.addVertex(v);
vertexMap.put(builder.toString(), v);
resourceVertexMap.put(r, v);
}
for(CatalogResource r : catalog.getResources()) {
final Vertex source = resourceVertexMap.get(r);
for(CatalogResourceParameter p : Iterables.filter(
getParameterIterable(r), Predicates.not(regularParameterPredicate))) {
String aName = p.getName();
String style = null;
if("subscribe".equals(aName))
style = CatalogGraphStyles.STYLE_SubscribeEdge;
else if("before".equals(aName))
style = CatalogGraphStyles.STYLE_BeforeEdge;
else if("notify".equals(aName))
style = CatalogGraphStyles.STYLE_NotifyEdge;
else
style = CatalogGraphStyles.STYLE_RequireEdge;
for(String ref : p.getValue()) {
Vertex target = vertexMap.get(ref.toLowerCase());
if(target == null) {
target = createVertexForMissingResource(ref);
vertexMap.put(ref.toLowerCase(), target); // keep it if there are more references
g.addVertex(target);
}
Edge edge = new Edge(aName, style, source, target);
g.addEdge(edge);
}
}
}
for(CatalogEdge e : catalog.getEdges()) {
Vertex source = vertexMap.get(e.getSource().toLowerCase());
Vertex target = vertexMap.get(e.getTarget().toLowerCase());
Edge edge = new Edge("", STYLE_ResourceEdge, source, target);
g.addEdge(edge);
}
return g;