Repository: nifi Updated Branches: refs/heads/master c10d11d37 -> df11e1d2c
NIFI-2425 fixed ControllerService referebcing in DTOs/Templates. This closes #770 Project: http://git-wip-us.apache.org/repos/asf/nifi/repo Commit: http://git-wip-us.apache.org/repos/asf/nifi/commit/df11e1d2 Tree: http://git-wip-us.apache.org/repos/asf/nifi/tree/df11e1d2 Diff: http://git-wip-us.apache.org/repos/asf/nifi/diff/df11e1d2 Branch: refs/heads/master Commit: df11e1d2c07c841561ed085810e2a712b84e02bc Parents: c10d11d Author: Oleg Zhurakousky <o...@suitcase.io> Authored: Tue Aug 2 07:03:14 2016 -0400 Committer: Matt Gilman <matt.c.gil...@gmail.com> Committed: Tue Aug 2 13:58:19 2016 -0400 ---------------------------------------------------------------------- .../apache/nifi/web/api/dto/FlowSnippetDTO.java | 34 +++++++++++++++++--- .../apache/nifi/controller/TemplateUtils.java | 1 - 2 files changed, 30 insertions(+), 5 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/nifi/blob/df11e1d2/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/FlowSnippetDTO.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/FlowSnippetDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/FlowSnippetDTO.java index f268134..12fb475 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/FlowSnippetDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/FlowSnippetDTO.java @@ -18,6 +18,8 @@ package org.apache.nifi.web.api.dto; import java.util.Comparator; import java.util.LinkedHashSet; +import java.util.Map; +import java.util.Map.Entry; import java.util.Set; import java.util.TreeSet; import java.util.UUID; @@ -207,8 +209,33 @@ public class FlowSnippetDTO { id = UUID.fromString(componentDto.getParentGroupId()); id = new UUID(id.getMostSignificantBits(), 0); componentDto.setParentGroupId(id.toString()); - - if (componentDto instanceof ConnectionDTO) { + if (componentDto instanceof ControllerServiceDTO) { + ControllerServiceDTO csDTO = (ControllerServiceDTO) componentDto; + Map<String, PropertyDescriptorDTO> map = csDTO.getDescriptors(); + Map<String, String> props = csDTO.getProperties(); + for (Entry<String, PropertyDescriptorDTO> entry : map.entrySet()) { + if (entry.getValue().getIdentifiesControllerService() != null) { + String key = entry.getKey(); + String value = props.get(key); + id = UUID.fromString(value); + id = new UUID(id.getMostSignificantBits(), 0); + props.put(key, id.toString()); + } + } + } else if (componentDto instanceof ProcessorDTO) { + ProcessorDTO processorDTO = (ProcessorDTO) componentDto; + Map<String, PropertyDescriptorDTO> map = processorDTO.getConfig().getDescriptors(); + Map<String, String> props = processorDTO.getConfig().getProperties(); + for (Entry<String, PropertyDescriptorDTO> entry : map.entrySet()) { + if (entry.getValue().getIdentifiesControllerService() != null) { + String key = entry.getKey(); + String value = props.get(key); + id = UUID.fromString(value); + id = new UUID(id.getMostSignificantBits(), 0); + props.put(key, id.toString()); + } + } + } else if (componentDto instanceof ConnectionDTO) { ConnectionDTO connectionDTO = (ConnectionDTO) componentDto; ConnectableDTO cdto = connectionDTO.getSource(); @@ -228,8 +255,7 @@ public class FlowSnippetDTO { id = UUID.fromString(cdto.getGroupId()); id = new UUID(id.getMostSignificantBits(), 0); cdto.setGroupId(id.toString()); - } - if (componentDto instanceof ProcessGroupDTO) { + } else if (componentDto instanceof ProcessGroupDTO) { FlowSnippetDTO fsDTO = ((ProcessGroupDTO) componentDto).getContents(); this.removeInstanceIdentifierIfNecessary(fsDTO.getConnections()); http://git-wip-us.apache.org/repos/asf/nifi/blob/df11e1d2/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/TemplateUtils.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/TemplateUtils.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/TemplateUtils.java index 21dba95..668872b 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/TemplateUtils.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/TemplateUtils.java @@ -188,7 +188,6 @@ public class TemplateUtils { processorConfig.setCustomUiUrl(null); processorConfig.setDefaultConcurrentTasks(null); processorConfig.setDefaultSchedulingPeriod(null); - processorConfig.setDescriptors(null); processorConfig.setAutoTerminatedRelationships(null); }