Search in sources :

Example 1 with NifiFlowCacheBaseProcessorDTO

use of com.thinkbiganalytics.metadata.rest.model.nifi.NifiFlowCacheBaseProcessorDTO in project kylo by Teradata.

the class NiFiTemplateCacheProcessorGraph method getProcessorDestinations.

/**
 * recursively add and connect processors
 * @param processorId
 * @param connectionSourceToDestination
 * @return
 */
private List<NifiFlowCacheBaseProcessorDTO> getProcessorDestinations(String processorId, Map<String, List<String>> connectionSourceToDestination, Map<String, NifiFlowCacheBaseProcessorDTO> processedDestinations) {
    if (processedDestinations == null) {
        processedDestinations = new HashMap<>();
    }
    List<NifiFlowCacheBaseProcessorDTO> destinations = new ArrayList<>();
    List<String> destIds = connectionSourceToDestination.get(processorId);
    if (destIds != null) {
        for (String id : destIds) {
            if (processedDestinations.containsKey(id)) {
                destinations.add(processedDestinations.get(id));
            } else if (id != processorId) {
                String processorName = processorIdToProcessorName.get(id);
                if (StringUtils.isNotBlank(processorName)) {
                    NifiFlowCacheBaseProcessorDTO dto = new NifiFlowCacheBaseProcessorDTO();
                    dto.setId(id);
                    dto.setName(processorName);
                    destinations.add(dto);
                    processedDestinations.put(id, dto);
                    List<NifiFlowCacheBaseProcessorDTO> destProcessors = getProcessorDestinations(id, connectionSourceToDestination, processedDestinations);
                    destinations.addAll(destProcessors);
                }
            } else {
                log.info("skipping processor relation {}", id);
            }
        }
    }
    return destinations;
}
Also used : NifiFlowCacheBaseProcessorDTO(com.thinkbiganalytics.metadata.rest.model.nifi.NifiFlowCacheBaseProcessorDTO) ArrayList(java.util.ArrayList) ArrayList(java.util.ArrayList) List(java.util.List)

Example 2 with NifiFlowCacheBaseProcessorDTO

use of com.thinkbiganalytics.metadata.rest.model.nifi.NifiFlowCacheBaseProcessorDTO in project kylo by Teradata.

the class NifiFlowCacheImpl method getProcessorDestinations.

/**
 * recursively add and connect processors
 */
private List<NifiFlowCacheBaseProcessorDTO> getProcessorDestinations(String processorId, Map<String, List<String>> connectionSourceToDestination, Map<String, NifiFlowCacheBaseProcessorDTO> processedDestinations) {
    if (processedDestinations == null) {
        processedDestinations = new HashMap<>();
    }
    List<NifiFlowCacheBaseProcessorDTO> destinations = new ArrayList<>();
    List<String> destIds = connectionSourceToDestination.get(processorId);
    if (destIds != null) {
        for (String id : destIds) {
            if (processedDestinations.containsKey(id)) {
                destinations.add(processedDestinations.get(id));
            } else if (id != processorId) {
                String processorName = processorIdToProcessorName.get(id);
                if (StringUtils.isNotBlank(processorName)) {
                    NifiFlowCacheBaseProcessorDTO dto = new NifiFlowCacheBaseProcessorDTO();
                    dto.setId(id);
                    dto.setName(processorName);
                    destinations.add(dto);
                    processedDestinations.put(id, dto);
                    List<NifiFlowCacheBaseProcessorDTO> destProcessors = getProcessorDestinations(id, connectionSourceToDestination, processedDestinations);
                    destinations.addAll(destProcessors);
                }
            } else {
                log.info("skipping processor relation {}", id);
            }
        }
    }
    return destinations;
}
Also used : NifiFlowCacheBaseProcessorDTO(com.thinkbiganalytics.metadata.rest.model.nifi.NifiFlowCacheBaseProcessorDTO) ArrayList(java.util.ArrayList) List(java.util.List) ArrayList(java.util.ArrayList)

Aggregations

NifiFlowCacheBaseProcessorDTO (com.thinkbiganalytics.metadata.rest.model.nifi.NifiFlowCacheBaseProcessorDTO)2 ArrayList (java.util.ArrayList)2 List (java.util.List)2