use of org.netxms.client.maps.NetworkMapLink 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);
}
use of org.netxms.client.maps.NetworkMapLink in project netxms by netxms.
the class NetworkMapWidget method onObjectChange.
/**
* Called by session listener when NetXMS object was changed.
*
* @param object changed NetXMS object
*/
private void onObjectChange(final AbstractObject object) {
if (mapPage == null)
return;
NetworkMapObject element = mapPage.findObjectElement(object.getObjectId());
if (element != null)
viewer.refresh(element, true);
List<NetworkMapLink> links = mapPage.findLinksWithStatusObject(object.getObjectId());
if (links != null)
for (NetworkMapLink l : links) viewer.refresh(l);
}
use of org.netxms.client.maps.NetworkMapLink in project netxms by netxms.
the class NetworkMapWidget method addDciToRequestList.
/**
* Goes thought all links and trys to add to request list required DCIs.
*/
protected void addDciToRequestList() {
Collection<NetworkMapLink> linkList = mapPage.getLinks();
for (NetworkMapLink item : linkList) {
if (item.hasDciData()) {
for (SingleDciConfig value : item.getDciAsList()) {
if (value.type == SingleDciConfig.ITEM) {
dciValueProvider.addDci(value.getNodeId(), value.dciId, mapPage);
} else {
dciValueProvider.addDci(value.getNodeId(), value.dciId, value.column, value.instance, mapPage);
}
}
}
}
Collection<NetworkMapElement> mapElements = mapPage.getElements();
for (NetworkMapElement element : mapElements) {
if (element instanceof NetworkMapDCIContainer) {
NetworkMapDCIContainer item = (NetworkMapDCIContainer) element;
if (item.hasDciData()) {
for (SingleDciConfig value : item.getObjectDCIArray()) {
if (value.type == SingleDciConfig.ITEM) {
dciValueProvider.addDci(value.getNodeId(), value.dciId, mapPage);
} else {
dciValueProvider.addDci(value.getNodeId(), value.dciId, value.column, value.instance, mapPage);
}
}
}
}
if (element instanceof NetworkMapDCIImage) {
NetworkMapDCIImage item = (NetworkMapDCIImage) element;
DCIImageConfiguration config = item.getImageOptions();
SingleDciConfig value = config.getDci();
if (value.type == SingleDciConfig.ITEM) {
dciValueProvider.addDci(value.getNodeId(), value.dciId, mapPage);
} else {
dciValueProvider.addDci(value.getNodeId(), value.dciId, value.column, value.instance, mapPage);
}
}
}
}
use of org.netxms.client.maps.NetworkMapLink in project netxms by netxms.
the class ServiceComponents method addServiceComponents.
/**
* Add parent services for given object
*
* @param object
*/
private void addServiceComponents(AbstractObject object, long parentElementId) {
Iterator<Long> it = object.getChildren();
while (it.hasNext()) {
long objectId = it.next();
AbstractObject child = session.findObjectById(objectId);
if ((child != null) && ((child instanceof Container) || (child instanceof Cluster) || (child instanceof Node) || (child instanceof Condition))) {
long elementId = mapPage.createElementId();
mapPage.addElement(new NetworkMapObject(elementId, objectId));
mapPage.addLink(new NetworkMapLink(NetworkMapLink.NORMAL, parentElementId, elementId));
addServiceComponents(child, elementId);
}
}
}
use of org.netxms.client.maps.NetworkMapLink in project netxms by netxms.
the class VlanMap method processVlanPort.
/**
* Process single member port of VLAN. Will add connected switch on other site to the map.
*
* @param page
* @param root
* @param port
* @throws Exception
*/
private void processVlanPort(NetworkMapPage page, Node root, Port port, long rootElementId) throws Exception {
Interface iface = (Interface) session.findObjectById(port.getObjectId(), Interface.class);
if (iface != null) {
Node peerNode = (Node) session.findObjectById(iface.getPeerNodeId(), Node.class);
if ((peerNode != null) && ((peerNode.getCapabilities() & Node.NC_IS_BRIDGE) != 0)) {
try {
long nodeElementId = collectVlanInfo(page, peerNode);
if (nodeElementId != -1) {
Interface peerIf = (Interface) session.findObjectById(iface.getPeerInterfaceId(), Interface.class);
page.addLink(new NetworkMapLink(null, NetworkMapLink.NORMAL, rootElementId, nodeElementId, iface.getObjectName(), (peerIf != null) ? peerIf.getObjectName() : "???", // $NON-NLS-1$ //$NON-NLS-2$
0));
}
} catch (NXCException e) {
// Ignore NetXMS errors for remote bridges
}
}
}
}
Aggregations