[NAE-2354] Include assignee userRealmId in task response#409
[NAE-2354] Include assignee userRealmId in task response#409machacjozef merged 5 commits intorelease/7.0.0-rev10from
Conversation
- refactor Task to contain ActorRef instead of just userId
WalkthroughReplaces per-task Changes
Sequence Diagram(s)(omitted) Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 1 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (1 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
# Conflicts: # application-engine/src/main/java/com/netgrif/application/engine/workflow/service/TaskService.java
- resolve conflicts with rev10 branch
- fix TaskRepository methods dependent on removed attribute userId
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (2)
application-engine/src/main/java/com/netgrif/application/engine/workflow/web/responsebodies/Task.java (1)
78-115:⚠️ Potential issue | 🟠 MajorPopulate assignee for ElasticTask-based responses.
assigneeis set only when constructed from domainTask; responses built fromElasticTaskstill returnnull, which defeats the requirement to includeuserRealmIdfor those code paths.✅ Suggested fix
public Task(ElasticTask entity) { _id = new ProcessResourceId(entity.getId()); caseId = entity.getCaseId(); transitionId = entity.getTransitionId(); title = entity.getTitle().getDefaultValue(); caseTitle = entity.getCaseTitle(); priority = entity.getPriority(); + if (entity.getUserId() != null || entity.getUserRealmId() != null) { + this.assignee = new ActorRef( + entity.getUserId(), + entity.getUserRealmId(), + entity.getUsername(), + entity.getUserFullName() + ); + } }nae-object-library/src/main/java/com/netgrif/application/engine/objects/elastic/domain/ElasticTask.java (1)
50-105:⚠️ Potential issue | 🟡 MinorAdd explicit Elasticsearch
@Fieldannotations for user identity fields in Spring ElasticTask.The new
userFullNameandusernamefields lack explicit@Fieldannotations in the Spring adapter class. Note thatuserIdanduserRealmIdalso lack explicit mappings. While dynamic mapping will handle unmapped fields, explicit annotations should be added for consistency with the rest of the ElasticTask mapping definition (similar to how other string fields use@Field(type = Keyword)).
🤖 Fix all issues with AI agents
In
`@application-engine/src/main/java/com/netgrif/application/engine/workflow/service/TaskService.java`:
- Around line 399-403: The task unassignment clears assignee and startDate but
leaves the stale task.user field; in TaskService (around the block that calls
workflowService.updateMarking(useCase) and then task.setAssignee(null);
task.setStartDate(null);) also clear the user reference by calling the
appropriate setter (e.g., task.setUser(null)) or nulling the user property so
the task no longer retains the previous user when unassigned.
...cation-engine/src/main/java/com/netgrif/application/engine/workflow/service/TaskService.java
Show resolved
Hide resolved
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Fix all issues with AI agents
In
`@application-engine/src/main/java/com/netgrif/application/engine/workflow/domain/repositories/TaskRepository.java`:
- Line 31: Rename the repository method to remove the extraneous underscore
before the connector so Spring can parse the derived query: change the method
name findByAssignee_Id_AndFinishDateNotNull to
findByAssignee_IdAndFinishDateNotNull in TaskRepository and update any call
sites accordingly; ensure the signature remains List<Task>
findByAssignee_IdAndFinishDateNotNull(String userId) and run a build/tests to
verify no further naming issues.
In
`@application-engine/src/main/java/com/netgrif/application/engine/workflow/service/TaskService.java`:
- Around line 571-576: The finish flow in TaskService leaves a stale task.user
after completing a task; update the finish logic to clear the user reference by
calling task.setUser(null) (in the same block that currently calls
task.setAssignee(null) and task.setFinishDate(...)), then save(task) and return
workflowService.save(useCase) as before so both assignee and user are cleared
consistently with the assignment code paths.
...rc/main/java/com/netgrif/application/engine/workflow/domain/repositories/TaskRepository.java
Outdated
Show resolved
Hide resolved
...cation-engine/src/main/java/com/netgrif/application/engine/workflow/service/TaskService.java
Show resolved
Hide resolved
- implement coderabbit suggestion
Description
Implements NAE-2354
Blocking Pull requests
How Has Been This Tested?
manual testing in single node and cluster mode
Checklist:
Summary by CodeRabbit