mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-21 18:09:20 +00:00
Merged 5.2.N (5.2.1) to HEAD (5.2)
128985 amorarasu: Merged 5.1.N (5.1.2) to 5.2.N (5.2.1) 128984 amorarasu: MNT-16469: Merged 5.0.N (5.0.4) to 5.1.N (5.1.2) 128478 amorarasu: MNT-16468: Merged V4.2-BUG-FIX (4.2.7) to 5.0.N (5.0.4) 128228, 128380 amorarasu: MNT-16439: Merged V4.2.4 (4.2.4.23) to V4.2-BUG-FIX (4.2.7) 128107 amorarasu: MNT-16040: skipCount does not appear to work for Workflow tasks REST api - Updated Activiti to version 5.19.0.3 git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@128986 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -1011,6 +1011,7 @@
|
|||||||
<property name="messageService" ref="messageService" />
|
<property name="messageService" ref="messageService" />
|
||||||
<property name="personService" ref="PersonService" />
|
<property name="personService" ref="PersonService" />
|
||||||
<property name="propertyConverter" ref="activitiPropertyConverter" />
|
<property name="propertyConverter" ref="activitiPropertyConverter" />
|
||||||
|
<property name="taskVariablesLimit" value="${system.workflow.engine.activiti.taskvariableslimit}" />
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
<bean id="Tasks" class="org.springframework.aop.framework.ProxyFactoryBean">
|
<bean id="Tasks" class="org.springframework.aop.framework.ProxyFactoryBean">
|
||||||
|
@@ -138,6 +138,7 @@ public class TasksImpl extends WorkflowRestImpl implements Tasks
|
|||||||
private MessageService messageService;
|
private MessageService messageService;
|
||||||
private PersonService personService;
|
private PersonService personService;
|
||||||
private ActivitiPropertyConverter propertyConverter;
|
private ActivitiPropertyConverter propertyConverter;
|
||||||
|
private int taskVariablesLimit = 20000;
|
||||||
|
|
||||||
public void setPropertyConverter(ActivitiPropertyConverter propertyConverter)
|
public void setPropertyConverter(ActivitiPropertyConverter propertyConverter)
|
||||||
{
|
{
|
||||||
@@ -159,6 +160,16 @@ public class TasksImpl extends WorkflowRestImpl implements Tasks
|
|||||||
this.personService = personService;
|
this.personService = personService;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getTaskVariablesLimit()
|
||||||
|
{
|
||||||
|
return taskVariablesLimit;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTaskVariablesLimit(int taskVariablesLimit)
|
||||||
|
{
|
||||||
|
this.taskVariablesLimit = taskVariablesLimit;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CollectionWithPagingInfo<Task> getTasks(Parameters parameters)
|
public CollectionWithPagingInfo<Task> getTasks(Parameters parameters)
|
||||||
{
|
{
|
||||||
@@ -293,6 +304,9 @@ public class TasksImpl extends WorkflowRestImpl implements Tasks
|
|||||||
query.includeTaskLocalVariables();
|
query.includeTaskLocalVariables();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// use the limit set in alfresco-global.properties
|
||||||
|
query.limitTaskVariables(taskVariablesLimit);
|
||||||
|
|
||||||
List<QueryVariableHolder> variableProperties = propertyWalker.getVariableProperties();
|
List<QueryVariableHolder> variableProperties = propertyWalker.getVariableProperties();
|
||||||
setQueryUsingVariables(query, variableProperties);
|
setQueryUsingVariables(query, variableProperties);
|
||||||
|
|
||||||
|
@@ -1995,6 +1995,81 @@ public class TaskWorkflowApiTest extends EnterpriseWorkflowTestApi
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testGetTasksWithPagingAndVariablesLimit() throws Exception
|
||||||
|
{
|
||||||
|
RequestContext requestContext = initApiClientWithTestUser();
|
||||||
|
List<ProcessInstance> startedProcesses = new ArrayList<ProcessInstance>();
|
||||||
|
|
||||||
|
// system.workflow.engine.activiti.taskvariableslimit is set to 200 in test-resources/alfresco-global.properties
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// MNT-16040: Create tasks with a number of variables just below the taskvariableslimit and test that skipCount is working as expected.
|
||||||
|
int numberOfTasks = 15;
|
||||||
|
for (int i = 0; i < numberOfTasks; i++)
|
||||||
|
{
|
||||||
|
startedProcesses.add(startAdhocProcess(requestContext.getRunAsUser(), requestContext.getNetworkId(), null));
|
||||||
|
}
|
||||||
|
TaskService taskService = activitiProcessEngine.getTaskService();
|
||||||
|
List<Task> taskList = new ArrayList<Task>();
|
||||||
|
for (int i = 0; i < numberOfTasks; i++)
|
||||||
|
{
|
||||||
|
Task task = taskService.createTaskQuery().processInstanceId(startedProcesses.get(i).getProcessInstanceId()).singleResult();
|
||||||
|
taskService.setPriority(task.getId(), (i + 1) * 10);
|
||||||
|
|
||||||
|
// Add an extra variable to the task, there are other 12 added, so a total of 13 variables for each task.
|
||||||
|
taskService.setVariableLocal(task.getId(), "test1", "test1");
|
||||||
|
taskList.add(task);
|
||||||
|
}
|
||||||
|
|
||||||
|
TasksClient tasksClient = publicApiClient.tasksClient();
|
||||||
|
|
||||||
|
// Test without skipCount
|
||||||
|
Map<String, String> params = new HashMap<String, String>();
|
||||||
|
params.put("where", "(includeProcessVariables = true AND includeTaskVariables = true)");
|
||||||
|
JSONObject taskListJSONObject = tasksClient.findTasks(params);
|
||||||
|
assertNotNull(taskListJSONObject);
|
||||||
|
JSONObject paginationJSON = (JSONObject) taskListJSONObject.get("pagination");
|
||||||
|
assertEquals(15l, paginationJSON.get("count"));
|
||||||
|
assertEquals(15l, paginationJSON.get("totalItems"));
|
||||||
|
assertEquals(0l, paginationJSON.get("skipCount"));
|
||||||
|
assertEquals(false, paginationJSON.get("hasMoreItems"));
|
||||||
|
JSONArray jsonEntries = (JSONArray) taskListJSONObject.get("entries");
|
||||||
|
assertEquals(15, jsonEntries.size());
|
||||||
|
|
||||||
|
// Test with skipCount
|
||||||
|
params.clear();
|
||||||
|
params.put("skipCount", "5");
|
||||||
|
params.put("where", "(includeProcessVariables = true AND includeTaskVariables = true)");
|
||||||
|
taskListJSONObject = tasksClient.findTasks(params);
|
||||||
|
assertNotNull(taskListJSONObject);
|
||||||
|
paginationJSON = (JSONObject) taskListJSONObject.get("pagination");
|
||||||
|
assertEquals(10l, paginationJSON.get("count"));
|
||||||
|
assertEquals(15l, paginationJSON.get("totalItems"));
|
||||||
|
assertEquals(5l, paginationJSON.get("skipCount"));
|
||||||
|
assertEquals(false, paginationJSON.get("hasMoreItems"));
|
||||||
|
jsonEntries = (JSONArray) taskListJSONObject.get("entries");
|
||||||
|
assertEquals(10, jsonEntries.size());
|
||||||
|
|
||||||
|
params.clear();
|
||||||
|
params.put("maxItems", "10");
|
||||||
|
params.put("where", "(includeProcessVariables = true AND includeTaskVariables = true)");
|
||||||
|
taskListJSONObject = tasksClient.findTasks(params);
|
||||||
|
assertNotNull(taskListJSONObject);
|
||||||
|
paginationJSON = (JSONObject) taskListJSONObject.get("pagination");
|
||||||
|
assertEquals(10l, paginationJSON.get("count"));
|
||||||
|
assertEquals(15l, paginationJSON.get("totalItems"));
|
||||||
|
assertEquals(0l, paginationJSON.get("skipCount"));
|
||||||
|
assertEquals(true, paginationJSON.get("hasMoreItems"));
|
||||||
|
jsonEntries = (JSONArray) taskListJSONObject.get("entries");
|
||||||
|
assertEquals(10, jsonEntries.size());
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
cleanupProcessInstance(startedProcesses.toArray(new ProcessInstance[] {}));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
protected void validateVariables(JSONObject entry, RequestContext requestContext) {
|
protected void validateVariables(JSONObject entry, RequestContext requestContext) {
|
||||||
JSONObject taskObject = (JSONObject) entry.get("entry");
|
JSONObject taskObject = (JSONObject) entry.get("entry");
|
||||||
JSONArray variables = (JSONArray) taskObject.get("variables");
|
JSONArray variables = (JSONArray) taskObject.get("variables");
|
||||||
|
@@ -1,2 +1,4 @@
|
|||||||
opencmis.tck.readtimeout=10000
|
opencmis.tck.readtimeout=10000
|
||||||
opencmis.tck.connecttimeout=10000
|
opencmis.tck.connecttimeout=10000
|
||||||
|
|
||||||
|
system.workflow.engine.activiti.taskvariableslimit=200
|
Reference in New Issue
Block a user