@Override public Set<AffectedComponentEntity> getComponentsAffectedByVariableRegistryUpdate(final VariableRegistryDTO variableRegistryDto) { final ProcessGroup group = processGroupDAO.getProcessGroup(variableRegistryDto.getProcessGroupId()); if (group == null) { throw new ResourceNotFoundException("Could not find Process Group with ID " + variableRegistryDto.getProcessGroupId()); } final Map<String, String> variableMap = new HashMap<>(); variableRegistryDto.getVariables().stream() // have to use forEach here instead of using Collectors.toMap because value may be null .map(VariableEntity::getVariable) .forEach(var -> variableMap.put(var.getName(), var.getValue())); final Set<AffectedComponentEntity> affectedComponentEntities = new HashSet<>(); final Set<String> updatedVariableNames = getUpdatedVariables(group, variableMap); for (final String variableName : updatedVariableNames) { final Set<ComponentNode> affectedComponents = group.getComponentsAffectedByVariable(variableName); affectedComponentEntities.addAll(dtoFactory.createAffectedComponentEntities(affectedComponents, revisionManager)); } return affectedComponentEntities; }
variableDto.setProcessGroupId(processGroup.getIdentifier()); final Set<AffectedComponentEntity> affectedComponentEntities = createAffectedComponentEntities(processGroup.getComponentsAffectedByVariable(variableName), revisionManager);
variableDto.setProcessGroupId(group.getIdentifier()); final Set<AffectedComponentEntity> affectedComponentEntities = createAffectedComponentEntities(group.getComponentsAffectedByVariable(variableDto.getName()), revisionManager);