use of org.opennms.features.geolocation.api.NodeInfo in project opennms by OpenNMS.
the class NodeMapComponent method createMapNode.
private static MapNode createMapNode(GeolocationInfo geolocationInfo) {
final MapNode node = new MapNode();
// Coordinates
if (geolocationInfo.getCoordinates() != null) {
node.setLatitude(geolocationInfo.getCoordinates().getLatitude());
node.setLongitude(geolocationInfo.getCoordinates().getLongitude());
}
// Node Info
final NodeInfo nodeInfo = geolocationInfo.getNodeInfo();
node.setNodeId(String.valueOf(nodeInfo.getNodeId()));
node.setNodeLabel(nodeInfo.getNodeLabel());
node.setForeignSource(nodeInfo.getForeignSource());
node.setForeignId(nodeInfo.getForeignId());
node.setIpAddress(nodeInfo.getIpAddress());
node.setDescription(nodeInfo.getDescription());
node.setMaintcontract(nodeInfo.getMaintcontract());
node.setCategories(new ArrayList<>(nodeInfo.getCategories()));
// Severity
node.setSeverityLabel(geolocationInfo.getSeverityInfo().getLabel());
node.setSeverity(String.valueOf(geolocationInfo.getSeverityInfo().getId()));
// Count
node.setUnackedCount(geolocationInfo.getAlarmUnackedCount());
return node;
}
use of org.opennms.features.geolocation.api.NodeInfo in project opennms by OpenNMS.
the class DefaultGeolocationService method convert.
private GeolocationInfo convert(OnmsNode node) {
GeolocationInfo geolocationInfo = new GeolocationInfo();
// Coordinates
OnmsGeolocation onmsGeolocation = geoLocation(node);
if (onmsGeolocation != null) {
geolocationInfo.setAddressInfo(toAddressInfo(onmsGeolocation));
if (onmsGeolocation.getLongitude() != null && onmsGeolocation.getLatitude() != null) {
geolocationInfo.setCoordinates(new Coordinates(onmsGeolocation.getLongitude(), onmsGeolocation.getLatitude()));
}
}
// NodeInfo
NodeInfo nodeInfo = new NodeInfo();
nodeInfo.setNodeId(node.getId());
nodeInfo.setNodeLabel(node.getLabel());
nodeInfo.setNodeLabel(node.getLabel());
nodeInfo.setForeignSource(node.getForeignSource());
nodeInfo.setForeignId(node.getForeignId());
nodeInfo.setLocation(node.getLocation().getLocationName());
if (node.getAssetRecord() != null) {
nodeInfo.setDescription(node.getAssetRecord().getDescription());
nodeInfo.setMaintcontract(node.getAssetRecord().getMaintcontract());
}
if (node.getPrimaryInterface() != null) {
nodeInfo.setIpAddress(InetAddressUtils.str(node.getPrimaryInterface().getIpAddress()));
}
nodeInfo.setCategories(node.getCategories().stream().map(OnmsCategory::getName).collect(Collectors.toList()));
geolocationInfo.setNodeInfo(nodeInfo);
return geolocationInfo;
}
Aggregations