TSK-741 Add ClassificationName and AttachmentClassificationName to TaskQuery

This commit is contained in:
BerndBreier 2018-11-13 14:58:37 +01:00 committed by Holger Hagen
parent e77e54e0b2
commit 0bd103cb20
6 changed files with 592 additions and 169 deletions

View File

@ -154,6 +154,26 @@ public interface TaskQuery extends BaseQuery<TaskSummary, TaskQueryColumnName> {
*/
TaskQuery classificationCategoryLike(String... classificationCategories);
/**
* Add your classificationName to your query.
*
* @param classificationNames
* the classification name
* @return the query
*/
TaskQuery classificationNameIn(String... classificationNames);
/**
* Add your classificationName for pattern matching to your query. It will be compared in SQL with the LIKE operator.
* You may use a wildcard like % to specify the pattern. If you specify multiple arguments they are combined with
* the OR keyword.
* *
* @param classificationNames
* the classification name
* @return the query
*/
TaskQuery classificationNameLike(String... classificationNames);
/**
* Add your workbasket key to the query.
*
@ -496,6 +516,26 @@ public interface TaskQuery extends BaseQuery<TaskSummary, TaskQueryColumnName> {
*/
TaskQuery attachmentClassificationIdLike(String... attachmentClassificationId);
/**
* Add the attachment classification names for exact matching to your query.
*
* @param attachmentClassificationName
* the attachmentClassificationName values of the searched for tasks
* @return the query
*/
TaskQuery attachmentClassificationNameIn(String... attachmentClassificationName);
/**
* Add the values of attachment classification names 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 attachmentClassificationName
* the attachmentClassificationName values of the searched-for tasks
* @return the query
*/
TaskQuery attachmentClassificationNameLike(String... attachmentClassificationName);
/**
* Add the values of attachment channel for exact matching to your query.
*
@ -584,6 +624,16 @@ public interface TaskQuery extends BaseQuery<TaskSummary, TaskQueryColumnName> {
*/
TaskQuery orderByClassificationKey(SortDirection sortDirection);
/**
* This method sorts the query result according to the classification name.
*
* @param sortDirection
* Determines whether the result is sorted in ascending or descending order. If sortDirection is null,
* the result is sorted in ascending order
* @return the query
*/
TaskQuery orderByClassificationName(SortDirection sortDirection);
/**
* This method sorts the query result according to the completed timestamp.
*
@ -820,6 +870,16 @@ public interface TaskQuery extends BaseQuery<TaskSummary, TaskQueryColumnName> {
*/
TaskQuery orderByAttachmentClassificationKey(SortDirection sortDirection);
/**
* This method sorts the query result according to the attachment classification name.
* (Should only be used if there is one attachment per task in other case the result would be wrong.)
*
* @param sortDirection
* Determines whether the result is sorted in ascending or descending order. If sortDirection is null,
* the result is sorted in ascending order
* @return the query
*/
TaskQuery orderByAttachmentClassificationName(SortDirection sortDirection);
/**
* This method sorts the query result according to the attachment classification id.

View File

@ -22,6 +22,7 @@ public enum TaskQueryColumnName implements QueryColumnName {
CLASSIFICATION_CATEGORY("t.classification_category"),
CLASSIFICATION_KEY("t.classification_key"),
CLASSIFICATION_ID("t.classification_id"),
CLASSIFICATION_NAME("c.name"),
WORKBASKET_ID("t.workbasket_id"),
WORKBASKET_KEY("t.workbasket_key"),
DOMAIN("t.domain"),
@ -55,6 +56,7 @@ public enum TaskQueryColumnName implements QueryColumnName {
CUSTOM_16("t.custom_16"),
A_CLASSIFICATION_KEY("a.classification_key"),
A_CLASSIFICATION_ID("a.classification_id"),
A_CLASSIFICATION_NAME("ac.name"),
A_CHANNEL("a.channel"),
A_REF_VALUE("a.ref_value");

View File

@ -62,6 +62,8 @@ public class TaskQueryImpl implements TaskQuery {
private String[] classificationKeyNotIn;
private String[] classificationCategoryIn;
private String[] classificationCategoryLike;
private String[] classificationNameIn;
private String[] classificationNameLike;
private String[] ownerIn;
private String[] ownerLike;
private Boolean isRead;
@ -116,6 +118,8 @@ public class TaskQueryImpl implements TaskQuery {
private String[] attachmentClassificationKeyLike;
private String[] attachmentClassificationIdIn;
private String[] attachmentClassificationIdLike;
private String[] attachmentClassificationNameIn;
private String[] attachmentClassificationNameLike;
private String[] attachmentChannelIn;
private String[] attachmentChannelLike;
private String[] attachmentReferenceIn;
@ -132,8 +136,13 @@ public class TaskQueryImpl implements TaskQuery {
private List<String> orderBy;
private List<String> orderColumns;
private boolean useDistinctKeyword = false;
private boolean joinWithAttachments = false;
private boolean joinWithClassifications = false;
private boolean joinWithAttachmentClassifications = false;
private boolean addAttachmentColumnsToSelectClauseForOrdering = false;
private boolean addClassificationNameToSelectClauseForOrdering = false;
private boolean addAttachmentClassificationNameToSelectClauseForOrdering = false;
TaskQueryImpl(TaskanaEngine taskanaEngine) {
this.taskanaEngine = (TaskanaEngineImpl) taskanaEngine;
@ -584,7 +593,7 @@ public class TaskQueryImpl implements TaskQuery {
@Override
public TaskQuery attachmentClassificationKeyLike(String... attachmentClassificationKey) {
joinWithAttachments = true;
this.attachmentClassificationKeyLike = attachmentClassificationKey;
this.attachmentClassificationKeyLike = toUpperCopy(attachmentClassificationKey);
return this;
}
@ -598,7 +607,7 @@ public class TaskQueryImpl implements TaskQuery {
@Override
public TaskQuery attachmentClassificationIdLike(String... attachmentClassificationId) {
joinWithAttachments = true;
this.attachmentClassificationIdLike = attachmentClassificationId;
this.attachmentClassificationIdLike = toUpperCopy(attachmentClassificationId);
return this;
}
@ -612,7 +621,7 @@ public class TaskQueryImpl implements TaskQuery {
@Override
public TaskQuery attachmentChannelLike(String... attachmentChannel) {
joinWithAttachments = true;
this.attachmentChannelLike = attachmentChannel;
this.attachmentChannelLike = toUpperCopy(attachmentChannel);
return this;
}
@ -626,7 +635,7 @@ public class TaskQueryImpl implements TaskQuery {
@Override
public TaskQuery attachmentReferenceValueLike(String... referenceValue) {
joinWithAttachments = true;
this.attachmentReferenceLike = referenceValue;
this.attachmentReferenceLike = toUpperCopy(referenceValue);
return this;
}
@ -642,6 +651,52 @@ public class TaskQueryImpl implements TaskQuery {
return this;
}
@Override
public TaskQuery classificationNameIn(String... classificationNames) {
joinWithClassifications = true;
this.classificationNameIn = classificationNames;
return this;
}
@Override
public TaskQuery classificationNameLike(String... classificationNames) {
joinWithClassifications = true;
this.classificationNameLike = toUpperCopy(classificationNames);
return this;
}
@Override
public TaskQuery attachmentClassificationNameIn(String... attachmentClassificationName) {
joinWithAttachmentClassifications = true;
this.attachmentClassificationNameIn = attachmentClassificationName;
return this;
}
@Override
public TaskQuery attachmentClassificationNameLike(String... attachmentClassificationName) {
joinWithAttachmentClassifications = true;
this.attachmentClassificationNameLike = toUpperCopy(attachmentClassificationName);
return this;
}
@Override
public TaskQuery orderByClassificationName(SortDirection sortDirection) {
joinWithClassifications = true;
addClassificationNameToSelectClauseForOrdering = true;
return this.taskanaEngine.sessionManager.getConfiguration().getDatabaseId().equals("db2")
? addOrderCriteria("CNAME", sortDirection)
: addOrderCriteria("c.NAME", sortDirection);
}
@Override
public TaskQuery orderByAttachmentClassificationName(SortDirection sortDirection) {
joinWithAttachments = true;
addAttachmentClassificationNameToSelectClauseForOrdering = true;
return this.taskanaEngine.sessionManager.getConfiguration().getDatabaseId().equals("db2")
? addOrderCriteria("ACNAME", sortDirection)
: addOrderCriteria("ac.NAME", sortDirection);
}
@Override
public TaskQuery orderByClassificationKey(SortDirection sortDirection) {
return this.taskanaEngine.sessionManager.getConfiguration().getDatabaseId().equals("db2")
@ -861,6 +916,7 @@ public class TaskQueryImpl implements TaskQuery {
LOGGER.debug("entry to list(), this = {}", this);
taskanaEngine.openConnection();
checkOpenAndReadPermissionForSpecifiedWorkbaskets();
setupJoinAndOrderParameters();
List<TaskSummaryImpl> tasks = new ArrayList<>();
setupAccessIds();
tasks = taskanaEngine.getSqlSession().selectList(getLinkToMapperScript(), this);
@ -880,6 +936,31 @@ public class TaskQueryImpl implements TaskQuery {
}
}
private void setupJoinAndOrderParameters() {
// if classificationName or attachmentClassificationName are added to the result set, and multiple
// attachments exist, the addition of these attribute may increase the result set.
// in order to have the same result set independent of sorting yes or no,
// we add the add... flags whenever we join with classification or attachmentClassification
if (joinWithAttachmentClassifications) {
joinWithAttachments = true;
addAttachmentClassificationNameToSelectClauseForOrdering = true;
}
if (joinWithClassifications) {
addClassificationNameToSelectClauseForOrdering = true;
}
if (addClassificationNameToSelectClauseForOrdering) {
joinWithClassifications = true;
}
if (addAttachmentClassificationNameToSelectClauseForOrdering) {
joinWithAttachments = true;
joinWithAttachmentClassifications = true;
}
if (joinWithAttachments || joinWithClassifications || joinWithAttachmentClassifications) {
useDistinctKeyword = true;
}
}
public String getLinkToMapperScript() {
return this.taskanaEngine.sessionManager.getConfiguration().getDatabaseId().equals("db2")
? LINK_TO_MAPPER_DB2
@ -919,6 +1000,17 @@ public class TaskQueryImpl implements TaskQuery {
this.addOrderCriteria(columnName.toString(), sortDirection);
checkOpenAndReadPermissionForSpecifiedWorkbaskets();
setupAccessIds();
if (columnName.equals(TaskQueryColumnName.CLASSIFICATION_NAME)) {
joinWithClassifications = true;
addClassificationNameToSelectClauseForOrdering = true;
}
if (columnName.equals(TaskQueryColumnName.A_CLASSIFICATION_NAME)) {
joinWithAttachments = true;
joinWithAttachmentClassifications = true;
addAttachmentClassificationNameToSelectClauseForOrdering = true;
}
setupJoinAndOrderParameters();
result = taskanaEngine.getSqlSession().selectList(LINK_TO_VALUEMAPPER, this);
return result;
} finally {
@ -939,6 +1031,7 @@ public class TaskQueryImpl implements TaskQuery {
taskanaEngine.openConnection();
checkOpenAndReadPermissionForSpecifiedWorkbaskets();
setupAccessIds();
setupJoinAndOrderParameters();
RowBounds rowBounds = new RowBounds(offset, limit);
List<TaskSummaryImpl> tasks = taskanaEngine.getSqlSession()
.selectList(getLinkToMapperScript(), this, rowBounds);
@ -970,6 +1063,7 @@ public class TaskQueryImpl implements TaskQuery {
taskanaEngine.openConnection();
checkOpenAndReadPermissionForSpecifiedWorkbaskets();
setupAccessIds();
setupJoinAndOrderParameters();
TaskSummaryImpl taskSummaryImpl = taskanaEngine.getSqlSession().selectOne(getLinkToMapperScript(), this);
if (taskSummaryImpl == null) {
return null;
@ -994,6 +1088,7 @@ public class TaskQueryImpl implements TaskQuery {
taskanaEngine.openConnection();
checkOpenAndReadPermissionForSpecifiedWorkbaskets();
setupAccessIds();
setupJoinAndOrderParameters();
rowCount = taskanaEngine.getSqlSession().selectOne(getLinkToCounterTaskScript(), this);
return (rowCount == null) ? 0L : rowCount;
} finally {
@ -1002,6 +1097,14 @@ public class TaskQueryImpl implements TaskQuery {
}
}
public boolean isUseDistinctKeyword() {
return useDistinctKeyword;
}
public void setUseDistinctKeyword(boolean useDistinctKeyword) {
this.useDistinctKeyword = useDistinctKeyword;
}
public boolean isJoinWithAttachments() {
return joinWithAttachments;
}
@ -1010,6 +1113,22 @@ public class TaskQueryImpl implements TaskQuery {
this.joinWithAttachments = joinWithAttachments;
}
public boolean isJoinWithClassifications() {
return joinWithClassifications;
}
public void setJoinWithClassifications(boolean joinWithClassifications) {
this.joinWithClassifications = joinWithClassifications;
}
public boolean isJoinWithAttachmentsClassifications() {
return joinWithAttachmentClassifications;
}
public void setJoinWithAttachmentsClassifications(boolean joinWithAttachmentsClassifications) {
this.joinWithAttachmentClassifications = joinWithAttachmentsClassifications;
}
public boolean isAddAttachmentColumnsToSelectClauseForOrdering() {
return addAttachmentColumnsToSelectClauseForOrdering;
}
@ -1456,165 +1575,118 @@ public class TaskQueryImpl implements TaskQuery {
return this;
}
public String[] getClassificationNameIn() {
return classificationNameIn;
}
public void setClassificationNameIn(String[] classificationNameIn) {
this.classificationNameIn = classificationNameIn;
}
public String[] getClassificationNameLike() {
return classificationNameLike;
}
public void setClassificationNameLike(String[] classificationNameLike) {
this.classificationNameLike = classificationNameLike;
}
public String[] getAttachmentClassificationNameIn() {
return attachmentClassificationNameIn;
}
public void setAttachmentClassificationNameIn(String[] attachmentClassificationNameIn) {
this.attachmentClassificationNameIn = attachmentClassificationNameIn;
}
public String[] getAttachmentClassificationNameLike() {
return attachmentClassificationNameLike;
}
public void setAttachmentClassificationNameLike(String[] attachmentClassificationNameLike) {
this.attachmentClassificationNameLike = attachmentClassificationNameLike;
}
public boolean isAddClassificationNameToSelectClauseForOrdering() {
return addClassificationNameToSelectClauseForOrdering;
}
public void setAddClassificationNameToSelectClauseForOrdering(boolean addClassificationNameToSelectClauseForOrdering) {
this.addClassificationNameToSelectClauseForOrdering = addClassificationNameToSelectClauseForOrdering;
}
public boolean isAddAttachmentClassificationNameToSelectClauseForOrdering() {
return addAttachmentClassificationNameToSelectClauseForOrdering;
}
public void setAddAttachmentClassificationNameToSelectClauseForOrdering(
boolean addAttachmentClassificationNameToSelectClauseForOrdering) {
this.addAttachmentClassificationNameToSelectClauseForOrdering = addAttachmentClassificationNameToSelectClauseForOrdering;
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("TaskQueryImpl [columnName=");
builder.append(columnName);
builder.append(", nameIn=");
builder.append(Arrays.toString(nameIn));
builder.append(", nameLike=");
builder.append(Arrays.toString(nameLike));
builder.append(", creatorIn=");
builder.append(Arrays.toString(creatorIn));
builder.append(", creatorLike=");
builder.append(Arrays.toString(creatorLike));
builder.append(", taskIds=");
builder.append(Arrays.toString(taskIds));
builder.append(", description=");
builder.append(Arrays.toString(description));
builder.append(", note=");
builder.append(Arrays.toString(note));
builder.append(", priority=");
builder.append(Arrays.toString(priority));
builder.append(", workbasketKeyDomainIn=");
builder.append(Arrays.toString(workbasketKeyDomainIn));
builder.append(", workbasketIdIn=");
builder.append(Arrays.toString(workbasketIdIn));
builder.append(", stateIn=");
builder.append(Arrays.toString(stateIn));
builder.append(", classificationIdIn=");
builder.append(Arrays.toString(classificationIdIn));
builder.append(", classificationKeyIn=");
builder.append(Arrays.toString(classificationKeyIn));
builder.append(", classificationKeyNotIn=");
builder.append(Arrays.toString(classificationKeyNotIn));
builder.append(", classificationKeyLike=");
builder.append(Arrays.toString(classificationKeyLike));
builder.append(", classificationCategoryIn=");
builder.append(Arrays.toString(classificationCategoryIn));
builder.append(", classificationCategoryLike=");
builder.append(Arrays.toString(classificationCategoryLike));
builder.append(", ownerIn=");
builder.append(Arrays.toString(ownerIn));
builder.append(", ownerLike=");
builder.append(Arrays.toString(ownerLike));
builder.append(", isRead=");
builder.append(isRead);
builder.append(", isTransferred=");
builder.append(isTransferred);
builder.append(", porCompanyIn=");
builder.append(Arrays.toString(porCompanyIn));
builder.append(", porCompanyLike=");
builder.append(Arrays.toString(porCompanyLike));
builder.append(", porSystemIn=");
builder.append(Arrays.toString(porSystemIn));
builder.append(", porSystemLike=");
builder.append(Arrays.toString(porSystemLike));
builder.append(", porSystemInstanceIn=");
builder.append(Arrays.toString(porSystemInstanceIn));
builder.append(", porSystemInstanceLike=");
builder.append(Arrays.toString(porSystemInstanceLike));
builder.append(", porTypeIn=");
builder.append(Arrays.toString(porTypeIn));
builder.append(", porTypeLike=");
builder.append(Arrays.toString(porTypeLike));
builder.append(", porValueIn=");
builder.append(Arrays.toString(porValueIn));
builder.append(", porValueLike=");
builder.append(Arrays.toString(porValueLike));
builder.append(", parentBusinessProcessIdIn=");
builder.append(Arrays.toString(parentBusinessProcessIdIn));
builder.append(", parentBusinessProcessIdLike=");
builder.append(Arrays.toString(parentBusinessProcessIdLike));
builder.append(", businessProcessIdIn=");
builder.append(Arrays.toString(businessProcessIdIn));
builder.append(", businessProcessIdLike=");
builder.append(Arrays.toString(businessProcessIdLike));
builder.append(", custom1In=");
builder.append(Arrays.toString(custom1In));
builder.append(", custom1Like=");
builder.append(Arrays.toString(custom1Like));
builder.append(", custom2In=");
builder.append(Arrays.toString(custom2In));
builder.append(", custom2Like=");
builder.append(Arrays.toString(custom2Like));
builder.append(", custom3In=");
builder.append(Arrays.toString(custom3In));
builder.append(", custom3Like=");
builder.append(Arrays.toString(custom3Like));
builder.append(", custom4In=");
builder.append(Arrays.toString(custom4In));
builder.append(", custom4Like=");
builder.append(Arrays.toString(custom4Like));
builder.append(", custom5In=");
builder.append(Arrays.toString(custom5In));
builder.append(", custom5Like=");
builder.append(Arrays.toString(custom5Like));
builder.append(", custom6In=");
builder.append(Arrays.toString(custom6In));
builder.append(", custom6Like=");
builder.append(Arrays.toString(custom6Like));
builder.append(", custom7In=");
builder.append(Arrays.toString(custom7In));
builder.append(", custom7Like=");
builder.append(Arrays.toString(custom7Like));
builder.append(", custom8In=");
builder.append(Arrays.toString(custom8In));
builder.append(", custom8Like=");
builder.append(Arrays.toString(custom8Like));
builder.append(", custom9In=");
builder.append(Arrays.toString(custom9In));
builder.append(", custom9Like=");
builder.append(Arrays.toString(custom9Like));
builder.append(", custom10In=");
builder.append(Arrays.toString(custom10In));
builder.append(", custom10Like=");
builder.append(Arrays.toString(custom10Like));
builder.append(", custom11In=");
builder.append(Arrays.toString(custom11In));
builder.append(", custom11Like=");
builder.append(Arrays.toString(custom11Like));
builder.append(", custom12In=");
builder.append(Arrays.toString(custom12In));
builder.append(", custom12Like=");
builder.append(Arrays.toString(custom12Like));
builder.append(", custom13In=");
builder.append(Arrays.toString(custom13In));
builder.append(", custom13Like=");
builder.append(Arrays.toString(custom13Like));
builder.append(", custom14In=");
builder.append(Arrays.toString(custom14In));
builder.append(", custom14Like=");
builder.append(Arrays.toString(custom14Like));
builder.append(", custom15In=");
builder.append(Arrays.toString(custom15In));
builder.append(", custom15Like=");
builder.append(Arrays.toString(custom15Like));
builder.append(", custom16In=");
builder.append(Arrays.toString(custom16In));
builder.append(", custom16Like=");
builder.append(Arrays.toString(custom16Like));
builder.append(", accessIdIn=");
builder.append(Arrays.toString(accessIdIn));
builder.append(", filterByAccessIdIn=");
builder.append(filterByAccessIdIn);
builder.append(", createdIn=");
builder.append(Arrays.toString(createdIn));
builder.append(", claimedIn=");
builder.append(Arrays.toString(claimedIn));
builder.append(", completedIn=");
builder.append(Arrays.toString(completedIn));
builder.append(", modifiedIn=");
builder.append(Arrays.toString(modifiedIn));
builder.append(", plannedIn=");
builder.append(Arrays.toString(plannedIn));
builder.append(", dueIn=");
builder.append(Arrays.toString(dueIn));
builder.append(", orderBy=");
builder.append(orderBy);
builder.append("]");
return builder.toString();
return "TaskQueryImpl [columnName=" + columnName + ", nameIn=" + Arrays.toString(nameIn) + ", nameLike="
+ Arrays.toString(nameLike) + ", creatorIn=" + Arrays.toString(creatorIn) + ", creatorLike="
+ Arrays.toString(creatorLike) + ", taskIds=" + Arrays.toString(taskIds) + ", description="
+ Arrays.toString(description) + ", note=" + Arrays.toString(note) + ", noteLike="
+ Arrays.toString(noteLike) + ", priority=" + Arrays.toString(priority) + ", workbasketKeyDomainIn="
+ Arrays.toString(workbasketKeyDomainIn) + ", workbasketIdIn=" + Arrays.toString(workbasketIdIn)
+ ", stateIn=" + Arrays.toString(stateIn) + ", classificationIdIn=" + Arrays.toString(classificationIdIn)
+ ", classificationKeyIn=" + Arrays.toString(classificationKeyIn) + ", classificationKeyLike="
+ Arrays.toString(classificationKeyLike) + ", classificationKeyNotIn="
+ Arrays.toString(classificationKeyNotIn) + ", classificationCategoryIn="
+ Arrays.toString(classificationCategoryIn) + ", classificationCategoryLike="
+ Arrays.toString(classificationCategoryLike) + ", classificationNameIn="
+ Arrays.toString(classificationNameIn) + ", classificationNameLike="
+ Arrays.toString(classificationNameLike) + ", ownerIn=" + Arrays.toString(ownerIn) + ", ownerLike="
+ Arrays.toString(ownerLike) + ", isRead=" + isRead + ", isTransferred=" + isTransferred + ", porCompanyIn="
+ Arrays.toString(porCompanyIn) + ", porCompanyLike=" + Arrays.toString(porCompanyLike) + ", porSystemIn="
+ Arrays.toString(porSystemIn) + ", porSystemLike=" + Arrays.toString(porSystemLike)
+ ", porSystemInstanceIn=" + Arrays.toString(porSystemInstanceIn) + ", porSystemInstanceLike="
+ Arrays.toString(porSystemInstanceLike) + ", porTypeIn=" + Arrays.toString(porTypeIn) + ", porTypeLike="
+ Arrays.toString(porTypeLike) + ", porValueIn=" + Arrays.toString(porValueIn) + ", porValueLike="
+ Arrays.toString(porValueLike) + ", parentBusinessProcessIdIn="
+ Arrays.toString(parentBusinessProcessIdIn) + ", parentBusinessProcessIdLike="
+ Arrays.toString(parentBusinessProcessIdLike) + ", businessProcessIdIn="
+ Arrays.toString(businessProcessIdIn) + ", businessProcessIdLike=" + Arrays.toString(businessProcessIdLike)
+ ", custom1In=" + Arrays.toString(custom1In) + ", custom1Like=" + Arrays.toString(custom1Like)
+ ", custom2In=" + Arrays.toString(custom2In) + ", custom2Like=" + Arrays.toString(custom2Like)
+ ", custom3In=" + Arrays.toString(custom3In) + ", custom3Like=" + Arrays.toString(custom3Like)
+ ", custom4In=" + Arrays.toString(custom4In) + ", custom4Like=" + Arrays.toString(custom4Like)
+ ", custom5In=" + Arrays.toString(custom5In) + ", custom5Like=" + Arrays.toString(custom5Like)
+ ", custom6In=" + Arrays.toString(custom6In) + ", custom6Like=" + Arrays.toString(custom6Like)
+ ", custom7In=" + Arrays.toString(custom7In) + ", custom7Like=" + Arrays.toString(custom7Like)
+ ", custom8In=" + Arrays.toString(custom8In) + ", custom8Like=" + Arrays.toString(custom8Like)
+ ", custom9In=" + Arrays.toString(custom9In) + ", custom9Like=" + Arrays.toString(custom9Like)
+ ", custom10In=" + Arrays.toString(custom10In) + ", custom10Like=" + Arrays.toString(custom10Like)
+ ", custom11In=" + Arrays.toString(custom11In) + ", custom11Like=" + Arrays.toString(custom11Like)
+ ", custom12In=" + Arrays.toString(custom12In) + ", custom12Like=" + Arrays.toString(custom12Like)
+ ", custom13In=" + Arrays.toString(custom13In) + ", custom13Like=" + Arrays.toString(custom13Like)
+ ", custom14In=" + Arrays.toString(custom14In) + ", custom14Like=" + Arrays.toString(custom14Like)
+ ", custom15In=" + Arrays.toString(custom15In) + ", custom15Like=" + Arrays.toString(custom15Like)
+ ", custom16In=" + Arrays.toString(custom16In) + ", custom16Like=" + Arrays.toString(custom16Like)
+ ", attachmentClassificationKeyIn=" + Arrays.toString(attachmentClassificationKeyIn)
+ ", attachmentClassificationKeyLike=" + Arrays.toString(attachmentClassificationKeyLike)
+ ", attachmentClassificationIdIn=" + Arrays.toString(attachmentClassificationIdIn)
+ ", attachmentClassificationIdLike=" + Arrays.toString(attachmentClassificationIdLike)
+ ", attachmentClassificationNameIn=" + Arrays.toString(attachmentClassificationNameIn)
+ ", attachmentClassificationNameLike=" + Arrays.toString(attachmentClassificationNameLike)
+ ", attachmentChannelIn=" + Arrays.toString(attachmentChannelIn) + ", attachmentChannelLike="
+ Arrays.toString(attachmentChannelLike) + ", attachmentReferenceIn="
+ Arrays.toString(attachmentReferenceIn) + ", attachmentReferenceLike="
+ Arrays.toString(attachmentReferenceLike) + ", attachmentReceivedIn="
+ Arrays.toString(attachmentReceivedIn) + ", accessIdIn=" + Arrays.toString(accessIdIn)
+ ", filterByAccessIdIn=" + filterByAccessIdIn + ", createdIn=" + Arrays.toString(createdIn)
+ ", claimedIn=" + Arrays.toString(claimedIn) + ", completedIn=" + Arrays.toString(completedIn)
+ ", modifiedIn=" + Arrays.toString(modifiedIn) + ", plannedIn=" + Arrays.toString(plannedIn) + ", dueIn="
+ Arrays.toString(dueIn) + ", orderBy=" + orderBy + ", orderColumns=" + orderColumns
+ ", joinWithAttachments=" + joinWithAttachments + ", joinWithClassifications=" + joinWithClassifications
+ ", joinWithAttachmentsClassifications=" + joinWithAttachmentClassifications
+ ", addAttachmentColumnsToSelectClauseForOrdering=" + addAttachmentColumnsToSelectClauseForOrdering
+ ", addClassificationNameToSelectClauseForOrdering=" + addClassificationNameToSelectClauseForOrdering
+ ", addAttachmentClassificationNameToSelectClauseForOrdering="
+ addAttachmentClassificationNameToSelectClauseForOrdering + "]";
}
}

View File

@ -33,14 +33,29 @@ public interface QueryMapper {
}
@Select("<script> "
+ "SELECT <if test=\"joinWithAttachments\">DISTINCT</if> t.ID, t.CREATED, t.CLAIMED, t.COMPLETED, t.MODIFIED, t.PLANNED, t.DUE, t.NAME, t.CREATOR, t.DESCRIPTION, t.NOTE, t.PRIORITY, t.STATE, t.CLASSIFICATION_KEY, t.CLASSIFICATION_CATEGORY, t.CLASSIFICATION_ID, t.WORKBASKET_ID, t.DOMAIN, t.WORKBASKET_KEY, t.BUSINESS_PROCESS_ID, t.PARENT_BUSINESS_PROCESS_ID, t.OWNER, t.POR_COMPANY, t.POR_SYSTEM, t.POR_INSTANCE, t.POR_TYPE, t.POR_VALUE, t.IS_READ, t.IS_TRANSFERRED, t.CUSTOM_1, t.CUSTOM_2, t.CUSTOM_3, t.CUSTOM_4, t.CUSTOM_5, t.CUSTOM_6, t.CUSTOM_7, t.CUSTOM_8, t.CUSTOM_9, t.CUSTOM_10, t.CUSTOM_11, t.CUSTOM_12, t.CUSTOM_13, t.CUSTOM_14, t.CUSTOM_15, t.CUSTOM_16"
+ "SELECT <if test=\"useDistinctKeyword\">DISTINCT</if> t.ID, t.CREATED, t.CLAIMED, t.COMPLETED, t.MODIFIED, t.PLANNED, t.DUE, t.NAME, t.CREATOR, t.DESCRIPTION, t.NOTE, t.PRIORITY, t.STATE, t.CLASSIFICATION_KEY, "
+ "t.CLASSIFICATION_CATEGORY, t.CLASSIFICATION_ID, t.WORKBASKET_ID, t.DOMAIN, t.WORKBASKET_KEY, t.BUSINESS_PROCESS_ID, t.PARENT_BUSINESS_PROCESS_ID, t.OWNER, t.POR_COMPANY, t.POR_SYSTEM, t.POR_INSTANCE, t.POR_TYPE, "
+ "t.POR_VALUE, t.IS_READ, t.IS_TRANSFERRED, t.CUSTOM_1, t.CUSTOM_2, t.CUSTOM_3, t.CUSTOM_4, t.CUSTOM_5, t.CUSTOM_6, t.CUSTOM_7, t.CUSTOM_8, t.CUSTOM_9, t.CUSTOM_10, t.CUSTOM_11, t.CUSTOM_12, t.CUSTOM_13, t.CUSTOM_14, "
+ "t.CUSTOM_15, t.CUSTOM_16"
+ "<if test=\"addAttachmentColumnsToSelectClauseForOrdering\">"
+ ", a.CLASSIFICATION_ID, a.CLASSIFICATION_KEY, a.CHANNEL, a.REF_VALUE, a.RECEIVED"
+ "</if>"
+ "<if test=\"addClassificationNameToSelectClauseForOrdering\">"
+ ", c.NAME "
+ "</if>"
+ "<if test=\"addAttachmentClassificationNameToSelectClauseForOrdering\">"
+ ", ac.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>"
+ "<where>"
+ "<if test='accessIdIn != null'> "
+ "AND t.WORKBASKET_ID IN ( "
@ -71,6 +86,10 @@ public interface QueryMapper {
+ "<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> "
@ -188,18 +207,36 @@ public interface QueryMapper {
+ "<if test=\"addAttachmentColumnsToSelectClauseForOrdering\">"
+ ", ACLASSIFICATION_ID, ACLASSIFICATION_KEY, CHANNEL, REF_VALUE, RECEIVED"
+ "</if>"
+ "<if test=\"addClassificationNameToSelectClauseForOrdering\">"
+ ", CNAME "
+ "</if>"
+ "<if test=\"addAttachmentClassificationNameToSelectClauseForOrdering\">"
+ ", ACNAME "
+ "</if>"
+ " ) "
+ " AS (SELECT <if test=\"joinWithAttachments\">DISTINCT</if> t.ID, t.CREATED, t.CLAIMED, t.COMPLETED, t.MODIFIED, t.PLANNED, t.DUE, t.NAME, t.CREATOR, t.DESCRIPTION, t.NOTE, t.PRIORITY, t.STATE, t.CLASSIFICATION_KEY, "
+ " t.CLASSIFICATION_CATEGORY, t.CLASSIFICATION_ID, t.WORKBASKET_ID, DOMAIN, t.WORKBASKET_KEY, t.BUSINESS_PROCESS_ID, t.PARENT_BUSINESS_PROCESS_ID, t.OWNER, "
+ " AS (SELECT <if test=\"useDistinctKeyword\">DISTINCT</if> t.ID, t.CREATED, t.CLAIMED, t.COMPLETED, t.MODIFIED, t.PLANNED, t.DUE, t.NAME, t.CREATOR, t.DESCRIPTION, t.NOTE, t.PRIORITY, t.STATE, t.CLASSIFICATION_KEY, "
+ " t.CLASSIFICATION_CATEGORY, t.CLASSIFICATION_ID, t.WORKBASKET_ID, t.DOMAIN, t.WORKBASKET_KEY, t.BUSINESS_PROCESS_ID, t.PARENT_BUSINESS_PROCESS_ID, t.OWNER, "
+ "t.POR_COMPANY, t.POR_SYSTEM, t.POR_INSTANCE, t.POR_TYPE, t.POR_VALUE, t.IS_READ, t.IS_TRANSFERRED, t.CUSTOM_1, t.CUSTOM_2, t.CUSTOM_3, t.CUSTOM_4, t.CUSTOM_5, "
+ "t.CUSTOM_6, t.CUSTOM_7, t.CUSTOM_8, t.CUSTOM_9, t.CUSTOM_10, t.CUSTOM_11, t.CUSTOM_12, t.CUSTOM_13, t.CUSTOM_14, t.CUSTOM_15, t.CUSTOM_16"
+ "<if test=\"addAttachmentColumnsToSelectClauseForOrdering\">"
+ ", a.CLASSIFICATION_ID, a.CLASSIFICATION_KEY, a.CHANNEL, a.REF_VALUE, a.RECEIVED"
+ "</if>"
+ "<if test=\"addClassificationNameToSelectClauseForOrdering\">"
+ ", c.NAME "
+ "</if>"
+ "<if test=\"addAttachmentClassificationNameToSelectClauseForOrdering\">"
+ ", ac.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>"
+ "<where> "
+ "<if test='taskIds != null'>AND t.ID IN(<foreach item='item' collection='taskIds' separator=',' >#{item}</foreach>)</if> "
+ "<if test='createdIn !=null'> AND ( <foreach item='item' collection='createdIn' separator=' OR ' > ( <if test='item.begin!=null'> t.CREATED &gt;= #{item.begin} </if> <if test='item.begin!=null and item.end!=null'> AND </if><if test='item.end!=null'> t.CREATED &lt;=#{item.end} </if>)</foreach>)</if> "
@ -224,6 +261,10 @@ public interface QueryMapper {
+ "<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> "
@ -291,6 +332,12 @@ public interface QueryMapper {
+ "<if test=\"addAttachmentColumnsToSelectClauseForOrdering\">"
+ ", ACLASSIFICATION_ID, ACLASSIFICATION_KEY, CHANNEL, REF_VALUE, RECEIVED"
+ "</if>"
+ "<if test=\"addClassificationNameToSelectClauseForOrdering\">"
+ ", CNAME "
+ "</if>"
+ "<if test=\"addAttachmentClassificationNameToSelectClauseForOrdering\">"
+ ", ACNAME "
+ "</if>"
+ ", FLAG ) "
+ "AS "
+ "(SELECT ID, CREATED, CLAIMED, COMPLETED, MODIFIED, PLANNED, DUE, NAME, CREATOR, DESCRIPTION, NOTE, PRIORITY, STATE, TCLASSIFICATION_KEY, "
@ -300,6 +347,12 @@ public interface QueryMapper {
+ "<if test=\"addAttachmentColumnsToSelectClauseForOrdering\">"
+ ", ACLASSIFICATION_ID, ACLASSIFICATION_KEY, CHANNEL, REF_VALUE, RECEIVED"
+ "</if>"
+ "<if test=\"addClassificationNameToSelectClauseForOrdering\">"
+ ", CNAME "
+ "</if>"
+ "<if test=\"addAttachmentClassificationNameToSelectClauseForOrdering\">"
+ ", ACNAME "
+ "</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 "
@ -315,6 +368,12 @@ public interface QueryMapper {
+ "<if test=\"addAttachmentColumnsToSelectClauseForOrdering\">"
+ ", ACLASSIFICATION_ID, ACLASSIFICATION_KEY, CHANNEL, REF_VALUE, RECEIVED "
+ "</if>"
+ "<if test=\"addClassificationNameToSelectClauseForOrdering\">"
+ ", CNAME "
+ "</if>"
+ "<if test=\"addAttachmentClassificationNameToSelectClauseForOrdering\">"
+ ", ACNAME "
+ "</if>"
+ " FROM Y WHERE FLAG = 1 "
+ "<if test='!orderBy.isEmpty()'>ORDER BY <foreach item='item' collection='orderBy' separator=',' >"
+ "${item}"
@ -594,10 +653,16 @@ public interface QueryMapper {
List<WorkbasketAccessItemImpl> queryWorkbasketAccessItems(WorkbasketAccessItemQuery accessItemQuery);
@Select("<script> "
+ "SELECT COUNT( <if test=\"joinWithAttachments\">DISTINCT</if> t.ID) FROM TASK t "
+ "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 ( "
@ -628,6 +693,10 @@ public interface QueryMapper {
+ "<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> "
@ -692,10 +761,16 @@ public interface QueryMapper {
Long countQueryTasks(TaskQueryImpl taskQuery);
@Select("<script> "
+ "WITH X (ID, WORKBASKET_ID) AS (SELECT <if test=\"joinWithAttachments\">DISTINCT</if> t.ID, t.WORKBASKET_ID FROM TASK t "
+ "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='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> "
@ -720,6 +795,10 @@ public interface QueryMapper {
+ "<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> "
@ -940,7 +1019,16 @@ public interface QueryMapper {
Long countQueryWorkbasketAccessItems(WorkbasketAccessItemQuery accessItem);
@Select("<script>SELECT DISTINCT ${columnName} "
+ "FROM TASK t LEFT JOIN ATTACHMENT AS a ON t.ID = a.TASK_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 ( "
@ -971,6 +1059,10 @@ public interface QueryMapper {
+ "<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> "
@ -1051,6 +1143,18 @@ public interface QueryMapper {
+ "<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>"

View File

@ -0,0 +1,185 @@
package acceptance.task;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import java.util.List;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import acceptance.AbstractAccTest;
import pro.taskana.AttachmentSummary;
import pro.taskana.TaskQuery;
import pro.taskana.BaseQuery.SortDirection;
import pro.taskana.TaskQueryColumnName;
import pro.taskana.TaskService;
import pro.taskana.TaskSummary;
import pro.taskana.security.JAASRunner;
import pro.taskana.security.WithAccessId;
/**
* Acceptance test for the usecase of adding/removing an attachment of a task and update the result correctly.
*/
@RunWith(JAASRunner.class)
public class QueryTaskByClassificationNameAccTest extends AbstractAccTest {
private static SortDirection asc = SortDirection.ASCENDING;
private static SortDirection desc = SortDirection.DESCENDING;
public QueryTaskByClassificationNameAccTest() {
super();
}
@WithAccessId(
userName = "teamlead_1",
groupNames = {"admin"})
@Test
public void testQueryTaskValuesForAttachmentClassificationName() {
TaskService taskService = taskanaEngine.getTaskService();
List<String> columnValueList = taskService.createTaskQuery()
.ownerLike("%user%")
.orderByOwner(desc)
.listValues(TaskQueryColumnName.A_CLASSIFICATION_NAME, null);
assertNotNull(columnValueList);
assertEquals(8, columnValueList.size());
}
@WithAccessId(
userName = "teamlead_1",
groupNames = {"admin"})
@Test
public void testQueryTaskValuesForClassificationName() {
TaskService taskService = taskanaEngine.getTaskService();
List<String> columnValueList = taskService.createTaskQuery()
.ownerLike("%user%")
.orderByClassificationName(asc)
.listValues(TaskQueryColumnName.CLASSIFICATION_NAME, null);
assertNotNull(columnValueList);
assertEquals(5, columnValueList.size());
}
@WithAccessId(
userName = "user_1_1",
groupNames = {"group_1"})
@Test
public void testQueryByClassificationNameIn() {
TaskService taskService = taskanaEngine.getTaskService();
List<TaskSummary> tasks = taskService.createTaskQuery()
.classificationNameIn("Dynamik-Ablehnung")
.list();
assertEquals(1, tasks.size());
List<AttachmentSummary> attachmentSummaries = tasks.get(0).getAttachmentSummaries();
assertNotNull(attachmentSummaries);
assertEquals(2, attachmentSummaries.size());
tasks = taskService.createTaskQuery()
.classificationNameIn("Dynamik-Ablehnung")
.orderByClassificationName(SortDirection.ASCENDING)
.list();
assertEquals(1, tasks.size());
}
@WithAccessId(
userName = "user_1_1",
groupNames = {"group_1"})
@Test
public void testQueryByClassificationNameLike() {
TaskService taskService = taskanaEngine.getTaskService();
List<TaskSummary> tasks = taskService.createTaskQuery()
.classificationNameLike("Dynamik%", "Widerruf")
.orderByClassificationName(SortDirection.ASCENDING)
.list();
assertEquals(22, tasks.size());
// without sort, the same number of tasks should be returned
tasks = taskService.createTaskQuery()
.classificationNameLike("Dynamik%", "Widerruf")
.list();
assertEquals(22, tasks.size());
}
@WithAccessId(
userName = "user_1_1",
groupNames = {"group_1"})
@Test
public void testSelectByAttachmentClassificationNameLike() {
TaskService taskService = taskanaEngine.getTaskService();
// find Task with attachment classification names
List<TaskSummary> tasks = taskService.createTaskQuery()
.attachmentClassificationNameLike("Widerruf", "Beratungsprotokoll", "Dynamik%")
.orderByAttachmentClassificationName(SortDirection.ASCENDING)
.list();
assertEquals(7, tasks.size());
// make sure that unordered query returns the same number of objects
tasks = taskService.createTaskQuery()
.attachmentClassificationNameLike("Widerruf", "Beratungsprotokoll", "Dynamik%")
.list();
assertEquals(7, tasks.size());
}
@WithAccessId(
userName = "user_1_1",
groupNames = {"group_1"})
@Test
public void testSelectByAttachmentClassificationNameIn() {
TaskService taskService = taskanaEngine.getTaskService();
// find Task with attachment classification names
List<TaskSummary> tasks = taskService.createTaskQuery()
.attachmentClassificationNameIn("Widerruf", "Beratungsprotokoll", "Dynamikaenderung")
.orderByAttachmentClassificationName(SortDirection.ASCENDING)
.list();
assertEquals(4, tasks.size());
// make sure that unordered query returns the same number of objects
tasks = taskService.createTaskQuery()
.attachmentClassificationNameIn("Widerruf", "Beratungsprotokoll", "Dynamikaenderung")
.list();
assertEquals(4, tasks.size());
}
@WithAccessId(
userName = "user_1_1",
groupNames = {"group_1"})
@Test
public void testQueryAndCountMatchForClassificationName() {
TaskService taskService = taskanaEngine.getTaskService();
TaskQuery taskQuery = taskService.createTaskQuery();
List<TaskSummary> tasks = taskQuery
.classificationNameIn("Widerruf", "Beratungsprotokoll", "Dynamikaenderung")
.list();
long numberOfTasks = taskQuery
.classificationNameIn("Widerruf", "Beratungsprotokoll", "Dynamikaenderung")
.count();
Assert.assertEquals(numberOfTasks, tasks.size());
}
@WithAccessId(
userName = "user_1_1",
groupNames = {"group_1"})
@Test
public void testQueryAndCountForAttachmentClassificationName() {
TaskService taskService = taskanaEngine.getTaskService();
TaskQuery taskQuery = taskService.createTaskQuery();
List<TaskSummary> tasks = taskQuery
.attachmentClassificationNameIn("Widerruf", "Beratungsprotokoll", "Dynamikaenderung")
.list();
// we expect 4 result objects in this case, because task TKI:000000000000000000000000000000000001 has 2 attachments with different Classifications
// therefore task TKI:000000000000000000000000000000000001 occurs twice in the result set
Assert.assertEquals(4, tasks.size());
long numberOfTasks = taskQuery
.attachmentClassificationNameIn("Widerruf", "Beratungsprotokoll", "Dynamikaenderung")
.count();
Assert.assertEquals(3, numberOfTasks);
// the count returns only the number of tasks that have an attachment with the specified classification name.
// therefore, task 001 is counted only once.
}
}

View File

@ -3,7 +3,7 @@
INSERT INTO CLASSIFICATION VALUES('CLI:000000000000000000000000000000000001', 'L10000', '', '', 'EXTERNAL', 'TASK', '', FALSE, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, 'OLD-Leistungsfall', 'OLD-Leistungsfall', 999, 'P1D', '', 'VNR,RVNR,KOLVNR', '', '', '', '', '', '', '');
INSERT INTO CLASSIFICATION VALUES('CLI:000000000000000000000000000000000002', 'L10303', '', '', 'EXTERNAL', 'TASK', '', FALSE, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, 'Beratungsprotokoll', 'Beratungsprotokoll', 1, 'P2D', '', 'VNR,RVNR,KOLVNR, ANR', '', '', '', '', '', '', '');
INSERT INTO CLASSIFICATION VALUES('CLI:000000000000000000000000000000000003', 'L1050', '', '', 'EXTERNAL', 'TASK', '', FALSE, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, 'Widerruf', 'Widerruf', 1, 'P3D', '', 'VNR,RVNR,KOLVNR', '', '', '', '', '', '', '');
INSERT INTO CLASSIFICATION VALUES('CLI:000000000000000000000000000000000004', 'L11010', '', '', 'EXTERNAL', 'TASK', '', FALSE, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, 'Dynamikänderung', 'Dynamikänderung', 7, 'P4D', '', 'VNR,RVNR,KOLVNR', '', '', '', '', '', '', '');
INSERT INTO CLASSIFICATION VALUES('CLI:000000000000000000000000000000000004', 'L11010', '', '', 'EXTERNAL', 'TASK', '', FALSE, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, 'Dynamikaenderung', 'Dynamikaenderung', 7, 'P4D', '', 'VNR,RVNR,KOLVNR', '', '', '', '', '', '', '');
INSERT INTO CLASSIFICATION VALUES('CLI:000000000000000000000000000000000005', 'L110102', 'CLI:000000000000000000000000000000000004', 'L11010', 'EXTERNAL', 'TASK', '', FALSE, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, 'Dynamik-Ablehnung', 'Dynamik-Ablehnung', 5, 'P5D', '', 'VNR,RVNR,KOLVNR', '', '', '', '', '', '', '');
INSERT INTO CLASSIFICATION VALUES('CLI:000000000000000000000000000000000006', 'L110105', 'CLI:000000000000000000000000000000000004', 'L11010', 'EXTERNAL', 'TASK', '', FALSE, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, 'Dynamik-Ausschluss', 'Dynamik-Ausschluss', 5, 'P5D', '', 'VNR,RVNR,KOLVNR', '', '', '', '', '', '', '');
INSERT INTO CLASSIFICATION VALUES('CLI:000000000000000000000000000000000007', 'L110107', 'CLI:000000000000000000000000000000000004', 'L11010', 'EXTERNAL', 'TASK', '', FALSE, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, 'Dynamik-Einschluss/Änd.', 'Dynamik-Einschluss/Änd.', 5, 'P6D', '', 'VNR,RVNR,KOLVNR', '', '', '', '', '', '', '');
@ -23,7 +23,7 @@ INSERT INTO CLASSIFICATION VALUES('CLI:300000000000000000000000000000000017', 'L
-- DOMAIN_A CLASSIFICATIONS
INSERT INTO CLASSIFICATION VALUES('CLI:100000000000000000000000000000000002', 'L10303', '', '', 'EXTERNAL', 'TASK', 'DOMAIN_A', TRUE, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, 'Beratungsprotokoll', 'Beratungsprotokoll', 101, 'P1D', '', 'VNR,RVNR,KOLVNR, ANR', '', '', '', '', '', '', '');
INSERT INTO CLASSIFICATION VALUES('CLI:100000000000000000000000000000000003', 'L1050', '', '', 'EXTERNAL', 'TASK', 'DOMAIN_A', TRUE, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, 'Widerruf', 'Widerruf', 1, 'P13D', '', 'VNR,RVNR,KOLVNR', '', '', '', '', '', '', '');
INSERT INTO CLASSIFICATION VALUES('CLI:100000000000000000000000000000000004', 'L11010', '', '', 'EXTERNAL', 'TASK', 'DOMAIN_A', TRUE, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, 'Dynamikänderung', 'Dynamikänderung', 1, 'P14D', '', 'VNR,RVNR,KOLVNR', '', '', '', '', '', '', '');
INSERT INTO CLASSIFICATION VALUES('CLI:100000000000000000000000000000000004', 'L11010', '', '', 'EXTERNAL', 'TASK', 'DOMAIN_A', TRUE, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, 'Dynamikaenderung', 'Dynamikaenderung', 1, 'P14D', '', 'VNR,RVNR,KOLVNR', '', '', '', '', '', '', '');
INSERT INTO CLASSIFICATION VALUES('CLI:100000000000000000000000000000000005', 'L110102', 'CLI:100000000000000000000000000000000004', 'L11010', 'EXTERNAL', 'TASK', 'DOMAIN_A', TRUE, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, 'Dynamik-Ablehnung', 'Dynamik-Ablehnung', 5, 'P15D', '', 'VNR,RVNR,KOLVNR', 'TEXT_1', '', '', '', '', '', '');
INSERT INTO CLASSIFICATION VALUES('CLI:100000000000000000000000000000000006', 'L110105', 'CLI:100000000000000000000000000000000004', 'L11010', 'EXTERNAL', 'TASK', 'DOMAIN_A', TRUE, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, 'Dynamik-Ausschluss', 'Dynamik-Ausschluss', 5, 'P16D', '', 'VNR,RVNR,KOLVNR', 'TEXT_2', '', '', '', '', '', '');
INSERT INTO CLASSIFICATION VALUES('CLI:100000000000000000000000000000000007', 'L110107', 'CLI:100000000000000000000000000000000004', 'L11010', 'EXTERNAL', 'TASK', 'DOMAIN_A', TRUE, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, 'Dynamik-Einschluss/Änd.', 'Dynamik-Einschluss/Änd.', 5, 'P5D', 'point0815', 'VNR,RVNR,KOLVNR', 'TEXT_1', '', '', '', '', '', '');