Skip to content

[NAE-2418] Verify @Transient handling across persistence layers in na…#436

Open
renczesstefan wants to merge 2 commits intorelease/7.0.0-rev10from
NAE-2418
Open

[NAE-2418] Verify @Transient handling across persistence layers in na…#436
renczesstefan wants to merge 2 commits intorelease/7.0.0-rev10from
NAE-2418

Conversation

@renczesstefan
Copy link
Copy Markdown
Member

@renczesstefan renczesstefan commented Apr 27, 2026

Description

Implements NAE-2418

Dependencies

No new dependencies were introduced.

Third party dependencies

There are no dependencies on other PR.

Blocking Pull requests

There are no dependencies on other PR.

How Has Been This Tested?

This was tested manually and with unit tests.

Test Configuration

Name Tested on
OS macOS Tahoe 26.3
Runtime Java 21
Dependency Manager Maven 3.9.9n
Framework version Spring Boot 3.4.4
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 @machacjozef
  • 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

  • Chores
    • Improved persistence compatibility by introducing Spring-data-aware adapter types and updating related implementations.
  • New Features
    • Registered a Petri net load event hook to the persistence layer (no behavioral changes yet).
  • Refactor
    • Core arc classes converted to abstract and replaced at runtime by adapter arc types for clearer separation between core models and persistence adapters.

…e-spring-core-adapter

Replaced the incorrect `java.beans.Transient` import with `org.springframework.data.annotation.Transient`. This ensures proper handling of transiency in the context of Spring Data.
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 27, 2026

Walkthrough

Core Petri net arc classes were made abstract; new Spring adapter arc subclasses (Arc, InhibitorArc, ReadArc, ResetArc) were added with Spring Data @Transient on getters; ArcFactory now instantiates adapter arc types for several arc kinds; DataGroup transient import switched; PetriNetEventHandler gains an empty onAfterLoad hook.

Changes

Cohort / File(s) Summary
Core arc abstractions
nae-object-library/src/main/java/com/netgrif/application/engine/objects/petrinet/domain/arcs/Arc.java, .../InhibitorArc.java, .../ReadArc.java, .../ResetArc.java
Changed concrete arc classes to abstract (Arc, InhibitorArc, ReadArc, ResetArc). No other logic changes.
Spring adapter arc implementations
nae-spring-core-adapter/src/main/java/com/netgrif/application/engine/adapter/spring/petrinet/domain/arcs/Arc.java, .../InhibitorArc.java, .../ReadArc.java, .../ResetArc.java
Added Spring adapter subclasses that extend core arc types, supply constructors, and override getSource()/getDestination() annotated with Spring Data @Transient.
ArcFactory update
application-engine/src/main/java/com/netgrif/application/engine/petrinet/service/ArcFactory.java
Switched instantiation to use Spring adapter arc classes for REGULAR/VARIABLE and for RESET/INHIBITOR/READ arc kinds; updated imports and removed an unused Type import.
Transient import change
nae-spring-core-adapter/src/main/java/com/netgrif/application/engine/adapter/spring/workflow/domain/DataGroup.java
Replaced java.beans.Transient import with org.springframework.data.annotation.Transient; annotations and logic unchanged.
MongoDB load hook
application-engine/src/main/java/com/netgrif/application/engine/petrinet/service/PetriNetEventHandler.java
Added an empty onAfterLoad(AfterLoadEvent<PetriNet>) method to register a MongoDB after-load event handler.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

🚥 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 clearly identifies the main change: verifying @Transient handling across persistence layers in the codebase, which is directly reflected in the changes to annotation imports and new Spring-specific arc adapter classes.
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.

coderabbitai[bot]
coderabbitai Bot previously approved these changes Apr 27, 2026
Retoocs
Retoocs previously approved these changes Apr 27, 2026
…e-spring-core-adapter

- created new arc classes in spring core adapter
- refactored existing arc class to be abstract
- added transient to arcs
@renczesstefan renczesstefan dismissed stale reviews from Retoocs and coderabbitai[bot] via 3f362f9 April 28, 2026 10:51
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: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In
`@application-engine/src/main/java/com/netgrif/application/engine/petrinet/service/PetriNetEventHandler.java`:
- Around line 21-24: Remove the no-op Spring Data lifecycle hook by deleting the
onAfterLoad(AfterLoadEvent<PetriNet> event) method from the PetriNetEventHandler
class and also remove the unused AfterLoadEvent import; ensure no other code
references onAfterLoad so compilation remains clean.

