[NAE-2418] Verify @Transient handling across persistence layers in na…#436
[NAE-2418] Verify @Transient handling across persistence layers in na…#436renczesstefan wants to merge 2 commits intorelease/7.0.0-rev10from
Conversation
…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.
WalkthroughCore Petri net arc classes were made abstract; new Spring adapter arc subclasses (Arc, InhibitorArc, ReadArc, ResetArc) were added with Spring Data Changes
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ 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. Comment |
…e-spring-core-adapter - created new arc classes in spring core adapter - refactored existing arc class to be abstract - added transient to arcs
3f362f9
There was a problem hiding this comment.
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
📒 Files selected for processing (10)
application-engine/src/main/java/com/netgrif/application/engine/petrinet/service/ArcFactory.javaapplication-engine/src/main/java/com/netgrif/application/engine/petrinet/service/PetriNetEventHandler.javanae-object-library/src/main/java/com/netgrif/application/engine/objects/petrinet/domain/arcs/Arc.javanae-object-library/src/main/java/com/netgrif/application/engine/objects/petrinet/domain/arcs/InhibitorArc.javanae-object-library/src/main/java/com/netgrif/application/engine/objects/petrinet/domain/arcs/ReadArc.javanae-object-library/src/main/java/com/netgrif/application/engine/objects/petrinet/domain/arcs/ResetArc.javanae-spring-core-adapter/src/main/java/com/netgrif/application/engine/adapter/spring/petrinet/domain/arcs/Arc.javanae-spring-core-adapter/src/main/java/com/netgrif/application/engine/adapter/spring/petrinet/domain/arcs/InhibitorArc.javanae-spring-core-adapter/src/main/java/com/netgrif/application/engine/adapter/spring/petrinet/domain/arcs/ReadArc.javanae-spring-core-adapter/src/main/java/com/netgrif/application/engine/adapter/spring/petrinet/domain/arcs/ResetArc.java
| @Override | ||
| public void onAfterLoad(AfterLoadEvent<PetriNet> event) { | ||
|
|
||
| } |
There was a problem hiding this comment.
🧹 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.
| public Arc(Arc arc) { | ||
| super(arc); | ||
| } |
There was a problem hiding this comment.
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.
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
Checklist:
Summary by CodeRabbit