// Procedures to exclude in ConflictGraph
if (args.hasParam(ArgumentsParser.PARAM_CONFLICTS_EXCLUDE_PROCEDURES)) {
String param = args.getParam(ArgumentsParser.PARAM_CONFLICTS_EXCLUDE_PROCEDURES);
for (String procName : param.split(",")) {
Procedure catalog_proc = args.catalogContext.procedures.getIgnoreCase(procName);
if (catalog_proc != null) {
calculator.ignoreProcedure(catalog_proc);
} else {
LOG.warn("Invalid procedure name to exclude '" + procName + "'");
}
} // FOR
}
// Statements to exclude in ConflictGraph
if (args.hasParam(ArgumentsParser.PARAM_CONFLICTS_EXCLUDE_STATEMENTS)) {
String param = args.getParam(ArgumentsParser.PARAM_CONFLICTS_EXCLUDE_STATEMENTS);
for (String name : param.split(",")) {
String splits[] = name.split("\\.");
if (splits.length != 2) {
LOG.warn("Invalid procedure name to exclude '" + name + "': " + Arrays.toString(splits));
continue;
}
Procedure catalog_proc = args.catalogContext.procedures.getIgnoreCase(splits[0]);
if (catalog_proc == null) {
LOG.warn("Invalid procedure name to exclude '" + name + "'");
continue;
}
Statement catalog_stmt = catalog_proc.getStatements().getIgnoreCase(splits[1]);
if (catalog_stmt != null) {
calculator.ignoreStatement(catalog_stmt);
} else {
LOG.warn("Invalid statement name to exclude '" + name + "'");
}
} // FOR
}
calculator.process();
DumpGraph graph = new DumpGraph(args.catalogContext);
// If we have a Procedure to "focus" on, then we need to remove any edges
// that don't involve that Procedure
if (args.hasParam(ArgumentsParser.PARAM_CONFLICTS_FOCUS_PROCEDURE)) {
String procName = args.getParam(ArgumentsParser.PARAM_CONFLICTS_FOCUS_PROCEDURE);
Procedure catalog_proc = args.catalogContext.procedures.getIgnoreCase(procName);
if (catalog_proc != null) {
if (graph.procXref.containsKey(catalog_proc)) {
Vertex vertices[] = graph.procXref.get(catalog_proc).toArray(new Vertex[0]);
LOG.debug("Remove Edges Without: " + Arrays.toString(vertices));
GraphUtil.removeEdgesWithoutVertex(graph, vertices);
GraphUtil.removeLoopEdges(graph);
GraphUtil.removeDisconnectedVertices(graph);
}
} else {
LOG.warn("Invalid procedure name to focus '" + procName + "'");
}
}
// Export!
GraphvizExport<Vertex, Edge> gvx = new GraphvizExport<Vertex, Edge>(graph);
gvx.setEdgeLabels(true);
for (Vertex v : graph.getVertices()) {
// Generate subgraphs based on procedure
ProcedureTable procTbl = v.getCatalogItem();
Procedure proc = procTbl.pair.getFirst();
gvx.addSubgraph(proc.getName(), v);
} // FOR
String graphviz = gvx.export(args.catalog_type.name());
if (!graphviz.isEmpty()) {
String output = args.getOptParam(0);