TSK-362 make getAttachmentSummaries available in TaskSummary
This commit is contained in:
parent
066acd408e
commit
df6d5944bc
|
@ -1,6 +1,7 @@
|
||||||
package pro.taskana;
|
package pro.taskana;
|
||||||
|
|
||||||
import java.time.Instant;
|
import java.time.Instant;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import pro.taskana.impl.ObjectReference;
|
import pro.taskana.impl.ObjectReference;
|
||||||
|
|
||||||
|
@ -107,6 +108,13 @@ public interface TaskSummary {
|
||||||
*/
|
*/
|
||||||
WorkbasketSummary getWorkbasketSummary();
|
WorkbasketSummary getWorkbasketSummary();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the attachment summaries of the task.
|
||||||
|
*
|
||||||
|
* @return the task's attachment summaries
|
||||||
|
*/
|
||||||
|
List<AttachmentSummary> getAttachmentSummaries();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the domain of the task.
|
* Gets the domain of the task.
|
||||||
*
|
*
|
||||||
|
@ -225,4 +233,5 @@ public interface TaskSummary {
|
||||||
* @return the task's custom10 property
|
* @return the task's custom10 property
|
||||||
*/
|
*/
|
||||||
String getCustom10();
|
String getCustom10();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -337,6 +337,7 @@ public class TaskSummaryImpl implements TaskSummary {
|
||||||
this.isTransferred = isTransferred;
|
this.isTransferred = isTransferred;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public List<AttachmentSummary> getAttachmentSummaries() {
|
public List<AttachmentSummary> getAttachmentSummaries() {
|
||||||
return attachmentSummaries;
|
return attachmentSummaries;
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,12 +21,16 @@ import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
|
|
||||||
import acceptance.AbstractAccTest;
|
import acceptance.AbstractAccTest;
|
||||||
|
import pro.taskana.Attachment;
|
||||||
|
import pro.taskana.AttachmentSummary;
|
||||||
import pro.taskana.BaseQuery.SortDirection;
|
import pro.taskana.BaseQuery.SortDirection;
|
||||||
import pro.taskana.KeyDomain;
|
import pro.taskana.KeyDomain;
|
||||||
import pro.taskana.Task;
|
import pro.taskana.Task;
|
||||||
import pro.taskana.TaskService;
|
import pro.taskana.TaskService;
|
||||||
import pro.taskana.TaskSummary;
|
import pro.taskana.TaskSummary;
|
||||||
|
import pro.taskana.exceptions.AttachmentPersistenceException;
|
||||||
import pro.taskana.exceptions.ClassificationNotFoundException;
|
import pro.taskana.exceptions.ClassificationNotFoundException;
|
||||||
|
import pro.taskana.exceptions.ConcurrencyException;
|
||||||
import pro.taskana.exceptions.InvalidArgumentException;
|
import pro.taskana.exceptions.InvalidArgumentException;
|
||||||
import pro.taskana.exceptions.InvalidWorkbasketException;
|
import pro.taskana.exceptions.InvalidWorkbasketException;
|
||||||
import pro.taskana.exceptions.NotAuthorizedException;
|
import pro.taskana.exceptions.NotAuthorizedException;
|
||||||
|
@ -164,6 +168,37 @@ public class QueryTasksAccTest extends AbstractAccTest {
|
||||||
assertThat(result2.size(), equalTo(65));
|
assertThat(result2.size(), equalTo(65));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@WithAccessId(
|
||||||
|
userName = "teamlead_1",
|
||||||
|
groupNames = {"group_1"})
|
||||||
|
@Test
|
||||||
|
public void testQueryForAttachmentInSummary()
|
||||||
|
throws SQLException, NotAuthorizedException, InvalidArgumentException, ClassificationNotFoundException,
|
||||||
|
TaskNotFoundException, WorkbasketNotFoundException, ConcurrencyException, InvalidWorkbasketException,
|
||||||
|
AttachmentPersistenceException {
|
||||||
|
TaskService taskService = taskanaEngine.getTaskService();
|
||||||
|
|
||||||
|
Attachment attachment = createAttachment("DOCTYPE_DEFAULT", // prio 99, SL P2000D
|
||||||
|
createObjectReference("COMPANY_A", "SYSTEM_B", "INSTANCE_B", "ArchiveId",
|
||||||
|
"12345678901234567890123456789012345678901234567890"),
|
||||||
|
"E-MAIL", "2018-01-15", createSimpleCustomProperties(3));
|
||||||
|
|
||||||
|
Task task = taskService.getTask("TKI:000000000000000000000000000000000000");
|
||||||
|
task.addAttachment(attachment);
|
||||||
|
taskService.updateTask(task);
|
||||||
|
|
||||||
|
List<TaskSummary> results = taskService.createTaskQuery()
|
||||||
|
.idIn("TKI:000000000000000000000000000000000000")
|
||||||
|
.list();
|
||||||
|
assertThat(results.size(), equalTo(1));
|
||||||
|
assertThat(results.get(0).getAttachmentSummaries().size(), equalTo(1));
|
||||||
|
AttachmentSummary att = results.get(0).getAttachmentSummaries().get(0);
|
||||||
|
assertThat(att.getClassificationSummary(), equalTo(attachment.getClassificationSummary()));
|
||||||
|
assertThat(att.getCreated(), equalTo(task.getAttachments().get(0).getCreated()));
|
||||||
|
assertThat(att.getModified(), equalTo(task.getAttachments().get(0).getModified()));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@WithAccessId(
|
@WithAccessId(
|
||||||
userName = "teamlead_1",
|
userName = "teamlead_1",
|
||||||
groupNames = {"group_1"})
|
groupNames = {"group_1"})
|
||||||
|
|
Loading…
Reference in New Issue