TSK-1837: Add custom_int fields and standard operations on them
This commit is contained in:
parent
5953310e59
commit
18ee26ba80
|
@ -24,7 +24,7 @@ public class SqlProviderUtil {
|
|||
.append("</when>")
|
||||
.append("<otherwise>0=1</otherwise>")
|
||||
.append("</choose>");
|
||||
if (column.contains("t.CUSTOM_")) {
|
||||
if (column.contains("t.CUSTOM_") && !column.contains("INT")) {
|
||||
sb.append("<if test='" + collection + "ContainsNull'> OR " + column + " IS NULL </if>");
|
||||
}
|
||||
return sb.append(")</if> ");
|
||||
|
@ -47,7 +47,7 @@ public class SqlProviderUtil {
|
|||
.append("</when>")
|
||||
.append("<otherwise>1=1</otherwise>")
|
||||
.append("</choose>");
|
||||
if (column.contains("t.CUSTOM_")) {
|
||||
if (column.contains("t.CUSTOM_") && !column.contains("INT")) {
|
||||
sb.append("<if test='" + collection + "ContainsNull'> AND " + column + " IS NOT NULL </if>");
|
||||
sb.append("<if test='!" + collection + "ContainsNull'> OR " + column + " IS NULL </if>");
|
||||
}
|
||||
|
@ -141,4 +141,16 @@ public class SqlProviderUtil {
|
|||
String baseCollection, String baseColumn, int customBound) {
|
||||
return whereCustomStatements(baseCollection, baseColumn, customBound, new StringBuilder());
|
||||
}
|
||||
|
||||
public static StringBuilder whereCustomIntStatements(
|
||||
String baseCollection, String baseColumn, int customBound, StringBuilder sb) {
|
||||
IntStream.rangeClosed(1, customBound)
|
||||
.forEach(
|
||||
x -> {
|
||||
String column = baseColumn + "_" + x;
|
||||
whereIn(baseCollection + x + "In", column, sb);
|
||||
whereNotIn(baseCollection + x + "NotIn", column, sb);
|
||||
});
|
||||
return sb;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,8 +28,10 @@ import pro.taskana.common.api.KeyDomain;
|
|||
import pro.taskana.common.api.TimeInterval;
|
||||
import pro.taskana.common.api.security.CurrentUserContext;
|
||||
import pro.taskana.common.internal.util.Pair;
|
||||
import pro.taskana.common.internal.util.Triplet;
|
||||
import pro.taskana.task.api.CallbackState;
|
||||
import pro.taskana.task.api.TaskCustomField;
|
||||
import pro.taskana.task.api.TaskCustomIntField;
|
||||
import pro.taskana.task.api.TaskQuery;
|
||||
import pro.taskana.task.api.TaskService;
|
||||
import pro.taskana.task.api.TaskState;
|
||||
|
@ -233,6 +235,14 @@ class TaskQueryImplAccTest {
|
|||
.customAttribute(TaskCustomField.CUSTOM_14, "custom14")
|
||||
.customAttribute(TaskCustomField.CUSTOM_15, "custom15")
|
||||
.customAttribute(TaskCustomField.CUSTOM_16, "custom16")
|
||||
.customIntField(TaskCustomIntField.CUSTOM_INT_1, (Integer) 1)
|
||||
.customIntField(TaskCustomIntField.CUSTOM_INT_2, 2)
|
||||
.customIntField(TaskCustomIntField.CUSTOM_INT_3, 3)
|
||||
.customIntField(TaskCustomIntField.CUSTOM_INT_4, 4)
|
||||
.customIntField(TaskCustomIntField.CUSTOM_INT_5, 5)
|
||||
.customIntField(TaskCustomIntField.CUSTOM_INT_6, 6)
|
||||
.customIntField(TaskCustomIntField.CUSTOM_INT_7, 7)
|
||||
.customIntField(TaskCustomIntField.CUSTOM_INT_8, 8)
|
||||
.callbackInfo(Map.of("custom", "value"))
|
||||
.callbackState(CallbackState.CALLBACK_PROCESSING_COMPLETED)
|
||||
.buildAndStoreAsSummary(taskService);
|
||||
|
@ -3248,6 +3258,100 @@ class TaskQueryImplAccTest {
|
|||
@TestInstance(Lifecycle.PER_CLASS)
|
||||
class CustomAttributes {}
|
||||
|
||||
@Nested
|
||||
@TestInstance(Lifecycle.PER_CLASS)
|
||||
class CustomIntFields {
|
||||
WorkbasketSummary wb;
|
||||
TaskSummary taskSummary1;
|
||||
TaskSummary taskSummary2;
|
||||
TaskSummary taskSummary3;
|
||||
|
||||
@WithAccessId(user = "user-1-1")
|
||||
@BeforeAll
|
||||
void setup() throws Exception {
|
||||
wb = createWorkbasketWithPermission();
|
||||
taskSummary1 =
|
||||
taskInWorkbasket(wb)
|
||||
.customIntField(TaskCustomIntField.CUSTOM_INT_1, 1)
|
||||
.customIntField(TaskCustomIntField.CUSTOM_INT_2, 2)
|
||||
.customIntField(TaskCustomIntField.CUSTOM_INT_3, 3)
|
||||
.customIntField(TaskCustomIntField.CUSTOM_INT_4, 4)
|
||||
.customIntField(TaskCustomIntField.CUSTOM_INT_5, 5)
|
||||
.customIntField(TaskCustomIntField.CUSTOM_INT_6, 6)
|
||||
.customIntField(TaskCustomIntField.CUSTOM_INT_7, 7)
|
||||
.customIntField(TaskCustomIntField.CUSTOM_INT_8, 8)
|
||||
.buildAndStoreAsSummary(taskService);
|
||||
taskSummary2 =
|
||||
taskInWorkbasket(wb)
|
||||
.customIntField(TaskCustomIntField.CUSTOM_INT_1, -1)
|
||||
.customIntField(TaskCustomIntField.CUSTOM_INT_2, -2)
|
||||
.customIntField(TaskCustomIntField.CUSTOM_INT_3, -3)
|
||||
.customIntField(TaskCustomIntField.CUSTOM_INT_4, -4)
|
||||
.customIntField(TaskCustomIntField.CUSTOM_INT_5, -5)
|
||||
.customIntField(TaskCustomIntField.CUSTOM_INT_6, -6)
|
||||
.customIntField(TaskCustomIntField.CUSTOM_INT_7, -7)
|
||||
.customIntField(TaskCustomIntField.CUSTOM_INT_8, -8)
|
||||
.buildAndStoreAsSummary(taskService);
|
||||
taskSummary3 = taskInWorkbasket(wb).buildAndStoreAsSummary(taskService);
|
||||
}
|
||||
|
||||
@WithAccessId(user = "user-1-1")
|
||||
@TestFactory
|
||||
Stream<DynamicTest> should_ApplyFilter_When_QueryingForCustomIntIn() {
|
||||
List<Triplet<String, Integer, TaskCustomIntField>> testCases =
|
||||
List.of(
|
||||
Triplet.of("CustomInt1", 1, TaskCustomIntField.CUSTOM_INT_1),
|
||||
Triplet.of("CustomInt2", 2, TaskCustomIntField.CUSTOM_INT_2),
|
||||
Triplet.of("CustomInt3", 3, TaskCustomIntField.CUSTOM_INT_3),
|
||||
Triplet.of("CustomInt4", 4, TaskCustomIntField.CUSTOM_INT_4),
|
||||
Triplet.of("CustomInt5", 5, TaskCustomIntField.CUSTOM_INT_5),
|
||||
Triplet.of("CustomInt6", 6, TaskCustomIntField.CUSTOM_INT_6),
|
||||
Triplet.of("CustomInt7", 7, TaskCustomIntField.CUSTOM_INT_7),
|
||||
Triplet.of("CustomInt8", 8, TaskCustomIntField.CUSTOM_INT_8));
|
||||
|
||||
ThrowingConsumer<Triplet<String, Integer, TaskCustomIntField>> test =
|
||||
t -> {
|
||||
List<TaskSummary> result =
|
||||
taskService
|
||||
.createTaskQuery()
|
||||
.workbasketIdIn(wb.getId())
|
||||
.customIntAttributeIn(t.getRight(), t.getMiddle())
|
||||
.list();
|
||||
assertThat(result).containsExactly(taskSummary1);
|
||||
};
|
||||
|
||||
return DynamicTest.stream(testCases.iterator(), Triplet::getLeft, test);
|
||||
}
|
||||
|
||||
@WithAccessId(user = "user-1-1")
|
||||
@TestFactory
|
||||
Stream<DynamicTest> should_ApplyFilter_When_QueryingForCustomIntNotIn() {
|
||||
List<Triplet<String, Integer, TaskCustomIntField>> testCases =
|
||||
List.of(
|
||||
Triplet.of("CustomInt1", 1, TaskCustomIntField.CUSTOM_INT_1),
|
||||
Triplet.of("CustomInt2", 2, TaskCustomIntField.CUSTOM_INT_2),
|
||||
Triplet.of("CustomInt3", 3, TaskCustomIntField.CUSTOM_INT_3),
|
||||
Triplet.of("CustomInt4", 4, TaskCustomIntField.CUSTOM_INT_4),
|
||||
Triplet.of("CustomInt5", 5, TaskCustomIntField.CUSTOM_INT_5),
|
||||
Triplet.of("CustomInt6", 6, TaskCustomIntField.CUSTOM_INT_6),
|
||||
Triplet.of("CustomInt7", 7, TaskCustomIntField.CUSTOM_INT_7),
|
||||
Triplet.of("CustomInt8", 8, TaskCustomIntField.CUSTOM_INT_8));
|
||||
|
||||
ThrowingConsumer<Triplet<String, Integer, TaskCustomIntField>> test =
|
||||
t -> {
|
||||
List<TaskSummary> result =
|
||||
taskService
|
||||
.createTaskQuery()
|
||||
.workbasketIdIn(wb.getId())
|
||||
.customIntAttributeNotIn(t.getRight(), t.getMiddle())
|
||||
.list();
|
||||
assertThat(result).containsExactlyInAnyOrder(taskSummary2);
|
||||
};
|
||||
|
||||
return DynamicTest.stream(testCases.iterator(), Triplet::getLeft, test);
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestInstance(Lifecycle.PER_CLASS)
|
||||
class CallbackStates {
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
package pro.taskana.task.api;
|
||||
|
||||
public enum TaskCustomIntField {
|
||||
CUSTOM_INT_1,
|
||||
CUSTOM_INT_2,
|
||||
CUSTOM_INT_3,
|
||||
CUSTOM_INT_4,
|
||||
CUSTOM_INT_5,
|
||||
CUSTOM_INT_6,
|
||||
CUSTOM_INT_7,
|
||||
CUSTOM_INT_8,
|
||||
}
|
|
@ -1679,6 +1679,44 @@ public interface TaskQuery extends BaseQuery<TaskSummary, TaskQueryColumnName> {
|
|||
*/
|
||||
TaskQuery orderByCustomAttribute(TaskCustomField customField, SortDirection sortDirection);
|
||||
|
||||
// endregion
|
||||
// region customIntAttributes
|
||||
|
||||
/**
|
||||
* Add the values of the specified {@linkplain TaskCustomIntField} for exact matching to your
|
||||
* query.
|
||||
*
|
||||
* @param customField identifies which {@linkplain TaskCustomIntField} is affected
|
||||
* @param searchArguments the corresponding values of the searched for {@linkplain Task Tasks}
|
||||
* @return the query
|
||||
* @throws InvalidArgumentException if searchArguments are not given
|
||||
*/
|
||||
TaskQuery customIntAttributeIn(TaskCustomIntField customField, Integer... searchArguments)
|
||||
throws InvalidArgumentException;
|
||||
|
||||
/**
|
||||
* Exclude these values of the specified {@linkplain TaskCustomIntField} from your query.
|
||||
*
|
||||
* @param customIntField identifies which {@linkplain TaskCustomIntField} is affected
|
||||
* @param searchArguments the corresponding customIntField values of the searched for {@linkplain
|
||||
* Task Tasks}
|
||||
* @return the query
|
||||
* @throws InvalidArgumentException if searchArguments are not given
|
||||
*/
|
||||
TaskQuery customIntAttributeNotIn(TaskCustomIntField customIntField, Integer... searchArguments)
|
||||
throws InvalidArgumentException;
|
||||
|
||||
/**
|
||||
* This method sorts the query result according to the value of the specified {@linkplain
|
||||
* TaskCustomIntField}.
|
||||
*
|
||||
* @param customIntField identifies which {@linkplain TaskCustomIntField} is affected
|
||||
* @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 orderByCustomIntAttribute(
|
||||
TaskCustomIntField customIntField, SortDirection sortDirection);
|
||||
// endregion
|
||||
// region callbackState
|
||||
|
||||
|
|
|
@ -54,6 +54,14 @@ public enum TaskQueryColumnName implements QueryColumnName {
|
|||
CUSTOM_14("t.custom_14"),
|
||||
CUSTOM_15("t.custom_15"),
|
||||
CUSTOM_16("t.custom_16"),
|
||||
CUSTOM_INT_1("t.custom_int_1"),
|
||||
CUSTOM_INT_2("t.custom_int_2"),
|
||||
CUSTOM_INT_3("t.custom_int_3"),
|
||||
CUSTOM_INT_4("t.custom_int_4"),
|
||||
CUSTOM_INT_5("t.custom_int_5"),
|
||||
CUSTOM_INT_6("t.custom_int_6"),
|
||||
CUSTOM_INT_7("t.custom_int_7"),
|
||||
CUSTOM_INT_8("t.custom_int_8"),
|
||||
A_CLASSIFICATION_NAME("ac.name"),
|
||||
A_CLASSIFICATION_ID("a.classification_id"),
|
||||
A_CLASSIFICATION_KEY("a.classification_key"),
|
||||
|
|
|
@ -6,6 +6,7 @@ import java.util.Map;
|
|||
|
||||
import pro.taskana.classification.api.models.Classification;
|
||||
import pro.taskana.task.api.TaskCustomField;
|
||||
import pro.taskana.task.api.TaskCustomIntField;
|
||||
import pro.taskana.task.api.TaskService;
|
||||
import pro.taskana.user.api.models.User;
|
||||
import pro.taskana.workbasket.api.models.WorkbasketSummary;
|
||||
|
@ -140,6 +141,15 @@ public interface Task extends TaskSummary {
|
|||
*/
|
||||
void setCustomField(TaskCustomField customField, String value);
|
||||
|
||||
/**
|
||||
* Sets the value for the specified {@linkplain TaskCustomIntField custoIntField}.
|
||||
*
|
||||
* @param customIntField identifies which {@linkplain TaskCustomIntField customIntField} is to be
|
||||
* set
|
||||
* @param value the value of the {@linkplain TaskCustomIntField customIntField} to be set
|
||||
*/
|
||||
void setCustomIntField(TaskCustomIntField customIntField, Integer value);
|
||||
|
||||
/**
|
||||
* Add an {@linkplain Attachment}.<br>
|
||||
* NULL will be ignored and an {@linkplain Attachment} with the same id will be replaced by the
|
||||
|
|
|
@ -5,6 +5,7 @@ import java.util.List;
|
|||
|
||||
import pro.taskana.classification.api.models.ClassificationSummary;
|
||||
import pro.taskana.task.api.TaskCustomField;
|
||||
import pro.taskana.task.api.TaskCustomIntField;
|
||||
import pro.taskana.task.api.TaskService;
|
||||
import pro.taskana.task.api.TaskState;
|
||||
import pro.taskana.workbasket.api.models.WorkbasketSummary;
|
||||
|
@ -281,6 +282,14 @@ public interface TaskSummary {
|
|||
*/
|
||||
String getCustomField(TaskCustomField customField);
|
||||
|
||||
/**
|
||||
* Returns the value of the specified {@linkplain TaskCustomIntField} of the {@linkplain Task}.
|
||||
*
|
||||
* @param customIntField identifies which {@linkplain TaskCustomIntField} is requested
|
||||
* @return the value for the given {@linkplain TaskCustomIntField}
|
||||
*/
|
||||
Integer getCustomIntField(TaskCustomIntField customIntField);
|
||||
|
||||
/**
|
||||
* Duplicates this TaskSummary without the internal and external id.
|
||||
*
|
||||
|
|
|
@ -27,7 +27,8 @@ public interface TaskMapper {
|
|||
|
||||
@Select(
|
||||
"<script>SELECT ID, EXTERNAL_ID, CREATED, CLAIMED, COMPLETED, MODIFIED, PLANNED, RECEIVED, DUE, NAME, CREATOR, DESCRIPTION, NOTE, PRIORITY, MANUAL_PRIORITY, STATE, CLASSIFICATION_CATEGORY, CLASSIFICATION_KEY, CLASSIFICATION_ID, WORKBASKET_ID, WORKBASKET_KEY, DOMAIN, BUSINESS_PROCESS_ID, PARENT_BUSINESS_PROCESS_ID, OWNER, POR_COMPANY, POR_SYSTEM, POR_INSTANCE, POR_TYPE, POR_VALUE, IS_READ, IS_TRANSFERRED, CALLBACK_INFO, CALLBACK_STATE, CUSTOM_ATTRIBUTES, "
|
||||
+ "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 "
|
||||
+ "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, "
|
||||
+ "CUSTOM_INT_1, CUSTOM_INT_2, CUSTOM_INT_3, CUSTOM_INT_4, CUSTOM_INT_5, CUSTOM_INT_6, CUSTOM_INT_7, CUSTOM_INT_8 "
|
||||
+ "FROM TASK "
|
||||
+ "WHERE ID = #{id} "
|
||||
+ "<if test=\"_databaseId == 'db2'\">with UR </if> "
|
||||
|
@ -91,19 +92,27 @@ public interface TaskMapper {
|
|||
@Result(property = "custom14", column = "CUSTOM_14")
|
||||
@Result(property = "custom15", column = "CUSTOM_15")
|
||||
@Result(property = "custom16", column = "CUSTOM_16")
|
||||
@Result(property = "customInt1", column = "CUSTOM_INT_1")
|
||||
@Result(property = "customInt2", column = "CUSTOM_INT_2")
|
||||
@Result(property = "customInt3", column = "CUSTOM_INT_3")
|
||||
@Result(property = "customInt4", column = "CUSTOM_INT_4")
|
||||
@Result(property = "customInt5", column = "CUSTOM_INT_5")
|
||||
@Result(property = "customInt6", column = "CUSTOM_INT_6")
|
||||
@Result(property = "customInt7", column = "CUSTOM_INT_7")
|
||||
@Result(property = "customInt8", column = "CUSTOM_INT_8")
|
||||
TaskImpl findById(@Param("id") String id);
|
||||
|
||||
@Insert(
|
||||
"INSERT INTO TASK(ID, EXTERNAL_ID, CREATED, CLAIMED, COMPLETED, MODIFIED, PLANNED, RECEIVED, DUE, NAME, CREATOR, DESCRIPTION, NOTE, PRIORITY, MANUAL_PRIORITY, STATE, CLASSIFICATION_CATEGORY, CLASSIFICATION_KEY, CLASSIFICATION_ID, WORKBASKET_ID, WORKBASKET_KEY, DOMAIN, BUSINESS_PROCESS_ID, PARENT_BUSINESS_PROCESS_ID, OWNER, POR_COMPANY, "
|
||||
+ "POR_SYSTEM, POR_INSTANCE, POR_TYPE, POR_VALUE, IS_READ, IS_TRANSFERRED, CALLBACK_INFO, CALLBACK_STATE, CUSTOM_ATTRIBUTES, 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 ) "
|
||||
+ "CUSTOM_9, CUSTOM_10, CUSTOM_11, CUSTOM_12, CUSTOM_13, CUSTOM_14, CUSTOM_15, CUSTOM_16, CUSTOM_INT_1, CUSTOM_INT_2, CUSTOM_INT_3, CUSTOM_INT_4, CUSTOM_INT_5, CUSTOM_INT_6, CUSTOM_INT_7, CUSTOM_INT_8 ) "
|
||||
+ "VALUES(#{id},#{externalId}, #{created}, #{claimed}, #{completed}, #{modified}, #{planned}, #{received}, #{due}, #{name}, #{creator}, #{description}, #{note}, #{priority}, #{manualPriority}, #{state}, #{classificationSummary.category}, "
|
||||
+ "#{classificationSummary.key}, #{classificationSummary.id}, #{workbasketSummary.id}, #{workbasketSummary.key}, #{workbasketSummary.domain}, #{businessProcessId}, "
|
||||
+ "#{parentBusinessProcessId}, #{owner}, #{primaryObjRef.company}, #{primaryObjRef.system}, #{primaryObjRef.systemInstance}, #{primaryObjRef.type}, #{primaryObjRef.value}, "
|
||||
+ "#{isRead}, #{isTransferred}, #{callbackInfo,jdbcType=CLOB,javaType=java.util.Map,typeHandler=pro.taskana.common.internal.persistence.MapTypeHandler}, #{callbackState}, "
|
||||
+ "#{customAttributes,jdbcType=CLOB,javaType=java.util.Map,typeHandler=pro.taskana.common.internal.persistence.MapTypeHandler}, "
|
||||
+ "#{custom1}, #{custom2}, #{custom3}, #{custom4}, #{custom5}, #{custom6}, #{custom7}, #{custom8}, #{custom9}, #{custom10}, "
|
||||
+ "#{custom11}, #{custom12}, #{custom13}, #{custom14}, #{custom15}, #{custom16})")
|
||||
+ "#{custom11}, #{custom12}, #{custom13}, #{custom14}, #{custom15}, #{custom16}, #{customInt1}, #{customInt2}, #{customInt3}, #{customInt4}, #{customInt5}, #{customInt6}, #{customInt7}, #{customInt8})")
|
||||
@Options(keyProperty = "id", keyColumn = "ID")
|
||||
void insert(TaskImpl task);
|
||||
|
||||
|
@ -116,7 +125,8 @@ public interface TaskMapper {
|
|||
+ "CALLBACK_INFO = #{callbackInfo,jdbcType=CLOB,javaType=java.util.Map,typeHandler=pro.taskana.common.internal.persistence.MapTypeHandler}, "
|
||||
+ "CUSTOM_ATTRIBUTES = #{customAttributes,jdbcType=CLOB,javaType=java.util.Map,typeHandler=pro.taskana.common.internal.persistence.MapTypeHandler}, CUSTOM_1 = #{custom1}, CUSTOM_2 = #{custom2}, "
|
||||
+ "CUSTOM_3 = #{custom3}, CUSTOM_4 = #{custom4}, CUSTOM_5 = #{custom5}, CUSTOM_6 = #{custom6}, CUSTOM_7 = #{custom7}, CUSTOM_8 = #{custom8}, "
|
||||
+ "CUSTOM_9 = #{custom9}, CUSTOM_10 = #{custom10}, CUSTOM_11 = #{custom11}, CUSTOM_12 = #{custom12}, CUSTOM_13 = #{custom13}, CUSTOM_14 = #{custom14}, CUSTOM_15 = #{custom15}, CUSTOM_16 = #{custom16} "
|
||||
+ "CUSTOM_9 = #{custom9}, CUSTOM_10 = #{custom10}, CUSTOM_11 = #{custom11}, CUSTOM_12 = #{custom12}, CUSTOM_13 = #{custom13}, CUSTOM_14 = #{custom14}, CUSTOM_15 = #{custom15}, CUSTOM_16 = #{custom16}, "
|
||||
+ "CUSTOM_INT_1 = #{customInt1}, CUSTOM_INT_2 = #{customInt2}, CUSTOM_INT_3 = #{customInt3}, CUSTOM_INT_4 = #{customInt4}, CUSTOM_INT_5 = #{customInt5}, CUSTOM_INT_6 = #{customInt6}, CUSTOM_INT_7 = #{customInt7}, CUSTOM_INT_8 = #{customInt8} "
|
||||
+ "WHERE ID = #{id}")
|
||||
void update(TaskImpl task);
|
||||
|
||||
|
|
|
@ -20,6 +20,7 @@ import pro.taskana.common.internal.configuration.DB;
|
|||
import pro.taskana.task.api.CallbackState;
|
||||
import pro.taskana.task.api.ObjectReferenceQuery;
|
||||
import pro.taskana.task.api.TaskCustomField;
|
||||
import pro.taskana.task.api.TaskCustomIntField;
|
||||
import pro.taskana.task.api.TaskQuery;
|
||||
import pro.taskana.task.api.TaskQueryColumnName;
|
||||
import pro.taskana.task.api.TaskState;
|
||||
|
@ -285,6 +286,26 @@ public class TaskQueryImpl implements TaskQuery {
|
|||
private boolean custom16NotInContainsNull;
|
||||
private String[] custom16Like;
|
||||
private String[] custom16NotLike;
|
||||
// endregion
|
||||
// region customIntAttributes
|
||||
private Integer[] customInt1In;
|
||||
private Integer[] customInt1NotIn;
|
||||
private Integer[] customInt2In;
|
||||
private Integer[] customInt2NotIn;
|
||||
private Integer[] customInt3In;
|
||||
private Integer[] customInt3NotIn;
|
||||
private Integer[] customInt4In;
|
||||
private Integer[] customInt4NotIn;
|
||||
private Integer[] customInt5In;
|
||||
private Integer[] customInt5NotIn;
|
||||
private Integer[] customInt6In;
|
||||
private Integer[] customInt6NotIn;
|
||||
private Integer[] customInt7In;
|
||||
private Integer[] customInt7NotIn;
|
||||
private Integer[] customInt8In;
|
||||
private Integer[] customInt8NotIn;
|
||||
// endregion
|
||||
// region callbackState
|
||||
private CallbackState[] callbackStateIn;
|
||||
private CallbackState[] callbackStateNotIn;
|
||||
private WildcardSearchField[] wildcardSearchFieldIn;
|
||||
|
@ -1643,6 +1664,101 @@ public class TaskQueryImpl implements TaskQuery {
|
|||
return addOrderCriteria(customField.name(), sortDirection);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TaskQuery customIntAttributeNotIn(TaskCustomIntField customIntField, Integer... values)
|
||||
throws InvalidArgumentException {
|
||||
if (values.length == 0) {
|
||||
throw new InvalidArgumentException(
|
||||
"At least one Integer has to be provided as a search parameter");
|
||||
}
|
||||
List<Integer> conditionList = new ArrayList<>(Arrays.asList(values));
|
||||
boolean containsNull = conditionList.contains(null);
|
||||
if (containsNull) {
|
||||
conditionList.remove(null);
|
||||
}
|
||||
switch (customIntField) {
|
||||
case CUSTOM_INT_1:
|
||||
this.customInt1NotIn = conditionList.toArray(new Integer[0]);
|
||||
break;
|
||||
case CUSTOM_INT_2:
|
||||
this.customInt2NotIn = conditionList.toArray(new Integer[0]);
|
||||
break;
|
||||
case CUSTOM_INT_3:
|
||||
this.customInt3NotIn = conditionList.toArray(new Integer[0]);
|
||||
break;
|
||||
case CUSTOM_INT_4:
|
||||
this.customInt4NotIn = conditionList.toArray(new Integer[0]);
|
||||
break;
|
||||
case CUSTOM_INT_5:
|
||||
this.customInt5NotIn = conditionList.toArray(new Integer[0]);
|
||||
break;
|
||||
case CUSTOM_INT_6:
|
||||
this.customInt6NotIn = conditionList.toArray(new Integer[0]);
|
||||
break;
|
||||
case CUSTOM_INT_7:
|
||||
this.customInt7NotIn = conditionList.toArray(new Integer[0]);
|
||||
break;
|
||||
case CUSTOM_INT_8:
|
||||
this.customInt8NotIn = conditionList.toArray(new Integer[0]);
|
||||
break;
|
||||
default:
|
||||
throw new SystemException("Unknown custom int field '" + customIntField + "'");
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TaskQuery customIntAttributeIn(TaskCustomIntField customIntField, Integer... values)
|
||||
throws InvalidArgumentException {
|
||||
if (values.length == 0) {
|
||||
throw new InvalidArgumentException(
|
||||
"At least one Integer has to be provided as a search parameter");
|
||||
}
|
||||
|
||||
List<Integer> conditionList = new ArrayList<>(Arrays.asList(values));
|
||||
boolean containsNull = conditionList.contains(null);
|
||||
if (containsNull) {
|
||||
conditionList.remove(null);
|
||||
}
|
||||
|
||||
switch (customIntField) {
|
||||
case CUSTOM_INT_1:
|
||||
this.customInt1In = conditionList.toArray(new Integer[0]);
|
||||
break;
|
||||
case CUSTOM_INT_2:
|
||||
this.customInt2In = conditionList.toArray(new Integer[0]);
|
||||
break;
|
||||
case CUSTOM_INT_3:
|
||||
this.customInt3In = conditionList.toArray(new Integer[0]);
|
||||
break;
|
||||
case CUSTOM_INT_4:
|
||||
this.customInt4In = conditionList.toArray(new Integer[0]);
|
||||
break;
|
||||
case CUSTOM_INT_5:
|
||||
this.customInt5In = conditionList.toArray(new Integer[0]);
|
||||
break;
|
||||
case CUSTOM_INT_6:
|
||||
this.customInt6In = conditionList.toArray(new Integer[0]);
|
||||
break;
|
||||
case CUSTOM_INT_7:
|
||||
this.customInt7In = conditionList.toArray(new Integer[0]);
|
||||
break;
|
||||
case CUSTOM_INT_8:
|
||||
this.customInt8In = conditionList.toArray(new Integer[0]);
|
||||
break;
|
||||
default:
|
||||
throw new SystemException("Unknown custom int attribute '" + customIntField + "'");
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TaskQuery orderByCustomIntAttribute(
|
||||
TaskCustomIntField customIntField, SortDirection sortDirection) {
|
||||
return addOrderCriteria(customIntField.name(), sortDirection);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TaskQuery callbackStateIn(CallbackState... states) {
|
||||
this.callbackStateIn = states;
|
||||
|
@ -2402,6 +2518,42 @@ public class TaskQueryImpl implements TaskQuery {
|
|||
+ Arrays.toString(custom16Like)
|
||||
+ ", custom16NotLike="
|
||||
+ Arrays.toString(custom16NotLike)
|
||||
+ ", customInt1In="
|
||||
+ Arrays.toString(customInt1In)
|
||||
+ ", customInt1NotIn="
|
||||
+ Arrays.toString(customInt1NotIn)
|
||||
+ ", customInt2In="
|
||||
+ Arrays.toString(customInt2In)
|
||||
+ ", customInt2NotIn="
|
||||
+ Arrays.toString(customInt2NotIn)
|
||||
+ ", customInt3In="
|
||||
+ Arrays.toString(customInt3In)
|
||||
+ ", customInt3NotIn="
|
||||
+ Arrays.toString(customInt3NotIn)
|
||||
+ ", customInt4In="
|
||||
+ Arrays.toString(customInt4In)
|
||||
+ ", customInt4NotIn="
|
||||
+ Arrays.toString(customInt4NotIn)
|
||||
+ ", customInt5In="
|
||||
+ Arrays.toString(customInt5In)
|
||||
+ ", customInt5NotIn="
|
||||
+ Arrays.toString(customInt5NotIn)
|
||||
+ ", customInt6In="
|
||||
+ Arrays.toString(customInt6In)
|
||||
+ ", customInt6NotIn="
|
||||
+ Arrays.toString(customInt6NotIn)
|
||||
+ ", customInt7In="
|
||||
+ Arrays.toString(customInt7In)
|
||||
+ ", customInt7NotIn="
|
||||
+ Arrays.toString(custom7NotIn)
|
||||
+ ", custom7Like="
|
||||
+ Arrays.toString(custom7Like)
|
||||
+ ", custom7NotLike="
|
||||
+ Arrays.toString(custom7NotLike)
|
||||
+ ", custom8In="
|
||||
+ Arrays.toString(custom8In)
|
||||
+ ", custom8NotIn="
|
||||
+ Arrays.toString(custom8NotIn)
|
||||
+ ", callbackStateIn="
|
||||
+ Arrays.toString(callbackStateIn)
|
||||
+ ", callbackStateNotIn="
|
||||
|
|
|
@ -60,6 +60,14 @@ public interface TaskQueryMapper {
|
|||
@Result(property = "custom14", column = "CUSTOM_14")
|
||||
@Result(property = "custom15", column = "CUSTOM_15")
|
||||
@Result(property = "custom16", column = "CUSTOM_16")
|
||||
@Result(property = "customInt1", column = "CUSTOM_INT_1")
|
||||
@Result(property = "customInt2", column = "CUSTOM_INT_2")
|
||||
@Result(property = "customInt3", column = "CUSTOM_INT_3")
|
||||
@Result(property = "customInt4", column = "CUSTOM_INT_4")
|
||||
@Result(property = "customInt5", column = "CUSTOM_INT_5")
|
||||
@Result(property = "customInt6", column = "CUSTOM_INT_6")
|
||||
@Result(property = "customInt7", column = "CUSTOM_INT_7")
|
||||
@Result(property = "customInt8", column = "CUSTOM_INT_8")
|
||||
List<TaskSummaryImpl> queryTaskSummaries(TaskQueryImpl taskQuery);
|
||||
|
||||
@SelectProvider(type = TaskQuerySqlProvider.class, method = "queryTaskSummariesDb2")
|
||||
|
@ -113,6 +121,14 @@ public interface TaskQueryMapper {
|
|||
@Result(property = "custom14", column = "CUSTOM_14")
|
||||
@Result(property = "custom15", column = "CUSTOM_15")
|
||||
@Result(property = "custom16", column = "CUSTOM_16")
|
||||
@Result(property = "customInt1", column = "CUSTOM_INT_1")
|
||||
@Result(property = "customInt2", column = "CUSTOM_INT_2")
|
||||
@Result(property = "customInt3", column = "CUSTOM_INT_3")
|
||||
@Result(property = "customInt4", column = "CUSTOM_INT_4")
|
||||
@Result(property = "customInt5", column = "CUSTOM_INT_5")
|
||||
@Result(property = "customInt6", column = "CUSTOM_INT_6")
|
||||
@Result(property = "customInt7", column = "CUSTOM_INT_7")
|
||||
@Result(property = "customInt8", column = "CUSTOM_INT_8")
|
||||
List<TaskSummaryImpl> queryTaskSummariesDb2(TaskQueryImpl taskQuery);
|
||||
|
||||
@SelectProvider(type = TaskQuerySqlProvider.class, method = "countQueryTasks")
|
||||
|
|
|
@ -5,6 +5,7 @@ import static pro.taskana.common.internal.util.SqlProviderUtil.CLOSING_WHERE_TAG
|
|||
import static pro.taskana.common.internal.util.SqlProviderUtil.DB2_WITH_UR;
|
||||
import static pro.taskana.common.internal.util.SqlProviderUtil.OPENING_SCRIPT_TAG;
|
||||
import static pro.taskana.common.internal.util.SqlProviderUtil.OPENING_WHERE_TAG;
|
||||
import static pro.taskana.common.internal.util.SqlProviderUtil.whereCustomIntStatements;
|
||||
import static pro.taskana.common.internal.util.SqlProviderUtil.whereCustomStatements;
|
||||
import static pro.taskana.common.internal.util.SqlProviderUtil.whereIn;
|
||||
import static pro.taskana.common.internal.util.SqlProviderUtil.whereInTime;
|
||||
|
@ -283,21 +284,21 @@ public class TaskQuerySqlProvider {
|
|||
|
||||
private static String db2selectFields() {
|
||||
// needs to be the same order as the commonSelectFields (TaskQueryColumnValue)
|
||||
return "ID, EXTERNAL_ID, CREATED, CLAIMED, COMPLETED, MODIFIED, PLANNED, RECEIVED, DUE, NAME, "
|
||||
+ "CREATOR, DESCRIPTION, NOTE, PRIORITY, MANUAL_PRIORITY, STATE, CLASSIFICATION_CATEGORY, "
|
||||
+ "TCLASSIFICATION_KEY, CLASSIFICATION_ID, "
|
||||
+ "WORKBASKET_ID, WORKBASKET_KEY, DOMAIN, "
|
||||
+ "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=\"addClassificationNameToSelectClauseForOrdering\">, CNAME</if>"
|
||||
+ "<if test=\"addAttachmentClassificationNameToSelectClauseForOrdering\">, ACNAME</if>"
|
||||
+ "<if test=\"addAttachmentColumnsToSelectClauseForOrdering\">"
|
||||
+ ", ACLASSIFICATION_ID, ACLASSIFICATION_KEY, CHANNEL, REF_VALUE, ARECEIVED"
|
||||
+ "</if>"
|
||||
+ "<if test=\"addWorkbasketNameToSelectClauseForOrdering\">, WNAME</if>"
|
||||
+ "<if test=\"joinWithUserInfo\">, ULONG_NAME </if>";
|
||||
return "ID, EXTERNAL_ID, CREATED, CLAIMED, COMPLETED, MODIFIED, PLANNED, RECEIVED, DUE, NAME,"
|
||||
+ " CREATOR, DESCRIPTION, NOTE, PRIORITY, MANUAL_PRIORITY, STATE,"
|
||||
+ " CLASSIFICATION_CATEGORY, TCLASSIFICATION_KEY, CLASSIFICATION_ID, WORKBASKET_ID,"
|
||||
+ " WORKBASKET_KEY, DOMAIN, 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, CUSTOM_INT_1, CUSTOM_INT_2, CUSTOM_INT_3,"
|
||||
+ " CUSTOM_INT_4, CUSTOM_INT_5, CUSTOM_INT_6, CUSTOM_INT_7, CUSTOM_INT_8 <if"
|
||||
+ " test=\"addClassificationNameToSelectClauseForOrdering\">, CNAME</if><if"
|
||||
+ " test=\"addAttachmentClassificationNameToSelectClauseForOrdering\">,"
|
||||
+ " ACNAME</if><if test=\"addAttachmentColumnsToSelectClauseForOrdering\">,"
|
||||
+ " ACLASSIFICATION_ID, ACLASSIFICATION_KEY, CHANNEL, REF_VALUE, ARECEIVED</if><if"
|
||||
+ " test=\"addWorkbasketNameToSelectClauseForOrdering\">, WNAME</if><if"
|
||||
+ " test=\"joinWithUserInfo\">, ULONG_NAME </if>";
|
||||
}
|
||||
|
||||
private static String checkForAuthorization() {
|
||||
|
@ -441,6 +442,7 @@ public class TaskQuerySqlProvider {
|
|||
whereLike("ownerLongNameLike", "u.LONG_NAME", sb);
|
||||
whereNotLike("ownerLongNameNotLike", "u.LONG_NAME", sb);
|
||||
whereCustomStatements("custom", "t.CUSTOM", 16, sb);
|
||||
whereCustomIntStatements("customInt", "t.CUSTOM_INT", 8, sb);
|
||||
|
||||
sb.append("<if test='isRead != null'>AND IS_READ = #{isRead}</if> ");
|
||||
sb.append("<if test='isTransferred != null'>AND IS_TRANSFERRED = #{isTransferred}</if> ");
|
||||
|
|
|
@ -11,6 +11,7 @@ import pro.taskana.classification.internal.models.ClassificationSummaryImpl;
|
|||
import pro.taskana.common.api.exceptions.SystemException;
|
||||
import pro.taskana.task.api.CallbackState;
|
||||
import pro.taskana.task.api.TaskCustomField;
|
||||
import pro.taskana.task.api.TaskCustomIntField;
|
||||
import pro.taskana.task.api.models.Attachment;
|
||||
import pro.taskana.task.api.models.AttachmentSummary;
|
||||
import pro.taskana.task.api.models.Task;
|
||||
|
@ -170,6 +171,38 @@ public class TaskImpl extends TaskSummaryImpl implements Task {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCustomIntField(TaskCustomIntField customIntField, Integer value) {
|
||||
switch (customIntField) {
|
||||
case CUSTOM_INT_1:
|
||||
customInt1 = value;
|
||||
break;
|
||||
case CUSTOM_INT_2:
|
||||
customInt2 = value;
|
||||
break;
|
||||
case CUSTOM_INT_3:
|
||||
customInt3 = value;
|
||||
break;
|
||||
case CUSTOM_INT_4:
|
||||
customInt4 = value;
|
||||
break;
|
||||
case CUSTOM_INT_5:
|
||||
customInt5 = value;
|
||||
break;
|
||||
case CUSTOM_INT_6:
|
||||
customInt6 = value;
|
||||
break;
|
||||
case CUSTOM_INT_7:
|
||||
customInt7 = value;
|
||||
break;
|
||||
case CUSTOM_INT_8:
|
||||
customInt8 = value;
|
||||
break;
|
||||
default:
|
||||
throw new SystemException("Unknown customIntField '" + customIntField + "'");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addAttachment(Attachment attachmentToAdd) {
|
||||
if (attachments == null) {
|
||||
|
@ -232,6 +265,14 @@ public class TaskImpl extends TaskSummaryImpl implements Task {
|
|||
taskSummary.setCustom14(custom14);
|
||||
taskSummary.setCustom15(custom15);
|
||||
taskSummary.setCustom16(custom16);
|
||||
taskSummary.setCustomInt1(customInt1);
|
||||
taskSummary.setCustomInt2(customInt2);
|
||||
taskSummary.setCustomInt3(customInt3);
|
||||
taskSummary.setCustomInt4(customInt4);
|
||||
taskSummary.setCustomInt5(customInt5);
|
||||
taskSummary.setCustomInt6(customInt6);
|
||||
taskSummary.setCustomInt7(customInt7);
|
||||
taskSummary.setCustomInt8(customInt8);
|
||||
taskSummary.setDue(due);
|
||||
taskSummary.setId(id);
|
||||
taskSummary.setModified(modified);
|
||||
|
@ -405,6 +446,22 @@ public class TaskImpl extends TaskSummaryImpl implements Task {
|
|||
+ custom15
|
||||
+ ", custom16="
|
||||
+ custom16
|
||||
+ ", customInt1="
|
||||
+ customInt1
|
||||
+ ", customInt2="
|
||||
+ customInt2
|
||||
+ ", customInt3="
|
||||
+ customInt3
|
||||
+ ", customInt4="
|
||||
+ customInt4
|
||||
+ ", customInt5="
|
||||
+ customInt5
|
||||
+ ", customInt6="
|
||||
+ customInt6
|
||||
+ ", customInt7="
|
||||
+ customInt7
|
||||
+ ", customInt8="
|
||||
+ customInt8
|
||||
+ "]";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@ import pro.taskana.classification.api.models.ClassificationSummary;
|
|||
import pro.taskana.classification.internal.models.ClassificationSummaryImpl;
|
||||
import pro.taskana.common.api.exceptions.SystemException;
|
||||
import pro.taskana.task.api.TaskCustomField;
|
||||
import pro.taskana.task.api.TaskCustomIntField;
|
||||
import pro.taskana.task.api.TaskState;
|
||||
import pro.taskana.task.api.models.AttachmentSummary;
|
||||
import pro.taskana.task.api.models.ObjectReference;
|
||||
|
@ -65,6 +66,14 @@ public class TaskSummaryImpl implements TaskSummary {
|
|||
protected String custom14;
|
||||
protected String custom15;
|
||||
protected String custom16;
|
||||
protected Integer customInt1;
|
||||
protected Integer customInt2;
|
||||
protected Integer customInt3;
|
||||
protected Integer customInt4;
|
||||
protected Integer customInt5;
|
||||
protected Integer customInt6;
|
||||
protected Integer customInt7;
|
||||
protected Integer customInt8;
|
||||
|
||||
public TaskSummaryImpl() {}
|
||||
|
||||
|
@ -113,6 +122,14 @@ public class TaskSummaryImpl implements TaskSummary {
|
|||
custom14 = copyFrom.custom14;
|
||||
custom15 = copyFrom.custom15;
|
||||
custom16 = copyFrom.custom16;
|
||||
customInt1 = copyFrom.customInt1;
|
||||
customInt2 = copyFrom.customInt2;
|
||||
customInt3 = copyFrom.customInt3;
|
||||
customInt4 = copyFrom.customInt4;
|
||||
customInt5 = copyFrom.customInt5;
|
||||
customInt6 = copyFrom.customInt6;
|
||||
customInt7 = copyFrom.customInt7;
|
||||
customInt8 = copyFrom.customInt8;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -425,6 +442,31 @@ public class TaskSummaryImpl implements TaskSummary {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer getCustomIntField(TaskCustomIntField customIntField) {
|
||||
|
||||
switch (customIntField) {
|
||||
case CUSTOM_INT_1:
|
||||
return customInt1;
|
||||
case CUSTOM_INT_2:
|
||||
return customInt2;
|
||||
case CUSTOM_INT_3:
|
||||
return customInt3;
|
||||
case CUSTOM_INT_4:
|
||||
return customInt4;
|
||||
case CUSTOM_INT_5:
|
||||
return customInt5;
|
||||
case CUSTOM_INT_6:
|
||||
return customInt6;
|
||||
case CUSTOM_INT_7:
|
||||
return customInt7;
|
||||
case CUSTOM_INT_8:
|
||||
return customInt8;
|
||||
default:
|
||||
throw new SystemException("Unknown custom int field '" + customIntField + "'");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isManualPriorityActive() {
|
||||
return manualPriority >= 0;
|
||||
|
@ -660,6 +702,70 @@ public class TaskSummaryImpl implements TaskSummary {
|
|||
this.custom16 = custom16 == null ? null : custom16.trim();
|
||||
}
|
||||
|
||||
public Integer getCustomInt1() {
|
||||
return customInt1;
|
||||
}
|
||||
|
||||
public void setCustomInt1(Integer customInt1) {
|
||||
this.customInt1 = customInt1;
|
||||
}
|
||||
|
||||
public Integer getCustomInt2() {
|
||||
return customInt2;
|
||||
}
|
||||
|
||||
public void setCustomInt2(Integer customInt2) {
|
||||
this.customInt2 = customInt2;
|
||||
}
|
||||
|
||||
public Integer getCustomInt3() {
|
||||
return customInt3;
|
||||
}
|
||||
|
||||
public void setCustomInt3(Integer customInt3) {
|
||||
this.customInt3 = customInt3;
|
||||
}
|
||||
|
||||
public Integer getCustomInt4() {
|
||||
return customInt4;
|
||||
}
|
||||
|
||||
public void setCustomInt4(Integer customInt4) {
|
||||
this.customInt4 = customInt4;
|
||||
}
|
||||
|
||||
public Integer getCustomInt5() {
|
||||
return customInt5;
|
||||
}
|
||||
|
||||
public void setCustomInt5(Integer customInt5) {
|
||||
this.customInt5 = customInt5;
|
||||
}
|
||||
|
||||
public Integer getCustomInt6() {
|
||||
return customInt6;
|
||||
}
|
||||
|
||||
public void setCustomInt6(Integer customInt6) {
|
||||
this.customInt6 = customInt6;
|
||||
}
|
||||
|
||||
public Integer getCustomInt7() {
|
||||
return customInt7;
|
||||
}
|
||||
|
||||
public void setCustomInt7(Integer customInt7) {
|
||||
this.customInt7 = customInt7;
|
||||
}
|
||||
|
||||
public Integer getCustomInt8() {
|
||||
return customInt8;
|
||||
}
|
||||
|
||||
public void setCustomInt8(Integer customInt8) {
|
||||
this.customInt8 = customInt8;
|
||||
}
|
||||
|
||||
protected boolean canEqual(Object other) {
|
||||
return (other instanceof TaskSummaryImpl);
|
||||
}
|
||||
|
@ -709,7 +815,15 @@ public class TaskSummaryImpl implements TaskSummary {
|
|||
custom13,
|
||||
custom14,
|
||||
custom15,
|
||||
custom16);
|
||||
custom16,
|
||||
customInt1,
|
||||
customInt2,
|
||||
customInt3,
|
||||
customInt4,
|
||||
customInt5,
|
||||
customInt6,
|
||||
customInt7,
|
||||
customInt8);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -766,7 +880,15 @@ public class TaskSummaryImpl implements TaskSummary {
|
|||
&& Objects.equals(custom13, other.custom13)
|
||||
&& Objects.equals(custom14, other.custom14)
|
||||
&& Objects.equals(custom15, other.custom15)
|
||||
&& Objects.equals(custom16, other.custom16);
|
||||
&& Objects.equals(custom16, other.custom16)
|
||||
&& Objects.equals(customInt1, other.customInt1)
|
||||
&& Objects.equals(customInt2, other.customInt2)
|
||||
&& Objects.equals(customInt3, other.customInt3)
|
||||
&& Objects.equals(customInt4, other.customInt4)
|
||||
&& Objects.equals(customInt5, other.customInt5)
|
||||
&& Objects.equals(customInt6, other.customInt6)
|
||||
&& Objects.equals(customInt7, other.customInt7)
|
||||
&& Objects.equals(customInt8, other.customInt8);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -857,6 +979,22 @@ public class TaskSummaryImpl implements TaskSummary {
|
|||
+ custom15
|
||||
+ ", custom16="
|
||||
+ custom16
|
||||
+ ", customInt1="
|
||||
+ customInt1
|
||||
+ ", customInt2="
|
||||
+ customInt2
|
||||
+ ", customInt3="
|
||||
+ customInt3
|
||||
+ ", customInt4="
|
||||
+ customInt4
|
||||
+ ", customInt5="
|
||||
+ customInt5
|
||||
+ ", customInt6="
|
||||
+ customInt6
|
||||
+ ", customInt7="
|
||||
+ customInt7
|
||||
+ ", customInt8="
|
||||
+ customInt8
|
||||
+ "]";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,6 +31,7 @@ import pro.taskana.common.api.TimeInterval;
|
|||
import pro.taskana.common.test.security.JaasExtension;
|
||||
import pro.taskana.common.test.security.WithAccessId;
|
||||
import pro.taskana.task.api.TaskCustomField;
|
||||
import pro.taskana.task.api.TaskCustomIntField;
|
||||
import pro.taskana.task.api.TaskQueryColumnName;
|
||||
import pro.taskana.task.api.TaskService;
|
||||
import pro.taskana.task.api.TaskState;
|
||||
|
@ -511,6 +512,56 @@ class QueryTasksWithSortingAccTest extends AbstractAccTest {
|
|||
.filteredOn(Objects::nonNull)
|
||||
.isSortedAccordingTo(comparator);
|
||||
}
|
||||
|
||||
@WithAccessId(user = "admin")
|
||||
@TestFactory
|
||||
Stream<DynamicTest> should_ReturnOrderedResult_When_OrderByCustomIntXAscIsSet() {
|
||||
Iterator<TaskCustomIntField> iterator =
|
||||
Arrays.stream(TaskCustomIntField.values()).iterator();
|
||||
|
||||
return DynamicTest.stream(
|
||||
iterator,
|
||||
s -> String.format("order by %s asc", s),
|
||||
s -> {
|
||||
List<TaskSummary> results =
|
||||
taskanaEngine
|
||||
.getTaskService()
|
||||
.createTaskQuery()
|
||||
.orderByCustomIntAttribute(s, ASCENDING)
|
||||
.list();
|
||||
|
||||
assertThat(results)
|
||||
.hasSizeGreaterThan(2)
|
||||
.extracting(t -> t.getCustomIntField(s))
|
||||
.filteredOn(Objects::nonNull)
|
||||
.isSortedAccordingTo(Integer::compareTo);
|
||||
});
|
||||
}
|
||||
|
||||
@WithAccessId(user = "admin")
|
||||
@TestFactory
|
||||
Stream<DynamicTest> should_ReturnOrderedResult_When_OrderByCustomIntXDescIsSet() {
|
||||
Iterator<TaskCustomIntField> iterator =
|
||||
Arrays.stream(TaskCustomIntField.values()).iterator();
|
||||
|
||||
return DynamicTest.stream(
|
||||
iterator,
|
||||
s -> String.format("order by %s desc", s),
|
||||
s -> {
|
||||
List<TaskSummary> results =
|
||||
taskanaEngine
|
||||
.getTaskService()
|
||||
.createTaskQuery()
|
||||
.orderByCustomIntAttribute(s, ASCENDING)
|
||||
.list();
|
||||
|
||||
assertThat(results)
|
||||
.hasSizeGreaterThan(2)
|
||||
.extracting(t -> t.getCustomIntField(s))
|
||||
.filteredOn(Objects::nonNull)
|
||||
.isSortedAccordingTo(Comparator.reverseOrder());
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
|
|
|
@ -14,6 +14,7 @@ import pro.taskana.common.api.exceptions.NotAuthorizedException;
|
|||
import pro.taskana.common.api.security.UserPrincipal;
|
||||
import pro.taskana.task.api.CallbackState;
|
||||
import pro.taskana.task.api.TaskCustomField;
|
||||
import pro.taskana.task.api.TaskCustomIntField;
|
||||
import pro.taskana.task.api.TaskService;
|
||||
import pro.taskana.task.api.TaskState;
|
||||
import pro.taskana.task.api.exceptions.AttachmentPersistenceException;
|
||||
|
@ -179,6 +180,11 @@ public class TaskBuilder {
|
|||
return this;
|
||||
}
|
||||
|
||||
public TaskBuilder customIntField(TaskCustomIntField customIntField, Integer value) {
|
||||
testTask.setCustomIntField(customIntField, value);
|
||||
return this;
|
||||
}
|
||||
|
||||
public TaskBuilder callbackInfo(Map<String, String> callbackInfo) {
|
||||
testTask.setCallbackInfo(callbackInfo);
|
||||
return this;
|
||||
|
|
|
@ -27,6 +27,7 @@ import pro.taskana.common.api.TaskanaEngine;
|
|||
import pro.taskana.common.internal.util.Quadruple;
|
||||
import pro.taskana.task.api.CallbackState;
|
||||
import pro.taskana.task.api.TaskCustomField;
|
||||
import pro.taskana.task.api.TaskCustomIntField;
|
||||
import pro.taskana.task.api.TaskService;
|
||||
import pro.taskana.task.api.TaskState;
|
||||
import pro.taskana.task.api.models.Attachment;
|
||||
|
@ -150,6 +151,14 @@ class TaskBuilderTest {
|
|||
.customAttribute(TaskCustomField.CUSTOM_14, "custom14")
|
||||
.customAttribute(TaskCustomField.CUSTOM_15, "custom15")
|
||||
.customAttribute(TaskCustomField.CUSTOM_16, "custom16")
|
||||
.customIntField(TaskCustomIntField.CUSTOM_INT_1, 1)
|
||||
.customIntField(TaskCustomIntField.CUSTOM_INT_2, 2)
|
||||
.customIntField(TaskCustomIntField.CUSTOM_INT_3, 3)
|
||||
.customIntField(TaskCustomIntField.CUSTOM_INT_4, 4)
|
||||
.customIntField(TaskCustomIntField.CUSTOM_INT_5, 5)
|
||||
.customIntField(TaskCustomIntField.CUSTOM_INT_6, 6)
|
||||
.customIntField(TaskCustomIntField.CUSTOM_INT_7, 7)
|
||||
.customIntField(TaskCustomIntField.CUSTOM_INT_8, 8)
|
||||
.callbackInfo(Map.of("custom", "value"))
|
||||
.callbackState(CallbackState.CALLBACK_PROCESSING_COMPLETED)
|
||||
.buildAndStore(taskService);
|
||||
|
@ -194,6 +203,14 @@ class TaskBuilderTest {
|
|||
expectedTask.setCustomField(TaskCustomField.CUSTOM_14, "custom14");
|
||||
expectedTask.setCustomField(TaskCustomField.CUSTOM_15, "custom15");
|
||||
expectedTask.setCustomField(TaskCustomField.CUSTOM_16, "custom16");
|
||||
expectedTask.setCustomIntField(TaskCustomIntField.CUSTOM_INT_1, 1);
|
||||
expectedTask.setCustomIntField(TaskCustomIntField.CUSTOM_INT_2, 2);
|
||||
expectedTask.setCustomIntField(TaskCustomIntField.CUSTOM_INT_3, 3);
|
||||
expectedTask.setCustomIntField(TaskCustomIntField.CUSTOM_INT_4, 4);
|
||||
expectedTask.setCustomIntField(TaskCustomIntField.CUSTOM_INT_5, 5);
|
||||
expectedTask.setCustomIntField(TaskCustomIntField.CUSTOM_INT_6, 6);
|
||||
expectedTask.setCustomIntField(TaskCustomIntField.CUSTOM_INT_7, 7);
|
||||
expectedTask.setCustomIntField(TaskCustomIntField.CUSTOM_INT_8, 8);
|
||||
expectedTask.setCallbackInfo(Map.of("custom", "value"));
|
||||
expectedTask.setCallbackState(CallbackState.CALLBACK_PROCESSING_COMPLETED);
|
||||
|
||||
|
|
|
@ -32,6 +32,7 @@ import pro.taskana.common.api.exceptions.InvalidArgumentException;
|
|||
import pro.taskana.common.internal.util.Pair;
|
||||
import pro.taskana.common.rest.QueryParameter;
|
||||
import pro.taskana.task.api.CallbackState;
|
||||
import pro.taskana.task.api.TaskCustomIntField;
|
||||
import pro.taskana.task.api.TaskQuery;
|
||||
import pro.taskana.task.api.TaskState;
|
||||
import pro.taskana.task.api.WildcardSearchField;
|
||||
|
@ -1484,6 +1485,64 @@ public class TaskQueryFilterParameter implements QueryParameter<TaskQuery, Void>
|
|||
@JsonProperty("custom-16-not-like")
|
||||
private final String[] custom16NotLike;
|
||||
// endregion
|
||||
// region customIntField
|
||||
/** Filter by the value of the field customInt1 of the Task. This is an exact match. */
|
||||
@JsonProperty("custom-int-1")
|
||||
private final Integer[] customInt1In;
|
||||
|
||||
/** Exclude values of the field customInt1 of the Task. */
|
||||
@JsonProperty("custom-int-1-not")
|
||||
private final Integer[] customInt1NotIn;
|
||||
/** Filter by the value of the field customInt2 of the Task. This is an exact match. */
|
||||
@JsonProperty("custom-int-2")
|
||||
private final Integer[] customInt2In;
|
||||
|
||||
/** Exclude values of the field customInt2 of the Task. */
|
||||
@JsonProperty("custom-int-2-not")
|
||||
private final Integer[] customInt2NotIn;
|
||||
/** Filter by the value of the field customInt3 of the Task. This is an exact match. */
|
||||
@JsonProperty("custom-int-3")
|
||||
private final Integer[] customInt3In;
|
||||
|
||||
/** Exclude values of the field customInt3 of the Task. */
|
||||
@JsonProperty("custom-int-3-not")
|
||||
private final Integer[] customInt3NotIn;
|
||||
/** Filter by the value of the field customInt4 of the Task. This is an exact match. */
|
||||
@JsonProperty("custom-int-4")
|
||||
private final Integer[] customInt4In;
|
||||
|
||||
/** Exclude values of the field customInt4 of the Task. */
|
||||
@JsonProperty("custom-int-4-not")
|
||||
private final Integer[] customInt4NotIn;
|
||||
/** Filter by the value of the field customInt5 of the Task. This is an exact match. */
|
||||
@JsonProperty("custom-int-5")
|
||||
private final Integer[] customInt5In;
|
||||
|
||||
/** Exclude values of the field customInt5 of the Task. */
|
||||
@JsonProperty("custom-int-5-not")
|
||||
private final Integer[] customInt5NotIn;
|
||||
/** Filter by the value of the field customInt6 of the Task. This is an exact match. */
|
||||
@JsonProperty("custom-int-6")
|
||||
private final Integer[] customInt6In;
|
||||
|
||||
/** Exclude values of the field customInt6 of the Task. */
|
||||
@JsonProperty("custom-int-6-not")
|
||||
private final Integer[] customInt6NotIn;
|
||||
/** Filter by the value of the field customInt7 of the Task. This is an exact match. */
|
||||
@JsonProperty("custom-int-7")
|
||||
private final Integer[] customInt7In;
|
||||
|
||||
/** Exclude values of the field customInt7 of the Task. */
|
||||
@JsonProperty("custom-int-7-not")
|
||||
private final Integer[] customInt7NotIn;
|
||||
/** Filter by the value of the field customInt8 of the Task. This is an exact match. */
|
||||
@JsonProperty("custom-int-8")
|
||||
private final Integer[] customInt8In;
|
||||
|
||||
/** Exclude values of the field customInt8 of the Task. */
|
||||
@JsonProperty("custom-int-8-not")
|
||||
private final Integer[] customInt8NotIn;
|
||||
// endregion
|
||||
// region callbackState
|
||||
/** Filter by the callback state of the Task. This is an exact match. */
|
||||
@JsonProperty("callback-state")
|
||||
|
@ -1718,6 +1777,22 @@ public class TaskQueryFilterParameter implements QueryParameter<TaskQuery, Void>
|
|||
"custom-16-not",
|
||||
"custom-16-like",
|
||||
"custom-16-not-like",
|
||||
"custom-int-1",
|
||||
"custom-int-1-not",
|
||||
"custom-int-2",
|
||||
"custom-int-2-not",
|
||||
"custom-int-3",
|
||||
"custom-int-3-not",
|
||||
"custom-int-4",
|
||||
"custom-int-4-not",
|
||||
"custom-int-5",
|
||||
"custom-int-5-not",
|
||||
"custom-int-6",
|
||||
"custom-int-6-not",
|
||||
"custom-int-7",
|
||||
"custom-int-7-not",
|
||||
"custom-int-8",
|
||||
"custom-int-8-not",
|
||||
"callback-state",
|
||||
"callback-state-not",
|
||||
"wildcard-search-fields",
|
||||
|
@ -1928,6 +2003,22 @@ public class TaskQueryFilterParameter implements QueryParameter<TaskQuery, Void>
|
|||
String[] custom16NotIn,
|
||||
String[] custom16Like,
|
||||
String[] custom16NotLike,
|
||||
Integer[] customInt1In,
|
||||
Integer[] customInt1NotIn,
|
||||
Integer[] customInt2In,
|
||||
Integer[] customInt2NotIn,
|
||||
Integer[] customInt3In,
|
||||
Integer[] customInt3NotIn,
|
||||
Integer[] customInt4In,
|
||||
Integer[] customInt4NotIn,
|
||||
Integer[] customInt5In,
|
||||
Integer[] customInt5NotIn,
|
||||
Integer[] customInt6In,
|
||||
Integer[] customInt6NotIn,
|
||||
Integer[] customInt7In,
|
||||
Integer[] customInt7NotIn,
|
||||
Integer[] customInt8In,
|
||||
Integer[] customInt8NotIn,
|
||||
CallbackState[] callbackStateIn,
|
||||
CallbackState[] callbackStateNotIn,
|
||||
WildcardSearchField[] wildcardSearchFieldIn,
|
||||
|
@ -2137,6 +2228,22 @@ public class TaskQueryFilterParameter implements QueryParameter<TaskQuery, Void>
|
|||
this.custom16NotIn = custom16NotIn;
|
||||
this.custom16Like = custom16Like;
|
||||
this.custom16NotLike = custom16NotLike;
|
||||
this.customInt1In = customInt1In;
|
||||
this.customInt1NotIn = customInt1NotIn;
|
||||
this.customInt2In = customInt2In;
|
||||
this.customInt2NotIn = customInt2NotIn;
|
||||
this.customInt3In = customInt3In;
|
||||
this.customInt3NotIn = customInt3NotIn;
|
||||
this.customInt4In = customInt4In;
|
||||
this.customInt4NotIn = customInt4NotIn;
|
||||
this.customInt5In = customInt5In;
|
||||
this.customInt5NotIn = customInt5NotIn;
|
||||
this.customInt6In = customInt6In;
|
||||
this.customInt6NotIn = customInt6NotIn;
|
||||
this.customInt7In = customInt7In;
|
||||
this.customInt7NotIn = customInt7NotIn;
|
||||
this.customInt8In = customInt8In;
|
||||
this.customInt8NotIn = customInt8NotIn;
|
||||
this.callbackStateIn = callbackStateIn;
|
||||
this.callbackStateNotIn = callbackStateNotIn;
|
||||
this.wildcardSearchFieldIn = wildcardSearchFieldIn;
|
||||
|
@ -2506,6 +2613,23 @@ public class TaskQueryFilterParameter implements QueryParameter<TaskQuery, Void>
|
|||
.ifPresent(wrap(l -> query.customAttributeNotLike(pair.getLeft(), l)));
|
||||
});
|
||||
|
||||
Stream.of(
|
||||
Pair.of(TaskCustomIntField.CUSTOM_INT_1, Pair.of(customInt1In, customInt1NotIn)),
|
||||
Pair.of(TaskCustomIntField.CUSTOM_INT_2, Pair.of(customInt2In, customInt2NotIn)),
|
||||
Pair.of(TaskCustomIntField.CUSTOM_INT_3, Pair.of(customInt3In, customInt3NotIn)),
|
||||
Pair.of(TaskCustomIntField.CUSTOM_INT_4, Pair.of(customInt4In, customInt4NotIn)),
|
||||
Pair.of(TaskCustomIntField.CUSTOM_INT_5, Pair.of(customInt5In, customInt5NotIn)),
|
||||
Pair.of(TaskCustomIntField.CUSTOM_INT_6, Pair.of(customInt6In, customInt6NotIn)),
|
||||
Pair.of(TaskCustomIntField.CUSTOM_INT_7, Pair.of(customInt7In, customInt7NotIn)),
|
||||
Pair.of(TaskCustomIntField.CUSTOM_INT_8, Pair.of(customInt8In, customInt8NotIn)))
|
||||
.forEach(
|
||||
pair -> {
|
||||
Optional.ofNullable(pair.getRight().getLeft())
|
||||
.ifPresent(wrap(l -> query.customIntAttributeIn(pair.getLeft(), l)));
|
||||
Optional.ofNullable(pair.getRight().getRight())
|
||||
.ifPresent(wrap(l -> query.customIntAttributeNotIn(pair.getLeft(), l)));
|
||||
});
|
||||
|
||||
Optional.ofNullable(callbackStateIn).ifPresent(query::callbackStateIn);
|
||||
Optional.ofNullable(callbackStateNotIn).ifPresent(query::callbackStateNotIn);
|
||||
|
||||
|
|
|
@ -15,6 +15,7 @@ import pro.taskana.classification.rest.assembler.ClassificationSummaryRepresenta
|
|||
import pro.taskana.common.api.exceptions.InvalidArgumentException;
|
||||
import pro.taskana.common.api.exceptions.SystemException;
|
||||
import pro.taskana.task.api.TaskCustomField;
|
||||
import pro.taskana.task.api.TaskCustomIntField;
|
||||
import pro.taskana.task.api.TaskService;
|
||||
import pro.taskana.task.api.models.Task;
|
||||
import pro.taskana.task.internal.models.TaskImpl;
|
||||
|
@ -110,6 +111,14 @@ public class TaskRepresentationModelAssembler
|
|||
repModel.setCustom14(task.getCustomField(TaskCustomField.CUSTOM_14));
|
||||
repModel.setCustom15(task.getCustomField(TaskCustomField.CUSTOM_15));
|
||||
repModel.setCustom16(task.getCustomField(TaskCustomField.CUSTOM_16));
|
||||
repModel.setCustomInt1(task.getCustomIntField(TaskCustomIntField.CUSTOM_INT_1));
|
||||
repModel.setCustomInt2(task.getCustomIntField(TaskCustomIntField.CUSTOM_INT_2));
|
||||
repModel.setCustomInt3(task.getCustomIntField(TaskCustomIntField.CUSTOM_INT_3));
|
||||
repModel.setCustomInt4(task.getCustomIntField(TaskCustomIntField.CUSTOM_INT_4));
|
||||
repModel.setCustomInt5(task.getCustomIntField(TaskCustomIntField.CUSTOM_INT_5));
|
||||
repModel.setCustomInt6(task.getCustomIntField(TaskCustomIntField.CUSTOM_INT_6));
|
||||
repModel.setCustomInt7(task.getCustomIntField(TaskCustomIntField.CUSTOM_INT_7));
|
||||
repModel.setCustomInt8(task.getCustomIntField(TaskCustomIntField.CUSTOM_INT_8));
|
||||
try {
|
||||
repModel.add(linkTo(methodOn(TaskController.class).getTask(task.getId())).withSelfRel());
|
||||
} catch (Exception e) {
|
||||
|
@ -167,6 +176,14 @@ public class TaskRepresentationModelAssembler
|
|||
task.setCustomField(TaskCustomField.CUSTOM_14, repModel.getCustom14());
|
||||
task.setCustomField(TaskCustomField.CUSTOM_15, repModel.getCustom15());
|
||||
task.setCustomField(TaskCustomField.CUSTOM_16, repModel.getCustom16());
|
||||
task.setCustomIntField(TaskCustomIntField.CUSTOM_INT_1, repModel.getCustomInt1());
|
||||
task.setCustomIntField(TaskCustomIntField.CUSTOM_INT_2, repModel.getCustomInt2());
|
||||
task.setCustomIntField(TaskCustomIntField.CUSTOM_INT_3, repModel.getCustomInt3());
|
||||
task.setCustomIntField(TaskCustomIntField.CUSTOM_INT_4, repModel.getCustomInt4());
|
||||
task.setCustomIntField(TaskCustomIntField.CUSTOM_INT_5, repModel.getCustomInt5());
|
||||
task.setCustomIntField(TaskCustomIntField.CUSTOM_INT_6, repModel.getCustomInt6());
|
||||
task.setCustomIntField(TaskCustomIntField.CUSTOM_INT_7, repModel.getCustomInt7());
|
||||
task.setCustomIntField(TaskCustomIntField.CUSTOM_INT_8, repModel.getCustomInt8());
|
||||
task.setAttachments(
|
||||
repModel.getAttachments().stream()
|
||||
.map(attachmentAssembler::toEntityModel)
|
||||
|
|
|
@ -12,6 +12,7 @@ import pro.taskana.common.rest.assembler.CollectionRepresentationModelAssembler;
|
|||
import pro.taskana.common.rest.assembler.PagedRepresentationModelAssembler;
|
||||
import pro.taskana.common.rest.models.PageMetadata;
|
||||
import pro.taskana.task.api.TaskCustomField;
|
||||
import pro.taskana.task.api.TaskCustomIntField;
|
||||
import pro.taskana.task.api.TaskService;
|
||||
import pro.taskana.task.api.models.TaskSummary;
|
||||
import pro.taskana.task.internal.models.TaskSummaryImpl;
|
||||
|
@ -102,6 +103,14 @@ public class TaskSummaryRepresentationModelAssembler
|
|||
repModel.setCustom14(taskSummary.getCustomField(TaskCustomField.CUSTOM_14));
|
||||
repModel.setCustom15(taskSummary.getCustomField(TaskCustomField.CUSTOM_15));
|
||||
repModel.setCustom16(taskSummary.getCustomField(TaskCustomField.CUSTOM_16));
|
||||
repModel.setCustomInt1(taskSummary.getCustomIntField(TaskCustomIntField.CUSTOM_INT_1));
|
||||
repModel.setCustomInt2(taskSummary.getCustomIntField(TaskCustomIntField.CUSTOM_INT_2));
|
||||
repModel.setCustomInt3(taskSummary.getCustomIntField(TaskCustomIntField.CUSTOM_INT_3));
|
||||
repModel.setCustomInt4(taskSummary.getCustomIntField(TaskCustomIntField.CUSTOM_INT_4));
|
||||
repModel.setCustomInt5(taskSummary.getCustomIntField(TaskCustomIntField.CUSTOM_INT_5));
|
||||
repModel.setCustomInt6(taskSummary.getCustomIntField(TaskCustomIntField.CUSTOM_INT_6));
|
||||
repModel.setCustomInt7(taskSummary.getCustomIntField(TaskCustomIntField.CUSTOM_INT_7));
|
||||
repModel.setCustomInt8(taskSummary.getCustomIntField(TaskCustomIntField.CUSTOM_INT_8));
|
||||
return repModel;
|
||||
}
|
||||
|
||||
|
@ -160,6 +169,14 @@ public class TaskSummaryRepresentationModelAssembler
|
|||
taskSummary.setCustom14(repModel.getCustom14());
|
||||
taskSummary.setCustom15(repModel.getCustom15());
|
||||
taskSummary.setCustom16(repModel.getCustom16());
|
||||
taskSummary.setCustomInt1(repModel.getCustomInt1());
|
||||
taskSummary.setCustomInt2(repModel.getCustomInt2());
|
||||
taskSummary.setCustomInt3(repModel.getCustomInt3());
|
||||
taskSummary.setCustomInt4(repModel.getCustomInt4());
|
||||
taskSummary.setCustomInt5(repModel.getCustomInt5());
|
||||
taskSummary.setCustomInt6(repModel.getCustomInt6());
|
||||
taskSummary.setCustomInt7(repModel.getCustomInt7());
|
||||
taskSummary.setCustomInt8(repModel.getCustomInt8());
|
||||
return taskSummary;
|
||||
}
|
||||
|
||||
|
|
|
@ -10,10 +10,8 @@ import org.springframework.hateoas.RepresentationModel;
|
|||
|
||||
import pro.taskana.classification.rest.models.ClassificationSummaryRepresentationModel;
|
||||
import pro.taskana.task.api.TaskState;
|
||||
import pro.taskana.workbasket.api.models.WorkbasketSummary;
|
||||
import pro.taskana.workbasket.rest.models.WorkbasketSummaryRepresentationModel;
|
||||
|
||||
/** EntityModel class for {@link WorkbasketSummary}. */
|
||||
public class TaskSummaryRepresentationModel
|
||||
extends RepresentationModel<TaskSummaryRepresentationModel> {
|
||||
|
||||
|
@ -114,6 +112,22 @@ public class TaskSummaryRepresentationModel
|
|||
protected String custom15;
|
||||
/** A custom property with name "16". */
|
||||
protected String custom16;
|
||||
/** A custom property with name "1". */
|
||||
protected Integer customInt1;
|
||||
/** A custom int property with name "1". */
|
||||
protected Integer customInt2;
|
||||
/** A custom int property with name "2". */
|
||||
protected Integer customInt3;
|
||||
/** A custom int property with name "3". */
|
||||
protected Integer customInt4;
|
||||
/** A custom int property with name "4". */
|
||||
protected Integer customInt5;
|
||||
/** A custom int property with name "5". */
|
||||
protected Integer customInt6;
|
||||
/** A custom int property with name "6". */
|
||||
protected Integer customInt7;
|
||||
/** A custom int property with name "7". */
|
||||
protected Integer customInt8;
|
||||
/** Secondary object references of the task. */
|
||||
protected List<ObjectReferenceRepresentationModel> secondaryObjectReferences = new ArrayList<>();
|
||||
/** The attachment summaries of this task. */
|
||||
|
@ -465,4 +479,68 @@ public class TaskSummaryRepresentationModel
|
|||
public void setCustom16(String custom16) {
|
||||
this.custom16 = custom16;
|
||||
}
|
||||
|
||||
public Integer getCustomInt1() {
|
||||
return customInt1;
|
||||
}
|
||||
|
||||
public void setCustomInt1(Integer customInt1) {
|
||||
this.customInt1 = customInt1;
|
||||
}
|
||||
|
||||
public Integer getCustomInt2() {
|
||||
return customInt2;
|
||||
}
|
||||
|
||||
public void setCustomInt2(Integer customInt2) {
|
||||
this.customInt2 = customInt2;
|
||||
}
|
||||
|
||||
public Integer getCustomInt3() {
|
||||
return customInt3;
|
||||
}
|
||||
|
||||
public void setCustomInt3(Integer customInt3) {
|
||||
this.customInt3 = customInt3;
|
||||
}
|
||||
|
||||
public Integer getCustomInt4() {
|
||||
return customInt4;
|
||||
}
|
||||
|
||||
public void setCustomInt4(Integer customInt4) {
|
||||
this.customInt4 = customInt4;
|
||||
}
|
||||
|
||||
public Integer getCustomInt5() {
|
||||
return customInt5;
|
||||
}
|
||||
|
||||
public void setCustomInt5(Integer customInt5) {
|
||||
this.customInt5 = customInt5;
|
||||
}
|
||||
|
||||
public Integer getCustomInt6() {
|
||||
return customInt6;
|
||||
}
|
||||
|
||||
public void setCustomInt6(Integer customInt6) {
|
||||
this.customInt6 = customInt6;
|
||||
}
|
||||
|
||||
public Integer getCustomInt7() {
|
||||
return customInt7;
|
||||
}
|
||||
|
||||
public void setCustomInt7(Integer customInt7) {
|
||||
this.customInt7 = customInt7;
|
||||
}
|
||||
|
||||
public Integer getCustomInt8() {
|
||||
return customInt8;
|
||||
}
|
||||
|
||||
public void setCustomInt8(Integer customInt8) {
|
||||
this.customInt8 = customInt8;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -135,6 +135,157 @@ class TaskControllerIntTest {
|
|||
assertThat(response.getBody().getContent()).hasSize(6);
|
||||
}
|
||||
|
||||
@Test
|
||||
void should_GetCustomIntCorrectly_When_GettingTaskWithCustomIntValues() {
|
||||
String url =
|
||||
restHelper.toUrl(RestEndpoints.URL_TASKS_ID, "TKI:000000000000000000000000000000000025");
|
||||
HttpEntity<Object> auth = new HttpEntity<>(RestHelper.generateHeadersForUser("user-1-2"));
|
||||
|
||||
ResponseEntity<TaskRepresentationModel> response =
|
||||
TEMPLATE.exchange(url, HttpMethod.GET, auth, TASK_MODEL_TYPE);
|
||||
|
||||
TaskRepresentationModel repModel = response.getBody();
|
||||
assertThat(repModel).isNotNull();
|
||||
assertThat(repModel.getCustomInt1()).isEqualTo(1);
|
||||
assertThat(repModel.getCustomInt2()).isEqualTo(2);
|
||||
assertThat(repModel.getCustomInt3()).isEqualTo(3);
|
||||
assertThat(repModel.getCustomInt4()).isEqualTo(4);
|
||||
assertThat(repModel.getCustomInt5()).isEqualTo(5);
|
||||
assertThat(repModel.getCustomInt6()).isEqualTo(6);
|
||||
assertThat(repModel.getCustomInt7()).isEqualTo(7);
|
||||
assertThat(repModel.getCustomInt8()).isEqualTo(8);
|
||||
}
|
||||
|
||||
@TestFactory
|
||||
Stream<DynamicTest> should_GetAllTasks_For_SpecifiedWorkbasketIdAndCustomIntFieldIn() {
|
||||
List<Integer> customIntValues = List.of(1, 2, 3, 4, 5, 6, 7, 8);
|
||||
ThrowingConsumer<Integer> test =
|
||||
i -> {
|
||||
String url =
|
||||
restHelper.toUrl(RestEndpoints.URL_TASKS)
|
||||
+ String.format(
|
||||
"?workbasket-id=WBI:100000000000000000000000000000000001"
|
||||
+ "&custom-int-%s=%s",
|
||||
i, i);
|
||||
HttpEntity<Object> auth =
|
||||
new HttpEntity<>(RestHelper.generateHeadersForUser("teamlead-1"));
|
||||
|
||||
ResponseEntity<TaskSummaryPagedRepresentationModel> response =
|
||||
TEMPLATE.exchange(url, HttpMethod.GET, auth, TASK_SUMMARY_PAGE_MODEL_TYPE);
|
||||
|
||||
assertThat(response.getBody()).isNotNull();
|
||||
assertThat((response.getBody()).getLink(IanaLinkRelations.SELF)).isNotNull();
|
||||
assertThat(response.getBody().getContent()).hasSize(22);
|
||||
};
|
||||
|
||||
return DynamicTest.stream(customIntValues.iterator(), c -> "customInt" + c, test);
|
||||
}
|
||||
|
||||
@TestFactory
|
||||
Stream<DynamicTest> should_GetAllTasks_For_SpecifiedWorkbasketIdAndCustomIntFieldNotIn() {
|
||||
List<Integer> customIntValues = List.of(1, 2, 3, 4, 5, 6, 7, 8);
|
||||
ThrowingConsumer<Integer> test =
|
||||
i -> {
|
||||
String url =
|
||||
restHelper.toUrl(RestEndpoints.URL_TASKS)
|
||||
+ String.format(
|
||||
"?workbasket-id=WBI:100000000000000000000000000000000001"
|
||||
+ "&custom-int-%s-not=25",
|
||||
i);
|
||||
HttpEntity<Object> auth =
|
||||
new HttpEntity<>(RestHelper.generateHeadersForUser("teamlead-1"));
|
||||
|
||||
ResponseEntity<TaskSummaryPagedRepresentationModel> response =
|
||||
TEMPLATE.exchange(url, HttpMethod.GET, auth, TASK_SUMMARY_PAGE_MODEL_TYPE);
|
||||
|
||||
assertThat(response.getBody()).isNotNull();
|
||||
assertThat((response.getBody()).getLink(IanaLinkRelations.SELF)).isNotNull();
|
||||
assertThat(response.getBody().getContent()).hasSize(22);
|
||||
};
|
||||
|
||||
return DynamicTest.stream(customIntValues.iterator(), c -> "customInt" + c, test);
|
||||
}
|
||||
|
||||
@TestFactory
|
||||
Stream<DynamicTest> should_GetAllTasks_For_SpecifiedWorkbasketIdAndCustomIntFieldWithin() {
|
||||
List<Integer> customIntValues = List.of(1, 2, 3, 4, 5, 6, 7, 8);
|
||||
ThrowingConsumer<Integer> test =
|
||||
i -> {
|
||||
String url =
|
||||
restHelper.toUrl(RestEndpoints.URL_TASKS)
|
||||
+ String.format(
|
||||
"?workbasket-id=WBI:100000000000000000000000000000000001"
|
||||
+ "&custom-int-%s-within=%s"
|
||||
+ "&custom-int-%s-within=15",
|
||||
i, i, i);
|
||||
HttpEntity<Object> auth =
|
||||
new HttpEntity<>(RestHelper.generateHeadersForUser("teamlead-1"));
|
||||
|
||||
ResponseEntity<TaskSummaryPagedRepresentationModel> response =
|
||||
TEMPLATE.exchange(url, HttpMethod.GET, auth, TASK_SUMMARY_PAGE_MODEL_TYPE);
|
||||
|
||||
assertThat(response.getBody()).isNotNull();
|
||||
assertThat((response.getBody()).getLink(IanaLinkRelations.SELF)).isNotNull();
|
||||
assertThat(response.getBody().getContent()).hasSize(22);
|
||||
};
|
||||
|
||||
return DynamicTest.stream(customIntValues.iterator(), c -> "customInt" + c, test);
|
||||
}
|
||||
|
||||
@TestFactory
|
||||
Stream<DynamicTest>
|
||||
should_GetAllTasks_For_SpecifiedWorkbasketIdAndCustomIntFieldWithinOpenLowerBound() {
|
||||
List<Integer> customIntValues = List.of(1, 2, 3, 4, 5, 6, 7, 8);
|
||||
ThrowingConsumer<Integer> test =
|
||||
i -> {
|
||||
String url =
|
||||
restHelper.toUrl(RestEndpoints.URL_TASKS)
|
||||
+ String.format(
|
||||
"?workbasket-id=WBI:100000000000000000000000000000000001"
|
||||
+ "&custom-int-%s-within="
|
||||
+ "&custom-int-%s-within=%s",
|
||||
i, i, i);
|
||||
HttpEntity<Object> auth =
|
||||
new HttpEntity<>(RestHelper.generateHeadersForUser("teamlead-1"));
|
||||
|
||||
ResponseEntity<TaskSummaryPagedRepresentationModel> response =
|
||||
TEMPLATE.exchange(url, HttpMethod.GET, auth, TASK_SUMMARY_PAGE_MODEL_TYPE);
|
||||
|
||||
assertThat(response.getBody()).isNotNull();
|
||||
assertThat((response.getBody()).getLink(IanaLinkRelations.SELF)).isNotNull();
|
||||
assertThat(response.getBody().getContent()).hasSize(22);
|
||||
};
|
||||
|
||||
return DynamicTest.stream(customIntValues.iterator(), c -> "customInt" + c, test);
|
||||
}
|
||||
|
||||
@TestFactory
|
||||
Stream<DynamicTest>
|
||||
should_GetAllTasks_For_SpecifiedWorkbasketIdAndCustomIntFieldNotWithinOpenUpperBound() {
|
||||
List<Integer> customIntValues = List.of(1, 2, 3, 4, 5, 6, 7, 8);
|
||||
ThrowingConsumer<Integer> test =
|
||||
i -> {
|
||||
String url =
|
||||
restHelper.toUrl(RestEndpoints.URL_TASKS)
|
||||
+ String.format(
|
||||
"?workbasket-id=WBI:100000000000000000000000000000000001"
|
||||
+ "&custom-int-%s-not-within=%s"
|
||||
+ "&custom-int-%s-not-within=",
|
||||
i, i, i);
|
||||
HttpEntity<Object> auth =
|
||||
new HttpEntity<>(RestHelper.generateHeadersForUser("teamlead-1"));
|
||||
|
||||
ResponseEntity<TaskSummaryPagedRepresentationModel> response =
|
||||
TEMPLATE.exchange(url, HttpMethod.GET, auth, TASK_SUMMARY_PAGE_MODEL_TYPE);
|
||||
|
||||
assertThat(response.getBody()).isNotNull();
|
||||
assertThat((response.getBody()).getLink(IanaLinkRelations.SELF)).isNotNull();
|
||||
assertThat(response.getBody().getContent()).isEmpty();
|
||||
};
|
||||
|
||||
return DynamicTest.stream(customIntValues.iterator(), c -> "customInt" + c, test);
|
||||
}
|
||||
|
||||
@Test
|
||||
void should_GetAllTasks_For_SpecifiesWorkbasketIdWithinSinglePlannedTimeInterval() {
|
||||
Instant plannedFromInstant = Instant.now().minus(6, ChronoUnit.DAYS);
|
||||
|
|
|
@ -15,6 +15,7 @@ import pro.taskana.common.api.exceptions.InvalidArgumentException;
|
|||
import pro.taskana.common.rest.RestEndpoints;
|
||||
import pro.taskana.common.test.rest.TaskanaSpringBootTest;
|
||||
import pro.taskana.task.api.TaskCustomField;
|
||||
import pro.taskana.task.api.TaskCustomIntField;
|
||||
import pro.taskana.task.api.TaskService;
|
||||
import pro.taskana.task.api.TaskState;
|
||||
import pro.taskana.task.api.models.Attachment;
|
||||
|
@ -30,7 +31,6 @@ import pro.taskana.workbasket.api.models.Workbasket;
|
|||
import pro.taskana.workbasket.api.models.WorkbasketSummary;
|
||||
import pro.taskana.workbasket.rest.models.WorkbasketSummaryRepresentationModel;
|
||||
|
||||
/** Test for {@link TaskRepresentationModelAssembler}. */
|
||||
@TaskanaSpringBootTest
|
||||
class TaskRepresentationModelAssemblerTest {
|
||||
|
||||
|
@ -113,6 +113,14 @@ class TaskRepresentationModelAssemblerTest {
|
|||
repModel.setCustom14("custom14");
|
||||
repModel.setCustom15("custom15");
|
||||
repModel.setCustom16("custom16");
|
||||
repModel.setCustomInt1(1);
|
||||
repModel.setCustomInt2(2);
|
||||
repModel.setCustomInt3(3);
|
||||
repModel.setCustomInt4(4);
|
||||
repModel.setCustomInt5(5);
|
||||
repModel.setCustomInt6(6);
|
||||
repModel.setCustomInt7(7);
|
||||
repModel.setCustomInt8(8);
|
||||
// when
|
||||
Task task = assembler.toEntityModel(repModel);
|
||||
// then
|
||||
|
@ -207,6 +215,14 @@ class TaskRepresentationModelAssemblerTest {
|
|||
task.setCustomField(TaskCustomField.CUSTOM_14, "custom14");
|
||||
task.setCustomField(TaskCustomField.CUSTOM_15, "custom15");
|
||||
task.setCustomField(TaskCustomField.CUSTOM_16, "custom16");
|
||||
task.setCustomIntField(TaskCustomIntField.CUSTOM_INT_1, 1);
|
||||
task.setCustomIntField(TaskCustomIntField.CUSTOM_INT_2, 2);
|
||||
task.setCustomIntField(TaskCustomIntField.CUSTOM_INT_3, 3);
|
||||
task.setCustomIntField(TaskCustomIntField.CUSTOM_INT_4, 4);
|
||||
task.setCustomIntField(TaskCustomIntField.CUSTOM_INT_5, 5);
|
||||
task.setCustomIntField(TaskCustomIntField.CUSTOM_INT_6, 6);
|
||||
task.setCustomIntField(TaskCustomIntField.CUSTOM_INT_7, 7);
|
||||
task.setCustomIntField(TaskCustomIntField.CUSTOM_INT_8, 8);
|
||||
// when
|
||||
TaskRepresentationModel repModel = assembler.toModel(task);
|
||||
// then
|
||||
|
@ -272,6 +288,14 @@ class TaskRepresentationModelAssemblerTest {
|
|||
task.setCustom14("custom14");
|
||||
task.setCustom15("custom15");
|
||||
task.setCustom16("custom16");
|
||||
task.setCustomInt1(1);
|
||||
task.setCustomInt2(2);
|
||||
task.setCustomInt3(3);
|
||||
task.setCustomInt4(4);
|
||||
task.setCustomInt5(5);
|
||||
task.setCustomInt6(6);
|
||||
task.setCustomInt7(7);
|
||||
task.setCustomInt8(8);
|
||||
// when
|
||||
TaskRepresentationModel repModel = assembler.toModel(task);
|
||||
Task task2 = assembler.toEntityModel(repModel);
|
||||
|
|
|
@ -27,6 +27,7 @@ import pro.taskana.classification.api.ClassificationService;
|
|||
import pro.taskana.classification.api.models.ClassificationSummary;
|
||||
import pro.taskana.classification.rest.models.ClassificationSummaryRepresentationModel;
|
||||
import pro.taskana.common.test.rest.TaskanaSpringBootTest;
|
||||
import pro.taskana.task.api.TaskCustomIntField;
|
||||
import pro.taskana.task.api.TaskService;
|
||||
import pro.taskana.task.api.TaskState;
|
||||
import pro.taskana.task.api.models.AttachmentSummary;
|
||||
|
@ -120,6 +121,14 @@ class TaskSummaryRepresentationModelAssemblerTest {
|
|||
task.setCustom14("custom14");
|
||||
task.setCustom15("custom15");
|
||||
task.setCustom16("custom16");
|
||||
task.setCustomInt1(1);
|
||||
task.setCustomInt2(2);
|
||||
task.setCustomInt3(3);
|
||||
task.setCustomInt4(4);
|
||||
task.setCustomInt5(5);
|
||||
task.setCustomInt6(6);
|
||||
task.setCustomInt7(7);
|
||||
task.setCustomInt8(8);
|
||||
|
||||
TaskSummaryRepresentationModel repModel = assembler.toModel(task);
|
||||
|
||||
|
@ -186,6 +195,14 @@ class TaskSummaryRepresentationModelAssemblerTest {
|
|||
repModel.setCustom14("custom14");
|
||||
repModel.setCustom15("custom15");
|
||||
repModel.setCustom16("custom16");
|
||||
repModel.setCustomInt1(1);
|
||||
repModel.setCustomInt2(2);
|
||||
repModel.setCustomInt3(3);
|
||||
repModel.setCustomInt4(4);
|
||||
repModel.setCustomInt5(5);
|
||||
repModel.setCustomInt6(6);
|
||||
repModel.setCustomInt7(7);
|
||||
repModel.setCustomInt8(8);
|
||||
// when
|
||||
TaskSummary task = assembler.toEntityModel(repModel);
|
||||
// then
|
||||
|
@ -276,6 +293,14 @@ class TaskSummaryRepresentationModelAssemblerTest {
|
|||
task.setCustom14("custom14");
|
||||
task.setCustom15("custom15");
|
||||
task.setCustom16("custom16");
|
||||
task.setCustomInt1(1);
|
||||
task.setCustomInt2(2);
|
||||
task.setCustomInt3(3);
|
||||
task.setCustomInt4(4);
|
||||
task.setCustomInt5(5);
|
||||
task.setCustomInt6(6);
|
||||
task.setCustomInt7(7);
|
||||
task.setCustomInt8(8);
|
||||
// when
|
||||
TaskSummaryRepresentationModel repModel = assembler.toModel(task);
|
||||
TaskSummary task2 = assembler.toEntityModel(repModel);
|
||||
|
@ -332,6 +357,22 @@ class TaskSummaryRepresentationModelAssemblerTest {
|
|||
assertThat(taskSummary.getCustomField(CUSTOM_14)).isEqualTo(repModel.getCustom14());
|
||||
assertThat(taskSummary.getCustomField(CUSTOM_15)).isEqualTo(repModel.getCustom15());
|
||||
assertThat(taskSummary.getCustomField(CUSTOM_16)).isEqualTo(repModel.getCustom16());
|
||||
assertThat(taskSummary.getCustomIntField(TaskCustomIntField.CUSTOM_INT_1))
|
||||
.isEqualTo(repModel.getCustomInt1());
|
||||
assertThat(taskSummary.getCustomIntField(TaskCustomIntField.CUSTOM_INT_2))
|
||||
.isEqualTo(repModel.getCustomInt2());
|
||||
assertThat(taskSummary.getCustomIntField(TaskCustomIntField.CUSTOM_INT_3))
|
||||
.isEqualTo(repModel.getCustomInt3());
|
||||
assertThat(taskSummary.getCustomIntField(TaskCustomIntField.CUSTOM_INT_4))
|
||||
.isEqualTo(repModel.getCustomInt4());
|
||||
assertThat(taskSummary.getCustomIntField(TaskCustomIntField.CUSTOM_INT_5))
|
||||
.isEqualTo(repModel.getCustomInt5());
|
||||
assertThat(taskSummary.getCustomIntField(TaskCustomIntField.CUSTOM_INT_6))
|
||||
.isEqualTo(repModel.getCustomInt6());
|
||||
assertThat(taskSummary.getCustomIntField(TaskCustomIntField.CUSTOM_INT_7))
|
||||
.isEqualTo(repModel.getCustomInt7());
|
||||
assertThat(taskSummary.getCustomIntField(TaskCustomIntField.CUSTOM_INT_8))
|
||||
.isEqualTo(repModel.getCustomInt8());
|
||||
testEqualityAttachments(
|
||||
taskSummary.getAttachmentSummaries(), repModel.getAttachmentSummaries());
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue