Skip to content

Commit 72d2ad2

Browse files
committed
Fix action filling in query workflows from archive
1 parent 3c76293 commit 72d2ad2

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

nflow-engine/src/main/java/io/nflow/engine/internal/dao/WorkflowInstanceDao.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -809,7 +809,7 @@ private void fillActions(WorkflowInstance instance, boolean includeStateVariable
809809
long maxActions = getMaxActions(requestedMaxActions);
810810
String tableName = ACTION.tableFor(instance);
811811
String sql = sqlVariants
812-
.limit("select nflow_workflow_action.* from " + tableName + " where workflow_id = ? order by id desc", maxActions);
812+
.limit("select * from " + tableName + " where workflow_id = ? order by id desc", maxActions);
813813
List<WorkflowInstanceAction.Builder> actionBuilders = jdbc.query(sql, workflowInstanceActionRowMapper,
814814
instance.id);
815815
if (includeStateVariables) {

nflow-engine/src/test/java/io/nflow/engine/internal/dao/MaintenanceDaoTest.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929

3030
import io.nflow.engine.model.ModelObject;
3131
import io.nflow.engine.service.WorkflowInstanceInclude;
32+
import io.nflow.engine.workflow.instance.QueryWorkflowInstances;
3233
import io.nflow.engine.workflow.instance.WorkflowInstance;
3334
import io.nflow.engine.workflow.instance.WorkflowInstanceAction;
3435

@@ -177,6 +178,9 @@ public void archiveWorkflowsWithActionsWorks() {
177178

178179
assertEquals(actionIds.size(), getArchiveActionCount());
179180
assertEquals(actionCountAfter, actionCountBefore - actionIds.size());
181+
182+
assertWorkflowActionsThroughQuery(archivable1, 1);
183+
assertWorkflowActionsThroughQuery(archivable2, 3);
180184
}
181185

182186
@Test
@@ -476,6 +480,15 @@ private void assertArchivedWorkflowsDoNotExist(List<Long> workflowIds) {
476480
}
477481
}
478482

483+
private void assertWorkflowActionsThroughQuery(Long workflowId, int expectedActions) {
484+
List<WorkflowInstance> archivedWorkflow = workflowInstanceDao.queryWorkflowInstances(new QueryWorkflowInstances.Builder()
485+
.setQueryArchive(true)
486+
.setIncludeActions(true)
487+
.addIds(workflowId)
488+
.build());
489+
assertEquals(archivedWorkflow.get(0).actions.size(), expectedActions);
490+
}
491+
479492
private void assertActiveActionsRemoved(List<Long> actionIds) {
480493
for (long actionId : actionIds) {
481494
int found = rowCount("select 1 from nflow_workflow_action where id = ?", actionId);

0 commit comments

Comments
 (0)