use of org.commonjava.indy.folo.model.TrackingKey in project indy by Commonjava.
the class EventAuditListener method transformFileGroupingEvent.
private void transformFileGroupingEvent(PromoteCompleteEvent event, FileGroupingEvent fileGroupingEvent) {
PathsPromoteCompleteEvent pathsPromoteCompleteEvent = (PathsPromoteCompleteEvent) event;
PathsPromoteResult promoteResult = pathsPromoteCompleteEvent.getPromoteResult();
String error = promoteResult.getError();
if (error != null) {
logger.trace("Error in promoteResult, skip audit.");
return;
}
Set<String> paths = promoteResult.getCompletedPaths();
if (paths.isEmpty()) {
logger.trace("No completedPaths, skip audit.");
return;
}
PathsPromoteRequest req = promoteResult.getRequest();
StoreKey source = req.getSource();
StoreKey target = req.getTarget();
// TODO How about generating the key if it does not exist.
TrackingKey trackingKey = getTrackingKey(source);
if (trackingKey == null) {
logger.trace("No tracking key found to: {}", source);
return;
}
Map<String, String> extra = new HashMap<>();
extra.put(EventConstants.SOURCE, source.toString());
extra.put(EventConstants.TARGET, target.toString());
fileGroupingEvent.setExtra(extra);
fileGroupingEvent.setTimestamp(new Date());
fileGroupingEvent.setSessionId(trackingKey.getId());
}
Aggregations