connection.setLabelIndex(proposed.getLabelIndex()); connection.setName(proposed.getName()); connection.setRelationships(proposed.getSelectedRelationships().stream() .map(name -> new Relationship.Builder().name(name).build()) .collect(Collectors.toSet()));
private Connection addConnection(final ProcessGroup destinationGroup, final VersionedConnection proposed, final String componentIdSeed) { final Connectable source = getConnectable(destinationGroup, proposed.getSource()); if (source == null) { throw new IllegalArgumentException("Connection has a source with identifier " + proposed.getIdentifier() + " but no component could be found in the Process Group with a corresponding identifier"); } final Connectable destination = getConnectable(destinationGroup, proposed.getDestination()); if (destination == null) { throw new IllegalArgumentException("Connection has a destination with identifier " + proposed.getDestination().getId() + " but no component could be found in the Process Group with a corresponding identifier"); } final Connection connection = flowController.createConnection(generateUuid(proposed.getIdentifier(), destination.getIdentifier(), componentIdSeed), proposed.getName(), source, destination, proposed.getSelectedRelationships()); connection.setVersionedComponentId(proposed.getIdentifier()); destinationGroup.addConnection(connection); updateConnection(connection, proposed); flowManager.onConnectionAdded(connection); return connection; }
@Override public ConnectionSchema apply(final VersionedConnection versionedConnection) { Map<String, Object> map = new HashMap<>(); map.put(ID_KEY, versionedConnection.getIdentifier()); map.put(NAME_KEY, versionedConnection.getName()); map.put(ConnectionSchema.SOURCE_ID_KEY, versionedConnection.getSource().getId()); Set<String> selectedRelationships = nullToEmpty(versionedConnection.getSelectedRelationships()); map.put(ConnectionSchema.SOURCE_RELATIONSHIP_NAMES_KEY, selectedRelationships.stream().sorted().collect(Collectors.toList())); map.put(ConnectionSchema.DESTINATION_ID_KEY, versionedConnection.getDestination().getId()); map.put(ConnectionSchema.MAX_WORK_QUEUE_SIZE_KEY, versionedConnection.getBackPressureObjectThreshold()); map.put(ConnectionSchema.MAX_WORK_QUEUE_DATA_SIZE_KEY, versionedConnection.getBackPressureDataSizeThreshold()); map.put(ConnectionSchema.FLOWFILE_EXPIRATION__KEY, versionedConnection.getFlowFileExpiration()); List<String> queuePrioritizers = nullToEmpty(versionedConnection.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(versionedConnection.getSource().getType())) { connectionSchema.addValidationIssue("Connection " + versionedConnection.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(final VersionedConnection versionedConnection) { Map<String, Object> map = new HashMap<>(); map.put(ID_KEY, versionedConnection.getIdentifier()); map.put(NAME_KEY, versionedConnection.getName()); map.put(ConnectionSchema.SOURCE_ID_KEY, versionedConnection.getSource().getId()); Set<String> selectedRelationships = nullToEmpty(versionedConnection.getSelectedRelationships()); map.put(ConnectionSchema.SOURCE_RELATIONSHIP_NAMES_KEY, selectedRelationships.stream().sorted().collect(Collectors.toList())); map.put(ConnectionSchema.DESTINATION_ID_KEY, versionedConnection.getDestination().getId()); map.put(ConnectionSchema.MAX_WORK_QUEUE_SIZE_KEY, versionedConnection.getBackPressureObjectThreshold()); map.put(ConnectionSchema.MAX_WORK_QUEUE_DATA_SIZE_KEY, versionedConnection.getBackPressureDataSizeThreshold()); map.put(ConnectionSchema.FLOWFILE_EXPIRATION__KEY, versionedConnection.getFlowFileExpiration()); List<String> queuePrioritizers = nullToEmpty(versionedConnection.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(versionedConnection.getSource().getType())) { connectionSchema.addValidationIssue("Connection " + versionedConnection.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; } }
if (connection.getSelectedRelationships() != null && connection.getSelectedRelationships().size() > 0) { name.append(connection.getSelectedRelationships().iterator().next());
if (connection.getSelectedRelationships() != null && connection.getSelectedRelationships().size() > 0) { name.append(connection.getSelectedRelationships().iterator().next());