use of com.thinkbiganalytics.metadata.rest.model.nifi.NiFiFlowCacheSync in project kylo by Teradata.
the class NifiFlowCacheImpl method syncAndReturnUpdates.
private NiFiFlowCacheSync syncAndReturnUpdates(NiFiFlowCacheSync sync, NifiFlowCacheSnapshot latest, boolean preview) {
if (latest != null && sync.needsUpdate(latest.getSnapshotDate())) {
NifiFlowCacheSnapshot updated = new NifiFlowCacheSnapshot.Builder().withProcessorIdToFeedNameMap(sync.getProcessorIdToFeedNameMapUpdatedSinceLastSync(latest.getProcessorIdToFeedNameMap())).withProcessorIdToFeedProcessGroupId(sync.getProcessorIdToProcessGroupIdUpdatedSinceLastSync(latest.getProcessorIdToFeedProcessGroupId())).withProcessorIdToProcessorName(sync.getProcessorIdToProcessorNameUpdatedSinceLastSync(latest.getProcessorIdToProcessorName())).withConnections(sync.getConnectionIdToConnectionUpdatedSinceLastSync(latest.getConnectionIdToConnectionName(), latest.getConnectionIdToConnection())).withReusableTemplateProcessorIds(latest.getReusableTemplateProcessorIds()).build();
// reset the pointers on this sync to be the latest
if (!preview) {
sync.setSnapshot(latest);
sync.setLastSync(latest.getSnapshotDate());
}
NiFiFlowCacheSync updatedSync = new NiFiFlowCacheSync(sync.getSyncId(), updated);
updatedSync.setUpdated(true);
if (!preview) {
updatedSync.setLastSync(latest.getSnapshotDate());
}
return updatedSync;
}
return NiFiFlowCacheSync.EMPTY(sync.getSyncId());
}
Aggregations