TSK-498 missing custom properties on REST taskquery result

This commit is contained in:
BerndBreier 2018-05-17 15:11:23 +02:00 committed by Holger Hagen
parent ad6a9163a7
commit c5ff9ed8a8
3 changed files with 159 additions and 1 deletions

View File

@ -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()));
}

View File

@ -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;
}

View File

@ -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;
}