Skip to content

[NAE-2439] Implement new filter data types#446

Merged
mazarijuraj merged 5 commits into
release/6.5.0from
NAE-2439
Jun 5, 2026
Merged

[NAE-2439] Implement new filter data types#446
mazarijuraj merged 5 commits into
release/6.5.0from
NAE-2439

Conversation

@Retoocs
Copy link
Copy Markdown
Contributor

@Retoocs Retoocs commented May 29, 2026

Description

Introduced new filter fields. Removed old FilterField. New filter fields are more simple

Implements NAE-2439

Dependencies

No new dependencies were introduced

Third party dependencies

No new dependencies were introduced

Blocking Pull requests

Depends on petriflow/petriflow#30

How Has Been This Tested?

Manually and by unit test

FilterTest.groovy

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

    • Filter functionality now includes distinct case, task, and process filter types for finer-grained filtering.
  • Improvements

    • Streamlined filter handling by removing filter metadata and trimmed allowed-net propagation; filter payloads and menu flows simplified.
  • Tests

    • Added end-to-end tests for the new filter types; some legacy filter tests temporarily disabled.

Retoocs added 4 commits May 27, 2026 14:48
- introduce new filter fields
- remove old filter field
- remove transactional in Importer
- handle deprecated filter data type when importing process
- remove use of deleted filter attributes
- force component use for dedicated filter fields
- fix cloning filter fields
@Retoocs Retoocs self-assigned this May 29, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 29, 2026

Review Change Stack

Walkthrough

This PR decomposes a generic FilterField into three specialized types (CaseFilterField, TaskFilterField, ProcessFilterField) and removes filterMetadata/allowedNets propagation across importer, data services, DSL/configuration, import/export, response serialization, and tests.

Changes

Filter Field Architecture Refactoring

Layer / File(s) Summary
Domain model and type system foundation
src/main/groovy/com/netgrif/application/engine/petrinet/domain/dataset/FieldType.groovy, src/main/groovy/com/netgrif/application/engine/petrinet/domain/dataset/CaseFilterField.groovy, src/main/groovy/com/netgrif/application/engine/petrinet/domain/dataset/ProcessFilterField.groovy, src/main/groovy/com/netgrif/application/engine/petrinet/domain/dataset/TaskFilterField.groovy
FieldType enum replaces FILTER with CASE_FILTER, TASK_FILTER, PROCESS_FILTER; three new MongoDB-mapped filter field domain classes introduced; FilterField class deleted.
Field instantiation and importer updates
src/main/java/com/netgrif/application/engine/importer/service/FieldFactory.java, src/main/java/com/netgrif/application/engine/importer/service/Importer.java
FieldFactory routes filter types through dedicated builders and removes filter-metadata resolution; Importer removes @Transactional annotations, changes addUserLogic to accept ActorRef, and uses Field<?> generics in dataset construction.
Data field state and service updates
src/main/java/com/netgrif/application/engine/workflow/domain/DataField.java, src/main/java/com/netgrif/application/engine/workflow/service/DataService.java, src/main/java/com/netgrif/application/engine/workflow/domain/Case.java
DataField removes filterMetadata field and setter; DataService removes metadata parsing and parseFilterMetadataValue, and restricts allowedNets derivation to caseRef; Case.populateDataSet initializes allowedNets for FieldWithAllowedNets instead of filter metadata.
Filter DSL, menu and import/export configuration
src/main/groovy/com/netgrif/application/engine/petrinet/domain/dataset/logic/action/ActionDelegate.groovy, src/main/java/com/netgrif/application/engine/menu/domain/FilterBody.java, src/main/java/com/netgrif/application/engine/menu/services/MenuItemService.java, src/main/java/com/netgrif/application/engine/workflow/service/FilterImportExportService.java, src/main/java/com/netgrif/application/engine/workflow/service/interfaces/IFilterImportExportService.java, src/main/resources/petriNets/engine-processes/import_filters.xml
ActionDelegate removes defaultFilterMetadata helper and DSL updates for allowedNets/filterMetadata; FilterBody drops allowedNets/icon/metadata and simplifies toDataSet; MenuItemService no longer assigns icon; FilterImportExportService and IFilterImportExportService drop changeFilterField usage/export; import_filters.xml removes associated action trigger.
HTTP response layer and field localization
src/main/java/com/netgrif/application/engine/workflow/web/responsebodies/LocalisedFieldFactory.java, src/main/java/com/netgrif/application/engine/workflow/web/responsebodies/LocalisedCaseFilterField.java, LocalisedTaskFilterField.java, LocalisedProcessFilterField.java
LocalisedFieldFactory.from routes three new filter types to dedicated factory methods; fromFilter replaced by type-specific factory methods; three new localized response classes added; LocalisedFilterField removed.
Test validation and coverage
src/test/groovy/com/netgrif/application/engine/filters/FilterTest.groovy, src/test/groovy/com/netgrif/application/engine/filters/FilterImportExportTest.groovy, src/test/resources/petriNets/filter_test.xml, src/test/groovy/com/netgrif/application/engine/action/MenuItemApiTest.groovy
New FilterTest integration test and filter_test.xml resource validate field type mappings and dataset updates; FilterImportExportTest and MenuItemApiTest annotated @Disabled.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

