@Test public void useAColumnBeforeCreationOrAfterDeletion_incoherentStepsList() throws Exception { List<AppendStep> steps = new ArrayList<>(); steps.add(createAppendStep("0003", emptyList())); steps.add(createAppendStep("0002", asList("0003", "0004"))); assertFalse(reorderStepsUtils.isStepOrderInvalid(steps)); }
boolean isStepOrderInvalid(List<AppendStep> appendSteps) { final Set<String> notYetAvailableColumnsIds = appendSteps .stream() .flatMap(step -> step.getDiff().getCreatedColumns().stream()) .collect(Collectors.toSet()); return appendSteps.stream().noneMatch(step -> { for (Action action : step.getActions()) { final Map<String, String> parameters = action.getParameters(); String[] columnIds = { parameters.get(ImplicitParameters.COLUMN_ID.getKey()) }; if (ActionScope.MULTI_COLUMNS .getDisplayName() .equals(action.getParameters().get(ImplicitParameters.SCOPE.getKey()))) { columnIds = ActionsUtils.extractColumnsId(parameters.get(COLUMN_IDS)); } notYetAvailableColumnsIds.removeAll(step.getDiff().getCreatedColumns()); for (String columnId : columnIds) { if (notYetAvailableColumnsIds.contains(columnId)) { return true; } if (StringUtils.equalsIgnoreCase(DeleteColumn.DELETE_COLUMN_ACTION_NAME, action.getName())) { notYetAvailableColumnsIds.add(columnId); } } } return false; }); }
ReorderStepsUtils { boolean isStepOrderInvalid(List<AppendStep> appendSteps) { final Set<String> notYetAvailableColumnsIds = appendSteps .stream() .flatMap(step -> step.getDiff().getCreatedColumns().stream()) .collect(Collectors.toSet()); return appendSteps.stream().noneMatch(step -> { for (Action action : step.getActions()) { final Map<String, String> parameters = action.getParameters(); String[] columnIds = { parameters.get(ImplicitParameters.COLUMN_ID.getKey()) }; if (ActionScope.MULTI_COLUMNS .getDisplayName() .equals(action.getParameters().get(ImplicitParameters.SCOPE.getKey()))) { columnIds = ActionsUtils.extractColumnsId(parameters.get(COLUMN_IDS)); } notYetAvailableColumnsIds.removeAll(step.getDiff().getCreatedColumns()); for (String columnId : columnIds) { if (notYetAvailableColumnsIds.contains(columnId)) { return true; } if (StringUtils.equalsIgnoreCase(DeleteColumn.DELETE_COLUMN_ACTION_NAME, action.getName())) { notYetAvailableColumnsIds.add(columnId); } } } return false; }); } }
ReorderStepsUtils { boolean isStepOrderInvalid(List<AppendStep> appendSteps) { final Set<String> notYetAvailableColumnsIds = appendSteps .stream() .flatMap(step -> step.getDiff().getCreatedColumns().stream()) .collect(Collectors.toSet()); return appendSteps.stream().noneMatch(step -> { for (Action action : step.getActions()) { final Map<String, String> parameters = action.getParameters(); String[] columnIds = { parameters.get(ImplicitParameters.COLUMN_ID.getKey()) }; if (ActionScope.MULTI_COLUMNS .getDisplayName() .equals(action.getParameters().get(ImplicitParameters.SCOPE.getKey()))) { columnIds = ActionsUtils.extractColumnsId(parameters.get(COLUMN_IDS)); } notYetAvailableColumnsIds.removeAll(step.getDiff().getCreatedColumns()); for (String columnId : columnIds) { if (notYetAvailableColumnsIds.contains(columnId)) { return true; } if (StringUtils.equalsIgnoreCase(DeleteColumn.DELETE_COLUMN_ACTION_NAME, action.getName())) { notYetAvailableColumnsIds.add(columnId); } } } return false; }); }  }
ReorderStepsUtils { boolean isStepOrderInvalid(List<AppendStep> appendSteps) { final Set<String> notYetAvailableColumnsIds = appendSteps .stream() .flatMap(step -> step.getDiff().getCreatedColumns().stream()) .collect(Collectors.toSet()); return appendSteps.stream().noneMatch(step -> { for (Action action : step.getActions()) { final Map<String, String> parameters = action.getParameters(); String[] columnIds = { parameters.get(ImplicitParameters.COLUMN_ID.getKey()) }; if (ActionScope.MULTI_COLUMNS .getDisplayName() .equals(action.getParameters().get(ImplicitParameters.SCOPE.getKey()))) { columnIds = ActionsUtils.extractColumnsId(parameters.get(COLUMN_IDS)); } notYetAvailableColumnsIds.removeAll(step.getDiff().getCreatedColumns()); for (String columnId : columnIds) { if (notYetAvailableColumnsIds.contains(columnId)) { return true; } if (StringUtils.equalsIgnoreCase(DeleteColumn.DELETE_COLUMN_ACTION_NAME, action.getName())) { notYetAvailableColumnsIds.add(columnId); } } } return false; }); }   }
ReorderStepsUtils { boolean isStepOrderInvalid(List<AppendStep> appendSteps) { final Set<String> notYetAvailableColumnsIds = appendSteps .stream() .flatMap(step -> step.getDiff().getCreatedColumns().stream()) .collect(Collectors.toSet()); return appendSteps.stream().noneMatch(step -> { for (Action action : step.getActions()) { final Map<String, String> parameters = action.getParameters(); String[] columnIds = { parameters.get(ImplicitParameters.COLUMN_ID.getKey()) }; if (ActionScope.MULTI_COLUMNS .getDisplayName() .equals(action.getParameters().get(ImplicitParameters.SCOPE.getKey()))) { columnIds = ActionsUtils.extractColumnsId(parameters.get(COLUMN_IDS)); } notYetAvailableColumnsIds.removeAll(step.getDiff().getCreatedColumns()); for (String columnId : columnIds) { if (notYetAvailableColumnsIds.contains(columnId)) { return true; } if (StringUtils.equalsIgnoreCase(DeleteColumn.DELETE_COLUMN_ACTION_NAME, action.getName())) { notYetAvailableColumnsIds.add(columnId); } } } return false; }); }    }