TSK-644 make tasks attachments queryable

This commit is contained in:
Martin Rojas Miguel Angel 2018-08-07 14:49:15 +02:00 committed by Holger Hagen
parent 06f5c436a9
commit d4110731f7
8 changed files with 1078 additions and 283 deletions

View File

@ -454,6 +454,99 @@ public interface TaskQuery extends BaseQuery<TaskSummary> {
*/
TaskQuery customAttributeLike(String num, String... searchArguments) throws InvalidArgumentException;
/**
* Add the attachment classification keys for exact matching to your query.
*
* @param attachmentClassificationKeys
* the attachmentClassificationKeys values of the searched for tasks
* @return the query
*/
TaskQuery attachmentClassificationKeyIn(String... attachmentClassificationKeys);
/**
* Add the attachment classification Keys 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 attachmentClassificationKey
* the attachmentClassificationKeys values of the searched for tasks
* @return the query
*/
TaskQuery attachmentClassificationKeyLike(String... attachmentClassificationKey);
/**
* Add the attachment classification Ids for exact matching to your query.
*
* @param attachmentClassificationId
* the attachmentClassificationId values of the searched for tasks
* @return the query
*/
TaskQuery attachmentClassificationIdIn(String... attachmentClassificationId);
/**
* Add the values of attachment classification ids for pattern matching to your query. They 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 attachmentClassificationId
* the attachmentClassificationId values of the searched-for tasks
* @return the query
*/
TaskQuery attachmentClassificationIdLike(String... attachmentClassificationId);
/**
* Add the values of attachment channel for exact matching to your query.
*
* @param attachmentChannel
* the attachmentChannel values of the searched for tasks
* @return the query
*/
TaskQuery attachmentChannelIn(String... attachmentChannel);
/**
* Add the values of attachment channel for pattern matching to your query. They 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 attachmentChannel
* the attachmentChannel values of the searched-for tasks
* @return the query
*/
TaskQuery attachmentChannelLike(String... attachmentChannel);
/**
* Add the values of reference values for exact matching to your query.
*
* @param referenceValue
* the referenceValue values of the searched for tasks
* @return the query
*/
TaskQuery attachmentReferenceValueIn(String... referenceValue);
/**
* Add the values of reference values for pattern matching to your query. They 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 referenceValue
* the referenceValue values of the searched-for tasks
* @return the query
*/
TaskQuery attachmentReferenceValueLike(String... referenceValue);
/**
* Add your received-dates to your query.
*
* @param receivedIn
* the {@link TimeInterval} within which the searched-for tasks attachment were received the last time.
* @return the query
*/
TaskQuery attachmentReceivedWithin(TimeInterval... receivedIn);
/**
* This method provides a query builder for quering the database.
*
@ -715,4 +808,64 @@ public interface TaskQuery extends BaseQuery<TaskSummary> {
* @return the query
*/
TaskQuery orderByWorkbasketId(SortDirection sortDirection);
/**
* This method sorts the query result according to the attachment classification key.
* (Should only be used if there is one attachment per task in other case the result would be wrong.)
*
* @param sortDirection
* Determines whether the result is sorted in ascending or descending order. If sortDirection is null,
* the result is sorted in ascending order
* @return the query
*/
TaskQuery orderByAttachmentClassificationKey(SortDirection sortDirection);
/**
* This method sorts the query result according to the attachment classification id.
* (Should only be used if there is one attachment per task in other case the result would be wrong.)
*
* @param sortDirection
* Determines whether the result is sorted in ascending or descending order. If sortDirection is null,
* the result is sorted in ascending order
* @return the query
*/
TaskQuery orderByAttachmentClassificationId(SortDirection sortDirection);
/**
* This method sorts the query result according to the attachment channel.
* (Should only be used if there is one attachment per task in other case the result would be wrong.)
*
* @param sortDirection
* Determines whether the result is sorted in ascending or descending order. If sortDirection is null,
* the result is sorted in ascending order
* @return the query
*/
TaskQuery orderByAttachmentChannel(SortDirection sortDirection);
/**
* This method sorts the query result according to the attachment reference value.
* (Should only be used if there is one attachment per task in other case the result would be wrong.)
*
* @param sortDirection
* Determines whether the result is sorted in ascending or descending order. If sortDirection is null,
* the result is sorted in ascending order
* @return the query
*/
TaskQuery orderByAttachmentReference(SortDirection sortDirection);
/**
* This method sorts the query result according to the attachment received.
* (Should only be used if there is one attachment per task in other case the result would be wrong.)
*
* @param sortDirection
* Determines whether the result is sorted in ascending or descending order. If sortDirection is null,
* the result is sorted in ascending order
* @return the query
*/
TaskQuery orderByAttachmentReceived(SortDirection sortDirection);
}

View File

