Java Code Examples for org.apache.nifi.groups.ProcessGroup#findAllProcessGroups()

The following examples show how to use org.apache.nifi.groups.ProcessGroup#findAllProcessGroups() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: StandardNiFiServiceFacade.java    From localization_nifi with Apache License 2.0 5 votes vote down vote up
private List<BulletinEntity> getProcessGroupBulletins(final ProcessGroup group) {
    final List<Bulletin> bulletins = new ArrayList<>(bulletinRepository.findBulletinsForGroupBySource(group.getIdentifier()));

    for (final ProcessGroup descendantGroup : group.findAllProcessGroups()) {
        bulletins.addAll(bulletinRepository.findBulletinsForGroupBySource(descendantGroup.getIdentifier()));
    }

    List<BulletinEntity> bulletinEntities = new ArrayList<>();
    for (final Bulletin bulletin : bulletins) {
        bulletinEntities.add(entityFactory.createBulletinEntity(dtoFactory.createBulletinDto(bulletin), authorizeBulletin(bulletin)));
    }

    return pruneAndSortBulletins(bulletinEntities, BulletinRepository.MAX_BULLETINS_PER_COMPONENT);
}
 
Example 2
Source File: StandardParameterReferenceManager.java    From nifi with Apache License 2.0 5 votes vote down vote up
@Override
public Set<ProcessGroup> getProcessGroupsBound(final ParameterContext parameterContext) {
    final ProcessGroup rootGroup = flowManager.getRootGroup();
    final String contextId = parameterContext.getIdentifier();
    final List<ProcessGroup> referencingGroups = rootGroup.findAllProcessGroups(
        group -> group.getParameterContext() != null && group.getParameterContext().getIdentifier().equals(contextId));

    return new HashSet<>(referencingGroups);
}
 
Example 3
Source File: StandardFlowManager.java    From nifi with Apache License 2.0 5 votes vote down vote up
@Override
public void purge() {
    verifyCanPurge();

    final ProcessGroup rootGroup = getRootGroup();

    // Delete templates from all levels first. This allows us to avoid having to purge each individual Process Group recursively
    // and instead just delete all child Process Groups after removing the connections to/from those Process Groups.
    for (final ProcessGroup group : rootGroup.findAllProcessGroups()) {
        group.getTemplates().forEach(group::removeTemplate);
    }
    rootGroup.getTemplates().forEach(rootGroup::removeTemplate);

    rootGroup.getConnections().forEach(rootGroup::removeConnection);
    rootGroup.getProcessors().forEach(rootGroup::removeProcessor);
    rootGroup.getFunnels().forEach(rootGroup::removeFunnel);
    rootGroup.getInputPorts().forEach(rootGroup::removeInputPort);
    rootGroup.getOutputPorts().forEach(rootGroup::removeOutputPort);
    rootGroup.getLabels().forEach(rootGroup::removeLabel);
    rootGroup.getRemoteProcessGroups().forEach(rootGroup::removeRemoteProcessGroup);

    rootGroup.getProcessGroups().forEach(rootGroup::removeProcessGroup);

    final ControllerServiceProvider serviceProvider = flowController.getControllerServiceProvider();
    rootGroup.getControllerServices(false).forEach(serviceProvider::removeControllerService);

    getRootControllerServices().forEach(this::removeRootControllerService);
    getAllReportingTasks().forEach(this::removeReportingTask);

    final FlowRegistryClient registryClient = flowController.getFlowRegistryClient();
    for (final String registryId : registryClient.getRegistryIdentifiers()) {
        registryClient.removeFlowRegistry(registryId);
    }

    for (final ParameterContext parameterContext : parameterContextManager.getParameterContexts()) {
        parameterContextManager.removeParameterContext(parameterContext.getIdentifier());
    }
}
 
Example 4
Source File: SnippetUtils.java    From nifi with Apache License 2.0 5 votes vote down vote up
private static void findAllVersionControlInfo(final ProcessGroup group, final List<VersionControlInformation> found) {
    if (group == null) {
        return;
    }

    final VersionControlInformation vci = group.getVersionControlInformation();
    if (vci != null) {
        found.add(vci);
    }

    for (final ProcessGroup childGroup : group.findAllProcessGroups()) {
        findAllVersionControlInfo(childGroup, found);
    }
}
 
Example 5
Source File: StandardParameterContextDAO.java    From nifi with Apache License 2.0 4 votes vote down vote up
private List<ProcessGroup> getBoundProcessGroups(final String parameterContextId) {
    final ProcessGroup rootGroup = flowManager.getRootGroup();
    return rootGroup.findAllProcessGroups(group -> group.getParameterContext() != null && group.getParameterContext().getIdentifier().equals(parameterContextId));
}