private static void populateComponentTypes(final VersionedProcessGroup group, final Set<Tuple<String, BundleCoordinate>> componentTypes) { group.getProcessors().stream() .map(versionedProc -> new Tuple<>(versionedProc.getType(), createBundleCoordinate(versionedProc.getBundle()))) .forEach(componentTypes::add); group.getControllerServices().stream() .map(versionedSvc -> new Tuple<>(versionedSvc.getType(), createBundleCoordinate(versionedSvc.getBundle()))) .forEach(componentTypes::add); for (final VersionedProcessGroup childGroup : group.getProcessGroups()) { populateComponentTypes(childGroup, componentTypes); } }
final Set<ConfigurableComponent> restrictedComponents = FlowRegistryUtils.getRestrictedComponents(groupContents, serviceFacade); restrictedComponents.forEach(restrictedComponent -> { final ComponentAuthorizable restrictedComponentAuthorizable = lookup.getConfigurableComponent(restrictedComponent);
public static Set<ConfigurableComponent> getRestrictedComponents(final VersionedProcessGroup group, final NiFiServiceFacade serviceFacade) { final Set<ConfigurableComponent> restrictedComponents = new HashSet<>(); final Set<Tuple<String, BundleCoordinate>> componentTypes = new HashSet<>(); populateComponentTypes(group, componentTypes); for (final Tuple<String, BundleCoordinate> tuple : componentTypes) { final ConfigurableComponent component = serviceFacade.getTempComponent(tuple.getKey(), tuple.getValue()); if (component == null) { throw new NiFiCoreException("Could not create an instance of component " + tuple.getKey() + " using bundle coordinates " + tuple.getValue()); } final boolean isRestricted = component.getClass().isAnnotationPresent(Restricted.class); if (isRestricted) { restrictedComponents.add(component); } } return restrictedComponents; }
final Set<ConfigurableComponent> restrictedComponents = FlowRegistryUtils.getRestrictedComponents(groupContents, serviceFacade); restrictedComponents.forEach(restrictedComponent -> { final ComponentAuthorizable restrictedComponentAuthorizable = lookup.getConfigurableComponent(restrictedComponent);
final Set<ConfigurableComponent> restrictedComponents = FlowRegistryUtils.getRestrictedComponents( versionedFlowSnapshot.getFlowContents(), serviceFacade); restrictedComponents.forEach(restrictedComponent -> {