in org.apache.ivyde.eclipse.resolvevisualizer/src/org/apache/ivyde/eclipse/resolvevisualizer/model/IvyNodeElementAdapter.java [40:97]
public static IvyNodeElement adapt(ResolveReport report) {
Map<ModuleRevisionId, IvyNodeElement> resolvedNodes = new HashMap<>();
IvyNodeElement root = new IvyNodeElement();
root.setModuleRevisionId(report.getModuleDescriptor().getModuleRevisionId());
resolvedNodes.put(report.getModuleDescriptor().getModuleRevisionId(), root);
List<IvyNode> dependencies = report.getDependencies();
// First pass - build the map of resolved nodes by revision id
for (IvyNode node : dependencies) {
if (node.getAllEvictingNodes() != null) {
// Nodes that are evicted as a result of conf inheritance still appear
// as dependencies, but with eviction data. They also appear as evictions.
// We map them as evictions rather than dependencies.
continue;
}
IvyNodeElement nodeElement = new IvyNodeElement();
nodeElement.setModuleRevisionId(node.getResolvedId());
resolvedNodes.put(node.getResolvedId(), nodeElement);
}
// Second pass - establish relationships between the resolved nodes
for (IvyNode node : dependencies) {
if (node.getAllEvictingNodes() != null) {
continue; // see note above
}
IvyNodeElement nodeElement = resolvedNodes.get(node.getResolvedId());
for (Caller call : node.getAllRealCallers()) {
IvyNodeElement caller = resolvedNodes.get(call.getModuleRevisionId());
if (caller != null) {
nodeElement.addCaller(caller);
nodeElement.setCallerConfigurations(caller, call.getCallerConfigurations());
}
}
}
for (IvyNode eviction : report.getEvictedNodes()) {
IvyNodeElement evictionElement = new IvyNodeElement();
evictionElement.setModuleRevisionId(eviction.getResolvedId());
evictionElement.setEvicted(true);
for (Caller call : eviction.getAllCallers()) {
IvyNodeElement caller = resolvedNodes.get(call.getModuleRevisionId());
if (caller != null) {
evictionElement.addCaller(caller);
evictionElement.setCallerConfigurations(caller, call.getCallerConfigurations());
}
}
}
// Recursively set depth starting at root
root.setDepth(0);
findConflictsBeneathNode(root);
return root;
}