Skip to content

Conversation

@Retoocs
Copy link
Contributor

@Retoocs Retoocs commented Oct 14, 2025

Description

I have added a flag to the FinishTaskEventOutcome. The boolean flag is true if the task, that was finished, is still executable. This information needs frontend to prohibit reloading on non-existing tasks

Fixes NAE-2231

Dependencies

No new dependencies were introduced

Third party dependencies

No new dependencies were introduced

Blocking Pull requests

There are no dependencies on other PR

How Has Been This Tested?

Manually. I tested multiple situations for the updated code conditions

Test Configuration

Name Tested on
OS Ubuntu 24.04.1 LTS
Runtime Java 11
Dependency Manager Maven 3.6.3
Framework version Spring Boot 2.7.8
Run parameters
Other configuration

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • My changes have been checked, personally or remotely, with @Kovy95
  • I have commented my code, particularly in hard-to-understand areas
  • I have resolved all conflicts with the target branch of the PR
  • I have updated and synced my code with the target branch
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing tests pass locally with my changes:
    • Lint test
    • Unit tests
    • Integration tests
  • I have checked my contribution with code analysis tools:
  • I have made corresponding changes to the documentation:
    • Developer documentation
    • User Guides
    • Migration Guides

Summary by CodeRabbit

  • New Features
    • Added an indicator in finish-task results showing whether the task remains executable after completion.
    • Exposed this status in API responses to enable clients and UIs to react accordingly (e.g., show follow-up actions or keep controls enabled).
    • Improves clarity for users by distinguishing between tasks that are fully completed versus those that can still be acted upon.

…ut error message

- implement FinishTaskEventOutcome flag, which signals if the finished task still exists
@Retoocs Retoocs self-assigned this Oct 14, 2025
@Retoocs Retoocs added the bugfix A change that fixes a bug label Oct 14, 2025
@coderabbitai
Copy link

coderabbitai bot commented Oct 14, 2025

Walkthrough

Adds a boolean flag isTaskStillExecutable to FinishTaskEventOutcome and exposes it in LocalisedFinishTaskEventOutcome. The flag is computed during construction via a helper that checks if the task still exists in the case’s tasks. Localised response now includes this value via a getter.

Changes

Cohort / File(s) Summary of Changes
Domain event outcome update
src/main/java/com/netgrif/application/engine/workflow/domain/eventoutcomes/taskoutcomes/FinishTaskEventOutcome.java
Added protected field isTaskStillExecutable. Initialized in constructor via new helper method isTaskStillExecutable(Case, Task) that checks task presence by stringId within the case.
Web response body update
src/main/java/com/netgrif/application/engine/workflow/web/responsebodies/eventoutcomes/LocalisedFinishTaskEventOutcome.java
Added protected Boolean isTaskStillExecutable with Lombok @Getter. Constructor assigns from outcome.isTaskStillExecutable() when available; added necessary import.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Pre-merge checks

❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Title Check ⚠️ Warning The pull request title describes the underlying bug and references the issue but does not summarize the primary change, which is introducing the isTaskStillExecutable flag to FinishTaskEventOutcome. The current wording and ellipsis make the title unclear and focused on the symptom rather than the implemented solution. As a result it does not meet the criteria for a concise and specific summary of the change. Please revise the title to focus on the actual change, for example “Add isTaskStillExecutable flag to FinishTaskEventOutcome to indicate if a finished task remains executable,” so it clearly conveys the PR’s main purpose.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (1 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

📜 Review details

Configuration used: CodeRabbit UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 14eeaa1 and 240ee7d.

📒 Files selected for processing (2)
  • src/main/java/com/netgrif/application/engine/workflow/domain/eventoutcomes/taskoutcomes/FinishTaskEventOutcome.java (1 hunks)
  • src/main/java/com/netgrif/application/engine/workflow/web/responsebodies/eventoutcomes/LocalisedFinishTaskEventOutcome.java (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (6)
  • GitHub Check: task-list-completed
  • GitHub Check: task-list-completed
  • GitHub Check: task-list-completed
  • GitHub Check: task-list-completed
  • GitHub Check: task-list-completed
  • GitHub Check: task-list-completed
🔇 Additional comments (2)
src/main/java/com/netgrif/application/engine/workflow/domain/eventoutcomes/taskoutcomes/FinishTaskEventOutcome.java (2)

13-16: LGTM!

The field declaration is clear and well-documented.


24-24: LGTM!

The field initialization correctly delegates to the helper method.

Comment on lines +32 to +35
protected boolean isTaskStillExecutable(Case useCase, Task task) {
return useCase.getTasks().stream()
.anyMatch(taskPair -> taskPair.getTask().equals(task.getStringId()));
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Guard against potential NPE and consider method naming.

The method has two concerns:

  1. NPE risk: If taskPair.getTask() returns null, the equals call will throw a NullPointerException.
  2. Naming clarity: The method name isTaskStillExecutable suggests checking executability, but the logic only verifies existence in the case's tasks collection. Consider a name like isTaskStillPresent or doesTaskStillExist for clarity.

Apply this diff to add null safety:

 protected boolean isTaskStillExecutable(Case useCase, Task task) {
     return useCase.getTasks().stream()
-            .anyMatch(taskPair -> taskPair.getTask().equals(task.getStringId()));
+            .anyMatch(taskPair -> task.getStringId().equals(taskPair.getTask()));
 }

Or with explicit null check:

 protected boolean isTaskStillExecutable(Case useCase, Task task) {
     return useCase.getTasks().stream()
-            .anyMatch(taskPair -> taskPair.getTask().equals(task.getStringId()));
+            .anyMatch(taskPair -> {
+                String taskId = taskPair.getTask();
+                return taskId != null && taskId.equals(task.getStringId());
+            });
 }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
protected boolean isTaskStillExecutable(Case useCase, Task task) {
return useCase.getTasks().stream()
.anyMatch(taskPair -> taskPair.getTask().equals(task.getStringId()));
}
protected boolean isTaskStillExecutable(Case useCase, Task task) {
return useCase.getTasks().stream()
.anyMatch(taskPair -> {
String taskId = taskPair.getTask();
return taskId != null && taskId.equals(task.getStringId());
});
}
🤖 Prompt for AI Agents
In
src/main/java/com/netgrif/application/engine/workflow/domain/eventoutcomes/taskoutcomes/FinishTaskEventOutcome.java
around lines 32 to 35, the method risks an NPE by calling
taskPair.getTask().equals(... ) and the name misleads about intent; change the
name to something like doesTaskStillExist or isTaskStillPresent, make the
existence check null-safe (e.g., use Objects.equals(task.getStringId(),
taskPair.getTask()) or invert the equals to compare
task.getStringId().equals(taskPair.getTask()) only after null-check of
task.getStringId()), and update all call sites and imports accordingly so the
method reflects its purpose and no longer throws on null task IDs.

Comment on lines +11 to +12
@Getter
protected Boolean isTaskStillExecutable;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick | 🔵 Trivial

Consider field naming for cleaner getter.

The @Getter annotation generates getIsTaskStillExecutable(), which deviates from the standard JavaBean convention of isXxx() for boolean properties. While not incorrect, renaming the field to taskStillExecutable would result in a more conventional getter getTaskStillExecutable().

🤖 Prompt for AI Agents
In
src/main/java/com/netgrif/application/engine/workflow/web/responsebodies/eventoutcomes/LocalisedFinishTaskEventOutcome.java
around lines 11-12, the protected Boolean field named isTaskStillExecutable
yields a non-idiomatic getter getIsTaskStillExecutable(); rename the field to
taskStillExecutable to produce a conventional getter getTaskStillExecutable(),
update all references/usages (including tests, serialization names or builders)
to the new field name, and ensure any JSON/property mappings or reflection
usages are adjusted (or add @JsonProperty if name must remain externally) so
behavior stays identical.

Comment on lines +16 to +18
if (outcome != null) {
this.isTaskStillExecutable = outcome.isTaskStillExecutable() ;
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick | 🔵 Trivial

Remove extra whitespace.

Minor formatting issue: there's an extra space before the semicolon on line 17.

Apply this diff:

 if (outcome != null) {
-    this.isTaskStillExecutable = outcome.isTaskStillExecutable() ;
+    this.isTaskStillExecutable = outcome.isTaskStillExecutable();
 }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
if (outcome != null) {
this.isTaskStillExecutable = outcome.isTaskStillExecutable() ;
}
if (outcome != null) {
this.isTaskStillExecutable = outcome.isTaskStillExecutable();
}
🤖 Prompt for AI Agents
In
src/main/java/com/netgrif/application/engine/workflow/web/responsebodies/eventoutcomes/LocalisedFinishTaskEventOutcome.java
around lines 16 to 18, there's an extra space before the semicolon on line 17;
remove the stray space so the assignment reads without a space before the
semicolon (i.e., ensure there is no space between the method call and the
semicolon), and save formatting so no other whitespace changes are introduced.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugfix A change that fixes a bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants