TSK-1658: Created TaskQueryMapperSqlProvider

TSK-1658: Added CustomXNotIn fields


TSK-1658: Tests fixed


TSK-1658: Added Test


TSK-1658: introduced methods for common OnjectReference where parts


TSK-1658: small stuff
This commit is contained in:
Tristan Eisermann 2021-07-13 11:50:40 +02:00 committed by Tristan2357
parent 8edb488bd3
commit 375a92291d
12 changed files with 877 additions and 823 deletions

View File

@ -1,5 +1,6 @@
package pro.taskana.common.api;
import java.util.Arrays;
import java.util.List;
/**
@ -77,17 +78,12 @@ public interface BaseQuery<T, U extends Enum<U> & QueryColumnName> {
default String[] toUpperCopy(String... source) {
if (source == null || source.length == 0) {
return null;
// we are currently aware that this is a code smell. Unfortunately the resolution of this
// would cause havoc in our queries, since we do not have a concept
// for a user input validation yet. As soon as that is done we can resolve this code smell.
return null;
} else {
String[] target = new String[source.length];
for (int i = 0; i < source.length; i++) {
target[i] = source[i].toUpperCase();
}
return target;
}
return Arrays.stream(source).map(String::toUpperCase).toArray(String[]::new);
}
/** Determines the sort direction. */

View File

