From 91a949f8420c4c417f89c17fec5f11a7b379c980 Mon Sep 17 00:00:00 2001 From: BerndBreier <33351391+BerndBreier@users.noreply.github.com> Date: Tue, 6 Feb 2018 14:40:42 +0100 Subject: [PATCH] TSK-48 Sort the results of a task query --- .../src/main/java/pro/taskana/BaseQuery.java | 11 + .../src/main/java/pro/taskana/TaskQuery.java | 310 ++++++++++++++++++ .../java/pro/taskana/impl/TaskQueryImpl.java | 178 ++++++++++ .../taskana/model/mappings/QueryMapper.java | 2 +- .../acceptance/task/DeleteTaskAccTest.java | 4 +- .../QueryTasksByObjectReferenceAccTest.java | 6 +- .../task/QueryTasksByWorkbasketAccTest.java | 2 +- .../task/QueryTasksWithSortingAccTest.java | 228 +++++++++++++ .../acceptance/task/TransferTaskAccTest.java | 4 +- .../QueryWorkbasketByPermissionAccTest.java | 8 +- ...QueryWorkbasketsWithPaginationAccTest.java | 6 +- .../src/test/resources/sql/task.sql | 46 ++- .../resources/sql/workbasket-access-list.sql | 1 + .../src/test/resources/sql/workbasket.sql | 1 + 14 files changed, 781 insertions(+), 26 deletions(-) create mode 100644 lib/taskana-core/src/test/java/acceptance/task/QueryTasksWithSortingAccTest.java diff --git a/lib/taskana-core/src/main/java/pro/taskana/BaseQuery.java b/lib/taskana-core/src/main/java/pro/taskana/BaseQuery.java index d8a8090a0..8a6fe0766 100644 --- a/lib/taskana-core/src/main/java/pro/taskana/BaseQuery.java +++ b/lib/taskana-core/src/main/java/pro/taskana/BaseQuery.java @@ -70,4 +70,15 @@ public interface BaseQuery { * @return resultRowCount */ long count() throws NotAuthorizedException; + + /** + * Determines the sort direction. + * + * @author bbr + */ + enum SortDirection { + ASCENDING, + DESCENDING + } + } diff --git a/lib/taskana-core/src/main/java/pro/taskana/TaskQuery.java b/lib/taskana-core/src/main/java/pro/taskana/TaskQuery.java index 7b64d30eb..acfe21e97 100644 --- a/lib/taskana-core/src/main/java/pro/taskana/TaskQuery.java +++ b/lib/taskana-core/src/main/java/pro/taskana/TaskQuery.java @@ -221,4 +221,314 @@ public interface TaskQuery extends BaseQuery { * @return a {@link ObjectReferenceQuery} */ ObjectReferenceQuery createObjectReferenceQuery(); + + /** + * This method sorts the query result according to the business process id. + * + * @param sortDirection + * Determines whether the result is sorted in ascending or descending order. If sortDirection is null, + * the result is sorted in ascending order + * @return the query + */ + TaskQuery orderByBusinessProcessId(SortDirection sortDirection); + + /** + * This method sorts the query result according to the claimed timestamp. + * + * @param sortDirection + * Determines whether the result is sorted in ascending or descending order. If sortDirection is null, + * the result is sorted in ascending order + * @return the query + */ + TaskQuery orderByClaimed(SortDirection sortDirection); + + /** + * This method sorts the query result according to the classification key. + * + * @param sortDirection + * Determines whether the result is sorted in ascending or descending order. If sortDirection is null, + * the result is sorted in ascending order + * @return the query + */ + TaskQuery orderByClassificationKey(SortDirection sortDirection); + + /** + * This method sorts the query result according to the completed timestamp. + * + * @param sortDirection + * Determines whether the result is sorted in ascending or descending order. If sortDirection is null, + * the result is sorted in ascending order + * @return the query + */ + TaskQuery orderByCompleted(SortDirection sortDirection); + + /** + * This method sorts the query result according to the created timestamp. + * + * @param sortDirection + * Determines whether the result is sorted in ascending or descending order. If sortDirection is null, + * the result is sorted in ascending order + * @return the query + */ + TaskQuery orderByCreated(SortDirection sortDirection); + + /** + * This method sorts the query result according to the domain. + * + * @param sortDirection + * Determines whether the result is sorted in ascending or descending order. If sortDirection is null, + * the result is sorted in ascending order + * @return the query + */ + TaskQuery orderByDomain(SortDirection sortDirection); + + /** + * This method sorts the query result according to the due timestamp. + * + * @param sortDirection + * Determines whether the result is sorted in ascending or descending order. If sortDirection is null, + * the result is sorted in ascending order + * @return the query + */ + TaskQuery orderByDue(SortDirection sortDirection); + + /** + * This method sorts the query result according to the modified timestamp. + * + * @param sortDirection + * Determines whether the result is sorted in ascending or descending order. If sortDirection is null, + * the result is sorted in ascending order + * @return the query + */ + TaskQuery orderByModified(SortDirection sortDirection); + + /** + * This method sorts the query result according to name. + * + * @param sortDirection + * Determines whether the result is sorted in ascending or descending order. If sortDirection is null, + * the result is sorted in ascending order + * @return the query + */ + TaskQuery orderByName(SortDirection sortDirection); + + /** + * This method sorts the query result according to the note. + * + * @param sortDirection + * Determines whether the result is sorted in ascending or descending order. If sortDirection is null, + * the result is sorted in ascending order + * @return the query + */ + TaskQuery orderByNote(SortDirection sortDirection); + + /** + * This method sorts the query result according to the owner. + * + * @param sortDirection + * Determines whether the result is sorted in ascending or descending order. If sortDirection is null, + * the result is sorted in ascending order + * @return the query + */ + TaskQuery orderByOwner(SortDirection sortDirection); + + /** + * This method sorts the query result according to the parent business process id. + * + * @param sortDirection + * Determines whether the result is sorted in ascending or descending order. If sortDirection is null, + * the result is sorted in ascending order + * @return the query + */ + TaskQuery orderByParentBusinessProcessId(SortDirection sortDirection); + + /** + * This method sorts the query result according to the planned timestamp. + * + * @param sortDirection + * Determines whether the result is sorted in ascending or descending order. If sortDirection is null, + * the result is sorted in ascending order + * @return the query + */ + TaskQuery orderByPlanned(SortDirection sortDirection); + + /** + * This method sorts the query result according to the company of the primary object reference. + * + * @param sortDirection + * Determines whether the result is sorted in ascending or descending order. If sortDirection is null, + * the result is sorted in ascending order + * @return the query + */ + TaskQuery orderByPrimaryObjectReferenceCompany(SortDirection sortDirection); + + /** + * This method sorts the query result according to the system of the primary object reference. + * + * @param sortDirection + * Determines whether the result is sorted in ascending or descending order. If sortDirection is null, + * the result is sorted in ascending order + * @return the query + */ + TaskQuery orderByPrimaryObjectReferenceSystem(SortDirection sortDirection); + + /** + * This method sorts the query result according to the system instance of the primary object reference. + * + * @param sortDirection + * Determines whether the result is sorted in ascending or descending order. If sortDirection is null, + * the result is sorted in ascending order + * @return the query + */ + TaskQuery orderByPrimaryObjectReferenceSystemInstance(SortDirection sortDirection); + + /** + * This method sorts the query result according to the type of the primary object reference. + * + * @param sortDirection + * Determines whether the result is sorted in ascending or descending order. If sortDirection is null, + * the result is sorted in ascending order + * @return the query + */ + TaskQuery orderByPrimaryObjectReferenceType(SortDirection sortDirection); + + /** + * This method sorts the query result according to the value of the primary object reference. + * + * @param sortDirection + * Determines whether the result is sorted in ascending or descending order. If sortDirection is null, + * the result is sorted in ascending order + * @return the query + */ + TaskQuery orderByPrimaryObjectReferenceValue(SortDirection sortDirection); + + /** + * This method sorts the query result according to the priority. + * + * @param sortDirection + * Determines whether the result is sorted in ascending or descending order. If sortDirection is null, + * the result is sorted in ascending order + * @return the query + */ + TaskQuery orderByPriority(SortDirection sortDirection); + + /** + * This method sorts the query result according to the state. + * + * @param sortDirection + * Determines whether the result is sorted in ascending or descending order. If sortDirection is null, + * the result is sorted in ascending order + * @return the query + */ + TaskQuery orderByState(SortDirection sortDirection); + + /** + * This method sorts the query result according to the workbasket key. + * + * @param sortDirection + * Determines whether the result is sorted in ascending or descending order. If sortDirection is null, + * the result is sorted in ascending order + * @return the query + */ + TaskQuery orderByWorkbasketKey(SortDirection sortDirection); + + /** + * This method sorts the query result according to the custom1 value. + * + * @param sortDirection + * Determines whether the result is sorted in ascending or descending order. If sortDirection is null, + * the result is sorted in ascending order + * @return the query + */ + TaskQuery orderByCustom1(SortDirection sortDirection); + + /** + * This method sorts the query result according to the custom2 value. + * + * @param sortDirection + * Determines whether the result is sorted in ascending or descending order. If sortDirection is null, + * the result is sorted in ascending order + * @return the query + */ + TaskQuery orderByCustom2(SortDirection sortDirection); + + /** + * This method sorts the query result according to the custom3 value. + * + * @param sortDirection + * Determines whether the result is sorted in ascending or descending order. If sortDirection is null, + * the result is sorted in ascending order + * @return the query + */ + TaskQuery orderByCustom3(SortDirection sortDirection); + + /** + * This method sorts the query result according to the custom4 value. + * + * @param sortDirection + * Determines whether the result is sorted in ascending or descending order. If sortDirection is null, + * the result is sorted in ascending order + * @return the query + */ + TaskQuery orderByCustom4(SortDirection sortDirection); + + /** + * This method sorts the query result according to the custom5 value. + * + * @param sortDirection + * Determines whether the result is sorted in ascending or descending order. If sortDirection is null, + * the result is sorted in ascending order + * @return the query + */ + TaskQuery orderByCustom5(SortDirection sortDirection); + + /** + * This method sorts the query result according to the custom6 value. + * + * @param sortDirection + * Determines whether the result is sorted in ascending or descending order. If sortDirection is null, + * the result is sorted in ascending order + * @return the query + */ + TaskQuery orderByCustom6(SortDirection sortDirection); + + /** + * This method sorts the query result according to the custom7 value. + * + * @param sortDirection + * Determines whether the result is sorted in ascending or descending order. If sortDirection is null, + * the result is sorted in ascending order + * @return the query + */ + TaskQuery orderByCustom7(SortDirection sortDirection); + + /** + * This method sorts the query result according to the custom8 value. + * + * @param sortDirection + * Determines whether the result is sorted in ascending or descending order. If sortDirection is null, + * the result is sorted in ascending order + * @return the query + */ + TaskQuery orderByCustom8(SortDirection sortDirection); + + /** + * This method sorts the query result according to the custom9 value. + * + * @param sortDirection + * Determines whether the result is sorted in ascending or descending order. If sortDirection is null, + * the result is sorted in ascending order + * @return the query + */ + TaskQuery orderByCustom9(SortDirection sortDirection); + + /** + * This method sorts the query result according to the custom10 value. + * + * @param sortDirection + * Determines whether the result is sorted in ascending or descending order. If sortDirection is null, + * the result is sorted in ascending order + * @return the query + */ + TaskQuery orderByCustom10(SortDirection sortDirection); } diff --git a/lib/taskana-core/src/main/java/pro/taskana/impl/TaskQueryImpl.java b/lib/taskana-core/src/main/java/pro/taskana/impl/TaskQueryImpl.java index 2503022a3..194507014 100644 --- a/lib/taskana-core/src/main/java/pro/taskana/impl/TaskQueryImpl.java +++ b/lib/taskana-core/src/main/java/pro/taskana/impl/TaskQueryImpl.java @@ -51,10 +51,12 @@ public class TaskQueryImpl implements TaskQuery { private String porTypeLike; private String[] porValueIn; private String porValueLike; + private List orderBy; public TaskQueryImpl(TaskanaEngine taskanaEngine) { this.taskanaEngineImpl = (TaskanaEngineImpl) taskanaEngine; this.taskService = (TaskServiceImpl) taskanaEngineImpl.getTaskService(); + this.orderBy = new ArrayList<>(); } @Override @@ -384,11 +386,17 @@ public class TaskQueryImpl implements TaskQuery { return porValueLike; } + public List getOrderBy() { + return orderBy; + } + @Override public String toString() { StringBuilder builder = new StringBuilder(); builder.append("TaskQueryImpl [taskanaEngineImpl="); builder.append(taskanaEngineImpl); + builder.append(", taskService="); + builder.append(taskService); builder.append(", name="); builder.append(Arrays.toString(name)); builder.append(", description="); @@ -403,6 +411,8 @@ public class TaskQueryImpl implements TaskQuery { builder.append(Arrays.toString(classificationKey)); builder.append(", workbasketKey="); builder.append(Arrays.toString(workbasketKey)); + builder.append(", domain="); + builder.append(Arrays.toString(domain)); builder.append(", owner="); builder.append(Arrays.toString(owner)); builder.append(", isRead="); @@ -434,4 +444,172 @@ public class TaskQueryImpl implements TaskQuery { builder.append("]"); return builder.toString(); } + + @Override + public TaskQuery orderByClassificationKey(SortDirection sortDirection) { + return addOrderCriteria("CLASSIFICATION_KEY", true, sortDirection); + } + + @Override + public TaskQuery orderByDomain(SortDirection sortDirection) { + return addOrderCriteria("DOMAIN", true, sortDirection); + } + + @Override + public TaskQuery orderByPlanned(SortDirection sortDirection) { + return addOrderCriteria("PLANNED", false, sortDirection); + } + + @Override + public TaskQuery orderByDue(SortDirection sortDirection) { + return addOrderCriteria("DUE", false, sortDirection); + } + + @Override + public TaskQuery orderByModified(SortDirection sortDirection) { + return addOrderCriteria("MODIFIED", false, sortDirection); + } + + @Override + public TaskQuery orderByName(SortDirection sortDirection) { + return addOrderCriteria("NAME", true, sortDirection); + } + + @Override + public TaskQuery orderByOwner(SortDirection sortDirection) { + return addOrderCriteria("OWNER", true, sortDirection); + } + + @Override + public TaskQuery orderByPrimaryObjectReferenceCompany(SortDirection sortDirection) { + return addOrderCriteria("POR_COMPANY", true, sortDirection); + } + + @Override + public TaskQuery orderByPrimaryObjectReferenceSystem(SortDirection sortDirection) { + return addOrderCriteria("POR_SYSTEM", true, sortDirection); + } + + @Override + public TaskQuery orderByPrimaryObjectReferenceSystemInstance(SortDirection sortDirection) { + return addOrderCriteria("POR_INSTANCE", true, sortDirection); + } + + @Override + public TaskQuery orderByPrimaryObjectReferenceType(SortDirection sortDirection) { + return addOrderCriteria("POR_TYPE", true, sortDirection); + } + + @Override + public TaskQuery orderByPrimaryObjectReferenceValue(SortDirection sortDirection) { + return addOrderCriteria("POR_VALUE", true, sortDirection); + } + + @Override + public TaskQuery orderByPriority(SortDirection sortDirection) { + return addOrderCriteria("PRIORITY", false, sortDirection); + } + + @Override + public TaskQuery orderByState(SortDirection sortDirection) { + return addOrderCriteria("STATE", false, sortDirection); + } + + @Override + public TaskQuery orderByWorkbasketKey(SortDirection sortDirection) { + return addOrderCriteria("WORKBASKET_KEY", true, sortDirection); + } + + @Override + public TaskQuery orderByNote(SortDirection sortDirection) { + return addOrderCriteria("NOTE", true, sortDirection); + } + + @Override + public TaskQuery orderByCustom1(SortDirection sortDirection) { + return addOrderCriteria("CUSTOM_1", true, sortDirection); + } + + @Override + public TaskQuery orderByCustom2(SortDirection sortDirection) { + return addOrderCriteria("CUSTOM_2", true, sortDirection); + } + + @Override + public TaskQuery orderByCustom3(SortDirection sortDirection) { + return addOrderCriteria("CUSTOM_3", true, sortDirection); + } + + @Override + public TaskQuery orderByCustom4(SortDirection sortDirection) { + return addOrderCriteria("CUSTOM_4", true, sortDirection); + } + + @Override + public TaskQuery orderByCustom5(SortDirection sortDirection) { + return addOrderCriteria("CUSTOM_5", true, sortDirection); + } + + @Override + public TaskQuery orderByCustom6(SortDirection sortDirection) { + return addOrderCriteria("CUSTOM_6", true, sortDirection); + } + + @Override + public TaskQuery orderByCustom7(SortDirection sortDirection) { + return addOrderCriteria("CUSTOM_7", true, sortDirection); + } + + @Override + public TaskQuery orderByCustom8(SortDirection sortDirection) { + return addOrderCriteria("CUSTOM_8", true, sortDirection); + } + + @Override + public TaskQuery orderByCustom9(SortDirection sortDirection) { + return addOrderCriteria("CUSTOM_9", true, sortDirection); + } + + @Override + public TaskQuery orderByCustom10(SortDirection sortDirection) { + return addOrderCriteria("CUSTOM_10", true, sortDirection); + } + + @Override + public TaskQuery orderByBusinessProcessId(SortDirection sortDirection) { + return addOrderCriteria("BUSINESS_PROCESS_ID", true, sortDirection); + } + + @Override + public TaskQuery orderByClaimed(SortDirection sortDirection) { + return addOrderCriteria("CLAIMED", false, sortDirection); + } + + @Override + public TaskQuery orderByCompleted(SortDirection sortDirection) { + return addOrderCriteria("COMPLETED", false, sortDirection); + } + + @Override + public TaskQuery orderByCreated(SortDirection sortDirection) { + return addOrderCriteria("CREATED", false, sortDirection); + } + + @Override + public TaskQuery orderByParentBusinessProcessId(SortDirection sortDirection) { + return addOrderCriteria("PARENT_BUSINESS_PROCESS_ID", true, sortDirection); + } + + private TaskQuery addOrderCriteria(String columnName, boolean useUpper, SortDirection sortDirection) { + String orderByDirection = " ASC"; + if (sortDirection != null && SortDirection.DESCENDING.equals(sortDirection)) { + orderByDirection = " DESC"; + } + if (useUpper) { + orderBy.add("UPPER(" + columnName + ")" + orderByDirection); + } else { + orderBy.add(columnName + orderByDirection); + } + return this; + } } diff --git a/lib/taskana-core/src/main/java/pro/taskana/model/mappings/QueryMapper.java b/lib/taskana-core/src/main/java/pro/taskana/model/mappings/QueryMapper.java index 827496311..7c0062cf9 100644 --- a/lib/taskana-core/src/main/java/pro/taskana/model/mappings/QueryMapper.java +++ b/lib/taskana-core/src/main/java/pro/taskana/model/mappings/QueryMapper.java @@ -51,6 +51,7 @@ public interface QueryMapper { + "AND t.POR_VALUE like #{porValueLike} " + "AND (t.CUSTOM_1 IN(#{item}) OR t.CUSTOM_2 IN(#{item}) OR t.CUSTOM_3 IN(#{item}) OR t.CUSTOM_4 IN(#{item}) OR t.CUSTOM_5 IN(#{item}) OR t.CUSTOM_6 IN(#{item}) OR t.CUSTOM_7 IN(#{item}) OR t.CUSTOM_8 IN(#{item}) OR t.CUSTOM_9 IN(#{item}) OR t.CUSTOM_10 IN(#{item})) " + "" + + "ORDER BY ${item} " + "") @Results(value = {@Result(property = "taskId", column = "ID"), @Result(property = "created", column = "CREATED"), @@ -60,7 +61,6 @@ public interface QueryMapper { @Result(property = "planned", column = "PLANNED"), @Result(property = "due", column = "DUE"), @Result(property = "name", column = "NAME"), - // @Result(property = "description", column = "DESCRIPTION"), @Result(property = "note", column = "NOTE"), @Result(property = "priority", column = "PRIORITY"), @Result(property = "state", column = "STATE"), diff --git a/lib/taskana-core/src/test/java/acceptance/task/DeleteTaskAccTest.java b/lib/taskana-core/src/test/java/acceptance/task/DeleteTaskAccTest.java index ffdaa38f7..9aa05c8bc 100644 --- a/lib/taskana-core/src/test/java/acceptance/task/DeleteTaskAccTest.java +++ b/lib/taskana-core/src/test/java/acceptance/task/DeleteTaskAccTest.java @@ -98,7 +98,7 @@ public class DeleteTaskAccTest extends AbstractAccTest { ConcurrencyException, AttachmentPersistenceException { TaskService taskService = taskanaEngine.getTaskService(); - ArrayList taskIdList = new ArrayList(); + ArrayList taskIdList = new ArrayList<>(); taskIdList.add("TKI:000000000000000000000000000000000037"); taskIdList.add("TKI:000000000000000000000000000000000038"); @@ -119,7 +119,7 @@ public class DeleteTaskAccTest extends AbstractAccTest { ConcurrencyException, AttachmentPersistenceException { TaskService taskService = taskanaEngine.getTaskService(); - ArrayList taskIdList = new ArrayList(); + ArrayList taskIdList = new ArrayList<>(); taskIdList.add("TKI:000000000000000000000000000000000039"); taskIdList.add("TKI:000000000000000000000000000000000040"); taskIdList.add("TKI:000000000000000000000000000000000028"); diff --git a/lib/taskana-core/src/test/java/acceptance/task/QueryTasksByObjectReferenceAccTest.java b/lib/taskana-core/src/test/java/acceptance/task/QueryTasksByObjectReferenceAccTest.java index c07d1cb9b..d55444cef 100644 --- a/lib/taskana-core/src/test/java/acceptance/task/QueryTasksByObjectReferenceAccTest.java +++ b/lib/taskana-core/src/test/java/acceptance/task/QueryTasksByObjectReferenceAccTest.java @@ -31,7 +31,7 @@ public class QueryTasksByObjectReferenceAccTest extends AbstractAccTest { List results = taskService.createTaskQuery() .primaryObjectReferenceValueIn("11223344", "22334455") .list(); - Assert.assertEquals(16L, results.size()); + Assert.assertEquals(32L, results.size()); } @Test @@ -42,7 +42,7 @@ public class QueryTasksByObjectReferenceAccTest extends AbstractAccTest { .primaryObjectReferenceTypeIn("SDNR") .primaryObjectReferenceValueIn("11223344") .list(); - Assert.assertEquals(5L, results.size()); + Assert.assertEquals(10L, results.size()); } @Test @@ -52,7 +52,7 @@ public class QueryTasksByObjectReferenceAccTest extends AbstractAccTest { List results = taskService.createTaskQuery() .primaryObjectReferenceValueLike("%567%") .list(); - Assert.assertEquals(5L, results.size()); + Assert.assertEquals(10L, results.size()); } @AfterClass diff --git a/lib/taskana-core/src/test/java/acceptance/task/QueryTasksByWorkbasketAccTest.java b/lib/taskana-core/src/test/java/acceptance/task/QueryTasksByWorkbasketAccTest.java index 715880bee..3d22cfcb7 100644 --- a/lib/taskana-core/src/test/java/acceptance/task/QueryTasksByWorkbasketAccTest.java +++ b/lib/taskana-core/src/test/java/acceptance/task/QueryTasksByWorkbasketAccTest.java @@ -60,7 +60,7 @@ public class QueryTasksByWorkbasketAccTest extends AbstractAccTest { List results = taskService.createTaskQuery() .domainIn("DOMAIN_B", "", "DOMAIN_A") .list(); - assertThat(results.size(), equalTo(45)); + assertThat(results.size(), equalTo(64)); results = taskService.createTaskQuery() .domainIn("DOMAIN_A") diff --git a/lib/taskana-core/src/test/java/acceptance/task/QueryTasksWithSortingAccTest.java b/lib/taskana-core/src/test/java/acceptance/task/QueryTasksWithSortingAccTest.java new file mode 100644 index 000000000..1b2d9078f --- /dev/null +++ b/lib/taskana-core/src/test/java/acceptance/task/QueryTasksWithSortingAccTest.java @@ -0,0 +1,228 @@ +package acceptance.task; + +import static org.hamcrest.core.IsEqual.equalTo; +import static org.junit.Assert.assertThat; + +import java.sql.SQLException; +import java.util.List; + +import org.h2.store.fs.FileUtils; +import org.junit.AfterClass; +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; + +import acceptance.AbstractAccTest; +import pro.taskana.BaseQuery.SortDirection; +import pro.taskana.TaskService; +import pro.taskana.TaskSummary; +import pro.taskana.exceptions.InvalidArgumentException; +import pro.taskana.exceptions.NotAuthorizedException; +import pro.taskana.model.TaskState; +import pro.taskana.security.JAASRunner; +import pro.taskana.security.WithAccessId; + +/** + * Acceptance test for all "query tasks with sorting" scenarios. + */ +@RunWith(JAASRunner.class) +public class QueryTasksWithSortingAccTest extends AbstractAccTest { + + private static SortDirection asc = SortDirection.ASCENDING; + private static SortDirection desc = SortDirection.DESCENDING; + + public QueryTasksWithSortingAccTest() { + super(); + } + + @WithAccessId( + userName = "teamlead_1", + groupNames = {"group_1"}) + @Test + public void testSortByModifiedAndDomain() + throws SQLException, NotAuthorizedException, InvalidArgumentException { + TaskService taskService = taskanaEngine.getTaskService(); + List results = taskService.createTaskQuery() + .workbasketKeyIn("key5") + .orderByModified(desc) + .orderByDomain(null) + .list(); + + assertThat(results.size(), equalTo(25)); + TaskSummary previousSummary = null; + for (TaskSummary taskSummary : results) { + if (previousSummary != null) { + Assert.assertTrue(!previousSummary.getModified().isBefore(taskSummary.getModified())); + } + previousSummary = taskSummary; + } + } + + @WithAccessId( + userName = "teamlead_1", + groupNames = {"group_1"}) + @Test + public void testSortByDomainNameAndCreated() + throws SQLException, NotAuthorizedException, InvalidArgumentException { + TaskService taskService = taskanaEngine.getTaskService(); + List results = taskService.createTaskQuery() + .workbasketKeyIn("key5") + .orderByDomain(asc) + .orderByName(asc) + .orderByCreated(null) + .list(); + + assertThat(results.size(), equalTo(25)); + TaskSummary previousSummary = null; + for (TaskSummary taskSummary : results) { + // System.out.println("domain: " + taskSummary.getDomain() + ", name: " + taskSummary.getName() + ", + // created: " + taskSummary.getCreated()); + if (previousSummary != null) { + Assert.assertTrue(taskSummary.getDomain().compareToIgnoreCase(previousSummary.getDomain()) >= 0); + if (taskSummary.getDomain().equals(previousSummary.getDomain())) { + Assert.assertTrue(taskSummary.getName().compareToIgnoreCase(previousSummary.getName()) >= 0); + if (taskSummary.getName().equals(previousSummary.getName())) { + Assert.assertTrue(!taskSummary.getCreated().isBefore(previousSummary.getCreated())); + } + } + } + previousSummary = taskSummary; + } + } + + @WithAccessId( + userName = "user_1_2", + groupNames = {"group_1"}) + @Test + public void testSortByPorSystemNoteDueAndOwner() + throws SQLException, NotAuthorizedException, InvalidArgumentException { + TaskService taskService = taskanaEngine.getTaskService(); + List results = taskService.createTaskQuery() + .workbasketKeyIn("key5") + .orderByPrimaryObjectReferenceSystem(SortDirection.DESCENDING) + .orderByNote(null) + .orderByDue(null) + .orderByOwner(asc) + .list(); + + assertThat(results.size(), equalTo(25)); + TaskSummary previousSummary = null; + for (TaskSummary taskSummary : results) { + if (previousSummary != null) { + Assert.assertTrue(taskSummary.getPrimaryObjRef().getSystem().compareToIgnoreCase( + previousSummary.getPrimaryObjRef().getSystem()) <= 0); + } + previousSummary = taskSummary; + } + } + + @WithAccessId( + userName = "user_1_2", + groupNames = {"group_1"}) + @Test + public void testSortByPorSystemInstanceParentProcPlannedAndState() + throws SQLException, NotAuthorizedException, InvalidArgumentException { + TaskService taskService = taskanaEngine.getTaskService(); + List results = taskService.createTaskQuery() + .workbasketKeyIn("key5") + .orderByPrimaryObjectReferenceSystemInstance(desc) + .orderByParentBusinessProcessId(asc) + .orderByPlanned(asc) + .orderByState(asc) + .list(); + + assertThat(results.size(), equalTo(25)); + TaskSummary previousSummary = null; + for (TaskSummary taskSummary : results) { + if (previousSummary != null) { + Assert.assertTrue(taskSummary.getPrimaryObjRef().getSystemInstance().compareToIgnoreCase( + previousSummary.getPrimaryObjRef().getSystemInstance()) <= 0); + } + previousSummary = taskSummary; + } + } + + @WithAccessId( + userName = "user_1_2", + groupNames = {"group_1"}) + @Test + public void testSortByPorCompanyAndClaimed() + throws SQLException, NotAuthorizedException, InvalidArgumentException { + TaskService taskService = taskanaEngine.getTaskService(); + List results = taskService.createTaskQuery() + .workbasketKeyIn("key5") + .orderByPrimaryObjectReferenceCompany(desc) + .orderByClaimed(asc) + .list(); + + assertThat(results.size(), equalTo(25)); + TaskSummary previousSummary = null; + for (TaskSummary taskSummary : results) { + // System.out.println("porCompany: " + taskSummary.getPrimaryObjRef().getCompany() + ", claimed: " + // + taskSummary.getClaimed()); + if (previousSummary != null) { + Assert.assertTrue(taskSummary.getPrimaryObjRef().getCompany().compareToIgnoreCase( + previousSummary.getPrimaryObjRef().getCompany()) <= 0); + } + previousSummary = taskSummary; + } + } + + @WithAccessId( + userName = "teamlead_1", + groupNames = {"group_1", "group2"}) + @Test + public void testSortByWbKeyPrioPorValueAndCompleted() + throws SQLException, NotAuthorizedException, InvalidArgumentException { + TaskService taskService = taskanaEngine.getTaskService(); + List results = taskService.createTaskQuery() + .stateIn(TaskState.READY) + .orderByWorkbasketKey(null) + .workbasketKeyIn("key5") + .orderByPriority(desc) + .orderByPrimaryObjectReferenceValue(asc) + .orderByCompleted(desc) + .list(); + + assertThat(results.size(), equalTo(22)); + TaskSummary previousSummary = null; + for (TaskSummary taskSummary : results) { + if (previousSummary != null) { + Assert.assertTrue(taskSummary.getWorkbasketSummary().getKey().compareToIgnoreCase( + previousSummary.getWorkbasketSummary().getKey()) >= 0); + } + previousSummary = taskSummary; + } + } + + @WithAccessId( + userName = "teamlead_1", + groupNames = {"group_1", "group2"}) + @Test + public void testSortBpIdClassificationIdDescriptionAndPorType() + throws SQLException, NotAuthorizedException, InvalidArgumentException { + TaskService taskService = taskanaEngine.getTaskService(); + List results = taskService.createTaskQuery() + .stateIn(TaskState.READY) + .workbasketKeyIn("key5") + .orderByBusinessProcessId(asc) + .orderByClassificationKey(null) + .orderByPrimaryObjectReferenceType(SortDirection.DESCENDING) + .list(); + + assertThat(results.size(), equalTo(22)); + TaskSummary previousSummary = null; + for (TaskSummary taskSummary : results) { + if (previousSummary != null) { + Assert.assertTrue(taskSummary.getBusinessProcessId().compareToIgnoreCase( + previousSummary.getBusinessProcessId()) >= 0); + } + previousSummary = taskSummary; + } + } + + @AfterClass + public static void cleanUpClass() { + FileUtils.deleteRecursive("~/data", true); + } +} diff --git a/lib/taskana-core/src/test/java/acceptance/task/TransferTaskAccTest.java b/lib/taskana-core/src/test/java/acceptance/task/TransferTaskAccTest.java index c9699f717..0552f7ba6 100644 --- a/lib/taskana-core/src/test/java/acceptance/task/TransferTaskAccTest.java +++ b/lib/taskana-core/src/test/java/acceptance/task/TransferTaskAccTest.java @@ -116,7 +116,7 @@ public class TransferTaskAccTest extends AbstractAccTest { WorkbasketNotFoundException, TaskAlreadyExistException, InvalidWorkbasketException, TaskNotFoundException, InvalidStateException, InvalidOwnerException { TaskService taskService = taskanaEngine.getTaskService(); - ArrayList taskIdList = new ArrayList(); + ArrayList taskIdList = new ArrayList<>(); taskIdList.add("TKI:000000000000000000000000000000000004"); taskIdList.add("TKI:000000000000000000000000000000000005"); @@ -144,7 +144,7 @@ public class TransferTaskAccTest extends AbstractAccTest { WorkbasketNotFoundException, TaskAlreadyExistException, InvalidWorkbasketException, TaskNotFoundException, InvalidStateException, InvalidOwnerException { TaskService taskService = taskanaEngine.getTaskService(); - ArrayList taskIdList = new ArrayList(); + ArrayList taskIdList = new ArrayList<>(); taskIdList.add("TKI:000000000000000000000000000000000006"); taskIdList.add("TKI:000000000000000000000000000000000002"); diff --git a/lib/taskana-core/src/test/java/acceptance/workbasket/QueryWorkbasketByPermissionAccTest.java b/lib/taskana-core/src/test/java/acceptance/workbasket/QueryWorkbasketByPermissionAccTest.java index 3f24033f9..cebb2c998 100644 --- a/lib/taskana-core/src/test/java/acceptance/workbasket/QueryWorkbasketByPermissionAccTest.java +++ b/lib/taskana-core/src/test/java/acceptance/workbasket/QueryWorkbasketByPermissionAccTest.java @@ -48,7 +48,7 @@ public class QueryWorkbasketByPermissionAccTest extends AbstractAccTest { List results = workbasketService.createWorkbasketQuery() .accessIdsHavePermission(WorkbasketAuthorization.APPEND, "user_1_1", "group_1") .list(); - Assert.assertEquals(8, results.size()); + Assert.assertEquals(9, results.size()); } @Test @@ -61,7 +61,7 @@ public class QueryWorkbasketByPermissionAccTest extends AbstractAccTest { .orderByName() .ascending() .list(); - Assert.assertEquals(8, results.size()); + Assert.assertEquals(9, results.size()); Assert.assertEquals("key4", results.get(0).getKey()); } @@ -77,7 +77,7 @@ public class QueryWorkbasketByPermissionAccTest extends AbstractAccTest { .orderByKey() .ascending() .list(); - Assert.assertEquals(8, results.size()); + Assert.assertEquals(9, results.size()); Assert.assertEquals("USER_2_2", results.get(0).getKey()); } @@ -91,7 +91,7 @@ public class QueryWorkbasketByPermissionAccTest extends AbstractAccTest { List results = workbasketService.createWorkbasketQuery() .callerHasPermission(WorkbasketAuthorization.APPEND) .list(); - Assert.assertEquals(8, results.size()); + Assert.assertEquals(9, results.size()); } @WithAccessId(userName = "user_1_1") diff --git a/lib/taskana-core/src/test/java/acceptance/workbasket/QueryWorkbasketsWithPaginationAccTest.java b/lib/taskana-core/src/test/java/acceptance/workbasket/QueryWorkbasketsWithPaginationAccTest.java index 4b56ec0b5..829536f70 100644 --- a/lib/taskana-core/src/test/java/acceptance/workbasket/QueryWorkbasketsWithPaginationAccTest.java +++ b/lib/taskana-core/src/test/java/acceptance/workbasket/QueryWorkbasketsWithPaginationAccTest.java @@ -99,7 +99,7 @@ public class QueryWorkbasketsWithPaginationAccTest extends AbstractAccTest { results = workbasketService.createWorkbasketQuery() .domainIn("DOMAIN_A") .listPage(pageNumber, pageSize); - assertThat(results.size(), equalTo(13)); + assertThat(results.size(), equalTo(14)); // Getting last results on multiple pages pageNumber = 2; @@ -107,7 +107,7 @@ public class QueryWorkbasketsWithPaginationAccTest extends AbstractAccTest { results = workbasketService.createWorkbasketQuery() .domainIn("DOMAIN_A") .listPage(pageNumber, pageSize); - assertThat(results.size(), equalTo(3)); + assertThat(results.size(), equalTo(4)); } @Test @@ -167,7 +167,7 @@ public class QueryWorkbasketsWithPaginationAccTest extends AbstractAccTest { long count = workbasketService.createWorkbasketQuery() .domainIn("DOMAIN_A") .count(); - assertThat(count, equalTo(13L)); + assertThat(count, equalTo(14L)); } @AfterClass diff --git a/lib/taskana-core/src/test/resources/sql/task.sql b/lib/taskana-core/src/test/resources/sql/task.sql index ebdac67ba..28aab5693 100644 --- a/lib/taskana-core/src/test/resources/sql/task.sql +++ b/lib/taskana-core/src/test/resources/sql/task.sql @@ -25,16 +25,16 @@ INSERT INTO TASK VALUES('TKI:000000000000000000000000000000000022', '2018-01-29 INSERT INTO TASK VALUES('TKI:000000000000000000000000000000000023', '2018-01-29 15:55:23', null , null , '2018-01-29 15:55:23', '2018-01-29 15:55:00', '2018-01-30 15:55:00', 'Widerruf' , 'Widerruf' , null , 2 , 'READY' , 'L1050' , 'GPK_KSC' , 'DOMAIN_A', 'PI_0000000000023' , 'DOC_0000000000000000023' , null , '00' , 'PASystem' , '00' , 'SDNR' , '11223344' , false , false , null , null , null , null , null , null , null , null , null , null , null ); INSERT INTO TASK VALUES('TKI:000000000000000000000000000000000024', '2018-01-29 15:55:24', null , null , '2018-01-29 15:55:24', '2018-01-29 15:55:00', '2018-01-30 15:55:00', 'Widerruf' , 'Widerruf' , null , 2 , 'READY' , 'L1050' , 'GPK_KSC' , 'DOMAIN_A', 'PI_0000000000024' , 'DOC_0000000000000000024' , null , '00' , 'PASystem' , '00' , 'SDNR' , '11223344' , false , false , null , null , null , null , null , null , null , null , null , null , null ); -- Tasks for WorkOnTaskAccTest -INSERT INTO TASK VALUES('TKI:000000000000000000000000000000000025', '2018-01-29 15:55:24', null , null , '2018-01-29 15:55:24', '2018-01-29 15:55:00', '2018-01-30 15:55:00', 'Widerruf' , 'Widerruf' , null , 2 , 'READY' , 'L1050' , 'USER_1_2' , 'DOMAIN_A', 'PI_0000000000025' , 'DOC_0000000000000000025' , null , '00' , 'PASystem' , '00' , 'SDNR' , '98765432' , false , false , null , null , null , null , null , null , null , null , null , null , null ); -INSERT INTO TASK VALUES('TKI:000000000000000000000000000000000026', '2018-01-29 15:55:24', '2018-01-30 15:55:24', null , '2018-01-30 15:55:24', '2018-01-29 15:55:00', '2018-01-30 15:55:00', 'Widerruf' , 'Widerruf' , null , 2 , 'CLAIMED' , 'L1050' , 'USER_1_2' , 'DOMAIN_A', 'PI_0000000000026' , 'DOC_0000000000000000026' , 'user_1_1' , '00' , 'PASystem' , '00' , 'SDNR' , '98765432' , true , false , null , null , null , null , null , null , null , null , null , null , null ); -INSERT INTO TASK VALUES('TKI:000000000000000000000000000000000027', '2018-01-29 15:55:24', '2018-01-30 15:55:24', null , '2018-01-30 15:55:24', '2018-01-29 15:55:00', '2018-01-30 15:55:00', 'Widerruf' , 'Widerruf' , null , 2 , 'CLAIMED' , 'L1050' , 'USER_1_2' , 'DOMAIN_A', 'PI_0000000000027' , 'DOC_0000000000000000027' , 'user_1_2' , '00' , 'PASystem' , '00' , 'SDNR' , '98765432' , true , false , null , null , null , null , null , null , null , null , null , null , null ); -INSERT INTO TASK VALUES('TKI:000000000000000000000000000000000028', '2018-01-29 15:55:24', '2018-01-30 15:55:24', null , '2018-01-30 15:55:24', '2018-01-29 15:55:00', '2018-01-30 15:55:00', 'Widerruf' , 'Widerruf' , null , 2 , 'CLAIMED' , 'L1050' , 'USER_1_2' , 'DOMAIN_A', 'PI_0000000000028' , 'DOC_0000000000000000028' , 'user_1_1' , '00' , 'PASystem' , '00' , 'SDNR' , '98765432' , true , false , null , null , null , null , null , null , null , null , null , null , null ); -INSERT INTO TASK VALUES('TKI:000000000000000000000000000000000029', '2018-01-29 15:55:24', '2018-01-30 15:55:24', null , '2018-01-30 15:55:24', '2018-01-29 15:55:00', '2018-01-30 15:55:00', 'Widerruf' , 'Widerruf' , null , 2 , 'CLAIMED' , 'L1050' , 'USER_1_2' , 'DOMAIN_A', 'PI_0000000000029' , 'DOC_0000000000000000029' , 'user_1_2' , '00' , 'PASystem' , '00' , 'SDNR' , '98765432' , true , false , null , null , null , null , null , null , null , null , null , null , null ); -INSERT INTO TASK VALUES('TKI:000000000000000000000000000000000030', '2018-01-29 15:55:24', '2018-01-30 15:55:24', null , '2018-01-30 15:55:24', '2018-01-29 15:55:00', '2018-01-30 15:55:00', 'Widerruf' , 'Widerruf' , null , 2 , 'CLAIMED' , 'L1050' , 'USER_1_2' , 'DOMAIN_A', 'PI_0000000000030' , 'DOC_0000000000000000030' , 'user_1_1' , '00' , 'PASystem' , '00' , 'SDNR' , '98765432' , true , false , null , null , null , null , null , null , null , null , null , null , null ); -INSERT INTO TASK VALUES('TKI:000000000000000000000000000000000031', '2018-01-29 15:55:24', '2018-01-30 15:55:24', null , '2018-01-30 15:55:24', '2018-01-29 15:55:00', '2018-01-30 15:55:00', 'Widerruf' , 'Widerruf' , null , 2 , 'CLAIMED' , 'L1050' , 'USER_1_2' , 'DOMAIN_A', 'PI_0000000000031' , 'DOC_0000000000000000031' , 'user_1_1' , '00' , 'PASystem' , '00' , 'SDNR' , '98765432' , true , false , null , null , null , null , null , null , null , null , null , null , null ); -INSERT INTO TASK VALUES('TKI:000000000000000000000000000000000032', '2018-01-29 15:55:24', '2018-01-30 15:55:24', null , '2018-01-30 15:55:24', '2018-01-29 15:55:00', '2018-01-30 15:55:00', 'Widerruf' , 'Widerruf' , null , 2 , 'CLAIMED' , 'L1050' , 'USER_1_2' , 'DOMAIN_A', 'PI_0000000000032' , 'DOC_0000000000000000032' , 'user_1_2' , '00' , 'PASystem' , '00' , 'SDNR' , '98765432' , true , false , null , null , null , null , null , null , null , null , null , null , null ); -INSERT INTO TASK VALUES('TKI:000000000000000000000000000000000033', '2018-01-29 15:55:24', null , null , '2018-01-30 15:55:24', '2018-01-29 15:55:00', '2018-01-30 15:55:00', 'Widerruf' , 'Widerruf' , null , 2 , 'READY' , 'L1050' , 'USER_1_2' , 'DOMAIN_A', 'PI_0000000000033' , 'DOC_0000000000000000033' , 'user_1_2' , '00' , 'PASystem' , '00' , 'SDNR' , '98765432' , true , false , null , null , null , null , null , null , null , null , null , null , null ); -INSERT INTO TASK VALUES('TKI:000000000000000000000000000000000034', '2018-01-29 15:55:24', '2018-01-30 15:55:24', null , '2018-01-30 15:55:24', '2018-01-29 15:55:00', '2018-01-30 15:55:00', 'Widerruf' , 'Widerruf' , null , 2 , 'CLAIMED' , 'L1050' , 'USER_1_2' , 'DOMAIN_A', 'PI_0000000000034' , 'DOC_0000000000000000034' , 'user_1_1' , '00' , 'PASystem' , '00' , 'SDNR' , '98765432' , true , false , null , null , null , null , null , null , null , null , null , null , null ); +INSERT INTO TASK VALUES('TKI:000000000000000000000000000000000025', '2018-01-29 15:55:24', null , null , '2018-01-29 15:55:24', '2018-01-29 15:55:00', '2018-01-30 15:55:00', 'Widerruf' , 'Widerruf' , null , 2 , 'READY' , 'L1050' , 'USER_1_2' , 'DOMAIN_A', 'PI_0000000000025' , 'DOC_0000000000000000025' , null , 'abcd00' , 'PASystem' , '00' , 'SDNR' , '98765432' , false , false , null , null , null , null , null , null , null , null , null , null , null ); +INSERT INTO TASK VALUES('TKI:000000000000000000000000000000000026', '2018-01-29 15:55:24', '2018-01-30 15:55:24', null , '2018-01-30 15:55:24', '2018-01-29 15:55:00', '2018-01-30 15:55:00', 'Widerruf' , 'Widerruf' , null , 2 , 'CLAIMED' , 'L1050' , 'USER_1_2' , 'DOMAIN_A', 'PI_0000000000026' , 'DOC_0000000000000000026' , 'user_1_1' , 'bcde00' , 'PASystem' , '00' , 'SDNR' , '98765432' , true , false , null , null , null , null , null , null , null , null , null , null , null ); +INSERT INTO TASK VALUES('TKI:000000000000000000000000000000000027', '2018-01-29 15:55:24', '2018-01-30 15:55:24', null , '2018-01-30 15:55:24', '2018-01-29 15:55:00', '2018-01-30 15:55:00', 'Widerruf' , 'Widerruf' , null , 2 , 'CLAIMED' , 'L1050' , 'USER_1_2' , 'DOMAIN_A', 'PI_0000000000027' , 'DOC_0000000000000000027' , 'user_1_2' , 'cdef00' , 'PASystem' , '00' , 'SDNR' , '98765432' , true , false , null , null , null , null , null , null , null , null , null , null , null ); +INSERT INTO TASK VALUES('TKI:000000000000000000000000000000000028', '2018-01-29 15:55:24', '2018-01-30 15:55:24', null , '2018-01-30 15:55:24', '2018-01-29 15:55:00', '2018-01-30 15:55:00', 'Widerruf' , 'Widerruf' , null , 2 , 'CLAIMED' , 'L1050' , 'USER_1_2' , 'DOMAIN_A', 'PI_0000000000028' , 'DOC_0000000000000000028' , 'user_1_1' , 'efgh00' , 'PASystem' , '00' , 'SDNR' , '98765432' , true , false , null , null , null , null , null , null , null , null , null , null , null ); +INSERT INTO TASK VALUES('TKI:000000000000000000000000000000000029', '2018-01-29 15:55:24', '2018-01-30 15:55:24', null , '2018-01-30 15:55:24', '2018-01-29 15:55:00', '2018-01-30 15:55:00', 'Widerruf' , 'Widerruf' , null , 2 , 'CLAIMED' , 'L1050' , 'USER_1_2' , 'DOMAIN_A', 'PI_0000000000029' , 'DOC_0000000000000000029' , 'user_1_2' , 'fghj00' , 'PASystem' , '00' , 'SDNR' , '98765432' , true , false , null , null , null , null , null , null , null , null , null , null , null ); +INSERT INTO TASK VALUES('TKI:000000000000000000000000000000000030', '2018-01-29 15:55:24', '2018-01-30 15:55:24', null , '2018-01-30 15:55:24', '2018-01-29 15:55:00', '2018-01-30 15:55:00', 'Widerruf' , 'Widerruf' , null , 2 , 'CLAIMED' , 'L1050' , 'USER_1_2' , 'DOMAIN_A', 'PI_0000000000030' , 'DOC_0000000000000000030' , 'user_1_1' , 'ABCD00' , 'PASystem' , '00' , 'SDNR' , '98765432' , true , false , null , null , null , null , null , null , null , null , null , null , null ); +INSERT INTO TASK VALUES('TKI:000000000000000000000000000000000031', '2018-01-29 15:55:24', '2018-01-30 15:55:24', null , '2018-01-30 15:55:24', '2018-01-29 15:55:00', '2018-01-30 15:55:00', 'Widerruf' , 'Widerruf' , null , 2 , 'CLAIMED' , 'L1050' , 'USER_1_2' , 'DOMAIN_A', 'PI_0000000000031' , 'DOC_0000000000000000031' , 'user_1_1' , 'BDCE00' , 'PASystem' , '00' , 'SDNR' , '98765432' , true , false , null , null , null , null , null , null , null , null , null , null , null ); +INSERT INTO TASK VALUES('TKI:000000000000000000000000000000000032', '2018-01-29 15:55:24', '2018-01-30 15:55:24', null , '2018-01-30 15:55:24', '2018-01-29 15:55:00', '2018-01-30 15:55:00', 'Widerruf' , 'Widerruf' , null , 2 , 'CLAIMED' , 'L1050' , 'USER_1_2' , 'DOMAIN_A', 'PI_0000000000032' , 'DOC_0000000000000000032' , 'user_1_2' , 'CDEF00' , 'PASystem' , '00' , 'SDNR' , '98765432' , true , false , null , null , null , null , null , null , null , null , null , null , null ); +INSERT INTO TASK VALUES('TKI:000000000000000000000000000000000033', '2018-01-29 15:55:24', null , null , '2018-01-30 15:55:24', '2018-01-29 15:55:00', '2018-01-30 15:55:00', 'Widerruf' , 'Widerruf' , null , 2 , 'READY' , 'L1050' , 'USER_1_2' , 'DOMAIN_A', 'PI_0000000000033' , 'DOC_0000000000000000033' , 'user_1_2' , 'DEFG00' , 'PASystem' , '00' , 'SDNR' , '98765432' , true , false , null , null , null , null , null , null , null , null , null , null , null ); +INSERT INTO TASK VALUES('TKI:000000000000000000000000000000000034', '2018-01-29 15:55:24', '2018-01-30 15:55:24', null , '2018-01-30 15:55:24', '2018-01-29 15:55:00', '2018-01-30 15:55:00', 'Widerruf' , 'Widerruf' , null , 2 , 'CLAIMED' , 'L1050' , 'USER_1_2' , 'DOMAIN_A', 'PI_0000000000034' , 'DOC_0000000000000000034' , 'user_1_1' , 'GHIJ00' , 'PASystem' , '00' , 'SDNR' , '98765432' , true , false , null , null , null , null , null , null , null , null , null , null , null ); INSERT INTO TASK VALUES('TKI:000000000000000000000000000000000035', '2018-01-29 15:55:24', '2018-01-30 15:55:24', null , '2018-01-30 15:55:24', '2018-01-29 15:55:00', '2018-01-30 15:55:00', 'Widerruf' , 'Widerruf' , null , 2 , 'CLAIMED' , 'L1050' , 'USER_1_2' , 'DOMAIN_A', 'PI_0000000000035' , 'DOC_0000000000000000035' , 'user_1_1' , '00' , 'PASystem' , '00' , 'SDNR' , '98765432' , true , false , null , null , null , null , null , null , null , null , null , null , null ); INSERT INTO TASK VALUES('TKI:000000000000000000000000000000000100', '2018-01-29 15:55:24', '2018-01-30 15:55:24', null , '2018-01-30 15:55:24', '2018-01-29 15:55:00', '2018-01-30 15:55:00', 'Widerruf' , 'Widerruf' , null , 2 , 'CLAIMED' , 'L1050' , 'USER_1_2' , 'DOMAIN_A', 'PI_0000000000100' , 'DOC_0000000000000000100' , 'user_1_2' , '00' , 'PASystem' , '00' , 'SDNR' , '98765432' , true , false , null , null , null , null , null , null , null , null , null , null , null ); INSERT INTO TASK VALUES('TKI:000000000000000000000000000000000101', '2018-01-29 15:55:24', '2018-01-30 15:55:24', null , '2018-01-30 15:55:24', '2018-01-29 15:55:00', '2018-01-30 15:55:00', 'Widerruf' , 'Widerruf' , null , 2 , 'CLAIMED' , 'L1050' , 'USER_1_2' , 'DOMAIN_A', 'PI_0000000000101' , 'DOC_0000000000000000101' , 'user_1_2' , '00' , 'PASystem' , '00' , 'SDNR' , '98765432' , true , false , null , null , null , null , null , null , null , null , null , null , null ); @@ -46,3 +46,29 @@ INSERT INTO TASK VALUES('TKI:000000000000000000000000000000000037', '2018-01-29 INSERT INTO TASK VALUES('TKI:000000000000000000000000000000000038', '2018-01-29 15:55:24', '2018-01-30 15:55:24', '2018-01-30 16:55:24', '2018-01-30 16:55:24', '2018-01-29 15:55:00', '2018-01-30 15:55:00', 'Widerruf' , 'Widerruf' , null , 2 , 'COMPLETED' , 'L1050' , 'USER_1_2' , 'DOMAIN_A', 'PI_0000000000038' , 'DOC_0000000000000000038' , 'user_1_2' , '00' , 'PASystem' , '00' , 'SDNR' , '00011122' , true , false , null , null , null , null , null , null , null , null , null , null , null ); INSERT INTO TASK VALUES('TKI:000000000000000000000000000000000039', '2018-01-29 15:55:24', '2018-01-30 15:55:24', '2018-01-30 16:55:24', '2018-01-30 16:55:24', '2018-01-29 15:55:00', '2018-01-30 15:55:00', 'Widerruf' , 'Widerruf' , null , 2 , 'COMPLETED' , 'L1050' , 'USER_1_2' , 'DOMAIN_A', 'PI_0000000000039' , 'DOC_0000000000000000039' , 'user_1_2' , '00' , 'PASystem' , '00' , 'SDNR' , '00011122' , true , false , null , null , null , null , null , null , null , null , null , null , null ); INSERT INTO TASK VALUES('TKI:000000000000000000000000000000000040', '2018-01-29 15:55:24', '2018-01-30 15:55:24', '2018-01-30 16:55:24', '2018-01-30 16:55:24', '2018-01-29 15:55:00', '2018-01-30 15:55:00', 'Widerruf' , 'Widerruf' , null , 2 , 'COMPLETED' , 'L1050' , 'USER_1_2' , 'DOMAIN_A', 'PI_0000000000040' , 'DOC_0000000000000000040' , 'user_1_2' , '00' , 'PASystem' , '00' , 'SDNR' , '00011122' , true , false , null , null , null , null , null , null , null , null , null , null , null ); +-- Tasks for QueryTasksWithSortingTest +INSERT INTO TASK VALUES('TKI:000000000000000000000000000000000041', '2018-01-29 15:55:00', '2018-01-30 15:55:00', null , '2018-01-30 15:55:00', '2018-01-29 15:55:00', '2018-01-30 15:55:00', 'Task99' , 'Lorem ipsum was n Quatsch dolor sit amet.', 'Some custom Note' , 1 , 'CLAIMED' , 'T6310' , 'key5' , 'DOMAIN_A', 'BPI21' , 'PBPI21' , 'user_1_1' , 'MyCompany1', 'MySystem1', 'MyInstance1' , 'MyType1', 'MyValue1' , true , false , null , null , null , null , null , null , null , null , null , null , null ); +INSERT INTO TASK VALUES('TKI:000000000000000000000000000000000042', '2018-01-29 15:55:01', '2018-01-30 15:55:00', null , '2018-01-30 15:55:01', '2018-01-29 15:55:00', '2018-01-30 15:55:00', 'Task01' , 'Lorem ipsum was n Quatsch dolor sit amet.', 'Some custom Note' , 2 , 'CLAIMED' , 'L110102' , 'key5' , 'DOMAIN_A', 'BPI21' , 'PBPI21' , 'user_1_1' , 'MyCompany1', 'MySystem1', 'MyInstance1' , 'MyType1', 'MyValue1' , true , false , null , null , null , null , null , null , null , null , null , null , null ); +INSERT INTO TASK VALUES('TKI:000000000000000000000000000000000043', '2018-01-29 15:55:02', '2018-01-30 15:55:00', null , '2018-01-30 15:55:02', '2018-01-29 15:55:00', '2018-01-30 15:55:00', 'Task02' , 'Lorem ipsum was n Quatsch t. Aber stimmt.', 'Some custom Note' , 2 , 'CLAIMED' , 'A12' , 'key5' , 'DOMAIN_B', 'BPI21' , 'PBPI21' , 'user_1_1' , 'MyCompany1', 'MySystem1', 'MyInstance1' , 'MyType1', 'MyValue1' , true , false , null , null , null , null , null , null , null , null , null , null , null ); +INSERT INTO TASK VALUES('TKI:000000000000000000000000000000000044', '2018-01-29 15:55:03', null , null , '2018-01-29 15:55:03', '2018-01-29 15:55:00', '2018-01-30 15:55:00', 'Widerruf' , 'Widerruf' , null , 2 , 'READY' , 'L1050' , 'key5' , 'DOMAIN_A', 'PI_0000000000003' , 'DOC_0000000000000000003' , null , '00' , 'PASystem' , '00' , 'VNR' , '11223344' , false , false , null , null , null , null , null , null , null , null , null , null , null ); +INSERT INTO TASK VALUES('TKI:000000000000000000000000000000000045', '2018-01-29 15:55:04', null , null , '2018-01-29 15:55:04', '2018-01-29 15:55:00', '2018-01-30 15:55:00', 'Widerruf' , 'Widerruf' , null , 2 , 'READY' , 'L1050' , 'key5' , 'DOMAIN_A', 'PI_0000000000004' , 'DOC_0000000000000000004' , null , '00' , 'PASystem' , '00' , 'VNR' , '11223344' , false , false , null , null , null , null , null , null , null , null , null , null , null ); +INSERT INTO TASK VALUES('TKI:000000000000000000000000000000000046', '2018-01-29 15:55:05', null , null , '2018-01-29 15:55:05', '2018-01-29 15:55:00', '2018-01-30 15:55:00', 'Widerruf' , 'Widerruf' , null , 2 , 'READY' , 'L1050' , 'key5' , 'DOMAIN_A', 'PI_0000000000004' , 'DOC_0000000000000000003' , null , '00' , 'PASystem' , '06' , 'VNR' , '11223344' , false , false , null , null , null , null , null , null , null , null , null , null , null ); +INSERT INTO TASK VALUES('TKI:000000000000000000000000000000000047', '2018-01-29 15:55:06', null , null , '2018-01-29 15:55:06', '2018-01-29 15:55:00', '2018-01-30 15:55:00', 'Widerruf' , 'Widerruf' , null , 2 , 'READY' , 'L1050' , 'key5' , 'DOMAIN_A', 'PI_0000000000004' , 'DOC_0000000000000000003' , null , '00' , 'PASystem' , '00' , 'VNR' , '11223344' , false , false , null , null , null , null , null , null , null , null , null , null , null ); +INSERT INTO TASK VALUES('TKI:000000000000000000000000000000000048', '2018-01-29 15:55:07', null , null , '2018-01-29 15:55:07', '2018-01-29 15:55:00', '2018-01-30 15:55:00', 'Widerruf' , 'Widerruf' , null , 2 , 'READY' , 'L1050' , 'key5' , 'DOMAIN_B', 'PI_0000000000004' , 'DOC_0000000000000000007' , null , '00' , 'PASystem' , '05' , 'VNR' , '11223344' , false , false , null , null , null , null , null , null , null , null , null , null , null ); +INSERT INTO TASK VALUES('TKI:000000000000000000000000000000000049', '2018-01-29 15:55:08', null , null , '2018-01-29 15:55:08', '2018-01-29 15:55:00', '2018-01-30 15:55:00', 'Widerruf' , 'Widerruf' , null , 2 , 'READY' , 'L1050' , 'key5' , 'DOMAIN_A', 'PI_0000000000008' , 'DOC_0000000000000000003' , null , '00' , 'PASyste1' , '00' , 'VNR' , '22334455' , false , false , null , null , null , null , null , null , null , null , null , null , null ); +INSERT INTO TASK VALUES('TKI:000000000000000000000000000000000050', '2018-01-29 15:55:09', null , null , '2018-01-29 15:55:09', '2018-01-29 15:55:00', '2018-01-30 15:55:00', 'Widerruf' , 'Widerruf' , null , 2 , 'READY' , 'L1050' , 'key5' , 'DOMAIN_B', 'PI_0000000000009' , 'DOC_0000000000000000009' , null , '00' , 'PASyste1' , '05' , 'VNR' , '22334455' , false , false , null , null , null , null , null , null , null , null , null , null , null ); +INSERT INTO TASK VALUES('TKI:000000000000000000000000000000000051', '2018-01-29 15:55:10', null , null , '2018-01-29 15:55:10', '2018-01-29 15:55:00', '2018-01-30 15:55:00', 'Widerruf' , 'Widerruf' , null , 2 , 'READY' , 'L1050' , 'key5' , 'DOMAIN_C', 'PI_0000000000010' , 'DOC_0000000000000000010' , null , '00' , 'PASyste1' , '00' , 'VNR' , '22334455' , false , false , null , null , null , null , null , null , null , null , null , null , null ); +INSERT INTO TASK VALUES('TKI:000000000000000000000000000000000052', '2018-01-29 15:55:11', null , null , '2018-01-29 15:55:11', '2018-01-29 15:55:00', '2018-01-30 15:55:00', 'Widerruf' , 'Widerruf' , null , 2 , 'READY' , 'L1050' , 'key5' , 'DOMAIN_C', 'PI_0000000000011' , 'DOC_0000000000000000011' , null , '00' , 'PASystem' , '04' , 'VNR' , '22334455' , false , false , null , null , null , null , null , null , null , null , null , null , null ); +INSERT INTO TASK VALUES('TKI:000000000000000000000000000000000053', '2018-01-29 15:55:12', null , null , '2018-01-29 15:55:12', '2018-01-29 15:55:00', '2018-01-30 15:55:00', 'Widerruf' , 'Widerruf' , null , 2 , 'READY' , 'L1050' , 'key5' , 'DOMAIN_A', 'PI_0000000000012' , 'DOC_0000000000000000012' , null , '00' , 'PASystem' , '00' , 'VNR' , '22334455' , false , false , null , null , null , null , null , null , null , null , null , null , null ); +INSERT INTO TASK VALUES('TKI:000000000000000000000000000000000054', '2018-01-29 15:55:13', null , null , '2018-01-29 15:55:13', '2018-01-29 15:55:00', '2018-01-30 15:55:00', 'Widerruf' , 'Widerruf' , null , 2 , 'READY' , 'L1050' , 'key5' , 'DOMAIN_A', 'PI_0000000000010' , 'DOC_0000000000000000011' , null , '00' , 'PASystem' , '00' , 'VNR' , '22334455' , false , false , null , null , null , null , null , null , null , null , null , null , null ); +INSERT INTO TASK VALUES('TKI:000000000000000000000000000000000055', '2018-01-29 15:55:14', null , null , '2018-01-29 15:55:14', '2018-01-29 15:55:00', '2018-01-30 15:55:00', 'Widerruf' , 'Widerruf' , null , 2 , 'READY' , 'L1050' , 'key5' , 'DOMAIN_A', 'PI_0000000000014' , 'DOC_0000000000000000014' , null , '00' , 'PASyste1' , '04' , 'VNR' , '12345678' , false , false , null , null , null , null , null , null , null , null , null , null , null ); +INSERT INTO TASK VALUES('TKI:000000000000000000000000000000000056', '2018-01-29 15:55:15', null , null , '2018-01-29 15:55:15', '2018-01-29 15:55:00', '2018-01-30 15:55:00', 'Widerruf' , 'Widerruf' , null , 2 , 'READY' , 'L1050' , 'key5' , 'DOMAIN_D', 'PI_0000000000015' , 'DOC_0000000000000000015' , null , '00' , 'PASyste1' , '00' , 'VNR' , '23456789' , false , false , null , null , null , null , null , null , null , null , null , null , null ); +INSERT INTO TASK VALUES('TKI:000000000000000000000000000000000057', '2018-01-29 15:55:16', null , null , '2018-01-29 15:55:16', '2018-01-29 15:55:00', '2018-01-30 15:55:00', 'Widerruf' , 'Widerruf' , null , 2 , 'READY' , 'L1050' , 'key5' , 'DOMAIN_A', 'PI_0000000000010' , 'DOC_0000000000000000011' , null , '00' , 'PASyste2' , '00' , 'VNR' , '34567890' , false , false , null , null , null , null , null , null , null , null , null , null , null ); +INSERT INTO TASK VALUES('TKI:000000000000000000000000000000000058', '2018-01-29 15:55:17', null , null , '2018-01-29 15:55:17', '2018-01-29 15:55:00', '2018-01-30 15:55:00', 'Widerruf' , 'Widerruf' , null , 2 , 'READY' , 'L1050' , 'key5' , 'DOMAIN_E', 'PI_0000000000017' , 'DOC_0000000000000000017' , null , '00' , 'PASystem' , '03' , 'VNR' , '45678901' , false , false , null , null , null , null , null , null , null , null , null , null , null ); +INSERT INTO TASK VALUES('TKI:000000000000000000000000000000000059', '2018-01-29 15:55:18', null , null , '2018-01-29 15:55:18', '2018-01-29 15:55:00', '2018-01-30 15:55:00', 'Widerruf' , 'Widerruf' , null , 2 , 'READY' , 'L1050' , 'key5' , 'DOMAIN_A', 'PI_0000000000018' , 'DOC_0000000000000000018' , null , '00' , 'PASystem' , '02' , 'VNR' , '56789012' , false , false , null , null , null , null , null , null , null , null , null , null , null ); +INSERT INTO TASK VALUES('TKI:000000000000000000000000000000000060', '2018-01-29 15:55:19', null , null , '2018-01-29 15:55:19', '2018-01-29 15:55:00', '2018-01-30 15:55:00', 'Widerruf' , 'Widerruf' , null , 2 , 'READY' , 'L1050' , 'key5' , 'DOMAIN_F', 'PI_0000000000010' , 'DOC_0000000000000000011' , null , '00' , 'PASyste2' , '00' , 'VNR' , '67890123' , false , false , null , null , null , null , null , null , null , null , null , null , null ); +INSERT INTO TASK VALUES('TKI:000000000000000000000000000000000061', '2018-01-29 15:55:20', null , null , '2018-01-29 15:55:20', '2018-01-29 15:55:00', '2018-01-30 15:55:00', 'Widerruf' , 'Widerruf' , null , 2 , 'READY' , 'L1050' , 'key5' , 'DOMAIN_A', 'PI_0000000000020' , 'DOC_0000000000000000020' , null , '00' , 'PASyste2' , '01' , 'SDNR' , '11223344' , false , false , null , null , null , null , null , null , null , null , null , null , null ); +INSERT INTO TASK VALUES('TKI:000000000000000000000000000000000062', '2018-01-29 15:55:21', null , null , '2018-01-29 15:55:21', '2018-01-29 15:55:00', '2018-01-30 15:55:00', 'Widerruf' , 'Widerruf' , null , 2 , 'READY' , 'L1050' , 'key5' , 'DOMAIN_G', 'PI_0000000000020' , 'DOC_0000000000000000021' , null , '00' , 'PASyste2' , '01' , 'SDNR' , '11223344' , false , false , null , null , null , null , null , null , null , null , null , null , null ); +INSERT INTO TASK VALUES('TKI:000000000000000000000000000000000063', '2018-01-29 15:55:22', null , null , '2018-01-29 15:55:22', '2018-01-29 15:55:00', '2018-01-30 15:55:00', 'Widerruf' , 'Widerruf' , null , 2 , 'READY' , 'L1050' , 'key5' , 'DOMAIN_A', 'PI_0000000000022' , 'DOC_0000000000000000022' , null , '00' , 'PASystem' , '00' , 'SDNR' , '11223344' , false , false , null , null , null , null , null , null , null , null , null , null , null ); +INSERT INTO TASK VALUES('TKI:000000000000000000000000000000000064', '2018-01-29 15:55:23', null , null , '2018-01-29 15:55:23', '2018-01-29 15:55:00', '2018-01-30 15:55:00', 'Widerruf' , 'Widerruf' , null , 2 , 'READY' , 'L1050' , 'key5' , 'DOMAIN_A', 'PI_0000000000020' , 'DOC_0000000000000000021' , null , '00' , 'PASystem' , '00' , 'SDNR' , '11223344' , false , false , null , null , null , null , null , null , null , null , null , null , null ); +INSERT INTO TASK VALUES('TKI:000000000000000000000000000000000065', '2018-01-29 15:55:24', null , null , '2018-01-29 15:55:24', '2018-01-29 15:55:00', '2018-01-30 15:55:00', 'Widerruf' , 'Widerruf' , null , 2 , 'READY' , 'L1050' , 'key5' , 'DOMAIN_A', 'PI_0000000000024' , 'DOC_0000000000000000024' , null , '00' , 'PASystem' , '00' , 'SDNR' , '11223344' , false , false , null , null , null , null , null , null , null , null , null , null , null ); diff --git a/lib/taskana-core/src/test/resources/sql/workbasket-access-list.sql b/lib/taskana-core/src/test/resources/sql/workbasket-access-list.sql index fce3c1684..781eb6666 100644 --- a/lib/taskana-core/src/test/resources/sql/workbasket-access-list.sql +++ b/lib/taskana-core/src/test/resources/sql/workbasket-access-list.sql @@ -37,3 +37,4 @@ INSERT INTO WORKBASKET_ACCESS_LIST VALUES ('WAI:10000000000000000000000000000000 INSERT INTO WORKBASKET_ACCESS_LIST VALUES ('WAI:100000000000000000000000000000000023', 'GPK_B_KSC_1', 'group_1', true, false, true, true, false, false, false, false, false, false, false, false, false, false, false, false, false); INSERT INTO WORKBASKET_ACCESS_LIST VALUES ('WAI:100000000000000000000000000000000024', 'GPK_B_KSC_2', 'group_2', true, false, true, true, false, false, false, false, false, false, false, false, false, false, false, false, false); +INSERT INTO WORKBASKET_ACCESS_LIST VALUES ('WAI:100000000000000000000000000000000025', 'key5', 'group_1', true, true, true, true, false, false, false, false, false, false, false, false, false, false, false, false, false); diff --git a/lib/taskana-core/src/test/resources/sql/workbasket.sql b/lib/taskana-core/src/test/resources/sql/workbasket.sql index 215346b3b..a30542f67 100644 --- a/lib/taskana-core/src/test/resources/sql/workbasket.sql +++ b/lib/taskana-core/src/test/resources/sql/workbasket.sql @@ -2,6 +2,7 @@ INSERT INTO WORKBASKET VALUES ('1', 'key1', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP INSERT INTO WORKBASKET VALUES ('2', 'key2', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, 'Basket2', 'DOMAIN_A', 'CLEARANCE', 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.', 'Susanne', '', '', '', '', '', '', '', ''); INSERT INTO WORKBASKET VALUES ('3', 'key3', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, 'Basket3', 'DOMAIN_A', 'TOPIC', 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.', 'Max', '', '', '', '', '', '', '', ''); INSERT INTO WORKBASKET VALUES ('4', 'key4', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, 'Basket4', 'DOMAIN_A', 'TOPIC', 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.', 'Max', '', '', '', '', '', '', '', ''); +INSERT INTO WORKBASKET VALUES ('5', 'key5', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, 'Basket5', 'DOMAIN_A', 'TOPIC', 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.', 'Max', '', '', '', '', '', '', '', ''); -- KSC workbaskets INSERT INTO WORKBASKET VALUES ('WBI:100000000000000000000000000000000001', 'GPK_KSC', '2018-02-01 12:00:00', '2018-02-01 12:00:00', 'Gruppenpostkorb KSC', 'DOMAIN_A', 'GROUP', 'Gruppenpostkorb KSC', '', '', '', '', '', '', '', '', '');