@ -32,6 +32,7 @@ import pro.taskana.security.CurrentUserContext;
public class TaskQueryImpl implements TaskQuery {
private static final String LINK_TO_MAPPER = "pro.taskana.mappings.QueryMapper.queryTaskSummaries";
private static final String LINK_TO_MAPPER_DB2 = "pro.taskana.mappings.QueryMapper.queryTaskSummariesDb2";
private static final String LINK_TO_COUNTER = "pro.taskana.mappings.QueryMapper.countQueryTasks";
private static final String LINK_TO_VALUEMAPPER = "pro.taskana.mappings.QueryMapper.queryTaskColumnValues";
private static final String TIME_INTERVAL = "TimeInterval ";
@ -108,6 +109,15 @@ public class TaskQueryImpl implements TaskQuery {
private String[] custom15Like;
private String[] custom16In;
private String[] custom16Like;
private String[] attachmentClassificationKeyIn;
private String[] attachmentClassificationKeyLike;
private String[] attachmentClassificationIdIn;
private String[] attachmentClassificationIdLike;
private String[] attachmentChannelIn;
private String[] attachmentChannelLike;
private String[] attachmentReferenceIn;
private String[] attachmentReferenceLike;
private TimeInterval[] attachmentReceivedIn;
private String[] accessIdIn;
private boolean filterByAccessIdIn;
private TimeInterval[] createdIn;
@ -119,6 +129,9 @@ public class TaskQueryImpl implements TaskQuery {
private List<String> orderBy;
private List<String> orderColumns;
private boolean joinWithAttachments = false;
private boolean addAttachmentColumnsToSelectClauseForOrdering = false;
TaskQueryImpl(TaskanaEngine taskanaEngine) {
this.taskanaEngine = (TaskanaEngineImpl) taskanaEngine;
this.taskService = (TaskServiceImpl) taskanaEngine.getTaskService();
@ -558,9 +571,79 @@ public class TaskQueryImpl implements TaskQuery {
return this;
}
@Override
public TaskQuery attachmentClassificationKeyIn(String... attachmentClassificationKeys) {
joinWithAttachments = true;
this.attachmentClassificationKeyIn = attachmentClassificationKeys;
return this;
}
@Override
public TaskQuery attachmentClassificationKeyLike(String... attachmentClassificationKey) {
joinWithAttachments = true;
this.attachmentClassificationKeyLike = attachmentClassificationKey;
return this;
}
@Override
public TaskQuery attachmentClassificationIdIn(String... attachmentClassificationId) {
joinWithAttachments = true;
this.attachmentClassificationIdIn = attachmentClassificationId;
return this;
}
@Override
public TaskQuery attachmentClassificationIdLike(String... attachmentClassificationId) {
joinWithAttachments = true;
this.attachmentClassificationIdLike = attachmentClassificationId;
return this;
}
@Override
public TaskQuery attachmentChannelIn(String... attachmentChannel) {
joinWithAttachments = true;
this.attachmentChannelIn = attachmentChannel;
return this;
}
@Override
public TaskQuery attachmentChannelLike(String... attachmentChannel) {
joinWithAttachments = true;
this.attachmentChannelLike = attachmentChannel;
return this;
}
@Override
public TaskQuery attachmentReferenceValueIn(String... referenceValue) {
joinWithAttachments = true;
this.attachmentReferenceIn = referenceValue;
return this;
}
@Override
public TaskQuery attachmentReferenceValueLike(String... referenceValue) {
joinWithAttachments = true;
this.attachmentReferenceLike = referenceValue;
return this;
}
@Override
public TaskQuery attachmentReceivedWithin(TimeInterval... receivedIn) {
joinWithAttachments = true;
this.attachmentReceivedIn = receivedIn;
for (TimeInterval ti : receivedIn) {
if (!ti.isValid()) {
throw new IllegalArgumentException(TIME_INTERVAL + ti + IS_INVALID);
}
}
return this;
}
@Override
public TaskQuery orderByClassificationKey(SortDirection sortDirection) {
return addOrderCriteria("CLASSIFICATION_KEY", sortDirection);
return this.taskanaEngine.sessionManager.getConfiguration().getDatabaseId().equals("db2")
? addOrderCriteria("TCLASSIFICATION_KEY", sortDirection)
: addOrderCriteria("t.CLASSIFICATION_KEY", sortDirection);
}
@Override
@ -643,13 +726,53 @@ public class TaskQueryImpl implements TaskQuery {
return addOrderCriteria("WORKBASKET_ID", sortDirection);
}
@Override
public TaskQuery orderByAttachmentClassificationKey(SortDirection sortDirection) {
joinWithAttachments = true;
addAttachmentColumnsToSelectClauseForOrdering = true;
return this.taskanaEngine.sessionManager.getConfiguration().getDatabaseId().equals("db2")
? addOrderCriteria("ACLASSIFICATION_KEY", sortDirection)
: addOrderCriteria("a.CLASSIFICATION_KEY", sortDirection);
}
@Override
public TaskQuery orderByAttachmentClassificationId(SortDirection sortDirection) {
joinWithAttachments = true;
addAttachmentColumnsToSelectClauseForOrdering = true;
return this.taskanaEngine.sessionManager.getConfiguration().getDatabaseId().equals("db2")
? addOrderCriteria("ACLASSIFICATION_ID", sortDirection)
: addOrderCriteria("a.CLASSIFICATION_ID", sortDirection);
}
@Override
public TaskQuery orderByAttachmentChannel(SortDirection sortDirection) {
joinWithAttachments = true;
addAttachmentColumnsToSelectClauseForOrdering = true;
return addOrderCriteria("CHANNEL", sortDirection);
}
@Override
public TaskQuery orderByAttachmentReference(SortDirection sortDirection) {
joinWithAttachments = true;
addAttachmentColumnsToSelectClauseForOrdering = true;
return addOrderCriteria("REF_VALUE", sortDirection);
}
@Override
public TaskQuery orderByAttachmentReceived(SortDirection sortDirection) {
joinWithAttachments = true;
addAttachmentColumnsToSelectClauseForOrdering = true;
return addOrderCriteria("RECEIVED", sortDirection);
}
@Override
public TaskQuery orderByNote(SortDirection sortDirection) {
return addOrderCriteria("NOTE", sortDirection);
}
@Override
public TaskQuery orderByCustomAttribute(String number, SortDirection sortDirection) throws InvalidArgumentException {
public TaskQuery orderByCustomAttribute(String number, SortDirection sortDirection)
throws InvalidArgumentException {
int num = 0;
try {
num = Integer.parseInt(number);
@ -737,7 +860,7 @@ public class TaskQueryImpl implements TaskQuery {
checkOpenAndReadPermissionForSpecifiedWorkbaskets();
List<TaskSummaryImpl> tasks = new ArrayList<>();
setupAccessIds();
tasks = taskanaEngine.getSqlSession().selectList(LINK_TO_MAPPER, this);
tasks = taskanaEngine.getSqlSession().selectList(getLinkToMapperScript(), this);
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("mapper returned {} resulting Objects: {} ", tasks.size(),
LoggerUtils.listToString(tasks));
@ -754,6 +877,12 @@ public class TaskQueryImpl implements TaskQuery {
}
}
public String getLinkToMapperScript() {
return this.taskanaEngine.sessionManager.getConfiguration().getDatabaseId().equals("db2")
? LINK_TO_MAPPER_DB2
: LINK_TO_MAPPER;
}
private void setupAccessIds() {
if (taskanaEngine.isUserInRole(TaskanaRole.ADMIN) || !filterByAccessIdIn) {
this.accessIdIn = null;
@ -802,7 +931,8 @@ public class TaskQueryImpl implements TaskQuery {
checkOpenAndReadPermissionForSpecifiedWorkbaskets();
setupAccessIds();
RowBounds rowBounds = new RowBounds(offset, limit);
List<TaskSummaryImpl> tasks = taskanaEngine.getSqlSession().selectList(LINK_TO_MAPPER, this, rowBounds);
List<TaskSummaryImpl> tasks = taskanaEngine.getSqlSession()
.selectList(getLinkToMapperScript(), this, rowBounds);
result = taskService.augmentTaskSummariesByContainedSummaries(tasks);
return result;
} catch (PersistenceException e) {
@ -831,7 +961,7 @@ public class TaskQueryImpl implements TaskQuery {
taskanaEngine.openConnection();
checkOpenAndReadPermissionForSpecifiedWorkbaskets();
setupAccessIds();
TaskSummaryImpl taskSummaryImpl = taskanaEngine.getSqlSession().selectOne(LINK_TO_MAPPER, this);
TaskSummaryImpl taskSummaryImpl = taskanaEngine.getSqlSession().selectOne(getLinkToMapperScript(), this);
if (taskSummaryImpl == null) {
return null;
}
@ -863,6 +993,23 @@ public class TaskQueryImpl implements TaskQuery {
}
}
public boolean isJoinWithAttachments() {
return joinWithAttachments;
}
public void setJoinWithAttachments(boolean joinWithAttachments) {
this.joinWithAttachments = joinWithAttachments;
}
public boolean isAddAttachmentColumnsToSelectClauseForOrdering() {
return addAttachmentColumnsToSelectClauseForOrdering;
}
public void setAddAttachmentColumnsToSelectClauseForOrdering(
boolean addAttachmentColumnsToSelectClauseForOrdering) {
this.addAttachmentColumnsToSelectClauseForOrdering = addAttachmentColumnsToSelectClauseForOrdering;
}
private void checkOpenAndReadPermissionForSpecifiedWorkbaskets() {
if (taskanaEngine.isUserInRole(TaskanaRole.ADMIN)) {
LOGGER.debug("Skipping permissions check since user is in role ADMIN.");
@ -1221,6 +1368,78 @@ public class TaskQueryImpl implements TaskQuery {
return columnName;
}
public String[] getAttachmentClassificationKeyIn() {
return attachmentClassificationKeyIn;
}
public void setAttachmentClassificationKeyIn(String[] attachmentClassificationKeyIn) {
this.attachmentClassificationKeyIn = attachmentClassificationKeyIn;
}
public String[] getAttachmentClassificationKeyLike() {
return attachmentClassificationKeyLike;
}
public void setAttachmentClassificationKeyLike(String[] attachmentClassificationKeyLike) {
this.attachmentClassificationKeyLike = attachmentClassificationKeyLike;
}
public String[] getAttachmentClassificationIdIn() {
return attachmentClassificationIdIn;
}
public void setAttachmentClassificationIdIn(String[] attachmentClassificationIdIn) {
this.attachmentClassificationIdIn = attachmentClassificationIdIn;
}
public String[] getAttachmentClassificationIdLike() {
return attachmentClassificationIdLike;
}
public void setAttachmentClassificationIdLike(String[] attachmentclassificationIdLike) {
this.attachmentClassificationIdLike = attachmentclassificationIdLike;
}
public String[] getAttachmentChannelIn() {
return attachmentChannelIn;
}
public void setAttachmentChannelIn(String[] attachmentChannelIn) {
this.attachmentChannelIn = attachmentChannelIn;
}
public String[] getAttachmentChannelLike() {
return attachmentChannelLike;
}
public void setAttachmentChannelLike(String[] attachmentChannelLike) {
this.attachmentChannelLike = attachmentChannelLike;
}
public String[] getAttachmentReferenceIn() {
return attachmentReferenceIn;
}
public void setAttachmentReferenceIn(String[] attachmentReferenceIn) {
this.attachmentReferenceIn = attachmentReferenceIn;
}
public String[] getAttachmentReferenceLike() {
return attachmentReferenceLike;
}
public void setAttachmentReferenceLike(String[] attachmentReferenceLike) {
this.attachmentReferenceLike = attachmentReferenceLike;
}
public TimeInterval[] getAttachmentReceivedIn() {
return attachmentReceivedIn;
}
public void setAttachmentReceivedIn(TimeInterval[] attachmentReceivedIn) {
this.attachmentReceivedIn = attachmentReceivedIn;
}
private TaskQuery addOrderCriteria(String columnName, SortDirection sortDirection) {
String orderByDirection = " ASC";
if (sortDirection != null && SortDirection.DESCENDING.equals(sortDirection)) {

View File

@ -74,10 +74,10 @@ public interface AttachmentMapper {
})
AttachmentImpl getAttachment(@Param("attachmentId") String attachmentId);
@Select("<script>SELECT ID, TASK_ID, CREATED, MODIFIED, CLASSIFICATION_KEY, CLASSIFICATION_ID, REF_COMPANY, REF_SYSTEM, REF_INSTANCE, REF_TYPE, REF_VALUE, CHANNEL, RECEIVED "
@Select("<script>SELECT DISTINCT ID, TASK_ID, CREATED, MODIFIED, CLASSIFICATION_KEY, CLASSIFICATION_ID, REF_COMPANY, REF_SYSTEM, REF_INSTANCE, REF_TYPE, REF_VALUE, CHANNEL, RECEIVED "
+ "FROM ATTACHMENT "
+ "<where>"
+ "TASK_ID IN (<foreach collection='array' item='item' separator=',' >#{item}</foreach>)"
+ "TASK_ID IN (<foreach collection='taskIds' item='item' separator=',' >#{item}</foreach>) "
+ "</where>"
+ "<if test=\"_databaseId == 'db2'\">with UR </if> "
+ "</script>")
@ -96,7 +96,7 @@ public interface AttachmentMapper {
@Result(property = "channel", column = "CHANNEL"),
@Result(property = "received", column = "RECEIVED")
})
List<AttachmentSummaryImpl> findAttachmentSummariesByTaskIds(String[] taskIds);
List<AttachmentSummaryImpl> findAttachmentSummariesByTaskIds(@Param("taskIds") String[] taskIds);
@Delete("DELETE FROM ATTACHMENT WHERE ID=#{attachmentId}")
void deleteAttachment(@Param("attachmentId") String attachmentId);

View File

@ -28,123 +28,18 @@ public interface QueryMapper {
String WORKBASKET_FINDSUMMARYBYKEY = "pro.taskana.mappings.WorkbasketMapper.findSummaryByKey";
@Select("<script> "
+ "<choose>"
+ "<when test=\"_databaseId == 'db2'\">"
+ "WITH X (ID, CREATED, CLAIMED, COMPLETED, MODIFIED, PLANNED, DUE, NAME, CREATOR, DESCRIPTION, NOTE, PRIORITY, STATE, CLASSIFICATION_KEY, "
+ "CLASSIFICATION_CATEGORY, CLASSIFICATION_ID, WORKBASKET_ID, DOMAIN, WORKBASKET_KEY, BUSINESS_PROCESS_ID, PARENT_BUSINESS_PROCESS_ID, OWNER, "
+ "POR_COMPANY, POR_SYSTEM, POR_INSTANCE, POR_TYPE, POR_VALUE, IS_READ, IS_TRANSFERRED, CUSTOM_1, CUSTOM_2, CUSTOM_3, CUSTOM_4, CUSTOM_5, "
+ "CUSTOM_6, CUSTOM_7, CUSTOM_8, CUSTOM_9, CUSTOM_10, CUSTOM_11, CUSTOM_12, CUSTOM_13, CUSTOM_14, CUSTOM_15, CUSTOM_16 ) "
+ "AS (SELECT ID, CREATED, CLAIMED, COMPLETED, MODIFIED, PLANNED, DUE, NAME, CREATOR, DESCRIPTION, NOTE, PRIORITY, STATE, CLASSIFICATION_KEY, "
+ " CLASSIFICATION_CATEGORY, CLASSIFICATION_ID, WORKBASKET_ID, DOMAIN, WORKBASKET_KEY, BUSINESS_PROCESS_ID, PARENT_BUSINESS_PROCESS_ID, OWNER, "
+ "POR_COMPANY, POR_SYSTEM, POR_INSTANCE, POR_TYPE, POR_VALUE, IS_READ, IS_TRANSFERRED, CUSTOM_1, CUSTOM_2, CUSTOM_3, CUSTOM_4, CUSTOM_5, "
+ "CUSTOM_6, CUSTOM_7, CUSTOM_8, CUSTOM_9, CUSTOM_10, CUSTOM_11, CUSTOM_12, CUSTOM_13, CUSTOM_14, CUSTOM_15, CUSTOM_16 FROM TASK t "
+ "<where> "
+ "<if test='taskIds != null'>AND ID IN(<foreach item='item' collection='taskIds' separator=',' >#{item}</foreach>)</if> "
+ "<if test='createdIn !=null'> AND ( <foreach item='item' collection='createdIn' separator=' OR ' > ( <if test='item.begin!=null'> CREATED &gt;= #{item.begin} </if> <if test='item.begin!=null and item.end!=null'> AND </if><if test='item.end!=null'> CREATED &lt;=#{item.end} </if>)</foreach>)</if> "
+ "<if test='claimedIn !=null'> AND ( <foreach item='item' collection='claimedIn' separator=' OR ' > ( <if test='item.begin!=null'> CLAIMED &gt;= #{item.begin} </if> <if test='item.begin!=null and item.end!=null'> AND </if><if test='item.end!=null'> CLAIMED &lt;=#{item.end} </if>)</foreach>)</if> "
+ "<if test='completedIn !=null'> AND ( <foreach item='item' collection='completedIn' separator=' OR ' > ( <if test='item.begin!=null'> COMPLETED &gt;= #{item.begin} </if> <if test='item.begin!=null and item.end!=null'> AND </if><if test='item.end!=null'> COMPLETED &lt;=#{item.end} </if>)</foreach>)</if> "
+ "<if test='modifiedIn !=null'> AND ( <foreach item='item' collection='modifiedIn' separator=' OR ' > ( <if test='item.begin!=null'> MODIFIED &gt;= #{item.begin} </if> <if test='item.begin!=null and item.end!=null'> AND </if><if test='item.end!=null'> MODIFIED &lt;=#{item.end} </if>)</foreach>)</if> "
+ "<if test='plannedIn !=null'> AND ( <foreach item='item' collection='plannedIn' separator=' OR ' > ( <if test='item.begin!=null'> PLANNED &gt;= #{item.begin} </if> <if test='item.begin!=null and item.end!=null'> AND </if><if test='item.end!=null'> PLANNED &lt;=#{item.end} </if>)</foreach>)</if> "
+ "<if test='dueIn !=null'> AND ( <foreach item='item' collection='dueIn' separator=' OR ' > ( <if test='item.begin!=null'> DUE &gt;= #{item.begin} </if> <if test='item.begin!=null and item.end!=null'> AND </if><if test='item.end!=null'> DUE &lt;=#{item.end} </if>)</foreach>)</if> "
+ "<if test='nameIn != null'>AND NAME IN(<foreach item='item' collection='nameIn' separator=',' >#{item}</foreach>)</if> "
+ "<if test='nameLike != null'>AND (<foreach item='item' collection='nameLike' separator=' OR '>UPPER(NAME) LIKE #{item}</foreach>)</if> "
+ "<if test='creatorIn != null'>AND CREATOR IN(<foreach item='item' collection='creatorIn' separator=',' >#{item}</foreach>)</if> "
+ "<if test='creatorLike != null'>AND (<foreach item='item' collection='creatorLike' separator=' OR '>UPPER(CREATOR) LIKE #{item}</foreach>)</if> "
+ "<if test='description != null'>AND (<foreach item='item' collection='description' separator=' OR '>DESCRIPTION LIKE #{item}</foreach>)</if> "
+ "<if test='noteLike != null'>AND (<foreach item='item' collection='noteLike' separator=' OR '>UPPER(NOTE) LIKE #{item}</foreach>)</if> "
+ "<if test='priority != null'>AND PRIORITY IN(<foreach item='item' collection='priority' separator=',' >#{item}</foreach>)</if> "
+ "<if test='stateIn != null'>AND STATE IN(<foreach item='item' collection='stateIn' separator=',' >#{item}</foreach>)</if> "
+ "<if test='workbasketIdIn != null'>AND WORKBASKET_ID IN(<foreach item='item' collection='workbasketIdIn' separator=',' >#{item}</foreach>)</if> "
+ "<if test='workbasketKeyDomainIn != null'>AND (<foreach item='item' collection='workbasketKeyDomainIn' separator=' OR '>(WORKBASKET_KEY = #{item.key} AND DOMAIN = #{item.domain})</foreach>)</if> "
+ "<if test='classificationKeyIn != null'>AND CLASSIFICATION_KEY IN(<foreach item='item' collection='classificationKeyIn' separator=',' >#{item}</foreach>)</if> "
+ "<if test='classificationKeyNotIn != null'>AND CLASSIFICATION_KEY NOT IN(<foreach item='item' collection='classificationKeyNotIn' separator=',' >#{item}</foreach>)</if> "
+ "<if test='classificationKeyLike != null'>AND (<foreach item='item' collection='classificationKeyLike' separator=' OR '>UPPER(CLASSIFICATION_KEY) LIKE #{item}</foreach>)</if> "
+ "<if test='classificationIdIn != null'>AND CLASSIFICATION_ID IN(<foreach item='item' collection='classificationIdIn' separator=',' >#{item}</foreach>)</if> "
+ "<if test='classificationCategoryIn != null'>AND CLASSIFICATION_CATEGORY IN(<foreach item='item' collection='classificationCategoryIn' separator=',' >#{item}</foreach>)</if> "
+ "<if test='classificationCategoryLike != null'>AND (<foreach item='item' collection='classificationCategoryLike' separator=' OR '>UPPER(CLASSIFICATION_CATEGORY) LIKE #{item}</foreach>)</if> "
+ "<if test='ownerIn != null'>AND OWNER IN(<foreach item='item' collection='ownerIn' separator=',' >#{item}</foreach>)</if> "
+ "<if test='ownerLike != null'>AND (<foreach item='item' collection='ownerLike' separator=' OR '>UPPER(OWNER) LIKE #{item}</foreach>)</if> "
+ "<if test='isRead != null'>AND IS_READ = #{isRead}</if> "
+ "<if test='isTransferred != null'>AND IS_TRANSFERRED = #{isTransferred}</if> "
+ "<if test='porCompanyIn != null'>AND POR_COMPANY IN(<foreach item='item' collection='porCompanyIn' separator=',' >#{item}</foreach>)</if> "
+ "<if test='porCompanyLike != null'>AND (<foreach item='item' collection='porCompanyLike' separator=' OR '>UPPER(POR_COMPANY) LIKE #{item}</foreach>)</if> "
+ "<if test='porSystemIn != null'>AND POR_SYSTEM IN(<foreach item='item' collection='porSystemIn' separator=',' >#{item}</foreach>)</if> "
+ "<if test='porSystemLike != null'>AND (<foreach item='item' collection='porSystemLike' separator=' OR '>UPPER(POR_SYSTEM) LIKE #{item}</foreach>)</if> "
+ "<if test='porSystemInstanceIn != null'>AND POR_INSTANCE IN(<foreach item='item' collection='porSystemInstanceIn' separator=',' >#{item}</foreach>)</if> "
+ "<if test='porSystemInstanceLike != null'>AND (<foreach item='item' collection='porSystemInstanceLike' separator=' OR '>UPPER(POR_INSTANCE) LIKE #{item}</foreach>)</if> "
+ "<if test='porTypeIn != null'>AND POR_TYPE IN(<foreach item='item' collection='porTypeIn' separator=',' >#{item}</foreach>)</if> "
+ "<if test='porTypeLike != null'>AND (<foreach item='item' collection='porTypeLike' separator=' OR '>UPPER(POR_TYPE) LIKE #{item}</foreach>)</if> "
+ "<if test='porValueIn != null'>AND POR_VALUE IN(<foreach item='item' collection='porValueIn' separator=',' >#{item}</foreach>)</if> "
+ "<if test='porValueLike != null'>AND (<foreach item='item' collection='porValueLike' separator=' OR '>UPPER(POR_VALUE) LIKE #{item}</foreach>)</if> "
+ "<if test='parentBusinessProcessIdIn != null'>AND PARENT_BUSINESS_PROCESS_ID IN(<foreach item='item' collection='parentBusinessProcessIdIn' separator=',' >#{item}</foreach>)</if> "
+ "<if test='parentBusinessProcessIdLike != null'>AND (<foreach item='item' collection='parentBusinessProcessIdLike' separator=' OR '>UPPER(PARENT_BUSINESS_PROCESS_ID) LIKE #{item}</foreach>)</if> "
+ "<if test='businessProcessIdIn != null'>AND BUSINESS_PROCESS_ID IN(<foreach item='item' collection='businessProcessIdIn' separator=',' >#{item}</foreach>)</if> "
+ "<if test='businessProcessIdLike != null'>AND (<foreach item='item' collection='businessProcessIdLike' separator=' OR '>UPPER(BUSINESS_PROCESS_ID) LIKE #{item}</foreach>)</if> "
+ "<if test='custom1In != null'>AND CUSTOM_1 IN(<foreach item='item' collection='custom1In' separator=',' >#{item}</foreach>)</if> "
+ "<if test='custom1Like != null'>AND (<foreach item='item' collection='custom1Like' separator=' OR '>UPPER(CUSTOM_1) LIKE #{item}</foreach>)</if> "
+ "<if test='custom2In != null'>AND CUSTOM_2 IN(<foreach item='item' collection='custom2In' separator=',' >#{item}</foreach>)</if> "
+ "<if test='custom2Like != null'>AND (<foreach item='item' collection='custom2Like' separator=' OR '>UPPER(CUSTOM_2) LIKE #{item}</foreach>)</if> "
+ "<if test='custom3In != null'>AND CUSTOM_3 IN(<foreach item='item' collection='custom3In' separator=',' >#{item}</foreach>)</if> "
+ "<if test='custom3Like != null'>AND (<foreach item='item' collection='custom3Like' separator=' OR '>UPPER(CUSTOM_3) LIKE #{item}</foreach>)</if> "
+ "<if test='custom4In != null'>AND CUSTOM_4 IN(<foreach item='item' collection='custom4In' separator=',' >#{item}</foreach>)</if> "
+ "<if test='custom4Like != null'>AND (<foreach item='item' collection='custom4Like' separator=' OR '>UPPER(CUSTOM_4) LIKE #{item}</foreach>)</if> "
+ "<if test='custom5In != null'>AND CUSTOM_5 IN(<foreach item='item' collection='custom5In' separator=',' >#{item}</foreach>)</if> "
+ "<if test='custom5Like != null'>AND (<foreach item='item' collection='custom5Like' separator=' OR '>UPPER(CUSTOM_5) LIKE #{item}</foreach>)</if> "
+ "<if test='custom6In != null'>AND CUSTOM_6 IN(<foreach item='item' collection='custom6In' separator=',' >#{item}</foreach>)</if> "
+ "<if test='custom6Like != null'>AND (<foreach item='item' collection='custom6Like' separator=' OR '>UPPER(CUSTOM_6) LIKE #{item}</foreach>)</if> "
+ "<if test='custom7In != null'>AND CUSTOM_7 IN(<foreach item='item' collection='custom7In' separator=',' >#{item}</foreach>)</if> "
+ "<if test='custom7Like != null'>AND (<foreach item='item' collection='custom7Like' separator=' OR '>UPPER(CUSTOM_7) LIKE #{item}</foreach>)</if> "
+ "<if test='custom8In != null'>AND CUSTOM_8 IN(<foreach item='item' collection='custom8In' separator=',' >#{item}</foreach>)</if> "
+ "<if test='custom8Like != null'>AND (<foreach item='item' collection='custom8Like' separator=' OR '>UPPER(CUSTOM_8) LIKE #{item}</foreach>)</if> "
+ "<if test='custom9In != null'>AND CUSTOM_9 IN(<foreach item='item' collection='custom9In' separator=',' >#{item}</foreach>)</if> "
+ "<if test='custom9Like != null'>AND (<foreach item='item' collection='custom9Like' separator=' OR '>UPPER(CUSTOM_9) LIKE #{item}</foreach>)</if> "
+ "<if test='custom10In != null'>AND CUSTOM_10 IN(<foreach item='item' collection='custom10In' separator=',' >#{item}</foreach>)</if> "
+ "<if test='custom10Like != null'>AND (<foreach item='item' collection='custom10Like' separator=' OR '>UPPER(CUSTOM_10) LIKE #{item}</foreach>)</if> "
+ "<if test='custom11In != null'>AND CUSTOM_11 IN(<foreach item='item' collection='custom11In' separator=',' >#{item}</foreach>)</if> "
+ "<if test='custom11Like != null'>AND (<foreach item='item' collection='custom11Like' separator=' OR '>UPPER(CUSTOM_11) LIKE #{item}</foreach>)</if> "
+ "<if test='custom12In != null'>AND CUSTOM_12 IN(<foreach item='item' collection='custom12In' separator=',' >#{item}</foreach>)</if> "
+ "<if test='custom12Like != null'>AND (<foreach item='item' collection='custom12Like' separator=' OR '>UPPER(CUSTOM_12) LIKE #{item}</foreach>)</if> "
+ "<if test='custom13In != null'>AND CUSTOM_13 IN(<foreach item='item' collection='custom13In' separator=',' >#{item}</foreach>)</if> "
+ "<if test='custom13Like != null'>AND (<foreach item='item' collection='custom13Like' separator=' OR '>UPPER(CUSTOM_13) LIKE #{item}</foreach>)</if> "
+ "<if test='custom14In != null'>AND CUSTOM_14 IN(<foreach item='item' collection='custom14In' separator=',' >#{item}</foreach>)</if> "
+ "<if test='custom14Like != null'>AND (<foreach item='item' collection='custom14Like' separator=' OR '>UPPER(CUSTOM_14) LIKE #{item}</foreach>)</if> "
+ "<if test='custom15In != null'>AND CUSTOM_15 IN(<foreach item='item' collection='custom15In' separator=',' >#{item}</foreach>)</if> "
+ "<if test='custom15Like != null'>AND (<foreach item='item' collection='custom15Like' separator=' OR '>UPPER(CUSTOM_15) LIKE #{item}</foreach>)</if> "
+ "<if test='custom16In != null'>AND CUSTOM_16 IN(<foreach item='item' collection='custom16In' separator=',' >#{item}</foreach>)</if> "
+ "<if test='custom16Like != null'>AND (<foreach item='item' collection='custom16Like' separator=' OR '>UPPER(CUSTOM_16) LIKE #{item}</foreach>)</if> "
+ "<if test='!orderBy.isEmpty()'>AND (<foreach item='item' collection='orderColumns' separator='OR ' >${item} IS NOT NULL </foreach>)</if> "
+ "</where> "
+ "), Y (ID, CREATED, CLAIMED, COMPLETED, MODIFIED, PLANNED, DUE, NAME, CREATOR, DESCRIPTION, NOTE, PRIORITY, STATE, CLASSIFICATION_KEY, "
+ " CLASSIFICATION_CATEGORY, CLASSIFICATION_ID, WORKBASKET_ID, DOMAIN, WORKBASKET_KEY, BUSINESS_PROCESS_ID, PARENT_BUSINESS_PROCESS_ID, OWNER, "
+ "POR_COMPANY, POR_SYSTEM, POR_INSTANCE, POR_TYPE, POR_VALUE, IS_READ, IS_TRANSFERRED, CUSTOM_1, CUSTOM_2, CUSTOM_3, CUSTOM_4, CUSTOM_5, "
+ "CUSTOM_6, CUSTOM_7, CUSTOM_8, CUSTOM_9, CUSTOM_10, CUSTOM_11, CUSTOM_12, CUSTOM_13, CUSTOM_14, CUSTOM_15, CUSTOM_16, FLAG ) "
+ "AS "
+ "(SELECT ID, CREATED, CLAIMED, COMPLETED, MODIFIED, PLANNED, DUE, NAME, CREATOR, DESCRIPTION, NOTE, PRIORITY, STATE, CLASSIFICATION_KEY, "
+ " CLASSIFICATION_CATEGORY, CLASSIFICATION_ID, WORKBASKET_ID, DOMAIN, WORKBASKET_KEY, BUSINESS_PROCESS_ID, PARENT_BUSINESS_PROCESS_ID, OWNER, "
+ "POR_COMPANY, POR_SYSTEM, POR_INSTANCE, POR_TYPE, POR_VALUE, IS_READ, IS_TRANSFERRED, CUSTOM_1, CUSTOM_2, CUSTOM_3, CUSTOM_4, CUSTOM_5, "
+ "CUSTOM_6, CUSTOM_7, CUSTOM_8, CUSTOM_9, CUSTOM_10, CUSTOM_11, CUSTOM_12, CUSTOM_13, CUSTOM_14, CUSTOM_15, CUSTOM_16, "
+ "(SELECT 1 FROM WORKBASKET_ACCESS_LIST s WHERE "
+ "<if test='accessIdIn != null'> "
+ "s.ACCESS_ID IN (<foreach item='item' collection='accessIdIn' separator=',' >#{item}</foreach>) and "
+ "SELECT <if test=\"joinWithAttachments\">DISTINCT</if> t.ID, t.CREATED, t.CLAIMED, t.COMPLETED, t.MODIFIED, t.PLANNED, t.DUE, t.NAME, t.CREATOR, t.DESCRIPTION, t.NOTE, t.PRIORITY, t.STATE, t.CLASSIFICATION_KEY, t.CLASSIFICATION_CATEGORY, t.CLASSIFICATION_ID, t.WORKBASKET_ID, t.DOMAIN, t.WORKBASKET_KEY, t.BUSINESS_PROCESS_ID, t.PARENT_BUSINESS_PROCESS_ID, t.OWNER, t.POR_COMPANY, t.POR_SYSTEM, t.POR_INSTANCE, t.POR_TYPE, t.POR_VALUE, t.IS_READ, t.IS_TRANSFERRED, t.CUSTOM_1, t.CUSTOM_2, t.CUSTOM_3, t.CUSTOM_4, t.CUSTOM_5, t.CUSTOM_6, t.CUSTOM_7, t.CUSTOM_8, t.CUSTOM_9, t.CUSTOM_10, t.CUSTOM_11, t.CUSTOM_12, t.CUSTOM_13, t.CUSTOM_14, t.CUSTOM_15, t.CUSTOM_16"
+ "<if test=\"addAttachmentColumnsToSelectClauseForOrdering\">"
+ ", a.CLASSIFICATION_ID, a.CLASSIFICATION_KEY, a.CHANNEL, a.REF_VALUE, a.RECEIVED"
+ "</if>"
+ "s.WORKBASKET_ID = X.WORKBASKET_ID AND "
+ "s.perm_read = 1 "
+ "fetch first 1 rows only "
+ ") FROM X )"
+ "SELECT ID, CREATED, CLAIMED, COMPLETED, MODIFIED, PLANNED, DUE, NAME, CREATOR, DESCRIPTION, NOTE, PRIORITY, STATE, CLASSIFICATION_KEY, "
+ " CLASSIFICATION_CATEGORY, CLASSIFICATION_ID, WORKBASKET_ID, DOMAIN, WORKBASKET_KEY, BUSINESS_PROCESS_ID, PARENT_BUSINESS_PROCESS_ID, OWNER, "
+ "POR_COMPANY, POR_SYSTEM, POR_INSTANCE, POR_TYPE, POR_VALUE, IS_READ, IS_TRANSFERRED, CUSTOM_1, CUSTOM_2, CUSTOM_3, CUSTOM_4, CUSTOM_5, "
+ "CUSTOM_6, CUSTOM_7, CUSTOM_8, CUSTOM_9, CUSTOM_10, CUSTOM_11, CUSTOM_12, CUSTOM_13, CUSTOM_14, CUSTOM_15, CUSTOM_16 FROM Y WHERE FLAG = 1 "
+ "<if test='!orderBy.isEmpty()'>ORDER BY <foreach item='item' collection='orderBy' separator=',' >${item}</foreach></if> "
+ "with UR "
+ "</when>"
+ "<otherwise>"
+ "SELECT t.ID, t.CREATED, t.CLAIMED, t.COMPLETED, t.MODIFIED, t.PLANNED, t.DUE, t.NAME, t.CREATOR, t.DESCRIPTION, t.NOTE, t.PRIORITY, t.STATE, t.CLASSIFICATION_KEY, t.CLASSIFICATION_CATEGORY, t.CLASSIFICATION_ID, t.WORKBASKET_ID, t.DOMAIN, t.WORKBASKET_KEY, t.BUSINESS_PROCESS_ID, t.PARENT_BUSINESS_PROCESS_ID, t.OWNER, t.POR_COMPANY, t.POR_SYSTEM, t.POR_INSTANCE, t.POR_TYPE, t.POR_VALUE, t.IS_READ, t.IS_TRANSFERRED, t.CUSTOM_1, t.CUSTOM_2, t.CUSTOM_3, t.CUSTOM_4, t.CUSTOM_5, t.CUSTOM_6, t.CUSTOM_7, t.CUSTOM_8, t.CUSTOM_9, t.CUSTOM_10, t.CUSTOM_11, t.CUSTOM_12, t.CUSTOM_13, t.CUSTOM_14, t.CUSTOM_15, t.CUSTOM_16 "
+ "FROM TASK t "
+ "<if test=\"joinWithAttachments\">"
+ "LEFT JOIN ATTACHMENT AS a ON t.ID = a.TASK_ID "
+ "</if>"
+ "<where>"
+ "<if test='accessIdIn != null'> "
+ "AND t.WORKBASKET_ID IN ( "
+ "SELECT WID from (SELECT WORKBASKET_ID as WID, MAX(PERM_READ::int) as MAX_READ FROM WORKBASKET_ACCESS_LIST AS s where "
+ "SELECT WID from (SELECT WORKBASKET_ID as WID, MAX(PERM_READ::int) as MAX_READ FROM WORKBASKET_ACCESS_LIST AS s where "
+ "ACCESS_ID IN (<foreach item='item' collection='accessIdIn' separator=',' >#{item}</foreach>) "
+ "group by WORKBASKET_ID ) AS f where max_read = 1 ) "
+ "</if> "
@ -221,11 +116,18 @@ public interface QueryMapper {
+ "<if test='custom15Like != null'>AND (<foreach item='item' collection='custom15Like' separator=' OR '>UPPER(t.CUSTOM_15) LIKE #{item}</foreach>)</if> "
+ "<if test='custom16In != null'>AND t.CUSTOM_16 IN(<foreach item='item' collection='custom16In' separator=',' >#{item}</foreach>)</if> "
+ "<if test='custom16Like != null'>AND (<foreach item='item' collection='custom16Like' separator=' OR '>UPPER(t.CUSTOM_16) LIKE #{item}</foreach>)</if> "
+ "<if test='attachmentClassificationKeyIn != null'>AND a.CLASSIFICATION_KEY IN(<foreach item='item' collection='attachmentClassificationKeyIn' separator=',' >#{item}</foreach>)</if> "
+ "<if test='attachmentClassificationKeyLike != null'>AND (<foreach item='item' collection='attachmentClassificationKeyLike' separator=' OR '>UPPER(a.CLASSIFICATION_KEY) LIKE #{item}</foreach>)</if> "
+ "<if test='attachmentClassificationIdIn != null'>AND a.CLASSIFICATION_ID IN(<foreach item='item' collection='attachmentClassificationIdIn' separator=',' >#{item}</foreach>)</if> "
+ "<if test='attachmentClassificationIdLike != null'>AND (<foreach item='item' collection='attachmentclassificationIdLike' separator=' OR '>UPPER(a.CLASSIFICATION_ID) LIKE #{item}</foreach>)</if> "
+ "<if test='attachmentChannelIn != null'>AND a.CHANNEL IN(<foreach item='item' collection='attachmentChannelIn' separator=',' >#{item}</foreach>)</if> "
+ "<if test='attachmentChannelLike != null'>AND (<foreach item='item' collection='attachmentChannelLike' separator=' OR '>UPPER(a.CHANNEL) LIKE #{item}</foreach>)</if> "
+ "<if test='attachmentReferenceIn != null'>AND a.REF_VALUE IN(<foreach item='item' collection='attachmentReferenceIn' separator=',' >#{item}</foreach>)</if> "
+ "<if test='attachmentReferenceLike != null'>AND (<foreach item='item' collection='attachmentReferenceLike' separator=' OR '>UPPER(a.REF_VALUE) LIKE #{item}</foreach>)</if> "
+ "<if test='attachmentReceivedIn !=null'> AND ( <foreach item='item' collection='attachmentReceivedIn' separator=' OR ' > ( <if test='item.begin!=null'> a.RECEIVED &gt;= #{item.begin} </if> <if test='item.begin!=null and item.end!=null'> AND </if><if test='item.end!=null'> a.RECEIVED &lt;=#{item.end} </if>)</foreach>)</if> "
+ "<if test='!orderColumns.isEmpty()'>AND (<foreach item='item' collection='orderColumns' separator='OR ' >${item} IS NOT NULL </foreach>)</if> "
+ "</where>"
+ "<if test='!orderBy.isEmpty()'>ORDER BY <foreach item='item' collection='orderBy' separator=',' >${item}</foreach></if> "
+ "</otherwise>"
+ "</choose>"
+ "</script>")
@Results(value = {@Result(property = "taskId", column = "ID"),
@Result(property = "created", column = "CREATED"),
@ -274,48 +176,259 @@ public interface QueryMapper {
@Result(property = "custom16", column = "CUSTOM_16")})
List<TaskSummaryImpl> queryTaskSummaries(TaskQueryImpl taskQuery);
@Select("<script>SELECT ID, KEY, PARENT_ID, PARENT_KEY, CATEGORY, TYPE, DOMAIN, VALID_IN_DOMAIN, CREATED, NAME, DESCRIPTION, PRIORITY, SERVICE_LEVEL, APPLICATION_ENTRY_POINT, CUSTOM_1, CUSTOM_2, CUSTOM_3, CUSTOM_4, CUSTOM_5, CUSTOM_6, CUSTOM_7, CUSTOM_8 "
+ "FROM CLASSIFICATION "
+ "<where>"
+ "<if test='key != null'>AND KEY IN(<foreach item='item' collection='key' separator=',' >#{item}</foreach>)</if> "
+ "<if test='idIn != null'>AND ID IN(<foreach item='item' collection='idIn' separator=',' >#{item}</foreach>)</if> "
+ "<if test='parentId != null'>AND PARENT_ID IN(<foreach item='item' collection='parentId' separator=',' >#{item}</foreach>)</if> "
+ "<if test='parentKey != null'>AND PARENT_KEY IN(<foreach item='item' collection='parentKey' separator=',' >#{item}</foreach>)</if> "
+ "<if test='category != null'>AND CATEGORY IN(<foreach item='item' collection='category' separator=',' >#{item}</foreach>)</if> "
+ "<if test='type != null'>AND TYPE IN(<foreach item='item' collection='type' separator=',' >#{item}</foreach>)</if> "
+ "<if test='domain != null'>AND DOMAIN IN(<foreach item='item' collection='domain' separator=',' >#{item}</foreach>)</if> "
+ "<if test='validInDomain != null'>AND VALID_IN_DOMAIN = #{validInDomain}</if> "
+ "<if test='createdIn !=null'> AND ( <foreach item='item' collection='createdIn' separator=' OR ' > ( <if test='item.begin!=null'> CREATED &gt;= #{item.begin} </if> <if test='item.begin!=null and item.end!=null'> AND </if><if test='item.end!=null'> CREATED &lt;=#{item.end} </if>)</foreach>)</if> "
+ "<if test='modifiedIn !=null'> AND ( <foreach item='item' collection='modifiedIn' separator=' OR ' > ( <if test='item.begin!=null'> MODIFIED &gt;= #{item.begin} </if> <if test='item.begin!=null and item.end!=null'> AND </if><if test='item.end!=null'> MODIFIED &lt;=#{item.end} </if>)</foreach>)</if> "
+ "<if test='nameIn != null'>AND NAME IN(<foreach item='item' collection='nameIn' separator=',' >#{item}</foreach>)</if> "
+ "<if test='nameLike != null'>AND (<foreach item='item' collection='nameLike' separator=' OR '>UPPER(NAME) LIKE #{item}</foreach>)</if> "
+ "<if test='descriptionLike != null'>AND UPPER(DESCRIPTION) like #{descriptionLike}</if> "
static String fixColumnNames() {
return "";
}
@Select("<script> "
+ "WITH X (ID, CREATED, CLAIMED, COMPLETED, MODIFIED, PLANNED, DUE, NAME, CREATOR, DESCRIPTION, NOTE, PRIORITY, STATE, TCLASSIFICATION_KEY, "
+ "CLASSIFICATION_CATEGORY, CLASSIFICATION_ID, WORKBASKET_ID, DOMAIN, WORKBASKET_KEY, BUSINESS_PROCESS_ID, PARENT_BUSINESS_PROCESS_ID, OWNER, "
+ "POR_COMPANY, POR_SYSTEM, POR_INSTANCE, POR_TYPE, POR_VALUE, IS_READ, IS_TRANSFERRED, CUSTOM_1, CUSTOM_2, CUSTOM_3, CUSTOM_4, CUSTOM_5, "
+ "CUSTOM_6, CUSTOM_7, CUSTOM_8, CUSTOM_9, CUSTOM_10, CUSTOM_11, CUSTOM_12, CUSTOM_13, CUSTOM_14, CUSTOM_15, CUSTOM_16"
+ "<if test=\"addAttachmentColumnsToSelectClauseForOrdering\">"
+ ", ACLASSIFICATION_ID, ACLASSIFICATION_KEY, CHANNEL, REF_VALUE, RECEIVED"
+ "</if>"
+ " ) "
+ " AS (SELECT <if test=\"joinWithAttachments\">DISTINCT</if> t.ID, t.CREATED, t.CLAIMED, t.COMPLETED, t.MODIFIED, t.PLANNED, t.DUE, t.NAME, t.CREATOR, t.DESCRIPTION, t.NOTE, t.PRIORITY, t.STATE, t.CLASSIFICATION_KEY, "
+ " t.CLASSIFICATION_CATEGORY, t.CLASSIFICATION_ID, t.WORKBASKET_ID, DOMAIN, t.WORKBASKET_KEY, t.BUSINESS_PROCESS_ID, t.PARENT_BUSINESS_PROCESS_ID, t.OWNER, "
+ "t.POR_COMPANY, t.POR_SYSTEM, t.POR_INSTANCE, t.POR_TYPE, t.POR_VALUE, t.IS_READ, t.IS_TRANSFERRED, t.CUSTOM_1, t.CUSTOM_2, t.CUSTOM_3, t.CUSTOM_4, t.CUSTOM_5, "
+ "t.CUSTOM_6, t.CUSTOM_7, t.CUSTOM_8, t.CUSTOM_9, t.CUSTOM_10, t.CUSTOM_11, t.CUSTOM_12, t.CUSTOM_13, t.CUSTOM_14, t.CUSTOM_15, t.CUSTOM_16"
+ "<if test=\"addAttachmentColumnsToSelectClauseForOrdering\">"
+ ", a.CLASSIFICATION_ID, a.CLASSIFICATION_KEY, a.CHANNEL, a.REF_VALUE, a.RECEIVED"
+ "</if>"
+ " FROM TASK t "
+ "<if test=\"joinWithAttachments\">"
+ "LEFT JOIN ATTACHMENT a ON t.ID = a.TASK_ID "
+ "</if>"
+ "<where> "
+ "<if test='taskIds != null'>AND t.ID IN(<foreach item='item' collection='taskIds' separator=',' >#{item}</foreach>)</if> "
+ "<if test='createdIn !=null'> AND ( <foreach item='item' collection='createdIn' separator=' OR ' > ( <if test='item.begin!=null'> t.CREATED &gt;= #{item.begin} </if> <if test='item.begin!=null and item.end!=null'> AND </if><if test='item.end!=null'> t.CREATED &lt;=#{item.end} </if>)</foreach>)</if> "
+ "<if test='claimedIn !=null'> AND ( <foreach item='item' collection='claimedIn' separator=' OR ' > ( <if test='item.begin!=null'> t.CLAIMED &gt;= #{item.begin} </if> <if test='item.begin!=null and item.end!=null'> AND </if><if test='item.end!=null'> t.CLAIMED &lt;=#{item.end} </if>)</foreach>)</if> "
+ "<if test='completedIn !=null'> AND ( <foreach item='item' collection='completedIn' separator=' OR ' > ( <if test='item.begin!=null'> t.COMPLETED &gt;= #{item.begin} </if> <if test='item.begin!=null and item.end!=null'> AND </if><if test='item.end!=null'> t.COMPLETED &lt;=#{item.end} </if>)</foreach>)</if> "
+ "<if test='modifiedIn !=null'> AND ( <foreach item='item' collection='modifiedIn' separator=' OR ' > ( <if test='item.begin!=null'> t.MODIFIED &gt;= #{item.begin} </if> <if test='item.begin!=null and item.end!=null'> AND </if><if test='item.end!=null'> t.MODIFIED &lt;=#{item.end} </if>)</foreach>)</if> "
+ "<if test='plannedIn !=null'> AND ( <foreach item='item' collection='plannedIn' separator=' OR ' > ( <if test='item.begin!=null'> t.PLANNED &gt;= #{item.begin} </if> <if test='item.begin!=null and item.end!=null'> AND </if><if test='item.end!=null'> t.PLANNED &lt;=#{item.end} </if>)</foreach>)</if> "
+ "<if test='dueIn !=null'> AND ( <foreach item='item' collection='dueIn' separator=' OR ' > ( <if test='item.begin!=null'> t.DUE &gt;= #{item.begin} </if> <if test='item.begin!=null and item.end!=null'> AND </if><if test='item.end!=null'> t.DUE &lt;=#{item.end} </if>)</foreach>)</if> "
+ "<if test='nameIn != null'>AND t.NAME IN(<foreach item='item' collection='nameIn' separator=',' >#{item}</foreach>)</if> "
+ "<if test='nameLike != null'>AND (<foreach item='item' collection='nameLike' separator=' OR '>UPPER(t.NAME) LIKE #{item}</foreach>)</if> "
+ "<if test='creatorIn != null'>AND CREATOR IN(<foreach item='item' collection='creatorIn' separator=',' >#{item}</foreach>)</if> "
+ "<if test='creatorLike != null'>AND (<foreach item='item' collection='creatorLike' separator=' OR '>UPPER(CREATOR) LIKE #{item}</foreach>)</if> "
+ "<if test='description != null'>AND (<foreach item='item' collection='description' separator=' OR '>DESCRIPTION LIKE #{item}</foreach>)</if> "
+ "<if test='noteLike != null'>AND (<foreach item='item' collection='noteLike' separator=' OR '>UPPER(NOTE) LIKE #{item}</foreach>)</if> "
+ "<if test='priority != null'>AND PRIORITY IN(<foreach item='item' collection='priority' separator=',' >#{item}</foreach>)</if> "
+ "<if test='serviceLevelIn != null'>AND SERVICE_LEVEL IN(<foreach item='item' collection='serviceLevelIn' separator=',' >#{item}</foreach>)</if> "
+ "<if test='serviceLevelLike != null'>AND (<foreach item='item' collection='serviceLevelLike' separator=' OR ' >UPPER(SERVICE_LEVEL) LIKE #{item}</foreach>)</if> "
+ "<if test='applicationEntryPointIn != null'>AND APPLICATION_ENTRY_POINT IN(<foreach item='item' collection='applicationEntryPointIn' separator=',' >#{item}</foreach>)</if> "
+ "<if test='applicationEntryPointLike != null'>AND (<foreach item='item' collection='applicationEntryPointLike' separator=' OR ' >UPPER(APPLICATION_ENTRY_POINT) LIKE #{item}</foreach>)</if> "
+ "<if test='custom1In != null'>AND CUSTOM_1 IN(<foreach item='item' collection='custom1In' separator=',' >#{item}</foreach>) </if> "
+ "<if test='custom1Like != null'>AND (<foreach item='item' collection='custom1Like' separator=' OR ' > UPPER(CUSTOM_1) LIKE #{item}</foreach>)</if> "
+ "<if test='custom2In != null'>AND CUSTOM_2 IN(<foreach item='item' collection='custom2In' separator=',' >#{item}</foreach>) </if> "
+ "<if test='custom2Like != null'>AND (<foreach item='item' collection='custom2Like' separator=' OR ' > UPPER(CUSTOM_2) LIKE #{item}</foreach>)</if> "
+ "<if test='custom3In != null'>AND CUSTOM_3 IN(<foreach item='item' collection='custom3In' separator=',' >#{item}</foreach>) </if> "
+ "<if test='custom3Like != null'>AND (<foreach item='item' collection='custom3Like' separator=' OR ' > UPPER(CUSTOM_3) LIKE #{item}</foreach>)</if> "
+ "<if test='custom4In != null'>AND CUSTOM_4 IN(<foreach item='item' collection='custom4In' separator=',' >#{item}</foreach>) </if> "
+ "<if test='custom4Like != null'>AND (<foreach item='item' collection='custom4Like' separator=' OR ' > UPPER(CUSTOM_4) LIKE #{item}</foreach>)</if> "
+ "<if test='custom5In != null'>AND CUSTOM_5 IN(<foreach item='item' collection='custom5In' separator=',' >#{item}</foreach>) </if> "
+ "<if test='custom5Like != null'>AND (<foreach item='item' collection='custom5Like' separator=' OR ' > UPPER(CUSTOM_5) LIKE #{item}</foreach>)</if> "
+ "<if test='custom6In != null'>AND CUSTOM_6 IN(<foreach item='item' collection='custom6In' separator=',' >#{item}</foreach>) </if> "
+ "<if test='custom6Like != null'>AND (<foreach item='item' collection='custom6Like' separator=' OR ' > UPPER(CUSTOM_6) LIKE #{item}</foreach>)</if> "
+ "<if test='custom7In != null'>AND CUSTOM_7 IN(<foreach item='item' collection='custom7In' separator=',' >#{item}</foreach>) </if> "
+ "<if test='custom7Like != null'>AND (<foreach item='item' collection='custom7Like' separator=' OR ' > UPPER(CUSTOM_7) LIKE #{item}</foreach>)</if> "
+ "<if test='custom8In != null'>AND CUSTOM_8 IN(<foreach item='item' collection='custom8In' separator=',' >#{item}</foreach>) </if> "
+ "<if test='custom8Like != null'>AND (<foreach item='item' collection='custom8Like' separator=' OR ' > UPPER(CUSTOM_8) LIKE #{item}</foreach>)</if> "
+ "<if test='!orderColumns.isEmpty()'>AND (<foreach item='item' collection='orderColumns' separator='OR ' >${item} IS NOT NULL </foreach>)</if> "
+ "</where>"
+ "<if test='!orderBy.isEmpty()'>ORDER BY <foreach item='item' collection='orderBy' separator=',' >${item}</foreach></if> "
+ "<if test=\"_databaseId == 'db2'\">with UR </if> "
+ "<if test='stateIn != null'>AND STATE IN(<foreach item='item' collection='stateIn' separator=',' >#{item}</foreach>)</if> "
+ "<if test='workbasketIdIn != null'>AND WORKBASKET_ID IN(<foreach item='item' collection='workbasketIdIn' separator=',' >#{item}</foreach>)</if> "
+ "<if test='workbasketKeyDomainIn != null'>AND (<foreach item='item' collection='workbasketKeyDomainIn' separator=' OR '>(WORKBASKET_KEY = #{item.key} AND DOMAIN = #{item.domain})</foreach>)</if> "
+ "<if test='classificationKeyIn != null'>AND t.CLASSIFICATION_KEY IN(<foreach item='item' collection='classificationKeyIn' separator=',' >#{item}</foreach>)</if> "
+ "<if test='classificationKeyNotIn != null'>AND t.CLASSIFICATION_KEY NOT IN(<foreach item='item' collection='classificationKeyNotIn' separator=',' >#{item}</foreach>)</if> "
+ "<if test='classificationKeyLike != null'>AND (<foreach item='item' collection='classificationKeyLike' separator=' OR '>UPPER(t.CLASSIFICATION_KEY) LIKE #{item}</foreach>)</if> "
+ "<if test='classificationIdIn != null'>AND t.CLASSIFICATION_ID IN(<foreach item='item' collection='classificationIdIn' separator=',' >#{item}</foreach>)</if> "
+ "<if test='classificationCategoryIn != null'>AND CLASSIFICATION_CATEGORY IN(<foreach item='item' collection='classificationCategoryIn' separator=',' >#{item}</foreach>)</if> "
+ "<if test='classificationCategoryLike != null'>AND (<foreach item='item' collection='classificationCategoryLike' separator=' OR '>UPPER(CLASSIFICATION_CATEGORY) LIKE #{item}</foreach>)</if> "
+ "<if test='ownerIn != null'>AND OWNER IN(<foreach item='item' collection='ownerIn' separator=',' >#{item}</foreach>)</if> "
+ "<if test='ownerLike != null'>AND (<foreach item='item' collection='ownerLike' separator=' OR '>UPPER(OWNER) LIKE #{item}</foreach>)</if> "
+ "<if test='isRead != null'>AND IS_READ = #{isRead}</if> "
+ "<if test='isTransferred != null'>AND IS_TRANSFERRED = #{isTransferred}</if> "
+ "<if test='porCompanyIn != null'>AND POR_COMPANY IN(<foreach item='item' collection='porCompanyIn' separator=',' >#{item}</foreach>)</if> "
+ "<if test='porCompanyLike != null'>AND (<foreach item='item' collection='porCompanyLike' separator=' OR '>UPPER(POR_COMPANY) LIKE #{item}</foreach>)</if> "
+ "<if test='porSystemIn != null'>AND POR_SYSTEM IN(<foreach item='item' collection='porSystemIn' separator=',' >#{item}</foreach>)</if> "
+ "<if test='porSystemLike != null'>AND (<foreach item='item' collection='porSystemLike' separator=' OR '>UPPER(POR_SYSTEM) LIKE #{item}</foreach>)</if> "
+ "<if test='porSystemInstanceIn != null'>AND POR_INSTANCE IN(<foreach item='item' collection='porSystemInstanceIn' separator=',' >#{item}</foreach>)</if> "
+ "<if test='porSystemInstanceLike != null'>AND (<foreach item='item' collection='porSystemInstanceLike' separator=' OR '>UPPER(POR_INSTANCE) LIKE #{item}</foreach>)</if> "
+ "<if test='porTypeIn != null'>AND POR_TYPE IN(<foreach item='item' collection='porTypeIn' separator=',' >#{item}</foreach>)</if> "
+ "<if test='porTypeLike != null'>AND (<foreach item='item' collection='porTypeLike' separator=' OR '>UPPER(POR_TYPE) LIKE #{item}</foreach>)</if> "
+ "<if test='porValueIn != null'>AND POR_VALUE IN(<foreach item='item' collection='porValueIn' separator=',' >#{item}</foreach>)</if> "
+ "<if test='porValueLike != null'>AND (<foreach item='item' collection='porValueLike' separator=' OR '>UPPER(POR_VALUE) LIKE #{item}</foreach>)</if> "
+ "<if test='parentBusinessProcessIdIn != null'>AND PARENT_BUSINESS_PROCESS_ID IN(<foreach item='item' collection='parentBusinessProcessIdIn' separator=',' >#{item}</foreach>)</if> "
+ "<if test='parentBusinessProcessIdLike != null'>AND (<foreach item='item' collection='parentBusinessProcessIdLike' separator=' OR '>UPPER(PARENT_BUSINESS_PROCESS_ID) LIKE #{item}</foreach>)</if> "
+ "<if test='businessProcessIdIn != null'>AND BUSINESS_PROCESS_ID IN(<foreach item='item' collection='businessProcessIdIn' separator=',' >#{item}</foreach>)</if> "
+ "<if test='businessProcessIdLike != null'>AND (<foreach item='item' collection='businessProcessIdLike' separator=' OR '>UPPER(BUSINESS_PROCESS_ID) LIKE #{item}</foreach>)</if> "
+ "<if test='custom1In != null'>AND CUSTOM_1 IN(<foreach item='item' collection='custom1In' separator=',' >#{item}</foreach>)</if> "
+ "<if test='custom1Like != null'>AND (<foreach item='item' collection='custom1Like' separator=' OR '>UPPER(CUSTOM_1) LIKE #{item}</foreach>)</if> "
+ "<if test='custom2In != null'>AND CUSTOM_2 IN(<foreach item='item' collection='custom2In' separator=',' >#{item}</foreach>)</if> "
+ "<if test='custom2Like != null'>AND (<foreach item='item' collection='custom2Like' separator=' OR '>UPPER(CUSTOM_2) LIKE #{item}</foreach>)</if> "
+ "<if test='custom3In != null'>AND CUSTOM_3 IN(<foreach item='item' collection='custom3In' separator=',' >#{item}</foreach>)</if> "
+ "<if test='custom3Like != null'>AND (<foreach item='item' collection='custom3Like' separator=' OR '>UPPER(CUSTOM_3) LIKE #{item}</foreach>)</if> "
+ "<if test='custom4In != null'>AND CUSTOM_4 IN(<foreach item='item' collection='custom4In' separator=',' >#{item}</foreach>)</if> "
+ "<if test='custom4Like != null'>AND (<foreach item='item' collection='custom4Like' separator=' OR '>UPPER(CUSTOM_4) LIKE #{item}</foreach>)</if> "
+ "<if test='custom5In != null'>AND CUSTOM_5 IN(<foreach item='item' collection='custom5In' separator=',' >#{item}</foreach>)</if> "
+ "<if test='custom5Like != null'>AND (<foreach item='item' collection='custom5Like' separator=' OR '>UPPER(CUSTOM_5) LIKE #{item}</foreach>)</if> "
+ "<if test='custom6In != null'>AND CUSTOM_6 IN(<foreach item='item' collection='custom6In' separator=',' >#{item}</foreach>)</if> "
+ "<if test='custom6Like != null'>AND (<foreach item='item' collection='custom6Like' separator=' OR '>UPPER(CUSTOM_6) LIKE #{item}</foreach>)</if> "
+ "<if test='custom7In != null'>AND CUSTOM_7 IN(<foreach item='item' collection='custom7In' separator=',' >#{item}</foreach>)</if> "
+ "<if test='custom7Like != null'>AND (<foreach item='item' collection='custom7Like' separator=' OR '>UPPER(CUSTOM_7) LIKE #{item}</foreach>)</if> "
+ "<if test='custom8In != null'>AND CUSTOM_8 IN(<foreach item='item' collection='custom8In' separator=',' >#{item}</foreach>)</if> "
+ "<if test='custom8Like != null'>AND (<foreach item='item' collection='custom8Like' separator=' OR '>UPPER(CUSTOM_8) LIKE #{item}</foreach>)</if> "
+ "<if test='custom9In != null'>AND CUSTOM_9 IN(<foreach item='item' collection='custom9In' separator=',' >#{item}</foreach>)</if> "
+ "<if test='custom9Like != null'>AND (<foreach item='item' collection='custom9Like' separator=' OR '>UPPER(CUSTOM_9) LIKE #{item}</foreach>)</if> "
+ "<if test='custom10In != null'>AND CUSTOM_10 IN(<foreach item='item' collection='custom10In' separator=',' >#{item}</foreach>)</if> "
+ "<if test='custom10Like != null'>AND (<foreach item='item' collection='custom10Like' separator=' OR '>UPPER(CUSTOM_10) LIKE #{item}</foreach>)</if> "
+ "<if test='custom11In != null'>AND CUSTOM_11 IN(<foreach item='item' collection='custom11In' separator=',' >#{item}</foreach>)</if> "
+ "<if test='custom11Like != null'>AND (<foreach item='item' collection='custom11Like' separator=' OR '>UPPER(CUSTOM_11) LIKE #{item}</foreach>)</if> "
+ "<if test='custom12In != null'>AND CUSTOM_12 IN(<foreach item='item' collection='custom12In' separator=',' >#{item}</foreach>)</if> "
+ "<if test='custom12Like != null'>AND (<foreach item='item' collection='custom12Like' separator=' OR '>UPPER(CUSTOM_12) LIKE #{item}</foreach>)</if> "
+ "<if test='custom13In != null'>AND CUSTOM_13 IN(<foreach item='item' collection='custom13In' separator=',' >#{item}</foreach>)</if> "
+ "<if test='custom13Like != null'>AND (<foreach item='item' collection='custom13Like' separator=' OR '>UPPER(CUSTOM_13) LIKE #{item}</foreach>)</if> "
+ "<if test='custom14In != null'>AND CUSTOM_14 IN(<foreach item='item' collection='custom14In' separator=',' >#{item}</foreach>)</if> "
+ "<if test='custom14Like != null'>AND (<foreach item='item' collection='custom14Like' separator=' OR '>UPPER(CUSTOM_14) LIKE #{item}</foreach>)</if> "
+ "<if test='custom15In != null'>AND CUSTOM_15 IN(<foreach item='item' collection='custom15In' separator=',' >#{item}</foreach>)</if> "
+ "<if test='custom15Like != null'>AND (<foreach item='item' collection='custom15Like' separator=' OR '>UPPER(CUSTOM_15) LIKE #{item}</foreach>)</if> "
+ "<if test='custom16In != null'>AND CUSTOM_16 IN(<foreach item='item' collection='custom16In' separator=',' >#{item}</foreach>)</if> "
+ "<if test='custom16Like != null'>AND (<foreach item='item' collection='custom16Like' separator=' OR '>UPPER(CUSTOM_16) LIKE #{item}</foreach>)</if> "
+ "<if test='attachmentClassificationKeyIn != null'>AND a.CLASSIFICATION_KEY IN(<foreach item='item' collection='attachmentClassificationKeyIn' separator=',' >#{item}</foreach>)</if> "
+ "<if test='attachmentClassificationKeyLike != null'>AND (<foreach item='item' collection='attachmentClassificationKeyLike' separator=' OR '>UPPER(a.CLASSIFICATION_KEY) LIKE #{item}</foreach>)</if> "
+ "<if test='attachmentClassificationIdIn != null'>AND a.CLASSIFICATION_ID IN(<foreach item='item' collection='attachmentClassificationIdIn' separator=',' >#{item}</foreach>)</if> "
+ "<if test='attachmentClassificationIdLike != null'>AND (<foreach item='item' collection='attachmentClassificationIdLike' separator=' OR '>UPPER(a.CLASSIFICATION_ID) LIKE #{item}</foreach>)</if> "
+ "<if test='attachmentChannelIn != null'>AND a.CHANNEL IN(<foreach item='item' collection='attachmentChannelIn' separator=',' >#{item}</foreach>)</if> "
+ "<if test='attachmentChannelLike != null'>AND (<foreach item='item' collection='attachmentChannelLike' separator=' OR '>UPPER(a.CHANNEL) LIKE #{item}</foreach>)</if> "
+ "<if test='attachmentReferenceIn != null'>AND a.REF_VALUE IN(<foreach item='item' collection='attachmentReferenceIn' separator=',' >#{item}</foreach>)</if> "
+ "<if test='attachmentReferenceLike != null'>AND (<foreach item='item' collection='attachmentReferenceLike' separator=' OR '>UPPER(a.REF_VALUE) LIKE #{item}</foreach>)</if> "
+ "<if test='attachmentReceivedIn !=null'> AND ( <foreach item='item' collection='attachmentReceivedIn' separator=' OR ' > ( <if test='item.begin!=null'> a.RECEIVED &gt;= #{item.begin} </if> <if test='item.begin!=null and item.end!=null'> AND </if><if test='item.end!=null'> a.RECEIVED &lt;=#{item.end} </if>)</foreach>)</if> "
+ "<if test='!orderBy.isEmpty()'>AND (<foreach item='item' collection='orderColumns' separator='OR ' >"
+ "<choose>"
+ "<when test=\"item.contains('ACLASSIFICATION_KEY')\">"
+ " a.CLASSIFICATION_KEY IS NOT NULL "
+ "</when>"
+ "<when test=\"item.contains('ACLASSIFICATION_ID')\">"
+ " a.CLASSIFICATION_KEY IS NOT NULL "
+ "</when>"
+ "<when test=\"item.contains('TCLASSIFICATION_KEY')\">"
+ " t.CLASSIFICATION_KEY IS NOT NULL "
+ "</when>"
+ "<otherwise>"
+ " ${item} IS NOT NULL "
+ "</otherwise>"
+ "</choose>"
+ "</foreach>)</if> "
+ "</where> "
+ "), Y (ID, CREATED, CLAIMED, COMPLETED, MODIFIED, PLANNED, DUE, NAME, CREATOR, DESCRIPTION, NOTE, PRIORITY, STATE, TCLASSIFICATION_KEY, "
+ " CLASSIFICATION_CATEGORY, CLASSIFICATION_ID, WORKBASKET_ID, DOMAIN, WORKBASKET_KEY, BUSINESS_PROCESS_ID, PARENT_BUSINESS_PROCESS_ID, OWNER, "
+ "POR_COMPANY, POR_SYSTEM, POR_INSTANCE, POR_TYPE, POR_VALUE, IS_READ, IS_TRANSFERRED, CUSTOM_1, CUSTOM_2, CUSTOM_3, CUSTOM_4, CUSTOM_5, "
+ "CUSTOM_6, CUSTOM_7, CUSTOM_8, CUSTOM_9, CUSTOM_10, CUSTOM_11, CUSTOM_12, CUSTOM_13, CUSTOM_14, CUSTOM_15, CUSTOM_16"
+ "<if test=\"addAttachmentColumnsToSelectClauseForOrdering\">"
+ ", ACLASSIFICATION_ID, ACLASSIFICATION_KEY, CHANNEL, REF_VALUE, RECEIVED"
+ "</if>"
+ ", FLAG ) "
+ "AS "
+ "(SELECT ID, CREATED, CLAIMED, COMPLETED, MODIFIED, PLANNED, DUE, NAME, CREATOR, DESCRIPTION, NOTE, PRIORITY, STATE, TCLASSIFICATION_KEY, "
+ " CLASSIFICATION_CATEGORY, CLASSIFICATION_ID, WORKBASKET_ID, DOMAIN, WORKBASKET_KEY, BUSINESS_PROCESS_ID, PARENT_BUSINESS_PROCESS_ID, OWNER, "
+ "POR_COMPANY, POR_SYSTEM, POR_INSTANCE, POR_TYPE, POR_VALUE, IS_READ, IS_TRANSFERRED, CUSTOM_1, CUSTOM_2, CUSTOM_3, CUSTOM_4, CUSTOM_5, "
+ "CUSTOM_6, CUSTOM_7, CUSTOM_8, CUSTOM_9, CUSTOM_10, CUSTOM_11, CUSTOM_12, CUSTOM_13, CUSTOM_14, CUSTOM_15, CUSTOM_16"
+ "<if test=\"addAttachmentColumnsToSelectClauseForOrdering\">"
+ ", ACLASSIFICATION_ID, ACLASSIFICATION_KEY, CHANNEL, REF_VALUE, RECEIVED"
+ "</if>"
+ ", (SELECT 1 FROM WORKBASKET_ACCESS_LIST s WHERE "
+ "<if test='accessIdIn != null'> "
+ "s.ACCESS_ID IN (<foreach item='item' collection='accessIdIn' separator=',' >#{item}</foreach>) and "
+ "</if>"
+ "s.WORKBASKET_ID = X.WORKBASKET_ID AND "
+ "s.perm_read = 1 "
+ "fetch first 1 rows only "
+ ") FROM X )"
+ "SELECT ID, CREATED, CLAIMED, COMPLETED, MODIFIED, PLANNED, DUE, NAME, CREATOR, DESCRIPTION, NOTE, PRIORITY, STATE, TCLASSIFICATION_KEY, "
+ " CLASSIFICATION_CATEGORY, CLASSIFICATION_ID, WORKBASKET_ID, DOMAIN, WORKBASKET_KEY, BUSINESS_PROCESS_ID, PARENT_BUSINESS_PROCESS_ID, OWNER, "
+ "POR_COMPANY, POR_SYSTEM, POR_INSTANCE, POR_TYPE, POR_VALUE, IS_READ, IS_TRANSFERRED, CUSTOM_1, CUSTOM_2, CUSTOM_3, CUSTOM_4, CUSTOM_5, "
+ "CUSTOM_6, CUSTOM_7, CUSTOM_8, CUSTOM_9, CUSTOM_10, CUSTOM_11, CUSTOM_12, CUSTOM_13, CUSTOM_14, CUSTOM_15, CUSTOM_16"
+ "<if test=\"addAttachmentColumnsToSelectClauseForOrdering\">"
+ ", ACLASSIFICATION_ID, ACLASSIFICATION_KEY, CHANNEL, REF_VALUE, RECEIVED "
+ "</if>"
+ " FROM Y WHERE FLAG = 1 "
+ "<if test='!orderBy.isEmpty()'>ORDER BY <foreach item='item' collection='orderBy' separator=',' >"
+ "${item}"
+ "</foreach>"
+ "</if> "
+ "with UR "
+ "</script>")
@Results(value = {@Result(property = "taskId", column = "ID"),
@Result(property = "created", column = "CREATED"),
@Result(property = "claimed", column = "CLAIMED"),
@Result(property = "completed", column = "COMPLETED"),
@Result(property = "modified", column = "MODIFIED"),
@Result(property = "planned", column = "PLANNED"),
@Result(property = "due", column = "DUE"),
@Result(property = "name", column = "NAME"),
@Result(property = "creator", column = "CREATOR"),
@Result(property = "note", column = "NOTE"),
@Result(property = "priority", column = "PRIORITY"),
@Result(property = "state", column = "STATE"),
@Result(property = "workbasketSummaryImpl.domain", column = "DOMAIN"),
@Result(property = "workbasketSummaryImpl.key", column = "WORKBASKET_KEY"),
@Result(property = "workbasketSummaryImpl.id", column = "WORKBASKET_ID"),
@Result(property = "classificationSummaryImpl.key", column = "CLASSIFICATION_KEY"),
@Result(property = "classificationSummaryImpl.id", column = "CLASSIFICATION_ID"),
@Result(property = "classificationSummaryImpl.domain", column = "DOMAIN"),
@Result(property = "classificationSummaryImpl.category", column = "CLASSIFICATION_CATEGORY"),
@Result(property = "businessProcessId", column = "BUSINESS_PROCESS_ID"),
@Result(property = "parentBusinessProcessId", column = "PARENT_BUSINESS_PROCESS_ID"),
@Result(property = "owner", column = "OWNER"),
@Result(property = "primaryObjRef.company", column = "POR_COMPANY"),
@Result(property = "primaryObjRef.system", column = "POR_SYSTEM"),
@Result(property = "primaryObjRef.systemInstance", column = "POR_INSTANCE"),
@Result(property = "primaryObjRef.type", column = "POR_TYPE"),
@Result(property = "primaryObjRef.value", column = "POR_VALUE"),
@Result(property = "isRead", column = "IS_READ"),
@Result(property = "isTransferred", column = "IS_TRANSFERRED"),
@Result(property = "custom1", column = "CUSTOM_1"),
@Result(property = "custom2", column = "CUSTOM_2"),
@Result(property = "custom3", column = "CUSTOM_3"),
@Result(property = "custom4", column = "CUSTOM_4"),
@Result(property = "custom5", column = "CUSTOM_5"),
@Result(property = "custom6", column = "CUSTOM_6"),
@Result(property = "custom7", column = "CUSTOM_7"),
@Result(property = "custom8", column = "CUSTOM_8"),
@Result(property = "custom9", column = "CUSTOM_9"),
@Result(property = "custom10", column = "CUSTOM_10"),
@Result(property = "custom11", column = "CUSTOM_11"),
@Result(property = "custom12", column = "CUSTOM_12"),
@Result(property = "custom13", column = "CUSTOM_13"),
@Result(property = "custom14", column = "CUSTOM_14"),
@Result(property = "custom15", column = "CUSTOM_15"),
@Result(property = "custom16", column = "CUSTOM_16")})
List<TaskSummaryImpl> queryTaskSummariesDb2(TaskQueryImpl taskQuery);
@Select(
"<script>SELECT ID, KEY, PARENT_ID, PARENT_KEY, CATEGORY, TYPE, DOMAIN, VALID_IN_DOMAIN, CREATED, NAME, DESCRIPTION, PRIORITY, SERVICE_LEVEL, APPLICATION_ENTRY_POINT, CUSTOM_1, CUSTOM_2, CUSTOM_3, CUSTOM_4, CUSTOM_5, CUSTOM_6, CUSTOM_7, CUSTOM_8 "
+ "FROM CLASSIFICATION "
+ "<where>"
+ "<if test='key != null'>AND KEY IN(<foreach item='item' collection='key' separator=',' >#{item}</foreach>)</if> "
+ "<if test='idIn != null'>AND ID IN(<foreach item='item' collection='idIn' separator=',' >#{item}</foreach>)</if> "
+ "<if test='parentId != null'>AND PARENT_ID IN(<foreach item='item' collection='parentId' separator=',' >#{item}</foreach>)</if> "
+ "<if test='parentKey != null'>AND PARENT_KEY IN(<foreach item='item' collection='parentKey' separator=',' >#{item}</foreach>)</if> "
+ "<if test='category != null'>AND CATEGORY IN(<foreach item='item' collection='category' separator=',' >#{item}</foreach>)</if> "
+ "<if test='type != null'>AND TYPE IN(<foreach item='item' collection='type' separator=',' >#{item}</foreach>)</if> "
+ "<if test='domain != null'>AND DOMAIN IN(<foreach item='item' collection='domain' separator=',' >#{item}</foreach>)</if> "
+ "<if test='validInDomain != null'>AND VALID_IN_DOMAIN = #{validInDomain}</if> "
+ "<if test='createdIn !=null'> AND ( <foreach item='item' collection='createdIn' separator=' OR ' > ( <if test='item.begin!=null'> CREATED &gt;= #{item.begin} </if> <if test='item.begin!=null and item.end!=null'> AND </if><if test='item.end!=null'> CREATED &lt;=#{item.end} </if>)</foreach>)</if> "
+ "<if test='modifiedIn !=null'> AND ( <foreach item='item' collection='modifiedIn' separator=' OR ' > ( <if test='item.begin!=null'> MODIFIED &gt;= #{item.begin} </if> <if test='item.begin!=null and item.end!=null'> AND </if><if test='item.end!=null'> MODIFIED &lt;=#{item.end} </if>)</foreach>)</if> "
+ "<if test='nameIn != null'>AND NAME IN(<foreach item='item' collection='nameIn' separator=',' >#{item}</foreach>)</if> "
+ "<if test='nameLike != null'>AND (<foreach item='item' collection='nameLike' separator=' OR '>UPPER(NAME) LIKE #{item}</foreach>)</if> "
+ "<if test='descriptionLike != null'>AND UPPER(DESCRIPTION) like #{descriptionLike}</if> "
+ "<if test='priority != null'>AND PRIORITY IN(<foreach item='item' collection='priority' separator=',' >#{item}</foreach>)</if> "
+ "<if test='serviceLevelIn != null'>AND SERVICE_LEVEL IN(<foreach item='item' collection='serviceLevelIn' separator=',' >#{item}</foreach>)</if> "
+ "<if test='serviceLevelLike != null'>AND (<foreach item='item' collection='serviceLevelLike' separator=' OR ' >UPPER(SERVICE_LEVEL) LIKE #{item}</foreach>)</if> "
+ "<if test='applicationEntryPointIn != null'>AND APPLICATION_ENTRY_POINT IN(<foreach item='item' collection='applicationEntryPointIn' separator=',' >#{item}</foreach>)</if> "
+ "<if test='applicationEntryPointLike != null'>AND (<foreach item='item' collection='applicationEntryPointLike' separator=' OR ' >UPPER(APPLICATION_ENTRY_POINT) LIKE #{item}</foreach>)</if> "
+ "<if test='custom1In != null'>AND CUSTOM_1 IN(<foreach item='item' collection='custom1In' separator=',' >#{item}</foreach>) </if> "
+ "<if test='custom1Like != null'>AND (<foreach item='item' collection='custom1Like' separator=' OR ' > UPPER(CUSTOM_1) LIKE #{item}</foreach>)</if> "
+ "<if test='custom2In != null'>AND CUSTOM_2 IN(<foreach item='item' collection='custom2In' separator=',' >#{item}</foreach>) </if> "
+ "<if test='custom2Like != null'>AND (<foreach item='item' collection='custom2Like' separator=' OR ' > UPPER(CUSTOM_2) LIKE #{item}</foreach>)</if> "
+ "<if test='custom3In != null'>AND CUSTOM_3 IN(<foreach item='item' collection='custom3In' separator=',' >#{item}</foreach>) </if> "
+ "<if test='custom3Like != null'>AND (<foreach item='item' collection='custom3Like' separator=' OR ' > UPPER(CUSTOM_3) LIKE #{item}</foreach>)</if> "
+ "<if test='custom4In != null'>AND CUSTOM_4 IN(<foreach item='item' collection='custom4In' separator=',' >#{item}</foreach>) </if> "
+ "<if test='custom4Like != null'>AND (<foreach item='item' collection='custom4Like' separator=' OR ' > UPPER(CUSTOM_4) LIKE #{item}</foreach>)</if> "
+ "<if test='custom5In != null'>AND CUSTOM_5 IN(<foreach item='item' collection='custom5In' separator=',' >#{item}</foreach>) </if> "
+ "<if test='custom5Like != null'>AND (<foreach item='item' collection='custom5Like' separator=' OR ' > UPPER(CUSTOM_5) LIKE #{item}</foreach>)</if> "
+ "<if test='custom6In != null'>AND CUSTOM_6 IN(<foreach item='item' collection='custom6In' separator=',' >#{item}</foreach>) </if> "
+ "<if test='custom6Like != null'>AND (<foreach item='item' collection='custom6Like' separator=' OR ' > UPPER(CUSTOM_6) LIKE #{item}</foreach>)</if> "
+ "<if test='custom7In != null'>AND CUSTOM_7 IN(<foreach item='item' collection='custom7In' separator=',' >#{item}</foreach>) </if> "
+ "<if test='custom7Like != null'>AND (<foreach item='item' collection='custom7Like' separator=' OR ' > UPPER(CUSTOM_7) LIKE #{item}</foreach>)</if> "
+ "<if test='custom8In != null'>AND CUSTOM_8 IN(<foreach item='item' collection='custom8In' separator=',' >#{item}</foreach>) </if> "
+ "<if test='custom8Like != null'>AND (<foreach item='item' collection='custom8Like' separator=' OR ' > UPPER(CUSTOM_8) LIKE #{item}</foreach>)</if> "
+ "<if test='!orderColumns.isEmpty()'>AND (<foreach item='item' collection='orderColumns' separator='OR ' >${item} IS NOT NULL </foreach>)</if> "
+ "</where>"
+ "<if test='!orderBy.isEmpty()'>ORDER BY <foreach item='item' collection='orderBy' separator=',' >${item}</foreach></if> "
+ "<if test=\"_databaseId == 'db2'\">with UR </if> "
+ "</script>")
@Results({@Result(property = "id", column = "ID"),
@Result(property = "key", column = "KEY"),
@Result(property = "category", column = "CATEGORY"),
@ -499,7 +612,10 @@ public interface QueryMapper {
@Select("<script> "
+ "<choose>"
+ "<when test=\"_databaseId == 'db2'\">"
+ "WITH X (ID, WORKBASKET_ID) AS (SELECT ID, WORKBASKET_ID FROM TASK t "
+ "WITH X (ID, WORKBASKET_ID) AS (SELECT <if test=\"joinWithAttachments\">DISTINCT</if> t.ID, t.WORKBASKET_ID FROM TASK t "
+ "<if test=\"joinWithAttachments\">"
+ "LEFT JOIN ATTACHMENT AS a ON t.ID = a.TASK_ID "
+ "</if>"
+ "<where> "
+ "<if test='taskIds != null'>AND t.ID IN(<foreach item='item' collection='taskIds' separator=',' >#{item}</foreach>)</if> "
+ "<if test='createdIn !=null'> AND ( <foreach item='item' collection='createdIn' separator=' OR ' > ( <if test='item.begin!=null'> t.CREATED &gt;= #{item.begin} </if> <if test='item.begin!=null and item.end!=null'> AND </if><if test='item.end!=null'> t.CREATED &lt;=#{item.end} </if>)</foreach>)</if> "
@ -574,6 +690,15 @@ public interface QueryMapper {
+ "<if test='custom15Like != null'>AND (<foreach item='item' collection='custom15Like' separator=' OR '>UPPER(t.CUSTOM_15) LIKE #{item}</foreach>)</if> "
+ "<if test='custom16In != null'>AND t.CUSTOM_16 IN(<foreach item='item' collection='custom16In' separator=',' >#{item}</foreach>)</if> "
+ "<if test='custom16Like != null'>AND (<foreach item='item' collection='custom16Like' separator=' OR '>UPPER(t.CUSTOM_16) LIKE #{item}</foreach>)</if> "
+ "<if test='attachmentClassificationKeyIn != null'>AND a.CLASSIFICATION_KEY IN(<foreach item='item' collection='attachmentClassificationKeyIn' separator=',' >#{item}</foreach>)</if> "
+ "<if test='attachmentClassificationKeyLike != null'>AND (<foreach item='item' collection='attachmentClassificationKeyLike' separator=' OR '>UPPER(a.CLASSIFICATION_KEY) LIKE #{item}</foreach>)</if> "
+ "<if test='attachmentClassificationIdIn != null'>AND a.CLASSIFICATION_ID IN(<foreach item='item' collection='attachmentClassificationIdIn' separator=',' >#{item}</foreach>)</if> "
+ "<if test='attachmentClassificationIdLike != null'>AND (<foreach item='item' collection='attachmentclassificationIdLike' separator=' OR '>UPPER(a.CLASSIFICATION_ID) LIKE #{item}</foreach>)</if> "
+ "<if test='attachmentChannelIn != null'>AND a.CHANNEL IN(<foreach item='item' collection='attachmentChannelIn' separator=',' >#{item}</foreach>)</if> "
+ "<if test='attachmentChannelLike != null'>AND (<foreach item='item' collection='attachmentChannelLike' separator=' OR '>UPPER(a.CHANNEL) LIKE #{item}</foreach>)</if> "
+ "<if test='attachmentReferenceIn != null'>AND a.REF_VALUE IN(<foreach item='item' collection='attachmentReferenceIn' separator=',' >#{item}</foreach>)</if> "
+ "<if test='attachmentReferenceLike != null'>AND (<foreach item='item' collection='attachmentReferenceLike' separator=' OR '>UPPER(a.REF_VALUE) LIKE #{item}</foreach>)</if> "
+ "<if test='attachmentReceivedIn !=null'> AND ( <foreach item='item' collection='attachmentReceivedIn' separator=' OR ' > ( <if test='item.begin!=null'> a.RECEIVED &gt;= #{item.begin} </if> <if test='item.begin!=null and item.end!=null'> AND </if><if test='item.end!=null'> a.RECEIVED &lt;=#{item.end} </if>)</foreach>)</if> "
+ "</where> "
+ "), Y (ID, FLAG) AS "
+ "(SELECT ID, (SELECT 1 FROM WORKBASKET_ACCESS_LIST s WHERE "
@ -588,7 +713,10 @@ public interface QueryMapper {
+ "with UR "
+ "</when>"
+ "<otherwise>"
+ "SELECT COUNT(ID) FROM TASK t "
+ "SELECT COUNT( <if test=\"joinWithAttachments\">DISTINCT</if> t.ID) FROM TASK t "
+ "<if test=\"joinWithAttachments\">"
+ "LEFT JOIN ATTACHMENT AS a ON t.ID = a.TASK_ID "
+ "</if>"
+ "<where>"
+ "<if test='accessIdIn != null'> "
+ "AND t.WORKBASKET_ID IN ( "
@ -669,6 +797,15 @@ public interface QueryMapper {
+ "<if test='custom15Like != null'>AND (<foreach item='item' collection='custom15Like' separator=' OR '>UPPER(t.CUSTOM_15) LIKE #{item}</foreach>)</if> "
+ "<if test='custom16In != null'>AND t.CUSTOM_16 IN(<foreach item='item' collection='custom16In' separator=',' >#{item}</foreach>)</if> "
+ "<if test='custom16Like != null'>AND (<foreach item='item' collection='custom16Like' separator=' OR '>UPPER(t.CUSTOM_16) LIKE #{item}</foreach>)</if> "
+ "<if test='attachmentClassificationKeyIn != null'>AND a.CLASSIFICATION_KEY IN(<foreach item='item' collection='attachmentClassificationKeyIn' separator=',' >#{item}</foreach>)</if> "
+ "<if test='attachmentClassificationKeyLike != null'>AND (<foreach item='item' collection='attachmentClassificationKeyLike' separator=' OR '>UPPER(a.CLASSIFICATION_KEY) LIKE #{item}</foreach>)</if> "
+ "<if test='attachmentClassificationIdIn != null'>AND a.CLASSIFICATION_ID IN(<foreach item='item' collection='attachmentClassificationIdIn' separator=',' >#{item}</foreach>)</if> "
+ "<if test='attachmentClassificationIdLike != null'>AND (<foreach item='item' collection='attachmentclassificationIdLike' separator=' OR '>UPPER(a.CLASSIFICATION_ID) LIKE #{item}</foreach>)</if> "
+ "<if test='attachmentChannelIn != null'>AND a.CHANNEL IN(<foreach item='item' collection='attachmentChannelIn' separator=',' >#{item}</foreach>)</if> "
+ "<if test='attachmentChannelLike != null'>AND (<foreach item='item' collection='attachmentChannelLike' separator=' OR '>UPPER(a.CHANNEL) LIKE #{item}</foreach>)</if> "
+ "<if test='attachmentReferenceIn != null'>AND a.REF_VALUE IN(<foreach item='item' collection='attachmentReferenceIn' separator=',' >#{item}</foreach>)</if> "
+ "<if test='attachmentReferenceLike != null'>AND (<foreach item='item' collection='attachmentReferenceLike' separator=' OR '>UPPER(a.REF_VALUE) LIKE #{item}</foreach>)</if> "
+ "<if test='attachmentReceivedIn !=null'> AND ( <foreach item='item' collection='attachmentReceivedIn' separator=' OR ' > ( <if test='item.begin!=null'> a.RECEIVED &gt;= #{item.begin} </if> <if test='item.begin!=null and item.end!=null'> AND </if><if test='item.end!=null'> a.RECEIVED &lt;=#{item.end} </if>)</foreach>)</if> "
+ "</where>"
+ "</otherwise>"
+ "</choose>"
@ -821,7 +958,7 @@ public interface QueryMapper {
Long countQueryWorkbasketAccessItems(WorkbasketAccessItemQueryImpl accessItem);
@Select("<script>SELECT DISTINCT ${columnName} "
+ "FROM TASK t "
+ "FROM TASK t LEFT JOIN ATTACHMENT AS a ON t.ID = a.TASK_ID "
+ "<where>"
+ "<if test='!orderBy.isEmpty()'>${columnName} IS NOT NULL</if> "
+ "<if test='accessIdIn != null'> "
@ -903,8 +1040,41 @@ public interface QueryMapper {
+ "<if test='custom15Like != null'>AND (<foreach item='item' collection='custom15Like' separator=' OR '>UPPER(t.CUSTOM_15) LIKE #{item}</foreach>)</if> "
+ "<if test='custom16In != null'>AND t.CUSTOM_16 IN(<foreach item='item' collection='custom16In' separator=',' >#{item}</foreach>)</if> "
+ "<if test='custom16Like != null'>AND (<foreach item='item' collection='custom16Like' separator=' OR '>UPPER(t.CUSTOM_16) LIKE #{item}</foreach>)</if> "
+ "<if test='attachmentClassificationKeyIn != null'>AND a.CLASSIFICATION_KEY IN(<foreach item='item' collection='attachmentClassificationKeyIn' separator=',' >#{item}</foreach>)</if> "
+ "<if test='attachmentClassificationKeyLike != null'>AND (<foreach item='item' collection='attachmentClassificationKeyLike' separator=' OR '>UPPER(a.CLASSIFICATION_KEY) LIKE #{item}</foreach>)</if> "
+ "<if test='attachmentClassificationIdIn != null'>AND a.CLASSIFICATION_ID IN(<foreach item='item' collection='attachmentClassificationIdIn' separator=',' >#{item}</foreach>)</if> "
+ "<if test='attachmentClassificationIdLike != null'>AND (<foreach item='item' collection='attachmentclassificationIdLike' separator=' OR '>UPPER(a.CLASSIFICATION_ID) LIKE #{item}</foreach>)</if> "
+ "<if test='attachmentChannelIn != null'>AND a.CHANNEL IN(<foreach item='item' collection='attachmentChannelIn' separator=',' >#{item}</foreach>)</if> "
+ "<if test='attachmentChannelLike != null'>AND (<foreach item='item' collection='attachmentChannelLike' separator=' OR '>UPPER(a.CHANNEL) LIKE #{item}</foreach>)</if> "
+ "<if test='attachmentReferenceIn != null'>AND a.REF_VALUE IN(<foreach item='item' collection='attachmentReferenceIn' separator=',' >#{item}</foreach>)</if> "
+ "<if test='attachmentReferenceLike != null'>AND (<foreach item='item' collection='attachmentReferenceLike' separator=' OR '>UPPER(a.REF_VALUE) LIKE #{item}</foreach>)</if> "
+ "<if test='attachmentReceivedIn !=null'> AND ( <foreach item='item' collection='attachmentReceivedIn' separator=' OR ' > ( <if test='item.begin!=null'> a.RECEIVED &gt;= #{item.begin} </if> <if test='item.begin!=null and item.end!=null'> AND </if><if test='item.end!=null'> a.RECEIVED &lt;=#{item.end} </if>)</foreach>)</if> "
+ "</where>"
+ "<if test='!orderBy.isEmpty()'>ORDER BY <foreach item='item' collection='orderBy' separator=',' >${item}</foreach></if> "
+ "<if test='!orderBy.isEmpty()'>ORDER BY <foreach item='item' collection='orderBy' separator=',' >"
+ "<choose>"
+ "<when test=\"item.contains('TCLASSIFICATION_KEY ASC')\">"
+ "t.CLASSIFICATION_KEY ASC"
+ "</when>"
+ "<when test=\"item.contains('TCLASSIFICATION_KEY DESC')\">"
+ "t.CLASSIFICATION_KEY DESC"
+ "</when>"
+ "<when test=\"item.contains('ACLASSIFICATION_KEY ASC')\">"
+ "a.CLASSIFICATION_KEY ASC"
+ "</when>"
+ "<when test=\"item.contains('ACLASSIFICATION_KEY DESC')\">"
+ "a.CLASSIFICATION_KEY DESC"
+ "</when>"
+ "<when test=\"item.contains('ACLASSIFICATION_ID ASC')\">"
+ "a.CLASSIFICATION_ID ASC"
+ "</when>"
+ "<when test=\"item.contains('ACLASSIFICATION_ID DESC')\">"
+ "a.CLASSIFICATION_ID DESC"
+ "</when>"
+ "<otherwise>"
+ "${item}"
+ "</otherwise>"
+ "</choose>"
+ "</foreach></if> "
+ "<if test=\"_databaseId == 'db2'\">with UR </if> "
+ "</script>")
List<String> queryTaskColumnValues(TaskQueryImpl taskQuery);
@ -1006,7 +1176,6 @@ public interface QueryMapper {
+ "<if test='custom1In != null'>AND w.CUSTOM_1 IN(<foreach item='item' collection='custom1In' separator=',' >#{item}</foreach>)</if> "
+ "<if test='custom1Like != null'>AND (<foreach item='item' collection='custom1Like' separator=' OR ' >UPPER(w.CUSTOM_1) LIKE #{item}</foreach>)</if> "
+ "<if test='custom2In != null'>AND w.CUSTOM_2 IN(<foreach item='item' collection='custom2In' separator=',' >#{item}</foreach>)</if> "
+ "<if test='custom2Like != null'>AND (<foreach item='item' collection='custom2Like' separator=' OR ' >UPPER(w.CUSTOM_2) LIKE #{item}</foreach>)</if> "
+ "<if test='custom3In != null'>AND w.CUSTOM_3 IN(<foreach item='item' collection='custom3In' separator=',' >#{item}</foreach>)</if> "
+ "<if test='custom3Like != null'>AND (<foreach item='item' collection='custom3Like' separator=' OR ' >UPPER(w.CUSTOM_3) LIKE #{item}</foreach>)</if> "
+ "<if test='custom4In != null'>AND w.CUSTOM_4 IN(<foreach item='item' collection='custom4In' separator=',' >#{item}</foreach>)</if> "

View File

@ -23,6 +23,7 @@ import pro.taskana.Task;
import pro.taskana.TaskQuery;
import pro.taskana.TaskService;
import pro.taskana.TaskSummary;
import pro.taskana.TimeInterval;
import pro.taskana.exceptions.AttachmentPersistenceException;
import pro.taskana.exceptions.ClassificationNotFoundException;
import pro.taskana.exceptions.ConcurrencyException;
@ -70,6 +71,37 @@ public class QueryTasksAccTest extends AbstractAccTest {
assertEquals(3, columnValueList.size());
}
@WithAccessId(
userName = "teamlead_1",
groupNames = {"admin"})
@Test
public void testQueryTaskValuesForColumnNameOnAttachments() {
TaskService taskService = taskanaEngine.getTaskService();
List<String> columnValueList = taskService.createTaskQuery()
.attachmentReferenceValueIn("val4")
.listValues("CHANNEL", null);
assertNotNull(columnValueList);
assertEquals(2, columnValueList.size());
columnValueList = taskService.createTaskQuery()
.listValues("REF_VALUE", null);
assertNotNull(columnValueList);
assertEquals(6, columnValueList.size());
columnValueList = taskService.createTaskQuery()
.orderByAttachmentClassificationId(desc)
.listValues("a.CLASSIFICATION_ID", null);
assertNotNull(columnValueList);
assertEquals(11, columnValueList.size());
columnValueList = taskService.createTaskQuery()
.orderByClassificationKey(desc)
.listValues("t.CLASSIFICATION_KEY", null);
assertNotNull(columnValueList);
assertEquals(7, columnValueList.size());
}
@WithAccessId(
userName = "teamlead_1",
groupNames = {"group_1", "group_2"})
@ -166,8 +198,8 @@ public class QueryTasksAccTest extends AbstractAccTest {
assertThat(result3.size(), equalTo(70));
List<TaskSummary> result4 = taskService.createTaskQuery()
.classificationKeyNotIn("L1050", "L1060", "T2100")
.list();
.classificationKeyNotIn("L1050", "L1060", "T2100")
.list();
assertThat(result4.size(), equalTo(6));
}
@ -561,8 +593,8 @@ public class QueryTasksAccTest extends AbstractAccTest {
TaskService taskService = taskanaEngine.getTaskService();
List<TaskSummary> results = taskService.createTaskQuery()
.customAttributeLike("11", "%")
.list();
.customAttributeLike("11", "%")
.list();
assertThat(results.size(), equalTo(3));
String[] ids = results.stream()
@ -577,8 +609,8 @@ public class QueryTasksAccTest extends AbstractAccTest {
.collect(Collectors.toList())
.toArray(new String[0]);
List<TaskSummary> results2 = taskService.createTaskQuery()
.customAttributeIn("11", ids)
.list();
.customAttributeIn("11", ids)
.list();
assertThat(results2.size(), equalTo(3));
}
@ -591,8 +623,8 @@ public class QueryTasksAccTest extends AbstractAccTest {
TaskService taskService = taskanaEngine.getTaskService();
List<TaskSummary> results = taskService.createTaskQuery()
.customAttributeLike("12", "%")
.list();
.customAttributeLike("12", "%")
.list();
assertThat(results.size(), equalTo(3));
String[] ids = results.stream()
@ -607,8 +639,8 @@ public class QueryTasksAccTest extends AbstractAccTest {
.collect(Collectors.toList())
.toArray(new String[0]);
List<TaskSummary> results2 = taskService.createTaskQuery()
.customAttributeIn("12", ids)
.list();
.customAttributeIn("12", ids)
.list();
assertThat(results2.size(), equalTo(3));
}
@ -621,8 +653,8 @@ public class QueryTasksAccTest extends AbstractAccTest {
TaskService taskService = taskanaEngine.getTaskService();
List<TaskSummary> results = taskService.createTaskQuery()
.customAttributeLike("13", "%")
.list();
.customAttributeLike("13", "%")
.list();
assertThat(results.size(), equalTo(3));
String[] ids = results.stream()
@ -637,8 +669,8 @@ public class QueryTasksAccTest extends AbstractAccTest {
.collect(Collectors.toList())
.toArray(new String[0]);
List<TaskSummary> results2 = taskService.createTaskQuery()
.customAttributeIn("13", ids)
.list();
.customAttributeIn("13", ids)
.list();
assertThat(results2.size(), equalTo(3));
}
@ -651,8 +683,8 @@ public class QueryTasksAccTest extends AbstractAccTest {
TaskService taskService = taskanaEngine.getTaskService();
List<TaskSummary> results = taskService.createTaskQuery()
.customAttributeLike("14", "%")
.list();
.customAttributeLike("14", "%")
.list();
assertThat(results.size(), equalTo(47));
String[] ids = results.stream()
@ -667,8 +699,8 @@ public class QueryTasksAccTest extends AbstractAccTest {
.collect(Collectors.toList())
.toArray(new String[0]);
List<TaskSummary> results2 = taskService.createTaskQuery()
.customAttributeIn("14", ids)
.list();
.customAttributeIn("14", ids)
.list();
assertThat(results2.size(), equalTo(47));
}
@ -681,8 +713,8 @@ public class QueryTasksAccTest extends AbstractAccTest {
TaskService taskService = taskanaEngine.getTaskService();
List<TaskSummary> results = taskService.createTaskQuery()
.customAttributeLike("15", "%")
.list();
.customAttributeLike("15", "%")
.list();
assertThat(results.size(), equalTo(3));
String[] ids = results.stream()
@ -697,8 +729,8 @@ public class QueryTasksAccTest extends AbstractAccTest {
.collect(Collectors.toList())
.toArray(new String[0]);
List<TaskSummary> results2 = taskService.createTaskQuery()
.customAttributeIn("15", ids)
.list();
.customAttributeIn("15", ids)
.list();
assertThat(results2.size(), equalTo(3));
}
@ -711,8 +743,8 @@ public class QueryTasksAccTest extends AbstractAccTest {
TaskService taskService = taskanaEngine.getTaskService();
List<TaskSummary> results = taskService.createTaskQuery()
.customAttributeLike("16", "%")
.list();
.customAttributeLike("16", "%")
.list();
assertThat(results.size(), equalTo(3));
String[] ids = results.stream()
@ -727,8 +759,8 @@ public class QueryTasksAccTest extends AbstractAccTest {
.collect(Collectors.toList())
.toArray(new String[0]);
List<TaskSummary> results2 = taskService.createTaskQuery()
.customAttributeIn("16", ids)
.list();
.customAttributeIn("16", ids)
.list();
assertThat(results2.size(), equalTo(3));
}
@ -823,8 +855,8 @@ public class QueryTasksAccTest extends AbstractAccTest {
public void testQueryForCreatorIn() {
TaskService taskService = taskanaEngine.getTaskService();
List<TaskSummary> results = taskService.createTaskQuery()
.creatorIn("creator_user_id2", "creator_user_id3")
.list();
.creatorIn("creator_user_id2", "creator_user_id3")
.list();
assertEquals(4, results.size());
}
@ -834,8 +866,8 @@ public class QueryTasksAccTest extends AbstractAccTest {
public void testQueryForCreatorLike() {
TaskService taskService = taskanaEngine.getTaskService();
List<TaskSummary> results = taskService.createTaskQuery()
.creatorLike("ersTeLlEr%")
.list();
.creatorLike("ersTeLlEr%")
.list();
assertEquals(3, results.size());
}
@ -845,8 +877,8 @@ public class QueryTasksAccTest extends AbstractAccTest {
public void testQueryForNoteLike() {
TaskService taskService = taskanaEngine.getTaskService();
List<TaskSummary> results = taskService.createTaskQuery()
.noteLike("Some%")
.list();
.noteLike("Some%")
.list();
assertEquals(6, results.size());
}
@ -856,8 +888,8 @@ public class QueryTasksAccTest extends AbstractAccTest {
public void testQueryForClassificationCategoryIn() {
TaskService taskService = taskanaEngine.getTaskService();
List<TaskSummary> results = taskService.createTaskQuery()
.classificationCategoryIn("MANUAL", "AUTOMATIC")
.list();
.classificationCategoryIn("MANUAL", "AUTOMATIC")
.list();
assertEquals(4, results.size());
}
@ -867,8 +899,8 @@ public class QueryTasksAccTest extends AbstractAccTest {
public void testQueryForClassificationCategoryLike() {
TaskService taskService = taskanaEngine.getTaskService();
List<TaskSummary> results = taskService.createTaskQuery()
.classificationCategoryLike("AUTO%")
.list();
.classificationCategoryLike("AUTO%")
.list();
assertEquals(1, results.size());
}
@ -878,8 +910,8 @@ public class QueryTasksAccTest extends AbstractAccTest {
public void testQueryForPrimaryObjectReferenceCompanyLike() {
TaskService taskService = taskanaEngine.getTaskService();
List<TaskSummary> results = taskService.createTaskQuery()
.primaryObjectReferenceCompanyLike("My%")
.list();
.primaryObjectReferenceCompanyLike("My%")
.list();
assertEquals(6, results.size());
}
@ -889,8 +921,8 @@ public class QueryTasksAccTest extends AbstractAccTest {
public void testQueryForPrimaryObjectReferenceSystemLike() {
TaskService taskService = taskanaEngine.getTaskService();
List<TaskSummary> results = taskService.createTaskQuery()
.primaryObjectReferenceSystemLike("My%")
.list();
.primaryObjectReferenceSystemLike("My%")
.list();
assertEquals(6, results.size());
}
@ -900,8 +932,8 @@ public class QueryTasksAccTest extends AbstractAccTest {
public void testQueryForPrimaryObjectReferenceSystemInstanceLike() {
TaskService taskService = taskanaEngine.getTaskService();
List<TaskSummary> results = taskService.createTaskQuery()
.primaryObjectReferenceSystemInstanceLike("My%")
.list();
.primaryObjectReferenceSystemInstanceLike("My%")
.list();
assertEquals(6, results.size());
}
@ -911,8 +943,8 @@ public class QueryTasksAccTest extends AbstractAccTest {
public void testQueryForPrimaryObjectReferenceTypeLike() {
TaskService taskService = taskanaEngine.getTaskService();
List<TaskSummary> results = taskService.createTaskQuery()
.primaryObjectReferenceTypeLike("My%")
.list();
.primaryObjectReferenceTypeLike("My%")
.list();
assertEquals(6, results.size());
}
@ -922,8 +954,8 @@ public class QueryTasksAccTest extends AbstractAccTest {
public void testQueryForReadEquals() {
TaskService taskService = taskanaEngine.getTaskService();
List<TaskSummary> results = taskService.createTaskQuery()
.readEquals(true)
.list();
.readEquals(true)
.list();
assertEquals(25, results.size());
}
@ -933,8 +965,8 @@ public class QueryTasksAccTest extends AbstractAccTest {
public void testQueryForTransferredEquals() {
TaskService taskService = taskanaEngine.getTaskService();
List<TaskSummary> results = taskService.createTaskQuery()
.transferredEquals(true)
.list();
.transferredEquals(true)
.list();
assertEquals(2, results.size());
}
@ -944,8 +976,8 @@ public class QueryTasksAccTest extends AbstractAccTest {
public void testQueryForBusinessProcessIdIn() {
TaskService taskService = taskanaEngine.getTaskService();
List<TaskSummary> results = taskService.createTaskQuery()
.businessProcessIdIn("PI_0000000000003", "BPI21")
.list();
.businessProcessIdIn("PI_0000000000003", "BPI21")
.list();
assertEquals(8, results.size());
}
@ -955,19 +987,98 @@ public class QueryTasksAccTest extends AbstractAccTest {
public void testQueryForBusinessProcessIdLike() {
TaskService taskService = taskanaEngine.getTaskService();
List<TaskSummary> results = taskService.createTaskQuery()
.businessProcessIdLike("pI_%")
.list();
.businessProcessIdLike("pI_%")
.list();
assertEquals(66, results.size());
}
@WithAccessId(
userName = "admin")
@Test
public void testQueryForAttachmentClassificationKeyIn() {
TaskService taskService = taskanaEngine.getTaskService();
List<TaskSummary> results = taskService.createTaskQuery()
.attachmentClassificationKeyIn("L110102")
.list();
assertEquals(1, results.size());
assertEquals("TKI:000000000000000000000000000000000002",
results.get(0).getTaskId());
}
@WithAccessId(
userName = "admin")
@Test
public void testQueryForAttachmentClassificationKeyLike() {
TaskService taskService = taskanaEngine.getTaskService();
List<TaskSummary> results = taskService.createTaskQuery()
.attachmentClassificationKeyLike("%10102")
.list();
assertEquals(1, results.size());
assertEquals("TKI:000000000000000000000000000000000002",
results.get(0).getTaskId());
}
@WithAccessId(
userName = "admin")
@Test
public void testQueryForAttachmentclassificationIdIn() {
TaskService taskService = taskanaEngine.getTaskService();
List<TaskSummary> results = taskService.createTaskQuery()
.attachmentClassificationIdIn("CLI:000000000000000000000000000000000002")
.list();
assertEquals(1, results.size());
assertEquals("TKI:000000000000000000000000000000000001",
results.get(0).getTaskId());
}
@WithAccessId(
userName = "admin")
@Test
public void testQueryForAttachmentChannelLike() {
TaskService taskService = taskanaEngine.getTaskService();
List<TaskSummary> results = taskService.createTaskQuery()
.attachmentChannelLike("%6")
.list();
assertEquals(2, results.size());
}
@WithAccessId(
userName = "admin")
@Test
public void testQueryForAttachmentReferenceIn() {
TaskService taskService = taskanaEngine.getTaskService();
List<TaskSummary> results = taskService.createTaskQuery()
.attachmentReferenceValueIn("val4")
.list();
assertEquals(6, results.size());
assertEquals(1, results.get(5).getAttachmentSummaries().size());
}
@WithAccessId(
userName = "admin")
@Test
public void testQueryForAttachmentReceivedIn() {
TaskService taskService = taskanaEngine.getTaskService();
TimeInterval interval = new TimeInterval(
getInstant("2018-01-30T12:00:00"),
getInstant("2018-01-31T12:00:00"));
List<TaskSummary> results = taskService.createTaskQuery()
.attachmentReceivedWithin(interval)
.orderByWorkbasketId(desc)
.list();
assertEquals(2, results.size());
assertEquals("TKI:000000000000000000000000000000000001", results.get(0).getTaskId());
assertEquals("TKI:000000000000000000000000000000000011", results.get(1).getTaskId());
}
@WithAccessId(
userName = "admin")
@Test
public void testQueryForOrderByCreatorDesc() {
TaskService taskService = taskanaEngine.getTaskService();
List<TaskSummary> results = taskService.createTaskQuery()
.orderByCreator(desc)
.list();
.orderByCreator(desc)
.list();
assertEquals("user_1_1", results.get(0).getCreator());
}
@ -977,10 +1088,10 @@ public class QueryTasksAccTest extends AbstractAccTest {
public void testQueryForOrderByWorkbasketIdDesc() {
TaskService taskService = taskanaEngine.getTaskService();
List<TaskSummary> results = taskService.createTaskQuery()
.orderByWorkbasketId(desc)
.list();
.orderByWorkbasketId(desc)
.list();
assertEquals("WBI:100000000000000000000000000000000015",
results.get(0).getWorkbasketSummary().getId());
results.get(0).getWorkbasketSummary().getId());
}
@WithAccessId(
@ -989,8 +1100,8 @@ public class QueryTasksAccTest extends AbstractAccTest {
public void testQueryForOrderByCustom1Asc() throws InvalidArgumentException {
TaskService taskService = taskanaEngine.getTaskService();
List<TaskSummary> results = taskService.createTaskQuery()
.orderByCustomAttribute("1", asc)
.list();
.orderByCustomAttribute("1", asc)
.list();
assertEquals("custom1", results.get(0).getCustomAttribute("1"));
}
@ -1000,8 +1111,8 @@ public class QueryTasksAccTest extends AbstractAccTest {
public void testQueryForOrderByCustom2Desc() throws InvalidArgumentException {
TaskService taskService = taskanaEngine.getTaskService();
List<TaskSummary> results = taskService.createTaskQuery()
.orderByCustomAttribute("2", desc)
.list();
.orderByCustomAttribute("2", desc)
.list();
assertEquals("custom2", results.get(0).getCustomAttribute("2"));
}
@ -1011,8 +1122,8 @@ public class QueryTasksAccTest extends AbstractAccTest {
public void testQueryForOrderByCustom3Asc() throws InvalidArgumentException {
TaskService taskService = taskanaEngine.getTaskService();
List<TaskSummary> results = taskService.createTaskQuery()
.orderByCustomAttribute("3", asc)
.list();
.orderByCustomAttribute("3", asc)
.list();
assertEquals("custom3", results.get(0).getCustomAttribute("3"));
}
@ -1022,19 +1133,19 @@ public class QueryTasksAccTest extends AbstractAccTest {
public void testQueryForOrderByCustom4Desc() throws InvalidArgumentException {
TaskService taskService = taskanaEngine.getTaskService();
List<TaskSummary> results = taskService.createTaskQuery()
.orderByCustomAttribute("4", desc)
.list();
.orderByCustomAttribute("4", desc)
.list();
assertEquals("rty", results.get(0).getCustomAttribute("4"));
}
@WithAccessId(
userName = "admin")
@Test
public void testQueryForOrderByCustom5Asc() throws InvalidArgumentException {
public void testQueryForOrderByCustom5Asc() throws InvalidArgumentException {
TaskService taskService = taskanaEngine.getTaskService();
List<TaskSummary> results = taskService.createTaskQuery()
.orderByCustomAttribute("5", asc)
.list();
.orderByCustomAttribute("5", asc)
.list();
assertEquals("al", results.get(0).getCustomAttribute("5"));
}
@ -1044,30 +1155,30 @@ public class QueryTasksAccTest extends AbstractAccTest {
public void testQueryForOrderByCustom6Desc() throws InvalidArgumentException {
TaskService taskService = taskanaEngine.getTaskService();
List<TaskSummary> results = taskService.createTaskQuery()
.orderByCustomAttribute("6", desc)
.list();
.orderByCustomAttribute("6", desc)
.list();
assertEquals("vvg", results.get(0).getCustomAttribute("6"));
}
@WithAccessId(
userName = "admin")
@Test
public void testQueryForOrderByCustom7Asc() throws InvalidArgumentException {
public void testQueryForOrderByCustom7Asc() throws InvalidArgumentException {
TaskService taskService = taskanaEngine.getTaskService();
List<TaskSummary> results = taskService.createTaskQuery()
.orderByCustomAttribute("7", asc)
.list();
.orderByCustomAttribute("7", asc)
.list();
assertEquals("custom7", results.get(0).getCustomAttribute("7"));
}
@WithAccessId(
userName = "admin")
userName = "admin")
@Test
public void testQueryForOrderByCustom8Desc() throws InvalidArgumentException {
public void testQueryForOrderByCustom8Desc() throws InvalidArgumentException {
TaskService taskService = taskanaEngine.getTaskService();
List<TaskSummary> results = taskService.createTaskQuery()
.orderByCustomAttribute("8", desc)
.list();
.orderByCustomAttribute("8", desc)
.list();
assertEquals("lnp", results.get(0).getCustomAttribute("8"));
}
@ -1077,96 +1188,213 @@ public class QueryTasksAccTest extends AbstractAccTest {
public void testQueryForOrderByCustom9Asc() throws InvalidArgumentException {
TaskService taskService = taskanaEngine.getTaskService();
List<TaskSummary> results = taskService.createTaskQuery()
.orderByCustomAttribute("9", asc)
.list();
.orderByCustomAttribute("9", asc)
.list();
assertEquals("bbq", results.get(0).getCustomAttribute("9"));
}
@WithAccessId(
userName = "admin")
userName = "admin")
@Test
public void testQueryForOrderByCustom10Desc() throws InvalidArgumentException {
TaskService taskService = taskanaEngine.getTaskService();
List<TaskSummary> results = taskService.createTaskQuery()
.orderByCustomAttribute("10", desc)
.list();
.orderByCustomAttribute("10", desc)
.list();
assertEquals("ert", results.get(0).getCustomAttribute("10"));
}
@WithAccessId(
userName = "admin")
userName = "admin")
@Test
public void testQueryForOrderByCustom11Desc() throws InvalidArgumentException {
TaskService taskService = taskanaEngine.getTaskService();
List<TaskSummary> results = taskService.createTaskQuery()
.orderByCustomAttribute("11", desc)
.list();
.orderByCustomAttribute("11", desc)
.list();
assertEquals("ert", results.get(0).getCustomAttribute("11"));
}
@WithAccessId(
userName = "admin")
userName = "admin")
@Test
public void testQueryForOrderByCustom12Asc() throws InvalidArgumentException {
TaskService taskService = taskanaEngine.getTaskService();
List<TaskSummary> results = taskService.createTaskQuery()
.orderByCustomAttribute("12", asc)
.list();
.orderByCustomAttribute("12", asc)
.list();
assertEquals("custom12", results.get(0).getCustomAttribute("12"));
}
@WithAccessId(
userName = "admin")
userName = "admin")
@Test
public void testQueryForOrderByCustom13Desc() throws InvalidArgumentException {
TaskService taskService = taskanaEngine.getTaskService();
List<TaskSummary> results = taskService.createTaskQuery()
.orderByCustomAttribute("13", desc)
.list();
.orderByCustomAttribute("13", desc)
.list();
assertEquals("ert", results.get(0).getCustomAttribute("13"));
}
@WithAccessId(
userName = "admin")
userName = "admin")
@Test
public void testQueryForOrderByCustom14Asc() throws InvalidArgumentException {
TaskService taskService = taskanaEngine.getTaskService();
List<TaskSummary> results = taskService.createTaskQuery()
.orderByCustomAttribute("14", asc)
.list();
.orderByCustomAttribute("14", asc)
.list();
assertEquals("abc", results.get(0).getCustomAttribute("14"));
}
@WithAccessId(
userName = "admin")
userName = "admin")
@Test
public void testQueryForOrderByCustom15Desc() throws InvalidArgumentException {
TaskService taskService = taskanaEngine.getTaskService();
List<TaskSummary> results = taskService.createTaskQuery()
.orderByCustomAttribute("15", desc)
.list();
.orderByCustomAttribute("15", desc)
.list();
assertEquals("ert", results.get(0).getCustomAttribute("15"));
}
@WithAccessId(
userName = "admin")
userName = "admin")
@Test
public void testQueryForOrderByCustom16Asc() throws InvalidArgumentException {
TaskService taskService = taskanaEngine.getTaskService();
List<TaskSummary> results = taskService.createTaskQuery()
.orderByCustomAttribute("16", asc)
.list();
.orderByCustomAttribute("16", asc)
.list();
assertEquals("custom16", results.get(0).getCustomAttribute("16"));
}
@WithAccessId(
userName = "admin")
userName = "admin")
@Test
public void testQueryForOrderWithDirectionNull() {
TaskService taskService = taskanaEngine.getTaskService();
List<TaskSummary> results = taskService.createTaskQuery()
.orderByPrimaryObjectReferenceSystemInstance(null)
.list();
.orderByPrimaryObjectReferenceSystemInstance(null)
.list();
assertEquals("00", results.get(0).getPrimaryObjRef().getSystemInstance());
}
@WithAccessId(
userName = "admin")
@Test
public void testQueryForOrderByAttachmentClassificationIdAsc() {
TaskService taskService = taskanaEngine.getTaskService();
List<TaskSummary> results = taskService.createTaskQuery()
.idIn("TKI:000000000000000000000000000000000010", "TKI:000000000000000000000000000000000011",
"TKI:000000000000000000000000000000000012")
.orderByAttachmentClassificationId(asc)
.list();
assertEquals("TKI:000000000000000000000000000000000011", results.get(0).getTaskId());
assertEquals("TKI:000000000000000000000000000000000010", results.get(results.size() - 1).getTaskId());
}
@WithAccessId(
userName = "admin")
@Test
public void testQueryForOrderByAttachmentClassificationIdDesc() {
TaskService taskService = taskanaEngine.getTaskService();
List<TaskSummary> results = taskService.createTaskQuery()
.idIn("TKI:000000000000000000000000000000000010", "TKI:000000000000000000000000000000000011",
"TKI:000000000000000000000000000000000012")
.orderByAttachmentClassificationId(desc)
.list();
assertEquals("TKI:000000000000000000000000000000000010", results.get(0).getTaskId());
assertEquals("TKI:000000000000000000000000000000000011", results.get(results.size() - 1).getTaskId());
}
@WithAccessId(
userName = "admin")
@Test
public void testQueryForOrderByAttachmentClassificationKeyAsc() {
TaskService taskService = taskanaEngine.getTaskService();
List<TaskSummary> results = taskService.createTaskQuery()
.idIn("TKI:000000000000000000000000000000000010", "TKI:000000000000000000000000000000000011",
"TKI:000000000000000000000000000000000012")
.orderByAttachmentClassificationKey(asc)
.list();
assertEquals("TKI:000000000000000000000000000000000010", results.get(0).getTaskId());
assertEquals("TKI:000000000000000000000000000000000012", results.get(results.size() - 1).getTaskId());
}
@WithAccessId(
userName = "admin")
@Test
public void testQueryForOrderByAttachmentClassificationKeyDesc() {
TaskService taskService = taskanaEngine.getTaskService();
List<TaskSummary> results = taskService.createTaskQuery()
.idIn("TKI:000000000000000000000000000000000010", "TKI:000000000000000000000000000000000011",
"TKI:000000000000000000000000000000000012")
.orderByAttachmentClassificationKey(desc)
.list();
assertEquals("TKI:000000000000000000000000000000000012", results.get(0).getTaskId());
assertEquals("TKI:000000000000000000000000000000000010", results.get(results.size() - 1).getTaskId());
}
@WithAccessId(
userName = "admin")
@Test
public void testQueryForOrderByAttachmentRefValueDesc() {
TaskService taskService = taskanaEngine.getTaskService();
List<TaskSummary> results = taskService.createTaskQuery()
.idIn("TKI:000000000000000000000000000000000010", "TKI:000000000000000000000000000000000011",
"TKI:000000000000000000000000000000000012")
.orderByAttachmentReference(desc)
.list();
assertEquals("TKI:000000000000000000000000000000000012", results.get(0).getTaskId());
assertEquals("TKI:000000000000000000000000000000000010", results.get(results.size() - 1).getTaskId());
}
@WithAccessId(
userName = "admin")
@Test
public void testQueryForOrderByAttachmentChannelAscAndReferenceDesc() {
TaskService taskService = taskanaEngine.getTaskService();
List<TaskSummary> results = taskService.createTaskQuery()
.idIn("TKI:000000000000000000000000000000000010", "TKI:000000000000000000000000000000000011",
"TKI:000000000000000000000000000000000012")
.orderByAttachmentChannel(asc)
.orderByAttachmentReference(desc)
.list();
assertEquals("TKI:000000000000000000000000000000000012", results.get(0).getTaskId());
assertEquals("TKI:000000000000000000000000000000000010", results.get(results.size() - 1).getTaskId());
}
@WithAccessId(
userName = "admin")
@Test
public void testQueryForAttachmentLikeCHAndOrderByClassificationKeyDescAndAsc() {
TaskService taskService = taskanaEngine.getTaskService();
List<TaskSummary> results = taskService.createTaskQuery()
.attachmentChannelLike("CH%")
.orderByClassificationKey(desc)
.list();
assertEquals("T2000", results.get(0).getClassificationSummary().getKey());
assertEquals("L1050", results.get(results.size() - 1).getClassificationSummary().getKey());
results = taskService.createTaskQuery()
.attachmentChannelLike("CH%")
.orderByClassificationKey(asc)
.list();
assertEquals("L1050", results.get(0).getClassificationSummary().getKey());
assertEquals("T2000", results.get(results.size() - 1).getClassificationSummary().getKey());
}
}

View File

@ -181,4 +181,16 @@ public class QueryTasksWithPaginationAccTest extends AbstractAccTest {
assertThat(count, equalTo(22L));
}
@WithAccessId(
userName = "teamlead_1",
groupNames = {"group_1"})
@Test
public void testCountOfTaskQueryWithAttachmentChannelFilter() {
TaskService taskService = taskanaEngine.getTaskService();
long count = taskService.createTaskQuery()
.attachmentChannelIn("ch6")
.count();
assertThat(count, equalTo(2L));
}
}

View File

@ -7,7 +7,9 @@ import static org.mockito.Mockito.when;
import java.util.ArrayList;
import java.util.List;
import org.apache.ibatis.session.Configuration;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionManager;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
@ -36,6 +38,9 @@ public class TaskQueryImplTest {
@Mock
private SqlSession sqlSession;
@Mock
private SqlSessionManager sqlSessionManager;
@Mock
ClassificationServiceImpl classificationService;
@ -45,6 +50,12 @@ public class TaskQueryImplTest {
@Before
public void setup() {
when(taskanaEngine.getTaskService()).thenReturn(taskServiceMock);
Configuration configuration = new org.apache.ibatis.session.Configuration();
configuration.setDatabaseId("h2");
this.taskanaEngine.sessionManager = sqlSessionManager;
when(taskanaEngine.sessionManager.getConfiguration()).thenReturn(configuration);
taskQueryImpl = new TaskQueryImpl(taskanaEngine);
}

View File

@ -1,16 +1,19 @@
-- ATTACHMENT TABLE (ID , task_ID , CREATED , MODIFIED , classif key, classif Id , refCompany, ref sys, ref inst,ref type, ref val, channel,received, custAtts)
INSERT INTO ATTACHMENT VALUES('TAI:000000000000000000000000000000000000','TKI:000000000000000000000000000000000000', '2018-01-29 15:55:00', '2018-01-30 15:55:00', 'L1050' , 'CLI:100000000000000000000000000000000003', 'novatec' , 'novasys', 'nvinst', 'typ1', 'val1', 'ch1', null, null);
INSERT INTO ATTACHMENT VALUES('TAI:000000000000000000000000000000000001','TKI:000000000000000000000000000000000001', '2018-01-29 15:55:01', '2018-01-30 15:55:00', 'L10303' , 'CLI:000000000000000000000000000000000002', 'novatec' , 'novasys', 'nvinst', 'typ1', 'val1', 'ch1', null, null);
INSERT INTO ATTACHMENT VALUES('TAI:000000000000000000000000000000000002','TKI:000000000000000000000000000000000001', '2018-01-29 15:55:02', '2018-01-30 15:55:00', 'L1050' , 'CLI:000000000000000000000000000000000003', 'novatec' , 'novasys', 'nvinst', 'typ1', 'val1', 'ch1', null, null);
INSERT INTO ATTACHMENT VALUES('TAI:000000000000000000000000000000000003','TKI:000000000000000000000000000000000002', '2018-01-29 15:55:03', null , 'L11010' , 'CLI:000000000000000000000000000000000004', 'novatec' , 'novasys', 'nvinst', 'typ1', 'val1', 'ch1', null, null);
INSERT INTO ATTACHMENT VALUES('TAI:000000000000000000000000000000000004','TKI:000000000000000000000000000000000002', '2018-01-29 15:55:04', null , 'L110102' , 'CLI:000000000000000000000000000000000005', 'novatec' , 'novasys', 'nvinst', 'typ1', 'val1', 'ch1', null, null);
INSERT INTO ATTACHMENT VALUES('TAI:000000000000000000000000000000000005','TKI:000000000000000000000000000000000002', '2018-01-29 15:55:05', null , 'L110105' , 'CLI:000000000000000000000000000000000006', 'novatec' , 'novasys', 'nvinst', 'typ1', 'val1', 'ch1', null, null);
INSERT INTO ATTACHMENT VALUES('TAI:000000000000000000000000000000000006','TKI:000000000000000000000000000000000002', '2018-01-29 15:55:06', null , 'L110107' , 'CLI:000000000000000000000000000000000007', 'novatec' , 'novasys', 'nvinst', 'typ1', 'val1', 'ch1', null, null);
INSERT INTO ATTACHMENT VALUES('TAI:000000000000000000000000000000000007','TKI:000000000000000000000000000000000002', '2018-01-29 15:55:07', null , 'L12010' , 'CLI:100000000000000000000000000000000008', 'novatec' , 'novasys', 'nvinst', 'typ1', 'val1', 'ch1', null, null);
INSERT INTO ATTACHMENT VALUES('TAI:000000000000000000000000000000000008','TKI:000000000000000000000000000000000008', '2018-01-29 15:55:08', null , 'L140101' , 'CLI:000000000000000000000000000000000009', 'novatec' , 'novasys', 'nvinst', 'typ1', 'val1', 'ch1', null, null);
INSERT INTO ATTACHMENT VALUES('TAI:000000000000000000000000000000000009','TKI:000000000000000000000000000000000000', '2018-01-29 15:55:00', '2018-01-30 15:55:00', 'L1050' , 'CLI:100000000000000000000000000000000003', 'novatec' , 'novasys', 'nvinst', 'typ1', 'val1', 'ch1', null, null);
INSERT INTO ATTACHMENT VALUES('TAI:000000000000000000000000000000000010','TKI:000000000000000000000000000000000053', '2018-01-29 15:55:00', '2018-01-30 15:55:00', 'L1050' , 'CLI:100000000000000000000000000000000003', 'novatec' , 'novasys', 'nvinst', 'typ1', 'val1', 'ch1', null, null);
INSERT INTO ATTACHMENT VALUES('TAI:000000000000000000000000000000000011','TKI:000000000000000000000000000000000053', '2018-01-29 15:55:00', '2018-01-30 15:55:00', 'L1050' , 'CLI:100000000000000000000000000000000003', 'novatec' , 'novasys', 'nvinst', 'typ1', 'val1', 'ch1', null, null);
INSERT INTO ATTACHMENT VALUES('TAI:000000000000000000000000000000000012','TKI:000000000000000000000000000000000054', '2018-01-29 15:55:00', '2018-01-30 15:55:00', 'L1050' , 'CLI:100000000000000000000000000000000003', 'novatec' , 'novasys', 'nvinst', 'typ1', 'val1', 'ch1', null, null);
INSERT INTO ATTACHMENT VALUES('TAI:000000000000000000000000000000000013','TKI:000000000000000000000000000000000055', '2018-01-29 15:55:00', '2018-01-30 15:55:00', 'L1050' , 'CLI:100000000000000000000000000000000003', 'novatec' , 'novasys', 'nvinst', 'typ1', 'val1', 'ch1', null, null);
INSERT INTO ATTACHMENT VALUES('TAI:000000000000000000000000000000000001','TKI:000000000000000000000000000000000001', '2018-01-29 15:55:01', '2018-01-30 15:55:00', 'L10303' , 'CLI:000000000000000000000000000000000002', 'novatec' , 'novasys', 'nvinst', 'typ2', 'val1', 'ch2', '2018-01-30 12:00:00', null);
INSERT INTO ATTACHMENT VALUES('TAI:000000000000000000000000000000000002','TKI:000000000000000000000000000000000001', '2018-01-29 15:55:02', '2018-01-30 15:55:00', 'L1050' , 'CLI:000000000000000000000000000000000003', 'novatec' , 'novasys', 'nvinst', 'typ2', 'val2', 'ch2', null, null);
INSERT INTO ATTACHMENT VALUES('TAI:000000000000000000000000000000000003','TKI:000000000000000000000000000000000002', '2018-01-29 15:55:03', null , 'L11010' , 'CLI:000000000000000000000000000000000004', 'novatec' , 'novasys', 'nvinst', 'typ2', 'val2', 'ch3', null, null);
INSERT INTO ATTACHMENT VALUES('TAI:000000000000000000000000000000000004','TKI:000000000000000000000000000000000002', '2018-01-29 15:55:04', null , 'L110102' , 'CLI:000000000000000000000000000000000005', 'novatec' , 'novasys', 'nvinst', 'typ3', 'val2', 'ch4', null, null);
INSERT INTO ATTACHMENT VALUES('TAI:000000000000000000000000000000000005','TKI:000000000000000000000000000000000002', '2018-01-29 15:55:05', null , 'L110105' , 'CLI:000000000000000000000000000000000006', 'novatec' , 'novasys', 'nvinst', 'typ3', 'val2', 'ch5', '2018-02-01 12:00:00', null);
INSERT INTO ATTACHMENT VALUES('TAI:000000000000000000000000000000000006','TKI:000000000000000000000000000000000002', '2018-01-29 15:55:06', null , 'L110107' , 'CLI:000000000000000000000000000000000007', 'novatec' , 'novasys', 'nvinst', 'typ3', 'val2', 'ch6', null, null);
INSERT INTO ATTACHMENT VALUES('TAI:000000000000000000000000000000000007','TKI:000000000000000000000000000000000002', '2018-01-29 15:55:07', null , 'L12010' , 'CLI:100000000000000000000000000000000008', 'novatec' , 'novasys', 'nvinst', 'typ3', 'val3', 'ch6', null, null);
INSERT INTO ATTACHMENT VALUES('TAI:000000000000000000000000000000000008','TKI:000000000000000000000000000000000008', '2018-01-29 15:55:08', null , 'L140101' , 'CLI:000000000000000000000000000000000009', 'novatec' , 'novasys', 'nvinst', 'typ3', 'val3', 'ch6', null, null);
INSERT INTO ATTACHMENT VALUES('TAI:000000000000000000000000000000000009','TKI:000000000000000000000000000000000000', '2018-01-29 15:55:00', '2018-01-30 15:55:00', 'L1050' , 'CLI:100000000000000000000000000000000003', 'novatec' , 'novasys', 'nvinst', 'typ3', 'val4', 'ch7', null, null);
INSERT INTO ATTACHMENT VALUES('TAI:000000000000000000000000000000000010','TKI:000000000000000000000000000000000052', '2018-01-29 15:55:00', '2018-01-30 15:55:00', 'L1050' , 'CLI:100000000000000000000000000000000003', 'novatec' , 'novasys', 'nvinst', 'typ4', 'val4', 'ch7', null, null);
INSERT INTO ATTACHMENT VALUES('TAI:000000000000000000000000000000000011','TKI:000000000000000000000000000000000053', '2018-01-29 15:55:00', '2018-01-30 15:55:00', 'L1050' , 'CLI:100000000000000000000000000000000003', 'novatec' , 'novasys', 'nvinst', 'typ4', 'val4', 'ch7', null, null);
INSERT INTO ATTACHMENT VALUES('TAI:000000000000000000000000000000000012','TKI:000000000000000000000000000000000054', '2018-01-29 15:55:00', '2018-01-30 15:55:00', 'L1050' , 'CLI:100000000000000000000000000000000003', 'novatec' , 'novasys', 'nvinst', 'typ5', 'val4', 'ch7', null, null);
INSERT INTO ATTACHMENT VALUES('TAI:000000000000000000000000000000000013','TKI:000000000000000000000000000000000055', '2018-01-29 15:55:00', '2018-01-30 15:55:00', 'L1050' , 'CLI:100000000000000000000000000000000003', 'novatec' , 'novasys', 'nvinst', 'typ5', 'val4', 'ch7', null, null);
INSERT INTO ATTACHMENT VALUES('TAI:000000000000000000000000000000000014','TKI:000000000000000000000000000000000010', '2018-01-29 15:55:00', '2018-01-30 15:55:00', 'L1051' , 'CLI:100000000000000000000000000000000004', 'novatec' , 'novasys', 'nvinst', 'typ5', 'val4', 'ch8', null, null);
INSERT INTO ATTACHMENT VALUES('TAI:000000000000000000000000000000000015','TKI:000000000000000000000000000000000011', '2018-01-29 15:55:00', '2018-01-30 15:55:00', 'L1052' , 'CLI:100000000000000000000000000000000002', 'novatec' , 'novasys', 'nvinst', 'typ5', 'val5', 'ch8', '2018-01-30 12:00:00', null);
INSERT INTO ATTACHMENT VALUES('TAI:000000000000000000000000000000000016','TKI:000000000000000000000000000000000012', '2018-01-29 15:55:00', '2018-01-30 15:55:00', 'L1053' , 'CLI:100000000000000000000000000000000003', 'novatec' , 'novasys', 'nvinst', 'typ5', 'val6', 'ch8', null, null);