Suggested labels

improvement

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: implementing new filter data types. It maps directly to the core refactoring where FilterField is replaced with three specialized filter field classes (CaseFilterField, TaskFilterField, ProcessFilterField).
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.

✏️ 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.

❤️ Share

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

@dpulls
Copy link
Copy Markdown

dpulls Bot commented May 29, 2026

⚠️ Dpulls not installed on repository petriflow/petriflow. Checkout our quickstart for how to install.

@Retoocs Retoocs marked this pull request as ready for review May 29, 2026 13:33
@coderabbitai coderabbitai Bot added new feature A change that introduces new functionality breaking change Fix or feature that would cause existing functionality doesn't work as expected Large Medium labels May 29, 2026
@dpulls
Copy link
Copy Markdown

dpulls Bot commented May 29, 2026

⚠️ Dpulls not installed on repository petriflow/petriflow. Checkout our quickstart for how to install.

Copy link
Copy Markdown

@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: 4

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/main/java/com/netgrif/application/engine/menu/domain/FilterBody.java (1)

18-23: ⚠️ Potential issue | 🟠 Major | 🏗️ Heavy lift

Removing these fields also removes accessors that current callers still use.

This change drops the Lombok-generated setAllowedNets(...), setIcon(...), and setMetadata(...) methods, but ActionDelegate.groovy still calls them in the provided context (for example around Lines 1619-1622, 2036-2039, and 2466-2469). Those filter/menu creation paths will now fail at runtime in Groovy with a missing-method error unless the callers are migrated in the same PR or compatibility setters are kept temporarily.

🤖 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/menu/domain/FilterBody.java`
around lines 18 - 23, The removal of fields from FilterBody removed
Lombok-generated setters (setAllowedNets, setIcon, setMetadata) that
ActionDelegate.groovy still invokes; restore binary compatibility by
reintroducing those setters on FilterBody (either add back the removed fields
with appropriate types or add explicit public setter methods named
setAllowedNets, setIcon, setMetadata that accept the same parameter types as
before) so ActionDelegate.groovy calls (around the spots that used those
setters) continue to work without runtime missing-method errors.
🤖 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/importer/service/FieldFactory.java`:
- Around line 251-254: The code in FieldFactory currently maps the deprecated
FILTER token directly to buildCaseFilterField, which will misclassify legacy
filters; update the FILTER branch in the switch inside FieldFactory to inspect
the incoming legacy definition (e.g., a "filterType" discriminator or other
distinguishing attributes on the data object) and route to the correct builder
(e.g., buildCaseFilterField or the task/process-specific builder), and if the
discriminator is missing or ambiguous, fail fast by throwing a descriptive
exception rather than silently coercing; reference the FILTER and CASE_FILTER
enum values and the buildCaseFilterField method when implementing the
discriminator check and error path.

In `@src/main/java/com/netgrif/application/engine/importer/service/Importer.java`:
- Line 243: The method signature change to protected void
resolveUserRef(CaseActorRef userRef) and related uses reference types
(CaseActorRef, ActorRef) that don't exist in
com.netgrif.application.engine.importer.model in this branch; revert the
signature and any other changed method/type usages to the existing importer
model types (restore the original parameter/type declarations used before the
PR) or update imports to the regenerated importer model only if that regenerated
model is landed in this stack; specifically update resolveUserRef and any
methods referencing CaseActorRef/ActorRef to use the existing model classes
present in the branch (or postpone these signature changes until the new
importer model is merged).

In
`@src/test/groovy/com/netgrif/application/engine/filters/FilterImportExportTest.groovy`:
- Line 40: The test class FilterImportExportTest has been globally disabled with
`@Disabled` because it references removed DataField properties filterMetadata and
allowedNets; add a tracking reference so we don’t lose the TODO — insert a
concise TODO/JIRA comment next to the `@Disabled` annotation or at the top of the
class mentioning the ticket (e.g. TODO: RE-ENABLE after migrating to new filter
field architecture — JIRA-XXXX) and note which symbols need updating
(filterMetadata, allowedNets on DataField) so the future change and re-enabling
steps are clear.

