Merged BRANCHES/DEV/BELARUS/HEAD_2010_08_04 to HEAD:

21592 & 21649: Workflow REST APIs for retrieving workflow instance collections

Includes:
ALF-3900: F62 REST API to get all workflow instances
ALF-3901: F64 REST API to get all workflow instances of a particular workflow definition
ALF-3905: F65 REST API to get a filtered list of workflow instances of a particular workflow definition (by initiator, state, date, priority)
ALF-3906: F63 REST API to get a filtered list of workflow instances (by initiator, status, date, priority)

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@21671 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Gavin Cornwell
2010-08-06 21:19:09 +00:00
parent e3b588a55d
commit dd2585c68a
4 changed files with 85 additions and 3 deletions

View File

@@ -782,6 +782,28 @@ public class JBPMEngine extends BPMEngine
*/
@SuppressWarnings("unchecked")
public List<WorkflowInstance> getActiveWorkflows(final String workflowDefinitionId)
{
return getWorkflowsInternal(workflowDefinitionId, true);
}
/* (non-Javadoc)
* @see org.alfresco.repo.workflow.WorkflowComponent#getCompletedWorkflows(java.lang.String)
*/
public List<WorkflowInstance> getCompletedWorkflows(final String workflowDefinitionId)
{
return getWorkflowsInternal(workflowDefinitionId, false);
}
/* (non-Javadoc)
* @see org.alfresco.repo.workflow.WorkflowComponent#getWorkflows(java.lang.String)
*/
public List<WorkflowInstance> getWorkflows(final String workflowDefinitionId)
{
return getWorkflowsInternal(workflowDefinitionId, null);
}
@SuppressWarnings("unchecked")
private List<WorkflowInstance> getWorkflowsInternal(final String workflowDefinitionId, final Boolean active)
{
try
{
@@ -794,7 +816,7 @@ public class JBPMEngine extends BPMEngine
List<WorkflowInstance> workflowInstances = new ArrayList<WorkflowInstance>(processInstances.size());
for (ProcessInstance processInstance : processInstances)
{
if (!processInstance.hasEnded())
if ((active == null) || (!active && processInstance.hasEnded()) || (active && !processInstance.hasEnded()))
{
WorkflowInstance workflowInstance = createWorkflowInstance(processInstance);
workflowInstances.add(workflowInstance);