Source:
public void enrich(final List<FlowDocument> documents, final FlowSource source) { if (documents.isEmpty()) { LOG.info("Nothing to enrich."); return; } transactionOperations.execute(callback -> { documents.forEach(document -> { document.setHost(source.getSourceAddress()); document.setLocation(source.getLocation()); document.setInitiator(isInitiator(document)); getNodeInfoFromCache(source.getLocation(), source.getSourceAddress()).ifPresent(document::setNodeExporter); if (document.getDstAddr() != null) { getNodeInfoFromCache(source.getLocation(), document.getDstAddr()).ifPresent(document::setNodeDst); } if (document.getSrcAddr() != null) { getNodeInfoFromCache(source.getLocation(), document.getSrcAddr()).ifPresent(document::setNodeSrc); } if (document.getSrcAddr() != null) { document.setSrcLocality(isPrivateAddress(document.getSrcAddr()) ? Locality.PRIVATE : Locality.PUBLIC); } if (document.getDstAddr() != null) { document.setDstLocality(isPrivateAddress(document.getDstAddr()) ? Locality.PRIVATE : Locality.PUBLIC); } if (Locality.PUBLIC.equals(document.getDstLocality()) || Locality.PUBLIC.equals(document.getSrcLocality())) { document.setFlowLocality(Locality.PUBLIC); } else if (Locality.PRIVATE.equals(document.getDstLocality()) || Locality.PRIVATE.equals(document.getSrcLocality())) { document.setFlowLocality(Locality.PRIVATE); } document.setConvoKey(ConversationKeyUtils.getConvoKeyAsJsonString(document)); final ClassificationRequest classificationRequest = createClassificationRequest(document); if (classificationRequest != null) { document.setApplication(classificationEngine.classify(classificationRequest)); } }); return null; }); }

Target:
public void enrich(final List<FlowDocument> documents, final FlowSource source) { if (documents.isEmpty()) { LOG.info("Nothing to enrich."); return; } transactionOperations.execute(callback -> { documents.forEach(document -> { document.setHost(source.getSourceAddress()); document.setLocation(source.getLocation()); document.setInitiator(isInitiator(document)); getNodeInfoFromCache(source.getLocation(), source.getSourceAddress()).ifPresent(document::setNodeExporter); if (document.getDstAddr() != null) { getNodeInfoFromCache(source.getLocation(), document.getDstAddr()).ifPresent(document::setNodeDst); } if (document.getSrcAddr() != null) { getNodeInfoFromCache(source.getLocation(), document.getSrcAddr()).ifPresent(document::setNodeSrc); } if (document.getSrcAddr() != null) { document.setSrcLocality(isPrivateAddress(document.getSrcAddr()) ? Locality.PRIVATE : Locality.PUBLIC); } if (document.getDstAddr() != null) { document.setDstLocality(isPrivateAddress(document.getDstAddr()) ? Locality.PRIVATE : Locality.PUBLIC); } if (Locality.PUBLIC.equals(document.getDstLocality()) || Locality.PUBLIC.equals(document.getSrcLocality())) { document.setFlowLocality(Locality.PUBLIC); } else if (Locality.PRIVATE.equals(document.getDstLocality()) || Locality.PRIVATE.equals(document.getSrcLocality())) { document.setFlowLocality(Locality.PRIVATE); } if (document.isInitiator() != null) { document.setConvoKey(ConversationKeyUtils.getConvoKeyAsJsonString(document)); } if (document.isInitiator() != null) { document.setApplication(classificationEngine.classify(createClassificationRequest(document))); } }); return null; }); }