From 746d40f8bb01b0e95b8c53cecec33efcd47721e7 Mon Sep 17 00:00:00 2001 From: Machac Date: Wed, 1 Apr 2026 15:49:24 +0200 Subject: [PATCH 1/5] [NAE-2400] Prevent Caching of Null Results in Process Cache - Updated `@Cacheable` annotations in `PetriNetService` to avoid caching null results. --- .../application/engine/petrinet/service/PetriNetService.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/application-engine/src/main/java/com/netgrif/application/engine/petrinet/service/PetriNetService.java b/application-engine/src/main/java/com/netgrif/application/engine/petrinet/service/PetriNetService.java index 759527b8bb..6f0276b092 100644 --- a/application-engine/src/main/java/com/netgrif/application/engine/petrinet/service/PetriNetService.java +++ b/application-engine/src/main/java/com/netgrif/application/engine/petrinet/service/PetriNetService.java @@ -150,7 +150,7 @@ public void evictCache(PetriNet net) { * Get read only Petri net. */ @Override - @Cacheable(value = "petriNetCache") + @Cacheable(value = "petriNetCache", unless = "#result == null") public PetriNet get(ObjectId petriNetId) { Optional optional = repository.findById(petriNetId.toString()); if (optional.isEmpty()) { @@ -301,7 +301,7 @@ protected final Optional doSaveInternal(PetriNet petriNet) { } @Override - @Cacheable(value = "petriNetById") + @Cacheable(value = "petriNetById", unless = "#result == null") public PetriNet getPetriNet(String id) { Optional net = repository.findById(id); if (net.isEmpty()) { From 3653f03761565e28424e0b8fadca64381dd57676 Mon Sep 17 00:00:00 2001 From: renczesstefan Date: Thu, 9 Apr 2026 12:59:31 +0200 Subject: [PATCH 2/5] [NAE-2400] Prevent Caching of Null Results in Petrinet Cache - added new function for evicting petriNet cache by several string properties --- .../engine/petrinet/service/PetriNetService.java | 9 +++++++++ .../petrinet/service/interfaces/IPetriNetService.java | 2 ++ 2 files changed, 11 insertions(+) diff --git a/application-engine/src/main/java/com/netgrif/application/engine/petrinet/service/PetriNetService.java b/application-engine/src/main/java/com/netgrif/application/engine/petrinet/service/PetriNetService.java index 6f0276b092..31e5e65902 100644 --- a/application-engine/src/main/java/com/netgrif/application/engine/petrinet/service/PetriNetService.java +++ b/application-engine/src/main/java/com/netgrif/application/engine/petrinet/service/PetriNetService.java @@ -138,6 +138,15 @@ public void evictAllCaches() { requireNonNull(cacheManager.getCache(cacheProperties.getPetriNetByIdentifier()), cacheProperties.getPetriNetByIdentifier()).clear(); } + @Override + public void evictCache(String id, String identifier, String version) { + requireNonNull(cacheManager.getCache(cacheProperties.getPetriNetById()), cacheProperties.getPetriNetById()).evict(id); + requireNonNull(cacheManager.getCache(cacheProperties.getPetriNetDefault()), cacheProperties.getPetriNetDefault()).evict(identifier); + requireNonNull(cacheManager.getCache(cacheProperties.getPetriNetLatest()), cacheProperties.getPetriNetLatest()).evict(identifier); + requireNonNull(cacheManager.getCache(cacheProperties.getPetriNetCache()), cacheProperties.getPetriNetCache()).evict(new ObjectId(id)); + requireNonNull(cacheManager.getCache(cacheProperties.getPetriNetByIdentifier()), cacheProperties.getPetriNetByIdentifier()).evict(id + version); + } + public void evictCache(PetriNet net) { requireNonNull(cacheManager.getCache(cacheProperties.getPetriNetById()), cacheProperties.getPetriNetById()).evict(net.getStringId()); requireNonNull(cacheManager.getCache(cacheProperties.getPetriNetDefault()), cacheProperties.getPetriNetDefault()).evict(net.getIdentifier()); diff --git a/application-engine/src/main/java/com/netgrif/application/engine/petrinet/service/interfaces/IPetriNetService.java b/application-engine/src/main/java/com/netgrif/application/engine/petrinet/service/interfaces/IPetriNetService.java index 234fedf217..e477c16658 100644 --- a/application-engine/src/main/java/com/netgrif/application/engine/petrinet/service/interfaces/IPetriNetService.java +++ b/application-engine/src/main/java/com/netgrif/application/engine/petrinet/service/interfaces/IPetriNetService.java @@ -257,6 +257,8 @@ ImportPetriNetEventOutcome importPetriNet(ImportPetriNetParams importPetriNetPar */ void evictAllCaches(); + void evictCache(String id, String identifier, String version); + /** * Evicts the cache for the given {@link PetriNet}. * From c3b91daf9f27067d23debbea4be0ddc781f8dd82 Mon Sep 17 00:00:00 2001 From: renczesstefan Date: Thu, 9 Apr 2026 13:11:15 +0200 Subject: [PATCH 3/5] [NAE-2400] Prevent Caching of Null Results in Petrinet Cache Replaced the incorrect use of 'id' with 'identifier' when evicting caches associated with PetriNet objects. This ensures consistency and proper functioning of the cache eviction process. --- .../application/engine/petrinet/service/PetriNetService.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/application-engine/src/main/java/com/netgrif/application/engine/petrinet/service/PetriNetService.java b/application-engine/src/main/java/com/netgrif/application/engine/petrinet/service/PetriNetService.java index 31e5e65902..2781235bb5 100644 --- a/application-engine/src/main/java/com/netgrif/application/engine/petrinet/service/PetriNetService.java +++ b/application-engine/src/main/java/com/netgrif/application/engine/petrinet/service/PetriNetService.java @@ -144,7 +144,7 @@ public void evictCache(String id, String identifier, String version) { requireNonNull(cacheManager.getCache(cacheProperties.getPetriNetDefault()), cacheProperties.getPetriNetDefault()).evict(identifier); requireNonNull(cacheManager.getCache(cacheProperties.getPetriNetLatest()), cacheProperties.getPetriNetLatest()).evict(identifier); requireNonNull(cacheManager.getCache(cacheProperties.getPetriNetCache()), cacheProperties.getPetriNetCache()).evict(new ObjectId(id)); - requireNonNull(cacheManager.getCache(cacheProperties.getPetriNetByIdentifier()), cacheProperties.getPetriNetByIdentifier()).evict(id + version); + requireNonNull(cacheManager.getCache(cacheProperties.getPetriNetByIdentifier()), cacheProperties.getPetriNetByIdentifier()).evict(identifier + version); } public void evictCache(PetriNet net) { From 2843d3d6509ef3b6cfe98a2e359c786b31fac99a Mon Sep 17 00:00:00 2001 From: Machac Date: Thu, 9 Apr 2026 14:27:28 +0200 Subject: [PATCH 4/5] Release 7.0.0-RC10.2 - Update version to 7.0.0-RC10.2 in all POM files --- application-engine/pom.xml | 2 +- nae-object-library/pom.xml | 2 +- nae-spring-core-adapter/pom.xml | 2 +- nae-user-ce/pom.xml | 2 +- nae-user-common/pom.xml | 2 +- pom.xml | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/application-engine/pom.xml b/application-engine/pom.xml index b22f9aaec1..2427ef6ed6 100644 --- a/application-engine/pom.xml +++ b/application-engine/pom.xml @@ -6,7 +6,7 @@ com.netgrif application-engine-parent - 7.0.0-RC10.1 + 7.0.0-RC10.2 application-engine diff --git a/nae-object-library/pom.xml b/nae-object-library/pom.xml index aea8bb7345..cd4763f83f 100644 --- a/nae-object-library/pom.xml +++ b/nae-object-library/pom.xml @@ -7,7 +7,7 @@ com.netgrif application-engine-parent - 7.0.0-RC10.1 + 7.0.0-RC10.2 nae-object-library diff --git a/nae-spring-core-adapter/pom.xml b/nae-spring-core-adapter/pom.xml index a4938f3527..d6b882dd6f 100644 --- a/nae-spring-core-adapter/pom.xml +++ b/nae-spring-core-adapter/pom.xml @@ -7,7 +7,7 @@ com.netgrif application-engine-parent - 7.0.0-RC10.1 + 7.0.0-RC10.2 nae-spring-core-adapter diff --git a/nae-user-ce/pom.xml b/nae-user-ce/pom.xml index 53754d34ca..91fc102afa 100644 --- a/nae-user-ce/pom.xml +++ b/nae-user-ce/pom.xml @@ -6,7 +6,7 @@ com.netgrif application-engine-parent - 7.0.0-RC10.1 + 7.0.0-RC10.2 nae-user-ce diff --git a/nae-user-common/pom.xml b/nae-user-common/pom.xml index 82986242a2..9960e3cc9e 100644 --- a/nae-user-common/pom.xml +++ b/nae-user-common/pom.xml @@ -6,7 +6,7 @@ com.netgrif application-engine-parent - 7.0.0-RC10.1 + 7.0.0-RC10.2 nae-user-common diff --git a/pom.xml b/pom.xml index 5031750cf0..b610c584da 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.netgrif application-engine-parent - 7.0.0-RC10.1 + 7.0.0-RC10.2 pom NETGRIF Application Engine parent From dfc012fc9a24e669ff78049561822cc8692f3fbf Mon Sep 17 00:00:00 2001 From: renczesstefan Date: Thu, 9 Apr 2026 18:01:00 +0200 Subject: [PATCH 5/5] [NAE-2400] Prevent Caching of Null Results in Petrinet Cache Included log statements to indicate the start and completion of caching functions for a given PetriNet. This improves traceability and aids in debugging by providing clear insights into the caching process. --- .../engine/workflow/service/FieldActionsCacheService.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/application-engine/src/main/java/com/netgrif/application/engine/workflow/service/FieldActionsCacheService.java b/application-engine/src/main/java/com/netgrif/application/engine/workflow/service/FieldActionsCacheService.java index 0f6818ded2..4c9da89eac 100644 --- a/application-engine/src/main/java/com/netgrif/application/engine/workflow/service/FieldActionsCacheService.java +++ b/application-engine/src/main/java/com/netgrif/application/engine/workflow/service/FieldActionsCacheService.java @@ -54,6 +54,8 @@ public void cachePetriNetFunctions(PetriNet petriNet) { return; } + log.info("Caching functions for PetriNet id={}", petriNet.getIdentifier()); + List functions = petriNet.getFunctions(FunctionScope.GLOBAL).stream() .map(function -> CachedFunction.build(shell, function)) .collect(Collectors.toList()); @@ -66,6 +68,7 @@ public void cachePetriNetFunctions(PetriNet petriNet) { } else { globalFunctionsCache.evictIfPresent(petriNet.getIdentifier()); } + log.info("Finished caching functions for PetriNet id={}", petriNet.getIdentifier()); } @Override