use of org.opennms.features.topology.netutils.internal.EventsAlarmsWindow 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);
}
}
}
Aggregations