From 5e5c3f7c3bd6ee81666689ac41f385a7efe8bd5a Mon Sep 17 00:00:00 2001 From: Oleg Zhurakousky Date: Mon, 8 Aug 2016 15:13:28 -0400 Subject: [PATCH] NIFI-2504 This closes #810. fixed template export for RPG - ensured that RPG and connections to it are treated as special case where instance ID is preserved --- .../nifi/web/api/dto/FlowSnippetDTO.java | 25 ++++++++----------- 1 file changed, 10 insertions(+), 15 deletions(-) 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 12fb475cbf..9d5cf418d6 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 @@ -239,18 +239,22 @@ public class FlowSnippetDTO { ConnectionDTO connectionDTO = (ConnectionDTO) componentDto; ConnectableDTO cdto = connectionDTO.getSource(); - id = UUID.fromString(cdto.getId()); - id = new UUID(id.getMostSignificantBits(), 0); - cdto.setId(id.toString()); + if (!cdto.getType().equals("REMOTE_INPUT_PORT") && !cdto.getType().equals("REMOTE_OUTPUT_PORT")) { + id = UUID.fromString(cdto.getId()); + id = new UUID(id.getMostSignificantBits(), 0); + cdto.setId(id.toString()); + } id = UUID.fromString(cdto.getGroupId()); id = new UUID(id.getMostSignificantBits(), 0); cdto.setGroupId(id.toString()); cdto = connectionDTO.getDestination(); - id = UUID.fromString(cdto.getId()); - id = new UUID(id.getMostSignificantBits(), 0); - cdto.setId(id.toString()); + if (!cdto.getType().equals("REMOTE_INPUT_PORT") && !cdto.getType().equals("REMOTE_OUTPUT_PORT")) { + id = UUID.fromString(cdto.getId()); + id = new UUID(id.getMostSignificantBits(), 0); + cdto.setId(id.toString()); + } id = UUID.fromString(cdto.getGroupId()); id = new UUID(id.getMostSignificantBits(), 0); @@ -286,15 +290,6 @@ public class FlowSnippetDTO { fsDTO.remoteProcessGroups = this.orderedById(fsDTO.getRemoteProcessGroups()); } else if (componentDto instanceof RemoteProcessGroupDTO) { RemoteProcessGroupContentsDTO contentsDTO = ((RemoteProcessGroupDTO) componentDto).getContents(); - for (RemoteProcessGroupPortDTO portDTO : contentsDTO.getInputPorts()) { - id = UUID.fromString(portDTO.getId()); - id = new UUID(id.getMostSignificantBits(), 0); - portDTO.setId(new UUID(id.getMostSignificantBits(), 0).toString()); - } - for (RemoteProcessGroupPortDTO portDTO : contentsDTO.getOutputPorts()) { - id = UUID.fromString(portDTO.getId()); - portDTO.setId(new UUID(id.getMostSignificantBits(), 0).toString()); - } contentsDTO.setInputPorts(this.orderedRemotePortsById(contentsDTO.getInputPorts())); contentsDTO.setOutputPorts(this.orderedRemotePortsById(contentsDTO.getOutputPorts())); }