use of org.opennms.features.topology.netutils.internal.Node in project opennms by OpenNMS.
the class EventsAlarmsOperation 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;
break;
}
}
}
final Node node = new Node(nodeID, null, label);
final String eventUrl;
final String alarmUrl;
if (node.getNodeID() >= 0) {
eventUrl = getEventsURL() + "?filter=node%3D" + node.getNodeID();
alarmUrl = getAlarmsURL() + "?sortby=id&acktype=unacklimit=20&filter=node%3D" + node.getNodeID();
} else {
eventUrl = getEventsURL();
alarmUrl = getAlarmsURL();
}
final URL fullEventUrl = new URL(getFullUrl(eventUrl));
final URL fullAlarmUrl = new URL(getFullUrl(alarmUrl));
operationContext.getMainWindow().addWindow(new EventsAlarmsWindow(node, fullEventUrl, fullAlarmUrl));
} catch (final Exception e) {
if (e instanceof RuntimeException) {
throw (RuntimeException) e;
} else {
throw new RuntimeException("Failed to create event/alarm window.", e);
}
}
}
use of org.opennms.features.topology.netutils.internal.Node in project opennms by OpenNMS.
the class ResourceGraphsOperation 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 = getResourceGraphNodeURL() + "[" + node.getNodeID() + "]";
} else {
url = getResourceGraphListURL();
}
final URL fullUrl = new URL(getFullUrl(url));
operationContext.getMainWindow().addWindow(new ResourceGraphsWindow(node, fullUrl));
} catch (final Exception e) {
if (e instanceof RuntimeException) {
throw (RuntimeException) e;
} else {
throw new RuntimeException("Failed to create resource graph window.", e);
}
}
}
use of org.opennms.features.topology.netutils.internal.Node 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