Fixed ALF-10851: GET workflow-instances REST API is returning completed workflows (should only be returning in progress workflows)

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@31734 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Gavin Cornwell
2011-11-04 12:46:03 +00:00
parent fddf5ecb9c
commit 702400beed

View File

@@ -67,6 +67,12 @@ public class WorkflowInstancesGet extends AbstractWorkflowWebscript
// state is not included into filters list as it will be taken into account before filtering // state is not included into filters list as it will be taken into account before filtering
WorkflowState state = getState(req); WorkflowState state = getState(req);
// if no state is provided default to ACTIVE workflows only (ALF-10851)
if (state == null)
{
state = WorkflowState.ACTIVE;
}
// get filter param values // get filter param values
Map<String, Object> filters = new HashMap<String, Object>(9); Map<String, Object> filters = new HashMap<String, Object>(9);
filters.put(PARAM_INITIATOR, req.getParameter(PARAM_INITIATOR)); filters.put(PARAM_INITIATOR, req.getParameter(PARAM_INITIATOR));
@@ -96,12 +102,8 @@ public class WorkflowInstancesGet extends AbstractWorkflowWebscript
List<WorkflowInstance> workflows; List<WorkflowInstance> workflows;
// list workflows for specified workflow definition // get workflows, if definition id is null all workflows are returned
if(state == null) if (state == WorkflowState.ACTIVE)
{
workflows = workflowService.getWorkflows(workflowDefinitionId);
}
else if (state == WorkflowState.ACTIVE)
{ {
workflows = workflowService.getActiveWorkflows(workflowDefinitionId); workflows = workflowService.getActiveWorkflows(workflowDefinitionId);
} }