Java Code Examples for org.apache.nifi.web.api.dto.PortDTO#getName()
The following examples show how to use
org.apache.nifi.web.api.dto.PortDTO#getName() .
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 |
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: FlowController.java From localization_nifi with Apache License 2.0 | 6 votes |
public PortDTO updateOutputPort(final String parentGroupId, final PortDTO dto) { final ProcessGroup parentGroup = lookupGroup(parentGroupId); final Port port = parentGroup.getOutputPort(dto.getId()); if (port == null) { throw new IllegalStateException("No Output Port with ID " + dto.getId() + " is known as a child of ProcessGroup with ID " + parentGroupId); } final String name = dto.getName(); if (name != null) { port.setName(name); } if (dto.getPosition() != null) { port.setPosition(toPosition(dto.getPosition())); } return createDTO(port); }
Example 3
Source File: AbstractPortDAO.java From nifi with Apache License 2.0 | 6 votes |
private List<String> validateProposedConfiguration(final Port port, final PortDTO portDTO) { List<String> validationErrors = new ArrayList<>(); if (isNotNull(portDTO.getName()) && portDTO.getName().trim().isEmpty()) { validationErrors.add("The name of the port must be specified."); } if (isNotNull(portDTO.getConcurrentlySchedulableTaskCount()) && portDTO.getConcurrentlySchedulableTaskCount() <= 0) { validationErrors.add("Concurrent tasks must be a positive integer."); } // Although StandardProcessGroup.addIn/OutputPort has the similar validation, // this validation is necessary to prevent a port becomes public with an existing port name. if (port instanceof PublicPort) { final String portName = isNotNull(portDTO.getName()) ? portDTO.getName() : port.getName(); // If there is any port with the same name, but different identifier, throw an error. if (getPublicPorts().stream() .anyMatch(p -> portName.equals(p.getName()) && !port.getIdentifier().equals(p.getIdentifier()))) { throw new IllegalStateException("Public port name must be unique throughout the flow."); } } return validationErrors; }
Example 4
Source File: StandardInputPortDAO.java From localization_nifi with Apache License 2.0 | 5 votes |
@Override public Port createPort(String groupId, PortDTO portDTO) { if (isNotNull(portDTO.getParentGroupId()) && !flowController.areGroupsSame(groupId, portDTO.getParentGroupId())) { throw new IllegalArgumentException("Cannot specify a different Parent Group ID than the Group to which the InputPort is being added."); } // ensure the name has been specified if (portDTO.getName() == null) { throw new IllegalArgumentException("Port name must be specified."); } // get the desired group ProcessGroup group = locateProcessGroup(flowController, groupId); // determine if this is the root group Port port; if (group.getParent() == null) { port = flowController.createRemoteInputPort(portDTO.getId(), portDTO.getName()); } else { port = flowController.createLocalInputPort(portDTO.getId(), portDTO.getName()); } // ensure we can perform the update before we add the processor to the flow verifyUpdate(port, portDTO); // configure if (portDTO.getPosition() != null) { port.setPosition(new Position(portDTO.getPosition().getX(), portDTO.getPosition().getY())); } port.setComments(portDTO.getComments()); // add the port group.addInputPort(port); return port; }
Example 5
Source File: StandardOutputPortDAO.java From localization_nifi with Apache License 2.0 | 5 votes |
@Override public Port createPort(String groupId, PortDTO portDTO) { if (isNotNull(portDTO.getParentGroupId()) && !flowController.areGroupsSame(groupId, portDTO.getParentGroupId())) { throw new IllegalArgumentException("Cannot specify a different Parent Group ID than the Group to which the OutputPort is being added."); } // ensure the name has been specified if (portDTO.getName() == null) { throw new IllegalArgumentException("Port name must be specified."); } // get the desired group ProcessGroup group = locateProcessGroup(flowController, groupId); // determine if this is the root group Port port; if (group.getParent() == null) { port = flowController.createRemoteOutputPort(portDTO.getId(), portDTO.getName()); } else { port = flowController.createLocalOutputPort(portDTO.getId(), portDTO.getName()); } // ensure we can perform the update before we add the processor to the flow verifyUpdate(port, portDTO); // configure if (portDTO.getPosition() != null) { port.setPosition(new Position(portDTO.getPosition().getX(), portDTO.getPosition().getY())); } port.setComments(portDTO.getComments()); // add the port group.addOutputPort(port); return port; }
Example 6
Source File: StandardInputPortDAO.java From nifi with Apache License 2.0 | 5 votes |
@Override public Port createPort(String groupId, PortDTO portDTO) { if (isNotNull(portDTO.getParentGroupId()) && !flowController.getFlowManager().areGroupsSame(groupId, portDTO.getParentGroupId())) { throw new IllegalArgumentException("Cannot specify a different Parent Group ID than the Group to which the InputPort is being added."); } // ensure the name has been specified if (portDTO.getName() == null) { throw new IllegalArgumentException("Port name must be specified."); } // get the desired group ProcessGroup group = locateProcessGroup(flowController, groupId); // determine if this is the root group Port port; if (group.getParent() == null || Boolean.TRUE.equals(portDTO.getAllowRemoteAccess())) { port = flowController.getFlowManager().createPublicInputPort(portDTO.getId(), portDTO.getName()); } else { port = flowController.getFlowManager().createLocalInputPort(portDTO.getId(), portDTO.getName()); } // Unique public port check among all groups. if (port instanceof PublicPort) { verifyPublicPortUniqueness(port.getIdentifier(), port.getName()); } // ensure we can perform the update before we add the port to the flow verifyUpdate(port, portDTO); // configure if (portDTO.getPosition() != null) { port.setPosition(new Position(portDTO.getPosition().getX(), portDTO.getPosition().getY())); } port.setComments(portDTO.getComments()); // add the port group.addInputPort(port); return port; }
Example 7
Source File: StandardOutputPortDAO.java From nifi with Apache License 2.0 | 5 votes |
@Override public Port createPort(String groupId, PortDTO portDTO) { if (isNotNull(portDTO.getParentGroupId()) && !flowController.getFlowManager().areGroupsSame(groupId, portDTO.getParentGroupId())) { throw new IllegalArgumentException("Cannot specify a different Parent Group ID than the Group to which the OutputPort is being added."); } // ensure the name has been specified if (portDTO.getName() == null) { throw new IllegalArgumentException("Port name must be specified."); } // get the desired group ProcessGroup group = locateProcessGroup(flowController, groupId); // determine if this is the root group Port port; if (group.getParent() == null || Boolean.TRUE.equals(portDTO.getAllowRemoteAccess())) { port = flowController.getFlowManager().createPublicOutputPort(portDTO.getId(), portDTO.getName()); } else { port = flowController.getFlowManager().createLocalOutputPort(portDTO.getId(), portDTO.getName()); } // Unique public port check among all groups. if (port instanceof PublicPort) { verifyPublicPortUniqueness(port.getIdentifier(), port.getName()); } // ensure we can perform the update before we add the port to the flow verifyUpdate(port, portDTO); // configure if (portDTO.getPosition() != null) { port.setPosition(new Position(portDTO.getPosition().getX(), portDTO.getPosition().getY())); } port.setComments(portDTO.getComments()); // add the port group.addOutputPort(port); return port; }
Example 8
Source File: StandardInputPortDAO.java From localization_nifi with Apache License 2.0 | 4 votes |
@Override public Port updatePort(PortDTO portDTO) { Port inputPort = locatePort(portDTO.getId()); // ensure we can do this update verifyUpdate(inputPort, portDTO); // handle state transition if (isNotNull(portDTO.getState())) { final ScheduledState purposedScheduledState = ScheduledState.valueOf(portDTO.getState()); // only attempt an action if it is changing if (!purposedScheduledState.equals(inputPort.getScheduledState())) { try { // perform the appropriate action switch (purposedScheduledState) { case RUNNING: inputPort.getProcessGroup().startInputPort(inputPort); break; case STOPPED: switch (inputPort.getScheduledState()) { case RUNNING: inputPort.getProcessGroup().stopInputPort(inputPort); break; case DISABLED: inputPort.getProcessGroup().enableInputPort(inputPort); break; } break; case DISABLED: inputPort.getProcessGroup().disableInputPort(inputPort); break; } } catch (IllegalStateException ise) { throw new NiFiCoreException(ise.getMessage(), ise); } } } if (inputPort instanceof RootGroupPort) { final RootGroupPort rootPort = (RootGroupPort) inputPort; if (isNotNull(portDTO.getGroupAccessControl())) { rootPort.setGroupAccessControl(portDTO.getGroupAccessControl()); } if (isNotNull(portDTO.getUserAccessControl())) { rootPort.setUserAccessControl(portDTO.getUserAccessControl()); } } // update the port final String name = portDTO.getName(); final String comments = portDTO.getComments(); final Integer concurrentTasks = portDTO.getConcurrentlySchedulableTaskCount(); if (isNotNull(portDTO.getPosition())) { inputPort.setPosition(new Position(portDTO.getPosition().getX(), portDTO.getPosition().getY())); } if (isNotNull(name)) { inputPort.setName(name); } if (isNotNull(comments)) { inputPort.setComments(comments); } if (isNotNull(concurrentTasks)) { inputPort.setMaxConcurrentTasks(concurrentTasks); } return inputPort; }
Example 9
Source File: StandardOutputPortDAO.java From localization_nifi with Apache License 2.0 | 4 votes |
@Override public Port updatePort(PortDTO portDTO) { Port outputPort = locatePort(portDTO.getId()); // ensure we can do this update verifyUpdate(outputPort, portDTO); // handle state transition if (portDTO.getState() != null) { final ScheduledState purposedScheduledState = ScheduledState.valueOf(portDTO.getState()); // only attempt an action if it is changing if (!purposedScheduledState.equals(outputPort.getScheduledState())) { try { // perform the appropriate action switch (purposedScheduledState) { case RUNNING: outputPort.getProcessGroup().startOutputPort(outputPort); break; case STOPPED: switch (outputPort.getScheduledState()) { case RUNNING: outputPort.getProcessGroup().stopOutputPort(outputPort); break; case DISABLED: outputPort.getProcessGroup().enableOutputPort(outputPort); break; } break; case DISABLED: outputPort.getProcessGroup().disableOutputPort(outputPort); break; } } catch (IllegalStateException ise) { throw new NiFiCoreException(ise.getMessage(), ise); } } } if (outputPort instanceof RootGroupPort) { final RootGroupPort rootPort = (RootGroupPort) outputPort; if (isNotNull(portDTO.getGroupAccessControl())) { rootPort.setGroupAccessControl(portDTO.getGroupAccessControl()); } if (isNotNull(portDTO.getUserAccessControl())) { rootPort.setUserAccessControl(portDTO.getUserAccessControl()); } } // perform the configuration final String name = portDTO.getName(); final String comments = portDTO.getComments(); final Integer concurrentTasks = portDTO.getConcurrentlySchedulableTaskCount(); if (isNotNull(portDTO.getPosition())) { outputPort.setPosition(new Position(portDTO.getPosition().getX(), portDTO.getPosition().getY())); } if (isNotNull(name)) { outputPort.setName(name); } if (isNotNull(comments)) { outputPort.setComments(comments); } if (isNotNull(concurrentTasks)) { outputPort.setMaxConcurrentTasks(concurrentTasks); } return outputPort; }
Example 10
Source File: AbstractPortDAO.java From nifi with Apache License 2.0 | 4 votes |
@Override public Port updatePort(PortDTO portDTO) { final Port port = locatePort(portDTO.getId()); final ProcessGroup processGroup = port.getProcessGroup(); // ensure we can do this update verifyUpdate(port, portDTO); // handle state transition if (isNotNull(portDTO.getState())) { final ScheduledState proposedScheduledState = ScheduledState.valueOf(portDTO.getState()); // only attempt an action if it is changing if (!proposedScheduledState.equals(port.getScheduledState())) { try { handleStateTransition(port, proposedScheduledState); } catch (IllegalStateException ise) { throw new NiFiCoreException(ise.getMessage(), ise); } } } if (port instanceof PublicPort) { final PublicPort publicPort = (PublicPort) port; if (isNotNull(portDTO.getGroupAccessControl())) { publicPort.setGroupAccessControl(portDTO.getGroupAccessControl()); } if (isNotNull(portDTO.getUserAccessControl())) { publicPort.setUserAccessControl(portDTO.getUserAccessControl()); } } // update the port final String name = portDTO.getName(); final String comments = portDTO.getComments(); final Integer concurrentTasks = portDTO.getConcurrentlySchedulableTaskCount(); if (isNotNull(portDTO.getPosition())) { port.setPosition(new Position(portDTO.getPosition().getX(), portDTO.getPosition().getY())); } if (isNotNull(name)) { port.setName(name); } if (isNotNull(comments)) { port.setComments(comments); } if (isNotNull(concurrentTasks)) { port.setMaxConcurrentTasks(concurrentTasks); } processGroup.onComponentModified(); return port; }