Repository: nifi Updated Branches: refs/heads/master 83701632f -> d93d53817
NIFI-4763: Ignore differences in components' Bundle Version when comparing a local flow to a flow in the registry This closes #2393. Signed-off-by: Bryan Bende <[email protected]> Project: http://git-wip-us.apache.org/repos/asf/nifi/repo Commit: http://git-wip-us.apache.org/repos/asf/nifi/commit/d93d5381 Tree: http://git-wip-us.apache.org/repos/asf/nifi/tree/d93d5381 Diff: http://git-wip-us.apache.org/repos/asf/nifi/diff/d93d5381 Branch: refs/heads/master Commit: d93d53817761772e623d4dd2411fc5474797ec42 Parents: 8370163 Author: Mark Payne <[email protected]> Authored: Wed Jan 10 10:01:27 2018 -0500 Committer: Bryan Bende <[email protected]> Committed: Tue Jan 16 12:48:17 2018 -0500 ---------------------------------------------------------------------- .../java/org/apache/nifi/groups/StandardProcessGroup.java | 9 ++++++++- .../java/org/apache/nifi/web/StandardNiFiServiceFacade.java | 6 ++++++ .../main/java/org/apache/nifi/web/api/dto/DtoFactory.java | 6 ++++++ 3 files changed, 20 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/nifi/blob/d93d5381/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/groups/StandardProcessGroup.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/groups/StandardProcessGroup.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/groups/StandardProcessGroup.java index 4cd6e2a..baf02bc 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/groups/StandardProcessGroup.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/groups/StandardProcessGroup.java @@ -3252,6 +3252,11 @@ public final class StandardProcessGroup implements ProcessGroup { final Set<String> updatedVersionedComponentIds = new HashSet<>(); for (final FlowDifference diff : flowComparison.getDifferences()) { + // Ignore these as local differences for now because we can't do anything with it + if (diff.getDifferenceType() == DifferenceType.BUNDLE_CHANGED) { + continue; + } + // If this update adds a new Controller Service, then we need to check if the service already exists at a higher level // and if so compare our VersionedControllerService to the existing service. if (diff.getDifferenceType() == DifferenceType.COMPONENT_ADDED) { @@ -4187,7 +4192,9 @@ public final class StandardProcessGroup implements ProcessGroup { final FlowComparator flowComparator = new StandardFlowComparator(snapshotFlow, currentFlow, getAncestorGroupServiceIds(), new EvolvingDifferenceDescriptor()); final FlowComparison comparison = flowComparator.compare(); - final Set<FlowDifference> differences = comparison.getDifferences(); + final Set<FlowDifference> differences = comparison.getDifferences().stream() + .filter(difference -> difference.getDifferenceType() != DifferenceType.BUNDLE_CHANGED) + .collect(Collectors.toCollection(HashSet::new)); LOG.debug("There are {} differences between this Local Flow and the Versioned Flow: {}", differences.size(), differences); return differences; http://git-wip-us.apache.org/repos/asf/nifi/blob/d93d5381/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/StandardNiFiServiceFacade.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/StandardNiFiServiceFacade.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/StandardNiFiServiceFacade.java index 3df75bb..65f6329 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/StandardNiFiServiceFacade.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/StandardNiFiServiceFacade.java @@ -3964,6 +3964,7 @@ public class StandardNiFiServiceFacade implements NiFiServiceFacade { final Set<AffectedComponentEntity> affectedComponents = comparison.getDifferences().stream() .filter(difference -> difference.getDifferenceType() != DifferenceType.COMPONENT_ADDED) // components that are added are not components that will be affected in the local flow. + .filter(difference -> difference.getDifferenceType() != DifferenceType.BUNDLE_CHANGED) .map(difference -> { final VersionedComponent localComponent = difference.getComponentA(); @@ -3995,6 +3996,11 @@ public class StandardNiFiServiceFacade implements NiFiServiceFacade { .collect(Collectors.toCollection(HashSet::new)); for (final FlowDifference difference : comparison.getDifferences()) { + // Ignore these as local differences for now because we can't do anything with it + if (difference.getDifferenceType() == DifferenceType.BUNDLE_CHANGED) { + continue; + } + final VersionedComponent localComponent = difference.getComponentA(); if (localComponent == null) { continue; http://git-wip-us.apache.org/repos/asf/nifi/blob/d93d5381/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/dto/DtoFactory.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/dto/DtoFactory.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/dto/DtoFactory.java index 3d9f521..36da701 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/dto/DtoFactory.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/dto/DtoFactory.java @@ -118,6 +118,7 @@ import org.apache.nifi.registry.flow.VersionControlInformation; import org.apache.nifi.registry.flow.VersionedComponent; import org.apache.nifi.registry.flow.VersionedFlowState; import org.apache.nifi.registry.flow.VersionedFlowStatus; +import org.apache.nifi.registry.flow.diff.DifferenceType; import org.apache.nifi.registry.flow.diff.FlowComparison; import org.apache.nifi.registry.flow.diff.FlowDifference; import org.apache.nifi.registry.flow.mapping.InstantiatedVersionedComponent; @@ -2219,6 +2220,11 @@ public final class DtoFactory { final Map<ComponentDifferenceDTO, List<DifferenceDTO>> differencesByComponent = new HashMap<>(); for (final FlowDifference difference : comparison.getDifferences()) { + // Ignore these as local differences for now because we can't do anything with it + if (difference.getDifferenceType() == DifferenceType.BUNDLE_CHANGED) { + continue; + } + final ComponentDifferenceDTO componentDiff = createComponentDifference(difference); final List<DifferenceDTO> differences = differencesByComponent.computeIfAbsent(componentDiff, key -> new ArrayList<>());
