private List<String> validateProposedConfiguration(PortDTO portDTO) { List<String> validationErrors = new ArrayList<>(); if (isNotNull(portDTO.getName()) && portDTO.getName().trim().isEmpty()) { validationErrors.add("Port name cannot be blank."); } if (isNotNull(portDTO.getConcurrentlySchedulableTaskCount()) && portDTO.getConcurrentlySchedulableTaskCount() <= 0) { validationErrors.add("Concurrent tasks must be a positive integer."); } return validationErrors; }
private List<String> validateProposedConfiguration(PortDTO portDTO) { List<String> validationErrors = new ArrayList<>(); if (isNotNull(portDTO.getName()) && portDTO.getName().trim().isEmpty()) { validationErrors.add("Port name cannot be blank."); } if (isNotNull(portDTO.getConcurrentlySchedulableTaskCount()) && portDTO.getConcurrentlySchedulableTaskCount() <= 0) { validationErrors.add("Concurrent tasks must be a positive integer."); } return validationErrors; }
public void validate(final ProcessGroup group) { // validate the names of Input Ports for (final PortDTO port : dto.getInputPorts()) { if (group.getInputPortByName(port.getName()) != null) { throw new IllegalStateException("One or more of the proposed Port names is not available in the process group"); } } // validate the names of Output Ports for (final PortDTO port : dto.getOutputPorts()) { if (group.getOutputPortByName(port.getName()) != null) { throw new IllegalStateException("One or more of the proposed Port names is not available in the process group"); } } verifyComponentTypesInSnippet(); SnippetUtils.verifyNoVersionControlConflicts(dto, group); }
String portName = portDTO.getName(); while (existingPortNames.contains(portName)) { portName = "Copy of " + portName; existingPortNames.add(portDTO.getName()); String portName = portDTO.getName(); while (existingPortNames.contains(portName)) { portName = "Copy of " + portName; existingPortNames.add(portDTO.getName());
/** * Converts a set of ports into a set of remote process group ports. * * @param ports to convert * @return descriptors of ports */ private Set<RemoteProcessGroupPortDescriptor> convertRemotePort(final Set<PortDTO> ports) { Set<RemoteProcessGroupPortDescriptor> remotePorts = null; if (ports != null) { remotePorts = new LinkedHashSet<>(ports.size()); for (final PortDTO port : ports) { final StandardRemoteProcessGroupPortDescriptor descriptor = new StandardRemoteProcessGroupPortDescriptor(); final ScheduledState scheduledState = ScheduledState.valueOf(port.getState()); descriptor.setId(generatePortId(port.getId())); descriptor.setTargetId(port.getId()); descriptor.setName(port.getName()); descriptor.setComments(port.getComments()); descriptor.setTargetRunning(ScheduledState.RUNNING.equals(scheduledState)); remotePorts.add(descriptor); } } return remotePorts; }
@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) { port = flowController.getFlowManager().createRemoteInputPort(portDTO.getId(), portDTO.getName()); } else { port = flowController.getFlowManager().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; }
@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) { port = flowController.getFlowManager().createRemoteOutputPort(portDTO.getId(), portDTO.getName()); } else { port = flowController.getFlowManager().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; }
public ConnectableDTO createConnectableDto(final PortDTO port, final ConnectableType type) { final ConnectableDTO connectable = new ConnectableDTO(); connectable.setGroupId(port.getParentGroupId()); connectable.setId(port.getId()); connectable.setName(port.getName()); connectable.setType(type.name()); connectable.setVersionedComponentId(port.getVersionedComponentId()); return connectable; }
final Resource resource; if (portDTO.getType() != null && portDTO.getType().equals("inputPort")) { resource = ResourceFactory.getDataTransferResource(ResourceFactory.getComponentResource(ResourceType.InputPort, portDTO.getId(), portDTO.getName())); } else { resource = ResourceFactory.getDataTransferResource(ResourceFactory.getComponentResource(ResourceType.OutputPort, portDTO.getId(), portDTO.getName()));
if (name != null && portDTO.getName() != null && !name.equals(updatedPort.getName())) {
}); snippet.getInputPorts().forEach(inputPortDTO -> { rollbackClonedPolicy(ResourceFactory.getComponentResource(ResourceType.InputPort, inputPortDTO.getId(), inputPortDTO.getName())); }); snippet.getLabels().forEach(labelDTO -> { }); snippet.getOutputPorts().forEach(outputPortDTO -> { rollbackClonedPolicy(ResourceFactory.getComponentResource(ResourceType.OutputPort, outputPortDTO.getId(), outputPortDTO.getName())); }); snippet.getProcessors().forEach(processorDTO -> {
portDTO.getGroupAccessControl(), portDTO.getConcurrentlySchedulableTaskCount(), portDTO.getName(), portDTO.getComments())) {
portDTO.getGroupAccessControl(), portDTO.getConcurrentlySchedulableTaskCount(), portDTO.getName(), portDTO.getComments())) {
ResourceFactory.getComponentResource(ResourceType.InputPort, portDTO.getId(), portDTO.getName()), ResourceFactory.getComponentResource(ResourceType.InputPort, cp.getId(), cp.getName()), idGenerationSeed); ResourceFactory.getComponentResource(ResourceType.OutputPort, portDTO.getId(), portDTO.getName()), ResourceFactory.getComponentResource(ResourceType.OutputPort, cp.getId(), cp.getName()), idGenerationSeed);
public PortDTO copy(final PortDTO original) { final PortDTO copy = new PortDTO(); copy.setPosition(original.getPosition()); copy.setId(original.getId()); copy.setName(original.getName()); copy.setComments(original.getComments()); copy.setParentGroupId(original.getParentGroupId()); copy.setState(original.getState()); copy.setType(original.getType()); copy.setTransmitting(original.isTransmitting()); copy.setConcurrentlySchedulableTaskCount(original.getConcurrentlySchedulableTaskCount()); copy.setUserAccessControl(copy(original.getUserAccessControl())); copy.setGroupAccessControl(copy(original.getGroupAccessControl())); copy.setValidationErrors(copy(original.getValidationErrors())); copy.setVersionedComponentId(original.getVersionedComponentId()); return copy; }
public AffectedComponentEntity createAffectedComponentEntity(final PortEntity portEntity, final String referenceType) { if (portEntity == null) { return null; } final AffectedComponentEntity component = new AffectedComponentEntity(); component.setBulletins(portEntity.getBulletins()); component.setId(portEntity.getId()); component.setPermissions(portEntity.getPermissions()); component.setPosition(portEntity.getPosition()); component.setRevision(portEntity.getRevision()); component.setUri(portEntity.getUri()); final PortDTO portDto = portEntity.getComponent(); final AffectedComponentDTO componentDto = new AffectedComponentDTO(); componentDto.setId(portDto.getId()); componentDto.setName(portDto.getName()); componentDto.setProcessGroupId(portDto.getParentGroupId()); componentDto.setReferenceType(referenceType); componentDto.setState(portDto.getState()); componentDto.setValidationErrors(portDto.getValidationErrors()); component.setComponent(componentDto); return component; }
final String name = portDTO.getName(); final String comments = portDTO.getComments(); final Integer concurrentTasks = portDTO.getConcurrentlySchedulableTaskCount();
final String name = portDTO.getName(); final String comments = portDTO.getComments(); final Integer concurrentTasks = portDTO.getConcurrentlySchedulableTaskCount();