@Override public Set<VersionedFlowSnapshotMetadata> getFlowVersionsForUser(String registryId, String bucketId, String flowId, NiFiUser user) { try { final FlowRegistry flowRegistry = flowRegistryClient.getFlowRegistry(registryId); if (flowRegistry == null) { throw new IllegalArgumentException("The specified registry id is unknown to this NiFi."); } final Set<VersionedFlowSnapshotMetadata> flowVersions = flowRegistry.getFlowVersions(bucketId, flowId, user); final Set<VersionedFlowSnapshotMetadata> sortedFlowVersions = new TreeSet<>((f1, f2) -> Integer.compare(f1.getVersion(), f2.getVersion())); sortedFlowVersions.addAll(flowVersions); return sortedFlowVersions; } catch (final IOException | NiFiRegistryException ioe) { throw new NiFiCoreException("Unable to obtain listing of versions for bucket with ID " + bucketId + " and flow with ID " + flowId + ": " + ioe, ioe); } }