@Override public VersionedFlowSnapshotResult doExecute(final NiFiRegistryClient client, final Properties properties) throws ParseException, IOException, NiFiRegistryException { final String flowId = getRequiredArg(properties, CommandOption.FLOW_ID); final Integer version = getIntArg(properties, CommandOption.FLOW_VERSION); // if no version was provided then export the latest, otherwise use specific version final VersionedFlowSnapshot versionedFlowSnapshot; if (version == null) { versionedFlowSnapshot = client.getFlowSnapshotClient().getLatest(flowId); } else { versionedFlowSnapshot = client.getFlowSnapshotClient().get(flowId, version); } versionedFlowSnapshot.setFlow(null); versionedFlowSnapshot.setBucket(null); versionedFlowSnapshot.getSnapshotMetadata().setBucketIdentifier(null); versionedFlowSnapshot.getSnapshotMetadata().setFlowIdentifier(null); versionedFlowSnapshot.getSnapshotMetadata().setLink(null); // currently export doesn't use the ResultWriter concept, it always writes JSON // destination will be a file if outputFile is specified, otherwise it will be the output stream of the CLI final String outputFile; if (properties.containsKey(CommandOption.OUTPUT_FILE.getLongName())) { outputFile = properties.getProperty(CommandOption.OUTPUT_FILE.getLongName()); } else { outputFile = null; } return new VersionedFlowSnapshotResult(versionedFlowSnapshot, outputFile); }