Skip to content

[NAE-2461] Create case filter only deployed#463

Open
Retoocs wants to merge 2 commits into
release/6.5.0from
NAE-2461
Open

[NAE-2461] Create case filter only deployed#463
Retoocs wants to merge 2 commits into
release/6.5.0from
NAE-2461

Conversation

@Retoocs

@Retoocs Retoocs commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

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

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 @...
  • 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

    • Process references now include deployment state information.
  • Refactor

    • Improved URL decoding to use a standard UTF-8 approach.
    • Updated endpoint parameter and routing logic for more consistent request handling.
    • Adjusted how the “newest version” lookup is routed.
  • Behavior Changes

    • Enhanced equality/hash code behavior for process reference responses.

- add deploymentState in PetriNetReference
- fix wrong call of cacheable method
- fix some warnings
@Retoocs Retoocs self-assigned this Jul 9, 2026
@coderabbitai

coderabbitai Bot commented Jul 9, 2026

Copy link
Copy Markdown

Review Change Stack

Walkthrough

This PR simplifies PetriNetController's getOne endpoint and URL decoding, removes unused dependencies, adds deploymentState to PetriNetReference, updates resource self-link construction, and routes a service lookup through a self-proxy.

Changes

PetriNet reference and controller updates

Layer / File(s) Summary
PetriNetReference: deploymentState field and equality
src/main/java/com/netgrif/application/engine/petrinet/web/responsebodies/PetriNetReference.java
Adds deploymentState, sets it from PetriNet, updates equality generation, and delegates one constructor through another.
getOne signature simplification and self-link update
src/main/java/com/netgrif/application/engine/petrinet/web/PetriNetController.java, src/main/java/com/netgrif/application/engine/petrinet/web/responsebodies/PetriNetReferenceResource.java
Removes Authentication from getOne and updates the self-link call to match the new signature.
Controller cleanup: decodeUrl, parameters, logging, and branching
src/main/java/com/netgrif/application/engine/petrinet/web/PetriNetController.java
Removes unused configuration, simplifies UTF-8 decoding, changes request parameter handling, reworks getAll branching, decodes netId once, and updates delete logging.
Service injection cleanup and self-proxy call
src/main/java/com/netgrif/application/engine/petrinet/service/PetriNetService.java
Removes the unused IDataService field and routes newest-version lookup through self.

Estimated code review effort: 2 (Simple) | ~15 minutes

Suggested labels: bugfix, improvement, Medium

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title matches the main change of adding deployment-state support for the case filter and is clear and concise.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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.

@Retoocs Retoocs changed the base branch from master to release/6.5.0 July 9, 2026 17:19
@Retoocs Retoocs marked this pull request as ready for review July 9, 2026 17:49
@coderabbitai coderabbitai Bot added improvement A change that improves on an existing feature Medium labels Jul 9, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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

📥 Commits

Reviewing files that changed from the base of the PR and between 49e9ed6 and b1ce984.

📒 Files selected for processing (4)
  • src/main/java/com/netgrif/application/engine/petrinet/service/PetriNetService.java
  • src/main/java/com/netgrif/application/engine/petrinet/web/PetriNetController.java
  • src/main/java/com/netgrif/application/engine/petrinet/web/responsebodies/PetriNetReference.java
  • src/main/java/com/netgrif/application/engine/petrinet/web/responsebodies/PetriNetReferenceResource.java

@coderabbitai coderabbitai Bot added the bugfix A change that fixes a bug label Jul 10, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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 in deletePetriNet is now inconsistent with decodeUrl behavior

decodeUrl no longer returns "" as an error fallback — it returns null for null input and throws IllegalArgumentException for malformed URL encoding. The Objects.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 uncaught IllegalArgumentException, 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 IllegalArgumentException from decodeUrl to 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 win

Rename 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

📥 Commits

Reviewing files that changed from the base of the PR and between b1ce984 and da30ae1.

📒 Files selected for processing (1)
  • src/main/java/com/netgrif/application/engine/petrinet/web/PetriNetController.java

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 improvement A change that improves on an existing feature Medium

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant