Search in sources :

Example 16 with FlowRegistry

use of org.apache.nifi.registry.flow.FlowRegistry in project nifi by apache.

the class FlowRegistryDAO method getFlowsForUser.

@Override
public Set<VersionedFlow> getFlowsForUser(String registryId, String bucketId, 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<VersionedFlow> flows = flowRegistry.getFlows(bucketId, user);
        final Set<VersionedFlow> sortedFlows = new TreeSet<>((f1, f2) -> f1.getName().compareTo(f2.getName()));
        sortedFlows.addAll(flows);
        return sortedFlows;
    } catch (final IOException | NiFiRegistryException ioe) {
        throw new NiFiCoreException("Unable to obtain listing of flows for bucket with ID " + bucketId + ": " + ioe, ioe);
    }
}
Also used : NiFiCoreException(org.apache.nifi.web.NiFiCoreException) TreeSet(java.util.TreeSet) FlowRegistry(org.apache.nifi.registry.flow.FlowRegistry) VersionedFlow(org.apache.nifi.registry.flow.VersionedFlow) IOException(java.io.IOException) NiFiRegistryException(org.apache.nifi.registry.client.NiFiRegistryException)

Aggregations

FlowRegistry (org.apache.nifi.registry.flow.FlowRegistry)16 IOException (java.io.IOException)8 NiFiRegistryException (org.apache.nifi.registry.client.NiFiRegistryException)7 StandardVersionControlInformation (org.apache.nifi.registry.flow.StandardVersionControlInformation)5 VersionedProcessGroup (org.apache.nifi.registry.flow.VersionedProcessGroup)5 VersionControlInformation (org.apache.nifi.registry.flow.VersionControlInformation)4 ArrayList (java.util.ArrayList)3 HashMap (java.util.HashMap)3 HashSet (java.util.HashSet)3 TreeSet (java.util.TreeSet)3 BundleCoordinate (org.apache.nifi.bundle.BundleCoordinate)3 Port (org.apache.nifi.connectable.Port)3 ProcessGroup (org.apache.nifi.groups.ProcessGroup)3 RemoteProcessGroup (org.apache.nifi.groups.RemoteProcessGroup)3 VersionedFlowSnapshot (org.apache.nifi.registry.flow.VersionedFlowSnapshot)3 NiFiRegistryFlowMapper (org.apache.nifi.registry.flow.mapping.NiFiRegistryFlowMapper)3 RemoteGroupPort (org.apache.nifi.remote.RemoteGroupPort)3 LinkedHashSet (java.util.LinkedHashSet)2 NiFiUser (org.apache.nifi.authorization.user.NiFiUser)2 Connectable (org.apache.nifi.connectable.Connectable)2