use of org.zaproxy.zap.eventBus.Event in project zaproxy by zaproxy.
the class ExtensionAlert method deleteAllAlerts.
public void deleteAllAlerts() {
try {
getModel().getDb().getTableAlert().deleteAllAlerts();
} catch (DatabaseException e) {
logger.error(e.getMessage(), e);
}
SiteMap siteTree = this.getModel().getSession().getSiteTree();
((SiteNode) siteTree.getRoot()).deleteAllAlerts();
for (HistoryReference href : hrefs.values()) {
href.deleteAllAlerts();
}
ZAP.getEventBus().publishSyncEvent(AlertEventPublisher.getPublisher(), new Event(AlertEventPublisher.getPublisher(), AlertEventPublisher.ALL_ALERTS_REMOVED_EVENT, null));
hrefs = new HashMap<>();
treeModel = null;
filteredTreeModel = null;
setTreeModel(getTreeModel());
}
use of org.zaproxy.zap.eventBus.Event in project zaproxy by zaproxy.
the class ExtensionAlert method publishAlertEvent.
private void publishAlertEvent(Alert alert, String event) {
HistoryReference historyReference = hrefs.get(alert.getSourceHistoryId());
if (historyReference == null) {
historyReference = Control.getSingleton().getExtensionLoader().getExtension(ExtensionHistory.class).getHistoryReference(alert.getSourceHistoryId());
}
Map<String, String> map = new HashMap<>();
map.put(AlertEventPublisher.ALERT_ID, Integer.toString(alert.getAlertId()));
map.put(AlertEventPublisher.HISTORY_REFERENCE_ID, Integer.toString(alert.getSourceHistoryId()));
ZAP.getEventBus().publishSyncEvent(AlertEventPublisher.getPublisher(), new Event(AlertEventPublisher.getPublisher(), event, new Target(historyReference.getSiteNode()), map));
}
Aggregations