Java Code Examples for org.apache.nifi.groups.ProcessGroup#findInputPort()
The following examples show how to use
org.apache.nifi.groups.ProcessGroup#findInputPort() .
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 |
/** * Gets the status for the specified input port. * * @param portId input port id * @return the status for the specified input port */ public PortStatus getInputPortStatus(final String portId) { final ProcessGroup root = flowController.getGroup(flowController.getRootGroupId()); final Port port = root.findInputPort(portId); // ensure the input port was found if (port == null) { throw new ResourceNotFoundException(String.format("Unable to locate input port with id '%s'.", portId)); } final String groupId = port.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 PortStatus status = processGroupStatus.getInputPortStatus().stream().filter(portStatus -> portId.equals(portStatus.getId())).findFirst().orElse(null); if (status == null) { throw new ResourceNotFoundException(String.format("Unable to locate input port with id '%s'.", portId)); } return status; }
Example 2
Source File: ControllerFacade.java From nifi with Apache License 2.0 | 6 votes |
/** * Gets the status for the specified input port. * * @param portId input port id * @return the status for the specified input port */ public PortStatus getInputPortStatus(final String portId) { final ProcessGroup root = getRootGroup(); final Port port = root.findInputPort(portId); // ensure the input port was found if (port == null) { throw new ResourceNotFoundException(String.format("Unable to locate input port with id '%s'.", portId)); } final String groupId = port.getProcessGroup().getIdentifier(); final ProcessGroupStatus processGroupStatus = flowController.getEventAccess().getGroupStatus(groupId, NiFiUserUtils.getNiFiUser(), 1); if (processGroupStatus == null) { throw new ResourceNotFoundException(String.format("Unable to locate group with id '%s'.", groupId)); } final PortStatus status = processGroupStatus.getInputPortStatus().stream().filter(portStatus -> portId.equals(portStatus.getId())).findFirst().orElse(null); if (status == null) { throw new ResourceNotFoundException(String.format("Unable to locate input port with id '%s'.", portId)); } return status; }
Example 3
Source File: StandardInputPortDAO.java From localization_nifi with Apache License 2.0 | 5 votes |
private Port locatePort(final String portId) { final ProcessGroup rootGroup = flowController.getGroup(flowController.getRootGroupId()); final Port port = rootGroup.findInputPort(portId); if (port == null) { throw new ResourceNotFoundException(String.format("Unable to find port with id '%s'.", portId)); } else { return port; } }
Example 4
Source File: FlowController.java From localization_nifi with Apache License 2.0 | 5 votes |
/** * Verifies that no output port exists with the given id or name. If this * does not hold true, throws an IllegalStateException * * @param id port identifier * @throws IllegalStateException port already exists */ private void verifyPortIdDoesNotExist(final String id) { final ProcessGroup rootGroup = getRootGroup(); Port port = rootGroup.findOutputPort(id); if (port != null) { throw new IllegalStateException("An Input Port already exists with ID " + id); } port = rootGroup.findInputPort(id); if (port != null) { throw new IllegalStateException("An Input Port already exists with ID " + id); } }
Example 5
Source File: StandardInputPortDAO.java From nifi with Apache License 2.0 | 5 votes |
protected Port locatePort(final String portId) { final ProcessGroup rootGroup = flowController.getFlowManager().getRootGroup(); Port port = rootGroup.findInputPort(portId); if (port == null) { port = rootGroup.findOutputPort(portId); } if (port == null) { throw new ResourceNotFoundException(String.format("Unable to find port with id '%s'.", portId)); } else { return port; } }
Example 6
Source File: StandardFlowManager.java From nifi with Apache License 2.0 | 5 votes |
private void verifyPortIdDoesNotExist(final String id) { final ProcessGroup rootGroup = getRootGroup(); Port port = rootGroup.findOutputPort(id); if (port != null) { throw new IllegalStateException("An Input Port already exists with ID " + id); } port = rootGroup.findInputPort(id); if (port != null) { throw new IllegalStateException("An Input Port already exists with ID " + id); } }
Example 7
Source File: StandardInputPortDAO.java From localization_nifi with Apache License 2.0 | 4 votes |
@Override public boolean hasPort(String portId) { final ProcessGroup rootGroup = flowController.getGroup(flowController.getRootGroupId()); return rootGroup.findInputPort(portId) != null; }
Example 8
Source File: StandardInputPortDAO.java From nifi with Apache License 2.0 | 4 votes |
@Override public boolean hasPort(String portId) { final ProcessGroup rootGroup = flowController.getFlowManager().getRootGroup(); return rootGroup.findInputPort(portId) != null || rootGroup.findOutputPort(portId) != null; }