This is an automated email from the ASF dual-hosted git repository.
markap14 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nifi.git
The following commit(s) were added to refs/heads/master by this push:
new 9c9f9c1 NIFI-5910 Retain external service reference when already set
to an existing external service
9c9f9c1 is described below
commit 9c9f9c10a980342b57ae13f38239fd809578d822
Author: Bryan Bende <[email protected]>
AuthorDate: Tue Oct 1 17:27:39 2019 -0400
NIFI-5910 Retain external service reference when already set to an existing
external service
This closes #3783.
Signed-off-by: Mark Payne <[email protected]>
---
.../apache/nifi/groups/StandardProcessGroup.java | 32 ++++++++++++++++++----
1 file changed, 26 insertions(+), 6 deletions(-)
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 82c51ab..f52188a 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
@@ -4603,12 +4603,32 @@ public final class StandardProcessGroup implements
ProcessGroup {
String value;
if (descriptor != null &&
descriptor.getIdentifiesControllerService()) {
- // Property identifies a Controller Service. So the value
that we want to assign is not the value given.
- // The value given is instead the Versioned Component ID
of the Controller Service. We want to resolve this
- // to the instance ID of the Controller Service.
- final String serviceVersionedComponentId =
proposedProperties.get(propertyName);
- String instanceId =
getServiceInstanceId(serviceVersionedComponentId, group);
- value = instanceId == null ? serviceVersionedComponentId :
instanceId;
+
+ // Need to determine if the component's property
descriptor for this service is already set to an id
+ // of an existing service that is outside the current
processor group, and if it is we want to leave
+ // the property set to that value
+ String existingExternalServiceId = null;
+ final PropertyDescriptor componentDescriptor =
componentNode.getPropertyDescriptor(propertyName);
+ if (componentDescriptor != null) {
+ final String componentDescriptorValue =
componentNode.getEffectivePropertyValue(componentDescriptor);
+ if (componentDescriptorValue != null) {
+ final ControllerServiceNode serviceNode =
findAncestorControllerService(componentDescriptorValue, getParent());
+ if (serviceNode != null) {
+ existingExternalServiceId =
componentDescriptorValue;
+ }
+ }
+ }
+
+ // If the component's property descriptor is not already
set to an id of an existing external service,
+ // then we need to take the Versioned Component ID and
resolve this to the instance ID of the service
+ if (existingExternalServiceId == null) {
+ final String serviceVersionedComponentId =
proposedProperties.get(propertyName);
+ String instanceId =
getServiceInstanceId(serviceVersionedComponentId, group);
+ value = instanceId == null ?
serviceVersionedComponentId : instanceId;
+ } else {
+ value = existingExternalServiceId;
+ }
+
} else {
value = proposedProperties.get(propertyName);
}