mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Merged HEAD-BUG-FIX to HEAD (4.2)
55501: Merged V4.1-BUG-FIX (4.1.7) to HEAD-BUG-FIX (4.2) << Had a conflict on merge - think it is okay >> 55463: Merged V4.1.6 (4.1.6) to V4.1-BUG-FIX (4.1.7) 55227: MNT-9074: Merged V4.1.6-PATCHES-2013_09_03 to PATCHES/V4.1.6 55046: MNT-9074 : My Tasks fails to render if tasks quantity is excessive Were implemented code for getting definite count of workflow instances and applying them to page. It makes the opening page more quickly. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@55782 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -194,6 +194,24 @@ public interface WorkflowComponent
|
|||||||
*/
|
*/
|
||||||
public List<WorkflowInstance> getWorkflows(WorkflowInstanceQuery workflowInstanceQuery);
|
public List<WorkflowInstance> getWorkflows(WorkflowInstanceQuery workflowInstanceQuery);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets maxItems "in-flight" workflow instances according to the specified workflowInstanceQuery parameter
|
||||||
|
*
|
||||||
|
* @param workflowInstanceQuery
|
||||||
|
* @param maxItems
|
||||||
|
* @param skipCount
|
||||||
|
* @return maxItems workflow instances
|
||||||
|
*/
|
||||||
|
public List<WorkflowInstance> getWorkflows(WorkflowInstanceQuery workflowInstanceQuery, int maxItems, int skipCount);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get count of workflow instances
|
||||||
|
*
|
||||||
|
* @param workflowInstanceQuery
|
||||||
|
* @return count of workflow instances
|
||||||
|
*/
|
||||||
|
public long countWorkflows(WorkflowInstanceQuery workflowInstanceQuery);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets all "in-flight" active workflow instances.
|
* Gets all "in-flight" active workflow instances.
|
||||||
*
|
*
|
||||||
|
@@ -482,7 +482,13 @@ public class WorkflowServiceImpl implements WorkflowService
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<WorkflowInstance> getWorkflows(final WorkflowInstanceQuery workflowInstanceQuery)
|
public List<WorkflowInstance> getWorkflows(WorkflowInstanceQuery workflowInstanceQuery)
|
||||||
|
{
|
||||||
|
return getWorkflows(workflowInstanceQuery, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<WorkflowInstance> getWorkflows(final WorkflowInstanceQuery workflowInstanceQuery, final int maxItems, final int skipCount)
|
||||||
{
|
{
|
||||||
if(workflowInstanceQuery.getWorkflowDefinitionId() == null)
|
if(workflowInstanceQuery.getWorkflowDefinitionId() == null)
|
||||||
{
|
{
|
||||||
@@ -492,14 +498,38 @@ public class WorkflowServiceImpl implements WorkflowService
|
|||||||
public List<WorkflowInstance> apply(String id)
|
public List<WorkflowInstance> apply(String id)
|
||||||
{
|
{
|
||||||
WorkflowComponent component = registry.getWorkflowComponent(id);
|
WorkflowComponent component = registry.getWorkflowComponent(id);
|
||||||
return component.getWorkflows(workflowInstanceQuery);
|
return component.getWorkflows(workflowInstanceQuery, maxItems, skipCount);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
String engineId = BPMEngineRegistry.getEngineId(workflowInstanceQuery.getWorkflowDefinitionId());
|
String engineId = BPMEngineRegistry.getEngineId(workflowInstanceQuery.getWorkflowDefinitionId());
|
||||||
WorkflowComponent component = getWorkflowComponent(engineId);
|
WorkflowComponent component = getWorkflowComponent(engineId);
|
||||||
return component.getWorkflows(workflowInstanceQuery);
|
return component.getWorkflows(workflowInstanceQuery, maxItems, skipCount);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public long countWorkflows(final WorkflowInstanceQuery workflowInstanceQuery)
|
||||||
|
{
|
||||||
|
// MNT-9074 My Tasks fails to render if tasks quantity is excessive
|
||||||
|
if (workflowInstanceQuery.getWorkflowDefinitionId() == null)
|
||||||
|
{
|
||||||
|
List<String> ids = Arrays.asList(registry.getWorkflowComponents());
|
||||||
|
|
||||||
|
long total = 0;
|
||||||
|
|
||||||
|
for (String id : ids)
|
||||||
|
{
|
||||||
|
WorkflowComponent component = registry.getWorkflowComponent(id);
|
||||||
|
total += component.countWorkflows(workflowInstanceQuery);
|
||||||
|
}
|
||||||
|
|
||||||
|
return total;
|
||||||
|
}
|
||||||
|
|
||||||
|
String engineId = BPMEngineRegistry.getEngineId(workflowInstanceQuery.getWorkflowDefinitionId());
|
||||||
|
WorkflowComponent component = getWorkflowComponent(engineId);
|
||||||
|
return component.countWorkflows(workflowInstanceQuery);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -2182,25 +2182,75 @@ public class ActivitiWorkflowEngine extends BPMEngine implements WorkflowEngine
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<WorkflowInstance> getWorkflows(WorkflowInstanceQuery workflowInstanceQuery)
|
public List<WorkflowInstance> getWorkflows(WorkflowInstanceQuery workflowInstanceQuery)
|
||||||
|
{
|
||||||
|
return getWorkflows(workflowInstanceQuery, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<WorkflowInstance> getWorkflows(WorkflowInstanceQuery workflowInstanceQuery, int maxItems, int skipCount)
|
||||||
{
|
{
|
||||||
LinkedList<WorkflowInstance> results = new LinkedList<WorkflowInstance>();
|
LinkedList<WorkflowInstance> results = new LinkedList<WorkflowInstance>();
|
||||||
if (Boolean.FALSE.equals(workflowInstanceQuery.getActive()) == false)
|
if (Boolean.FALSE.equals(workflowInstanceQuery.getActive()) == false)
|
||||||
{
|
{
|
||||||
//Add active.
|
//Add active.
|
||||||
results.addAll(getWorkflowsInternal(workflowInstanceQuery, true));
|
results.addAll(getWorkflowsInternal(workflowInstanceQuery, true, maxItems, skipCount));
|
||||||
}
|
}
|
||||||
if (Boolean.TRUE.equals(workflowInstanceQuery.getActive()) == false)
|
if (Boolean.TRUE.equals(workflowInstanceQuery.getActive()) == false)
|
||||||
{
|
{
|
||||||
//Add complete
|
//Add complete
|
||||||
results.addAll(getWorkflowsInternal(workflowInstanceQuery, false));
|
results.addAll(getWorkflowsInternal(workflowInstanceQuery, false, maxItems, skipCount));
|
||||||
}
|
}
|
||||||
|
|
||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
private List<WorkflowInstance> getWorkflowsInternal(WorkflowInstanceQuery workflowInstanceQuery, boolean isActive)
|
private List<WorkflowInstance> getWorkflowsInternal(WorkflowInstanceQuery workflowInstanceQuery, boolean isActive, int maxItems, int skipCount)
|
||||||
{
|
{
|
||||||
|
// MNT-9074 My Tasks fails to render if tasks quantity is excessive
|
||||||
|
HistoricProcessInstanceQuery query = createQuery(workflowInstanceQuery, isActive);
|
||||||
|
|
||||||
|
LinkedList<WorkflowInstance> results = new LinkedList<WorkflowInstance>();
|
||||||
|
|
||||||
|
List<HistoricProcessInstance> completedInstances;
|
||||||
|
if (maxItems > 0)
|
||||||
|
{
|
||||||
|
completedInstances = query.orderByProcessInstanceDuration().desc().listPage(skipCount, maxItems);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
completedInstances = query.list();
|
||||||
|
}
|
||||||
|
|
||||||
|
List<WorkflowInstance> completedResults = typeConverter.convert(completedInstances);
|
||||||
|
|
||||||
|
results.addAll(completedResults);
|
||||||
|
return results;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public long countWorkflows(WorkflowInstanceQuery workflowInstanceQuery)
|
||||||
|
{
|
||||||
|
// MNT-9074 My Tasks fails to render if tasks quantity is excessive
|
||||||
|
long total = 0;
|
||||||
|
if (Boolean.FALSE.equals(workflowInstanceQuery.getActive()) == false)
|
||||||
|
{
|
||||||
|
// Add active.
|
||||||
|
total += createQuery(workflowInstanceQuery, true).count();
|
||||||
|
}
|
||||||
|
if (Boolean.TRUE.equals(workflowInstanceQuery.getActive()) == false)
|
||||||
|
{
|
||||||
|
// Add complete
|
||||||
|
total += createQuery(workflowInstanceQuery, false).count();
|
||||||
|
}
|
||||||
|
|
||||||
|
return total;
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
private HistoricProcessInstanceQuery createQuery(WorkflowInstanceQuery workflowInstanceQuery, boolean isActive)
|
||||||
|
{
|
||||||
|
// MNT-9074 My Tasks fails to render if tasks quantity is excessive
|
||||||
String processDefId = workflowInstanceQuery.getWorkflowDefinitionId() == null ? null : createLocalId(workflowInstanceQuery.getWorkflowDefinitionId());
|
String processDefId = workflowInstanceQuery.getWorkflowDefinitionId() == null ? null : createLocalId(workflowInstanceQuery.getWorkflowDefinitionId());
|
||||||
|
|
||||||
HistoricProcessInstanceQuery query;
|
HistoricProcessInstanceQuery query;
|
||||||
@@ -2324,8 +2374,7 @@ public class ActivitiWorkflowEngine extends BPMEngine implements WorkflowEngine
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
List<HistoricProcessInstance> completedInstances = query.list();
|
return query;
|
||||||
return typeConverter.convert(completedInstances);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -876,8 +876,16 @@ public class JBPMEngine extends AlfrescoBpmEngine implements WorkflowEngine
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<WorkflowInstance> getWorkflows(final WorkflowInstanceQuery query)
|
public List<WorkflowInstance> getWorkflows(WorkflowInstanceQuery workflowInstanceQuery)
|
||||||
{
|
{
|
||||||
|
return getWorkflows(workflowInstanceQuery, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<WorkflowInstance> getWorkflows(final WorkflowInstanceQuery query, int maxItems, int skipCount)
|
||||||
|
{
|
||||||
|
// MNT-9074 My Tasks fails to render if tasks quantity is excessive
|
||||||
|
// here don't use maxItems and skipCount
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
List<ProcessInstance> instances = getProcessInstances(query);
|
List<ProcessInstance> instances = getProcessInstances(query);
|
||||||
@@ -891,6 +899,13 @@ public class JBPMEngine extends AlfrescoBpmEngine implements WorkflowEngine
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public long countWorkflows(WorkflowInstanceQuery workflowInstanceQuery)
|
||||||
|
{
|
||||||
|
// MNT-9074 My Tasks fails to render if tasks quantity is excessive
|
||||||
|
return getWorkflows(workflowInstanceQuery).size();
|
||||||
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
private List<ProcessInstance> getProcessInstances(final WorkflowInstanceQuery query)
|
private List<ProcessInstance> getProcessInstances(final WorkflowInstanceQuery query)
|
||||||
{
|
{
|
||||||
|
@@ -245,6 +245,25 @@ public interface WorkflowService
|
|||||||
*/
|
*/
|
||||||
public List<WorkflowInstance> getWorkflows(WorkflowInstanceQuery workflowInstanceQuery);
|
public List<WorkflowInstance> getWorkflows(WorkflowInstanceQuery workflowInstanceQuery);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets maxItems "in-flight" workflow instances according to the specified workflowInstanceQuery parameter
|
||||||
|
* Get maxItems and skipCount parameters form request
|
||||||
|
*
|
||||||
|
* @param workflowInstanceQuery
|
||||||
|
* @param maxItems
|
||||||
|
* @param skipCount
|
||||||
|
* @return maxItems workflow instances
|
||||||
|
*/
|
||||||
|
public List<WorkflowInstance> getWorkflows(WorkflowInstanceQuery workflowInstanceQuery, int maxItems, int skipCount);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get count of workflow instances
|
||||||
|
*
|
||||||
|
* @param workflowInstanceQuery
|
||||||
|
* @return count of workflow instances
|
||||||
|
*/
|
||||||
|
public long countWorkflows(WorkflowInstanceQuery workflowInstanceQuery);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets all active workflow instances.
|
* Gets all active workflow instances.
|
||||||
*
|
*
|
||||||
|
Reference in New Issue
Block a user