@ -22,10 +22,6 @@ import pro.taskana.spi.history.api.events.task.TaskHistoryEventType;
/** Test for Task History queries. */
class QueryTaskHistoryAccTest extends AbstractAccTest {
public QueryTaskHistoryAccTest() {
super();
}
@Test
void should_ConfirmEquality_When_UsingListValuesAscendingAndDescending() {
List<String> defaultList =
@ -77,7 +73,7 @@ class QueryTaskHistoryAccTest extends AbstractAccTest {
}
@Test
void should_ReturnEmptyList_When_ProvidingWrongContraints() {
void should_ReturnEmptyList_When_ProvidingWrongConstraints() {
List<TaskHistoryEvent> result = getHistoryService().createTaskHistoryQuery().list(1, 1000);
assertThat(result).hasSize(12);
@ -110,7 +106,7 @@ class QueryTaskHistoryAccTest extends AbstractAccTest {
TaskHistoryQuery query = getHistoryService().createTaskHistoryQuery().userIdIn("peter");
assertThatThrownBy(() -> query.single()).isInstanceOf(TooManyResultsException.class);
assertThatThrownBy(query::single).isInstanceOf(TooManyResultsException.class);
}
@Test

View File

@ -452,13 +452,24 @@ public interface TaskQuery extends BaseQuery<TaskSummary, TaskQueryColumnName> {
TaskQuery customAttributeIn(TaskCustomField customField, String... searchArguments)
throws InvalidArgumentException;
/**
* Exclude these values of custom attributes from your query.
*
* @param customField identifies which custom attribute is affected.
* @param searchArguments the customField values of the searched for tasks
* @return the query
* @throws InvalidArgumentException if searchArguments are not given
*/
TaskQuery customAttributeNotIn(TaskCustomField customField, String... searchArguments)
throws InvalidArgumentException;
/**
* Add the values of custom attributes 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 customField identifies which custom attribute is affected.
* @param searchArguments the customField values of the searched-for tasks
* @param searchArguments the customField values of the searched for tasks
* @return the query
* @throws InvalidArgumentException if searchArguments is not given
*/

View File

@ -256,7 +256,7 @@ public interface TaskService {
throws TaskNotFoundException, NotAuthorizedException;
/**
* This method provides a query builder for quering the database.
* This method provides a query builder for querying the database.
*
* @return a {@link TaskQuery}
*/
@ -394,7 +394,7 @@ public interface TaskService {
* @param taskIds list of source {@linkplain Task Tasks} which will be moved
* @param setTransferFlag the control about whether to set the {@linkplain Task#isTransferred()}
* flag or not
* @return Bulkresult with ID and Error in it for failed transactions.
* @return BulkResult with ID and Error in it for failed transactions.
* @throws NotAuthorizedException if the caller has no permissions on target {@linkplain
* pro.taskana.workbasket.api.models.Workbasket Workbasket}.
* @throws InvalidArgumentException if the method parameters are EMPTY or NULL.

View File

@ -97,36 +97,52 @@ public class TaskQueryImpl implements TaskQuery {
private String[] businessProcessIdLike;
private CallbackState[] callbackStateIn;
private String[] custom1In;
private String[] custom1NotIn;
private String[] custom1Like;
private String[] custom2In;
private String[] custom2NotIn;
private String[] custom2Like;
private String[] custom3In;
private String[] custom3NotIn;
private String[] custom3Like;
private String[] custom4In;
private String[] custom4NotIn;
private String[] custom4Like;
private String[] custom5In;
private String[] custom5NotIn;
private String[] custom5Like;
private String[] custom6In;
private String[] custom6NotIn;
private String[] custom6Like;
private String[] custom7In;
private String[] custom7NotIn;
private String[] custom7Like;
private String[] custom8In;
private String[] custom8NotIn;
private String[] custom8Like;
private String[] custom9In;
private String[] custom9NotIn;
private String[] custom9Like;
private String[] custom10In;
private String[] custom10NotIn;
private String[] custom10Like;
private String[] custom11In;
private String[] custom11NotIn;
private String[] custom11Like;
private String[] custom12In;
private String[] custom12NotIn;
private String[] custom12Like;
private String[] custom13In;
private String[] custom13NotIn;
private String[] custom13Like;
private String[] custom14In;
private String[] custom14NotIn;
private String[] custom14Like;
private String[] custom15In;
private String[] custom15NotIn;
private String[] custom15Like;
private String[] custom16In;
private String[] custom16NotIn;
private String[] custom16Like;
private String[] attachmentClassificationKeyIn;
private String[] attachmentClassificationKeyLike;
@ -540,6 +556,69 @@ public class TaskQueryImpl implements TaskQuery {
return this;
}
@Override
public TaskQuery customAttributeNotIn(TaskCustomField customField, String... strings)
throws InvalidArgumentException {
if (strings.length == 0) {
throw new InvalidArgumentException(
"At least one string has to be provided as a search parameter");
}
switch (customField) {
case CUSTOM_1:
this.custom1NotIn = strings;
break;
case CUSTOM_2:
this.custom2NotIn = strings;
break;
case CUSTOM_3:
this.custom3NotIn = strings;
break;
case CUSTOM_4:
this.custom4NotIn = strings;
break;
case CUSTOM_5:
this.custom5NotIn = strings;
break;
case CUSTOM_6:
this.custom6NotIn = strings;
break;
case CUSTOM_7:
this.custom7NotIn = strings;
break;
case CUSTOM_8:
this.custom8NotIn = strings;
break;
case CUSTOM_9:
this.custom9NotIn = strings;
break;
case CUSTOM_10:
this.custom10NotIn = strings;
break;
case CUSTOM_11:
this.custom11NotIn = strings;
break;
case CUSTOM_12:
this.custom12NotIn = strings;
break;
case CUSTOM_13:
this.custom13NotIn = strings;
break;
case CUSTOM_14:
this.custom14NotIn = strings;
break;
case CUSTOM_15:
this.custom15NotIn = strings;
break;
case CUSTOM_16:
this.custom16NotIn = strings;
break;
default:
throw new SystemException("Unknown custom attribute '" + customField + "'");
}
return this;
}
@Override
public TaskQuery customAttributeLike(TaskCustomField customField, String... strings)
throws InvalidArgumentException {
@ -550,7 +629,8 @@ public class TaskQueryImpl implements TaskQuery {
switch (customField) {
case CUSTOM_1:
this.custom1Like = toUpperCopy(strings);
this.custom1Like =
toUpperCopy(strings); // why are we doing this? the sql is always an upper?
break;
case CUSTOM_2:
this.custom2Like = toUpperCopy(strings);
@ -1225,6 +1305,10 @@ public class TaskQueryImpl implements TaskQuery {
return custom1In;
}
public String[] getCustom1NotIn() {
return custom1NotIn;
}
public String[] getCustom1Like() {
return custom1Like;
}
@ -1233,6 +1317,10 @@ public class TaskQueryImpl implements TaskQuery {
return custom2In;
}
public String[] getCustom2NotIn() {
return custom2NotIn;
}
public String[] getCustom2Like() {
return custom2Like;
}
@ -1241,6 +1329,10 @@ public class TaskQueryImpl implements TaskQuery {
return custom3In;
}
public String[] getCustom3NotIn() {
return custom3NotIn;
}
public String[] getCustom3Like() {
return custom3Like;
}
@ -1249,6 +1341,10 @@ public class TaskQueryImpl implements TaskQuery {
return custom4In;
}
public String[] getCustom4NotIn() {
return custom4NotIn;
}
public String[] getCustom4Like() {
return custom4Like;
}
@ -1257,6 +1353,10 @@ public class TaskQueryImpl implements TaskQuery {
return custom5In;
}
public String[] getCustom5NotIn() {
return custom5NotIn;
}
public String[] getCustom5Like() {
return custom5Like;
}
@ -1265,6 +1365,10 @@ public class TaskQueryImpl implements TaskQuery {
return custom6In;
}
public String[] getCustom6NotIn() {
return custom6NotIn;
}
public String[] getCustom6Like() {
return custom6Like;
}
@ -1273,6 +1377,10 @@ public class TaskQueryImpl implements TaskQuery {
return custom7In;
}
public String[] getCustom7NotIn() {
return custom7NotIn;
}
public String[] getCustom7Like() {
return custom7Like;
}
@ -1281,6 +1389,10 @@ public class TaskQueryImpl implements TaskQuery {
return custom8In;
}
public String[] getCustom8NotIn() {
return custom8NotIn;
}
public String[] getCustom8Like() {
return custom8Like;
}
@ -1289,6 +1401,10 @@ public class TaskQueryImpl implements TaskQuery {
return custom9In;
}
public String[] getCustom9NotIn() {
return custom9NotIn;
}
public String[] getCustom9Like() {
return custom9Like;
}
@ -1297,6 +1413,10 @@ public class TaskQueryImpl implements TaskQuery {
return custom10In;
}
public String[] getCustom10NotIn() {
return custom10NotIn;
}
public String[] getCustom10Like() {
return custom10Like;
}
@ -1305,6 +1425,10 @@ public class TaskQueryImpl implements TaskQuery {
return custom11In;
}
public String[] getCustom11NotIn() {
return custom11NotIn;
}
public String[] getCustom11Like() {
return custom11Like;
}
@ -1313,6 +1437,10 @@ public class TaskQueryImpl implements TaskQuery {
return custom12In;
}
public String[] getCustom12NotIn() {
return custom12NotIn;
}
public String[] getCustom12Like() {
return custom12Like;
}
@ -1321,6 +1449,10 @@ public class TaskQueryImpl implements TaskQuery {
return custom13In;
}
public String[] getCustom13NotIn() {
return custom13NotIn;
}
public String[] getCustom13Like() {
return custom13Like;
}
@ -1329,6 +1461,10 @@ public class TaskQueryImpl implements TaskQuery {
return custom14In;
}
public String[] getCustom14NotIn() {
return custom14NotIn;
}
public String[] getCustom14Like() {
return custom14Like;
}
@ -1337,6 +1473,10 @@ public class TaskQueryImpl implements TaskQuery {
return custom15In;
}
public String[] getCustom15NotIn() {
return custom15NotIn;
}
public String[] getCustom15Like() {
return custom15Like;
}
@ -1345,6 +1485,10 @@ public class TaskQueryImpl implements TaskQuery {
return custom16In;
}
public String[] getCustom16NotIn() {
return custom16NotIn;
}
public String[] getCustom16Like() {
return custom16Like;
}
@ -1760,66 +1904,98 @@ public class TaskQueryImpl implements TaskQuery {
+ Arrays.toString(callbackStateIn)
+ ", custom1In="
+ Arrays.toString(custom1In)
+ ", custom1NotIn="
+ Arrays.toString(custom1NotIn)
+ ", custom1Like="
+ Arrays.toString(custom1Like)
+ ", custom2In="
+ Arrays.toString(custom2In)
+ ", custom2NotIn="
+ Arrays.toString(custom2NotIn)
+ ", custom2Like="
+ Arrays.toString(custom2Like)
+ ", custom3In="
+ Arrays.toString(custom3In)
+ ", custom3NotIn="
+ Arrays.toString(custom3NotIn)
+ ", custom3Like="
+ Arrays.toString(custom3Like)
+ ", custom4In="
+ Arrays.toString(custom4In)
+ ", custom4NotIn="
+ Arrays.toString(custom4NotIn)
+ ", custom4Like="
+ Arrays.toString(custom4Like)
+ ", custom5In="
+ Arrays.toString(custom5In)
+ ", custom5NotIn="
+ Arrays.toString(custom5NotIn)
+ ", custom5Like="
+ Arrays.toString(custom5Like)
+ ", custom6In="
+ Arrays.toString(custom6In)
+ ", custom6NotIn="
+ Arrays.toString(custom6NotIn)
+ ", custom6Like="
+ Arrays.toString(custom6Like)
+ ", custom7In="
+ Arrays.toString(custom7In)
+ ", custom7NotIn="
+ Arrays.toString(custom7NotIn)
+ ", custom7Like="
+ Arrays.toString(custom7Like)
+ ", custom8In="
+ Arrays.toString(custom8In)
+ ", custom8NotIn="
+ Arrays.toString(custom8NotIn)
+ ", custom8Like="
+ Arrays.toString(custom8Like)
+ ", custom9In="
+ Arrays.toString(custom9In)
+ ", custom9NotIn="
+ Arrays.toString(custom9NotIn)
+ ", custom9Like="
+ Arrays.toString(custom9Like)
+ ", custom10In="
+ Arrays.toString(custom10In)
+ ", custom10NotIn="
+ Arrays.toString(custom10NotIn)
+ ", custom10Like="
+ Arrays.toString(custom10Like)
+ ", custom11In="
+ Arrays.toString(custom11In)
+ ", custom11NotIn="
+ Arrays.toString(custom11NotIn)
+ ", custom11Like="
+ Arrays.toString(custom11Like)
+ ", custom12In="
+ Arrays.toString(custom12In)
+ ", custom12NotIn="
+ Arrays.toString(custom12NotIn)
+ ", custom12Like="
+ Arrays.toString(custom12Like)
+ ", custom13In="
+ Arrays.toString(custom13In)
+ ", custom13NotIn="
+ Arrays.toString(custom13NotIn)
+ ", custom13Like="
+ Arrays.toString(custom13Like)
+ ", custom14In="
+ Arrays.toString(custom14In)
+ ", custom14NotIn="
+ Arrays.toString(custom14NotIn)
+ ", custom14Like="
+ Arrays.toString(custom14Like)
+ ", custom15In="
+ Arrays.toString(custom15In)
+ ", custom15NotIn="
+ Arrays.toString(custom15NotIn)
+ ", custom15Like="
+ Arrays.toString(custom15Like)
+ ", custom16In="
+ Arrays.toString(custom16In)
+ ", custom16NotIn="
+ Arrays.toString(custom16NotIn)
+ ", custom16Like="
+ Arrays.toString(custom16Like)
+ ", attachmentClassificationKeyIn="

View File

@ -2,7 +2,7 @@ package pro.taskana.task.internal;
import java.util.List;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectProvider;
import pro.taskana.task.api.models.ObjectReference;
import pro.taskana.task.internal.models.TaskSummaryImpl;
@ -11,148 +11,7 @@ import pro.taskana.task.internal.models.TaskSummaryImpl;
@SuppressWarnings({"checkstyle:LineLength", "checkstyle:Indentation"})
public interface TaskQueryMapper {
@Select(
"<script> "
+ "SELECT <if test=\"useDistinctKeyword\">DISTINCT</if> t.ID, t.EXTERNAL_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>"
+ "<if test=\"addClassificationNameToSelectClauseForOrdering\">"
+ ", c.NAME "
+ "</if>"
+ "<if test=\"addAttachmentClassificationNameToSelectClauseForOrdering\">"
+ ", ac.NAME "
+ "</if>"
+ "<if test=\"addWorkbasketNameToSelectClauseForOrdering\">"
+ ", w.NAME "
+ "</if>"
+ "FROM TASK t "
+ "<if test=\"joinWithAttachments\">"
+ "LEFT JOIN ATTACHMENT AS a ON t.ID = a.TASK_ID "
+ "</if>"
+ "<if test=\"joinWithClassifications\">"
+ "LEFT JOIN CLASSIFICATION AS c ON t.CLASSIFICATION_ID = c.ID "
+ "</if>"
+ "<if test=\"joinWithAttachmentClassifications\">"
+ "LEFT JOIN CLASSIFICATION AS ac ON a.CLASSIFICATION_ID = ac.ID "
+ "</if>"
+ "<if test=\"joinWithWorkbaskets\">"
+ "LEFT JOIN WORKBASKET AS w ON t.WORKBASKET_ID = w.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 "
+ "ACCESS_ID IN (<foreach item='item' collection='accessIdIn' separator=',' >#{item}</foreach>) "
+ "group by WORKBASKET_ID ) AS f where max_read = 1 ) "
+ "</if> "
+ "<if test='taskIds != null'>AND t.ID IN(<foreach item='item' collection='taskIds' separator=',' >#{item}</foreach>)</if> "
+ "<if test='externalIdIn != null'>AND t.EXTERNAL_ID IN(<foreach item='item' collection='externalIdIn' separator=',' >#{item}</foreach>)</if> "
+ "<if test='externalIdLike != null'>AND (<foreach item='item' collection='externalIdLike' separator=' OR '>UPPER(t.EXTERNAL_ID) LIKE #{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 t.CREATOR IN(<foreach item='item' collection='creatorIn' separator=',' >#{item}</foreach>)</if> "
+ "<if test='creatorLike != null'>AND (<foreach item='item' collection='creatorLike' separator=' OR '>UPPER(t.CREATOR) LIKE #{item}</foreach>)</if> "
+ "<if test='description != null'>AND (<foreach item='item' collection='description' separator=' OR '>t.DESCRIPTION LIKE #{item}</foreach>)</if> "
+ "<if test='noteLike != null'>AND (<foreach item='item' collection='noteLike' separator=' OR '>UPPER(t.NOTE) LIKE #{item}</foreach>)</if> "
+ "<if test='priority != null'>AND t.PRIORITY IN(<foreach item='item' collection='priority' separator=',' >#{item}</foreach>)</if> "
+ "<if test='stateIn != null'>AND t.STATE IN(<foreach item='item' collection='stateIn' separator=',' >#{item}</foreach>)</if> "
+ "<if test='callbackStateIn != null'>AND t.CALLBACK_STATE IN(<foreach item='item' collection='callbackStateIn' separator=',' >#{item}</foreach>)</if> "
+ "<if test='workbasketIdIn != null'>AND t.WORKBASKET_ID IN(<foreach item='item' collection='workbasketIdIn' separator=',' >#{item}</foreach>)</if> "
+ "<if test='workbasketKeyDomainIn != null'>AND (<foreach item='item' collection='workbasketKeyDomainIn' separator=' OR '>(t.WORKBASKET_KEY = #{item.key} AND t.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 t.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(t.CLASSIFICATION_CATEGORY) LIKE #{item}</foreach>)</if> "
+ "<if test='classificationNameIn != null'>AND c.NAME IN(<foreach item='item' collection='classificationNameIn' separator=',' >#{item}</foreach>)</if> "
+ "<if test='classificationNameLike != null'>AND (<foreach item='item' collection='classificationNameLike' separator=' OR '>UPPER(c.NAME) LIKE #{item}</foreach>)</if> "
+ "<if test='attachmentClassificationNameIn != null'>AND ac.NAME IN(<foreach item='item' collection='attachmentClassificationNameIn' separator=',' >#{item}</foreach>)</if> "
+ "<if test='attachmentClassificationNameLike != null'>AND (<foreach item='item' collection='attachmentClassificationNameLike' separator=' OR '>UPPER(ac.NAME) LIKE #{item}</foreach>)</if> "
+ "<if test='ownerIn != null'>AND t.OWNER IN(<foreach item='item' collection='ownerIn' separator=',' >#{item}</foreach>)</if> "
+ "<if test='ownerLike != null'>AND (<foreach item='item' collection='ownerLike' separator=' OR '>UPPER(t.OWNER) LIKE #{item}</foreach>)</if> "
+ "<if test='isRead != null'>AND t.IS_READ = #{isRead}</if> "
+ "<if test='isTransferred != null'>AND t.IS_TRANSFERRED = #{isTransferred}</if> "
+ "<if test='objectReferences != null'>"
+ "AND (<foreach item='item' collection='objectReferences' separator=' OR '> "
+ "<if test='item.company != null'>t.POR_COMPANY = #{item.company} </if>"
+ "<if test='item.system != null'> <if test='item.company != null'>AND</if> t.POR_SYSTEM = #{item.system} </if>"
+ "<if test='item.systemInstance != null'> <if test='item.company != null or item.system != null'>AND</if> t.POR_INSTANCE = #{item.systemInstance} </if>"
+ "<if test='item.type != null'> <if test='item.company != null or item.system != null or item.systemInstance != null'>AND</if> t.POR_TYPE = #{item.type} </if>"
+ "<if test='item.value != null'> <if test='item.company != null or item.system != null or item.systemInstance != null or item.type != null'>AND</if> t.POR_VALUE = #{item.value} </if>"
+ "</foreach>)</if>"
+ "<if test='porCompanyIn != null'>AND t.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(t.POR_COMPANY) LIKE #{item}</foreach>)</if> "
+ "<if test='porSystemIn != null'>AND t.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(t.POR_SYSTEM) LIKE #{item}</foreach>)</if> "
+ "<if test='porSystemInstanceIn != null'>AND t.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(t.POR_INSTANCE) LIKE #{item}</foreach>)</if> "
+ "<if test='porTypeIn != null'>AND t.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(t.POR_TYPE) LIKE #{item}</foreach>)</if> "
+ "<if test='porValueIn != null'>AND t.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(t.POR_VALUE) LIKE #{item}</foreach>)</if> "
+ "<if test='parentBusinessProcessIdIn != null'>AND t.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(t.PARENT_BUSINESS_PROCESS_ID) LIKE #{item}</foreach>)</if> "
+ "<if test='businessProcessIdIn != null'>AND t.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(t.BUSINESS_PROCESS_ID) LIKE #{item}</foreach>)</if> "
+ "<if test='custom1In != null'>AND t.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(t.CUSTOM_1) LIKE #{item}</foreach>)</if> "
+ "<if test='custom2In != null'>AND t.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(t.CUSTOM_2) LIKE #{item}</foreach>)</if> "
+ "<if test='custom3In != null'>AND t.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(t.CUSTOM_3) LIKE #{item}</foreach>)</if> "
+ "<if test='custom4In != null'>AND t.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(t.CUSTOM_4) LIKE #{item}</foreach>)</if> "
+ "<if test='custom5In != null'>AND t.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(t.CUSTOM_5) LIKE #{item}</foreach>)</if> "
+ "<if test='custom6In != null'>AND t.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(t.CUSTOM_6) LIKE #{item}</foreach>)</if> "
+ "<if test='custom7In != null'>AND t.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(t.CUSTOM_7) LIKE #{item}</foreach>)</if> "
+ "<if test='custom8In != null'>AND t.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(t.CUSTOM_8) LIKE #{item}</foreach>)</if> "
+ "<if test='custom9In != null'>AND t.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(t.CUSTOM_9) LIKE #{item}</foreach>)</if> "
+ "<if test='custom10In != null'>AND t.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(t.CUSTOM_10) LIKE #{item}</foreach>)</if> "
+ "<if test='custom11In != null'>AND t.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(t.CUSTOM_11) LIKE #{item}</foreach>)</if> "
+ "<if test='custom12In != null'>AND t.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(t.CUSTOM_12) LIKE #{item}</foreach>)</if> "
+ "<if test='custom13In != null'>AND t.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(t.CUSTOM_13) LIKE #{item}</foreach>)</if> "
+ "<if test='custom14In != null'>AND t.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(t.CUSTOM_14) LIKE #{item}</foreach>)</if> "
+ "<if test='custom15In != null'>AND t.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(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='wildcardSearchValueLike != null and wildcardSearchFieldIn != null'>AND (<foreach item='item' collection='wildcardSearchFieldIn' separator=' OR '>UPPER(t.${item}) LIKE #{wildcardSearchValueLike}</foreach>)</if> "
+ "<if test='selectAndClaim == true'> AND t.STATE = 'READY' </if>"
+ "</where>"
+ "<if test='!orderBy.isEmpty()'>ORDER BY <foreach item='item' collection='orderBy' separator=',' >${item}</foreach></if> "
+ "<if test='selectAndClaim == true'> FETCH FIRST ROW ONLY FOR UPDATE </if>"
+ "<if test=\"_databaseId == 'db2'\">WITH RS USE AND KEEP UPDATE LOCKS </if> "
+ "</script>")
@SelectProvider(type = TaskQuerySqlProvider.class, method = "queryTaskSummaries")
@Result(property = "id", column = "ID")
@Result(property = "externalId", column = "EXTERNAL_ID")
@Result(property = "created", column = "CREATED")
@ -202,220 +61,7 @@ public interface TaskQueryMapper {
@Result(property = "custom16", column = "CUSTOM_16")
List<TaskSummaryImpl> queryTaskSummaries(TaskQueryImpl taskQuery);
@Select(
"<script> "
+ "WITH X (ID, EXTERNAL_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>"
+ "<if test=\"addClassificationNameToSelectClauseForOrdering\">"
+ ", CNAME "
+ "</if>"
+ "<if test=\"addAttachmentClassificationNameToSelectClauseForOrdering\">"
+ ", ACNAME "
+ "</if>"
+ "<if test=\"addWorkbasketNameToSelectClauseForOrdering\">"
+ ", WNAME "
+ "</if>"
+ " ) "
+ " AS (SELECT <if test=\"useDistinctKeyword\">DISTINCT</if> t.ID, t.EXTERNAL_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>"
+ "<if test=\"addClassificationNameToSelectClauseForOrdering\">"
+ ", c.NAME "
+ "</if>"
+ "<if test=\"addAttachmentClassificationNameToSelectClauseForOrdering\">"
+ ", ac.NAME "
+ "</if>"
+ "<if test=\"addWorkbasketNameToSelectClauseForOrdering\">"
+ ", w.NAME "
+ "</if>"
+ " FROM TASK t "
+ "<if test=\"joinWithAttachments\">"
+ "LEFT JOIN ATTACHMENT a ON t.ID = a.TASK_ID "
+ "</if>"
+ "<if test=\"joinWithClassifications\">"
+ "LEFT JOIN CLASSIFICATION AS c ON t.CLASSIFICATION_ID = c.ID "
+ "</if>"
+ "<if test=\"joinWithAttachmentClassifications\">"
+ "LEFT JOIN CLASSIFICATION AS ac ON a.CLASSIFICATION_ID = ac.ID "
+ "</if>"
+ "<if test=\"joinWithWorkbaskets\">"
+ "LEFT JOIN WORKBASKET AS w ON t.WORKBASKET_ID = w.ID "
+ "</if>"
+ "<where> "
+ "<if test='taskIds != null'>AND t.ID IN(<foreach item='item' collection='taskIds' separator=',' >#{item}</foreach>)</if> "
+ "<if test='externalIdIn != null'>AND t.EXTERNAL_ID IN(<foreach item='item' collection='externalIdIn' separator=',' >#{item}</foreach>)</if> "
+ "<if test='externalIdLike != null'>AND (<foreach item='item' collection='externalIdLike' separator=' OR '>UPPER(t.EXTERNAL_ID) LIKE #{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='stateIn != null'>AND STATE IN(<foreach item='item' collection='stateIn' separator=',' >#{item}</foreach>)</if> "
+ "<if test='callbackStateIn != null'>AND t.CALLBACK_STATE IN(<foreach item='item' collection='callbackStateIn' 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='classificationNameIn != null'>AND c.NAME IN(<foreach item='item' collection='classificationNameIn' separator=',' >#{item}</foreach>)</if> "
+ "<if test='classificationNameLike != null'>AND (<foreach item='item' collection='classificationNameLike' separator=' OR '>UPPER(c.NAME) LIKE #{item}</foreach>)</if> "
+ "<if test='attachmentClassificationNameIn != null'>AND ac.NAME IN(<foreach item='item' collection='attachmentClassificationNameIn' separator=',' >#{item}</foreach>)</if> "
+ "<if test='attachmentClassificationNameLike != null'>AND (<foreach item='item' collection='attachmentClassificationNameLike' separator=' OR '>UPPER(ac.NAME) 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='objectReferences != null'>"
+ "AND (<foreach item='item' collection='objectReferences' separator=' OR '> "
+ "<if test='item.company != null'>t.POR_COMPANY = #{item.company} </if>"
+ "<if test='item.system != null'> <if test='item.company != null'>AND</if> t.POR_SYSTEM = #{item.system} </if>"
+ "<if test='item.systemInstance != null'> <if test='item.company != null or item.system != null'>AND</if> t.POR_INSTANCE = #{item.systemInstance} </if>"
+ "<if test='item.type != null'> <if test='item.company != null or item.system != null or item.systemInstance != null'>AND</if> t.POR_TYPE = #{item.type} </if>"
+ "<if test='item.value != null'> <if test='item.company != null or item.system != null or item.systemInstance != null or item.type != null'>AND</if> t.POR_VALUE = #{item.value} </if>"
+ "</foreach>)</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='wildcardSearchValueLike != null and wildcardSearchFieldIn != null'>AND (<foreach item='item' collection='wildcardSearchFieldIn' separator=' OR '>UPPER(t.${item}) LIKE #{wildcardSearchValueLike}</foreach>)</if> "
+ "</where> "
+ "), Y (ID, EXTERNAL_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>"
+ "<if test=\"addClassificationNameToSelectClauseForOrdering\">"
+ ", CNAME "
+ "</if>"
+ "<if test=\"addAttachmentClassificationNameToSelectClauseForOrdering\">"
+ ", ACNAME "
+ "</if>"
+ "<if test=\"addWorkbasketNameToSelectClauseForOrdering\">"
+ ", WNAME "
+ "</if>"
+ ", FLAG ) "
+ "AS "
+ "(SELECT ID, EXTERNAL_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>"
+ "<if test=\"addClassificationNameToSelectClauseForOrdering\">"
+ ", CNAME "
+ "</if>"
+ "<if test=\"addAttachmentClassificationNameToSelectClauseForOrdering\">"
+ ", ACNAME "
+ "</if>"
+ "<if test=\"addWorkbasketNameToSelectClauseForOrdering\">"
+ ", WNAME "
+ "</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, EXTERNAL_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>"
+ "<if test=\"addClassificationNameToSelectClauseForOrdering\">"
+ ", CNAME "
+ "</if>"
+ "<if test=\"addAttachmentClassificationNameToSelectClauseForOrdering\">"
+ ", ACNAME "
+ "</if>"
+ "<if test=\"addWorkbasketNameToSelectClauseForOrdering\">"
+ ", WNAME "
+ "</if>"
+ " FROM Y WHERE FLAG = 1 "
+ "<if test='!orderBy.isEmpty()'>ORDER BY <foreach item='item' collection='orderBy' separator=',' >"
+ "${item}"
+ "</foreach>"
+ "</if> "
+ "<if test='selectAndClaim == true'>FETCH FIRST ROW ONLY FOR UPDATE WITH RS USE AND KEEP UPDATE LOCKS</if>"
+ "<if test='selectAndClaim == false'> with UR</if>"
+ "</script>")
@SelectProvider(type = TaskQuerySqlProvider.class, method = "queryTaskSummariesDb2")
@Result(property = "id", column = "ID")
@Result(property = "externalId", column = "EXTERNAL_ID")
@Result(property = "created", column = "CREATED")
@ -465,18 +111,7 @@ public interface TaskQueryMapper {
@Result(property = "custom16", column = "CUSTOM_16")
List<TaskSummaryImpl> queryTaskSummariesDb2(TaskQueryImpl taskQuery);
@Select(
"<script>SELECT ID, COMPANY, SYSTEM, SYSTEM_INSTANCE, TYPE, VALUE "
+ "FROM OBJECT_REFERENCE "
+ "<where>"
+ "<if test='company != null'>AND COMPANY IN(<foreach item='item' collection='company' separator=',' >#{item}</foreach>)</if> "
+ "<if test='system != null'>AND SYSTEM IN(<foreach item='item' collection='system' separator=',' >#{item}</foreach>)</if> "
+ "<if test='systemInstance != null'>AND SYSTEM_INSTANCE IN(<foreach item='item' collection='systemInstance' separator=',' >#{item}</foreach>)</if> "
+ "<if test='type != null'>AND TYPE IN(<foreach item='item' collection='type' separator=',' >#{item}</foreach>)</if> "
+ "<if test='value != null'>AND VALUE IN(<foreach item='item' collection='value' separator=',' >#{item}</foreach>)</if> "
+ "</where>"
+ "<if test=\"_databaseId == 'db2'\">with UR </if> "
+ "</script>")
@SelectProvider(type = TaskQuerySqlProvider.class, method = "queryObjectReferences")
@Result(property = "id", column = "ID")
@Result(property = "company", column = "COMPANY")
@Result(property = "system", column = "SYSTEM")
@ -485,427 +120,18 @@ public interface TaskQueryMapper {
@Result(property = "value", column = "VALUE")
List<ObjectReference> queryObjectReferences(ObjectReferenceQueryImpl objectReference);
@Select(
"<script> "
+ "SELECT COUNT( <if test=\"useDistinctKeyword\">DISTINCT</if> t.ID) FROM TASK t "
+ "<if test=\"joinWithAttachments\">"
+ "LEFT JOIN ATTACHMENT AS a ON t.ID = a.TASK_ID "
+ "</if>"
+ "<if test=\"joinWithClassifications\">"
+ "LEFT JOIN CLASSIFICATION AS c ON t.CLASSIFICATION_ID = c.ID "
+ "</if>"
+ "<if test=\"joinWithAttachmentClassifications\">"
+ "LEFT JOIN CLASSIFICATION AS ac ON a.CLASSIFICATION_ID = ac.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 "
+ "ACCESS_ID IN (<foreach item='item' collection='accessIdIn' separator=',' >#{item}</foreach>) "
+ "group by WORKBASKET_ID ) AS f where max_read = 1 ) "
+ "</if> "
+ "<if test='taskIds != null'>AND t.ID IN(<foreach item='item' collection='taskIds' separator=',' >#{item}</foreach>)</if> "
+ "<if test='externalIdIn != null'>AND t.EXTERNAL_ID IN(<foreach item='item' collection='externalIdIn' separator=',' >#{item}</foreach>)</if> "
+ "<if test='externalIdLike != null'>AND (<foreach item='item' collection='externalIdLike' separator=' OR '>UPPER(t.EXTERNAL_ID) LIKE #{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 t.CREATOR IN(<foreach item='item' collection='creatorIn' separator=',' >#{item}</foreach>)</if> "
+ "<if test='creatorLike != null'>AND (<foreach item='item' collection='creatorLike' separator=' OR '>UPPER(t.CREATOR) LIKE #{item}</foreach>)</if> "
+ "<if test='description != null'>AND (<foreach item='item' collection='description' separator=' OR '>t.DESCRIPTION LIKE #{item}</foreach>)</if> "
+ "<if test='noteLike != null'>AND (<foreach item='item' collection='noteLike' separator=' OR '>UPPER(t.NOTE) LIKE #{item}</foreach>)</if> "
+ "<if test='priority != null'>AND t.PRIORITY IN(<foreach item='item' collection='priority' separator=',' >#{item}</foreach>)</if> "
+ "<if test='stateIn != null'>AND t.STATE IN(<foreach item='item' collection='stateIn' separator=',' >#{item}</foreach>)</if> "
+ "<if test='callbackStateIn != null'>AND t.CALLBACK_STATE IN(<foreach item='item' collection='callbackStateIn' separator=',' >#{item}</foreach>)</if> "
+ "<if test='workbasketIdIn != null'>AND t.WORKBASKET_ID IN(<foreach item='item' collection='workbasketIdIn' separator=',' >#{item}</foreach>)</if> "
+ "<if test='workbasketKeyDomainIn != null'>AND (<foreach item='item' collection='workbasketKeyDomainIn' separator=' OR '>(t.WORKBASKET_KEY = #{item.key} AND t.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 t.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(t.CLASSIFICATION_CATEGORY) LIKE #{item}</foreach>)</if> "
+ "<if test='classificationNameIn != null'>AND c.NAME IN(<foreach item='item' collection='classificationNameIn' separator=',' >#{item}</foreach>)</if> "
+ "<if test='classificationNameLike != null'>AND (<foreach item='item' collection='classificationNameLike' separator=' OR '>UPPER(c.NAME) LIKE #{item}</foreach>)</if> "
+ "<if test='attachmentClassificationNameIn != null'>AND ac.NAME IN(<foreach item='item' collection='attachmentClassificationNameIn' separator=',' >#{item}</foreach>)</if> "
+ "<if test='attachmentClassificationNameLike != null'>AND (<foreach item='item' collection='attachmentClassificationNameLike' separator=' OR '>UPPER(ac.NAME) LIKE #{item}</foreach>)</if> "
+ "<if test='ownerIn != null'>AND t.OWNER IN(<foreach item='item' collection='ownerIn' separator=',' >#{item}</foreach>)</if> "
+ "<if test='ownerLike != null'>AND (<foreach item='item' collection='ownerLike' separator=' OR '>UPPER(t.OWNER) LIKE #{item}</foreach>)</if> "
+ "<if test='isRead != null'>AND t.IS_READ = #{isRead}</if> "
+ "<if test='isTransferred != null'>AND t.IS_TRANSFERRED = #{isTransferred}</if> "
+ "<if test='objectReferences != null'>"
+ "AND (<foreach item='item' collection='objectReferences' separator=' OR '> "
+ "<if test='item.company != null'>t.POR_COMPANY = #{item.company} </if>"
+ "<if test='item.system != null'> <if test='item.company != null'>AND</if> t.POR_SYSTEM = #{item.system} </if>"
+ "<if test='item.systemInstance != null'> <if test='item.company != null or item.system != null'>AND</if> t.POR_INSTANCE = #{item.systemInstance} </if>"
+ "<if test='item.type != null'> <if test='item.company != null or item.system != null or item.systemInstance != null'>AND</if> t.POR_TYPE = #{item.type} </if>"
+ "<if test='item.value != null'> <if test='item.company != null or item.system != null or item.systemInstance != null or item.type != null'>AND</if> t.POR_VALUE = #{item.value} </if>"
+ "</foreach>)</if>"
+ "<if test='porCompanyIn != null'>AND t.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(t.POR_COMPANY) LIKE #{item}</foreach>)</if> "
+ "<if test='porSystemIn != null'>AND t.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(t.POR_SYSTEM) LIKE #{item}</foreach>)</if> "
+ "<if test='porSystemInstanceIn != null'>AND t.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(t.POR_INSTANCE) LIKE #{item}</foreach>)</if> "
+ "<if test='porTypeIn != null'>AND t.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(t.POR_TYPE) LIKE #{item}</foreach>)</if> "
+ "<if test='porValueIn != null'>AND t.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(t.POR_VALUE) LIKE #{item}</foreach>)</if> "
+ "<if test='parentBusinessProcessIdIn != null'>AND t.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(t.PARENT_BUSINESS_PROCESS_ID) LIKE #{item}</foreach>)</if> "
+ "<if test='businessProcessIdIn != null'>AND t.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(t.BUSINESS_PROCESS_ID) LIKE #{item}</foreach>)</if> "
+ "<if test='custom1In != null'>AND t.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(t.CUSTOM_1) LIKE #{item}</foreach>)</if> "
+ "<if test='custom2In != null'>AND t.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(t.CUSTOM_2) LIKE #{item}</foreach>)</if> "
+ "<if test='custom3In != null'>AND t.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(t.CUSTOM_3) LIKE #{item}</foreach>)</if> "
+ "<if test='custom4In != null'>AND t.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(t.CUSTOM_4) LIKE #{item}</foreach>)</if> "
+ "<if test='custom5In != null'>AND t.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(t.CUSTOM_5) LIKE #{item}</foreach>)</if> "
+ "<if test='custom6In != null'>AND t.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(t.CUSTOM_6) LIKE #{item}</foreach>)</if> "
+ "<if test='custom7In != null'>AND t.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(t.CUSTOM_7) LIKE #{item}</foreach>)</if> "
+ "<if test='custom8In != null'>AND t.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(t.CUSTOM_8) LIKE #{item}</foreach>)</if> "
+ "<if test='custom9In != null'>AND t.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(t.CUSTOM_9) LIKE #{item}</foreach>)</if> "
+ "<if test='custom10In != null'>AND t.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(t.CUSTOM_10) LIKE #{item}</foreach>)</if> "
+ "<if test='custom11In != null'>AND t.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(t.CUSTOM_11) LIKE #{item}</foreach>)</if> "
+ "<if test='custom12In != null'>AND t.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(t.CUSTOM_12) LIKE #{item}</foreach>)</if> "
+ "<if test='custom13In != null'>AND t.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(t.CUSTOM_13) LIKE #{item}</foreach>)</if> "
+ "<if test='custom14In != null'>AND t.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(t.CUSTOM_14) LIKE #{item}</foreach>)</if> "
+ "<if test='custom15In != null'>AND t.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(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='wildcardSearchValueLike != null and wildcardSearchFieldIn != null'>AND (<foreach item='item' collection='wildcardSearchFieldIn' separator=' OR '>UPPER(t.${item}) LIKE #{wildcardSearchValueLike}</foreach>)</if> "
+ "</where>"
+ "</script>")
@SelectProvider(type = TaskQuerySqlProvider.class, method = "countQueryTasks")
Long countQueryTasks(TaskQueryImpl taskQuery);
@Select(
"<script> "
+ "WITH X (ID, WORKBASKET_ID) AS (SELECT <if test=\"useDistinctKeyword\">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>"
+ "<if test=\"joinWithClassifications\">"
+ "LEFT JOIN CLASSIFICATION AS c ON t.CLASSIFICATION_ID = c.ID "
+ "</if>"
+ "<if test=\"joinWithAttachmentClassifications\">"
+ "LEFT JOIN CLASSIFICATION AS ac ON a.CLASSIFICATION_ID = ac.ID "
+ "</if>"
+ "<where> "
+ "<if test='taskIds != null'>AND t.ID IN(<foreach item='item' collection='taskIds' separator=',' >#{item}</foreach>)</if> "
+ "<if test='externalIdIn != null'>AND t.EXTERNAL_ID IN(<foreach item='item' collection='externalIdIn' separator=',' >#{item}</foreach>)</if> "
+ "<if test='externalIdLike != null'>AND (<foreach item='item' collection='externalIdLike' separator=' OR '>UPPER(t.EXTERNAL_ID) LIKE #{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 t.CREATOR IN(<foreach item='item' collection='creatorIn' separator=',' >#{item}</foreach>)</if> "
+ "<if test='creatorLike != null'>AND (<foreach item='item' collection='creatorLike' separator=' OR '>UPPER(t.CREATOR) LIKE #{item}</foreach>)</if> "
+ "<if test='description != null'>AND (<foreach item='item' collection='description' separator=' OR '>t.DESCRIPTION LIKE #{item}</foreach>)</if> "
+ "<if test='noteLike != null'>AND (<foreach item='item' collection='noteLike' separator=' OR '>UPPER(t.NOTE) LIKE #{item}</foreach>)</if> "
+ "<if test='priority != null'>AND t.PRIORITY IN(<foreach item='item' collection='priority' separator=',' >#{item}</foreach>)</if> "
+ "<if test='stateIn != null'>AND t.STATE IN(<foreach item='item' collection='stateIn' separator=',' >#{item}</foreach>)</if> "
+ "<if test='callbackStateIn != null'>AND t.CALLBACK_STATE IN(<foreach item='item' collection='callbackStateIn' separator=',' >#{item}</foreach>)</if> "
+ "<if test='workbasketIdIn != null'>AND t.WORKBASKET_ID IN(<foreach item='item' collection='workbasketIdIn' separator=',' >#{item}</foreach>)</if> "
+ "<if test='workbasketKeyDomainIn != null'>AND (<foreach item='item' collection='workbasketKeyDomainIn' separator=' OR '>(t.WORKBASKET_KEY = #{item.key} AND t.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 t.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(t.CLASSIFICATION_CATEGORY) LIKE #{item}</foreach>)</if> "
+ "<if test='classificationNameIn != null'>AND c.NAME IN(<foreach item='item' collection='classificationNameIn' separator=',' >#{item}</foreach>)</if> "
+ "<if test='classificationNameLike != null'>AND (<foreach item='item' collection='classificationNameLike' separator=' OR '>UPPER(c.NAME) LIKE #{item}</foreach>)</if> "
+ "<if test='attachmentClassificationNameIn != null'>AND ac.NAME IN(<foreach item='item' collection='attachmentClassificationNameIn' separator=',' >#{item}</foreach>)</if> "
+ "<if test='attachmentClassificationNameLike != null'>AND (<foreach item='item' collection='attachmentClassificationNameLike' separator=' OR '>UPPER(ac.NAME) LIKE #{item}</foreach>)</if> "
+ "<if test='ownerIn != null'>AND t.OWNER IN(<foreach item='item' collection='ownerIn' separator=',' >#{item}</foreach>)</if> "
+ "<if test='ownerLike != null'>AND (<foreach item='item' collection='ownerLike' separator=' OR '>UPPER(t.OWNER) LIKE #{item}</foreach>)</if> "
+ "<if test='isRead != null'>AND t.IS_READ = #{isRead}</if> "
+ "<if test='isTransferred != null'>AND t.IS_TRANSFERRED = #{isTransferred}</if> "
+ "<if test='objectReferences != null'>"
+ "AND (<foreach item='item' collection='objectReferences' separator=' OR '> "
+ "<if test='item.company != null'>t.POR_COMPANY = #{item.company} </if>"
+ "<if test='item.system != null'> <if test='item.company != null'>AND</if> t.POR_SYSTEM = #{item.system} </if>"
+ "<if test='item.systemInstance != null'> <if test='item.company != null or item.system != null'>AND</if> t.POR_INSTANCE = #{item.systemInstance} </if>"
+ "<if test='item.type != null'> <if test='item.company != null or item.system != null or item.systemInstance != null'>AND</if> t.POR_TYPE = #{item.type} </if>"
+ "<if test='item.value != null'> <if test='item.company != null or item.system != null or item.systemInstance != null or item.type != null'>AND</if> t.POR_VALUE = #{item.value} </if>"
+ "</foreach>)</if>"
+ "<if test='porCompanyIn != null'>AND t.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(t.POR_COMPANY) LIKE #{item}</foreach>)</if> "
+ "<if test='porSystemIn != null'>AND t.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(t.POR_SYSTEM) LIKE #{item}</foreach>)</if> "
+ "<if test='porSystemInstanceIn != null'>AND t.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(t.POR_INSTANCE) LIKE #{item}</foreach>)</if> "
+ "<if test='porTypeIn != null'>AND t.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(t.POR_TYPE) LIKE #{item}</foreach>)</if> "
+ "<if test='porValueIn != null'>AND t.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(t.POR_VALUE) LIKE #{item}</foreach>)</if> "
+ "<if test='parentBusinessProcessIdIn != null'>AND t.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(t.PARENT_BUSINESS_PROCESS_ID) LIKE #{item}</foreach>)</if> "
+ "<if test='businessProcessIdIn != null'>AND t.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(t.BUSINESS_PROCESS_ID) LIKE #{item}</foreach>)</if> "
+ "<if test='custom1In != null'>AND t.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(t.CUSTOM_1) LIKE #{item}</foreach>)</if> "
+ "<if test='custom2In != null'>AND t.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(t.CUSTOM_2) LIKE #{item}</foreach>)</if> "
+ "<if test='custom3In != null'>AND t.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(t.CUSTOM_3) LIKE #{item}</foreach>)</if> "
+ "<if test='custom4In != null'>AND t.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(t.CUSTOM_4) LIKE #{item}</foreach>)</if> "
+ "<if test='custom5In != null'>AND t.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(t.CUSTOM_5) LIKE #{item}</foreach>)</if> "
+ "<if test='custom6In != null'>AND t.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(t.CUSTOM_6) LIKE #{item}</foreach>)</if> "
+ "<if test='custom7In != null'>AND t.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(t.CUSTOM_7) LIKE #{item}</foreach>)</if> "
+ "<if test='custom8In != null'>AND t.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(t.CUSTOM_8) LIKE #{item}</foreach>)</if> "
+ "<if test='custom9In != null'>AND t.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(t.CUSTOM_9) LIKE #{item}</foreach>)</if> "
+ "<if test='custom10In != null'>AND t.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(t.CUSTOM_10) LIKE #{item}</foreach>)</if> "
+ "<if test='custom11In != null'>AND t.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(t.CUSTOM_11) LIKE #{item}</foreach>)</if> "
+ "<if test='custom12In != null'>AND t.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(t.CUSTOM_12) LIKE #{item}</foreach>)</if> "
+ "<if test='custom13In != null'>AND t.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(t.CUSTOM_13) LIKE #{item}</foreach>)</if> "
+ "<if test='custom14In != null'>AND t.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(t.CUSTOM_14) LIKE #{item}</foreach>)</if> "
+ "<if test='custom15In != null'>AND t.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(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='wildcardSearchValueLike != null and wildcardSearchFieldIn != null'>AND (<foreach item='item' collection='wildcardSearchFieldIn' separator=' OR '>UPPER(t.${item}) LIKE #{wildcardSearchValueLike}</foreach>)</if> "
+ "</where> "
+ "), Y (ID, FLAG) AS "
+ "(SELECT ID, (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 COUNT(*) FROM Y WHERE FLAG = 1 "
+ "with UR "
+ "</script>")
@SelectProvider(type = TaskQuerySqlProvider.class, method = "countQueryTasksDb2")
Long countQueryTasksDb2(TaskQueryImpl taskQuery);
@Select(
"<script>SELECT COUNT(ID) FROM OBJECT_REFERENCE "
+ "<where>"
+ "<if test='company != null'>AND COMPANY IN(<foreach item='item' collection='company' separator=',' >#{item}</foreach>)</if> "
+ "<if test='system != null'>AND SYSTEM IN(<foreach item='item' collection='system' separator=',' >#{item}</foreach>)</if> "
+ "<if test='systemInstance != null'>AND SYSTEM_INSTANCE IN(<foreach item='item' collection='systemInstance' separator=',' >#{item}</foreach>)</if> "
+ "<if test='type != null'>AND TYPE IN(<foreach item='item' collection='type' separator=',' >#{item}</foreach>)</if> "
+ "<if test='value != null'>AND VALUE IN(<foreach item='item' collection='value' separator=',' >#{item}</foreach>)</if> "
+ "</where>"
+ "<if test=\"_databaseId == 'db2'\">with UR </if> "
+ "</script>")
@SelectProvider(type = TaskQuerySqlProvider.class, method = "countQueryObjectReferences")
Long countQueryObjectReferences(ObjectReferenceQueryImpl objectReference);
@Select(
"<script>SELECT DISTINCT ${columnName} "
+ "FROM TASK t "
+ "<if test=\"joinWithAttachments\">"
+ "LEFT JOIN ATTACHMENT AS a ON t.ID = a.TASK_ID "
+ "</if>"
+ "<if test=\"joinWithClassifications\">"
+ "LEFT JOIN CLASSIFICATION AS c ON t.CLASSIFICATION_ID = c.ID "
+ "</if>"
+ "<if test=\"joinWithAttachmentClassifications\">"
+ "LEFT JOIN CLASSIFICATION AS ac ON a.CLASSIFICATION_ID = ac.ID "
+ "</if>"
+ "<where>"
+ "<if test='accessIdIn != null'> "
+ "AND t.WORKBASKET_ID IN ( "
+ "select WID from (select WORKBASKET_ID as WID, MAX(PERM_READ) as MAX_READ FROM WORKBASKET_ACCESS_LIST where "
+ "ACCESS_ID IN (<foreach item='item' collection='accessIdIn' separator=',' >#{item}</foreach>) "
+ "group by WORKBASKET_ID ) where max_read = 1 ) "
+ "</if> "
+ "<if test='taskIds != null'>AND t.ID IN(<foreach item='item' collection='taskIds' separator=',' >#{item}</foreach>)</if> "
+ "<if test='externalIdIn != null'>AND t.EXTERNAL_ID IN(<foreach item='item' collection='externalIdIn' separator=',' >#{item}</foreach>)</if> "
+ "<if test='externalIdLike != null'>AND (<foreach item='item' collection='externalIdLike' separator=' OR '>UPPER(t.EXTERNAL_ID) LIKE #{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 t.CREATOR IN(<foreach item='item' collection='creatorIn' separator=',' >#{item}</foreach>)</if> "
+ "<if test='creatorLike != null'>AND (<foreach item='item' collection='creatorLike' separator=' OR '>UPPER(t.CREATOR) LIKE #{item}</foreach>)</if> "
+ "<if test='description != null'>AND (<foreach item='item' collection='description' separator=' OR '>t.DESCRIPTION LIKE #{item}</foreach>)</if> "
+ "<if test='noteLike != null'>AND (<foreach item='item' collection='noteLike' separator=' OR '>UPPER(t.NOTE) LIKE #{item}</foreach>)</if> "
+ "<if test='priority != null'>AND t.PRIORITY IN(<foreach item='item' collection='priority' separator=',' >#{item}</foreach>)</if> "
+ "<if test='stateIn != null'>AND t.STATE IN(<foreach item='item' collection='stateIn' separator=',' >#{item}</foreach>)</if> "
+ "<if test='callbackStateIn != null'>AND t.CALLBACK_STATE IN(<foreach item='item' collection='callbackStateIn' separator=',' >#{item}</foreach>)</if> "
+ "<if test='workbasketIdIn != null'>AND t.WORKBASKET_ID IN(<foreach item='item' collection='workbasketIdIn' separator=',' >#{item}</foreach>)</if> "
+ "<if test='workbasketKeyDomainIn != null'>AND (<foreach item='item' collection='workbasketKeyDomainIn' separator=' OR '>(t.WORKBASKET_KEY = #{item.key} AND t.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 t.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(t.CLASSIFICATION_CATEGORY) LIKE #{item}</foreach>)</if> "
+ "<if test='classificationNameIn != null'>AND c.NAME IN(<foreach item='item' collection='classificationNameIn' separator=',' >#{item}</foreach>)</if> "
+ "<if test='classificationNameLike != null'>AND (<foreach item='item' collection='classificationNameLike' separator=' OR '>UPPER(c.NAME) LIKE #{item}</foreach>)</if> "
+ "<if test='attachmentClassificationNameIn != null'>AND ac.NAME IN(<foreach item='item' collection='attachmentClassificationNameIn' separator=',' >#{item}</foreach>)</if> "
+ "<if test='attachmentClassificationNameLike != null'>AND (<foreach item='item' collection='attachmentClassificationNameLike' separator=' OR '>UPPER(ac.NAME) LIKE #{item}</foreach>)</if> "
+ "<if test='ownerIn != null'>AND t.OWNER IN(<foreach item='item' collection='ownerIn' separator=',' >#{item}</foreach>)</if> "
+ "<if test='ownerLike != null'>AND (<foreach item='item' collection='ownerLike' separator=' OR '>UPPER(t.OWNER) LIKE #{item}</foreach>)</if> "
+ "<if test='isRead != null'>AND t.IS_READ = #{isRead}</if> "
+ "<if test='isTransferred != null'>AND t.IS_TRANSFERRED = #{isTransferred}</if> "
+ "<if test='porCompanyIn != null'>AND t.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(t.POR_COMPANY) LIKE #{item}</foreach>)</if> "
+ "<if test='porSystemIn != null'>AND t.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(t.POR_SYSTEM) LIKE #{item}</foreach>)</if> "
+ "<if test='porSystemInstanceIn != null'>AND t.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(t.POR_INSTANCE) LIKE #{item}</foreach>)</if> "
+ "<if test='porTypeIn != null'>AND t.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(t.POR_TYPE) LIKE #{item}</foreach>)</if> "
+ "<if test='porValueIn != null'>AND t.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(t.POR_VALUE) LIKE #{item}</foreach>)</if> "
+ "<if test='parentBusinessProcessIdIn != null'>AND t.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(t.PARENT_BUSINESS_PROCESS_ID) LIKE #{item}</foreach>)</if> "
+ "<if test='businessProcessIdIn != null'>AND t.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(t.BUSINESS_PROCESS_ID) LIKE #{item}</foreach>)</if> "
+ "<if test='custom1In != null'>AND t.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(t.CUSTOM_1) LIKE #{item}</foreach>)</if> "
+ "<if test='custom2In != null'>AND t.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(t.CUSTOM_2) LIKE #{item}</foreach>)</if> "
+ "<if test='custom3In != null'>AND t.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(t.CUSTOM_3) LIKE #{item}</foreach>)</if> "
+ "<if test='custom4In != null'>AND t.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(t.CUSTOM_4) LIKE #{item}</foreach>)</if> "
+ "<if test='custom5In != null'>AND t.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(t.CUSTOM_5) LIKE #{item}</foreach>)</if> "
+ "<if test='custom6In != null'>AND t.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(t.CUSTOM_6) LIKE #{item}</foreach>)</if> "
+ "<if test='custom7In != null'>AND t.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(t.CUSTOM_7) LIKE #{item}</foreach>)</if> "
+ "<if test='custom8In != null'>AND t.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(t.CUSTOM_8) LIKE #{item}</foreach>)</if> "
+ "<if test='custom9In != null'>AND t.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(t.CUSTOM_9) LIKE #{item}</foreach>)</if> "
+ "<if test='custom10In != null'>AND t.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(t.CUSTOM_10) LIKE #{item}</foreach>)</if> "
+ "<if test='custom11In != null'>AND t.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(t.CUSTOM_11) LIKE #{item}</foreach>)</if> "
+ "<if test='custom12In != null'>AND t.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(t.CUSTOM_12) LIKE #{item}</foreach>)</if> "
+ "<if test='custom13In != null'>AND t.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(t.CUSTOM_13) LIKE #{item}</foreach>)</if> "
+ "<if test='custom14In != null'>AND t.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(t.CUSTOM_14) LIKE #{item}</foreach>)</if> "
+ "<if test='custom15In != null'>AND t.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(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=',' >"
+ "<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>"
+ "<when test=\"item.contains('CLASSIFICATION_NAME DESC')\">"
+ "c.NAME DESC"
+ "</when>"
+ "<when test=\"item.contains('CLASSIFICATION_NAME ASC')\">"
+ "c.NAME ASC"
+ "</when>"
+ "<when test=\"item.contains('A_CLASSIFICATION_NAME DESC')\">"
+ "ac.NAME DESC"
+ "</when>"
+ "<when test=\"item.contains('A_CLASSIFICATION_NAME ASC')\">"
+ "ac.NAME ASC"
+ "</when>"
+ "<otherwise>"
+ "${item}"
+ "</otherwise>"
+ "</choose>"
+ "</foreach></if> "
+ "<if test=\"_databaseId == 'db2'\">with UR </if> "
+ "</script>")
@SelectProvider(type = TaskQuerySqlProvider.class, method = "queryTaskColumnValues")
List<String> queryTaskColumnValues(TaskQueryImpl taskQuery);
@Select(
"<script>SELECT DISTINCT ${columnName} "
+ "FROM OBJECT_REFERENCE "
+ "<where>"
+ "<if test='company != null'>AND COMPANY IN(<foreach item='item' collection='company' separator=',' >#{item}</foreach>)</if> "
+ "<if test='system != null'>AND SYSTEM IN(<foreach item='item' collection='system' separator=',' >#{item}</foreach>)</if> "
+ "<if test='systemInstance != null'>AND SYSTEM_INSTANCE IN(<foreach item='item' collection='systemInstance' separator=',' >#{item}</foreach>)</if> "
+ "<if test='type != null'>AND TYPE IN(<foreach item='item' collection='type' separator=',' >#{item}</foreach>)</if> "
+ "<if test='value != null'>AND VALUE IN(<foreach item='item' collection='value' separator=',' >#{item}</foreach>)</if> "
+ "</where>"
+ "<if test=\"_databaseId == 'db2'\">with UR </if> "
+ "</script>")
@SelectProvider(type = TaskQuerySqlProvider.class, method = "queryObjectReferenceColumnValues")
List<String> queryObjectReferenceColumnValues(ObjectReferenceQueryImpl objectReference);
}

View File

@ -0,0 +1,476 @@
package pro.taskana.task.internal;
import java.util.stream.IntStream;
@SuppressWarnings({"checkstyle:LineLength", "checkstyle:Indentation"})
public class TaskQuerySqlProvider {
private static final String OPENING_SCRIPT_TAG = "<script>";
private static final String CLOSING_SCRIPT_TAG = "</script>";
private static final String OPENING_WHERE_TAG = "<where>";
private static final String CLOSING_WHERE_TAG = "</where>";
private TaskQuerySqlProvider() {}
public static String queryTaskSummaries() {
return OPENING_SCRIPT_TAG
+ "SELECT <if test=\"useDistinctKeyword\">DISTINCT</if> t.ID, t.EXTERNAL_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>"
+ "<if test=\"addClassificationNameToSelectClauseForOrdering\">"
+ ", c.NAME "
+ "</if>"
+ "<if test=\"addAttachmentClassificationNameToSelectClauseForOrdering\">"
+ ", ac.NAME "
+ "</if>"
+ "<if test=\"addWorkbasketNameToSelectClauseForOrdering\">"
+ ", w.NAME "
+ "</if>"
+ "FROM TASK t "
+ "<if test=\"joinWithAttachments\">"
+ "LEFT JOIN ATTACHMENT AS a ON t.ID = a.TASK_ID "
+ "</if>"
+ "<if test=\"joinWithClassifications\">"
+ "LEFT JOIN CLASSIFICATION AS c ON t.CLASSIFICATION_ID = c.ID "
+ "</if>"
+ "<if test=\"joinWithAttachmentClassifications\">"
+ "LEFT JOIN CLASSIFICATION AS ac ON a.CLASSIFICATION_ID = ac.ID "
+ "</if>"
+ "<if test=\"joinWithWorkbaskets\">"
+ "LEFT JOIN WORKBASKET AS w ON t.WORKBASKET_ID = w.ID "
+ "</if>"
+ OPENING_WHERE_TAG
+ "<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 "
+ "ACCESS_ID IN (<foreach item='item' collection='accessIdIn' separator=',' >#{item}</foreach>) "
+ "group by WORKBASKET_ID ) AS f where max_read = 1 ) "
+ "</if> "
+ commonTaskWhereStatement()
+ "<if test='wildcardSearchValueLike != null and wildcardSearchFieldIn != null'>AND (<foreach item='item' collection='wildcardSearchFieldIn' separator=' OR '>UPPER(t.${item}) LIKE #{wildcardSearchValueLike}</foreach>)</if> "
+ commonTaskObjectReferenceWhereStatement()
+ "<if test='selectAndClaim == true'> AND t.STATE = 'READY' </if>"
+ CLOSING_WHERE_TAG
+ "<if test='!orderBy.isEmpty()'>ORDER BY <foreach item='item' collection='orderBy' separator=',' >${item}</foreach></if> "
+ "<if test='selectAndClaim == true'> FETCH FIRST ROW ONLY FOR UPDATE </if>"
+ "<if test=\"_databaseId == 'db2'\">WITH RS USE AND KEEP UPDATE LOCKS </if> "
+ CLOSING_SCRIPT_TAG;
}
public static String queryTaskSummariesDb2() {
return OPENING_SCRIPT_TAG
+ "WITH X (ID, EXTERNAL_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>"
+ "<if test=\"addClassificationNameToSelectClauseForOrdering\">"
+ ", CNAME "
+ "</if>"
+ "<if test=\"addAttachmentClassificationNameToSelectClauseForOrdering\">"
+ ", ACNAME "
+ "</if>"
+ "<if test=\"addWorkbasketNameToSelectClauseForOrdering\">"
+ ", WNAME "
+ "</if>"
+ " ) "
+ " AS (SELECT <if test=\"useDistinctKeyword\">DISTINCT</if> t.ID, t.EXTERNAL_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>"
+ "<if test=\"addClassificationNameToSelectClauseForOrdering\">"
+ ", c.NAME "
+ "</if>"
+ "<if test=\"addAttachmentClassificationNameToSelectClauseForOrdering\">"
+ ", ac.NAME "
+ "</if>"
+ "<if test=\"addWorkbasketNameToSelectClauseForOrdering\">"
+ ", w.NAME "
+ "</if>"
+ " FROM TASK t "
+ "<if test=\"joinWithAttachments\">"
+ "LEFT JOIN ATTACHMENT a ON t.ID = a.TASK_ID "
+ "</if>"
+ "<if test=\"joinWithClassifications\">"
+ "LEFT JOIN CLASSIFICATION AS c ON t.CLASSIFICATION_ID = c.ID "
+ "</if>"
+ "<if test=\"joinWithAttachmentClassifications\">"
+ "LEFT JOIN CLASSIFICATION AS ac ON a.CLASSIFICATION_ID = ac.ID "
+ "</if>"
+ "<if test=\"joinWithWorkbaskets\">"
+ "LEFT JOIN WORKBASKET AS w ON t.WORKBASKET_ID = w.ID "
+ "</if>"
+ OPENING_WHERE_TAG
+ commonTaskWhereStatement()
+ commonTaskObjectReferenceWhereStatement()
+ "<if test='wildcardSearchValueLike != null and wildcardSearchFieldIn != null'>AND (<foreach item='item' collection='wildcardSearchFieldIn' separator=' OR '>UPPER(t.${item}) LIKE #{wildcardSearchValueLike}</foreach>)</if> "
+ CLOSING_WHERE_TAG
+ "), Y (ID, EXTERNAL_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>"
+ "<if test=\"addClassificationNameToSelectClauseForOrdering\">"
+ ", CNAME "
+ "</if>"
+ "<if test=\"addAttachmentClassificationNameToSelectClauseForOrdering\">"
+ ", ACNAME "
+ "</if>"
+ "<if test=\"addWorkbasketNameToSelectClauseForOrdering\">"
+ ", WNAME "
+ "</if>"
+ ", FLAG ) "
+ "AS "
+ "(SELECT ID, EXTERNAL_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>"
+ "<if test=\"addClassificationNameToSelectClauseForOrdering\">"
+ ", CNAME "
+ "</if>"
+ "<if test=\"addAttachmentClassificationNameToSelectClauseForOrdering\">"
+ ", ACNAME "
+ "</if>"
+ "<if test=\"addWorkbasketNameToSelectClauseForOrdering\">"
+ ", WNAME "
+ "</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, EXTERNAL_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>"
+ "<if test=\"addClassificationNameToSelectClauseForOrdering\">"
+ ", CNAME "
+ "</if>"
+ "<if test=\"addAttachmentClassificationNameToSelectClauseForOrdering\">"
+ ", ACNAME "
+ "</if>"
+ "<if test=\"addWorkbasketNameToSelectClauseForOrdering\">"
+ ", WNAME "
+ "</if>"
+ " FROM Y WHERE FLAG = 1 "
+ "<if test='!orderBy.isEmpty()'>ORDER BY <foreach item='item' collection='orderBy' separator=',' >"
+ "${item}"
+ "</foreach>"
+ "</if> "
+ "<if test='selectAndClaim == true'>FETCH FIRST ROW ONLY FOR UPDATE WITH RS USE AND KEEP UPDATE LOCKS</if>"
+ "<if test='selectAndClaim == false'> with UR</if>"
+ CLOSING_SCRIPT_TAG;
}
public static String queryObjectReferences() {
return OPENING_SCRIPT_TAG
+ "SELECT ID, COMPANY, SYSTEM, SYSTEM_INSTANCE, TYPE, VALUE "
+ "FROM OBJECT_REFERENCE "
+ OPENING_WHERE_TAG
+ commonObjectReferenceWhereStatement()
+ CLOSING_WHERE_TAG
+ "<if test=\"_databaseId == 'db2'\">with UR </if> "
+ CLOSING_SCRIPT_TAG;
}
public static String countQueryTasks() {
return OPENING_SCRIPT_TAG
+ "SELECT COUNT( <if test=\"useDistinctKeyword\">DISTINCT</if> t.ID) FROM TASK t "
+ "<if test=\"joinWithAttachments\">"
+ "LEFT JOIN ATTACHMENT AS a ON t.ID = a.TASK_ID "
+ "</if>"
+ "<if test=\"joinWithClassifications\">"
+ "LEFT JOIN CLASSIFICATION AS c ON t.CLASSIFICATION_ID = c.ID "
+ "</if>"
+ "<if test=\"joinWithAttachmentClassifications\">"
+ "LEFT JOIN CLASSIFICATION AS ac ON a.CLASSIFICATION_ID = ac.ID "
+ "</if>"
+ OPENING_WHERE_TAG
+ "<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 "
+ "ACCESS_ID IN (<foreach item='item' collection='accessIdIn' separator=',' >#{item}</foreach>) "
+ "group by WORKBASKET_ID ) AS f where max_read = 1 ) "
+ "</if> "
+ commonTaskWhereStatement()
+ commonTaskObjectReferenceWhereStatement()
+ "<if test='wildcardSearchValueLike != null and wildcardSearchFieldIn != null'>AND (<foreach item='item' collection='wildcardSearchFieldIn' separator=' OR '>UPPER(t.${item}) LIKE #{wildcardSearchValueLike}</foreach>)</if> "
+ CLOSING_WHERE_TAG
+ CLOSING_SCRIPT_TAG;
}
public static String countQueryTasksDb2() {
return OPENING_SCRIPT_TAG
+ "WITH X (ID, WORKBASKET_ID) AS (SELECT <if test=\"useDistinctKeyword\">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>"
+ "<if test=\"joinWithClassifications\">"
+ "LEFT JOIN CLASSIFICATION AS c ON t.CLASSIFICATION_ID = c.ID "
+ "</if>"
+ "<if test=\"joinWithAttachmentClassifications\">"
+ "LEFT JOIN CLASSIFICATION AS ac ON a.CLASSIFICATION_ID = ac.ID "
+ "</if>"
+ OPENING_WHERE_TAG
+ commonTaskWhereStatement()
+ commonTaskObjectReferenceWhereStatement()
+ "<if test='wildcardSearchValueLike != null and wildcardSearchFieldIn != null'>AND (<foreach item='item' collection='wildcardSearchFieldIn' separator=' OR '>UPPER(t.${item}) LIKE #{wildcardSearchValueLike}</foreach>)</if> "
+ CLOSING_WHERE_TAG
+ "), Y (ID, FLAG) AS "
+ "(SELECT ID, (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 COUNT(*) FROM Y WHERE FLAG = 1 "
+ "with UR "
+ CLOSING_SCRIPT_TAG;
}
public static String countQueryObjectReferences() {
return OPENING_SCRIPT_TAG
+ "SELECT COUNT(ID) FROM OBJECT_REFERENCE "
+ OPENING_WHERE_TAG
+ commonObjectReferenceWhereStatement()
+ CLOSING_WHERE_TAG
+ "<if test=\"_databaseId == 'db2'\">with UR </if> "
+ CLOSING_SCRIPT_TAG;
}
public static String queryTaskColumnValues() {
return OPENING_SCRIPT_TAG
+ "SELECT DISTINCT ${columnName} "
+ "FROM TASK t "
+ "<if test=\"joinWithAttachments\">"
+ "LEFT JOIN ATTACHMENT AS a ON t.ID = a.TASK_ID "
+ "</if>"
+ "<if test=\"joinWithClassifications\">"
+ "LEFT JOIN CLASSIFICATION AS c ON t.CLASSIFICATION_ID = c.ID "
+ "</if>"
+ "<if test=\"joinWithAttachmentClassifications\">"
+ "LEFT JOIN CLASSIFICATION AS ac ON a.CLASSIFICATION_ID = ac.ID "
+ "</if>"
+ OPENING_WHERE_TAG
+ "<if test='accessIdIn != null'> "
+ "AND t.WORKBASKET_ID IN ( "
+ "select WID from (select WORKBASKET_ID as WID, MAX(PERM_READ) as MAX_READ FROM WORKBASKET_ACCESS_LIST where "
+ "ACCESS_ID IN (<foreach item='item' collection='accessIdIn' separator=',' >#{item}</foreach>) "
+ "group by WORKBASKET_ID ) where max_read = 1 ) "
+ "</if> "
+ commonTaskWhereStatement()
+ CLOSING_WHERE_TAG
+ "<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>"
+ "<when test=\"item.contains('CLASSIFICATION_NAME DESC')\">"
+ "c.NAME DESC"
+ "</when>"
+ "<when test=\"item.contains('CLASSIFICATION_NAME ASC')\">"
+ "c.NAME ASC"
+ "</when>"
+ "<when test=\"item.contains('A_CLASSIFICATION_NAME DESC')\">"
+ "ac.NAME DESC"
+ "</when>"
+ "<when test=\"item.contains('A_CLASSIFICATION_NAME ASC')\">"
+ "ac.NAME ASC"
+ "</when>"
+ "<otherwise>"
+ "${item}"
+ "</otherwise>"
+ "</choose>"
+ "</foreach></if> "
+ "<if test=\"_databaseId == 'db2'\">with UR </if> "
+ CLOSING_SCRIPT_TAG;
}
public static String queryObjectReferenceColumnValues() {
return OPENING_SCRIPT_TAG
+ "SELECT DISTINCT ${columnName} "
+ "FROM OBJECT_REFERENCE "
+ OPENING_WHERE_TAG
+ commonObjectReferenceWhereStatement()
+ CLOSING_WHERE_TAG
+ "<if test=\"_databaseId == 'db2'\">with UR </if> "
+ CLOSING_SCRIPT_TAG;
}
private static String commonTaskObjectReferenceWhereStatement() {
return "<if test='objectReferences != null'>"
+ "AND (<foreach item='item' collection='objectReferences' separator=' OR '> "
+ "<if test='item.company != null'>t.POR_COMPANY = #{item.company} </if>"
+ "<if test='item.system != null'> <if test='item.company != null'>AND</if> t.POR_SYSTEM = #{item.system} </if>"
+ "<if test='item.systemInstance != null'> <if test='item.company != null or item.system != null'>AND</if> t.POR_INSTANCE = #{item.systemInstance} </if>"
+ "<if test='item.type != null'> <if test='item.company != null or item.system != null or item.systemInstance != null'>AND</if> t.POR_TYPE = #{item.type} </if>"
+ "<if test='item.value != null'> <if test='item.company != null or item.system != null or item.systemInstance != null or item.type != null'>AND</if> t.POR_VALUE = #{item.value} </if>"
+ "</foreach>)</if>";
}
private static String commonObjectReferenceWhereStatement() {
StringBuilder sb = new StringBuilder();
whereIn("company", "COMPANY", sb);
whereIn("system", "SYSTEM", sb);
whereIn("systemInstance", "SYSTEM_INSTANCE", sb);
whereIn("type", "TYPE", sb);
whereIn("value", "VALUE", sb);
return sb.toString();
}
private static String commonTaskWhereStatement() {
StringBuilder sb = new StringBuilder();
whereIn("taskIds", "t.ID", sb);
whereIn("priority", "PRIORITY", sb);
whereIn("externalIdIn", "t.EXTERNAL_ID", sb);
whereIn("nameIn", "t.NAME", sb);
whereIn("creatorIn", "CREATOR", sb);
whereIn("stateIn", "STATE", sb);
whereIn("callbackStateIn", "t.CALLBACK_STATE", sb);
whereIn("workbasketIdIn", "WORKBASKET_ID", sb);
whereIn("classificationKeyIn", "t.CLASSIFICATION_KEY", sb);
whereIn("classificationIdIn", "t.CLASSIFICATION_ID", sb);
whereIn("classificationCategoryIn", "CLASSIFICATION_CATEGORY", sb);
whereIn("classificationNameIn", "c.NAME", sb);
whereIn("attachmentClassificationNameIn", "ac.NAME", sb);
whereIn("ownerIn", "OWNER", sb);
whereIn("porCompanyIn", "POR_COMPANY", sb);
whereIn("porSystemIn", "POR_SYSTEM", sb);
whereIn("porSystemInstanceIn", "POR_INSTANCE", sb);
whereIn("porTypeIn", "POR_TYPE", sb);
whereIn("porValueIn", "POR_VALUE", sb);
whereIn("parentBusinessProcessIdIn", "PARENT_BUSINESS_PROCESS_ID", sb);
whereIn("businessProcessIdIn", "BUSINESS_PROCESS_ID", sb);
whereIn("attachmentClassificationKeyIn", "a.CLASSIFICATION_KEY", sb);
whereIn("attachmentClassificationIdIn", "a.CLASSIFICATION_ID", sb);
whereIn("attachmentChannelIn", "a.CHANNEL", sb);
whereIn("attachmentReferenceIn", "a.REF_VALUE", sb);
whereInTime("createdIn", "t.CREATED", sb);
whereInTime("claimedIn", "t.CLAIMED", sb);
whereInTime("completedIn", "t.COMPLETED", sb);
whereInTime("modifiedIn", "t.MODIFIED", sb);
whereInTime("plannedIn", "t.PLANNED", sb);
whereInTime("dueIn", "t.DUE", sb);
whereInTime("attachmentReceivedIn", "a.RECEIVED", sb);
whereNotIn("classificationKeyNotIn", "t.CLASSIFICATION_KEY", sb);
whereLike("externalIdLike", "t.EXTERNAL_ID", sb);
whereLike("nameLike", "t.NAME", sb);
whereLike("creatorLike", "CREATOR", sb);
whereLike("noteLike", "NOTE", sb);
whereLike("classificationKeyLike", "t.CLASSIFICATION_KEY", sb);
whereLike("classificationCategoryLike", "CLASSIFICATION_CATEGORY", sb);
whereLike("classificationNameLike", "c.NAME", sb);
whereLike("attachmentClassificationNameLike", "ac.NAME", sb);
whereLike("ownerLike", "OWNER", sb);
whereLike("porCompanyLike", "POR_COMPANY", sb);
whereLike("porSystemLike", "POR_SYSTEM", sb);
whereLike("porSystemInstanceLike", "POR_INSTANCE", sb);
whereLike("porTypeLike", "POR_TYPE", sb);
whereLike("porValueLike", "POR_VALUE", sb);
whereLike("parentBusinessProcessIdLike", "PARENT_BUSINESS_PROCESS_ID", sb);
whereLike("businessProcessIdLike", "BUSINESS_PROCESS_ID", sb);
whereLike("attachmentClassificationKeyLike", "a.CLASSIFICATION_KEY", sb);
whereLike("attachmentClassificationIdLike", "a.CLASSIFICATION_ID", sb);
whereLike("attachmentChannelLike", "a.CHANNEL", sb);
whereLike("attachmentReferenceLike", "a.REF_VALUE", sb);
whereLike("description", "DESCRIPTION", sb);
whereCustomStatements(sb);
sb.append("<if test='isRead != null'>AND IS_READ = #{isRead}</if> ");
sb.append("<if test='isTransferred != null'>AND IS_TRANSFERRED = #{isTransferred}</if> ");
sb.append(
"<if test='workbasketKeyDomainIn != null'>AND (<foreach item='item' collection='workbasketKeyDomainIn' separator=' OR '>(WORKBASKET_KEY = #{item.key} AND DOMAIN = #{item.domain})</foreach>)</if> ");
return sb.toString();
}
private static void whereCustomStatements(StringBuilder sb) {
IntStream.rangeClosed(1, 16)
.forEach(
x -> {
String collectionIn = "custom" + x + "In";
String collectionNotIn = "custom" + x + "NotIn";
String collectionLike = "custom" + x + "Like";
String column = "CUSTOM_" + x;
whereIn(collectionIn, column, sb);
whereLike(collectionLike, column, sb);
whereNotIn(collectionNotIn, column, sb);
});
}
private static void whereIn(String collection, String column, StringBuilder sb) {
sb.append("<if test='")
.append(collection)
.append(" != null'>AND ")
.append(column)
.append(" IN(<foreach item='item' collection='")
.append(collection)
.append("' separator=',' >#{item}</foreach>)</if> ");
}
private static void whereNotIn(String collection, String column, StringBuilder sb) {
sb.append("<if test='")
.append(collection)
.append(" != null'>AND ")
.append(column)
.append(" NOT IN(<foreach item='item' collection='")
.append(collection)
.append("' separator=',' >#{item}</foreach>)</if> ");
}
private static void whereInTime(String collection, String column, StringBuilder sb) {
sb.append("<if test='")
.append(collection)
.append(" !=null'> AND (<foreach item='item' collection='")
.append(collection)
.append("' separator=' OR ' > ( <if test='item.begin!=null'> ")
.append(column)
.append(
" &gt;= #{item.begin} </if> <if test='item.begin!=null and item.end!=null'> AND </if><if test='item.end!=null'> ")
.append(column)
.append(" &lt;=#{item.end} </if>)</foreach>)</if> ");
}
private static void whereLike(String collection, String column, StringBuilder sb) {
sb.append("<if test='")
.append(collection)
.append(" != null'>AND (<foreach item='item' collection='")
.append(collection)
.append("' separator=' OR '>UPPER(")
.append(column)
.append(") LIKE #{item}</foreach>)</if> ");
}
}

View File

@ -28,6 +28,7 @@ import java.util.stream.Stream;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.annotations.Update;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Disabled;
@ -331,7 +332,8 @@ class ArchitectureTest {
for (JavaMethod method : javaClass.getAllMethods()) {
List<String> sqlStrings = getSqlStringsFromMethod.apply(method);
if (sqlStrings.isEmpty()) {
if (sqlStrings.isEmpty()
&& !method.tryGetAnnotationOfType(SelectProvider.class).isPresent()) {
String message =
String.format(
"Method '%s#%s' does not contain any MyBatis SQL annotation",

View File

@ -25,6 +25,7 @@ import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import org.apache.ibatis.session.Configuration;
import org.apache.ibatis.session.SqlSession;
@ -163,6 +164,20 @@ class QueryTasksAccTest extends AbstractAccTest {
}
}
@WithAccessId(user = "admin")
@Test
void should_ReturnCorrectResults_When_QueryingForDescriptionAndPriority() {
List<TaskSummary> results1 = TASK_SERVICE.createTaskQuery().descriptionLike("Lorem%").list();
assertThat(results1).extracting(TaskSummary::getDescription).hasSize(7);
List<TaskSummary> results2 = TASK_SERVICE.createTaskQuery().priorityIn(1).list();
assertThat(results2).extracting(TaskSummary::getPriority).hasSize(2);
List<TaskSummary> results3 =
TASK_SERVICE.createTaskQuery().descriptionLike("Lorem%").priorityIn(1).list();
assertThat(results3).hasSize(2);
}
@WithAccessId(user = "admin")
@Test
void testQueryForParentBusinessProcessId() {
@ -273,7 +288,7 @@ class QueryTasksAccTest extends AbstractAccTest {
@WithAccessId(user = "admin")
@TestFactory
Stream<DynamicTest> testQueryForCustomX() {
Stream<DynamicTest> should_ReturnCorrectResults_When_QueryingForCustomXLikeInAndNotIn() {
List<Triplet<TaskCustomField, String[], Integer>> list =
List.of(
Triplet.of(TaskCustomField.CUSTOM_1, new String[] {"custom%", "p%", "%xyz%", "efg"}, 3),
@ -306,12 +321,41 @@ class QueryTasksAccTest extends AbstractAccTest {
TASK_SERVICE.createTaskQuery().customAttributeLike(customField, searchArguments).list();
assertThat(results).hasSize(expectedResult);
String[] ids =
String[] customAttributes =
results.stream().map(t -> t.getCustomAttribute(customField)).toArray(String[]::new);
List<TaskSummary> result2 =
TASK_SERVICE.createTaskQuery().customAttributeIn(customField, ids).list();
TASK_SERVICE.createTaskQuery().customAttributeIn(customField, customAttributes).list();
assertThat(result2).hasSize(expectedResult);
List<String> allCustomAttributesWithValues =
TASK_SERVICE.createTaskQuery().list().stream()
.map(t -> t.getCustomAttribute(customField))
.filter(Objects::nonNull)
.collect(Collectors.toList());
// NotIn with an empty String should return all Tasks with a value in the specified customField
List<TaskSummary> results3 =
TASK_SERVICE.createTaskQuery().customAttributeNotIn(customField, "").list();
assertThat(results3)
.extracting(t -> t.getCustomAttribute(customField))
.isEqualTo(allCustomAttributesWithValues);
List<String> customAttributeList = Arrays.asList(customAttributes);
List<String> allCustomAttributesWithValuesExceptResult2 =
allCustomAttributesWithValues.stream()
.filter(s -> !customAttributeList.contains(s))
.collect(Collectors.toList());
/* NotIn with the already used customAttributes should result in all Tasks with values in the
specified customField, except the ones specified in customAttributes*/
List<TaskSummary> results4 =
TASK_SERVICE.createTaskQuery().customAttributeNotIn(customField, customAttributes).list();
assertThat(results4)
.extracting(t -> t.getCustomAttribute(customField))
.isEqualTo(allCustomAttributesWithValuesExceptResult2);
}
@WithAccessId(user = "admin")
@ -389,7 +433,7 @@ class QueryTasksAccTest extends AbstractAccTest {
@WithAccessId(user = "admin")
@Test
void testQueryAndCountMatch() {
void should_QueryAndCountMatch_When_CalledWithSameQuery() {
TaskQuery taskQuery = TASK_SERVICE.createTaskQuery();
List<TaskSummary> tasks = taskQuery.nameIn("Task99", "Task01", "Widerruf").list();
long numberOfTasks = taskQuery.nameIn("Task99", "Task01", "Widerruf").count();
@ -573,7 +617,7 @@ class QueryTasksAccTest extends AbstractAccTest {
@WithAccessId(user = "admin")
@Test
void testQueryForOrderByCreatorDesc() {
void should_ReturnOrderedResult_When_OrderByCreatorDescIsSet() {
List<TaskSummary> results = TASK_SERVICE.createTaskQuery().orderByCreator(DESCENDING).list();
assertThat(results)
@ -584,7 +628,7 @@ class QueryTasksAccTest extends AbstractAccTest {
@WithAccessId(user = "admin")
@Test
void testQueryForOrderByWorkbasketIdDesc() {
void should_ReturnOrderedResult_When_OrderByWorkbasketIdDescIsSet() {
List<TaskSummary> results =
TASK_SERVICE.createTaskQuery().orderByWorkbasketId(DESCENDING).list();
@ -597,26 +641,27 @@ class QueryTasksAccTest extends AbstractAccTest {
@WithAccessId(user = "admin")
@TestFactory
Stream<DynamicTest> testQueryForOrderByCustomXAsc() {
Stream<DynamicTest> should_ReturnOrderedResult_When_OrderByCustomXAscIsSet() {
Iterator<TaskCustomField> iterator = Arrays.stream(TaskCustomField.values()).iterator();
return DynamicTest.stream(
iterator,
s -> String.format("order by %s asc", s),
s -> testQueryForOrderByCustomX(s, ASCENDING));
s -> should_ReturnOrderedResult_When_OrderByCustomFieldInSortDirectionIsSet(s, ASCENDING));
}
@WithAccessId(user = "admin")
@TestFactory
Stream<DynamicTest> testQueryForOrderByCustomXDesc() {
Stream<DynamicTest> should_ReturnOrderedResult_When_OrderByCustomXDescIsSet() {
Iterator<TaskCustomField> iterator = Arrays.stream(TaskCustomField.values()).iterator();
return DynamicTest.stream(
iterator,
s -> String.format("order by %s desc", s),
s -> testQueryForOrderByCustomX(s, DESCENDING));
s -> should_ReturnOrderedResult_When_OrderByCustomFieldInSortDirectionIsSet(s, DESCENDING));
}
void testQueryForOrderByCustomX(TaskCustomField customField, SortDirection sortDirection) {
void should_ReturnOrderedResult_When_OrderByCustomFieldInSortDirectionIsSet(
TaskCustomField customField, SortDirection sortDirection) {
List<TaskSummary> results =
TASK_SERVICE.createTaskQuery().orderByCustomAttribute(customField, sortDirection).list();

View File

@ -21,7 +21,7 @@ class QueryTasksByObjectReferenceAccTest extends AbstractAccTest {
@WithAccessId(user = "admin")
@Test
void testQueryTasksByExcactValueOfObjectReference() {
void should_ApplyObjectReferenceFilter_When_ExactValueIsSet() {
List<TaskSummary> results =
TASK_SERVICE.createTaskQuery().primaryObjectReferenceValueIn("11223344", "22334455").list();
assertThat(results).hasSize(33);
@ -121,7 +121,7 @@ class QueryTasksByObjectReferenceAccTest extends AbstractAccTest {
@WithAccessId(user = "admin")
@Test
void testQueryTasksByExactValueAndTypeOfObjectReference() {
void should_ApplyObjectReferenceFilter_When_ExactValueAndTypeAreSet() {
List<TaskSummary> results =
TASK_SERVICE
.createTaskQuery()
@ -133,7 +133,7 @@ class QueryTasksByObjectReferenceAccTest extends AbstractAccTest {
@WithAccessId(user = "admin")
@Test
void testQueryTasksByValueLikeOfObjectReference() {
void should_ApplyObjectReferenceFilter_When_ValueLikeIsSet() {
List<TaskSummary> results =
TASK_SERVICE.createTaskQuery().primaryObjectReferenceValueLike("%567%").list();
assertThat(results).hasSize(10);

View File

@ -2,6 +2,7 @@ package pro.taskana.common.rest;
import java.time.Instant;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import pro.taskana.common.api.BaseQuery;
@ -12,12 +13,7 @@ public interface QueryParameter<Q extends BaseQuery<?, ?>, R> {
R applyToQuery(Q query);
default String[] wrapElementsInLikeStatement(String[] list) {
if (list != null) {
for (int i = 0; i < list.length; i++) {
list[i] = "%" + list[i] + "%";
}
}
return list;
return Arrays.stream(list).map(item -> "%" + item + "%").toArray(String[]::new);
}
default TimeInterval[] extractTimeIntervals(Instant[] instants) {

View File

@ -466,6 +466,10 @@ public class TaskQueryFilterParameter implements QueryParameter<TaskQuery, Void>
@JsonProperty("custom-1")
private final String[] custom1;
/** Exclude values of the field custom1 of the task. */
@JsonProperty("custom-1-not-in")
private final String[] custom1NotIn;
/**
* Filter by the custom1 field of the task. This results in a substring search (% is appended to
* the front and end of the requested value). Further SQL "LIKE" wildcard characters will be
@ -478,6 +482,10 @@ public class TaskQueryFilterParameter implements QueryParameter<TaskQuery, Void>
@JsonProperty("custom-2")
private final String[] custom2;
/** Filter out by values of the field custom2 of the task. This is an exact match. */
@JsonProperty("custom-2-not-in")
private final String[] custom2NotIn;
/**
* Filter by the custom2 field of the task. This results in a substring search (% is appended to
* the front and end of the requested value). Further SQL "LIKE" wildcard characters will be
@ -490,6 +498,10 @@ public class TaskQueryFilterParameter implements QueryParameter<TaskQuery, Void>
@JsonProperty("custom-3")
private final String[] custom3;
/** Filter out by values of the field custom3 of the task. This is an exact match. */
@JsonProperty("custom-3-not-in")
private final String[] custom3NotIn;
/**
* Filter by the custom3 field of the task. This results in a substring search (% is appended to
* the front and end of the requested value). Further SQL "LIKE" wildcard characters will be
@ -502,6 +514,10 @@ public class TaskQueryFilterParameter implements QueryParameter<TaskQuery, Void>
@JsonProperty("custom-4")
private final String[] custom4;
/** Filter out by values of the field custom4 of the task. This is an exact match. */
@JsonProperty("custom-4-not-in")
private final String[] custom4NotIn;
/**
* Filter by the custom4 field of the task. This results in a substring search (% is appended to
* the front and end of the requested value). Further SQL "LIKE" wildcard characters will be
@ -514,6 +530,10 @@ public class TaskQueryFilterParameter implements QueryParameter<TaskQuery, Void>
@JsonProperty("custom-5")
private final String[] custom5;
/** Filter out by values of the field custom5 of the task. This is an exact match. */
@JsonProperty("custom-5-not-in")
private final String[] custom5NotIn;
/**
* Filter by the custom5 field of the task. This results in a substring search (% is appended to
* the front and end of the requested value). Further SQL "LIKE" wildcard characters will be
@ -526,6 +546,10 @@ public class TaskQueryFilterParameter implements QueryParameter<TaskQuery, Void>
@JsonProperty("custom-6")
private final String[] custom6;
/** Filter out by values of the field custom6 of the task. This is an exact match. */
@JsonProperty("custom-6-not-in")
private final String[] custom6NotIn;
/**
* Filter by the custom6 field of the task. This results in a substring search (% is appended to
* the front and end of the requested value). Further SQL "LIKE" wildcard characters will be
@ -538,6 +562,10 @@ public class TaskQueryFilterParameter implements QueryParameter<TaskQuery, Void>
@JsonProperty("custom-7")
private final String[] custom7;
/** Filter out by values of the field custom7 of the task. This is an exact match. */
@JsonProperty("custom-7-not-in")
private final String[] custom7NotIn;
/**
* Filter by the custom7 field of the task. This results in a substring search (% is appended to
* the front and end of the requested value). Further SQL "LIKE" wildcard characters will be
@ -550,6 +578,10 @@ public class TaskQueryFilterParameter implements QueryParameter<TaskQuery, Void>
@JsonProperty("custom-8")
private final String[] custom8;
/** Filter out by values of the field custom8 of the task. This is an exact match. */
@JsonProperty("custom-8-not-in")
private final String[] custom8NotIn;
/**
* Filter by the custom8 field of the task. This results in a substring search (% is appended to
* the front and end of the requested value). Further SQL "LIKE" wildcard characters will be
@ -562,6 +594,10 @@ public class TaskQueryFilterParameter implements QueryParameter<TaskQuery, Void>
@JsonProperty("custom-9")
private final String[] custom9;
/** Filter out by values of the field custom9 of the task. This is an exact match. */
@JsonProperty("custom-9-not-in")
private final String[] custom9NotIn;
/**
* Filter by the custom9 field of the task. This results in a substring search (% is appended to
* the front and end of the requested value). Further SQL "LIKE" wildcard characters will be
@ -574,6 +610,10 @@ public class TaskQueryFilterParameter implements QueryParameter<TaskQuery, Void>
@JsonProperty("custom-10")
private final String[] custom10;
/** Filter out by values of the field custom10 of the task. This is an exact match. */
@JsonProperty("custom-10-not-in")
private final String[] custom10NotIn;
/**
* Filter by the custom10 field of the task. This results in a substring search (% is appended to
* the front and end of the requested value). Further SQL "LIKE" wildcard characters will be
@ -586,6 +626,10 @@ public class TaskQueryFilterParameter implements QueryParameter<TaskQuery, Void>
@JsonProperty("custom-11")
private final String[] custom11;
/** Filter out by values of the field custom11 of the task. This is an exact match. */
@JsonProperty("custom-11-not-in")
private final String[] custom11NotIn;
/**
* Filter by the custom11 field of the task. This results in a substring search (% is appended to
* the front and end of the requested value). Further SQL "LIKE" wildcard characters will be
@ -598,6 +642,10 @@ public class TaskQueryFilterParameter implements QueryParameter<TaskQuery, Void>
@JsonProperty("custom-12")
private final String[] custom12;
/** Filter out by values of the field custom12 of the task. This is an exact match. */
@JsonProperty("custom-12-not-in")
private final String[] custom12NotIn;
/**
* Filter by the custom12 field of the task. This results in a substring search (% is appended to
* the front and end of the requested value). Further SQL "LIKE" wildcard characters will be
@ -610,6 +658,10 @@ public class TaskQueryFilterParameter implements QueryParameter<TaskQuery, Void>
@JsonProperty("custom-13")
private final String[] custom13;
/** Filter out by values of the field custom13 of the task. This is an exact match. */
@JsonProperty("custom-13-not-in")
private final String[] custom13NotIn;
/**
* Filter by the custom13 field of the task. This results in a substring search (% is appended to
* the front and end of the requested value). Further SQL "LIKE" wildcard characters will be
@ -622,6 +674,10 @@ public class TaskQueryFilterParameter implements QueryParameter<TaskQuery, Void>
@JsonProperty("custom-14")
private final String[] custom14;
/** Filter out by values of the field custom14 of the task. This is an exact match. */
@JsonProperty("custom-14-not-in")
private final String[] custom14NotIn;
/**
* Filter by the custom14 field of the task. This results in a substring search (% is appended to
* the front and end of the requested value). Further SQL "LIKE" wildcard characters will be
@ -634,6 +690,10 @@ public class TaskQueryFilterParameter implements QueryParameter<TaskQuery, Void>
@JsonProperty("custom-15")
private final String[] custom15;
/** Filter out by values of the field custom15 of the task. This is an exact match. */
@JsonProperty("custom-15-not-in")
private final String[] custom15NotIn;
/**
* Filter by the custom15 field of the task. This results in a substring search (% is appended to
* the front and end of the requested value). Further SQL "LIKE" wildcard characters will be
@ -641,11 +701,12 @@ public class TaskQueryFilterParameter implements QueryParameter<TaskQuery, Void>
*/
@JsonProperty("custom-15-like")
private final String[] custom15Like;
/** Filter by the value of the field custom16 of the task. This is an exact match. */
@JsonProperty("custom-16")
private final String[] custom16;
/** Filter out by values of the field custom16 of the task. This is an exact match. */
@JsonProperty("custom-16-not-in")
private final String[] custom16NotIn;
/**
* Filter by the custom16 field of the task. This results in a substring search (% is appended to
* the front and end of the requested value). Further SQL "LIKE" wildcard characters will be
@ -725,36 +786,52 @@ public class TaskQueryFilterParameter implements QueryParameter<TaskQuery, Void>
"external-id",
"external-id-like",
"custom-1",
"custom-1-not-in",
"custom-1-like",
"custom-2",
"custom-2-not-in",
"custom-2-like",
"custom-3",
"custom-3-not-in",
"custom-3-like",
"custom-4",
"custom-4-not-in",
"custom-4-like",
"custom-5",
"custom-5-not-in",
"custom-5-like",
"custom-6",
"custom-6-not-in",
"custom-6-like",
"custom-7",
"custom-7-not-in",
"custom-7-like",
"custom-8",
"custom-8-not-in",
"custom-8-like",
"custom-9",
"custom-9-not-in",
"custom-9-like",
"custom-10",
"custom-10-not-in",
"custom-10-like",
"custom-11",
"custom-11-not-in",
"custom-11-like",
"custom-12",
"custom-12-not-in",
"custom-12-like",
"custom-13",
"custom-13-not-in",
"custom-13-like",
"custom-14",
"custom-14-not-in",
"custom-14-like",
"custom-15",
"custom-15-not-in",
"custom-15-like",
"custom-16",
"custom-16-not-in",
"custom-16-like"
})
public TaskQueryFilterParameter(
@ -827,36 +904,52 @@ public class TaskQueryFilterParameter implements QueryParameter<TaskQuery, Void>
String[] externalIds,
String[] externalIdsLike,
String[] custom1,
String[] custom1NotIn,
String[] custom1Like,
String[] custom2,
String[] custom2NotIn,
String[] custom2Like,
String[] custom3,
String[] custom3NotIn,
String[] custom3Like,
String[] custom4,
String[] custom4NotIn,
String[] custom4Like,
String[] custom5,
String[] custom5NotIn,
String[] custom5Like,
String[] custom6,
String[] custom6NotIn,
String[] custom6Like,
String[] custom7,
String[] custom7NotIn,
String[] custom7Like,
String[] custom8,
String[] custom8NotIn,
String[] custom8Like,
String[] custom9,
String[] custom9NotIn,
String[] custom9Like,
String[] custom10,
String[] custom10NotIn,
String[] custom10Like,
String[] custom11,
String[] custom11NotIn,
String[] custom11Like,
String[] custom12,
String[] custom12NotIn,
String[] custom12Like,
String[] custom13,
String[] custom13NotIn,
String[] custom13Like,
String[] custom14,
String[] custom14NotIn,
String[] custom14Like,
String[] custom15,
String[] custom15NotIn,
String[] custom15Like,
String[] custom16,
String[] custom16NotIn,
String[] custom16Like)
throws InvalidArgumentException {
this.name = name;
@ -928,36 +1021,52 @@ public class TaskQueryFilterParameter implements QueryParameter<TaskQuery, Void>
this.externalIds = externalIds;
this.externalIdsLike = externalIdsLike;
this.custom1 = custom1;
this.custom1NotIn = custom1NotIn;
this.custom1Like = custom1Like;
this.custom2 = custom2;
this.custom2NotIn = custom2NotIn;
this.custom2Like = custom2Like;
this.custom3 = custom3;
this.custom3NotIn = custom3NotIn;
this.custom3Like = custom3Like;
this.custom4 = custom4;
this.custom4NotIn = custom4NotIn;
this.custom4Like = custom4Like;
this.custom5 = custom5;
this.custom5NotIn = custom5NotIn;
this.custom5Like = custom5Like;
this.custom6 = custom6;
this.custom6NotIn = custom6NotIn;
this.custom6Like = custom6Like;
this.custom7 = custom7;
this.custom7NotIn = custom7NotIn;
this.custom7Like = custom7Like;
this.custom8 = custom8;
this.custom8NotIn = custom8NotIn;
this.custom8Like = custom8Like;
this.custom9 = custom9;
this.custom9NotIn = custom9NotIn;
this.custom9Like = custom9Like;
this.custom10 = custom10;
this.custom10NotIn = custom10NotIn;
this.custom10Like = custom10Like;
this.custom11 = custom11;
this.custom11NotIn = custom11NotIn;
this.custom11Like = custom11Like;
this.custom12 = custom12;
this.custom12NotIn = custom12NotIn;
this.custom12Like = custom12Like;
this.custom13 = custom13;
this.custom13NotIn = custom13NotIn;
this.custom13Like = custom13Like;
this.custom14 = custom14;
this.custom14NotIn = custom14NotIn;
this.custom14Like = custom14Like;
this.custom15 = custom15;
this.custom15NotIn = custom15NotIn;
this.custom15Like = custom15Like;
this.custom16 = custom16;
this.custom16NotIn = custom16NotIn;
this.custom16Like = custom16Like;
validateFilterParameters();
@ -1107,6 +1216,27 @@ public class TaskQueryFilterParameter implements QueryParameter<TaskQuery, Void>
pair ->
Optional.ofNullable(pair.getRight())
.ifPresent(wrap(l -> query.customAttributeIn(pair.getLeft(), l))));
Stream.of(
Pair.of(TaskCustomField.CUSTOM_1, custom1NotIn),
Pair.of(TaskCustomField.CUSTOM_2, custom2NotIn),
Pair.of(TaskCustomField.CUSTOM_3, custom3NotIn),
Pair.of(TaskCustomField.CUSTOM_4, custom4NotIn),
Pair.of(TaskCustomField.CUSTOM_5, custom5NotIn),
Pair.of(TaskCustomField.CUSTOM_6, custom6NotIn),
Pair.of(TaskCustomField.CUSTOM_7, custom7NotIn),
Pair.of(TaskCustomField.CUSTOM_8, custom8NotIn),
Pair.of(TaskCustomField.CUSTOM_9, custom9NotIn),
Pair.of(TaskCustomField.CUSTOM_10, custom10NotIn),
Pair.of(TaskCustomField.CUSTOM_11, custom11NotIn),
Pair.of(TaskCustomField.CUSTOM_12, custom12NotIn),
Pair.of(TaskCustomField.CUSTOM_13, custom13NotIn),
Pair.of(TaskCustomField.CUSTOM_14, custom14NotIn),
Pair.of(TaskCustomField.CUSTOM_15, custom15NotIn),
Pair.of(TaskCustomField.CUSTOM_16, custom16NotIn))
.forEach(
pair ->
Optional.ofNullable(pair.getRight())
.ifPresent(wrap(l -> query.customAttributeNotIn(pair.getLeft(), l))));
Stream.of(
Pair.of(TaskCustomField.CUSTOM_1, custom1Like),
Pair.of(TaskCustomField.CUSTOM_2, custom2Like),