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 de25639b1..5f9800453 100644 --- a/lib/taskana-core/src/main/java/pro/taskana/TaskQuery.java +++ b/lib/taskana-core/src/main/java/pro/taskana/TaskQuery.java @@ -1,6 +1,5 @@ package pro.taskana; -import pro.taskana.exceptions.NotAuthorizedException; import pro.taskana.model.TaskState; /** @@ -11,31 +10,44 @@ public interface TaskQuery extends BaseQuery { /** * Add your names to your query. * - * @param name + * @param names * the names as Strings * @return the query */ - TaskQuery nameIn(String... name); + TaskQuery nameIn(String... names); + + /** + * Add your name for pattern matching to your query. It will be compared in SQL with the LIKE operator. You may use + * a wildcard like % to specify the pattern. If you specify multiple arguments they are combined with the OR + * keyword. + * + * @param names + * your names + * @return the query + */ + TaskQuery nameLike(String... names); /** * Add your description for pattern matching to your query. It will be compared in SQL with the LIKE operator. You - * may use a wildcard like % to specify the pattern. + * may use a wildcard like % to specify the pattern. If you specify multiple arguments they are combined with the OR + * keyword. * * @param description * your description * @return the query */ - TaskQuery descriptionLike(String description); + TaskQuery descriptionLike(String... description); /** * Add your custom note for pattern matching to your query. It will be compared in SQL with the LIKE operator. You - * may use a wildcard like % to specify the pattern. + * may use a wildcard like % to specify the pattern. If you specify multiple arguments they are combined with the OR + * keyword. * * @param note * your custom note * @return the query */ - TaskQuery noteLike(String note); + TaskQuery noteLike(String... note); /** * Add your priorities to your query. @@ -58,11 +70,22 @@ public interface TaskQuery extends BaseQuery { /** * Add your classificationKey to your query. * - * @param classificationKey + * @param classificationKeys * the classification key * @return the query */ - TaskQuery classificationKeyIn(String... classificationKey); + TaskQuery classificationKeyIn(String... classificationKeys); + + /** + * Add your classificationKey for pattern matching to your query. It will be compared in SQL with the LIKE operator. + * You may use a wildcard like % to specify the pattern. If you specify multiple arguments they are combined with + * the OR keyword. + * + * @param classificationKeys + * the classification key + * @return the query + */ + TaskQuery classificationKeyLike(String... classificationKeys); /** * Add your workbasket key to the query. @@ -70,19 +93,39 @@ public interface TaskQuery extends BaseQuery { * @param workbasketKeys * the workbasket keys as String * @return the query - * @throws NotAuthorizedException - * if the user have no rights */ - TaskQuery workbasketKeyIn(String... workbasketKeys) throws NotAuthorizedException; + TaskQuery workbasketKeyIn(String... workbasketKeys); + + /** + * Add your workbasketKey for pattern matching to your query. It will be compared in SQL with the LIKE operator. You + * may use a wildcard like % to specify the pattern. If you specify multiple arguments they are combined with the OR + * keyword. + * + * @param workbasketKeys + * the workbasket keys + * @return the query + */ + TaskQuery workbasketKeyLike(String... workbasketKeys); /** * Add your domain to the query. * - * @param domain + * @param domains * the domain as String * @return the query */ - TaskQuery domainIn(String... domain); + TaskQuery domainIn(String... domains); + + /** + * Add your domains for pattern matching to your query. It will be compared in SQL with the LIKE operator. You may + * use a wildcard like % to specify the pattern. If you specify multiple arguments they are combined with the OR + * keyword. + * + * @param domains + * the domains of the searched-for workbaskets + * @return the query + */ + TaskQuery domainLike(String... domains); /** * Add the owners to your query. @@ -93,6 +136,17 @@ public interface TaskQuery extends BaseQuery { */ TaskQuery ownerIn(String... owners); + /** + * Add the owner for pattern matching to your query. It will be compared in SQL with the LIKE operator. You may use + * a wildcard like % to specify the pattern. If you specify multiple arguments they are combined with the OR + * keyword. + * + * @param owners + * the owners of the searched tasks + * @return the query + */ + TaskQuery ownerLike(String... owners); + /** * Add the companies of the primary object reference for exact matching to your query. * @@ -104,13 +158,14 @@ public interface TaskQuery extends BaseQuery { /** * Add the company of the primary object reference for pattern matching to your query. It will be compared in SQL - * with the LIKE operator. You may use a wildcard like % to specify the pattern. + * with the LIKE operator. You may use a wildcard like % to specify the pattern. If you specify multiple arguments + * they are combined with the OR keyword. * * @param company * the company of your primary object reference * @return the query */ - TaskQuery primaryObjectReferenceCompanyLike(String company); + TaskQuery primaryObjectReferenceCompanyLike(String... company); /** * Add the systems of the primary object reference for exact matching to your query. @@ -123,13 +178,14 @@ public interface TaskQuery extends BaseQuery { /** * Add the system of the primary object reference for pattern matching to your query. It will be compared in SQL - * with the LIKE operator. You may use a wildcard like % to specify the pattern. + * with the LIKE operator. You may use a wildcard like % to specify the pattern. If you specify multiple arguments + * they are combined with the OR keyword. * - * @param system + * @param systems * the system of your primary object reference * @return the query */ - TaskQuery primaryObjectReferenceSystemLike(String system); + TaskQuery primaryObjectReferenceSystemLike(String... systems); /** * Add the system instances of the primary object reference for exact matching to your query. @@ -142,13 +198,14 @@ public interface TaskQuery extends BaseQuery { /** * Add the system instance of the primary object reference for pattern matching to your query. It will be compared - * in SQL with the LIKE operator. You may use a wildcard like % to specify the pattern. + * in SQL with the LIKE operator. You may use a wildcard like % to specify the pattern. If you specify multiple + * arguments they are combined with the OR keyword. * - * @param systemInstance - * the system instance of your primary object reference + * @param systemInstances + * the system instances of your primary object reference * @return the query */ - TaskQuery primaryObjectReferenceSystemInstanceLike(String systemInstance); + TaskQuery primaryObjectReferenceSystemInstanceLike(String... systemInstances); /** * Add the types of the primary object reference for exact matching to your query. @@ -161,13 +218,25 @@ public interface TaskQuery extends BaseQuery { /** * Add the type of the primary object reference for pattern matching to your query. It will be compared in SQL with - * the LIKE operator. You may use a wildcard like % to specify the pattern. + * the LIKE operator. You may use a wildcard like % to specify the pattern. If you specify multiple arguments they + * are combined with the OR keyword. * - * @param type - * the type of your primary object reference + * @param types + * the types of your primary object reference * @return the query */ - TaskQuery primaryObjectReferenceTypeLike(String type); + TaskQuery primaryObjectReferenceTypeLike(String... types); + + /** + * Add the value of the primary object reference for pattern matching to your query. It will be compared in SQL with + * the LIKE operator. You may use a wildcard like % to specify the pattern. If you specify multiple arguments they + * are combined with the OR keyword. + * + * @param values + * the values of your primary object reference + * @return the query + */ + TaskQuery primaryObjectReferenceValueLike(String... values); /** * Add the values of the primary object reference for exact matching to your query. @@ -179,14 +248,76 @@ public interface TaskQuery extends BaseQuery { TaskQuery primaryObjectReferenceValueIn(String... values); /** - * Add the value of the primary object reference for pattern matching to your query. It will be compared in SQL with - * the LIKE operator. You may use a wildcard like % to specify the pattern. + * Add the time intervals within which the task was created to your query. For each time interval, the database + * query will search for tasks whose created timestamp is after or at the interval's begin and before or at the + * interval's end. If more than one interval is specified, the query will connect them with the OR keyword. If + * either begin or end of an interval are null, these values will not be specified in the query. * - * @param value - * the value of your primary object reference + * @param intervals + * - the TimeIntervals within which the task was created * @return the query */ - TaskQuery primaryObjectReferenceValueLike(String value); + TaskQuery createdWithin(TimeInterval... intervals); + + /** + * Add the time intervals within which the task was claimed to your query. For each time interval, the database + * query will search for tasks whose claimed timestamp is after or at the interval's begin and before or at the + * interval's end. If more than one interval is specified, the query will connect them with the OR keyword. If + * either begin or end of an interval are null, these values will not be specified in the query. + * + * @param intervals + * - the TimeIntervals within which the task was claimed + * @return the query + */ + TaskQuery claimedWithin(TimeInterval... intervals); + + /** + * Add the time intervals within which the task was completed to your query. For each time interval, the database + * query will search for tasks whose completed timestamp is after or at the interval's begin and before or at the + * interval's end. If more than one interval is specified, the query will connect them with the OR keyword. If + * either begin or end of an interval are null, these values will not be specified in the query. + * + * @param intervals + * - the TimeIntervals within which the task was completed + * @return the query + */ + TaskQuery completedWithin(TimeInterval... intervals); + + /** + * Add the time intervals within which the task was modified to your query. For each time interval, the database + * query will search for tasks whose modified timestamp is after or at the interval's begin and before or at the + * interval's end. If more than one interval is specified, the query will connect them with the OR keyword. If + * either begin or end of an interval are null, these values will not be specified in the query. + * + * @param intervals + * - the TimeIntervals within which the task was modified + * @return the query + */ + TaskQuery modifiedWithin(TimeInterval... intervals); + + /** + * Add the time intervals within which the task is planned to your query. For each time interval, the database query + * will search for tasks whose planned timestamp is after or at the interval's begin and before or at the interval's + * end. If more than one interval is specified, the query will connect them with the OR keyword. If either begin or + * end of an interval are null, these values will not be specified in the query. + * + * @param intervals + * - the TimeIntervals within which the task is planned + * @return the query + */ + TaskQuery plannedWithin(TimeInterval... intervals); + + /** + * Add the time intervals within which the task is due to your query. For each time interval, the database query + * will search for tasks whose due timestamp is after or at the interval's begin and before or at the interval's + * end. If more than one interval is specified, the query will connect them with the OR keyword. If either begin or + * end of an interval are null, these values will not be specified in the query. + * + * @param intervals + * - the TimeIntervals within which the task is due + * @return the query + */ + TaskQuery dueWithin(TimeInterval... intervals); /** * Add the isRead flag to the query. @@ -206,6 +337,46 @@ public interface TaskQuery extends BaseQuery { */ TaskQuery transferredEquals(Boolean isTransferred); + /** + * Add the parent business process ids for exact matching to your query. + * + * @param parentBusinessProcessIds + * the parent businessProcessIds of the searched for tasks + * @return the query + */ + TaskQuery parentBusinessProcessIdIn(String... parentBusinessProcessIds); + + /** + * Add the parent business process id for pattern matching to your query. It will be compared in SQL with the LIKE + * operator. You may use a wildcard like % to specify the pattern. If you specify multiple arguments they are + * combined with the OR keyword. + * + * @param parentBusinessProcessIds + * the parent businessprocess ids of the searched for tasks + * @return the query + */ + TaskQuery parentBusinessProcessIdLike(String... parentBusinessProcessIds); + + /** + * Add the business process ids for exact matching to your query. + * + * @param businessProcessIds + * the businessProcessIds of the searched for tasks + * @return the query + */ + TaskQuery businessProcessIdIn(String... businessProcessIds); + + /** + * Add the business process id for pattern matching to your query. It will be compared in SQL with the LIKE + * operator. You may use a wildcard like % to specify the pattern. If you specify multiple arguments they are + * combined with the OR keyword. + * + * @param businessProcessIds + * the business process ids of the searched-for tasks + * @return the query + */ + TaskQuery businessProcessIdLike(String... businessProcessIds); + /** * Filter the custom fields with this query. The scan will be run over all 10 fields. * @@ -215,6 +386,206 @@ public interface TaskQuery extends BaseQuery { */ TaskQuery customFieldsIn(String... customFields); + /** + * Add the custom_1 values for exact matching to your query. + * + * @param strings + * the custom_1 values of the searched for tasks + * @return the query + */ + TaskQuery custom1In(String... strings); + + /** + * Add the custom_1 value for pattern matching to your query. It will be compared in SQL with the LIKE operator. You + * may use a wildcard like % to specify the pattern. If you specify multiple arguments they are combined with the OR + * keyword. + * + * @param strings + * the custom_1 values of the searched-for tasks + * @return the query + */ + TaskQuery custom1Like(String... strings); + + /** + * Add the custom_2 values for exact matching to your query. + * + * @param strings + * the custom_2 values of the searched for tasks + * @return the query + */ + TaskQuery custom2In(String... strings); + + /** + * Add the custom_2 value for pattern matching to your query. It will be compared in SQL with the LIKE operator. You + * may use a wildcard like % to specify the pattern. If you specify multiple arguments they are combined with the OR + * keyword. + * + * @param strings + * the custom_2 values of the searched-for tasks + * @return the query + */ + TaskQuery custom2Like(String... strings); + + /** + * Add the custom_3 values for exact matching to your query. + * + * @param strings + * the custom_3 values of the searched for tasks + * @return the query + */ + TaskQuery custom3In(String... strings); + + /** + * Add the custom_3 value for pattern matching to your query. It will be compared in SQL with the LIKE operator. You + * may use a wildcard like % to specify the pattern. If you specify multiple arguments they are combined with the OR + * keyword. + * + * @param strings + * the custom_3 values of the searched-for tasks + * @return the query + */ + TaskQuery custom3Like(String... strings); + + /** + * Add the custom_4 values for exact matching to your query. + * + * @param strings + * the custom_4 values of the searched for tasks + * @return the query + */ + TaskQuery custom4In(String... strings); + + /** + * Add the custom_4 value for pattern matching to your query. It will be compared in SQL with the LIKE operator. You + * may use a wildcard like % to specify the pattern. If you specify multiple arguments they are combined with the OR + * keyword. + * + * @param strings + * the custom_4 values of the searched-for tasks + * @return the query + */ + TaskQuery custom4Like(String... strings); + + /** + * Add the custom_5 values for exact matching to your query. + * + * @param strings + * the custom_5 values of the searched for tasks + * @return the query + */ + TaskQuery custom5In(String... strings); + + /** + * Add the custom_5 value for pattern matching to your query. It will be compared in SQL with the LIKE operator. You + * may use a wildcard like % to specify the pattern. If you specify multiple arguments they are combined with the OR + * keyword. + * + * @param strings + * the custom_5 values of the searched-for tasks + * @return the query + */ + TaskQuery custom5Like(String... strings); + + /** + * Add the custom_6 values for exact matching to your query. + * + * @param strings + * the custom_6 values of the searched for tasks + * @return the query + */ + TaskQuery custom6In(String... strings); + + /** + * Add the custom_6 value for pattern matching to your query. It will be compared in SQL with the LIKE operator. You + * may use a wildcard like % to specify the pattern. If you specify multiple arguments they are combined with the OR + * keyword. + * + * @param strings + * the custom_6 values of the searched-for tasks + * @return the query + */ + TaskQuery custom6Like(String... strings); + + /** + * Add the custom_7 values for exact matching to your query. + * + * @param strings + * the custom_7 values of the searched for tasks + * @return the query + */ + TaskQuery custom7In(String... strings); + + /** + * Add the custom_7 value for pattern matching to your query. It will be compared in SQL with the LIKE operator. You + * may use a wildcard like % to specify the pattern. If you specify multiple arguments they are combined with the OR + * keyword. + * + * @param strings + * the custom_7 values of the searched-for tasks + * @return the query + */ + TaskQuery custom7Like(String... strings); + + /** + * Add the custom_8 values for exact matching to your query. + * + * @param strings + * the custom_8 values of the searched for tasks + * @return the query + */ + TaskQuery custom8In(String... strings); + + /** + * Add the custom_8 value for pattern matching to your query. It will be compared in SQL with the LIKE operator. You + * may use a wildcard like % to specify the pattern. If you specify multiple arguments they are combined with the OR + * keyword. + * + * @param strings + * the custom_8 values of the searched-for tasks + * @return the query + */ + TaskQuery custom8Like(String... strings); + + /** + * Add the custom_9 values for exact matching to your query. + * + * @param strings + * the custom_9 values of the searched for tasks + * @return the query + */ + TaskQuery custom9In(String... strings); + + /** + * Add the custom_9 value for pattern matching to your query. It will be compared in SQL with the LIKE operator. You + * may use a wildcard like % to specify the pattern. If you specify multiple arguments they are combined with the OR + * keyword. + * + * @param strings + * the custom_9 values of the searched-for tasks + * @return the query + */ + TaskQuery custom9Like(String... strings); + + /** + * Add the custom_10 values for exact matching to your query. + * + * @param strings + * the custom_10 values of the searched for tasks + * @return the query + */ + TaskQuery custom10In(String... strings); + + /** + * Add the custom_10 value for pattern matching to your query. It will be compared in SQL with the LIKE operator. + * You may use a wildcard like % to specify the pattern. If you specify multiple arguments they are combined with + * the OR keyword. + * + * @param strings + * the custom_10 values of the searched-for tasks + * @return the query + */ + TaskQuery custom10Like(String... strings); + /** * This method provides a query builder for quering the database. * diff --git a/lib/taskana-core/src/main/java/pro/taskana/TimeInterval.java b/lib/taskana-core/src/main/java/pro/taskana/TimeInterval.java new file mode 100644 index 000000000..b587d2fa3 --- /dev/null +++ b/lib/taskana-core/src/main/java/pro/taskana/TimeInterval.java @@ -0,0 +1,61 @@ +package pro.taskana; + +import java.time.Instant; + +/** + * Capture a time interval. A fixed interval has defined begin and end Instant. An open ended interval has either begin + * == null or end ==null. + * + * @author bbr + */ +public class TimeInterval { + + private Instant begin; + private Instant end; + + public TimeInterval(Instant begin, Instant end) { + this.begin = begin; + this.end = end; + } + + public boolean contains(Instant i) { + if (i == null) { + return false; + } + boolean isAfterBegin = begin == null ? true : !i.isBefore(begin); + boolean isBeforeEnd = end == null ? true : !i.isAfter(end); + return (isAfterBegin && isBeforeEnd); + } + + public boolean isValid() { + return begin != null || end != null; + } + + public Instant getBegin() { + return begin; + } + + public void setBegin(Instant begin) { + this.begin = begin; + } + + public Instant getEnd() { + return end; + } + + public void setEnd(Instant end) { + this.end = end; + } + + @Override + public String toString() { + StringBuilder builder = new StringBuilder(); + builder.append("TimeInterval [begin="); + builder.append(begin); + builder.append(", end="); + builder.append(end); + builder.append("]"); + return builder.toString(); + } + +} 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 a69dc9dec..4d97dc190 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 @@ -13,6 +13,7 @@ import pro.taskana.ObjectReferenceQuery; import pro.taskana.TaskQuery; import pro.taskana.TaskSummary; import pro.taskana.TaskanaEngine; +import pro.taskana.TimeInterval; import pro.taskana.exceptions.NotAuthorizedException; import pro.taskana.exceptions.TaskanaRuntimeException; import pro.taskana.impl.util.LoggerUtils; @@ -29,29 +30,64 @@ public class TaskQueryImpl implements TaskQuery { private static final Logger LOGGER = LoggerFactory.getLogger(TaskQueryImpl.class); private TaskanaEngineImpl taskanaEngineImpl; private TaskServiceImpl taskService; - private String[] name; + private String[] nameIn; + private String[] nameLike; private String[] taskIds; - private String description; - private String note; + private String[] description; + private String[] note; private int[] priority; private TaskState[] states; - private String[] classificationKey; - private String[] workbasketKey; - private String[] domain; - private String[] owner; + private String[] classificationKeyIn; + private String[] classificationKeyLike; + private String[] workbasketKeyIn; + private String[] workbasketKeyLike; + private String[] domainIn; + private String[] domainLike; + private String[] ownerIn; + private String[] ownerLike; private Boolean isRead; private Boolean isTransferred; private String[] customFields; private String[] porCompanyIn; - private String porCompanyLike; + private String[] porCompanyLike; private String[] porSystemIn; - private String porSystemLike; + private String[] porSystemLike; private String[] porSystemInstanceIn; - private String porSystemInstanceLike; + private String[] porSystemInstanceLike; private String[] porTypeIn; - private String porTypeLike; + private String[] porTypeLike; private String[] porValueIn; - private String porValueLike; + private String[] porValueLike; + private String[] parentBusinessProcessIdIn; + private String[] parentBusinessProcessIdLike; + private String[] businessProcessIdIn; + private String[] businessProcessIdLike; + private String[] custom1In; + private String[] custom1Like; + private String[] custom2In; + private String[] custom2Like; + private String[] custom3In; + private String[] custom3Like; + private String[] custom4In; + private String[] custom4Like; + private String[] custom5In; + private String[] custom5Like; + private String[] custom6In; + private String[] custom6Like; + private String[] custom7In; + private String[] custom7Like; + private String[] custom8In; + private String[] custom8Like; + private String[] custom9In; + private String[] custom9Like; + private String[] custom10In; + private String[] custom10Like; + private TimeInterval[] createdIn; + private TimeInterval[] claimedIn; + private TimeInterval[] completedIn; + private TimeInterval[] modifiedIn; + private TimeInterval[] plannedIn; + private TimeInterval[] dueIn; private List orderBy; TaskQueryImpl(TaskanaEngine taskanaEngine) { @@ -68,19 +104,91 @@ public class TaskQueryImpl implements TaskQuery { @Override public TaskQuery nameIn(String... names) { - this.name = names; + this.nameIn = names; return this; } @Override - public TaskQuery descriptionLike(String description) { - this.description = description; + public TaskQuery nameLike(String... names) { + this.nameLike = toUpperCopy(names); return this; } @Override - public TaskQuery noteLike(String note) { - this.note = note; + public TaskQuery createdWithin(TimeInterval... intervals) { + this.createdIn = intervals; + for (TimeInterval ti : intervals) { + if (!ti.isValid()) { + throw new IllegalArgumentException("TimeInterval " + ti + " is invalid."); + } + } + return this; + } + + @Override + public TaskQuery claimedWithin(TimeInterval... intervals) { + this.claimedIn = intervals; + for (TimeInterval ti : intervals) { + if (!ti.isValid()) { + throw new IllegalArgumentException("TimeInterval " + ti + " is invalid."); + } + } + return this; + } + + @Override + public TaskQuery completedWithin(TimeInterval... intervals) { + this.completedIn = intervals; + for (TimeInterval ti : intervals) { + if (!ti.isValid()) { + throw new IllegalArgumentException("TimeInterval " + ti + " is invalid."); + } + } + return this; + } + + @Override + public TaskQuery modifiedWithin(TimeInterval... intervals) { + this.modifiedIn = intervals; + for (TimeInterval ti : intervals) { + if (!ti.isValid()) { + throw new IllegalArgumentException("TimeInterval " + ti + " is invalid."); + } + } + return this; + } + + @Override + public TaskQuery plannedWithin(TimeInterval... intervals) { + this.plannedIn = intervals; + for (TimeInterval ti : intervals) { + if (!ti.isValid()) { + throw new IllegalArgumentException("TimeInterval " + ti + " is invalid."); + } + } + return this; + } + + @Override + public TaskQuery dueWithin(TimeInterval... intervals) { + this.dueIn = intervals; + for (TimeInterval ti : intervals) { + if (!ti.isValid()) { + throw new IllegalArgumentException("TimeInterval " + ti + " is invalid."); + } + } + return this; + } + + @Override + public TaskQuery descriptionLike(String... description) { + this.description = toUpperCopy(description); + return this; + } + + @Override + public TaskQuery noteLike(String... note) { + this.note = toUpperCopy(note); return this; } @@ -98,25 +206,49 @@ public class TaskQueryImpl implements TaskQuery { @Override public TaskQuery classificationKeyIn(String... classificationKey) { - this.classificationKey = classificationKey; + this.classificationKeyIn = classificationKey; + return this; + } + + @Override + public TaskQuery classificationKeyLike(String... classificationKeys) { + this.classificationKeyLike = toUpperCopy(classificationKeys); return this; } @Override public TaskQuery workbasketKeyIn(String... workbasketKeys) { - this.workbasketKey = workbasketKeys; + this.workbasketKeyIn = workbasketKeys; + return this; + } + + @Override + public TaskQuery workbasketKeyLike(String... workbasketKeys) { + this.workbasketKeyLike = toUpperCopy(workbasketKeys); return this; } @Override public TaskQuery domainIn(String... domain) { - this.domain = domain; + this.domainIn = domain; + return this; + } + + @Override + public TaskQuery domainLike(String... domains) { + this.domainLike = toUpperCopy(domains); return this; } @Override public TaskQuery ownerIn(String... owners) { - this.owner = owners; + this.ownerIn = owners; + return this; + } + + @Override + public TaskQuery ownerLike(String... owners) { + this.ownerLike = toUpperCopy(owners); return this; } @@ -127,8 +259,8 @@ public class TaskQueryImpl implements TaskQuery { } @Override - public TaskQuery primaryObjectReferenceCompanyLike(String company) { - this.porCompanyLike = company; + public TaskQuery primaryObjectReferenceCompanyLike(String... company) { + this.porCompanyLike = toUpperCopy(company); return this; } @@ -139,8 +271,8 @@ public class TaskQueryImpl implements TaskQuery { } @Override - public TaskQuery primaryObjectReferenceSystemLike(String system) { - this.porSystemLike = system; + public TaskQuery primaryObjectReferenceSystemLike(String... system) { + this.porSystemLike = toUpperCopy(system); return this; } @@ -151,8 +283,8 @@ public class TaskQueryImpl implements TaskQuery { } @Override - public TaskQuery primaryObjectReferenceSystemInstanceLike(String systemInstance) { - this.porSystemInstanceLike = systemInstance; + public TaskQuery primaryObjectReferenceSystemInstanceLike(String... systemInstance) { + this.porSystemInstanceLike = toUpperCopy(systemInstance); return this; } @@ -163,8 +295,8 @@ public class TaskQueryImpl implements TaskQuery { } @Override - public TaskQuery primaryObjectReferenceTypeLike(String type) { - this.porTypeLike = type; + public TaskQuery primaryObjectReferenceTypeLike(String... type) { + this.porTypeLike = toUpperCopy(type); return this; } @@ -175,8 +307,8 @@ public class TaskQueryImpl implements TaskQuery { } @Override - public TaskQuery primaryObjectReferenceValueLike(String value) { - this.porValueLike = value; + public TaskQuery primaryObjectReferenceValueLike(String... value) { + this.porValueLike = toUpperCopy(value); return this; } @@ -199,261 +331,147 @@ public class TaskQueryImpl implements TaskQuery { } @Override - public ObjectReferenceQuery createObjectReferenceQuery() { - return new ObjectReferenceQueryImpl(taskanaEngineImpl); + public TaskQuery parentBusinessProcessIdIn(String... parentBusinessProcessIds) { + this.parentBusinessProcessIdIn = parentBusinessProcessIds; + return this; } @Override - public List list() throws NotAuthorizedException { - List result = new ArrayList<>(); - try { - LOGGER.debug("entry to list(), this = {}", this); - taskanaEngineImpl.openConnection(); - checkOpenPermissionForWorkbasketKey(); - List tasks = new ArrayList<>(); - tasks = taskanaEngineImpl.getSqlSession().selectList(LINK_TO_MAPPER, this); - result = taskService.augmentTaskSummariesByContainedSummaries(tasks); - return result; - } finally { - taskanaEngineImpl.returnConnection(); - if (LOGGER.isDebugEnabled()) { - int numberOfResultObjects = result == null ? 0 : result.size(); - LOGGER.debug("exit from list(). Returning {} resulting Objects: {} ", numberOfResultObjects, - LoggerUtils.listToString(result)); - } - } + public TaskQuery parentBusinessProcessIdLike(String... parentBusinessProcessId) { + this.parentBusinessProcessIdLike = toUpperCopy(parentBusinessProcessId); + return this; } @Override - public List list(int offset, int limit) throws NotAuthorizedException { - LOGGER.debug("entry to list(offset = {}, limit = {}), this = {}", offset, limit, this); - List result = new ArrayList<>(); - try { - taskanaEngineImpl.openConnection(); - checkOpenPermissionForWorkbasketKey(); - RowBounds rowBounds = new RowBounds(offset, limit); - List tasks = taskanaEngineImpl.getSqlSession().selectList(LINK_TO_MAPPER, this, rowBounds); - result = taskService.augmentTaskSummariesByContainedSummaries(tasks); - return result; - } catch (Exception e) { - if (e instanceof PersistenceException) { - if (e.getMessage().contains("ERRORCODE=-4470")) { - TaskanaRuntimeException ex = new TaskanaRuntimeException( - "The offset beginning was set over the amount of result-rows.", e.getCause()); - ex.setStackTrace(e.getStackTrace()); - throw ex; - } - } - throw e; - } finally { - taskanaEngineImpl.returnConnection(); - if (LOGGER.isDebugEnabled()) { - int numberOfResultObjects = result == null ? 0 : result.size(); - LOGGER.debug("exit from list(offset,limit). Returning {} resulting Objects: {} ", numberOfResultObjects, - LoggerUtils.listToString(result)); - } - } + public TaskQuery businessProcessIdIn(String... businessProcessIds) { + this.businessProcessIdIn = businessProcessIds; + return this; } @Override - public TaskSummary single() throws NotAuthorizedException { - LOGGER.debug("entry to single(), this = {}", this); - TaskSummary result = null; - try { - taskanaEngineImpl.openConnection(); - checkOpenPermissionForWorkbasketKey(); - TaskSummaryImpl taskSummaryImpl = taskanaEngineImpl.getSqlSession().selectOne(LINK_TO_MAPPER, this); - if (taskSummaryImpl == null) { - return null; - } - List tasks = new ArrayList<>(); - tasks.add(taskSummaryImpl); - List augmentedList = taskService.augmentTaskSummariesByContainedSummaries(tasks); - result = augmentedList.get(0); - - return result; - } finally { - taskanaEngineImpl.returnConnection(); - LOGGER.debug("exit from single(). Returning result {} ", result); - } + public TaskQuery businessProcessIdLike(String... businessProcessIds) { + this.businessProcessIdLike = toUpperCopy(businessProcessIds); + return this; } @Override - public long count() throws NotAuthorizedException { - LOGGER.debug("entry to count(), this = {}", this); - Long rowCount = null; - try { - taskanaEngineImpl.openConnection(); - checkOpenPermissionForWorkbasketKey(); - rowCount = taskanaEngineImpl.getSqlSession().selectOne(LINK_TO_COUNTER, this); - return (rowCount == null) ? 0L : rowCount; - } finally { - taskanaEngineImpl.returnConnection(); - LOGGER.debug("exit from count(). Returning result {} ", rowCount); - } - } - - private void checkOpenPermissionForWorkbasketKey() throws NotAuthorizedException { - if (this.workbasketKey != null && this.workbasketKey.length > 0) { - for (String wbKey : this.workbasketKey) { - taskanaEngineImpl.getWorkbasketService().checkAuthorization(wbKey, WorkbasketAuthorization.OPEN); - } - } - } - - public TaskanaEngineImpl getTaskanaEngine() { - return taskanaEngineImpl; - } - - public void setTaskanaEngine(TaskanaEngineImpl taskanaEngine) { - this.taskanaEngineImpl = taskanaEngine; - } - - public String[] getTaskIds() { - return taskIds; - } - - public String[] getName() { - return name; - } - - public String getDescription() { - return description; - } - - public int[] getPriority() { - return priority; - } - - public TaskState[] getStates() { - return states; - } - - public String[] getClassificationKey() { - return classificationKey; - } - - public String[] getWorkbasketKey() { - return workbasketKey; - } - - public String[] getDomain() { - return domain; - } - - public String[] getOwner() { - return owner; - } - - public String[] getCustomFields() { - return customFields; - } - - public Boolean getIsRead() { - return isRead; - } - - public Boolean getIsTransferred() { - return isTransferred; - } - - public String[] getPorCompanyIn() { - return porCompanyIn; - } - - public String getPorCompanyLike() { - return porCompanyLike; - } - - public String[] getPorSystemIn() { - return porSystemIn; - } - - public String getPorSystemLike() { - return porSystemLike; - } - - public String[] getPorSystemInstanceIn() { - return porSystemInstanceIn; - } - - public String getPorSystemInstanceLike() { - return porSystemInstanceLike; - } - - public String[] getPorTypeIn() { - return porTypeIn; - } - - public String getPorTypeLike() { - return porTypeLike; - } - - public String[] getPorValueIn() { - return porValueIn; - } - - public String getPorValueLike() { - return porValueLike; - } - - public List getOrderBy() { - return orderBy; + public TaskQuery custom1In(String... strings) { + this.custom1In = strings; + return this; } @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="); - builder.append(description); - builder.append(", note="); - builder.append(note); - builder.append(", priority="); - builder.append(Arrays.toString(priority)); - builder.append(", states="); - builder.append(Arrays.toString(states)); - builder.append(", classificationKey="); - 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="); - builder.append(isRead); - builder.append(", isTransferred="); - builder.append(isTransferred); - builder.append(", customFields="); - builder.append(Arrays.toString(customFields)); - builder.append(", porCompanyIn="); - builder.append(Arrays.toString(porCompanyIn)); - builder.append(", porCompanyLike="); - builder.append(porCompanyLike); - builder.append(", porSystemIn="); - builder.append(Arrays.toString(porSystemIn)); - builder.append(", porSystemLike="); - builder.append(porSystemLike); - builder.append(", porSystemInstanceIn="); - builder.append(Arrays.toString(porSystemInstanceIn)); - builder.append(", porSystemInstanceLike="); - builder.append(porSystemInstanceLike); - builder.append(", porTypeIn="); - builder.append(Arrays.toString(porTypeIn)); - builder.append(", porTypeLike="); - builder.append(porTypeLike); - builder.append(", porValueIn="); - builder.append(Arrays.toString(porValueIn)); - builder.append(", porValueLike="); - builder.append(porValueLike); - builder.append("]"); - return builder.toString(); + public TaskQuery custom1Like(String... strings) { + this.custom1Like = toUpperCopy(strings); + return this; + } + + @Override + public TaskQuery custom2In(String... strings) { + this.custom2In = strings; + return this; + } + + @Override + public TaskQuery custom2Like(String... strings) { + this.custom2Like = toUpperCopy(strings); + return this; + } + + @Override + public TaskQuery custom3In(String... strings) { + this.custom3In = strings; + return this; + } + + @Override + public TaskQuery custom3Like(String... strings) { + this.custom3Like = toUpperCopy(strings); + return this; + } + + @Override + public TaskQuery custom4In(String... strings) { + this.custom4In = strings; + return this; + } + + @Override + public TaskQuery custom4Like(String... strings) { + this.custom4Like = toUpperCopy(strings); + return this; + } + + @Override + public TaskQuery custom5In(String... strings) { + this.custom5In = strings; + return this; + } + + @Override + public TaskQuery custom5Like(String... strings) { + this.custom5Like = toUpperCopy(strings); + return this; + } + + @Override + public TaskQuery custom6In(String... strings) { + this.custom6In = strings; + return this; + } + + @Override + public TaskQuery custom6Like(String... strings) { + this.custom6Like = toUpperCopy(strings); + return this; + } + + @Override + public TaskQuery custom7In(String... strings) { + this.custom7In = strings; + return this; + } + + @Override + public TaskQuery custom7Like(String... strings) { + this.custom7Like = toUpperCopy(strings); + return this; + } + + @Override + public TaskQuery custom8In(String... strings) { + this.custom8In = strings; + return this; + } + + @Override + public TaskQuery custom8Like(String... strings) { + this.custom8Like = toUpperCopy(strings); + return this; + } + + @Override + public TaskQuery custom9In(String... strings) { + this.custom9In = strings; + return this; + } + + @Override + public TaskQuery custom9Like(String... strings) { + this.custom9Like = toUpperCopy(strings); + return this; + } + + @Override + public TaskQuery custom10In(String... strings) { + this.custom10In = strings; + return this; + } + + @Override + public TaskQuery custom10Like(String... strings) { + this.custom10Like = toUpperCopy(strings); + return this; } @Override @@ -611,6 +629,353 @@ public class TaskQueryImpl implements TaskQuery { return addOrderCriteria("PARENT_BUSINESS_PROCESS_ID", sortDirection); } + @Override + public ObjectReferenceQuery createObjectReferenceQuery() { + return new ObjectReferenceQueryImpl(taskanaEngineImpl); + } + + @Override + public List list() throws NotAuthorizedException { + List result = new ArrayList<>(); + try { + LOGGER.debug("entry to list(), this = {}", this); + taskanaEngineImpl.openConnection(); + checkOpenPermissionForWorkbasketKey(); + List tasks = new ArrayList<>(); + tasks = taskanaEngineImpl.getSqlSession().selectList(LINK_TO_MAPPER, this); + result = taskService.augmentTaskSummariesByContainedSummaries(tasks); + return result; + } finally { + taskanaEngineImpl.returnConnection(); + if (LOGGER.isDebugEnabled()) { + int numberOfResultObjects = result == null ? 0 : result.size(); + LOGGER.debug("exit from list(). Returning {} resulting Objects: {} ", numberOfResultObjects, + LoggerUtils.listToString(result)); + } + } + } + + @Override + public List list(int offset, int limit) throws NotAuthorizedException { + LOGGER.debug("entry to list(offset = {}, limit = {}), this = {}", offset, limit, this); + List result = new ArrayList<>(); + try { + taskanaEngineImpl.openConnection(); + checkOpenPermissionForWorkbasketKey(); + RowBounds rowBounds = new RowBounds(offset, limit); + List tasks = taskanaEngineImpl.getSqlSession().selectList(LINK_TO_MAPPER, this, rowBounds); + result = taskService.augmentTaskSummariesByContainedSummaries(tasks); + return result; + } catch (Exception e) { + if (e instanceof PersistenceException) { + if (e.getMessage().contains("ERRORCODE=-4470")) { + TaskanaRuntimeException ex = new TaskanaRuntimeException( + "The offset beginning was set over the amount of result-rows.", e.getCause()); + ex.setStackTrace(e.getStackTrace()); + throw ex; + } + } + throw e; + } finally { + taskanaEngineImpl.returnConnection(); + if (LOGGER.isDebugEnabled()) { + int numberOfResultObjects = result == null ? 0 : result.size(); + LOGGER.debug("exit from list(offset,limit). Returning {} resulting Objects: {} ", numberOfResultObjects, + LoggerUtils.listToString(result)); + } + } + } + + @Override + public TaskSummary single() throws NotAuthorizedException { + LOGGER.debug("entry to single(), this = {}", this); + TaskSummary result = null; + try { + taskanaEngineImpl.openConnection(); + checkOpenPermissionForWorkbasketKey(); + TaskSummaryImpl taskSummaryImpl = taskanaEngineImpl.getSqlSession().selectOne(LINK_TO_MAPPER, this); + if (taskSummaryImpl == null) { + return null; + } + List tasks = new ArrayList<>(); + tasks.add(taskSummaryImpl); + List augmentedList = taskService.augmentTaskSummariesByContainedSummaries(tasks); + result = augmentedList.get(0); + + return result; + } finally { + taskanaEngineImpl.returnConnection(); + LOGGER.debug("exit from single(). Returning result {} ", result); + } + } + + @Override + public long count() throws NotAuthorizedException { + LOGGER.debug("entry to count(), this = {}", this); + Long rowCount = null; + try { + taskanaEngineImpl.openConnection(); + checkOpenPermissionForWorkbasketKey(); + rowCount = taskanaEngineImpl.getSqlSession().selectOne(LINK_TO_COUNTER, this); + return (rowCount == null) ? 0L : rowCount; + } finally { + taskanaEngineImpl.returnConnection(); + LOGGER.debug("exit from count(). Returning result {} ", rowCount); + } + } + + private void checkOpenPermissionForWorkbasketKey() throws NotAuthorizedException { + if (this.workbasketKeyIn != null && this.workbasketKeyIn.length > 0) { + for (String wbKey : this.workbasketKeyIn) { + taskanaEngineImpl.getWorkbasketService().checkAuthorization(wbKey, WorkbasketAuthorization.OPEN); + } + } + } + + public TaskanaEngineImpl getTaskanaEngine() { + return taskanaEngineImpl; + } + + public String[] getTaskIds() { + return taskIds; + } + + public String[] getNameIn() { + return nameIn; + } + + public String[] getDescription() { + return description; + } + + public int[] getPriority() { + return priority; + } + + public TaskState[] getStates() { + return states; + } + + public String[] getOwnerIn() { + return ownerIn; + } + + public String[] getOwnerLike() { + return ownerLike; + } + + public String[] getCustomFields() { + return customFields; + } + + public Boolean getIsRead() { + return isRead; + } + + public Boolean getIsTransferred() { + return isTransferred; + } + + public String[] getPorCompanyIn() { + return porCompanyIn; + } + + public String[] getPorCompanyLike() { + return porCompanyLike; + } + + public String[] getPorSystemIn() { + return porSystemIn; + } + + public String[] getPorSystemLike() { + return porSystemLike; + } + + public String[] getPorSystemInstanceIn() { + return porSystemInstanceIn; + } + + public String[] getPorSystemInstanceLike() { + return porSystemInstanceLike; + } + + public String[] getPorTypeIn() { + return porTypeIn; + } + + public String[] getPorTypeLike() { + return porTypeLike; + } + + public String[] getPorValueIn() { + return porValueIn; + } + + public String[] getPorValueLike() { + return porValueLike; + } + + public List getOrderBy() { + return orderBy; + } + + public TimeInterval[] getCreatedIn() { + return createdIn; + } + + public TaskServiceImpl getTaskService() { + return taskService; + } + + public String[] getNote() { + return note; + } + + public String[] getParentBusinessProcessIdIn() { + return parentBusinessProcessIdIn; + } + + public String[] getParentBusinessProcessIdLike() { + return parentBusinessProcessIdLike; + } + + public String[] getBusinessProcessIdIn() { + return businessProcessIdIn; + } + + public String[] getBusinessProcessIdLike() { + return businessProcessIdLike; + } + + public String[] getCustom1In() { + return custom1In; + } + + public String[] getCustom1Like() { + return custom1Like; + } + + public String[] getCustom2In() { + return custom2In; + } + + public String[] getCustom2Like() { + return custom2Like; + } + + public String[] getCustom3In() { + return custom3In; + } + + public String[] getCustom3Like() { + return custom3Like; + } + + public String[] getCustom4In() { + return custom4In; + } + + public String[] getCustom4Like() { + return custom4Like; + } + + public String[] getCustom5In() { + return custom5In; + } + + public String[] getCustom5Like() { + return custom5Like; + } + + public String[] getCustom6In() { + return custom6In; + } + + public String[] getCustom6Like() { + return custom6Like; + } + + public String[] getCustom7In() { + return custom7In; + } + + public String[] getCustom7Like() { + return custom7Like; + } + + public String[] getCustom8In() { + return custom8In; + } + + public String[] getCustom8Like() { + return custom8Like; + } + + public String[] getCustom9In() { + return custom9In; + } + + public String[] getCustom9Like() { + return custom9Like; + } + + public String[] getCustom10In() { + return custom10In; + } + + public String[] getCustom10Like() { + return custom10Like; + } + + public TimeInterval[] getClaimedIn() { + return claimedIn; + } + + public TimeInterval[] getCompletedIn() { + return completedIn; + } + + public TimeInterval[] getModifiedIn() { + return modifiedIn; + } + + public TimeInterval[] getPlannedIn() { + return plannedIn; + } + + public TimeInterval[] getDueIn() { + return dueIn; + } + + public String[] getNameLike() { + return nameLike; + } + + public String[] getClassificationKeyIn() { + return classificationKeyIn; + } + + public String[] getClassificationKeyLike() { + return classificationKeyLike; + } + + public String[] getWorkbasketKeyIn() { + return workbasketKeyIn; + } + + public String[] getWorkbasketKeyLike() { + return workbasketKeyLike; + } + + public String[] getDomainIn() { + return domainIn; + } + + public String[] getDomainLike() { + return domainLike; + } + private TaskQuery addOrderCriteria(String columnName, SortDirection sortDirection) { String orderByDirection = " ASC"; if (sortDirection != null && SortDirection.DESCENDING.equals(sortDirection)) { @@ -619,4 +984,138 @@ public class TaskQueryImpl implements TaskQuery { orderBy.add(columnName + orderByDirection); return this; } + + private String[] toUpperCopy(String... source) { + String[] target = new String[source.length]; + for (int i = 0; i < source.length; i++) { + target[i] = source[i].toUpperCase(); + } + return target; + } + + @Override + public String toString() { + StringBuilder builder = new StringBuilder(); + builder.append("TaskQueryImpl [nameIn="); + builder.append(Arrays.toString(nameIn)); + builder.append(", nameLike="); + builder.append(Arrays.toString(nameLike)); + builder.append(", taskIds="); + builder.append(Arrays.toString(taskIds)); + builder.append(", description="); + builder.append(Arrays.toString(description)); + builder.append(", note="); + builder.append(Arrays.toString(note)); + builder.append(", priority="); + builder.append(Arrays.toString(priority)); + builder.append(", states="); + builder.append(Arrays.toString(states)); + builder.append(", classificationKeyIn="); + builder.append(Arrays.toString(classificationKeyIn)); + builder.append(", classificationKeyLike="); + builder.append(Arrays.toString(classificationKeyLike)); + builder.append(", workbasketKeyIn="); + builder.append(Arrays.toString(workbasketKeyIn)); + builder.append(", workbasketKeyLike="); + builder.append(Arrays.toString(workbasketKeyLike)); + builder.append(", domainIn="); + builder.append(Arrays.toString(domainIn)); + builder.append(", domainLike="); + builder.append(Arrays.toString(domainLike)); + builder.append(", ownerIn="); + builder.append(Arrays.toString(ownerIn)); + builder.append(", ownerLike="); + builder.append(Arrays.toString(ownerLike)); + builder.append(", isRead="); + builder.append(isRead); + builder.append(", isTransferred="); + builder.append(isTransferred); + builder.append(", customFields="); + builder.append(Arrays.toString(customFields)); + builder.append(", porCompanyIn="); + builder.append(Arrays.toString(porCompanyIn)); + builder.append(", porCompanyLike="); + builder.append(Arrays.toString(porCompanyLike)); + builder.append(", porSystemIn="); + builder.append(Arrays.toString(porSystemIn)); + builder.append(", porSystemLike="); + builder.append(Arrays.toString(porSystemLike)); + builder.append(", porSystemInstanceIn="); + builder.append(Arrays.toString(porSystemInstanceIn)); + builder.append(", porSystemInstanceLike="); + builder.append(Arrays.toString(porSystemInstanceLike)); + builder.append(", porTypeIn="); + builder.append(Arrays.toString(porTypeIn)); + builder.append(", porTypeLike="); + builder.append(Arrays.toString(porTypeLike)); + builder.append(", porValueIn="); + builder.append(Arrays.toString(porValueIn)); + builder.append(", porValueLike="); + builder.append(Arrays.toString(porValueLike)); + builder.append(", parentBusinessProcessIdIn="); + builder.append(Arrays.toString(parentBusinessProcessIdIn)); + builder.append(", parentBusinessProcessIdLike="); + builder.append(Arrays.toString(parentBusinessProcessIdLike)); + builder.append(", businessProcessIdIn="); + builder.append(Arrays.toString(businessProcessIdIn)); + builder.append(", businessProcessIdLike="); + builder.append(Arrays.toString(businessProcessIdLike)); + builder.append(", custom1In="); + builder.append(Arrays.toString(custom1In)); + builder.append(", custom1Like="); + builder.append(Arrays.toString(custom1Like)); + builder.append(", custom2In="); + builder.append(Arrays.toString(custom2In)); + builder.append(", custom2Like="); + builder.append(Arrays.toString(custom2Like)); + builder.append(", custom3In="); + builder.append(Arrays.toString(custom3In)); + builder.append(", custom3Like="); + builder.append(Arrays.toString(custom3Like)); + builder.append(", custom4In="); + builder.append(Arrays.toString(custom4In)); + builder.append(", custom4Like="); + builder.append(Arrays.toString(custom4Like)); + builder.append(", custom5In="); + builder.append(Arrays.toString(custom5In)); + builder.append(", custom5Like="); + builder.append(Arrays.toString(custom5Like)); + builder.append(", custom6In="); + builder.append(Arrays.toString(custom6In)); + builder.append(", custom6Like="); + builder.append(Arrays.toString(custom6Like)); + builder.append(", custom7In="); + builder.append(Arrays.toString(custom7In)); + builder.append(", custom7Like="); + builder.append(Arrays.toString(custom7Like)); + builder.append(", custom8In="); + builder.append(Arrays.toString(custom8In)); + builder.append(", custom8Like="); + builder.append(Arrays.toString(custom8Like)); + builder.append(", custom9In="); + builder.append(Arrays.toString(custom9In)); + builder.append(", custom9Like="); + builder.append(Arrays.toString(custom9Like)); + builder.append(", custom10In="); + builder.append(Arrays.toString(custom10In)); + builder.append(", custom10Like="); + builder.append(Arrays.toString(custom10Like)); + builder.append(", createdIn="); + builder.append(Arrays.toString(createdIn)); + builder.append(", claimedIn="); + builder.append(Arrays.toString(claimedIn)); + builder.append(", completedIn="); + builder.append(Arrays.toString(completedIn)); + builder.append(", modifiedIn="); + builder.append(Arrays.toString(modifiedIn)); + builder.append(", plannedIn="); + builder.append(Arrays.toString(plannedIn)); + builder.append(", dueIn="); + builder.append(Arrays.toString(dueIn)); + builder.append(", orderBy="); + builder.append(orderBy); + builder.append("]"); + return builder.toString(); + } + } 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 f49b44927..7d4314541 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 @@ -31,27 +31,62 @@ public interface QueryMapper { + "FROM TASK t " + "" + "AND t.ID IN(#{item}) " - + "AND t.NAME IN(#{item}) " - + "AND t.DESCRIPTION like #{description} " - + "AND t.NOTE like #{note} " + + " AND ( ( t.CREATED >= #{item.begin} AND t.CREATED <=#{item.end} )) " + + " AND ( ( t.CLAIMED >= #{item.begin} AND t.CLAIMED <=#{item.end} )) " + + " AND ( ( t.COMPLETED >= #{item.begin} AND t.COMPLETED <=#{item.end} )) " + + " AND ( ( t.MODIFIED >= #{item.begin} AND t.MODIFIED <=#{item.end} )) " + + " AND ( ( t.PLANNED >= #{item.begin} AND t.PLANNED <=#{item.end} )) " + + " AND ( ( t.DUE >= #{item.begin} AND t.DUE <=#{item.end} )) " + + "AND t.NAME IN(#{item}) " + + "AND (UPPER(t.NAME) LIKE #{item}) " + + "AND (t.DESCRIPTION LIKE #{item}) " + + "AND (t.NOTE LIKE #{item}) " + "AND t.PRIORITY IN(#{item}) " + "AND t.STATE IN(#{item}) " - + "AND t.WORKBASKET_KEY IN(#{item}) " - + "AND t.CLASSIFICATION_KEY IN(#{item}) " - + "AND t.DOMAIN IN(#{item}) " - + "AND t.OWNER IN(#{item}) " + + "AND t.WORKBASKET_KEY IN(#{item}) " + + "AND (UPPER(t.WORKBASKET_KEY) LIKE #{item}) " + + "AND t.CLASSIFICATION_KEY IN(#{item}) " + + "AND (UPPER(t.CLASSIFICATION_KEY) LIKE #{item}) " + + "AND t.DOMAIN IN(#{item}) " + + "AND (UPPER(t.DOMAIN) LIKE #{item}) " + + "AND t.OWNER IN(#{item}) " + + "AND (UPPER(t.OWNER) LIKE #{item}) " + "AND t.IS_READ = #{isRead} " + "AND t.IS_TRANSFERRED = #{isTransferred} " + "AND t.POR_COMPANY IN(#{item}) " - + "AND t.POR_COMPANY like #{porCompanyLike} " + + "AND (UPPER(t.POR_COMPANY) LIKE #{item}) " + "AND t.POR_SYSTEM IN(#{item}) " - + "AND t.POR_SYSTEM like #{porSystemLike} " + + "AND (UPPER(t.POR_SYSTEM) LIKE #{item}) " + "AND t.POR_INSTANCE IN(#{item}) " - + "AND t.POR_INSTANCE like #{porSystemInstanceLike} " + + "AND (UPPER(t.POR_INSTANCE) LIKE #{item}) " + "AND t.POR_TYPE IN(#{item}) " - + "AND t.POR_TYPE like #{porTypeLike} " + + "AND (UPPER(t.POR_TYPE) LIKE #{item}) " + "AND t.POR_VALUE IN(#{item}) " - + "AND t.POR_VALUE like #{porValueLike} " + + "AND (UPPER(t.POR_VALUE) LIKE #{item}) " + + "AND t.PARENT_BUSINESS_PROCESS_ID IN(#{item}) " + + "AND (UPPER(t.PARENT_BUSINESS_PROCESS_ID) LIKE #{item}) " + + "AND t.BUSINESS_PROCESS_ID IN(#{item}) " + + "AND (UPPER(t.BUSINESS_PROCESS_ID) LIKE #{item}) " + + "AND t.CUSTOM_1 IN(#{item}) " + + "AND (UPPER(t.CUSTOM_1) LIKE #{item}) " + + "AND t.CUSTOM_2 IN(#{item}) " + + "AND (UPPER(t.CUSTOM_2) LIKE #{item}) " + + "AND t.CUSTOM_3 IN(#{item}) " + + "AND (UPPER(t.CUSTOM_3) LIKE #{item}) " + + "AND t.CUSTOM_4 IN(#{item}) " + + "AND (UPPER(t.CUSTOM_4) LIKE #{item}) " + + "AND t.CUSTOM_5 IN(#{item}) " + + "AND (UPPER(t.CUSTOM_5) LIKE #{item}) " + + "AND t.CUSTOM_6 IN(#{item}) " + + "AND (UPPER(t.CUSTOM_6) LIKE #{item}) " + + "AND t.CUSTOM_7 IN(#{item}) " + + "AND (UPPER(t.CUSTOM_7) LIKE #{item}) " + + "AND t.CUSTOM_8 IN(#{item}) " + + "AND (UPPER(t.CUSTOM_8) LIKE #{item}) " + + "AND t.CUSTOM_9 IN(#{item}) " + + "AND (UPPER(t.CUSTOM_9) LIKE #{item}) " + + "AND t.CUSTOM_10 IN(#{item}) " + + "AND (UPPER(t.CUSTOM_10) LIKE #{item}) " + "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} " @@ -246,27 +281,63 @@ public interface QueryMapper { @Select("") diff --git a/lib/taskana-core/src/test/java/acceptance/AbstractAccTest.java b/lib/taskana-core/src/test/java/acceptance/AbstractAccTest.java index 06b5ac664..2935a9866 100644 --- a/lib/taskana-core/src/test/java/acceptance/AbstractAccTest.java +++ b/lib/taskana-core/src/test/java/acceptance/AbstractAccTest.java @@ -3,6 +3,8 @@ package acceptance; import java.sql.SQLException; import java.time.Instant; import java.time.LocalDate; +import java.time.LocalDateTime; +import java.time.ZoneId; import java.time.ZoneOffset; import java.util.HashMap; import java.util.Map; @@ -94,4 +96,8 @@ public abstract class AbstractAccTest { return attachment; } + + protected Instant getInstant(String datetime) { + return LocalDateTime.parse(datetime).atZone(ZoneId.systemDefault()).toInstant(); + } } diff --git a/lib/taskana-core/src/test/java/acceptance/task/QueryTasksAccTest.java b/lib/taskana-core/src/test/java/acceptance/task/QueryTasksAccTest.java new file mode 100644 index 000000000..d04204ec3 --- /dev/null +++ b/lib/taskana-core/src/test/java/acceptance/task/QueryTasksAccTest.java @@ -0,0 +1,445 @@ +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 java.util.stream.Collectors; + +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.security.JAASRunner; +import pro.taskana.security.WithAccessId; + +/** + * Acceptance test for all "query tasks with sorting" scenarios. + */ +@RunWith(JAASRunner.class) +public class QueryTasksAccTest extends AbstractAccTest { + + private static SortDirection asc = SortDirection.ASCENDING; + private static SortDirection desc = SortDirection.DESCENDING; + + public QueryTasksAccTest() { + super(); + } + + @WithAccessId( + userName = "teamlead_1", + groupNames = {"group_1"}) + @Test + public void testQueryForOwnerLike() + throws SQLException, NotAuthorizedException, InvalidArgumentException { + TaskService taskService = taskanaEngine.getTaskService(); + + List results = taskService.createTaskQuery() + .ownerLike("%a%", "%u%") + .orderByCreated(asc) + .list(); + + assertThat(results.size(), equalTo(25)); + TaskSummary previousSummary = null; + for (TaskSummary taskSummary : results) { + if (previousSummary != null) { + Assert.assertTrue(!previousSummary.getCreated().isAfter(taskSummary.getCreated())); + } + previousSummary = taskSummary; + } + } + + @WithAccessId( + userName = "teamlead_1", + groupNames = {"group_1"}) + @Test + public void testQueryForParentBusinessProcessId() + throws SQLException, NotAuthorizedException, InvalidArgumentException { + TaskService taskService = taskanaEngine.getTaskService(); + + List results = taskService.createTaskQuery() + .parentBusinessProcessIdLike("%PBPI%", "doc%3%") + .list(); + assertThat(results.size(), equalTo(24)); + + String[] parentIds = results.stream() + .map(TaskSummary::getParentBusinessProcessId) + .collect(Collectors.toList()) + .toArray(new String[0]); + + List result2 = taskService.createTaskQuery() + .parentBusinessProcessIdIn(parentIds) + .list(); + assertThat(result2.size(), equalTo(24)); + } + + @WithAccessId( + userName = "teamlead_1", + groupNames = {"group_1"}) + @Test + public void testQueryForName() + throws SQLException, NotAuthorizedException, InvalidArgumentException { + TaskService taskService = taskanaEngine.getTaskService(); + + List results = taskService.createTaskQuery() + .nameLike("task%") + .list(); + assertThat(results.size(), equalTo(6)); + + String[] ids = results.stream() + .map(TaskSummary::getName) + .collect(Collectors.toList()) + .toArray(new String[0]); + + List result2 = taskService.createTaskQuery() + .nameIn(ids) + .list(); + assertThat(result2.size(), equalTo(6)); + } + + @WithAccessId( + userName = "teamlead_1", + groupNames = {"group_1"}) + @Test + public void testQueryForClassificationKey() + throws SQLException, NotAuthorizedException, InvalidArgumentException { + TaskService taskService = taskanaEngine.getTaskService(); + + List results = taskService.createTaskQuery() + .classificationKeyLike("L10%") + .list(); + assertThat(results.size(), equalTo(64)); + + String[] ids = results.stream() + .map(t -> t.getClassificationSummary().getKey()) + .collect(Collectors.toList()) + .toArray(new String[0]); + + List result2 = taskService.createTaskQuery() + .classificationKeyIn(ids) + .list(); + assertThat(result2.size(), equalTo(64)); + } + + @WithAccessId( + userName = "teamlead_1", + groupNames = {"group_1"}) + @Test + public void testQueryForWorkbasketKey() + throws SQLException, NotAuthorizedException, InvalidArgumentException { + TaskService taskService = taskanaEngine.getTaskService(); + + List results = taskService.createTaskQuery() + .workbasketKeyLike("user%") + .list(); + assertThat(results.size(), equalTo(22)); + + String[] ids = results.stream() + .map(t -> t.getWorkbasketSummary().getKey()) + .collect(Collectors.toList()) + .toArray(new String[0]); + + List result2 = taskService.createTaskQuery() + .workbasketKeyIn(ids) + .list(); + assertThat(result2.size(), equalTo(22)); + } + + @WithAccessId( + userName = "teamlead_1", + groupNames = {"group_1"}) + @Test + public void testQueryForDomain() + throws SQLException, NotAuthorizedException, InvalidArgumentException { + TaskService taskService = taskanaEngine.getTaskService(); + + List results = taskService.createTaskQuery() + .domainLike("dom%b") + .list(); + assertThat(results.size(), equalTo(4)); + + String[] ids = results.stream() + .map(TaskSummary::getDomain) + .collect(Collectors.toList()) + .toArray(new String[0]); + + List result2 = taskService.createTaskQuery() + .domainIn(ids) + .list(); + assertThat(result2.size(), equalTo(4)); + } + + @WithAccessId( + userName = "teamlead_1", + groupNames = {"group_1"}) + @Test + public void testQueryForCustom1() + throws SQLException, NotAuthorizedException, InvalidArgumentException { + TaskService taskService = taskanaEngine.getTaskService(); + + List results = taskService.createTaskQuery() + .custom1Like("%a%", "%b%", "%c%", "%d%", "%e%", "%f%", "%g%", "%h%", "%i%", "%j%", "%k%", "%l%", "%m%", + "%n%", "%o%", "%p%", + "%q%", "%r%", "%s%", "%w%") + .list(); + assertThat(results.size(), equalTo(2)); + + String[] ids = results.stream() + .map(TaskSummary::getCustom1) + .collect(Collectors.toList()) + .toArray(new String[0]); + + List result2 = taskService.createTaskQuery() + .custom1In(ids) + .list(); + assertThat(result2.size(), equalTo(2)); + } + + @WithAccessId( + userName = "teamlead_1", + groupNames = {"group_1"}) + @Test + public void testQueryForCustom2() + throws SQLException, NotAuthorizedException, InvalidArgumentException { + TaskService taskService = taskanaEngine.getTaskService(); + + List results = taskService.createTaskQuery() + .custom2Like("%a%", "%b%", "%c%", "%d%", "%e%", "%f%", "%g%", "%h%", "%i%", "%j%", "%k%", "%l%", "%m%", + "%n%", "%o%", "%p%", + "%q%", "%r%", "%s%", "%w%") + .list(); + assertThat(results.size(), equalTo(1)); + + String[] ids = results.stream() + .map(TaskSummary::getCustom2) + .collect(Collectors.toList()) + .toArray(new String[0]); + + List result2 = taskService.createTaskQuery() + .custom2In(ids) + .list(); + assertThat(result2.size(), equalTo(1)); + } + + @WithAccessId( + userName = "teamlead_1", + groupNames = {"group_1"}) + @Test + public void testQueryForCustom3() + throws SQLException, NotAuthorizedException, InvalidArgumentException { + TaskService taskService = taskanaEngine.getTaskService(); + + List results = taskService.createTaskQuery() + .custom3Like("%a%", "%b%", "%c%", "%d%", "%e%", "%f%", "%g%", "%h%", "%i%", "%j%", "%k%", "%l%", "%m%", + "%n%", "%o%", "%p%", + "%q%", "%r%", "%s%", "%w%") + .list(); + assertThat(results.size(), equalTo(1)); + + String[] ids = results.stream() + .map(TaskSummary::getCustom3) + .collect(Collectors.toList()) + .toArray(new String[0]); + + List result2 = taskService.createTaskQuery() + .custom3In(ids) + .list(); + assertThat(result2.size(), equalTo(1)); + } + + @WithAccessId( + userName = "teamlead_1", + groupNames = {"group_1"}) + @Test + public void testQueryForCustom4() + throws SQLException, NotAuthorizedException, InvalidArgumentException { + TaskService taskService = taskanaEngine.getTaskService(); + + List results = taskService.createTaskQuery() + .custom4Like("%a%", "%b%", "%c%", "%d%", "%e%", "%f%", "%g%", "%h%", "%i%", "%j%", "%k%", "%l%", "%m%", + "%n%", "%o%", "%p%", + "%q%", "%r%", "%s%", "%w%") + .list(); + assertThat(results.size(), equalTo(1)); + + String[] ids = results.stream() + .map(TaskSummary::getCustom4) + .collect(Collectors.toList()) + .toArray(new String[0]); + + List result2 = taskService.createTaskQuery() + .custom4In(ids) + .list(); + assertThat(result2.size(), equalTo(1)); + } + + @WithAccessId( + userName = "teamlead_1", + groupNames = {"group_1"}) + @Test + public void testQueryForCustom5() + throws SQLException, NotAuthorizedException, InvalidArgumentException { + TaskService taskService = taskanaEngine.getTaskService(); + + List results = taskService.createTaskQuery() + .custom5Like("%a%", "%b%", "%c%", "%d%", "%e%", "%f%", "%g%", "%h%", "%i%", "%j%", "%k%", "%l%", "%m%", + "%n%", "%o%", "%p%", + "%q%", "%r%", "%s%", "%w%") + .list(); + assertThat(results.size(), equalTo(3)); + + String[] ids = results.stream() + .map(TaskSummary::getCustom5) + .collect(Collectors.toList()) + .toArray(new String[0]); + + List result2 = taskService.createTaskQuery() + .custom5In(ids) + .list(); + assertThat(result2.size(), equalTo(3)); + } + + @WithAccessId( + userName = "teamlead_1", + groupNames = {"group_1"}) + @Test + public void testQueryForCustom6() + throws SQLException, NotAuthorizedException, InvalidArgumentException { + TaskService taskService = taskanaEngine.getTaskService(); + + List results = taskService.createTaskQuery() + .custom6Like("%a%", "%b%", "%c%", "%d%", "%e%", "%f%", "%g%", "%h%", "%i%", "%j%", "%k%", "%l%", "%m%", + "%n%", "%o%", "%p%", + "%q%", "%r%", "%s%", "%w%") + .list(); + assertThat(results.size(), equalTo(2)); + + String[] ids = results.stream() + .map(TaskSummary::getCustom6) + .collect(Collectors.toList()) + .toArray(new String[0]); + + List result2 = taskService.createTaskQuery() + .custom6In(ids) + .list(); + assertThat(result2.size(), equalTo(2)); + } + + @WithAccessId( + userName = "teamlead_1", + groupNames = {"group_1"}) + @Test + public void testQueryForCustom7() + throws SQLException, NotAuthorizedException, InvalidArgumentException { + TaskService taskService = taskanaEngine.getTaskService(); + + List results = taskService.createTaskQuery() + .custom7Like("%a%", "%b%", "%c%", "%d%", "%e%", "%f%", "%g%", "%h%", "%i%", "%j%", "%k%", "%l%", "%m%", + "%n%", "%o%", "%p%", + "%q%", "%r%", "%s%", "%w%") + .list(); + assertThat(results.size(), equalTo(1)); + + String[] ids = results.stream() + .map(TaskSummary::getCustom7) + .collect(Collectors.toList()) + .toArray(new String[0]); + + List result2 = taskService.createTaskQuery() + .custom7In(ids) + .list(); + assertThat(result2.size(), equalTo(1)); + } + + @WithAccessId( + userName = "teamlead_1", + groupNames = {"group_1"}) + @Test + public void testQueryForCustom8() + throws SQLException, NotAuthorizedException, InvalidArgumentException { + TaskService taskService = taskanaEngine.getTaskService(); + + List results = taskService.createTaskQuery() + .custom8Like("%a%", "%b%", "%c%", "%d%", "%e%", "%f%", "%g%", "%h%", "%i%", "%j%", "%k%", "%l%", "%m%", + "%n%", "%o%", "%p%", + "%q%", "%r%", "%s%", "%w%") + .list(); + assertThat(results.size(), equalTo(1)); + + String[] ids = results.stream() + .map(TaskSummary::getCustom8) + .collect(Collectors.toList()) + .toArray(new String[0]); + + List result2 = taskService.createTaskQuery() + .custom8In(ids) + .list(); + assertThat(result2.size(), equalTo(1)); + } + + @WithAccessId( + userName = "teamlead_1", + groupNames = {"group_1"}) + @Test + public void testQueryForCustom9() + throws SQLException, NotAuthorizedException, InvalidArgumentException { + TaskService taskService = taskanaEngine.getTaskService(); + + List results = taskService.createTaskQuery() + .custom9Like("%a%", "%b%", "%c%", "%d%", "%e%", "%f%", "%g%", "%h%", "%i%", "%j%", "%k%", "%l%", "%m%", + "%n%", "%o%", "%p%", + "%q%", "%r%", "%s%", "%w%") + .list(); + assertThat(results.size(), equalTo(1)); + + String[] ids = results.stream() + .map(TaskSummary::getCustom9) + .collect(Collectors.toList()) + .toArray(new String[0]); + + List result2 = taskService.createTaskQuery() + .custom9In(ids) + .list(); + assertThat(result2.size(), equalTo(1)); + } + + @WithAccessId( + userName = "teamlead_1", + groupNames = {"group_1"}) + @Test + public void testQueryForCustom10() + throws SQLException, NotAuthorizedException, InvalidArgumentException { + TaskService taskService = taskanaEngine.getTaskService(); + + List results = taskService.createTaskQuery() + .custom10Like("%a%", "%b%", "%c%", "%d%", "%e%", "%f%", "%g%", "%h%", "%i%", "%j%", "%k%", "%l%", "%m%", + "%n%", "%o%", "%p%", + "%q%", "%r%", "%s%", "%w%") + .list(); + assertThat(results.size(), equalTo(2)); + + String[] ids = results.stream() + .map(TaskSummary::getCustom10) + .collect(Collectors.toList()) + .toArray(new String[0]); + + List result2 = taskService.createTaskQuery() + .custom10In(ids) + .list(); + assertThat(result2.size(), equalTo(2)); + } + + @AfterClass + public static void cleanUpClass() { + FileUtils.deleteRecursive("~/data", true); + } +} diff --git a/lib/taskana-core/src/test/java/acceptance/task/QueryTasksByTimeIntervalsAccTest.java b/lib/taskana-core/src/test/java/acceptance/task/QueryTasksByTimeIntervalsAccTest.java new file mode 100644 index 000000000..a17228f11 --- /dev/null +++ b/lib/taskana-core/src/test/java/acceptance/task/QueryTasksByTimeIntervalsAccTest.java @@ -0,0 +1,284 @@ +package acceptance.task; + +import static org.hamcrest.core.IsEqual.equalTo; +import static org.junit.Assert.assertThat; + +import java.sql.SQLException; +import java.time.Instant; +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.TimeInterval; +import pro.taskana.exceptions.InvalidArgumentException; +import pro.taskana.exceptions.NotAuthorizedException; +import pro.taskana.security.JAASRunner; +import pro.taskana.security.WithAccessId; + +/** + * Acceptance test for all "query tasks with sorting" scenarios. + */ +@RunWith(JAASRunner.class) +public class QueryTasksByTimeIntervalsAccTest extends AbstractAccTest { + + private static SortDirection asc = SortDirection.ASCENDING; + private static SortDirection desc = SortDirection.DESCENDING; + + public QueryTasksByTimeIntervalsAccTest() { + super(); + } + + @WithAccessId( + userName = "teamlead_1", + groupNames = {"group_1"}) + @Test + public void testCreatedWithin2Intervals() + throws SQLException, NotAuthorizedException, InvalidArgumentException { + TaskService taskService = taskanaEngine.getTaskService(); + + TimeInterval interval1 = new TimeInterval( + getInstant("2018-01-29T15:55:10"), + getInstant("2018-01-29T15:55:17")); + TimeInterval interval2 = new TimeInterval( + getInstant("2018-01-29T15:55:23"), + getInstant("2018-01-29T15:55:25")); + + List results = taskService.createTaskQuery() + .createdWithin(interval1, interval2) + .orderByCreated(asc) + .list(); + + assertThat(results.size(), equalTo(40)); + TaskSummary previousSummary = null; + for (TaskSummary taskSummary : results) { + Instant cr = taskSummary.getCreated(); + Assert.assertTrue(interval1.contains(cr) || interval2.contains(cr)); + + if (previousSummary != null) { + Assert.assertTrue(!previousSummary.getCreated().isAfter(taskSummary.getCreated())); + } + previousSummary = taskSummary; + } + } + + @WithAccessId( + userName = "teamlead_1", + groupNames = {"group_1"}) + @Test + public void testCreatedBefore() + throws SQLException, NotAuthorizedException, InvalidArgumentException { + TaskService taskService = taskanaEngine.getTaskService(); + + TimeInterval interval1 = new TimeInterval( + null, + getInstant("2018-01-29T15:55:17")); + + List results = taskService.createTaskQuery() + .createdWithin(interval1) + .orderByCreated(asc) + .list(); + + assertThat(results.size(), equalTo(36)); + TaskSummary previousSummary = null; + for (TaskSummary taskSummary : results) { + Instant cr = taskSummary.getCreated(); + Assert.assertTrue(interval1.contains(cr)); + + if (previousSummary != null) { + Assert.assertTrue(!previousSummary.getCreated().isAfter(taskSummary.getCreated())); + } + previousSummary = taskSummary; + } + } + + @WithAccessId( + userName = "teamlead_1", + groupNames = {"group_1"}) + @Test + public void testCreatedAfter() + throws SQLException, NotAuthorizedException, InvalidArgumentException { + TaskService taskService = taskanaEngine.getTaskService(); + + TimeInterval interval1 = new TimeInterval( + getInstant("2018-01-29T15:55:17"), null); + + List results = taskService.createTaskQuery() + .createdWithin(interval1) + .orderByCreated(asc) + .list(); + + assertThat(results.size(), equalTo(36)); + TaskSummary previousSummary = null; + for (TaskSummary taskSummary : results) { + Instant cr = taskSummary.getCreated(); + Assert.assertTrue(interval1.contains(cr)); + + if (previousSummary != null) { + Assert.assertTrue(!previousSummary.getCreated().isAfter(taskSummary.getCreated())); + } + previousSummary = taskSummary; + } + } + + @WithAccessId( + userName = "teamlead_1", + groupNames = {"group_1"}) + @Test + public void testClaimedWithin2Intervals() + throws SQLException, NotAuthorizedException, InvalidArgumentException { + TaskService taskService = taskanaEngine.getTaskService(); + + TimeInterval interval1 = new TimeInterval( + getInstant("2018-01-30T15:55:00"), + getInstant("2018-01-30T15:55:10")); + TimeInterval interval2 = new TimeInterval( + getInstant("2018-01-30T15:55:23"), + getInstant("2018-01-30T15:55:25")); + + List results = taskService.createTaskQuery() + .claimedWithin(interval1, interval2) + .orderByCreated(asc) + .list(); + + assertThat(results.size(), equalTo(24)); + TaskSummary previousSummary = null; + for (TaskSummary taskSummary : results) { + Instant cr = taskSummary.getClaimed(); + Assert.assertTrue(interval1.contains(cr) || interval2.contains(cr)); + + if (previousSummary != null) { + Assert.assertTrue(!previousSummary.getClaimed().isAfter(taskSummary.getClaimed())); + } + previousSummary = taskSummary; + } + } + + @WithAccessId( + userName = "teamlead_1", + groupNames = {"group_1"}) + @Test + public void testCompletedWithin() + throws SQLException, NotAuthorizedException, InvalidArgumentException { + TaskService taskService = taskanaEngine.getTaskService(); + + TimeInterval interval = new TimeInterval( + getInstant("2018-01-30T16:55:23"), + getInstant("2018-01-30T16:55:25")); + List results = taskService.createTaskQuery() + .completedWithin(interval) + .orderByCompleted(asc) + .list(); + + assertThat(results.size(), equalTo(5)); + TaskSummary previousSummary = null; + for (TaskSummary taskSummary : results) { + Instant cr = taskSummary.getCompleted(); + Assert.assertTrue(interval.contains(cr)); + + if (previousSummary != null) { + Assert.assertTrue(!previousSummary.getCompleted().isAfter(taskSummary.getCompleted())); + } + previousSummary = taskSummary; + } + } + + @WithAccessId( + userName = "teamlead_1", + groupNames = {"group_1"}) + @Test + public void testModifiedWithin() + throws SQLException, NotAuthorizedException, InvalidArgumentException { + TaskService taskService = taskanaEngine.getTaskService(); + + TimeInterval interval = new TimeInterval( + getInstant("2018-01-30T15:55:00"), + getInstant("2018-01-30T15:55:22")); + List results = taskService.createTaskQuery() + .modifiedWithin(interval) + .orderByModified(asc) + .list(); + + assertThat(results.size(), equalTo(6)); + TaskSummary previousSummary = null; + for (TaskSummary taskSummary : results) { + Instant cr = taskSummary.getModified(); + Assert.assertTrue(interval.contains(cr)); + + if (previousSummary != null) { + Assert.assertTrue(!previousSummary.getModified().isAfter(taskSummary.getModified())); + } + previousSummary = taskSummary; + } + } + + @WithAccessId( + userName = "teamlead_1", + groupNames = {"group_1"}) + @Test + public void testPlannedWithin() + throws SQLException, NotAuthorizedException, InvalidArgumentException { + TaskService taskService = taskanaEngine.getTaskService(); + + TimeInterval interval = new TimeInterval( + getInstant("2018-01-29T15:55:00"), + getInstant("2018-01-30T15:55:22")); + List results = taskService.createTaskQuery() + .plannedWithin(interval) + .orderByPlanned(asc) + .list(); + + assertThat(results.size(), equalTo(70)); + TaskSummary previousSummary = null; + for (TaskSummary taskSummary : results) { + Instant cr = taskSummary.getPlanned(); + Assert.assertTrue(interval.contains(cr)); + + if (previousSummary != null) { + Assert.assertTrue(!previousSummary.getPlanned().isAfter(taskSummary.getPlanned())); + } + previousSummary = taskSummary; + } + } + + @WithAccessId( + userName = "teamlead_1", + groupNames = {"group_1"}) + @Test + public void testDueWithin() + throws SQLException, NotAuthorizedException, InvalidArgumentException { + TaskService taskService = taskanaEngine.getTaskService(); + + TimeInterval interval = new TimeInterval( + getInstant("2018-01-29T15:55:00"), + getInstant("2018-01-30T15:55:22")); + List results = taskService.createTaskQuery() + .dueWithin(interval) + .orderByPlanned(asc) + .list(); + + assertThat(results.size(), equalTo(70)); + TaskSummary previousSummary = null; + for (TaskSummary taskSummary : results) { + Instant cr = taskSummary.getDue(); + Assert.assertTrue(interval.contains(cr)); + + if (previousSummary != null) { + Assert.assertTrue(!previousSummary.getPlanned().isAfter(taskSummary.getPlanned())); + } + previousSummary = taskSummary; + } + } + + @AfterClass + public static void cleanUpClass() { + FileUtils.deleteRecursive("~/data", true); + } +} diff --git a/lib/taskana-core/src/test/resources/sql/task.sql b/lib/taskana-core/src/test/resources/sql/task.sql index 28aab5693..38707deff 100644 --- a/lib/taskana-core/src/test/resources/sql/task.sql +++ b/lib/taskana-core/src/test/resources/sql/task.sql @@ -1,35 +1,35 @@ -- TASK TABLE (ID , CREATED , CLAIMED , COMPLETED , modified , planned , due , name , description , note , priority, state , classification_key, workbasket_key, domain , business_process_id, parent_business_process_id, owner , por_company , por_system , por_system_instance, por_type , por_value , is_read, is_transferred, custom_attributes, custom1, custom2, custom3, custom4, custom5, custom6, custom7, custom8, custom9, custom10 INSERT INTO TASK VALUES('TKI:000000000000000000000000000000000000', '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' , 'USER_1_1' , '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:000000000000000000000000000000000001', '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' , 'USER_1_1' , '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:000000000000000000000000000000000002', '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' , 'GPK_B_KSC' , '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:000000000000000000000000000000000002', '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' , 'GPK_B_KSC' , 'DOMAIN_B', 'BPI21' , 'PBPI21' , 'user_1_1' , 'MyCompany1', 'MySystem1', 'MyInstance1' , 'MyType1', 'MyValue1' , true , false , null , 'abc' , null , null , null , null , null , null , null , null , null ); INSERT INTO TASK VALUES('TKI:000000000000000000000000000000000003', '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' , 'GPK_KSC' , '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:000000000000000000000000000000000004', '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' , 'GPK_KSC' , '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:000000000000000000000000000000000004', '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' , 'GPK_KSC' , 'DOMAIN_A', 'PI_0000000000004' , 'DOC_0000000000000000004' , null , '00' , 'PASystem' , '00' , 'VNR' , '11223344' , false , false , null , null , 'ade' , null , null , null , null , null , null , null , null ); INSERT INTO TASK VALUES('TKI:000000000000000000000000000000000005', '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' , 'GPK_KSC' , 'DOMAIN_A', 'PI_0000000000005' , 'DOC_0000000000000000005' , null , '00' , 'PASystem' , '00' , 'VNR' , '11223344' , false , false , null , null , null , null , null , null , null , null , null , null , null ); INSERT INTO TASK VALUES('TKI:000000000000000000000000000000000006', '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' , 'GPK_KSC' , 'DOMAIN_A', 'PI_0000000000006' , 'DOC_0000000000000000006' , null , '00' , 'PASystem' , '00' , 'VNR' , '11223344' , false , false , null , null , null , null , null , null , null , null , null , null , null ); -INSERT INTO TASK VALUES('TKI:000000000000000000000000000000000007', '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' , 'GPK_KSC' , 'DOMAIN_A', 'PI_0000000000007' , 'DOC_0000000000000000007' , null , '00' , 'PASystem' , '00' , 'VNR' , '11223344' , false , false , null , null , null , null , null , null , null , null , null , null , null ); +INSERT INTO TASK VALUES('TKI:000000000000000000000000000000000007', '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' , 'GPK_KSC' , 'DOMAIN_A', 'PI_0000000000007' , 'DOC_0000000000000000007' , null , '00' , 'PASystem' , '00' , 'VNR' , '11223344' , false , false , null , null , null , 'ffg' , null , null , null , null , null , null , null ); INSERT INTO TASK VALUES('TKI:000000000000000000000000000000000008', '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' , 'GPK_KSC' , 'DOMAIN_A', 'PI_0000000000008' , 'DOC_0000000000000000008' , null , '00' , 'PASystem' , '00' , 'VNR' , '22334455' , false , false , null , null , null , null , null , null , null , null , null , null , null ); INSERT INTO TASK VALUES('TKI:000000000000000000000000000000000009', '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' , 'GPK_KSC' , 'DOMAIN_A', 'PI_0000000000009' , 'DOC_0000000000000000009' , null , '00' , 'PASystem' , '00' , 'VNR' , '22334455' , false , false , null , null , null , null , null , null , null , null , null , null , null ); -INSERT INTO TASK VALUES('TKI:000000000000000000000000000000000010', '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' , 'GPK_KSC' , 'DOMAIN_A', 'PI_0000000000010' , 'DOC_0000000000000000010' , null , '00' , 'PASystem' , '00' , 'VNR' , '22334455' , false , false , null , null , null , null , null , null , null , null , null , null , null ); +INSERT INTO TASK VALUES('TKI:000000000000000000000000000000000010', '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' , 'GPK_KSC' , 'DOMAIN_A', 'PI_0000000000010' , 'DOC_0000000000000000010' , null , '00' , 'PASystem' , '00' , 'VNR' , '22334455' , false , false , null , null , null , null , 'rty' , null , null , null , null , null , null ); INSERT INTO TASK VALUES('TKI:000000000000000000000000000000000011', '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' , 'GPK_KSC' , 'DOMAIN_A', 'PI_0000000000011' , '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:000000000000000000000000000000000012', '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' , 'GPK_KSC' , '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:000000000000000000000000000000000013', '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' , 'GPK_KSC' , 'DOMAIN_A', 'PI_0000000000013' , 'DOC_0000000000000000013' , null , '00' , 'PASystem' , '00' , 'VNR' , '22334455' , false , false , null , null , null , null , null , null , null , null , null , null , null ); +INSERT INTO TASK VALUES('TKI:000000000000000000000000000000000013', '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' , 'GPK_KSC' , 'DOMAIN_A', 'PI_0000000000013' , 'DOC_0000000000000000013' , null , '00' , 'PASystem' , '00' , 'VNR' , '22334455' , false , false , null , null , null , null , null , 'rty' , null , null , null , null , null ); INSERT INTO TASK VALUES('TKI:000000000000000000000000000000000014', '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' , 'GPK_KSC' , 'DOMAIN_A', 'PI_0000000000014' , 'DOC_0000000000000000014' , null , '00' , 'PASystem' , '00' , 'VNR' , '12345678' , false , false , null , null , null , null , null , null , null , null , null , null , null ); INSERT INTO TASK VALUES('TKI:000000000000000000000000000000000015', '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' , 'GPK_KSC' , 'DOMAIN_A', 'PI_0000000000015' , 'DOC_0000000000000000015' , null , '00' , 'PASystem' , '00' , 'VNR' , '23456789' , false , false , null , null , null , null , null , null , null , null , null , null , null ); INSERT INTO TASK VALUES('TKI:000000000000000000000000000000000016', '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' , 'GPK_KSC' , 'DOMAIN_A', 'PI_0000000000016' , 'DOC_0000000000000000016' , null , '00' , 'PASystem' , '00' , 'VNR' , '34567890' , false , false , null , null , null , null , null , null , null , null , null , null , null ); -INSERT INTO TASK VALUES('TKI:000000000000000000000000000000000017', '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' , 'GPK_KSC' , 'DOMAIN_A', 'PI_0000000000017' , 'DOC_0000000000000000017' , null , '00' , 'PASystem' , '00' , 'VNR' , '45678901' , false , false , null , null , null , null , null , null , null , null , null , null , null ); +INSERT INTO TASK VALUES('TKI:000000000000000000000000000000000017', '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' , 'GPK_KSC' , 'DOMAIN_A', 'PI_0000000000017' , 'DOC_0000000000000000017' , null , '00' , 'PASystem' , '00' , 'VNR' , '45678901' , false , false , null , null , null , null , null , null , 'vvg' , null , null , null , null ); INSERT INTO TASK VALUES('TKI:000000000000000000000000000000000018', '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' , 'GPK_KSC' , 'DOMAIN_A', 'PI_0000000000018' , 'DOC_0000000000000000018' , null , '00' , 'PASystem' , '00' , 'VNR' , '56789012' , false , false , null , null , null , null , null , null , null , null , null , null , null ); INSERT INTO TASK VALUES('TKI:000000000000000000000000000000000019', '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' , 'GPK_KSC' , 'DOMAIN_A', 'PI_0000000000019' , 'DOC_0000000000000000019' , null , '00' , 'PASystem' , '00' , 'VNR' , '67890123' , false , false , null , null , null , null , null , null , null , null , null , null , null ); -INSERT INTO TASK VALUES('TKI:000000000000000000000000000000000020', '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' , 'GPK_KSC' , 'DOMAIN_A', 'PI_0000000000020' , 'DOC_0000000000000000020' , null , '00' , 'PASystem' , '00' , 'SDNR' , '11223344' , false , false , null , null , null , null , null , null , null , null , null , null , null ); +INSERT INTO TASK VALUES('TKI:000000000000000000000000000000000020', '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' , 'GPK_KSC' , 'DOMAIN_A', 'PI_0000000000020' , 'DOC_0000000000000000020' , null , '00' , 'PASystem' , '00' , 'SDNR' , '11223344' , false , false , null , null , null , null , null , null , null , 'ijk' , null , null , null ); INSERT INTO TASK VALUES('TKI:000000000000000000000000000000000021', '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' , 'GPK_KSC' , 'DOMAIN_A', 'PI_0000000000021' , '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:000000000000000000000000000000000022', '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' , 'GPK_KSC' , '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: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 ); +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 , 'lnp' , 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 , 'bbq' , 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 , 'abcd00' , 'PASystem' , '00' , 'SDNR' , '98765432' , false , 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 , 'ert' ); 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: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 , 'rew' , null , null , null , 'dde' ); 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 ); @@ -37,20 +37,20 @@ INSERT INTO TASK VALUES('TKI:000000000000000000000000000000000033', '2018-01-29 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 ); +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 , 'el' , null , null , null , null , null ); INSERT INTO TASK VALUES('TKI:000000000000000000000000000000000102', '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_0000000000102' , 'DOC_0000000000000000102' , '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:000000000000000000000000000000000103', '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_0000000000103' , 'DOC_0000000000000000103' , 'user_1_2' , '00' , 'PASystem' , '00' , 'SDNR' , '98765432' , true , false , null , null , null , null , null , null , null , null , null , null , null ); -- Tasks for DeleteTaskAccTest -INSERT INTO TASK VALUES('TKI:000000000000000000000000000000000036', '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_0000000000036' , 'DOC_0000000000000000036' , '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:000000000000000000000000000000000036', '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_0000000000036' , 'DOC_0000000000000000036' , 'user_1_2' , '00' , 'PASystem' , '00' , 'SDNR' , '00011122' , true , false , null , null , null , null , null , 'ew' , null , null , null , null , null ); INSERT INTO TASK VALUES('TKI:000000000000000000000000000000000037', '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_0000000000037' , 'DOC_0000000000000000037' , '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: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: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 , '11' , 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: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 , 'ew' , 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 );