Java Code Examples for org.apache.nifi.groups.ProcessGroup#findProcessor()
The following examples show how to use
org.apache.nifi.groups.ProcessGroup#findProcessor() .
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: ControllerFacade.java From localization_nifi with Apache License 2.0 | 6 votes |
/** * Returns the status history for the specified processor. * * @param processorId processor id * @return status history */ public StatusHistoryDTO getProcessorStatusHistory(final String processorId) { final ProcessGroup root = flowController.getGroup(flowController.getRootGroupId()); final ProcessorNode processor = root.findProcessor(processorId); // ensure the processor was found if (processor == null) { throw new ResourceNotFoundException(String.format("Unable to locate processor with id '%s'.", processorId)); } final StatusHistoryDTO statusHistory = flowController.getProcessorStatusHistory(processorId); // if not authorized if (!processor.isAuthorized(authorizer, RequestAction.READ, NiFiUserUtils.getNiFiUser())) { statusHistory.getComponentDetails().put(ComponentStatusRepository.COMPONENT_DETAIL_NAME, processorId); statusHistory.getComponentDetails().put(ComponentStatusRepository.COMPONENT_DETAIL_TYPE, "Processor"); } return statusHistory; }
Example 2
Source File: ControllerFacade.java From localization_nifi with Apache License 2.0 | 6 votes |
/** * Gets the status for the specified processor. * * @param processorId processor id * @return the status for the specified processor */ public ProcessorStatus getProcessorStatus(final String processorId) { final ProcessGroup root = flowController.getGroup(flowController.getRootGroupId()); final ProcessorNode processor = root.findProcessor(processorId); // ensure the processor was found if (processor == null) { throw new ResourceNotFoundException(String.format("Unable to locate processor with id '%s'.", processorId)); } // calculate the process group status final String groupId = processor.getProcessGroup().getIdentifier(); final ProcessGroupStatus processGroupStatus = flowController.getGroupStatus(groupId, NiFiUserUtils.getNiFiUser()); if (processGroupStatus == null) { throw new ResourceNotFoundException(String.format("Unable to locate group with id '%s'.", groupId)); } final ProcessorStatus status = processGroupStatus.getProcessorStatus().stream().filter(processorStatus -> processorId.equals(processorStatus.getId())).findFirst().orElse(null); if (status == null) { throw new ResourceNotFoundException(String.format("Unable to locate processor with id '%s'.", processorId)); } return status; }
Example 3
Source File: ControllerFacade.java From nifi with Apache License 2.0 | 6 votes |
/** * Returns the status history for the specified processor. * * @param processorId processor id * @return status history */ public StatusHistoryDTO getProcessorStatusHistory(final String processorId) { final ProcessGroup root = getRootGroup(); final ProcessorNode processor = root.findProcessor(processorId); // ensure the processor was found if (processor == null) { throw new ResourceNotFoundException(String.format("Unable to locate processor with id '%s'.", processorId)); } final boolean authorized = processor.isAuthorized(authorizer, RequestAction.READ, NiFiUserUtils.getNiFiUser()); final StatusHistoryDTO statusHistory = flowController.getProcessorStatusHistory(processorId, authorized); // if not authorized if (!authorized) { statusHistory.getComponentDetails().put(ComponentStatusRepository.COMPONENT_DETAIL_NAME, processorId); statusHistory.getComponentDetails().put(ComponentStatusRepository.COMPONENT_DETAIL_TYPE, "Processor"); } return statusHistory; }
Example 4
Source File: ControllerFacade.java From localization_nifi with Apache License 2.0 | 5 votes |
/** * Returns the group id that contains the specified processor. * * @param processorId processor id * @return group id */ public String findProcessGroupIdForProcessor(String processorId) { final ProcessGroup rootGroup = flowController.getGroup(flowController.getRootGroupId()); final ProcessorNode processor = rootGroup.findProcessor(processorId); if (processor == null) { return null; } else { return processor.getProcessGroup().getIdentifier(); } }
Example 5
Source File: StandardProcessorDAO.java From localization_nifi with Apache License 2.0 | 5 votes |
private ProcessorNode locateProcessor(final String processorId) { final ProcessGroup rootGroup = flowController.getGroup(flowController.getRootGroupId()); final ProcessorNode processor = rootGroup.findProcessor(processorId); if (processor == null) { throw new ResourceNotFoundException(String.format("Unable to find processor with id '%s'.", processorId)); } else { return processor; } }
Example 6
Source File: StandardSnippetDAO.java From localization_nifi with Apache License 2.0 | 5 votes |
private void lookupSensitiveProcessorProperties(final Set<ProcessorDTO> processors) { final ProcessGroup rootGroup = flowController.getGroup(flowController.getRootGroupId()); // go through each processor for (final ProcessorDTO processorDTO : processors) { final ProcessorConfigDTO processorConfig = processorDTO.getConfig(); // ensure that some property configuration have been specified if (processorConfig != null && processorConfig.getProperties() != null) { final Map<String, String> processorProperties = processorConfig.getProperties(); // find the corresponding processor final ProcessorNode processorNode = rootGroup.findProcessor(processorDTO.getId()); if (processorNode == null) { throw new IllegalArgumentException(String.format("Unable to create snippet because Processor '%s' could not be found", processorDTO.getId())); } // look for sensitive properties get the actual value for (Entry<PropertyDescriptor, String> entry : processorNode.getProperties().entrySet()) { final PropertyDescriptor descriptor = entry.getKey(); if (descriptor.isSensitive()) { processorProperties.put(descriptor.getName(), entry.getValue()); } } } } }
Example 7
Source File: ControllerFacade.java From nifi with Apache License 2.0 | 5 votes |
/** * Returns the group id that contains the specified processor. * * @param processorId processor id * @return group id */ public String findProcessGroupIdForProcessor(String processorId) { final ProcessGroup rootGroup = getRootGroup(); final ProcessorNode processor = rootGroup.findProcessor(processorId); if (processor == null) { return null; } else { return processor.getProcessGroup().getIdentifier(); } }
Example 8
Source File: StandardProcessorDAO.java From nifi with Apache License 2.0 | 5 votes |
private ProcessorNode locateProcessor(final String processorId) { final ProcessGroup rootGroup = flowController.getFlowManager().getRootGroup(); final ProcessorNode processor = rootGroup.findProcessor(processorId); if (processor == null) { throw new ResourceNotFoundException(String.format("Unable to find processor with id '%s'.", processorId)); } else { return processor; } }
Example 9
Source File: StandardSnippetDAO.java From nifi with Apache License 2.0 | 5 votes |
private void lookupSensitiveProcessorProperties(final Set<ProcessorDTO> processors) { final ProcessGroup rootGroup = flowController.getFlowManager().getRootGroup(); // go through each processor for (final ProcessorDTO processorDTO : processors) { final ProcessorConfigDTO processorConfig = processorDTO.getConfig(); // ensure that some property configuration have been specified if (processorConfig != null && processorConfig.getProperties() != null) { final Map<String, String> processorProperties = processorConfig.getProperties(); // find the corresponding processor final ProcessorNode processorNode = rootGroup.findProcessor(processorDTO.getId()); if (processorNode == null) { throw new IllegalArgumentException(String.format("Unable to create snippet because Processor '%s' could not be found", processorDTO.getId())); } // look for sensitive properties get the actual value for (Entry<PropertyDescriptor, String> entry : processorNode.getRawPropertyValues().entrySet()) { final PropertyDescriptor descriptor = entry.getKey(); if (descriptor.isSensitive()) { processorProperties.put(descriptor.getName(), entry.getValue()); } } } } }
Example 10
Source File: StandardProcessorDAO.java From localization_nifi with Apache License 2.0 | 4 votes |
@Override public boolean hasProcessor(String id) { final ProcessGroup rootGroup = flowController.getGroup(flowController.getRootGroupId()); return rootGroup.findProcessor(id) != null; }
Example 11
Source File: StandardProcessorDAO.java From nifi with Apache License 2.0 | 4 votes |
@Override public boolean hasProcessor(String id) { final ProcessGroup rootGroup = flowController.getFlowManager().getRootGroup(); return rootGroup.findProcessor(id) != null; }