@Test public void archiveWorkflowsWorks() { List<Long> workflowIds = new ArrayList<>(); storeActiveWorkflow(archiveTime1); storeActiveWorkflow(prodTime1); storePassiveWorkflow(prodTime1); workflowIds.add(storePassiveWorkflow(archiveTime1)); workflowIds.add(storePassiveWorkflow(archiveTime2)); int workflowCountBefore = getActiveWorkflowCount(); assertEquals(workflowIds.size(), maintenanceDao.archiveWorkflows(workflowIds)); int workflowCountAfter = getActiveWorkflowCount(); assertActiveWorkflowsRemoved(workflowIds); assertArchiveWorkflowsExist(workflowIds); assertEquals(workflowIds.size(), getArchivedWorkflowCount()); assertEquals(workflowCountAfter, workflowCountBefore - workflowIds.size()); }
@Transactional public int archiveWorkflows(Collection<Long> workflowIds) { String workflowIdParams = params(workflowIds); int archivedInstances = archiveTable("workflow", "id", getWorkflowColumns(), workflowIdParams); int archivedActions = archiveTable("workflow_action", "workflow_id", getActionColumns(), workflowIdParams); int archivedStates = archiveTable("workflow_state", "workflow_id", getStateColumns(), workflowIdParams); logger.info("Archived {} workflow instances, {} actions and {} states.", archivedInstances, archivedActions, archivedStates); deleteWorkflows(MAIN, workflowIdParams); return archivedInstances; }
MaintenanceDao { @Transactional public int archiveWorkflows(Collection<Long> workflowIds) { String workflowIdParams = params(workflowIds); int archivedInstances = archiveTable("workflow", "id", getWorkflowColumns(), workflowIdParams); int archivedActions = archiveTable("workflow_action", "workflow_id", getActionColumns(), workflowIdParams); int archivedStates = archiveTable("workflow_state", "workflow_id", getStateColumns(), workflowIdParams); logger.info("Archived {} workflow instances, {} actions and {} states.", archivedInstances, archivedActions, archivedStates); deleteWorkflows(MAIN, workflowIdParams); return archivedInstances; } }
MaintenanceDao { @Transactional public int archiveWorkflows(Collection<Long> workflowIds) { String workflowIdParams = params(workflowIds); int archivedInstances = archiveTable("workflow", "id", getWorkflowColumns(), workflowIdParams); int archivedActions = archiveTable("workflow_action", "workflow_id", getActionColumns(), workflowIdParams); int archivedStates = archiveTable("workflow_state", "workflow_id", getStateColumns(), workflowIdParams); logger.info("Archived {} workflow instances, {} actions and {} states.", archivedInstances, archivedActions, archivedStates); deleteWorkflows(MAIN, workflowIdParams); return archivedInstances; } @Inject  MaintenanceDao(SQLVariants sqlVariants, @NFlow JdbcTemplate jdbcTemplate,
      @NFlow NamedParameterJdbcTemplate nflowNamedParameterJdbcTemplate); }
MaintenanceDao { @Transactional public int archiveWorkflows(Collection<Long> workflowIds) { String workflowIdParams = params(workflowIds); int archivedInstances = archiveTable("workflow", "id", getWorkflowColumns(), workflowIdParams); int archivedActions = archiveTable("workflow_action", "workflow_id", getActionColumns(), workflowIdParams); int archivedStates = archiveTable("workflow_state", "workflow_id", getStateColumns(), workflowIdParams); logger.info("Archived {} workflow instances, {} actions and {} states.", archivedInstances, archivedActions, archivedStates); deleteWorkflows(MAIN, workflowIdParams); return archivedInstances; } @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 archiveWorkflows(Collection<Long> workflowIds) { String workflowIdParams = params(workflowIds); int archivedInstances = archiveTable("workflow", "id", getWorkflowColumns(), workflowIdParams); int archivedActions = archiveTable("workflow_action", "workflow_id", getActionColumns(), workflowIdParams); int archivedStates = archiveTable("workflow_state", "workflow_id", getStateColumns(), workflowIdParams); logger.info("Archived {} workflow instances, {} actions and {} states.", archivedInstances, archivedActions, archivedStates); deleteWorkflows(MAIN, workflowIdParams); return archivedInstances; } @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);  }