[NAE-2461] Create case filter only deployed#463
Conversation
- add deploymentState in PetriNetReference - fix wrong call of cacheable method - fix some warnings
WalkthroughThis PR simplifies PetriNetController's ChangesPetriNet reference and controller updates
Estimated code review effort: 2 (Simple) | ~15 minutes Suggested labels: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
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 |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In
`@src/main/java/com/netgrif/application/engine/petrinet/web/PetriNetController.java`:
- Around line 165-168: The TransactionsResource construction in
PetriNetController#getTransactions is using the raw netId while getPetriNet
already uses decodeUrl(netId), which is inconsistent with getRoles. Update
getTransactions to pass the decoded netId into TransactionsResource so
downstream link building uses the same id form as the rest of the controller.
- Around line 158-161: Decode the netId only once in PetriNetController.getRoles
and reuse the same decoded value for both roleService.findAll(...) and
service.getPetriNet(...); remove the second decodeUrl(netId) call so the method
consistently operates on the same identifier.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: 3f183468-02a9-4c01-bb64-5b8612f776f0
📒 Files selected for processing (4)
src/main/java/com/netgrif/application/engine/petrinet/service/PetriNetService.javasrc/main/java/com/netgrif/application/engine/petrinet/web/PetriNetController.javasrc/main/java/com/netgrif/application/engine/petrinet/web/responsebodies/PetriNetReference.javasrc/main/java/com/netgrif/application/engine/petrinet/web/responsebodies/PetriNetReferenceResource.java
- fix decoding issues
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (2)
src/main/java/com/netgrif/application/engine/petrinet/web/PetriNetController.java (2)
220-224: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
""check indeletePetriNetis now inconsistent withdecodeUrlbehavior
decodeUrlno longer returns""as an error fallback — it returnsnullfor null input and throwsIllegalArgumentExceptionfor malformed URL encoding. TheObjects.equals(decodedProcessId, "")check at line 221 now only catches the narrow case where the decoded result is an empty string, not decode failures. Malformed URLs will throw an uncaughtIllegalArgumentException, producing a raw 500 error instead of the intended error message. The log message "could not decode process ID from URL" is also misleading when the decoding succeeded but yielded an empty string.Consider catching
IllegalArgumentExceptionfromdecodeUrlto restore graceful error handling for malformed URLs.🛠️ Proposed fix for malformed URL handling
String decodedProcessId; try { decodedProcessId = decodeUrl(processId); } catch (IllegalArgumentException e) { log.error("Deleting Petri net [{}] failed: could not decode process ID from URL", processId); return MessageResource.errorMessage("Deleting Petri net " + processId + " failed!"); } - if (Objects.equals(decodedProcessId, "")) { - log.error("Deleting Petri net [{}] failed: could not decode process ID from URL", processId); - return MessageResource.errorMessage("Deleting Petri net " + processId + " failed!"); - } + if (decodedProcessId == null || decodedProcessId.isEmpty()) { + log.error("Deleting Petri net [{}] failed: decoded process ID is empty", processId); + return MessageResource.errorMessage("Deleting Petri net " + processId + " failed!"); + }🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/main/java/com/netgrif/application/engine/petrinet/web/PetriNetController.java` around lines 220 - 224, Update deletePetriNet to handle decodeUrl failures by catching IllegalArgumentException around the decode call and returning the existing error response with an appropriate log entry for malformed process IDs. Remove or separately handle the empty-string check, since it represents a successful decode rather than a decoding failure; also account for decodeUrl returning null where applicable.
117-117: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick winRename the query parameter to
identifier
@RequestParam(value = "indentifier")is misspelled, so?identifier=...never binds and the identifier/version branches return the wrong result set.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/main/java/com/netgrif/application/engine/petrinet/web/PetriNetController.java` at line 117, Correct the misspelled `@RequestParam` value in PetriNetController.getAll from "indentifier" to "identifier", preserving the existing optional identifier and version handling.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Outside diff comments:
In
`@src/main/java/com/netgrif/application/engine/petrinet/web/PetriNetController.java`:
- Around line 220-224: Update deletePetriNet to handle decodeUrl failures by
catching IllegalArgumentException around the decode call and returning the
existing error response with an appropriate log entry for malformed process IDs.
Remove or separately handle the empty-string check, since it represents a
successful decode rather than a decoding failure; also account for decodeUrl
returning null where applicable.
- Line 117: Correct the misspelled `@RequestParam` value in
PetriNetController.getAll from "indentifier" to "identifier", preserving the
existing optional identifier and version handling.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: 8acd688a-080a-41ac-a1c2-214f5b5b02a2
📒 Files selected for processing (1)
src/main/java/com/netgrif/application/engine/petrinet/web/PetriNetController.java
Description
Added deployment state attribute to PetriNetController response entity. And also fixed some warnings
Implements NAE-2461
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
Test Configuration
Checklist:
Summary by CodeRabbit
New Features
Refactor
Behavior Changes