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
This commit is contained in:
Oleg Zhurakousky 2016-08-08 15:13:28 -04:00 committed by joewitt
parent ed14bf22e7
commit 5e5c3f7c3b
1 changed files with 10 additions and 15 deletions

View File

@ -239,18 +239,22 @@ public class FlowSnippetDTO {
ConnectionDTO connectionDTO = (ConnectionDTO) componentDto; ConnectionDTO connectionDTO = (ConnectionDTO) componentDto;
ConnectableDTO cdto = connectionDTO.getSource(); ConnectableDTO cdto = connectionDTO.getSource();
if (!cdto.getType().equals("REMOTE_INPUT_PORT") && !cdto.getType().equals("REMOTE_OUTPUT_PORT")) {
id = UUID.fromString(cdto.getId()); id = UUID.fromString(cdto.getId());
id = new UUID(id.getMostSignificantBits(), 0); id = new UUID(id.getMostSignificantBits(), 0);
cdto.setId(id.toString()); cdto.setId(id.toString());
}
id = UUID.fromString(cdto.getGroupId()); id = UUID.fromString(cdto.getGroupId());
id = new UUID(id.getMostSignificantBits(), 0); id = new UUID(id.getMostSignificantBits(), 0);
cdto.setGroupId(id.toString()); cdto.setGroupId(id.toString());
cdto = connectionDTO.getDestination(); cdto = connectionDTO.getDestination();
if (!cdto.getType().equals("REMOTE_INPUT_PORT") && !cdto.getType().equals("REMOTE_OUTPUT_PORT")) {
id = UUID.fromString(cdto.getId()); id = UUID.fromString(cdto.getId());
id = new UUID(id.getMostSignificantBits(), 0); id = new UUID(id.getMostSignificantBits(), 0);
cdto.setId(id.toString()); cdto.setId(id.toString());
}
id = UUID.fromString(cdto.getGroupId()); id = UUID.fromString(cdto.getGroupId());
id = new UUID(id.getMostSignificantBits(), 0); id = new UUID(id.getMostSignificantBits(), 0);
@ -286,15 +290,6 @@ public class FlowSnippetDTO {
fsDTO.remoteProcessGroups = this.orderedById(fsDTO.getRemoteProcessGroups()); fsDTO.remoteProcessGroups = this.orderedById(fsDTO.getRemoteProcessGroups());
} else if (componentDto instanceof RemoteProcessGroupDTO) { } else if (componentDto instanceof RemoteProcessGroupDTO) {
RemoteProcessGroupContentsDTO contentsDTO = ((RemoteProcessGroupDTO) componentDto).getContents(); 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.setInputPorts(this.orderedRemotePortsById(contentsDTO.getInputPorts()));
contentsDTO.setOutputPorts(this.orderedRemotePortsById(contentsDTO.getOutputPorts())); contentsDTO.setOutputPorts(this.orderedRemotePortsById(contentsDTO.getOutputPorts()));
} }