提交 f9e08d9e 编写于 作者: T Tijs Rademakers

Merge PR #1014 to activiti6 branch

上级 47f95fe1
......@@ -115,6 +115,9 @@ public class HistoricTaskInstanceBaseResource {
if (queryRequest.getTaskDefinitionKeyLike() != null) {
query.taskDefinitionKeyLike(queryRequest.getTaskDefinitionKeyLike());
}
if (queryRequest.getTaskCategory() != null) {
query.taskCategory(queryRequest.getTaskCategory());
}
if (queryRequest.getTaskDeleteReason() != null) {
query.taskDeleteReason(queryRequest.getTaskDeleteReason());
}
......
......@@ -57,7 +57,7 @@ public class HistoricTaskInstanceCollectionResource extends HistoricTaskInstance
}
if (allRequestParams.get("processDefinitionKeyLike") != null) {
queryRequest.setProcessDefinitionKeyLike(allRequestParams.get("processDefinitionKeyLike"));
queryRequest.setProcessDefinitionKeyLike(allRequestParams.get("processDefinitionKeyLike"));
}
if (allRequestParams.get("processDefinitionId") != null) {
......@@ -67,9 +67,9 @@ public class HistoricTaskInstanceCollectionResource extends HistoricTaskInstance
if (allRequestParams.get("processDefinitionName") != null) {
queryRequest.setProcessDefinitionName(allRequestParams.get("processDefinitionName"));
}
if (allRequestParams.get("processDefinitionNameLike") != null) {
queryRequest.setProcessDefinitionNameLike(allRequestParams.get("processDefinitionNameLike"));
}
if (allRequestParams.get("executionId") != null) {
......@@ -95,6 +95,10 @@ public class HistoricTaskInstanceCollectionResource extends HistoricTaskInstance
if (allRequestParams.get("taskDefinitionKey") != null) {
queryRequest.setTaskDefinitionKey(allRequestParams.get("taskDefinitionKey"));
}
if (allRequestParams.containsKey("taskCategory")) {
queryRequest.setTaskCategory(allRequestParams.get("taskCategory"));
}
if (allRequestParams.get("taskDeleteReason") != null) {
queryRequest.setTaskDeleteReason(allRequestParams.get("taskDeleteReason"));
......
......@@ -43,6 +43,7 @@ public class HistoricTaskInstanceQueryRequest extends PaginateRequest {
private String taskDescriptionLike;
private String taskDefinitionKey;
private String taskDefinitionKeyLike;
private String taskCategory;
private String taskDeleteReason;
private String taskDeleteReasonLike;
private String taskAssignee;
......@@ -203,6 +204,14 @@ public class HistoricTaskInstanceQueryRequest extends PaginateRequest {
this.taskDefinitionKeyLike = taskDefinitionKeyLike;
}
public String getTaskCategory() {
return taskCategory;
}
public void setTaskCategory(String taskCategory) {
this.taskCategory = taskCategory;
}
public String getTaskDeleteReason() {
return taskDeleteReason;
}
......
......@@ -287,6 +287,10 @@ public class TaskBaseResource {
if (request.getCandidateOrAssigned() != null) {
taskQuery.taskCandidateOrAssigned(request.getCandidateOrAssigned());
}
if (request.getCategory() != null) {
taskQuery.taskCategory(request.getCategory());
}
return new TaskPaginateList(restResponseFactory).paginateList(requestParams, request, taskQuery, "id", properties);
}
......
......@@ -215,6 +215,10 @@ public class TaskCollectionResource extends TaskBaseResource {
if (requestParams.containsKey("candidateOrAssigned")) {
request.setCandidateOrAssigned(requestParams.get("candidateOrAssigned"));
}
if (requestParams.containsKey("category")) {
request.setCategory(requestParams.get("category"));
}
return getTasksFromQueryRequest(request, requestParams);
}
......
......@@ -70,6 +70,7 @@ public class TaskQueryRequest extends PaginateRequest {
private String tenantIdLike;
private Boolean withoutTenantId;
private String candidateOrAssigned;
private String category;
private List<QueryVariable> taskVariables;
private List<QueryVariable> processInstanceVariables;
......@@ -435,4 +436,12 @@ public class TaskQueryRequest extends PaginateRequest {
public void setCandidateOrAssigned(String candidateOrAssigned) {
this.candidateOrAssigned = candidateOrAssigned;
}
public String getCategory() {
return category;
}
public void setCategory(String category) {
this.category = category;
}
}
......@@ -137,6 +137,7 @@ public class TaskCollectionResourceTest extends BaseSpringRestTestCase {
adhocTask.setName("Name one");
adhocTask.setDueDate(adhocTaskCreate.getTime());
adhocTask.setPriority(100);
adhocTask.setCategory("some-category");
taskService.saveTask(adhocTask);
taskService.addUserIdentityLink(adhocTask.getId(), "misspiggy", IdentityLinkType.PARTICIPANT);
......@@ -307,6 +308,10 @@ public class TaskCollectionResourceTest extends BaseSpringRestTestCase {
// Tenant id like filtering
url = RestUrls.createRelativeResourceUrl(RestUrls.URL_TASK_COLLECTION) + "?tenantIdLike=" + encode("%enant");
assertResultsPresentInDataResponse(url, processTask.getId());
// Category filtering
url = RestUrls.createRelativeResourceUrl(RestUrls.URL_TASK_COLLECTION) + "?category=" + encode("some-category");
assertResultsPresentInDataResponse(url, adhocTask.getId());
// Suspend process-instance to have a supended task
runtimeService.suspendProcessInstanceById(processInstance.getId());
......
......@@ -65,6 +65,7 @@ public class TaskQueryResourceTest extends BaseSpringRestTestCase {
adhocTask.setDueDate(adhocTaskCreate.getTime());
adhocTask.setPriority(100);
adhocTask.setFormKey("myForm.json");
adhocTask.setCategory("some-category");
taskService.saveTask(adhocTask);
taskService.addUserIdentityLink(adhocTask.getId(), "misspiggy", IdentityLinkType.PARTICIPANT);
......@@ -269,6 +270,11 @@ public class TaskQueryResourceTest extends BaseSpringRestTestCase {
requestNode.removeAll();
requestNode.put("active", true);
assertResultsPresentInPostDataResponse(url, requestNode, adhocTask.getId());
// Filtering by category
requestNode.removeAll();
requestNode.put("category", "someCategory");
assertResultsPresentInPostDataResponse(url, requestNode);
// Filtering without duedate
requestNode.removeAll();
......
......@@ -3060,6 +3060,7 @@ GET runtime/tasks
|tenantIdLike|No|String|Only return tasks with a tenantId like the given value.
|withoutTenantId|No|Boolean|If +true+, only returns tasks without a tenantId set. If +false+, the +withoutTenantId+ parameter is ignored.
|candidateOrAssigned|No|String|Select tasks that has been claimed or assigned to user or waiting to claim by user (candidate user or groups).
|category|No|string|Select tasks with the given category. Note that this is the task category, not the category of the process definition (namespace within the BPMN Xml).
|The general <<restPagingAndSort,paging and sorting query-parameters>> can be used for this URL.
|===============
......@@ -5072,6 +5073,7 @@ GET history/historic-task-instances
|taskDescription|No|String|The task description of the historic task instance.
|taskDescriptionLike|No|String|The task description with 'like' operator for the historic task instance.
|taskDefinitionKey|No|String|The task identifier from the process definition for the historic task instance.
|taskCategory|No|String|Select tasks with the given category. Note that this is the task category, not the category of the process definition (namespace within the BPMN Xml).
|taskDeleteReason|No|String|The task delete reason of the historic task instance.
|taskDeleteReasonLike|No|String|The task delete reason with 'like' operator for the historic task instance.
|taskAssignee|No|String|The assignee of the historic task instance.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册