use of org.netxms.client.topology.HopInfo in project netxms by netxms.
the class IPRouteMap method getRoute.
/**
* Get route between objects and build map page
*
* @throws Exception
*/
private void getRoute(Display display) throws Exception {
final NetworkPath path = session.getNetworkPath(rootObject.getObjectId(), targetObject.getObjectId());
// $NON-NLS-1$ //$NON-NLS-2$
final NetworkMapPage page = new NetworkMapPage(ID + "@" + rootObject.getObjectName() + "@" + targetObject.getObjectName());
long prevElementId = 0;
HopInfo prevHop = null;
for (final HopInfo h : path.getPath()) {
final long elementId = page.createElementId();
page.addElement(new NetworkMapObject(elementId, h.getNodeId()));
if (prevElementId != 0) {
NetworkMapLink link = new NetworkMapLink(prevHop.isVpn() ? NetworkMapLink.VPN : NetworkMapLink.NORMAL, prevElementId, elementId);
if (!prevHop.getName().isEmpty())
link.setName(prevHop.getName());
page.addLink(link);
}
prevElementId = elementId;
prevHop = h;
}
replaceMapPage(page, display);
}
Aggregations