diff --git a/jbpm-services/jbpm-kie-services/src/main/java/org/jbpm/kie/services/impl/RuntimeDataServiceImpl.java b/jbpm-services/jbpm-kie-services/src/main/java/org/jbpm/kie/services/impl/RuntimeDataServiceImpl.java index b78d32d7c0..584ac48af2 100644 --- a/jbpm-services/jbpm-kie-services/src/main/java/org/jbpm/kie/services/impl/RuntimeDataServiceImpl.java +++ b/jbpm-services/jbpm-kie-services/src/main/java/org/jbpm/kie/services/impl/RuntimeDataServiceImpl.java @@ -692,6 +692,13 @@ public Collection getProcessInstanceHistoryCompleted(long proc return getProcessInstanceHistory(processId, true, queryContext); } + @Override + public Collection getProcessInstanceHistoryFinished(long processId, QueryContext queryContext) { + Map params = new HashMap(); + params.put("processId", processId); + applyQueryContext(params, queryContext); + return commandService.execute(new QueryNameCommand>("getProcessInstanceFinishedNodes", params)); + } protected Collection getProcessInstanceHistory(long processId, boolean completed, QueryContext queryContext) { Map params = new HashMap(); diff --git a/jbpm-services/jbpm-kie-services/src/main/resources/META-INF/Servicesorm.xml b/jbpm-services/jbpm-kie-services/src/main/resources/META-INF/Servicesorm.xml index 169d8e08e5..35f5d80d65 100644 --- a/jbpm-services/jbpm-kie-services/src/main/resources/META-INF/Servicesorm.xml +++ b/jbpm-services/jbpm-kie-services/src/main/resources/META-INF/Servicesorm.xml @@ -597,7 +597,37 @@ - + + + + select + new org.jbpm.kie.services.impl.model.NodeInstanceDesc( + log.nodeInstanceId, + log.nodeId, + log.nodeName, + log.nodeType, + log.externalId, + log.processInstanceId, + log.date, + log.connection, + log.type, + log.workItemId, + log.referenceId, + log.nodeContainerId, + log.slaDueDate, + log.slaCompliance + ) + from + NodeInstanceLog log + where + log.type in ( 1, 2, 3 ,4 ) + and log.processInstanceId=:processId + ORDER BY + log.id ASC + + + + select diff --git a/jbpm-services/jbpm-kie-services/src/test/java/org/jbpm/kie/services/impl/admin/ProcessInstanceAdminServiceImplTest.java b/jbpm-services/jbpm-kie-services/src/test/java/org/jbpm/kie/services/impl/admin/ProcessInstanceAdminServiceImplTest.java index 1ec5aea798..5ca202a5f5 100644 --- a/jbpm-services/jbpm-kie-services/src/test/java/org/jbpm/kie/services/impl/admin/ProcessInstanceAdminServiceImplTest.java +++ b/jbpm-services/jbpm-kie-services/src/test/java/org/jbpm/kie/services/impl/admin/ProcessInstanceAdminServiceImplTest.java @@ -273,6 +273,11 @@ public void testReTriggerNodeInstance() { assertNotNull(completedNodes); assertEquals(1, completedNodes.size()); + // test for finished nodes + Collection finishedNodes = runtimeDataService.getProcessInstanceHistoryFinished(processInstanceId, new QueryFilter()); + assertNotNull(finishedNodes); + assertEquals(2, finishedNodes.size()); + final List nodeInstances = completedNodes.stream().filter(node -> node.getId().equals(active.getId())).collect(Collectors.toList()); assertEquals(0, nodeInstances.size()); diff --git a/jbpm-services/jbpm-services-api/src/build/revapi-config.json b/jbpm-services/jbpm-services-api/src/build/revapi-config.json index 40d51a8062..411d76dd26 100644 --- a/jbpm-services/jbpm-services-api/src/build/revapi-config.json +++ b/jbpm-services/jbpm-services-api/src/build/revapi-config.json @@ -26,7 +26,16 @@ "methodName": "countProcessInstancesByDeploymentId", "elementKind": "method", "justification": "[RHPAM-4028] Allow to count process instances by deploymentId and states." - } + }, + { + "code": "java.method.addedToInterface", + "new": "method java.util.Collection org.jbpm.services.api.RuntimeDataService::getProcessInstanceHistoryFinished(long, org.kie.api.runtime.query.QueryContext)", + "package": "org.jbpm.services.api", + "classSimpleName": "RuntimeDataService", + "methodName": "getProcessInstanceHistoryFinished", + "elementKind": "method", + "justification": "[RHPAM-4653] IntermediateThrowingSignal node from subprocess and the subprocess is not getting marked as executed." + } ] } } diff --git a/jbpm-services/jbpm-services-api/src/main/java/org/jbpm/services/api/RuntimeDataService.java b/jbpm-services/jbpm-services-api/src/main/java/org/jbpm/services/api/RuntimeDataService.java index 01b67a6882..bc729aeb82 100644 --- a/jbpm-services/jbpm-services-api/src/main/java/org/jbpm/services/api/RuntimeDataService.java +++ b/jbpm-services/jbpm-services-api/src/main/java/org/jbpm/services/api/RuntimeDataService.java @@ -247,7 +247,15 @@ public int getValue() { */ Collection getProcessInstanceHistoryCompleted(long processInstanceId, QueryContext queryContext); - /** + /** + * Returns trace of all passed (include completed, skipped, aborted, OBSOLETE) for given process instance id + * @param processInstanceId unique identifier of process instance + * @param queryContext control parameters for the result e.g. sorting, paging + * @return + */ + Collection getProcessInstanceHistoryFinished(long processInstanceId, QueryContext queryContext); + + /** * Returns complete trace of all executed (completed) and active nodes for given process instance id * @param processInstanceId The id of the process used to start the process instance. * @param queryContext control parameters for the result e.g. sorting, paging