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()); }
private void verifyProcessorsInSnippet(final FlowSnippetDTO templateContents, final Map<String, Set<BundleCoordinate>> supportedTypes) { if (templateContents.getProcessors() != null) { templateContents.getProcessors().forEach(processor -> { if (processor.getBundle() == null) { throw new IllegalArgumentException("Processor bundle must be specified."); } if (supportedTypes.containsKey(processor.getType())) { verifyBundleInSnippet(processor.getBundle(), supportedTypes.get(processor.getType())); } else { throw new IllegalStateException("Invalid Processor Type: " + processor.getType()); } }); } if (templateContents.getProcessGroups() != null) { templateContents.getProcessGroups().forEach(processGroup -> verifyProcessorsInSnippet(processGroup.getContents(), supportedTypes)); } }
components.addAll(contents.getProcessGroups()); if (contents.getProcessors() != null) { components.addAll(contents.getProcessors());
snippet.getProcessors().stream() .map(proc -> proc.getId()) .forEach(id -> identifiers.add(id));
private void lookupSensitiveProperties(final FlowSnippetDTO snippet) { // ensure that contents have been specified if (snippet != null) { // go through each processor if specified if (snippet.getProcessors() != null) { lookupSensitiveProcessorProperties(snippet.getProcessors()); } if (snippet.getControllerServices() != null) { lookupSensitiveControllerServiceProperties(snippet.getControllerServices()); } // go through each process group if specified if (snippet.getProcessGroups() != null) { for (final ProcessGroupDTO group : snippet.getProcessGroups()) { lookupSensitiveProperties(group.getContents()); } } } }
private void updateControllerServiceIdentifiers(final FlowSnippetDTO snippet, final Map<String, String> serviceIdMap) { final Set<ProcessorDTO> processors = snippet.getProcessors(); if (processors != null) { for (final ProcessorDTO processor : processors) { updateControllerServiceIdentifiers(processor.getConfig(), serviceIdMap); } } for (final ProcessGroupDTO processGroupDto : snippet.getProcessGroups()) { updateControllerServiceIdentifiers(processGroupDto.getContents(), serviceIdMap); } }
if (snippet.getProcessors() != null) { snippet.getProcessors().forEach(dto -> { if (dto.getConfig() == null) { dto.setConfig(new ProcessorConfigDTO());
private void validateSnippetContents(final FlowSnippetDTO flow) { if (flow.getProcessors() != null) { for (final ProcessorDTO processorDTO : flow.getProcessors()) { final ProcessorNode processorNode = processorDAO.getProcessor(processorDTO.getId()); processorDTO.setValidationStatus(processorNode.getValidationStatus().name());
for (final ProcessorDTO processor : original.getProcessors()) { processors.add(copy(processor)); labels.addAll(copy(original.getLabels())); if (original.getProcessors() != null) { processors.addAll(copy(original.getProcessors()));
/** * Discovers the compatible bundle details for the components in the specified snippet. * * @param snippet the snippet */ private void discoverCompatibleBundles(final FlowSnippetDTO snippet) { if (snippet.getProcessors() != null) { snippet.getProcessors().forEach(processor -> { final BundleCoordinate coordinate = serviceFacade.getCompatibleBundle(processor.getType(), processor.getBundle()); processor.setBundle(new BundleDTO(coordinate.getGroup(), coordinate.getId(), coordinate.getVersion())); }); } if (snippet.getControllerServices() != null) { snippet.getControllerServices().forEach(controllerService -> { final BundleCoordinate coordinate = serviceFacade.getCompatibleBundle(controllerService.getType(), controllerService.getBundle()); controllerService.setBundle(new BundleDTO(coordinate.getGroup(), coordinate.getId(), coordinate.getVersion())); }); } if (snippet.getProcessGroups() != null) { snippet.getProcessGroups().forEach(processGroup -> { discoverCompatibleBundles(processGroup.getContents()); }); } }
if (snippet.getProcessors() != null) { snippet.getProcessors().forEach(processor -> { try { final BundleCoordinate bundle = BundleUtils.getCompatibleBundle(extensionManager, processor.getType(), processor.getBundle());
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.getProcessors().add(createProcessorDto(procNode));
if (originalSnippet.getProcessors() != null) { for (final ProcessorDTO processor : originalSnippet.getProcessors()) { copySnippet.getProcessors().add(copy(processor));
fsDTO.processGroups = this.orderedById(fsDTO.getProcessGroups()); this.removeInstanceIdentifierIfNecessary(fsDTO.getProcessors()); fsDTO.processors = this.orderedById(fsDTO.getProcessors());
for (final ProcessorDTO snippetProcessor : snippet.getProcessors()) { final ProcessorNode processor = group.getProcessor(snippetProcessor.getId());
for (final ProcessorDTO processor : snippet.getProcessors()) { final FlowChangeExtensionDetails processorDetails = new FlowChangeExtensionDetails(); processorDetails.setType(StringUtils.substringAfterLast(processor.getType(), "."));
rollbackClonedPolicy(ResourceFactory.getComponentResource(ResourceType.OutputPort, outputPortDTO.getId(), outputPortDTO.getName())); }); snippet.getProcessors().forEach(processorDTO -> { rollbackClonedPolicy(ResourceFactory.getComponentResource(ResourceType.Processor, processorDTO.getId(), processorDTO.getName())); });
if (snippetContents.getProcessors() != null) { for (final ProcessorDTO processorDTO : snippetContents.getProcessors()) { final ProcessorDTO cp = dtoFactory.copy(processorDTO); cp.setId(generateId(processorDTO.getId(), idGenerationSeed, isCopy));
for (final ProcessorDTO processorDTO : dto.getProcessors()) { final BundleCoordinate bundleCoordinate = BundleUtils.getBundle(extensionManager, processorDTO.getType(), processorDTO.getBundle()); final ProcessorNode procNode = flowManager.createProcessor(processorDTO.getType(), processorDTO.getId(), bundleCoordinate); childTemplateDTO.setOutputPorts(contents.getOutputPorts()); childTemplateDTO.setProcessGroups(contents.getProcessGroups()); childTemplateDTO.setProcessors(contents.getProcessors()); childTemplateDTO.setFunnels(contents.getFunnels()); childTemplateDTO.setRemoteProcessGroups(contents.getRemoteProcessGroups());