List/* <IvyNode> */dependencies = report.getDependencies();
// First pass - build the map of resolved nodes by revision id
for (Iterator iter = dependencies.iterator(); iter.hasNext();) {
IvyNode node = (IvyNode) iter.next();
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 (Iterator iter = dependencies.iterator(); iter.hasNext();) {
IvyNode node = (IvyNode) iter.next();
if (node.getAllEvictingNodes() != null) {
continue; // see note above
}
IvyNodeElement nodeElement = (IvyNodeElement) resolvedNodes.get(node.getResolvedId());
Caller[] callers = node.getAllRealCallers();
for (int i = 0; i < callers.length; i++) {
IvyNodeElement caller = (IvyNodeElement) resolvedNodes.get(callers[i].getModuleRevisionId());
if (caller != null) {
nodeElement.addCaller(caller);
nodeElement.setCallerConfigurations(caller, callers[i].getCallerConfigurations());
}
}
}
IvyNode[] evictions = report.getEvictedNodes();
for (int i = 0; i < evictions.length; i++) {
IvyNode eviction = evictions[i];
IvyNodeElement evictionElement = new IvyNodeElement();
evictionElement.setModuleRevisionId(eviction.getResolvedId());
evictionElement.setEvicted(true);
Caller[] callers = eviction.getAllCallers();
for (int j = 0; j < callers.length; j++) {
IvyNodeElement caller = (IvyNodeElement) resolvedNodes.get(callers[j].getModuleRevisionId());
if (caller != null) {
evictionElement.addCaller(caller);
evictionElement.setCallerConfigurations(caller, callers[j].getCallerConfigurations());