@Test public void deleteWorkflowsWithActionsAndStatesFromMainTablesWorks() { List<Long> workflowIds = new ArrayList<>(); List<Long> actionIds = new ArrayList<>(); List<StateKey> stateIds = new ArrayList<>(); long nonArchivableWorkflow1 = storeActiveWorkflow(archiveTime1); storeStateVariables(nonArchivableWorkflow1, storeActions(nonArchivableWorkflow1, 3), 1); long nonArchivableWorkflow2 = storeActiveWorkflow(prodTime1); storeStateVariables(nonArchivableWorkflow2, storeActions(nonArchivableWorkflow2, 1), 3); long nonArchivableWorkflow3 = storePassiveWorkflow(prodTime1); storeStateVariables(nonArchivableWorkflow3, storeActions(nonArchivableWorkflow3, 2), 2); long archivable1 = storePassiveWorkflow(archiveTime1); long archivable2 = storePassiveWorkflow(archiveTime2); List<Long> actions1 = storeActions(archivable1, 1); List<Long> actions2 = storeActions(archivable2, 2); actionIds.addAll(actions1); actionIds.addAll(actions2); stateIds.addAll(storeStateVariables(archivable1, actions1, 4)); stateIds.addAll(storeStateVariables(archivable2, actions2, 2)); workflowIds.addAll(asList(archivable1, archivable2)); int variablesCountBefore = getActiveStateCount(); assertEquals(workflowIds.size(), maintenanceDao.deleteWorkflows(MAIN, workflowIds)); int variablesCountAfter = getActiveStateCount(); assertActiveWorkflowsRemoved(workflowIds); assertArchivedWorkflowsDoNotExist(workflowIds); assertActiveActionsRemoved(actionIds); assertArchiveActionsExist(actionIds, false); assertActiveStateVariablesRemoved(stateIds); assertArchiveStateVariablesExist(stateIds, false); assertEquals(0, getArchivedStateCount()); int requestDataVariableCount = workflowIds.size(); assertEquals(variablesCountAfter, variablesCountBefore - stateIds.size() - requestDataVariableCount); }
@Transactional public int deleteWorkflows(TablePrefix table, Collection<Long> workflowIds) { String workflowIdParams = params(workflowIds); return deleteWorkflows(table, workflowIdParams); }
MaintenanceDao { @Transactional public int deleteWorkflows(TablePrefix table, Collection<Long> workflowIds) { String workflowIdParams = params(workflowIds); return deleteWorkflows(table, workflowIdParams); } }
MaintenanceDao { @Transactional public int deleteWorkflows(TablePrefix table, Collection<Long> workflowIds) { String workflowIdParams = params(workflowIds); return deleteWorkflows(table, workflowIdParams); } @Inject  MaintenanceDao(SQLVariants sqlVariants, @NFlow JdbcTemplate jdbcTemplate,
      @NFlow NamedParameterJdbcTemplate nflowNamedParameterJdbcTemplate); }
MaintenanceDao { @Transactional public int deleteWorkflows(TablePrefix table, Collection<Long> workflowIds) { String workflowIdParams = params(workflowIds); return deleteWorkflows(table, workflowIdParams); } @Inject  MaintenanceDao(SQLVariants sqlVariants, @NFlow JdbcTemplate jdbcTemplate,
      @NFlow NamedParameterJdbcTemplate nflowNamedParameterJdbcTemplate); List<Long> getOldWorkflowIds(TablePrefix table, DateTime before, int maxWorkflows, Set<String> workflowTypes); @Transactional int archiveWorkflows(Collection<Long> workflowIds); @Transactional int deleteWorkflows(TablePrefix table, Collection<Long> workflowIds); @Transactional void deleteActionAndStateHistory(long workflowInstanceId, DateTime olderThan); }
MaintenanceDao { @Transactional public int deleteWorkflows(TablePrefix table, Collection<Long> workflowIds) { String workflowIdParams = params(workflowIds); return deleteWorkflows(table, workflowIdParams); } @Inject  MaintenanceDao(SQLVariants sqlVariants, @NFlow JdbcTemplate jdbcTemplate,
      @NFlow NamedParameterJdbcTemplate nflowNamedParameterJdbcTemplate); List<Long> getOldWorkflowIds(TablePrefix table, DateTime before, int maxWorkflows, Set<String> workflowTypes); @Transactional int archiveWorkflows(Collection<Long> workflowIds); @Transactional int deleteWorkflows(TablePrefix table, Collection<Long> workflowIds); @Transactional void deleteActionAndStateHistory(long workflowInstanceId, DateTime olderThan);  }