use of org.opennms.features.topology.netutils.internal.NodeInfoWindow in project opennms by OpenNMS.
the class NodeInfoOperation method execute.
@Override
public void execute(final List<VertexRef> targets, final OperationContext operationContext) {
try {
String label = "";
int nodeID = -1;
if (targets != null) {
for (final VertexRef target : targets) {
final String labelValue = getLabelValue(operationContext, target);
final Integer nodeValue = getNodeIdValue(operationContext, target);
if (nodeValue != null && nodeValue > 0) {
label = labelValue == null ? "" : labelValue;
nodeID = nodeValue.intValue();
break;
}
}
}
final Node node = new Node(nodeID, null, label);
final String url;
if (node.getNodeID() >= 0) {
url = getNodePageURL() + node.getNodeID();
} else {
url = getNodeListURL();
}
final URL fullUrl = new URL(getFullUrl(url));
operationContext.getMainWindow().addWindow(new NodeInfoWindow(node, fullUrl));
} catch (final Exception e) {
if (e instanceof RuntimeException) {
throw (RuntimeException) e;
} else {
throw new RuntimeException("Failed to create node window.", e);
}
}
}
Aggregations