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

@@ -151,13 +151,29 @@ public interface WorkflowComponent
public WorkflowPath startWorkflow(String workflowDefinitionId, Map<QName, Serializable> parameters);
/**
* Gets all "in-flight" workflow instances of the specified Workflow Definition
* Gets all "in-flight" active workflow instances of the specified Workflow Definition
*
* @param workflowDefinitionId the workflow definition id
* @return the list of "in-flight" workflow instances
*/
public List<WorkflowInstance> getActiveWorkflows(String workflowDefinitionId);
/**
* Gets all "in-flight" completed workflow instances of the specified Workflow Definition
*
* @param workflowDefinitionId the workflow definition id
* @return the list of "in-flight" workflow instances
*/
public List<WorkflowInstance> getCompletedWorkflows(String workflowDefinitionId);
/**
* Gets all "in-flight" workflow instances (both active and completed) of the specified Workflow Definition
*
* @param workflowDefinitionId the workflow definition id
* @return the list of "in-flight" workflow instances
*/
public List<WorkflowInstance> getWorkflows(String workflowDefinitionId);
/**
* Gets a specific workflow instances
*

View File

@@ -381,6 +381,32 @@ public class WorkflowServiceImpl implements WorkflowService
return component.getActiveWorkflows(workflowDefinitionId);
}
/*
* (non-Javadoc)
* @see
* org.alfresco.service.cmr.workflow.WorkflowService#getCompletedWorkflows(
* java.lang.String)
*/
public List<WorkflowInstance> getCompletedWorkflows(String workflowDefinitionId)
{
String engineId = BPMEngineRegistry.getEngineId(workflowDefinitionId);
WorkflowComponent component = getWorkflowComponent(engineId);
return component.getCompletedWorkflows(workflowDefinitionId);
}
/*
* (non-Javadoc)
* @see
* org.alfresco.service.cmr.workflow.WorkflowService#getWorkflows(
* java.lang.String)
*/
public List<WorkflowInstance> getWorkflows(String workflowDefinitionId)
{
String engineId = BPMEngineRegistry.getEngineId(workflowDefinitionId);
WorkflowComponent component = getWorkflowComponent(engineId);
return component.getWorkflows(workflowDefinitionId);
}
/*
* (non-Javadoc)
* @see

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);

View File

@@ -194,7 +194,7 @@ public interface WorkflowService
public WorkflowPath startWorkflowFromTemplate(NodeRef templateDefinition);
/**
* Gets all "in-flight" workflow instances of the specified Workflow Definition
* Gets all "in-flight" active workflow instances of the specified Workflow Definition
*
* @param workflowDefinitionId the workflow definition id
* @return the list of "in-flight" workflow instances
@@ -202,6 +202,24 @@ public interface WorkflowService
@Auditable(parameters = {"workflowDefinitionId"})
public List<WorkflowInstance> getActiveWorkflows(String workflowDefinitionId);
/**
* Gets all "in-flight" completed workflow instances of the specified Workflow Definition
*
* @param workflowDefinitionId the workflow definition id
* @return the list of "in-flight" workflow instances
*/
@Auditable(parameters = {"workflowDefinitionId"})
public List<WorkflowInstance> getCompletedWorkflows(String workflowDefinitionId);
/**
* Gets all "in-flight" workflow instances (both active and completed) of the specified Workflow Definition
*
* @param workflowDefinitionId the workflow definition id
* @return the list of "in-flight" workflow instances
*/
@Auditable(parameters = {"workflowDefinitionId"})
public List<WorkflowInstance> getWorkflows(String workflowDefinitionId);
/**
* Gets a specific workflow instances
*