/** * Determines the type of component the specified connectable is. */ private Component determineConnectableType(ConnectableDTO connectable) { Component component = Component.Controller; final String connectableType = connectable.getType(); if (ConnectableType.PROCESSOR.name().equals(connectableType)) { component = Component.Processor; } else if (ConnectableType.INPUT_PORT.name().equals(connectableType)) { component = Component.InputPort; } else if (ConnectableType.OUTPUT_PORT.name().equals(connectableType)) { component = Component.OutputPort; } else if (ConnectableType.FUNNEL.name().equals(connectableType)) { component = Component.Funnel; } else { component = Component.RemoteProcessGroup; } return component; }
if (proposedDestination != null && ConnectableType.REMOTE_INPUT_PORT.name().equals(proposedDestination.getType())) {
if (ConnectableType.REMOTE_OUTPUT_PORT.name().equals(sourceDto.getType())) { final ProcessGroup sourceParentGroup = locateProcessGroup(flowController, groupId); if (ConnectableType.REMOTE_INPUT_PORT.name().equals(destinationDto.getType())) { final ProcessGroup destinationParentGroup = locateProcessGroup(flowController, groupId);
if (!cdto.getType().equals("REMOTE_INPUT_PORT") && !cdto.getType().equals("REMOTE_OUTPUT_PORT")) { id = new UUID(this.generateMsb(cdto.getId()), LSB); cdto.setId(id.toString()); if (!cdto.getType().equals("REMOTE_INPUT_PORT") && !cdto.getType().equals("REMOTE_OUTPUT_PORT")) { id = new UUID(this.generateMsb(cdto.getId()), LSB); cdto.setId(id.toString());
if (requestConnection.getDestination().getType() == null) { throw new IllegalArgumentException("When specifying a destination component, the type of the destination is required."); if (requestConnection.getDestination() != null && !currentDestination.getIdentifier().equals(requestConnection.getDestination().getId())) { try { final ConnectableType destinationConnectableType = ConnectableType.valueOf(requestConnection.getDestination().getType()); } catch (final IllegalArgumentException e) { throw new IllegalArgumentException(String.format("Unrecognized destination type %s. Excepted values are [%s]", requestConnection.getDestination().getType(), StringUtils.join(ConnectableType.values(), ", ")));
if (requestConnection.getSource().getType() == null) { throw new IllegalArgumentException("The type of the source of the connection must be specified."); sourceConnectableType = ConnectableType.valueOf(requestConnection.getSource().getType()); } catch (final IllegalArgumentException e) { throw new IllegalArgumentException(String.format("Unrecognized source type %s. Expected values are [%s]", requestConnection.getSource().getType(), StringUtils.join(ConnectableType.values(), ", "))); if (requestConnection.getDestination().getType() == null) { throw new IllegalArgumentException("The type of the destination of the connection must be specified."); destinationConnectableType = ConnectableType.valueOf(requestConnection.getDestination().getType()); } catch (final IllegalArgumentException e) { throw new IllegalArgumentException(String.format("Unrecognized destination type %s. Expected values are [%s]", requestConnection.getDestination().getType(), StringUtils.join(ConnectableType.values(), ", ")));
if (ConnectableType.REMOTE_INPUT_PORT.name().equals(proposedDestination.getType())) {
if (ConnectableType.REMOTE_OUTPUT_PORT.name().equals(sourceConnectableDTO.getType())) { final ProcessGroup sourceParentGroup = locateProcessGroup(flowController, groupId); final RemoteProcessGroup remoteProcessGroup = sourceParentGroup.getRemoteProcessGroup(sourceConnectableDTO.getGroupId()); if (ConnectableType.REMOTE_INPUT_PORT.name().equals(destinationConnectableDTO.getType())) { final ProcessGroup destinationParentGroup = locateProcessGroup(flowController, groupId); final RemoteProcessGroup remoteProcessGroup = destinationParentGroup.getRemoteProcessGroup(destinationConnectableDTO.getGroupId());
public ConnectionEntity createConnectionEntity(final ConnectionDTO dto, final RevisionDTO revision, final PermissionsDTO permissions, final ConnectionStatusDTO status) { final ConnectionEntity entity = new ConnectionEntity(); entity.setRevision(revision); if (dto != null) { entity.setPermissions(permissions); entity.setStatus(status); entity.setId(dto.getId()); entity.setPosition(dto.getPosition()); entity.setBends(dto.getBends()); entity.setLabelIndex(dto.getLabelIndex()); entity.setzIndex(dto.getzIndex()); entity.setSourceId(dto.getSource().getId()); entity.setSourceGroupId(dto.getSource().getGroupId()); entity.setSourceType(dto.getSource().getType()); entity.setDestinationId(dto.getDestination().getId()); entity.setDestinationGroupId(dto.getDestination().getGroupId()); entity.setDestinationType(dto.getDestination().getType()); if (permissions != null && permissions.getCanRead()) { entity.setComponent(dto); } } return entity; }
if (ConnectableType.REMOTE_OUTPUT_PORT.name().equals(sourceDto.getType())) { final RemoteProcessGroup remoteGroup = processGroup.getRemoteProcessGroup(sourceDto.getGroupId()); source = remoteGroup.getOutputPort(sourceDto.getId()); if (ConnectableType.REMOTE_INPUT_PORT.name().equals(destinationDto.getType())) { final RemoteProcessGroup remoteGroup = processGroup.getRemoteProcessGroup(destinationDto.getGroupId()); destination = remoteGroup.getInputPort(destinationDto.getId());
if (ConnectableType.REMOTE_OUTPUT_PORT.name().equals(sourceDTO.getType())) { final RemoteProcessGroup remoteGroup = group.getRemoteProcessGroup(sourceDTO.getGroupId()); source = remoteGroup.getOutputPort(sourceDTO.getId()); if (ConnectableType.REMOTE_INPUT_PORT.name().equals(destinationDTO.getType())) { final RemoteProcessGroup remoteGroup = group.getRemoteProcessGroup(destinationDTO.getGroupId()); destination = remoteGroup.getInputPort(destinationDTO.getId());
@Override public ConnectionSchema apply(ConnectionDTO connectionDTO) { Map<String, Object> map = new HashMap<>(); map.put(ID_KEY, connectionDTO.getId()); map.put(NAME_KEY, connectionDTO.getName()); map.put(ConnectionSchema.SOURCE_ID_KEY, connectionDTO.getSource().getId()); Set<String> selectedRelationships = nullToEmpty(connectionDTO.getSelectedRelationships()); map.put(ConnectionSchema.SOURCE_RELATIONSHIP_NAMES_KEY, selectedRelationships.stream().sorted().collect(Collectors.toList())); map.put(ConnectionSchema.DESTINATION_ID_KEY, connectionDTO.getDestination().getId()); map.put(ConnectionSchema.MAX_WORK_QUEUE_SIZE_KEY, connectionDTO.getBackPressureObjectThreshold()); map.put(ConnectionSchema.MAX_WORK_QUEUE_DATA_SIZE_KEY, connectionDTO.getBackPressureDataSizeThreshold()); map.put(ConnectionSchema.FLOWFILE_EXPIRATION__KEY, connectionDTO.getFlowFileExpiration()); List<String> queuePrioritizers = nullToEmpty(connectionDTO.getPrioritizers()); if (queuePrioritizers.size() > 0) { map.put(ConnectionSchema.QUEUE_PRIORITIZER_CLASS_KEY, queuePrioritizers.get(0)); } ConnectionSchema connectionSchema = new ConnectionSchema(map); if (ConnectableType.FUNNEL.name().equals(connectionDTO.getSource().getType())) { connectionSchema.addValidationIssue("Connection " + connectionDTO.getName() + " has type " + ConnectableType.FUNNEL.name() + " which is not supported by MiNiFi"); } if (queuePrioritizers.size() > 1) { connectionSchema.addValidationIssue(ConnectionSchema.QUEUE_PRIORITIZER_CLASS_KEY, CONNECTIONS_KEY, " has more than one queue prioritizer"); } return connectionSchema; } }
@Override public ConnectionSchema apply(ConnectionDTO connectionDTO) { Map<String, Object> map = new HashMap<>(); map.put(ID_KEY, connectionDTO.getId()); map.put(NAME_KEY, connectionDTO.getName()); map.put(ConnectionSchema.SOURCE_ID_KEY, connectionDTO.getSource().getId()); Set<String> selectedRelationships = nullToEmpty(connectionDTO.getSelectedRelationships()); map.put(ConnectionSchema.SOURCE_RELATIONSHIP_NAMES_KEY, selectedRelationships.stream().sorted().collect(Collectors.toList())); map.put(ConnectionSchema.DESTINATION_ID_KEY, connectionDTO.getDestination().getId()); map.put(ConnectionSchema.MAX_WORK_QUEUE_SIZE_KEY, connectionDTO.getBackPressureObjectThreshold()); map.put(ConnectionSchema.MAX_WORK_QUEUE_DATA_SIZE_KEY, connectionDTO.getBackPressureDataSizeThreshold()); map.put(ConnectionSchema.FLOWFILE_EXPIRATION__KEY, connectionDTO.getFlowFileExpiration()); List<String> queuePrioritizers = nullToEmpty(connectionDTO.getPrioritizers()); if (queuePrioritizers.size() > 0) { map.put(ConnectionSchema.QUEUE_PRIORITIZER_CLASS_KEY, queuePrioritizers.get(0)); } ConnectionSchema connectionSchema = new ConnectionSchema(map); if (ConnectableType.FUNNEL.name().equals(connectionDTO.getSource().getType())) { connectionSchema.addValidationIssue("Connection " + connectionDTO.getName() + " has type " + ConnectableType.FUNNEL.name() + " which is not supported by MiNiFi"); } if (queuePrioritizers.size() > 1) { connectionSchema.addValidationIssue(ConnectionSchema.QUEUE_PRIORITIZER_CLASS_KEY, CONNECTIONS_KEY, " has more than one queue prioritizer"); } return connectionSchema; } }
.filter(connectable -> connectable.getType().equals(ConnectableType.REMOTE_OUTPUT_PORT.toString()) || connectable.getType().equals(ConnectableType.REMOTE_INPUT_PORT.toString())) .forEach(connectable -> connectable.setId(Optional.ofNullable(rpgIdToTargetIdMap.get(connectable.getId())).orElse(connectable.getId())));
.filter(connectable -> connectable.getType().equals(ConnectableType.REMOTE_OUTPUT_PORT.toString()) || connectable.getType().equals(ConnectableType.REMOTE_INPUT_PORT.toString())) .forEach(connectable -> connectable.setId(Optional.ofNullable(rpgIdToTargetIdMap.get(connectable.getId())).orElse(connectable.getId())));