diff --git a/rest/taskana-rest-spring/src/main/java/pro/taskana/common/rest/JsonPropertyEditorRegistrator.java b/rest/taskana-rest-spring/src/main/java/pro/taskana/common/rest/JsonPropertyEditorRegistrator.java index c3afd3564..0dfde34c7 100644 --- a/rest/taskana-rest-spring/src/main/java/pro/taskana/common/rest/JsonPropertyEditorRegistrator.java +++ b/rest/taskana-rest-spring/src/main/java/pro/taskana/common/rest/JsonPropertyEditorRegistrator.java @@ -7,6 +7,7 @@ import org.springframework.web.bind.annotation.ControllerAdvice; import org.springframework.web.bind.annotation.InitBinder; import pro.taskana.monitor.rest.models.PriorityColumnHeaderRepresentationModel; +import pro.taskana.task.api.models.ObjectReference; @ControllerAdvice public class JsonPropertyEditorRegistrator { @@ -23,5 +24,7 @@ public class JsonPropertyEditorRegistrator { binder.registerCustomEditor( PriorityColumnHeaderRepresentationModel.class, new JsonPropertyEditor(objectMapper, PriorityColumnHeaderRepresentationModel.class)); + binder.registerCustomEditor( + ObjectReference.class, new JsonPropertyEditor(objectMapper, ObjectReference.class)); } } diff --git a/rest/taskana-rest-spring/src/test/java/pro/taskana/task/rest/TaskControllerIntTest.java b/rest/taskana-rest-spring/src/test/java/pro/taskana/task/rest/TaskControllerIntTest.java index a8bd3ae51..c93023476 100644 --- a/rest/taskana-rest-spring/src/test/java/pro/taskana/task/rest/TaskControllerIntTest.java +++ b/rest/taskana-rest-spring/src/test/java/pro/taskana/task/rest/TaskControllerIntTest.java @@ -9,6 +9,7 @@ import java.io.BufferedWriter; import java.io.OutputStreamWriter; import java.net.HttpURLConnection; import java.net.URL; +import java.net.URLEncoder; import java.time.Instant; import java.time.temporal.ChronoUnit; import java.util.Arrays; @@ -222,6 +223,22 @@ class TaskControllerIntTest { assertThat(response.getBody().getContent()).hasSize(22); } + @Test + void should_ReturnAllTasks_For_ProvidedPrimaryObjectReference() throws Exception { + String url = + restHelper.toUrl(RestEndpoints.URL_TASKS) + + "?por=" + + URLEncoder.encode( + "{\"systemInstance\":\"MyInstance1\",\"type\":\"MyType1\"}", "UTF-8"); + HttpEntity auth = new HttpEntity<>(RestHelper.generateHeadersForUser("teamlead-1")); + ResponseEntity response = + TEMPLATE.exchange(url, HttpMethod.GET, auth, TASK_SUMMARY_PAGE_MODEL_TYPE); + assertThat(response.getBody()).isNotNull(); + assertThat(response.getStatusCode()).isEqualTo(HttpStatus.OK); + assertThat((response.getBody()).getLink(IanaLinkRelations.SELF)).isNotNull(); + assertThat(response.getBody().getContent()).hasSize(4); + } + @Test void should_ReturnAllTasksByWildcardSearch_For_ProvidedSearchValue() { String url =