From d53da3eccc5f9dc03aa6e71a818c0fee05bb0d89 Mon Sep 17 00:00:00 2001 From: skandala-cgi Date: Tue, 31 Mar 2026 15:51:23 +0100 Subject: [PATCH 1/3] TMDPC-32 initial commit --- .../wataskmanagementapi/services/CFTTaskMapper.java | 12 +++++++++--- src/main/resources/api-specs/openapi.yaml | 1 + 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/main/java/uk/gov/hmcts/reform/wataskmanagementapi/services/CFTTaskMapper.java b/src/main/java/uk/gov/hmcts/reform/wataskmanagementapi/services/CFTTaskMapper.java index 4e485440c9..496310687e 100644 --- a/src/main/java/uk/gov/hmcts/reform/wataskmanagementapi/services/CFTTaskMapper.java +++ b/src/main/java/uk/gov/hmcts/reform/wataskmanagementapi/services/CFTTaskMapper.java @@ -910,11 +910,17 @@ public TaskResource mapToTaskResourceForReconfigure(TaskResource taskResource, T taskResource.setLocation(task.getLocation()); taskResource.setLocationName(task.getLocationName()); taskResource.setDescription(task.getDescription()); - taskResource.setTitle(task.getTitle()); + if (task.getTitle() != null) { + taskResource.setTitle(task.getTitle()); + } taskResource.setDueDateTime(task.getDueDateTime()); taskResource.setPriorityDate(task.getPriorityDate()); - taskResource.setMajorPriority(task.getMajorPriority()); - taskResource.setMinorPriority(task.getMinorPriority()); + if (task.getMajorPriority() != null) { + taskResource.setMajorPriority(task.getMajorPriority()); + } + if (task.getMinorPriority() != null) { + taskResource.setMinorPriority(task.getMinorPriority()); + } String taskId = task.getId().toString(); Set taskRoleResources = mapPermissions(task.getPermissions(), taskId); taskResource.setTaskRoleResources(taskRoleResources); diff --git a/src/main/resources/api-specs/openapi.yaml b/src/main/resources/api-specs/openapi.yaml index 391d908ec1..1731166843 100644 --- a/src/main/resources/api-specs/openapi.yaml +++ b/src/main/resources/api-specs/openapi.yaml @@ -514,6 +514,7 @@ components: - case_name - region - location + - role_category description: Task attributes that can be updated during reconfiguration. properties: id: From 0e194402cb0c03766408f4895af5237c52d01bcd Mon Sep 17 00:00:00 2001 From: skandala-cgi Date: Thu, 2 Apr 2026 10:25:16 +0100 Subject: [PATCH 2/3] TMDPC-32 initial commit --- .../services/CFTTaskMapper.java | 39 ++++++++++--------- src/main/resources/api-specs/openapi.yaml | 5 +++ 2 files changed, 26 insertions(+), 18 deletions(-) diff --git a/src/main/java/uk/gov/hmcts/reform/wataskmanagementapi/services/CFTTaskMapper.java b/src/main/java/uk/gov/hmcts/reform/wataskmanagementapi/services/CFTTaskMapper.java index 496310687e..180f454958 100644 --- a/src/main/java/uk/gov/hmcts/reform/wataskmanagementapi/services/CFTTaskMapper.java +++ b/src/main/java/uk/gov/hmcts/reform/wataskmanagementapi/services/CFTTaskMapper.java @@ -185,8 +185,8 @@ public TaskResource mapToApiFirstTaskResource(CreateTaskRequestTask request) { taskTitle != null ? taskTitle : taskName, request.getDescription(), new ArrayList(), - majorPriority != null ? majorPriority : 5000, - minorPriority != null ? minorPriority : 500, + majorPriority, + minorPriority, null, //Need to get from taskPayload assignee false, //autoAssigned executionTypeResource, @@ -910,17 +910,12 @@ public TaskResource mapToTaskResourceForReconfigure(TaskResource taskResource, T taskResource.setLocation(task.getLocation()); taskResource.setLocationName(task.getLocationName()); taskResource.setDescription(task.getDescription()); - if (task.getTitle() != null) { - taskResource.setTitle(task.getTitle()); - } + taskResource.setTitle(task.getTitle()); taskResource.setDueDateTime(task.getDueDateTime()); taskResource.setPriorityDate(task.getPriorityDate()); - if (task.getMajorPriority() != null) { - taskResource.setMajorPriority(task.getMajorPriority()); - } - if (task.getMinorPriority() != null) { - taskResource.setMinorPriority(task.getMinorPriority()); - } + taskResource.setMajorPriority(task.getMajorPriority()); + taskResource.setMinorPriority(task.getMinorPriority()); + String taskId = task.getId().toString(); Set taskRoleResources = mapPermissions(task.getPermissions(), taskId); taskResource.setTaskRoleResources(taskRoleResources); @@ -932,15 +927,23 @@ public TaskResource mapToTaskResourceForReconfigure(TaskResource taskResource, T taskResource.setRoleCategory(task.getRoleCategory()); taskResource.setNextHearingDate(task.getNextHearingDate()); taskResource.setNextHearingId(task.getNextHearingId()); - Map additionalProperties = Collections.emptyMap(); + Map additionalProperties = new ConcurrentHashMap<>(); + + // Start with existing values if present + if (taskResource.getAdditionalProperties() != null && + !taskResource.getAdditionalProperties().isEmpty()) { + additionalProperties.putAll(taskResource.getAdditionalProperties()); + } + + // Merge / update with new values from task if (task.getAdditionalProperties() != null) { - additionalProperties = task.getAdditionalProperties().entrySet() - .stream() - .collect(Collectors.toMap( - Map.Entry::getKey, - e -> String.valueOf(e.getValue()) - )); + task.getAdditionalProperties().forEach( + (key, value) -> additionalProperties.put(key, String.valueOf(value)) // put() handles both add & update + ); } + + + // Set back to resource taskResource.setAdditionalProperties(additionalProperties); return taskResource; } diff --git a/src/main/resources/api-specs/openapi.yaml b/src/main/resources/api-specs/openapi.yaml index 1731166843..f2eb56f646 100644 --- a/src/main/resources/api-specs/openapi.yaml +++ b/src/main/resources/api-specs/openapi.yaml @@ -352,9 +352,11 @@ components: major_priority: type: integer description: Major priority level. + default: 5000 minor_priority: type: integer description: Minor priority level. + default: 500 location_name: type: string description: Location display name. @@ -515,6 +517,9 @@ components: - region - location - role_category + - title + - major_priority + - minor_priority description: Task attributes that can be updated during reconfiguration. properties: id: From 7ce970bc58412e402da94281b63826774acc76f4 Mon Sep 17 00:00:00 2001 From: skandala-cgi Date: Thu, 2 Apr 2026 10:45:48 +0100 Subject: [PATCH 3/3] TMDPC-32 initial commit --- .../reform/wataskmanagementapi/services/CFTTaskMapper.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/uk/gov/hmcts/reform/wataskmanagementapi/services/CFTTaskMapper.java b/src/main/java/uk/gov/hmcts/reform/wataskmanagementapi/services/CFTTaskMapper.java index 180f454958..2fdb04c6ea 100644 --- a/src/main/java/uk/gov/hmcts/reform/wataskmanagementapi/services/CFTTaskMapper.java +++ b/src/main/java/uk/gov/hmcts/reform/wataskmanagementapi/services/CFTTaskMapper.java @@ -930,8 +930,8 @@ public TaskResource mapToTaskResourceForReconfigure(TaskResource taskResource, T Map additionalProperties = new ConcurrentHashMap<>(); // Start with existing values if present - if (taskResource.getAdditionalProperties() != null && - !taskResource.getAdditionalProperties().isEmpty()) { + if (taskResource.getAdditionalProperties() != null + && !taskResource.getAdditionalProperties().isEmpty()) { additionalProperties.putAll(taskResource.getAdditionalProperties()); }