In `@src/test/groovy/com/netgrif/application/engine/filters/FilterTest.groovy`:
- Line 61: The FileInputStream created for PROCESS_PATH when calling
petriNetService.importPetriNet(...) is never closed and may leak; wrap the
stream creation and the import call in a try-with-resources (or use Groovy's
withCloseable) so the FileInputStream is automatically closed after use.
Specifically, ensure the FileInputStream used to set PetriNet testProcess via
petriNetService.importPetriNet(new FileInputStream(PROCESS_PATH),
VersionType.MAJOR, superCreator.loggedSuper).getNet() is created inside a
try(resource) block (or passed through withCloseable) so the stream is closed
even on exceptions.

---

Outside diff comments:
In `@src/main/java/com/netgrif/application/engine/menu/domain/FilterBody.java`:
- Around line 18-23: The removal of fields from FilterBody removed
Lombok-generated setters (setAllowedNets, setIcon, setMetadata) that
ActionDelegate.groovy still invokes; restore binary compatibility by
reintroducing those setters on FilterBody (either add back the removed fields
with appropriate types or add explicit public setter methods named
setAllowedNets, setIcon, setMetadata that accept the same parameter types as
before) so ActionDelegate.groovy calls (around the spots that used those
setters) continue to work without runtime missing-method errors.
🪄 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: 9b66e756-f883-4739-bd3b-ff0706ec6d0e

📥 Commits

Reviewing files that changed from the base of the PR and between 7dabfe9 and 4fb5875.

📒 Files selected for processing (24)
  • src/main/groovy/com/netgrif/application/engine/petrinet/domain/dataset/CaseFilterField.groovy
  • src/main/groovy/com/netgrif/application/engine/petrinet/domain/dataset/FieldType.groovy
  • src/main/groovy/com/netgrif/application/engine/petrinet/domain/dataset/FilterField.groovy
  • src/main/groovy/com/netgrif/application/engine/petrinet/domain/dataset/ProcessFilterField.groovy
  • src/main/groovy/com/netgrif/application/engine/petrinet/domain/dataset/TaskFilterField.groovy
  • src/main/groovy/com/netgrif/application/engine/petrinet/domain/dataset/logic/action/ActionDelegate.groovy
  • src/main/java/com/netgrif/application/engine/importer/service/FieldFactory.java
  • src/main/java/com/netgrif/application/engine/importer/service/Importer.java
  • src/main/java/com/netgrif/application/engine/menu/domain/FilterBody.java
  • src/main/java/com/netgrif/application/engine/menu/services/MenuItemService.java
  • src/main/java/com/netgrif/application/engine/workflow/domain/Case.java
  • src/main/java/com/netgrif/application/engine/workflow/domain/DataField.java
  • src/main/java/com/netgrif/application/engine/workflow/service/DataService.java
  • src/main/java/com/netgrif/application/engine/workflow/service/FilterImportExportService.java
  • src/main/java/com/netgrif/application/engine/workflow/service/interfaces/IFilterImportExportService.java
  • src/main/java/com/netgrif/application/engine/workflow/web/responsebodies/LocalisedCaseFilterField.java
  • src/main/java/com/netgrif/application/engine/workflow/web/responsebodies/LocalisedFieldFactory.java
  • src/main/java/com/netgrif/application/engine/workflow/web/responsebodies/LocalisedFilterField.java
  • src/main/java/com/netgrif/application/engine/workflow/web/responsebodies/LocalisedProcessFilterField.java
  • src/main/java/com/netgrif/application/engine/workflow/web/responsebodies/LocalisedTaskFilterField.java
  • src/main/resources/petriNets/engine-processes/import_filters.xml
  • src/test/groovy/com/netgrif/application/engine/filters/FilterImportExportTest.groovy
  • src/test/groovy/com/netgrif/application/engine/filters/FilterTest.groovy
  • src/test/resources/petriNets/filter_test.xml