In
`@nae-spring-core-adapter/src/main/java/com/netgrif/application/engine/adapter/spring/petrinet/domain/arcs/Arc.java`:
- Around line 12-14: The copy constructor public Arc(Arc arc) is too narrowly
typed; change its parameter to the core/base arc type (the base Arc
interface/class used by the superclass) so it can accept core arcs, e.g. public
Arc(BaseArcType arc) { super(arc); }, and update the import for that core/base
Arc type; keep the body calling super(arc) unchanged to delegate copying to the
superclass.
🪄 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: d5fe2af9-b04f-42a0-b2dd-3da8dca5d1d3

📥 Commits

Reviewing files that changed from the base of the PR and between 17e7be8 and 3f362f9.

📒 Files selected for processing (10)
  • application-engine/src/main/java/com/netgrif/application/engine/petrinet/service/ArcFactory.java
  • application-engine/src/main/java/com/netgrif/application/engine/petrinet/service/PetriNetEventHandler.java
  • nae-object-library/src/main/java/com/netgrif/application/engine/objects/petrinet/domain/arcs/Arc.java
  • nae-object-library/src/main/java/com/netgrif/application/engine/objects/petrinet/domain/arcs/InhibitorArc.java
  • nae-object-library/src/main/java/com/netgrif/application/engine/objects/petrinet/domain/arcs/ReadArc.java
  • nae-object-library/src/main/java/com/netgrif/application/engine/objects/petrinet/domain/arcs/ResetArc.java
  • nae-spring-core-adapter/src/main/java/com/netgrif/application/engine/adapter/spring/petrinet/domain/arcs/Arc.java
  • nae-spring-core-adapter/src/main/java/com/netgrif/application/engine/adapter/spring/petrinet/domain/arcs/InhibitorArc.java
  • nae-spring-core-adapter/src/main/java/com/netgrif/application/engine/adapter/spring/petrinet/domain/arcs/ReadArc.java
  • nae-spring-core-adapter/src/main/java/com/netgrif/application/engine/adapter/spring/petrinet/domain/arcs/ResetArc.java

Comment on lines +21 to +24
@Override
public void onAfterLoad(AfterLoadEvent<PetriNet> event) {

}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧹 Nitpick | 🔵 Trivial

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Verify whether this callback is intentionally used/covered elsewhere.
rg -n -C3 --type=java '\bonAfterLoad\s*\(\s*AfterLoadEvent<PetriNet>\s+event\s*\)'
rg -n -C3 --type=java '\bPetriNetEventHandler\b'
rg -n -C3 --type=java --iglob '*test*' 'AfterLoadEvent|PetriNetEventHandler|onAfterLoad\s*\('

Repository: netgrif/application-engine

Length of output: 1901


Remove the empty onAfterLoad callback.

The onAfterLoad method at lines 21–24 is a no-op Spring Data lifecycle hook that is never invoked or tested. Remove the method and its unused AfterLoadEvent import (line 11).

Cleanup diff
-import org.springframework.data.mongodb.core.mapping.event.AfterLoadEvent;
@@
-    `@Override`
-    public void onAfterLoad(AfterLoadEvent<PetriNet> event) {
-
-    }
-
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@application-engine/src/main/java/com/netgrif/application/engine/petrinet/service/PetriNetEventHandler.java`
around lines 21 - 24, Remove the no-op Spring Data lifecycle hook by deleting
the onAfterLoad(AfterLoadEvent<PetriNet> event) method from the
PetriNetEventHandler class and also remove the unused AfterLoadEvent import;
ensure no other code references onAfterLoad so compilation remains clean.

Comment on lines +12 to +14
public Arc(Arc arc) {
super(arc);
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Copy constructor is too narrowly typed.

At Line 12, Arc(Arc arc) only accepts the adapter type, which prevents copying when the source is referenced as the core/base arc type. Use the core arc type in the constructor signature.

Proposed fix
-    public Arc(Arc arc) {
+    public Arc(com.netgrif.application.engine.objects.petrinet.domain.arcs.Arc arc) {
         super(arc);
     }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@nae-spring-core-adapter/src/main/java/com/netgrif/application/engine/adapter/spring/petrinet/domain/arcs/Arc.java`
around lines 12 - 14, The copy constructor public Arc(Arc arc) is too narrowly
typed; change its parameter to the core/base arc type (the base Arc
interface/class used by the superclass) so it can accept core arcs, e.g. public
Arc(BaseArcType arc) { super(arc); }, and update the import for that core/base
Arc type; keep the body calling super(arc) unchanged to delegate copying to the
superclass.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants