Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
dd58002
NAE-2182 - Implementation of an endpoint for clearing the action cache
dominikvozr Sep 1, 2025
5b98ca4
NAE-2182 - Implementation of custom cache wrapper to use in cacheManager
dominikvozr Sep 1, 2025
e917f76
NAE-2182 - Implementation of generic map cache and created actuator c…
dominikvozr Sep 2, 2025
bd719b5
NAE-2182 - cache FunctionsNamespace and functions if not found
dominikvozr Sep 3, 2025
e976081
NAE-2182 - prevent multi thread unexpected behaviour and prevent cach…
dominikvozr Sep 4, 2025
8323adb
NAE-2182 - Implementation of generic map cache and changed store for …
dominikvozr Sep 16, 2025
f9796d6
NAE-2182 - removal of unused methods, correction of several issues du…
dominikvozr Sep 16, 2025
a002636
NAE-2212 - added method that will cache all petriNets functions
dominikvozr Sep 24, 2025
e6e8dac
NAE-2212 - added prevention of cache namespaceFunctions deletion from…
dominikvozr Sep 25, 2025
d2227d0
NAE-2182 - optimized imports, added helper and refactor code
dominikvozr Sep 25, 2025
6e09ba1
NAE-2212 - repair of PR, rework to use petriNetService and other
dominikvozr Sep 25, 2025
790659b
- test fix
renczesstefan Sep 29, 2025
dd80913
- test fix
renczesstefan Sep 30, 2025
7dc7947
[NAE-2212] Change list to set, remove CacheMapKeys, use copyOf for sa…
dominikvozr Sep 30, 2025
eb56f99
Merge remote-tracking branch 'origin/release/7.0.0-rev8' into NAE-2212
machacjozef Sep 30, 2025
93921f9
fix
machacjozef Sep 30, 2025
cf3dc8c
Merge remote-tracking branch 'origin/release/7.0.0-rev8' into NAE-2212
machacjozef Sep 30, 2025
cb1505f
Merge remote-tracking branch 'origin/release/7.0.0-rev8' into NAE-2182
machacjozef Sep 30, 2025
fc76808
[NAE-2266] Introduce active version of process
Retoocs Nov 19, 2025
b5bd5b5
[NAE-2266] Introduce active version of process
Retoocs Nov 19, 2025
9059bec
[NAE-2266] Introduce active version of process
Retoocs Nov 19, 2025
dfd7afd
[NAE-2266] Introduce active version of process
Retoocs Nov 20, 2025
e8441cb
[NAE-2266] Introduce active version of process
Retoocs Nov 20, 2025
0c1c914
[NAE-2266] Introduce active version of process
Retoocs Nov 20, 2025
53fb4e6
[NAE-2266] Introduce active version of process
Retoocs Nov 21, 2025
1cdfbc4
[NAE-2266] Introduce active version of process
Retoocs Nov 21, 2025
47ba662
[NAE-2266] Introduce active version of process
Retoocs Nov 21, 2025
7e0c9b8
[NAE-2266] Introduce active version of process
Retoocs Nov 21, 2025
4670f33
[NAE-2266] Introduce active version of process
Retoocs Nov 21, 2025
cf0651a
[NAE-2266] Introduce active version of process
Retoocs Nov 24, 2025
48e1411
[NAE-2266] Introduce active version of process
Retoocs Nov 25, 2025
b30c884
[NAE-2266] Introduce active version of process
Retoocs Nov 25, 2025
d7705b2
[NAE-2266] Introduce active version of process
Retoocs Nov 27, 2025
2654b7d
[NAE-2266] Introduce active version of process
Retoocs Nov 27, 2025
d457145
Merge remote-tracking branch 'origin/release/7.0.0-rev9' into NAE-2266
Retoocs Nov 27, 2025
61f9b2e
[NAE-2266] Introduce active version of process
Retoocs Nov 28, 2025
289de0f
[NAE-2266] Introduce active version of process
Retoocs Nov 28, 2025
e9ef494
[NAE-2266] Introduce active version of process
Retoocs Nov 28, 2025
2274d62
[NAE-2266] Introduce active version of process
Retoocs Nov 28, 2025
39da22c
Merge remote-tracking branch 'origin/release/7.0.0-rev9' into NAE-2266
Retoocs Dec 8, 2025
d82fc67
Merge branch 'release/7.0.0-rev9' into NAE-2212
renczesstefan Dec 12, 2025
174c7ee
[NAE-2212] Global scope process function caches
renczesstefan Dec 16, 2025
faa99d7
Merge remote-tracking branch 'refs/remotes/origin/NAE-2266' into NAE-…
renczesstefan Dec 18, 2025
44c6ed7
[NAE-2212] Global scope process function caches
renczesstefan Dec 18, 2025
fc637ee
[NAE-2212] Global scope process function caches
renczesstefan Dec 18, 2025
6d84f5b
Remove redundant dependencies and fix scope comparison logic.
renczesstefan Dec 18, 2025
c18561f
Merge branch 'NAE-2212' into NAE-2182
renczesstefan Dec 18, 2025
f7b61be
Refactor caching logic in FieldActionsCacheService and improve annota…
renczesstefan Dec 18, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 0 additions & 12 deletions application-engine/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -270,18 +270,6 @@
<version>${junit-jupiter.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>${junit-jupiter.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>${junit-jupiter.version}</version>
<scope>test</scope>
</dependency>
<!-- Groovy -->
<!-- https://mvnrepository.com/artifact/org.codehaus.groovy/groovy-all -->
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2444,9 +2444,13 @@ class ActionDelegate {
return [(role.importId + ":" + GLOBAL_ROLE), ("$role.name (🌍 Global role)" as String)]
} else {
if (!temp.containsKey(entry.value)) {
temp.put(entry.value, petriNetService.getNewestVersionByIdentifier(entry.value))
temp.put(entry.value, petriNetService.getActiveVersionByIdentifier(entry.value))
}
PetriNet net = temp[entry.value]
if (net == null) {
throw new IllegalArgumentException("The process with identifier [%s] could not be found when collecting roles."
.formatted(entry.value))
}
ProcessRole role = net.roles.find { it.value.importId == entry.key }.value
return [(role.importId + ":" + net.identifier), ("$role.name ($net.title)" as String)]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ abstract class FieldActionsRunner {
actionsCacheService.getCachedFunctions(functions).each {
actionDelegate.metaClass."${it.function.name}" << it.code
}
actionsCacheService.getNamespaceFunctionCache().each { entry ->
actionsCacheService.getGlobalFunctionsCache().each { entry ->
def namespace = [:]
entry.getValue().each {
namespace["${it.function.name}"] = it.code.rehydrate(actionDelegate, it.code.owner, it.code.thisObject)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,10 @@ class RoleActionDelegate extends AbstractActionDelegate<RoleContext> {
}

AbstractUser assignRole(String roleImportId, String petriNetIdentifier, AbstractUser user = affectedUser) {
PetriNet petriNet = petriNetService.getNewestVersionByIdentifier(petriNetIdentifier)
PetriNet petriNet = petriNetService.getActiveVersionByIdentifier(petriNetIdentifier)
if (petriNet == null) {
throw new IllegalArgumentException("The process with identifier [%s] could not be found".formatted(petriNetIdentifier))
}
assignRole(roleImportId, user, petriNet)
}

Expand All @@ -75,7 +78,10 @@ class RoleActionDelegate extends AbstractActionDelegate<RoleContext> {
}

AbstractUser removeRole(String roleImportId, String petriNetIdentifier, AbstractUser user = affectedUser) {
PetriNet petriNet = petriNetService.getNewestVersionByIdentifier(petriNetIdentifier)
PetriNet petriNet = petriNetService.getActiveVersionByIdentifier(petriNetIdentifier)
if (petriNet == null) {
throw new IllegalArgumentException("The process with identifier [%s] could not be found".formatted(petriNetIdentifier))
}
removeRole(roleImportId, user, petriNet)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ class ImportHelper {
}

Optional<PetriNet> upsertNet(String filename, String identifier, VersionType release = VersionType.MAJOR, LoggedUser author = ActorTransformer.toLoggedUser(userService.getSystem())) {
PetriNet petriNet = petriNetService.getNewestVersionByIdentifier(identifier)
PetriNet petriNet = petriNetService.getActiveVersionByIdentifier(identifier)
if (!petriNet) {
return createNet(filename, release, author)
}
Expand Down Expand Up @@ -249,7 +249,7 @@ class ImportHelper {
}

Optional<PetriNet> importProcessOnce(String message, String netIdentifier, String netFileName) {
PetriNet filter = petriNetService.getNewestVersionByIdentifier(netIdentifier)
PetriNet filter = petriNetService.getActiveVersionByIdentifier(netIdentifier)
if (filter != null) {
log.info("${message} has already been imported.")
return Optional.of(filter)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,30 +1,65 @@
package com.netgrif.application.engine.configuration;

import com.netgrif.application.engine.configuration.properties.CacheConfigurationProperties;
import com.netgrif.application.engine.configuration.properties.RunnerConfigurationProperties;
import com.netgrif.application.engine.elastic.service.executors.MaxSizeHashMap;
import com.netgrif.application.engine.workflow.domain.CachedFunction;
import groovy.lang.Closure;
import lombok.RequiredArgsConstructor;
import org.springframework.cache.Cache;
import org.springframework.cache.CacheManager;
import org.springframework.cache.annotation.CachingConfigurerSupport;
import org.springframework.cache.annotation.CachingConfigurer;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.cache.concurrent.ConcurrentMapCacheManager;
import org.springframework.cache.concurrent.ConcurrentMapCache;
import org.springframework.cache.interceptor.CacheResolver;
import org.springframework.cache.support.SimpleCacheManager;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;


import java.util.*;
import java.util.function.Supplier;
import java.util.stream.Collectors;

@Configuration
@EnableCaching
public class CacheConfiguration extends CachingConfigurerSupport {

@RequiredArgsConstructor
public class CacheConfiguration implements CachingConfigurer {
private final RunnerConfigurationProperties.FieldRunnerProperties fieldRunnerProperties;
private final CacheConfigurationProperties properties;

public CacheConfiguration(CacheConfigurationProperties properties) {
this.properties = properties;
}

@Bean
@Primary
@Override
public CacheManager cacheManager() {
return new ConcurrentMapCacheManager(properties.getAllCaches().toArray(String[]::new));
Set<String> cacheNames = properties.getAllCaches();
List<Cache> caches = cacheNames.stream()
.map(ConcurrentMapCache::new)
.collect(Collectors.toCollection(ArrayList::new));


Supplier<Map<String, Closure>> actionsFactory =
() -> Collections.synchronizedMap(new MaxSizeHashMap<>(fieldRunnerProperties.getActionCacheSize()));

caches.add(new GenericMapCache<>(
CacheMapKeys.ACTIONS,
Closure.class,
actionsFactory
));

Supplier<Map<String, CachedFunction>> functionsFactory =
() -> Collections.synchronizedMap(new MaxSizeHashMap<>(fieldRunnerProperties.getFunctionsCacheSize()));

caches.add(new GenericMapCache<>(
CacheMapKeys.FUNCTIONS,
CachedFunction.class,
functionsFactory
));

SimpleCacheManager cacheManager = new SimpleCacheManager();
cacheManager.setCaches(caches);
return cacheManager;
}

@Bean
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package com.netgrif.application.engine.configuration;

public final class CacheMapKeys {
private CacheMapKeys() {}
public static final String ACTIONS = "actions";
public static final String FUNCTIONS = "functions";
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
package com.netgrif.application.engine.configuration;

import lombok.extern.slf4j.Slf4j;
import org.jetbrains.annotations.NotNull;
import org.springframework.cache.Cache;
import org.springframework.cache.support.SimpleValueWrapper;

import java.util.Map;
import java.util.concurrent.Callable;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.atomic.AtomicReference;

@Slf4j
public class GenericMapCache<V> implements Cache {
private final String name;
private final Class<V> valueType;
private final java.util.function.Supplier<Map<String, V>> mapFactory;
private final AtomicReference<Map<String, V>> atomicMapRef;

private final ConcurrentHashMap<String, Object> locks = new ConcurrentHashMap<>();

public GenericMapCache(String name, Class<V> valueType, java.util.function.Supplier<Map<String, V>> mapFactory) {
this.name = name;
this.valueType = valueType;
this.mapFactory = mapFactory;
this.atomicMapRef = new AtomicReference<>(mapFactory.get());
}

@Override public @NotNull String getName() { return name; }

@Override public @NotNull Object getNativeCache() { return Map.copyOf(map()); }

@Override
public <T> T get(Object key, Callable<T> loader) {
final String stringKey = String.valueOf(key);

Object mapValue = map().get(stringKey);
if (mapValue != null) {
return (T) mapValue;
}

Object lock = locks.computeIfAbsent(stringKey, lockKey -> new Object());
try {
synchronized (lock) {
Object mapLockValue = map().get(stringKey);
if (mapLockValue != null) {
return (T) mapLockValue;
}

T computed = loader.call();
if (computed == null) {
return null;
}

V value = safeCast(computed);
map().put(stringKey, value);
return (T) value;
}
} catch (Exception ex) {
throw new Cache.ValueRetrievalException(stringKey, loader, ex);
} finally {
locks.remove(stringKey, lock);
}
}

@Override
public ValueWrapper get(Object key) {
String stringKey = String.valueOf(key);
Object valueObject = map().get(stringKey);
return valueObject != null ? new SimpleValueWrapper(valueObject) : null;
}

@Override
public synchronized <T> T get(Object key, Class<T> type) {
String stringKey = String.valueOf(key);
Object valueObject = map().get(stringKey);
return valueObject != null ? type.cast(valueObject) : null;
}

@Override
public synchronized void put(Object key, Object value) {
map().put(String.valueOf(key), safeCast(value));
}

@Override
public synchronized void evict(Object key) {
map().remove(String.valueOf(key));
}

@Override
public synchronized void clear() {
this.atomicMapRef.set(mapFactory.get());
}
Comment on lines +73 to +93
Copy link

Choose a reason for hiding this comment

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

🧹 Nitpick | 🔵 Trivial

Mixed synchronization strategy creates potential inconsistencies.

The class uses three different synchronization mechanisms:

  1. Per-key locks in get(key, loader) (lines 42-63)
  2. Method-level synchronized on get(key, type), put, evict, clear (lines 74, 81, 86, 91)
  3. AtomicReference for map swapping in clear()

This mix can lead to visibility issues. For example, a thread calling put() acquires the instance monitor, while another thread in get(key, loader) only holds a per-key lock—they don't synchronize with each other.

Consider using a consistent approach: either use ConcurrentHashMap operations throughout (removing synchronized), or use the instance monitor for all mutations.


private Map<String, V> map() {
return atomicMapRef.get();
}

@SuppressWarnings("unchecked")
private V safeCast(Object object) {
if (object == null) {
return null;
}

if (!valueType.isInstance(object)) {
throw new ClassCastException("Expected " + valueType.getName() + " but was " + object.getClass().getName());
}

return (V) object;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,14 @@ public class CacheConfigurationProperties {
private String petriNetByIdentifier = "petriNetByIdentifier";

/**
* Default cache name for caching the newest versions of Petri nets.
* Default cache name for caching the active versions of Petri nets.
*/
private String petriNetNewest = "petriNetNewest";
private String petriNetActive = "petriNetActive";

/**
* Default cache name for caching the latest versions of Petri nets.
*/
private String petriNetLatest = "petriNetLatest";

/**
* Default cache name for general Petri net caching.
Expand All @@ -41,6 +46,11 @@ public class CacheConfigurationProperties {
*/
private String loadedModules = "loadedModules";

/**
* Default cache name for caching namespace functions.
*/
private String globalFunctions = "globalFunctions";

/**
* A list of additional custom cache names.
* Allows users to define their own cache names for specific use cases.
Expand All @@ -54,7 +64,8 @@ public class CacheConfigurationProperties {
* @return a {@link Set} of all cache names.
*/
public Set<String> getAllCaches() {
Set<String> caches = new LinkedHashSet<>(Arrays.asList(petriNetById, petriNetByIdentifier, petriNetNewest, petriNetCache, loadedModules));
Set<String> caches = new LinkedHashSet<>(Arrays.asList(petriNetById, petriNetByIdentifier, petriNetActive,
petriNetLatest, petriNetCache, loadedModules, globalFunctions));
caches.addAll(additional);
return caches;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public static class FieldRunnerProperties {
/**
* The size of the cache used for maintaining field runner namespaces.
*/
private int namespaceCacheSize = 500;
private int globalFunctionsCacheSize = 500;
Comment on lines 56 to +59
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Update Javadoc to match the renamed field.

The Javadoc on line 57 still references "maintaining field runner namespaces," but the field has been renamed to globalFunctionsCacheSize. Update the documentation to accurately describe the cache's purpose.

🔎 Apply this diff to fix the Javadoc:
     /**
-     * The size of the cache used for maintaining field runner namespaces.
+     * The size of the cache used for managing global field runner functions.
      */
     private int globalFunctionsCacheSize = 500;
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
/**
* The size of the cache used for maintaining field runner namespaces.
*/
private int namespaceCacheSize = 500;
private int globalFunctionsCacheSize = 500;
/**
* The size of the cache used for managing global field runner functions.
*/
private int globalFunctionsCacheSize = 500;
🤖 Prompt for AI Agents
In
application-engine/src/main/java/com/netgrif/application/engine/configuration/properties/RunnerConfigurationProperties.java
around lines 56 to 59, the Javadoc still describes "maintaining field runner
namespaces" but the field was renamed to globalFunctionsCacheSize; update the
Javadoc to describe that this integer controls the size of the cache used for
global function definitions (or global functions lookup) so the comment
accurately reflects the field's purpose and name.

}

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.netgrif.application.engine.importer.service;

import com.netgrif.application.engine.objects.importer.model.Scope;
import com.netgrif.application.engine.objects.petrinet.domain.Function;
import com.netgrif.application.engine.objects.petrinet.domain.FunctionScope;
import lombok.extern.slf4j.Slf4j;
Expand All @@ -9,7 +10,10 @@
@Slf4j
public final class FunctionFactory {

private static final String NAMESPACE = "namespace";

public Function getFunction(com.netgrif.application.engine.objects.importer.model.Function function) {
checkDeprecatedAttributes(function);
Function function1 = new Function();

function1.setDefinition(function.getValue());
Expand All @@ -18,4 +22,11 @@ public Function getFunction(com.netgrif.application.engine.objects.importer.mode

return function1;
}

private void checkDeprecatedAttributes(com.netgrif.application.engine.objects.importer.model.Function function) {
if (function.getScope() != null && function.getScope().value().equals(NAMESPACE)) {
log.warn("Function scope [NAMESPACE] is deprecated. Replacing with [GLOBAL].]");
function.setScope(Scope.GLOBAL);
}
}
Comment on lines +26 to +31
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🏁 Script executed:

find . -type f -name "Scope.java" | head -20

Repository: netgrif/application-engine

Length of output: 52


🏁 Script executed:

#!/bin/bash
# Search for enum Scope definition
rg "enum\s+Scope" -A 10 --type java

Repository: netgrif/application-engine

Length of output: 52


🏁 Script executed:

#!/bin/bash
# Search for Scope class/interface definition
rg "^(class|interface|enum)\s+Scope\b" --type java -A 15

Repository: netgrif/application-engine

Length of output: 52


🏁 Script executed:

#!/bin/bash
# Read the FunctionFactory.java file to see imports and the actual method
cat application-engine/src/main/java/com/netgrif/application/engine/importer/service/FunctionFactory.java | head -50

Repository: netgrif/application-engine

Length of output: 1320


🏁 Script executed:

#!/bin/bash
# Search for Scope enum in the objects.importer.model package
find . -type f -path "*/objects/importer/model/*" -name "*.java" | xargs ls -la

Repository: netgrif/application-engine

Length of output: 1212


🏁 Script executed:

#!/bin/bash
# Find all Java files in objects/importer/model path
find . -path "*/objects/importer/model/*.java" -type f

Repository: netgrif/application-engine

Length of output: 52


🏁 Script executed:

#!/bin/bash
# Search for Scope.java file anywhere in the objects directory
find . -path "*/objects/*" -name "Scope.java" -type f

Repository: netgrif/application-engine

Length of output: 52


🏁 Script executed:

#!/bin/bash
# Broad search for where Scope is defined
rg "class Scope|interface Scope" --type java -B 2 -A 10

Repository: netgrif/application-engine

Length of output: 52


🏁 Script executed:

#!/bin/bash
# Search for GLOBAL constant in the codebase
rg "GLOBAL" --type java | head -20

Repository: netgrif/application-engine

Length of output: 2792


🏁 Script executed:

#!/bin/bash
# Search for Scope in nae-object-library or find the importer model package
find . -path "*/importer/model/*" -name "*.java" -type f

Repository: netgrif/application-engine

Length of output: 52


🏁 Script executed:

#!/bin/bash
# List all directories in nae-object-library
find ./nae-object-library -type d -name "importer"

Repository: netgrif/application-engine

Length of output: 52


🏁 Script executed:

#!/bin/bash
# Search all Java files for "Scope.GLOBAL"
rg "Scope\." --type java -B 2 -A 2 | head -40

Repository: netgrif/application-engine

Length of output: 3040


🏁 Script executed:

#!/bin/bash
# Search for all imports of Scope in FunctionFactory and related files
rg "import.*Scope" --type java | grep -v "FunctionScope"

Repository: netgrif/application-engine

Length of output: 742


🏁 Script executed:

#!/bin/bash
# Find the Scope class in the objects.importer.model package
find . -path "*/objects/importer/model/Scope.java" -o -path "*/objects/importer/model/Scope.class"

Repository: netgrif/application-engine

Length of output: 52


🏁 Script executed:

#!/bin/bash
# List all files in the objects/importer/model directory
find . -type d -path "*/objects/importer/model" -exec ls -la {} \;

Repository: netgrif/application-engine

Length of output: 52


🏁 Script executed:

#!/bin/bash
# Search for where the importer model package is defined
find . -type d -name "importer"

Repository: netgrif/application-engine

Length of output: 351


Critical: Fix compilation error - Scope.GLOBAL does not exist.

The code on line 29 attempts to use Scope.GLOBAL, but the Scope class from com.netgrif.application.engine.objects.importer.model cannot be found in the codebase. This will result in a compilation error: "cannot find symbol 'GLOBAL' in Scope" or more likely "cannot find symbol 'Scope'".

Verify the correct import path for the Scope enum and ensure the constant exists, or refactor to use an alternative approach (such as directly setting an appropriate value on the importer model function).

🧰 Tools
🪛 GitHub Actions: Pull Request

[error] 29-29: Compilation error: cannot find symbol 'GLOBAL' in Scope used by FunctionFactory.java.

🤖 Prompt for AI Agents
In
application-engine/src/main/java/com/netgrif/application/engine/importer/service/FunctionFactory.java
around lines 26 to 31, the code references Scope.GLOBAL from
com.netgrif.application.engine.objects.importer.model but that Scope
type/constant isn't available, causing a compilation error; to fix, find the
correct Scope enum/class used by the importer model (search the project for the
Scope definition or an equivalent enum like FunctionScope), import that type at
the top of the file, and replace the current reference with the correct enum
constant or conversion method (e.g., Scope.GLOBAL or Scope.valueOf("GLOBAL") or
Scope.fromValue("GLOBAL")) or, if no enum exists, set the appropriate
string/value on the importer Function (e.g., function.setScope("GLOBAL") or use
the model's setter/creator API); ensure the import statement is added and the
referenced constant/method matches the actual enum/class name to resolve the
compilation error.

}
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import com.netgrif.application.engine.objects.auth.domain.AbstractUser;
import com.netgrif.application.engine.objects.auth.domain.ActorTransformer;
import com.netgrif.application.engine.objects.auth.domain.LoggedUser;
import com.netgrif.application.engine.objects.petrinet.domain.PetriNet;
import com.netgrif.application.engine.objects.petrinet.domain.throwable.TransitionNotExecutableException;
import com.netgrif.application.engine.objects.utils.MenuItemUtils;
import com.netgrif.application.engine.objects.workflow.domain.Case;
Expand Down Expand Up @@ -62,7 +63,11 @@ public Case getOrCreate(DashboardItemBody body) throws TransitionNotExecutableEx
}

LoggedUser loggedUser = ActorTransformer.toLoggedUser(userService.getLoggedOrSystem());
itemCase = workflowService.createCase(petriNetService.getNewestVersionByIdentifier(DashboardItemConstants.PROCESS_IDENTIFIER).getStringId(), body.getName().getDefaultValue(), "", loggedUser).getCase();
PetriNet petriNet = petriNetService.getActiveVersionByIdentifier(DashboardItemConstants.PROCESS_IDENTIFIER);
if (petriNet == null) {
throw new IllegalStateException("Dashboard item process not found or not active");
}
itemCase = workflowService.createCase(petriNet.getStringId(), body.getName().getDefaultValue(), "", loggedUser).getCase();
ToDataSetOutcome outcome = body.toDataSet();
itemCase = setDataWithExecute(itemCase, DashboardItemConstants.TASK_CONFIGURE, outcome.getDataSet());
return itemCase;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import com.netgrif.application.engine.objects.auth.domain.ActorTransformer;
import com.netgrif.application.engine.objects.auth.domain.LoggedUser;
import com.netgrif.application.engine.objects.petrinet.domain.I18nString;
import com.netgrif.application.engine.objects.petrinet.domain.PetriNet;
import com.netgrif.application.engine.objects.petrinet.domain.throwable.TransitionNotExecutableException;
import com.netgrif.application.engine.objects.utils.MenuItemUtils;
import com.netgrif.application.engine.objects.workflow.domain.Case;
Expand Down Expand Up @@ -64,7 +65,11 @@ public Case createDashboardManagement(DashboardManagementBody body) throws Trans
}
addReferencedMenuItems(body);
LoggedUser loggedUser = ActorTransformer.toLoggedUser(userService.getLoggedOrSystem());
managementCase = workflowService.createCase(petriNetService.getNewestVersionByIdentifier(DashboardManagementConstants.PROCESS_IDENTIFIER).getStringId(), body.getName().getDefaultValue(), "", loggedUser).getCase();
PetriNet petriNet = petriNetService.getActiveVersionByIdentifier(DashboardManagementConstants.PROCESS_IDENTIFIER);
if (petriNet == null) {
throw new IllegalStateException("Dashboard management process not found or not active");
}
managementCase = workflowService.createCase(petriNet.getStringId(), body.getName().getDefaultValue(), "", loggedUser).getCase();
ToDataSetOutcome outcome = body.toDataSet();
managementCase = setDataWithExecute(managementCase, DashboardItemConstants.TASK_CONFIGURE, outcome.getDataSet());
return managementCase;
Expand Down
Loading
Loading