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

The following examples show how to use org.apache.nifi.groups.ProcessGroup#getInputPort() . 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: FlowController.java    From localization_nifi with Apache License 2.0 6 votes vote down vote up
public PortDTO updateInputPort(final String parentGroupId, final PortDTO dto) {
    final ProcessGroup parentGroup = lookupGroup(parentGroupId);
    final Port port = parentGroup.getInputPort(dto.getId());
    if (port == null) {
        throw new IllegalStateException("No Input Port with ID " + dto.getId() + " is known as a child of ProcessGroup with ID " + parentGroupId);
    }

    final String name = dto.getName();
    if (dto.getPosition() != null) {
        port.setPosition(toPosition(dto.getPosition()));
    }

    if (name != null) {
        port.setName(name);
    }

    return createDTO(port);
}
 
Example 2
Source File: RelationshipAuditor.java    From localization_nifi with Apache License 2.0 5 votes vote down vote up
/**
 * Determines the type of component the specified connectable is.
 */
private Component determineConnectableType(Connectable connectable) {
    String sourceId = connectable.getIdentifier();
    Component componentType = Component.Controller;
    if (connectable instanceof ProcessorNode) {
        componentType = Component.Processor;
    } else if (connectable instanceof RemoteGroupPort) {
        final RemoteGroupPort remoteGroupPort = (RemoteGroupPort) connectable;
        if (TransferDirection.RECEIVE.equals(remoteGroupPort.getTransferDirection())) {
            if (remoteGroupPort.getRemoteProcessGroup() == null) {
                componentType = Component.InputPort;
            } else {
                componentType = Component.OutputPort;
            }
        } else {
            if (remoteGroupPort.getRemoteProcessGroup() == null) {
                componentType = Component.OutputPort;
            } else {
                componentType = Component.InputPort;
            }
        }
    } else if (connectable instanceof Port) {
        ProcessGroup processGroup = connectable.getProcessGroup();
        if (processGroup.getInputPort(sourceId) != null) {
            componentType = Component.InputPort;
        } else if (processGroup.getOutputPort(sourceId) != null) {
            componentType = Component.OutputPort;
        }
    } else if (connectable instanceof Funnel) {
        componentType = Component.Funnel;
    }
    return componentType;
}
 
Example 3
Source File: RelationshipAuditor.java    From nifi with Apache License 2.0 5 votes vote down vote up
/**
 * Determines the type of component the specified connectable is.
 */
private Component determineConnectableType(Connectable connectable) {
    String sourceId = connectable.getIdentifier();
    Component componentType = Component.Controller;
    if (connectable instanceof ProcessorNode) {
        componentType = Component.Processor;
    } else if (connectable instanceof RemoteGroupPort) {
        final RemoteGroupPort remoteGroupPort = (RemoteGroupPort) connectable;
        if (TransferDirection.RECEIVE.equals(remoteGroupPort.getTransferDirection())) {
            if (remoteGroupPort.getRemoteProcessGroup() == null) {
                componentType = Component.InputPort;
            } else {
                componentType = Component.OutputPort;
            }
        } else {
            if (remoteGroupPort.getRemoteProcessGroup() == null) {
                componentType = Component.OutputPort;
            } else {
                componentType = Component.InputPort;
            }
        }
    } else if (connectable instanceof Port) {
        ProcessGroup processGroup = connectable.getProcessGroup();
        if (processGroup.getInputPort(sourceId) != null) {
            componentType = Component.InputPort;
        } else if (processGroup.getOutputPort(sourceId) != null) {
            componentType = Component.OutputPort;
        }
    } else if (connectable instanceof Funnel) {
        componentType = Component.Funnel;
    }
    return componentType;
}