💤 Files with no reviewable changes (8)
  • src/main/groovy/com/netgrif/application/engine/petrinet/domain/dataset/FilterField.groovy
  • src/main/java/com/netgrif/application/engine/workflow/service/interfaces/IFilterImportExportService.java
  • src/main/java/com/netgrif/application/engine/workflow/web/responsebodies/LocalisedFilterField.java
  • src/main/resources/petriNets/engine-processes/import_filters.xml
  • src/main/java/com/netgrif/application/engine/menu/services/MenuItemService.java
  • src/main/java/com/netgrif/application/engine/workflow/service/FilterImportExportService.java
  • src/main/java/com/netgrif/application/engine/workflow/domain/DataField.java
  • src/main/java/com/netgrif/application/engine/workflow/domain/Case.java

Comment thread src/test/groovy/com/netgrif/application/engine/filters/FilterTest.groovy Outdated
- close input stream
- disable MenuItemApiTest.groovy
@coderabbitai coderabbitai Bot added the improvement A change that improves on an existing feature label Jun 1, 2026
@dpulls
Copy link
Copy Markdown

dpulls Bot commented Jun 1, 2026

⚠️ Dpulls not installed on repository petriflow/petriflow. Checkout our quickstart for how to install.

Copy link
Copy Markdown

@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: 1

♻️ Duplicate comments (1)
src/test/groovy/com/netgrif/application/engine/filters/FilterTest.groovy (1)

61-63: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Use exception-safe resource cleanup.

The explicit close() call on line 63 won't execute if line 62 throws an exception, leaving the FileInputStream open. Wrap the resource in Groovy's withCloseable to guarantee cleanup.

🔒 Proposed fix using withCloseable
-        InputStream inputStream = new FileInputStream(PROCESS_PATH)
-        PetriNet testProcess = petriNetService.importPetriNet(inputStream, VersionType.MAJOR, superCreator.loggedSuper).getNet()
-        inputStream.close()
+        PetriNet testProcess
+        new FileInputStream(PROCESS_PATH).withCloseable { inputStream ->
+            testProcess = petriNetService.importPetriNet(inputStream, VersionType.MAJOR, superCreator.loggedSuper).getNet()
+        }
🤖 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/test/groovy/com/netgrif/application/engine/filters/FilterTest.groovy`
around lines 61 - 63, The FileInputStream assigned to InputStream inputStream
(opened from PROCESS_PATH) is closed explicitly but will leak if
petriNetService.importPetriNet(...) throws; replace the manual open/close with
Groovy's resource-safe pattern: create the FileInputStream and call
withCloseable (or use try-with-resources) so the stream is passed into
petriNetService.importPetriNet(INPUT_STREAM, VersionType.MAJOR,
superCreator.loggedSuper).getNet() inside the withCloseable block, ensuring the
InputStream is always closed even on exception.
🤖 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/test/groovy/com/netgrif/application/engine/action/MenuItemApiTest.groovy`:
- Line 38: Add a descriptive reason to the `@Disabled` annotation on the
MenuItemApiTest class explaining why it is disabled and whether that state is
temporary or permanent (e.g., "`@Disabled`(\"temporarily disabled: failing due to
new filter field types - needs migration\")"); locate the class MenuItemApiTest
and update the annotation accordingly, and if the intent is to re-enable later,
add a TODO comment referencing the required work (migrate tests to new filter
field types or remove) so maintainers know the next action.

---

Duplicate comments:
In `@src/test/groovy/com/netgrif/application/engine/filters/FilterTest.groovy`:
- Around line 61-63: The FileInputStream assigned to InputStream inputStream
(opened from PROCESS_PATH) is closed explicitly but will leak if
petriNetService.importPetriNet(...) throws; replace the manual open/close with
Groovy's resource-safe pattern: create the FileInputStream and call
withCloseable (or use try-with-resources) so the stream is passed into
petriNetService.importPetriNet(INPUT_STREAM, VersionType.MAJOR,
superCreator.loggedSuper).getNet() inside the withCloseable block, ensuring the
InputStream is always closed even on exception.
🪄 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: c7867d2e-ac6b-429c-b4c1-e7c34d157d46

📥 Commits

Reviewing files that changed from the base of the PR and between 4fb5875 and cec67b5.

📒 Files selected for processing (2)
  • src/test/groovy/com/netgrif/application/engine/action/MenuItemApiTest.groovy
  • src/test/groovy/com/netgrif/application/engine/filters/FilterTest.groovy

@mazarijuraj mazarijuraj merged commit 5173bc1 into release/6.5.0 Jun 5, 2026
5 of 7 checks passed
@mazarijuraj mazarijuraj deleted the NAE-2439 branch June 5, 2026 08:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking change Fix or feature that would cause existing functionality doesn't work as expected improvement A change that improves on an existing feature Large Medium new feature A change that introduces new functionality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants