/** * Gets all connections that are part of the specified template. * * @param contents snippet content * @return connection dtos */ private static Collection<ConnectionDTO> getConnections(FlowSnippetDTO contents) { final Collection<ConnectionDTO> connections = new HashSet<>(); if (contents.getConnections() != null) { connections.addAll(contents.getConnections()); } return connections; }
/** * Recursively finds all ConnectionDTO's * * @param group group * @return connection dtos */ private Set<ConnectionDTO> findAllConnections(final ProcessGroupDTO group) { final Set<ConnectionDTO> conns = new HashSet<>(); conns.addAll(group.getContents().getConnections()); for (final ProcessGroupDTO childGroup : group.getContents().getProcessGroups()) { conns.addAll(findAllConnections(childGroup)); } return conns; }
private static boolean isEmpty(final ProcessGroupDTO dto) { if (dto == null) { return true; } final FlowSnippetDTO contents = dto.getContents(); if (contents == null) { return true; } return CollectionUtils.isEmpty(contents.getProcessors()) && CollectionUtils.isEmpty(contents.getConnections()) && CollectionUtils.isEmpty(contents.getFunnels()) && CollectionUtils.isEmpty(contents.getLabels()) && CollectionUtils.isEmpty(contents.getOutputPorts()) && CollectionUtils.isEmpty(contents.getProcessGroups()) && CollectionUtils.isEmpty(contents.getProcessors()) && CollectionUtils.isEmpty(contents.getRemoteProcessGroups()); }
allConns.addAll(dto.getConnections()); for (final ProcessGroupDTO childGroup : dto.getProcessGroups()) { allConns.addAll(findAllConnections(childGroup));
.map(proc -> proc.getId()) .forEach(id -> identifiers.add(id)); snippet.getConnections().stream() .map(conn -> conn.getId()) .forEach(id -> identifiers.add(id));
for (final ConnectionDTO connection : original.getConnections()) { connections.add(copy(connection)); if (original.getConnections() != null) { connections.addAll(copy(original.getConnections()));
private static void scrubSnippet(final FlowSnippetDTO snippet) { // ensure that contents have been specified if (snippet != null) { // go through each processor if specified if (snippet.getProcessors() != null) { scrubProcessors(snippet.getProcessors()); } // go through each connection if specified if (snippet.getConnections() != null) { scrubConnections(snippet.getConnections()); } // go through each remote process group if specified if (snippet.getRemoteProcessGroups() != null) { scrubRemoteProcessGroups(snippet.getRemoteProcessGroups()); } // go through each process group if specified if (snippet.getProcessGroups() != null) { scrubProcessGroups(snippet.getProcessGroups()); } // go through each controller service if specified if (snippet.getControllerServices() != null) { scrubControllerServices(snippet.getControllerServices()); } } }
dto.getConnections().add(createConnectionDto(connNode));
final FlowSnippetDTO copySnippet = new FlowSnippetDTO(); if (originalSnippet.getConnections() != null) { for (final ConnectionDTO connection : originalSnippet.getConnections()) { copySnippet.getConnections().add(copy(connection));
FlowSnippetDTO fsDTO = ((ProcessGroupDTO) componentDto).getContents(); this.removeInstanceIdentifierIfNecessary(fsDTO.getConnections()); fsDTO.connections = this.orderedById(fsDTO.getConnections());
for (final ConnectionDTO snippetConnection : snippet.getConnections()) { final Connection connection = group.getConnection(snippetConnection.getId());
for (final ConnectionDTO connection : snippet.getConnections()) { final ConnectableDTO source = connection.getSource(); final ConnectableDTO destination = connection.getDestination();
if (snippetContents.getConnections() != null) { for (final ConnectionDTO connectionDTO : snippetContents.getConnections()) { final ConnectionDTO cp = dtoFactory.copy(connectionDTO);
childTemplateDTO.setConnections(contents.getConnections()); childTemplateDTO.setInputPorts(contents.getInputPorts()); childTemplateDTO.setLabels(contents.getLabels()); for (final ConnectionDTO connectionDTO : dto.getConnections()) { final ConnectableDTO sourceDTO = connectionDTO.getSource(); final ConnectableDTO destinationDTO = connectionDTO.getDestination();
.collect(Collectors.toList())); map.put(CommonPropertyKeys.CONNECTIONS_KEY, nullToEmpty(snippet.getConnections()).stream() .map(connectionSchemaFunction) .sorted(Comparator.comparing(ConnectionSchema::getName))
.collect(Collectors.toList())); map.put(CommonPropertyKeys.CONNECTIONS_KEY, nullToEmpty(snippet.getConnections()).stream() .map(connectionSchemaFunction) .sorted(Comparator.comparing(ConnectionSchema::getName))