diff --git a/lib/taskana-core/src/test/java/acceptance/task/UpdateTaskAccTest.java b/lib/taskana-core/src/test/java/acceptance/task/UpdateTaskAccTest.java index a081e84fa..af61b45af 100644 --- a/lib/taskana-core/src/test/java/acceptance/task/UpdateTaskAccTest.java +++ b/lib/taskana-core/src/test/java/acceptance/task/UpdateTaskAccTest.java @@ -209,7 +209,7 @@ public class UpdateTaskAccTest extends AbstractAccTest { Task updatedTask2 = taskService.getTask("TKI:000000000000000000000000000000000030"); assertNotNull(updatedTask2); assertFalse(updatedTask2.isRead()); - assertFalse(updatedTask2.getModified().equals(updatedTask.getModified())); + assertFalse(updatedTask2.getModified().isBefore(updatedTask.getModified())); } diff --git a/rest/taskana-rest-spring/src/main/java/pro/taskana/rest/resource/assembler/TaskResourceAssembler.java b/rest/taskana-rest-spring/src/main/java/pro/taskana/rest/resource/assembler/TaskResourceAssembler.java index 3a7580924..9b060fadb 100644 --- a/rest/taskana-rest-spring/src/main/java/pro/taskana/rest/resource/assembler/TaskResourceAssembler.java +++ b/rest/taskana-rest-spring/src/main/java/pro/taskana/rest/resource/assembler/TaskResourceAssembler.java @@ -10,6 +10,7 @@ import org.springframework.stereotype.Component; import pro.taskana.Task; import pro.taskana.TaskService; import pro.taskana.exceptions.InvalidArgumentException; +import pro.taskana.exceptions.SystemException; import pro.taskana.impl.TaskImpl; import pro.taskana.rest.TaskController; import pro.taskana.rest.resource.TaskResource; @@ -57,6 +58,59 @@ public class TaskResourceAssembler resource.setClassificationSummaryResource( classificationAssembler.toResource(task.getClassificationSummary())); resource.setWorkbasketSummaryResource(workbasketAssembler.toResource(task.getWorkbasketSummary())); + try { + if (task.getCustomAttribute("1") != null) { + resource.setCustom1(task.getCustomAttribute("1")); + } + if (task.getCustomAttribute("2") != null) { + resource.setCustom2(task.getCustomAttribute("2")); + } + if (task.getCustomAttribute("3") != null) { + resource.setCustom3(task.getCustomAttribute("3")); + } + if (task.getCustomAttribute("4") != null) { + resource.setCustom4(task.getCustomAttribute("4")); + } + if (task.getCustomAttribute("5") != null) { + resource.setCustom5(task.getCustomAttribute("5")); + } + if (task.getCustomAttribute("6") != null) { + resource.setCustom6(task.getCustomAttribute("6")); + } + if (task.getCustomAttribute("7") != null) { + resource.setCustom7(task.getCustomAttribute("7")); + } + if (task.getCustomAttribute("8") != null) { + resource.setCustom8(task.getCustomAttribute("8")); + } + if (task.getCustomAttribute("8") != null) { + resource.setCustom9(task.getCustomAttribute("9")); + } + if (task.getCustomAttribute("10") != null) { + resource.setCustom10(task.getCustomAttribute("10")); + } + if (task.getCustomAttribute("11") != null) { + resource.setCustom11(task.getCustomAttribute("11")); + } + if (task.getCustomAttribute("12") != null) { + resource.setCustom12(task.getCustomAttribute("12")); + } + if (task.getCustomAttribute("13") != null) { + resource.setCustom13(task.getCustomAttribute("13")); + } + if (task.getCustomAttribute("14") != null) { + resource.setCustom14(task.getCustomAttribute("14")); + } + if (task.getCustomAttribute("15") != null) { + resource.setCustom15(task.getCustomAttribute("15")); + } + if (task.getCustomAttribute("16") != null) { + resource.setCustom16(task.getCustomAttribute("16")); + } + } catch (InvalidArgumentException e) { + throw new SystemException("caught unexpected Exception " + e); + } + return resource; } @@ -82,6 +136,55 @@ public class TaskResourceAssembler } task.setClassificationSummary(classificationAssembler.toModel(resource.getClassificationSummaryResource())); task.setWorkbasketSummary(workbasketAssembler.toModel(resource.getWorkbasketSummaryResource())); + if (resource.getCustom1() != null) { + task.setCustom1(resource.getCustom1()); + } + if (resource.getCustom2() != null) { + task.setCustom2(resource.getCustom2()); + } + if (resource.getCustom3() != null) { + task.setCustom3(resource.getCustom3()); + } + if (resource.getCustom4() != null) { + task.setCustom4(resource.getCustom4()); + } + if (resource.getCustom5() != null) { + task.setCustom5(resource.getCustom5()); + } + if (resource.getCustom6() != null) { + task.setCustom6(resource.getCustom6()); + } + if (resource.getCustom7() != null) { + task.setCustom7(resource.getCustom7()); + } + if (resource.getCustom8() != null) { + task.setCustom8(resource.getCustom8()); + } + if (resource.getCustom9() != null) { + task.setCustom9(resource.getCustom9()); + } + if (resource.getCustom10() != null) { + task.setCustom10(resource.getCustom10()); + } + if (resource.getCustom11() != null) { + task.setCustom11(resource.getCustom11()); + } + if (resource.getCustom12() != null) { + task.setCustom12(resource.getCustom12()); + } + if (resource.getCustom13() != null) { + task.setCustom13(resource.getCustom13()); + } + if (resource.getCustom14() != null) { + task.setCustom14(resource.getCustom14()); + } + if (resource.getCustom15() != null) { + task.setCustom15(resource.getCustom15()); + } + if (resource.getCustom16() != null) { + task.setCustom16(resource.getCustom16()); + } + return task; } diff --git a/rest/taskana-rest-spring/src/main/java/pro/taskana/rest/resource/assembler/TaskSummaryResourceAssembler.java b/rest/taskana-rest-spring/src/main/java/pro/taskana/rest/resource/assembler/TaskSummaryResourceAssembler.java index 7f8649a17..052c664c6 100644 --- a/rest/taskana-rest-spring/src/main/java/pro/taskana/rest/resource/assembler/TaskSummaryResourceAssembler.java +++ b/rest/taskana-rest-spring/src/main/java/pro/taskana/rest/resource/assembler/TaskSummaryResourceAssembler.java @@ -4,6 +4,8 @@ import org.springframework.beans.BeanUtils; import org.springframework.hateoas.mvc.ResourceAssemblerSupport; import pro.taskana.TaskSummary; +import pro.taskana.exceptions.InvalidArgumentException; +import pro.taskana.exceptions.SystemException; import pro.taskana.rest.TaskController; import pro.taskana.rest.resource.TaskSummaryResource; @@ -42,6 +44,59 @@ public class TaskSummaryResourceAssembler resource.setClassificationSummaryResource( classificationAssembler.toResource(taskSummary.getClassificationSummary())); resource.setWorkbasketSummaryResource(workbasketAssembler.toResource(taskSummary.getWorkbasketSummary())); + try { + if (taskSummary.getCustomAttribute("1") != null) { + resource.setCustom1(taskSummary.getCustomAttribute("1")); + } + if (taskSummary.getCustomAttribute("2") != null) { + resource.setCustom2(taskSummary.getCustomAttribute("2")); + } + if (taskSummary.getCustomAttribute("3") != null) { + resource.setCustom3(taskSummary.getCustomAttribute("3")); + } + if (taskSummary.getCustomAttribute("4") != null) { + resource.setCustom4(taskSummary.getCustomAttribute("4")); + } + if (taskSummary.getCustomAttribute("5") != null) { + resource.setCustom5(taskSummary.getCustomAttribute("5")); + } + if (taskSummary.getCustomAttribute("6") != null) { + resource.setCustom6(taskSummary.getCustomAttribute("6")); + } + if (taskSummary.getCustomAttribute("7") != null) { + resource.setCustom7(taskSummary.getCustomAttribute("7")); + } + if (taskSummary.getCustomAttribute("8") != null) { + resource.setCustom8(taskSummary.getCustomAttribute("8")); + } + if (taskSummary.getCustomAttribute("8") != null) { + resource.setCustom9(taskSummary.getCustomAttribute("9")); + } + if (taskSummary.getCustomAttribute("10") != null) { + resource.setCustom10(taskSummary.getCustomAttribute("10")); + } + if (taskSummary.getCustomAttribute("11") != null) { + resource.setCustom11(taskSummary.getCustomAttribute("11")); + } + if (taskSummary.getCustomAttribute("12") != null) { + resource.setCustom12(taskSummary.getCustomAttribute("12")); + } + if (taskSummary.getCustomAttribute("13") != null) { + resource.setCustom13(taskSummary.getCustomAttribute("13")); + } + if (taskSummary.getCustomAttribute("14") != null) { + resource.setCustom14(taskSummary.getCustomAttribute("14")); + } + if (taskSummary.getCustomAttribute("15") != null) { + resource.setCustom15(taskSummary.getCustomAttribute("15")); + } + if (taskSummary.getCustomAttribute("16") != null) { + resource.setCustom16(taskSummary.getCustomAttribute("16")); + } + } catch (InvalidArgumentException e) { + throw new SystemException("caught unexpected Exception " + e); + } + return resource; }