TSK-1834: fix so manual priority is returned when querying

This commit is contained in:
ryzheboka 2022-03-31 15:19:05 +02:00 committed by Mustapha Zorgati
parent bc86006877
commit 1592f71dbe
3 changed files with 63 additions and 1 deletions

View File

@ -18,6 +18,7 @@ public enum TaskQueryColumnName implements QueryColumnName {
DESCRIPTION("t.description"), DESCRIPTION("t.description"),
NOTE("t.note"), NOTE("t.note"),
PRIORITY("t.priority"), PRIORITY("t.priority"),
MANUAL_PRIORITY("t.manual_priority"),
STATE("t.state"), STATE("t.state"),
CLASSIFICATION_CATEGORY("t.classification_category"), CLASSIFICATION_CATEGORY("t.classification_category"),
CLASSIFICATION_KEY("t.classification_key"), CLASSIFICATION_KEY("t.classification_key"),

View File

@ -273,7 +273,7 @@ public class TaskQuerySqlProvider {
private static String db2selectFields() { private static String db2selectFields() {
// needs to be the same order as the commonSelectFields (TaskQueryColumnValue) // needs to be the same order as the commonSelectFields (TaskQueryColumnValue)
return "ID, EXTERNAL_ID, CREATED, CLAIMED, COMPLETED, MODIFIED, PLANNED, RECEIVED, DUE, NAME, " return "ID, EXTERNAL_ID, CREATED, CLAIMED, COMPLETED, MODIFIED, PLANNED, RECEIVED, DUE, NAME, "
+ "CREATOR, DESCRIPTION, NOTE, PRIORITY, STATE, CLASSIFICATION_CATEGORY, " + "CREATOR, DESCRIPTION, NOTE, PRIORITY, MANUAL_PRIORITY, STATE, CLASSIFICATION_CATEGORY, "
+ "TCLASSIFICATION_KEY, CLASSIFICATION_ID, " + "TCLASSIFICATION_KEY, CLASSIFICATION_ID, "
+ "WORKBASKET_ID, WORKBASKET_KEY, DOMAIN, " + "WORKBASKET_ID, WORKBASKET_KEY, DOMAIN, "
+ "BUSINESS_PROCESS_ID, PARENT_BUSINESS_PROCESS_ID, OWNER, POR_COMPANY, POR_SYSTEM, " + "BUSINESS_PROCESS_ID, PARENT_BUSINESS_PROCESS_ID, OWNER, POR_COMPANY, POR_SYSTEM, "

View File

@ -10,6 +10,7 @@ import acceptance.DefaultTestEntities;
import java.security.PrivilegedActionException; import java.security.PrivilegedActionException;
import java.time.Instant; import java.time.Instant;
import java.util.List; import java.util.List;
import java.util.Map;
import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Nested; import org.junit.jupiter.api.Nested;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
@ -25,6 +26,7 @@ import pro.taskana.common.api.TimeInterval;
import pro.taskana.common.api.security.CurrentUserContext; import pro.taskana.common.api.security.CurrentUserContext;
import pro.taskana.common.test.security.WithAccessId; import pro.taskana.common.test.security.WithAccessId;
import pro.taskana.task.api.CallbackState; import pro.taskana.task.api.CallbackState;
import pro.taskana.task.api.TaskCustomField;
import pro.taskana.task.api.TaskService; import pro.taskana.task.api.TaskService;
import pro.taskana.task.api.TaskState; import pro.taskana.task.api.TaskState;
import pro.taskana.task.api.WildcardSearchField; import pro.taskana.task.api.WildcardSearchField;
@ -104,6 +106,65 @@ class TaskQueryImplAccTest {
assertThat(list).containsExactlyInAnyOrder(taskSummary1, taskSummary2); assertThat(list).containsExactlyInAnyOrder(taskSummary1, taskSummary2);
} }
@WithAccessId(user = "user-1-2")
@Test
void should_ReturnAllTasksWithAllAttributesSet_When_NotApplyingAnyFilter() throws Exception {
WorkbasketSummary wb = createWorkbasketWithPermission();
Attachment attachment =
TaskAttachmentBuilder.newAttachment()
.classificationSummary(defaultClassificationSummary)
.objectReference(defaultTestObjectReference().build())
.build();
TaskSummary taskSummary1 =
taskInWorkbasket(wb)
.externalId("external id")
.received(Instant.parse("2020-04-19T13:13:00.000Z"))
.created(Instant.parse("2020-04-20T13:13:00.000Z"))
.claimed(Instant.parse("2020-04-21T13:13:00.000Z"))
.completed(Instant.parse("2020-04-22T13:13:00.000Z"))
.modified(Instant.parse("2020-04-22T13:13:00.000Z"))
.planned(Instant.parse("2020-04-21T13:13:00.000Z"))
.due(Instant.parse("2020-04-21T13:13:00.000Z"))
.name("Name")
.note("Note")
.description("Description")
.state(TaskState.COMPLETED)
.businessProcessId("BPI:SomeNumber")
.parentBusinessProcessId("BPI:OtherNumber")
.owner("user-1-2")
.primaryObjRef(defaultTestObjectReference().build())
.manualPriority(7)
.read(true)
.transferred(true)
.attachments(attachment)
.customAttribute(TaskCustomField.CUSTOM_1, "custom1")
.customAttribute(TaskCustomField.CUSTOM_2, "custom2")
.customAttribute(TaskCustomField.CUSTOM_3, "custom3")
.customAttribute(TaskCustomField.CUSTOM_4, "custom4")
.customAttribute(TaskCustomField.CUSTOM_5, "custom5")
.customAttribute(TaskCustomField.CUSTOM_6, "custom6")
.customAttribute(TaskCustomField.CUSTOM_7, "custom7")
.customAttribute(TaskCustomField.CUSTOM_8, "custom8")
.customAttribute(TaskCustomField.CUSTOM_9, "custom9")
.customAttribute(TaskCustomField.CUSTOM_10, "custom10")
.customAttribute(TaskCustomField.CUSTOM_11, "custom11")
.customAttribute(TaskCustomField.CUSTOM_12, "custom12")
.customAttribute(TaskCustomField.CUSTOM_13, "custom13")
.customAttribute(TaskCustomField.CUSTOM_14, "custom14")
.customAttribute(TaskCustomField.CUSTOM_15, "custom15")
.customAttribute(TaskCustomField.CUSTOM_16, "custom16")
.callbackInfo(Map.of("custom", "value"))
.callbackState(CallbackState.CALLBACK_PROCESSING_COMPLETED)
.buildAndStoreAsSummary(taskService);
TaskSummary taskSummary2 = taskInWorkbasket(wb).buildAndStoreAsSummary(taskService);
List<TaskSummary> list = taskService.createTaskQuery().workbasketIdIn(wb.getId()).list();
assertThat(list).containsExactlyInAnyOrder(taskSummary1, taskSummary2);
assertThat(taskSummary1).hasNoNullFieldsOrPropertiesExcept("ownerLongName");
}
@WithAccessId(user = "user-1-1") @WithAccessId(user = "user-1-1")
@Test @Test
@SuppressWarnings("unused") @SuppressWarnings("unused")