Skip to content

Commit

Permalink
JBPM-4646 - Case management - added support for taking completed node…
Browse files Browse the repository at this point in the history
…s for case instance, improved filtering for case nodes to exclude less meaningful nodes
  • Loading branch information
mswiderski committed Feb 10, 2017
1 parent 123b3f2 commit 46b954d
Show file tree
Hide file tree
Showing 6 changed files with 594 additions and 367 deletions.
Expand Up @@ -146,6 +146,14 @@ public interface CaseRuntimeDataService {
*/
Collection<NodeInstanceDesc> getActiveNodesForCase(String caseId, QueryContext queryContext);

/**
* Returns completed nodes in given case regardless in what process instance they belong to.
* @param caseId unique id of the case
* @param queryContext control parameters for the result e.g. sorting, paging
*
*/
Collection<NodeInstanceDesc> getCompletedNodesForCase(String caseId, QueryContext queryContext);

/**
* Returns list of AdHocFragments available in given case. It includes all ad hoc fragments that are
* eligible for triggering - meaning it's container is active (case instance or stage)
Expand Down
Expand Up @@ -393,12 +393,22 @@ public Collection<CaseStageInstance> getCaseInstanceStages(String caseId, boolea
@Override
public Collection<org.jbpm.services.api.model.NodeInstanceDesc> getActiveNodesForCase(String caseId, QueryContext queryContext) {
Map<String, Object> params = new HashMap<String, Object>();
params.put("caseId", caseId);
params.put("caseId", caseId + "%");
applyQueryContext(params, queryContext);
applyDeploymentFilter(params);
List<org.jbpm.services.api.model.NodeInstanceDesc> nodeInstances = commandService.execute(new QueryNameCommand<List<org.jbpm.services.api.model.NodeInstanceDesc>>("getActiveNodesForCase", params));
return nodeInstances;
}

@Override
public Collection<org.jbpm.services.api.model.NodeInstanceDesc> getCompletedNodesForCase(String caseId, QueryContext queryContext) {
Map<String, Object> params = new HashMap<String, Object>();
params.put("caseId", caseId + "%");
applyQueryContext(params, queryContext);
applyDeploymentFilter(params);
List<org.jbpm.services.api.model.NodeInstanceDesc> nodeInstances = commandService.execute(new QueryNameCommand<List<org.jbpm.services.api.model.NodeInstanceDesc>>("getCompletedNodesForCase", params));
return nodeInstances;
}


@Override
Expand Down
Expand Up @@ -243,10 +243,10 @@
ProcessInstanceLog plog,
NodeInstanceLog log
where
plog.correlationKey =:caseId
and plog.processType = 2
plog.correlationKey like :caseId
and plog.status = 1
and plog.processInstanceId = log.processInstanceId
and log.nodeType not in ('StartNode', 'EndNode', 'Split', 'Join')
and log.nodeInstanceId in ( select nil.nodeInstanceId from NodeInstanceLog nil where nil.processInstanceId=plog.processInstanceId
GROUP BY nil.nodeInstanceId
HAVING sum(nil.type) = 0)
Expand All @@ -257,6 +257,38 @@
<!-- hint name="org.hibernate.timeout" value="200"/ -->
</named-query>

<named-query name="getCompletedNodesForCase">
<query>
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
)
from
ProcessInstanceLog plog,
NodeInstanceLog log
where
plog.correlationKey like :caseId
and plog.processInstanceId = log.processInstanceId
and log.nodeType not in ('StartNode', 'EndNode', 'Split', 'Join')
and log.nodeInstanceId in (select nodeInstanceId from NodeInstanceLog nid where nid.processInstanceId=plog.processInstanceId AND nid.type = 1
GROUP BY nid.nodeInstanceId
HAVING sum(nid.type) &gt;= 1)
and log.type = 1
ORDER BY
log.processInstanceId, log.nodeInstanceId
</query>
<!-- hint name="org.hibernate.timeout" value="200"/ -->
</named-query>

<!-- case id info queries -->
<named-query name="findCaseIdInfoByPrefix">

Expand Down

0 comments on commit 46b954d

Please sign in to comment.