-
Notifications
You must be signed in to change notification settings - Fork 6
[NAE-2231] Unable to change behavior of taskRef on finish event witho… #371
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: release/6.4.2
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -2,12 +2,19 @@ | |||||||||||||
|
|
||||||||||||||
| import com.netgrif.application.engine.workflow.domain.eventoutcomes.taskoutcomes.FinishTaskEventOutcome; | ||||||||||||||
| import com.netgrif.application.engine.workflow.web.responsebodies.eventoutcomes.base.LocalisedTaskEventOutcome; | ||||||||||||||
| import lombok.Getter; | ||||||||||||||
|
|
||||||||||||||
| import java.util.Locale; | ||||||||||||||
|
|
||||||||||||||
| public class LocalisedFinishTaskEventOutcome extends LocalisedTaskEventOutcome { | ||||||||||||||
|
|
||||||||||||||
| @Getter | ||||||||||||||
| protected Boolean isTaskStillExecutable; | ||||||||||||||
|
Comment on lines
+11
to
+12
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧹 Nitpick | 🔵 Trivial Consider field naming for cleaner getter. The 🤖 Prompt for AI Agents |
||||||||||||||
|
|
||||||||||||||
| public LocalisedFinishTaskEventOutcome(FinishTaskEventOutcome outcome, Locale locale) { | ||||||||||||||
| super(outcome, locale); | ||||||||||||||
| if (outcome != null) { | ||||||||||||||
| this.isTaskStillExecutable = outcome.isTaskStillExecutable() ; | ||||||||||||||
| } | ||||||||||||||
|
Comment on lines
+16
to
+18
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||
| } | ||||||||||||||
| } | ||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Guard against potential NPE and consider method naming.
The method has two concerns:
taskPair.getTask()returnsnull, theequalscall will throw aNullPointerException.isTaskStillExecutablesuggests checking executability, but the logic only verifies existence in the case's tasks collection. Consider a name likeisTaskStillPresentordoesTaskStillExistfor 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
🤖 Prompt for AI Agents