Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
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
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
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
6f57b74
Release/7.0.0-RC10
machacjozef Dec 15, 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
c039509
Refactor function validation and enhance PetriNet handling
renczesstefan Jan 7, 2026
df89aac
Merge remote-tracking branch 'origin/release/7.0.0-rev10' into NAE-2266
Retoocs Jan 7, 2026
3241eed
[NAE-2266] Introduce active version of process
Retoocs Jan 7, 2026
b92ba07
[NAE-2266] Introduce active version of process
Retoocs Jan 7, 2026
eb377cc
[NAE-2266] Introduce active version of process
Retoocs Jan 7, 2026
4ca7fd4
[NAE-2266] Introduce active version of process
Retoocs Jan 8, 2026
8028b98
[NAE-2266] Introduce active version of process
Retoocs Jan 8, 2026
1d7d175
[NAE-2266] Introduce active version of process
Retoocs Jan 8, 2026
9cdd0b9
Merge branch 'NAE-2266' into NAE-2212
renczesstefan Jan 8, 2026
d614cf9
- corrected according to PR
renczesstefan Jan 8, 2026
e82c400
- returned petriflow_schema.xsd
renczesstefan Jan 8, 2026
f7c8583
- cached functions after doSaveInternal
renczesstefan Jan 8, 2026
5d72517
- added thread safe maps to cache service
renczesstefan Jan 8, 2026
a1e93de
Add documentation for new PetriNet functions in NAE 5.6.0
renczesstefan Jan 8, 2026
5ce552c
Fix typos and improve formatting in functions documentation
renczesstefan Jan 8, 2026
f2cf540
Synchronize access to cache instances
renczesstefan Jan 8, 2026
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.getDefaultVersionByIdentifier(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.getDefaultVersionByIdentifier(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.getDefaultVersionByIdentifier(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.getDefaultVersionByIdentifier(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.getDefaultVersionByIdentifier(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
Expand Up @@ -10,6 +10,7 @@
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;


@Configuration
@EnableCaching
public class CacheConfiguration extends CachingConfigurerSupport {
Expand Down
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 default versions of Petri nets.
*/
private String petriNetNewest = "petriNetNewest";
private String petriNetDefault = "petriNetDefault";

/**
* 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 global functions of PetriNet global scoped functions.
*/
private String globalFunctions = "globalFunctions";
Comment on lines +49 to +52
Copy link

Choose a reason for hiding this comment

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

🧹 Nitpick | 🔵 Trivial

Clarify the Javadoc wording.

The phrase "caching global functions of PetriNet global scoped functions" is redundant. Consider simplifying to "for caching global-scoped PetriNet functions" or "for caching PetriNet functions with global scope".

📝 Proposed Javadoc improvement
     /**
-     * Default cache name for caching global functions of PetriNet global scoped functions.
+     * Default cache name for caching global-scoped PetriNet functions.
      */
     private String globalFunctions = "globalFunctions";
📝 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
/**
* Default cache name for caching global functions of PetriNet global scoped functions.
*/
private String globalFunctions = "globalFunctions";
/**
* Default cache name for caching global-scoped PetriNet functions.
*/
private String globalFunctions = "globalFunctions";
🤖 Prompt for AI Agents
In
@application-engine/src/main/java/com/netgrif/application/engine/configuration/properties/CacheConfigurationProperties.java
around lines 49 - 52, The Javadoc for the CacheConfigurationProperties field
globalFunctions is wordy and redundant; update the comment to a concise
description such as "Default cache name for caching PetriNet functions with
global scope" (or "for caching global-scoped PetriNet functions") and ensure the
Javadoc sits directly above the private String globalFunctions =
"globalFunctions"; field in the CacheConfigurationProperties class.


/**
* 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, petriNetDefault,
petriNetLatest, petriNetCache, loadedModules, globalFunctions));
caches.addAll(additional);
return caches;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,17 @@ public static class FieldRunnerProperties {
private int functionsCacheSize = 500;

/**
* The size of the cache used for maintaining field runner namespaces.
* The size of the cache used for managing global Petri net functions.
*/
private int namespaceCacheSize = 500;
private int globalFunctionsCacheSize = 500;


/**
* The size of pages used for caching functions when processing large sets of data.
* This property determines the maximum number of functions to include in a single page during caching operations.
* Default value is 500.
*/
private int functionCachingPageSize = 500;
}

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,21 @@
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.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

@Component
@Slf4j
@Component
@RequiredArgsConstructor
public final class FunctionFactory {

private final IFunctionValidator functionValidator;

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

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

return function1;
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package com.netgrif.application.engine.importer.service;

import com.netgrif.application.engine.objects.importer.model.Function;
import com.netgrif.application.engine.objects.importer.model.Scope;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

@Component
@Slf4j
public class FunctionValidator implements IFunctionValidator {

private static final String NAMESPACE = "namespace";

/**
* Validates and updates deprecated function attributes.
* <p>
* This method mutates the input function by replacing deprecated scope values.
* Specifically, it replaces the deprecated NAMESPACE scope with GLOBAL scope.
*
* @param function the function to validate and update (mutated in-place)
*/
@Override
public void checkDeprecatedAttributes(Function function) {
if (function.getScope() != null && function.getScope().value().equals(NAMESPACE)) {
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 . -name "FunctionValidator.java" -type f

Repository: netgrif/application-engine

Length of output: 175


🏁 Script executed:

# Once we find the file, let's examine it around line 24
head -40 application-engine/src/main/java/com/netgrif/application/engine/importer/service/FunctionValidator.java

Repository: netgrif/application-engine

Length of output: 1147


🏁 Script executed:

# Search for the Scope enum definition
find . -name "*.java" -type f | xargs rg "enum Scope" -A 10

Repository: netgrif/application-engine

Length of output: 54


🌐 Web query:

Best practices for handling deprecated enum values during migration in Java Spring applications

💡 Result:

Short checklist — best practices for handling deprecated enum values during migration in Java Spring apps:

  1. Persist enums with stable identifiers (not ordinal): use EnumType.STRING or explicit codes (code field + getter) so order changes don’t break data. [1][2]

  2. Give enums an explicit, stable external value (code/int/string) and map via AttributeConverter or Jackson annotations. This lets you rename constants but keep stored values stable. [3][4]

  3. Use DB migrations (Flyway/Liquibase) to perform any column/value changes, and write migration scripts that transform old values to new ones (or add new DB enum types) rather than relying on app code alone. [5]

  4. Deprecate first, remove later: mark enum constants @deprecated, add mapping from deprecated → replacement in converters/serializers, and keep deprecated values supported for at least one release cycle. Log usages. [3]

  5. Implement tolerant deserialization/reading:

    • In JPA converters and Jackson deserializers accept unknown/old values and map to a safe default or “UNKNOWN/DEPRECATED” placeholder.
    • Fail-fast only when necessary and surface clear errors for clients. [4][6]
  6. API versioning and compatibility:

    • When enums are exposed in APIs, use semantically versioned API changes or extension fields rather than renaming/removing enum values in-place. Document changes and migration paths. [3][5]
  7. Backwards-compat tests and monitoring:

    • Add integration tests exercising DB rows with old enum values, migration scripts, and API consumers.
    • Instrument and monitor occurrences of deprecated values in logs/metrics to know when it’s safe to remove them. [5][6]
  8. If using a DB-native enum type (Postgres), treat changes as schema migrations and prefer using text/varchar + constraints or explicit mapping to avoid expensive ALTER operations. Use migration tooling to update DB enum types carefully. [5][7]

References

  • [1] Baeldung — Persisting Enums in JPA (recommend EnumType.STRING).
  • [2] Java Guides / community blog — prefer EnumType.STRING; avoid ORDINAL.
  • [3] Oracle Java deprecation guidance / use @deprecated and document migration.
  • [4] JPA/Postgres articles on using AttributeConverter and tolerant mapping.
  • [5] DZone / migration articles — use Flyway/Liquibase and scripted transformations.
  • [6] Best-practice posts on backward compatibility and testing.
  • [7] Postgres + Java enum pitfalls (DB-native enums vs text mapping).

If you want, I can produce concrete code examples: (a) JPA AttributeConverter mapping deprecated values to new codes, (b) Jackson deserializer that tolerantly maps unknown strings, and (c) a sample Flyway SQL migration. Which one would you like first?


🏁 Script executed:

find . -name "Scope.java" -type f

Repository: netgrif/application-engine

Length of output: 52


🏁 Script executed:

# Search for Scope in the importer/model package
find . -path "*/importer/model/*" -name "*.java" -type f | head -20

Repository: netgrif/application-engine

Length of output: 52


🏁 Script executed:

# Search for enum definitions with "Scope"
rg "class Scope|interface Scope" -t java

Repository: netgrif/application-engine

Length of output: 52


🏁 Script executed:

rg "Scope" -t java | grep -E "(enum|class|interface|record)" | head -20

Repository: netgrif/application-engine

Length of output: 204


🏁 Script executed:

# Search for any mention of Scope in Java files
rg "Scope" -t java -B 2 -A 5 | head -100

Repository: netgrif/application-engine

Length of output: 13324


🏁 Script executed:

# Look for Function.java to understand the relationship
find . -name "Function.java" -type f

Repository: netgrif/application-engine

Length of output: 173


🏁 Script executed:

find . -path "*/importer/model/Scope.java" -type f

Repository: netgrif/application-engine

Length of output: 52


🏁 Script executed:

rg "class Scope|interface Scope|enum Scope" -t java -B 2 -A 15 | grep -A 15 "importer/model"

Repository: netgrif/application-engine

Length of output: 52


🏁 Script executed:

# Find all Java files in importer model package
find . -path "*/objects/importer/model/*" -name "*.java" -type f

Repository: netgrif/application-engine

Length of output: 52


🏁 Script executed:

# Search for all files with "Scope" in name
find . -name "*Scope*" -type f

Repository: netgrif/application-engine

Length of output: 504


🏁 Script executed:

# Try to find the Scope class in importer - broader search
rg "public class Scope|public enum Scope|public interface Scope" -t java

Repository: netgrif/application-engine

Length of output: 52


🏁 Script executed:

# Check what's imported in FunctionValidator more carefully
cat -n ./application-engine/src/main/java/com/netgrif/application/engine/importer/service/FunctionValidator.java

Repository: netgrif/application-engine

Length of output: 1350


🏁 Script executed:

# Find source files in objects/importer/model - they should be in a source directory
find . -path "*objects/importer/model*" -name "*.java" -type f | head -20

Repository: netgrif/application-engine

Length of output: 52


🏁 Script executed:

# Search for the Scope class definition anywhere with broader approach
rg "enum Scope|class Scope" -t java --no-filename | head -10

Repository: netgrif/application-engine

Length of output: 52


🏁 Script executed:

# List all Java files in the objects module under importer
find ./nae-object-library -path "*importer/model*" -type f

Repository: netgrif/application-engine

Length of output: 52


🏁 Script executed:

# Try to find the Scope source - it might be in a different module structure
find . -name "Scope.java" -o -name "Scope.kt" -o -name "Scope.groovy"

Repository: netgrif/application-engine

Length of output: 52


🏁 Script executed:

# Check all modules by listing directories with "importer" in name
find . -type d -name "*importer*" | grep -v ".git" | head -20

Repository: netgrif/application-engine

Length of output: 351


🏁 Script executed:

# Search for @Override checkDeprecatedAttributes to see if there are other implementations
rg "checkDeprecatedAttributes" -t java -B 3 -A 10

Repository: netgrif/application-engine

Length of output: 30497


🏁 Script executed:

# Look for files containing "enum Scope" more broadly
rg "enum Scope" -t java -B 2 -A 20

Repository: netgrif/application-engine

Length of output: 52


🏁 Script executed:

# Check git history or look in test directories
find ./application-engine/src/test -name "*Scope*" -type f

Repository: netgrif/application-engine

Length of output: 52


🏁 Script executed:

# Look at the FunctionFactory.java more closely to see how Scope is converted
cat -n ./application-engine/src/main/java/com/netgrif/application/engine/importer/service/FunctionFactory.java

Repository: netgrif/application-engine

Length of output: 1233


🏁 Script executed:

# Search more carefully for Scope - it might be in a JAR or different module
find . -type f \( -name "*.java" -o -name "*.class" \) | xargs rg "class Scope|enum Scope" 2>/dev/null | head -20

Repository: netgrif/application-engine

Length of output: 52


🏁 Script executed:

# Look at what's imported and used in the importer model package
find ./application-engine -path "*/importer/model/*" -type f

Repository: netgrif/application-engine

Length of output: 52


🏁 Script executed:

# Check if there's a separate objects-importer or model package
find . -type d -name "importer" | head -20

Repository: netgrif/application-engine

Length of output: 351


🏁 Script executed:

# Let's look at the javadoc that was found earlier
cat ./docs/javadoc/com/netgrif/application/engine/importer/model/Scope.html | head -100

Repository: netgrif/application-engine

Length of output: 3868


🏁 Script executed:

# Let's look at the javadoc more completely to understand Scope structure
grep -A 200 "Enum Constants" ./docs/javadoc/com/netgrif/application/engine/importer/model/Scope.html | head -100

Repository: netgrif/application-engine

Length of output: 3205


🏁 Script executed:

# Look for Scope in any compiled artifacts or check if it's a generated class
find . -name "pom.xml" -o -name "build.gradle" | head -5

Repository: netgrif/application-engine

Length of output: 209


🏁 Script executed:

# Search for where Scope.GLOBAL is referenced in the codebase
rg "Scope\.GLOBAL" -t java

Repository: netgrif/application-engine

Length of output: 423


🏁 Script executed:

# Look at the actual Function class in importer model by examining test files
find ./application-engine/src/test -name "*.java" -o -name "*.groovy" | xargs rg "Scope" | head -20

Repository: netgrif/application-engine

Length of output: 52


🏁 Script executed:

# Check the actual Scope enum definition - it seems the javadoc shows it, let's find the source
find . -type f -name "*.java" | xargs rg "public enum Scope" -A 15 | grep -v "FunctionScope"

Repository: netgrif/application-engine

Length of output: 52


🏁 Script executed:

# Look for where Scope enum is defined - check nae-spring-core-adapter
find ./nae-spring-core-adapter -name "Scope.java" -o -name "*Scope*"

Repository: netgrif/application-engine

Length of output: 52


🏁 Script executed:

# Check if Scope.GLOBAL exists in the codebase at all
rg "GLOBAL" -t java | grep -i scope

Repository: netgrif/application-engine

Length of output: 1122


🏁 Script executed:

# Let's look at what constants Scope enum actually has
grep -A 50 "enum Scope" ./docs/javadoc/com/netgrif/application/engine/importer/model/Scope.html | grep -E "NAMESPACE|PROCESS|GLOBAL"

Repository: netgrif/application-engine

Length of output: 52


🏁 Script executed:

# Let's check the actual Scope enum definition - it might be in nae-spring-core-adapter
find ./nae-spring-core-adapter -type f -name "*.java" | xargs cat | grep -A 30 "enum Scope" | head -50

Repository: netgrif/application-engine

Length of output: 52


🏁 Script executed:

# Compile to check for errors - look at what Scope constants are available
grep -A 100 "public enum Scope" ./docs/javadoc/com/netgrif/application/engine/importer/model/Scope.html | grep -E "value|NAMESPACE|PROCESS|GLOBAL" | head -20

Repository: netgrif/application-engine

Length of output: 52


🏁 Script executed:

# Check if there's actual source code for Scope enum - search all directories
find . -type f \( -name "*.java" -o -name "*.groovy" \) -exec grep -l "public enum Scope" {} \;

Repository: netgrif/application-engine

Length of output: 52


🏁 Script executed:

# Let's verify what the FunctionFactory is doing - convert Scope to FunctionScope
cat -n ./application-engine/src/main/java/com/netgrif/application/engine/importer/service/FunctionFactory.java | sed -n '17,26p'

Repository: netgrif/application-engine

Length of output: 568


🏁 Script executed:

# Check if Scope enum might be in a different module or if it's been recently modified
rg "enum Scope" --type-list all -t java -B 3 -A 20

Repository: netgrif/application-engine

Length of output: 459


🏁 Script executed:

# Verify if Scope.GLOBAL compile error would occur - check all references to Scope.
rg "Scope\." -t java | grep -v "FunctionScope"

Repository: netgrif/application-engine

Length of output: 218


🏁 Script executed:

# Final verification - check if there are any build issues or if GLOBAL was added recently
find . -name "Scope.java" -o -name "*Scope*.java" | grep -v "FunctionScope" | xargs cat 2>/dev/null

Repository: netgrif/application-engine

Length of output: 52


🏁 Script executed:

# Check test files to see if they reveal the actual Scope definition
find ./application-engine/src/test -type f \( -name "*.java" -o -name "*.groovy" \) -exec grep -l "Scope\." {} \; | head -5

Repository: netgrif/application-engine

Length of output: 52


Fix the broken enum reference: Scope.GLOBAL does not exist in the Scope enum.

The Scope enum in the importer model contains only NAMESPACE and PROCESS constants. Line 26 attempts to set Scope.GLOBAL, which will cause a compilation error. Either add the GLOBAL constant to the Scope enum, or map the deprecated NAMESPACE value to PROCESS instead, depending on the intended behavior of this deprecation migration.

🤖 Prompt for AI Agents
In
@application-engine/src/main/java/com/netgrif/application/engine/importer/service/FunctionValidator.java
at line 24, The code references a non-existent Scope.GLOBAL constant in
FunctionValidator when handling deprecated NAMESPACE scope; change the migration
to map the deprecated NAMESPACE to the existing Scope.PROCESS (replace any
occurrences of Scope.GLOBAL with Scope.PROCESS in FunctionValidator and adjust
related conditional logic that checks function.getScope() and sets the new
scope), and run compilation/tests to ensure the enum usage is consistent (do not
add a GLOBAL constant unless you intentionally want to expand the Scope enum).

log.warn("Function scope [NAMESPACE] is deprecated. Replacing with [GLOBAL].");
function.setScope(Scope.GLOBAL);
}
}
Comment on lines +23 to +28
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:

#!/bin/bash
# Find and examine the Scope enum definition

echo "=== Searching for Scope.java in importer model ==="
fd -t f 'Scope\.java' | head -20

echo -e "\n=== Checking paths to identify correct Scope enum ==="
fd -t f 'Scope\.java' -x grep -l 'enum Scope' {}

echo -e "\n=== Examining Scope enum values ==="
fd -t f 'Scope\.java' | xargs -I {} sh -c 'echo "File: {}"; cat -n {}'

Repository: netgrif/application-engine

Length of output: 1523


🏁 Script executed:

#!/bin/bash
# Search for enum Scope definitions
echo "=== Searching for all enum Scope definitions ==="
rg 'enum Scope' -A 10

echo -e "\n=== Checking FunctionValidator imports ==="
cat -n application-engine/src/main/java/com/netgrif/application/engine/importer/service/FunctionValidator.java | head -30

echo -e "\n=== Searching for Scope in importer/model package ==="
fd -t f '\.java$' | rg 'importer/model' | xargs grep -l 'class Scope\|enum Scope' 2>/dev/null || echo "No Scope enum found in importer/model"

echo -e "\n=== All Scope-related files in importer ==="
fd -t f 'Scope\.java'

Repository: netgrif/application-engine

Length of output: 1688


🏁 Script executed:

#!/bin/bash
# Search for all files in importer/model package
echo "=== Files in importer/model package ==="
fd -t f '\.java$' | rg 'importer/model' 

echo -e "\n=== Checking if Scope class exists in importer.model package ==="
fd -t f '\.java$' | rg 'importer/model' | xargs cat | rg -B2 -A10 'class Scope|enum Scope' || echo "No Scope class/enum found"

echo -e "\n=== Full directory structure of importer/model ==="
find . -type d -path '*/importer/model' 2>/dev/null | head -5

echo -e "\n=== Contents of importer/model directory ==="
find . -type d -path '*/importer/model' -exec ls -la {} \; 2>/dev/null | head -20

Repository: netgrif/application-engine

Length of output: 1587


🏁 Script executed:

#!/bin/bash
# Search for Scope class in objects package
echo "=== Searching for Scope in objects package ==="
fd -t f 'Scope\.java' 

echo -e "\n=== Searching in importer package for Scope ==="
fd -t d 'importer' | head -10

echo -e "\n=== Looking for where Scope is actually defined ==="
rg 'class Scope|enum Scope' -l

echo -e "\n=== Checking all Java files with Scope ==="
rg 'Scope\s*\{' -A 5 | head -50

echo -e "\n=== Checking objects directory structure ==="
fd -t d 'objects' | head -5

echo -e "\n=== Looking for importer model source ==="
fd -t f '\.java$' | rg 'objects.*importer.*model' | head -20

Repository: netgrif/application-engine

Length of output: 1580


🏁 Script executed:

#!/bin/bash
# Search for source files in importer.model package
echo "=== Looking for all Java source files in importer ==="
fd -t f '\.java$' 'importer' | head -30

echo -e "\n=== Checking nae-object-library structure ==="
fd -t d 'nae-object-library' | head -5

echo -e "\n=== Looking in nae-object-library for importer ==="
fd -t f '\.java$' | rg 'nae-object-library.*importer' | head -20

echo -e "\n=== Checking if Scope is in nae-object-library/objects ==="
find nae-object-library -name 'Scope.java' 2>/dev/null

echo -e "\n=== All Java files in nae-object-library/objects ==="
fd -t f '\.java$' nae-object-library | head -30

Repository: netgrif/application-engine

Length of output: 3532


🏁 Script executed:

#!/bin/bash
# Comprehensive search for Scope class
echo "=== Searching for any reference to 'Scope' class definition ==="
find . -name '*.java' -type f -exec grep -l 'class Scope\|enum Scope' {} \; 2>/dev/null

echo -e "\n=== Searching for Scope in import statements ==="
find . -name '*.java' -type f -exec grep -h 'import.*Scope' {} \; 2>/dev/null | sort -u

echo -e "\n=== Checking if Scope exists anywhere ==="
rg 'Scope\s+\{' -A 3 2>/dev/null | head -50

echo -e "\n=== Listing all Java files in objects directory ==="
find . -path '*/objects/*' -name '*.java' -type f | grep -i scope

echo -e "\n=== Full content check of importer in application-engine ==="
find application-engine -name '*.java' -type f | head -20

Repository: netgrif/application-engine

Length of output: 3296


🏁 Script executed:

#!/bin/bash
# Check where Scope might be coming from
echo "=== Looking for Scope class in all locations ==="
find . -name 'Scope.class' 2>/dev/null

echo -e "\n=== Checking pom.xml for dependencies ==="
find . -name 'pom.xml' -type f | head -3 | xargs grep -h '<artifactId>' | sort -u | head -20

echo -e "\n=== Checking if objects.importer.model package exists ==="
find . -type d -path '*/objects/importer/model' 2>/dev/null

echo -e "\n=== List all directories in objects ==="
find . -path '*/objects' -type d | head -20

echo -e "\n=== Check objects directory specifically ==="
ls -la nae-object-library/src/main/java/com/netgrif/application/engine/objects/ 2>/dev/null | head -30

echo -e "\n=== Searching for where importer model classes might be ==="
find . -path '*/objects/*' -name '*.java' | grep -i importer

Repository: netgrif/application-engine

Length of output: 2594


🏁 Script executed:

#!/bin/bash
# Search for Function class in importer.model
echo "=== Searching for Function class ==="
find . -name 'Function.java' -type f 2>/dev/null

echo -e "\n=== Checking if importer.model is in a different location ==="
rg 'class Function|interface Function' -l | head -10

echo -e "\n=== Looking at what FunctionValidator is actually trying to import ==="
cat -n application-engine/src/main/java/com/netgrif/application/engine/importer/service/FunctionValidator.java

echo -e "\n=== Checking all imports from com.netgrif.application.engine.objects.importer ==="
rg 'com\.netgrif\.application\.engine\.objects\.importer' -l | head -20

Repository: netgrif/application-engine

Length of output: 4108


🏁 Script executed:

#!/bin/bash
# Check for generated sources
echo "=== Checking for generated sources directory ==="
find . -type d -name 'generated-sources' 2>/dev/null | head -5

echo -e "\n=== Looking for JAXB or other code generation ==="
rg 'jaxb|xsd' pom.xml | head -20

echo -e "\n=== Check if there are XSD files ==="
find . -name '*.xsd' 2>/dev/null

echo -e "\n=== Examining pom.xml for importer model dependencies ==="
rg -A 5 -B 5 'importer.*model|objects.*importer' nae-object-library/pom.xml application-engine/pom.xml

echo -e "\n=== Check target directory for generated classes ==="
find . -path '*/target/*' -name 'Scope.class' 2>/dev/null

Repository: netgrif/application-engine

Length of output: 2680


🏁 Script executed:

#!/bin/bash
# Check the XSD schema for Scope definition
echo "=== Examining petriflow_schema.xsd for Scope ==="
cat application-engine/src/main/resources/petriNets/petriflow_schema.xsd | grep -A 30 -B 5 'Scope' | head -100

echo -e "\n=== Searching for enumeration values in schema ==="
rg -A 10 'name="Scope"' application-engine/src/main/resources/petriNets/petriflow_schema.xsd

echo -e "\n=== Full XSD file size ==="
wc -l application-engine/src/main/resources/petriNets/petriflow_schema.xsd

echo -e "\n=== Complete Scope definition from XSD ==="
sed -n '/name="Scope"/,/\/xs:simpleType/p' application-engine/src/main/resources/petriNets/petriflow_schema.xsd

Repository: netgrif/application-engine

Length of output: 313


🏁 Script executed:

#!/bin/bash
# Check content of XSD files
echo "=== Content of application-engine petriflow_schema.xsd ==="
cat application-engine/src/main/resources/petriNets/petriflow_schema.xsd

echo -e "\n=== Content of nae-object-library petriflow_schema.xsd ==="
cat nae-object-library/src/main/resources/petriflow_schema.xsd | head -100

echo -e "\n=== Searching for Scope in nae-object-library XSD ==="
rg -A 20 'Scope' nae-object-library/src/main/resources/petriflow_schema.xsd | head -80

echo -e "\n=== Full size of nae-object-library XSD ==="
wc -l nae-object-library/src/main/resources/petriflow_schema.xsd

Repository: netgrif/application-engine

Length of output: 1032


🏁 Script executed:

#!/bin/bash
# Check for compiled Scope class
echo "=== Searching for any reference to Scope enum values ==="
rg 'Scope\.' --type java | head -30

echo -e "\n=== Checking for test files that might use Scope ==="
find . -name '*Test*.java' -o -name '*Test*.groovy' | xargs rg 'Scope' 2>/dev/null | head -20

echo -e "\n=== Looking for build output or cached schema ==="
find . -type d -name '.m2' -o -name 'target' | head -5

echo -e "\n=== Checking if GLOBAL is referenced anywhere in code ==="
rg 'GLOBAL' --type java | grep -v FunctionScope | head -20

echo -e "\n=== Checking Function class to see what it expects ==="
cat -n nae-object-library/src/main/java/com/netgrif/application/engine/objects/petrinet/domain/Function.java | head -80

Repository: netgrif/application-engine

Length of output: 4823


🏁 Script executed:

#!/bin/bash
# Examine FunctionFactory to understand Scope usage
echo "=== Examining FunctionFactory ==="
cat -n application-engine/src/main/java/com/netgrif/application/engine/importer/service/FunctionFactory.java

echo -e "\n=== Checking what happens with function scope ==="
rg -B 5 -A 5 'getScope' application-engine/src/main/java/com/netgrif/application/engine/importer/service/FunctionFactory.java

echo -e "\n=== Checking IFunctionValidator interface ==="
cat -n application-engine/src/main/java/com/netgrif/application/engine/importer/service/IFunctionValidator.java

Repository: netgrif/application-engine

Length of output: 2384


🏁 Script executed:

#!/bin/bash
# Check all usages of Scope enum to understand available values
echo "=== All usages of Scope enum ==="
rg 'Scope\.' --type java -B 2 -A 2

echo -e "\n=== Looking for any cached/compiled Scope definition ==="
find . -name '*.class' -path '*/importer/model/*' 2>/dev/null

echo -e "\n=== Checking git status for any uncommitted generated files ==="
git status | head -50

echo -e "\n=== Check git log for recent changes to FunctionValidator ==="
git log -p --follow -S 'Scope.GLOBAL' -- application-engine/src/main/java/com/netgrif/application/engine/importer/service/FunctionValidator.java 2>/dev/null | head -100 || echo "No git history found for this pattern"

echo -e "\n=== Checking if there's a build or compile error report ==="
find . -name '*.log' -type f | xargs grep -l 'Scope' 2>/dev/null | head -5

Repository: netgrif/application-engine

Length of output: 3395


🏁 Script executed:

#!/bin/bash
# Check for any hints about Scope enum values
echo "=== Checking git branches and recent changes ==="
git branch -a | head -20

echo -e "\n=== Looking for any documentation about Scope enum ==="
find . -name '*.md' -o -name '*.txt' | xargs grep -l 'Scope' 2>/dev/null | head -10

echo -e "\n=== Checking if there's any mapping or documentation in comments ==="
rg 'NAMESPACE|namespace' --type java -B 3 -A 3 | head -60

echo -e "\n=== Verifying what FunctionScope values exist ==="
cat nae-object-library/src/main/java/com/netgrif/application/engine/objects/petrinet/domain/FunctionScope.java

echo -e "\n=== Checking how the conversion works in FunctionFactory ==="
cat -n application-engine/src/main/java/com/netgrif/application/engine/importer/service/FunctionFactory.java | grep -A 10 -B 10 'FunctionScope.valueOf'

Repository: netgrif/application-engine

Length of output: 9264


Compilation error: Scope.GLOBAL does not exist.

The Scope enum (generated via JAXB from the petriflow schema) does not currently contain a GLOBAL value, making line 26 a compilation error. The FunctionFactory.getFunction() method converts the importer model's Scope to the domain model's FunctionScope via FunctionScope.valueOf(function.getScope().name()), which requires enum names to match. Since FunctionScope has GLOBAL but the generated Scope enum does not, this code cannot compile.

This change depends on updating the external petriflow schema (https://petriflow.org/petriflow.schema.xsd) or providing a local schema override to include the GLOBAL value in the Scope enum definition.

🧰 Tools
🪛 GitHub Actions: Pull Request

[error] 26-26: cannot find symbol: GLOBAL referenced in FunctionValidator.java. Location: com.netgrif.application.engine.objects.importer.model.Scope. Likely a missing enum/constant or import.

🤖 Prompt for AI Agents
In
@application-engine/src/main/java/com/netgrif/application/engine/importer/service/FunctionValidator.java
around lines 23 - 28, The code in FunctionValidator.checkDeprecatedAttributes
tries to set Scope.GLOBAL which doesn't exist in the generated JAXB enum; update
the logic to avoid referencing a non-existent enum value by either mapping the
deprecated NAMESPACE to the actual generated enum constant (e.g. the existing
equivalent in Scope) or by changing the deprecation handling to set the domain
model scope later during conversion: remove or replace the call to
function.setScope(Scope.GLOBAL) and instead record the deprecation (log.warn)
and let FunctionFactory.getFunction handle mapping to FunctionScope (which uses
FunctionScope.valueOf(function.getScope().name())) or update the JAXB schema to
include GLOBAL so Scope.GLOBAL is generated; adjust
FunctionValidator.checkDeprecatedAttributes, Function.setScope usage, and ensure
consistency with FunctionFactory.getFunction and the FunctionScope enum.

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package com.netgrif.application.engine.importer.service;

import com.netgrif.application.engine.objects.importer.model.Function;

public interface IFunctionValidator extends IModelValidator {
/**
* Validates and updates deprecated function attributes.
* <p>
* This method mutates the input function by replacing deprecated scope values.
* Specifically, it replaces the deprecated NAMESPACE scope with GLOBAL scope.
*
* @param function the function to validate and update (mutated in-place)
*/
void checkDeprecatedAttributes(Function function);
}
Comment on lines +1 to +15
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:

#!/bin/bash

# Find Scope.java in the importer model package
echo "=== Searching for Scope enum ==="
fd -t f 'Scope.java' 2>/dev/null | head -20

# Also search more broadly
echo ""
echo "=== Broader search for Scope class ==="
rg -t java 'enum Scope|class Scope' --max-count 10 2>/dev/null

# Check if GLOBAL value exists in Scope
echo ""
echo "=== Checking for GLOBAL in Scope-related files ==="
rg -t java 'GLOBAL' objects/importer 2>/dev/null | grep -i scope | head -20

Repository: netgrif/application-engine

Length of output: 301


🏁 Script executed:

#!/bin/bash

# Search for FunctionValidator.java to see actual compilation error
echo "=== Looking for FunctionValidator.java ==="
fd -t f 'FunctionValidator.java' 2>/dev/null

# If found, check its content
echo ""
echo "=== Content of FunctionValidator.java (first 50 lines) ==="
fd -t f 'FunctionValidator.java' -x cat {} \; 2>/dev/null | head -50

Repository: netgrif/application-engine

Length of output: 2048


🏁 Script executed:

#!/bin/bash

# Check directory structure of importer model package
echo "=== Importer model package structure ==="
fd 'objects/importer' -type d 2>/dev/null | head -10

# List files in the importer/model directory
echo ""
echo "=== Files in importer/model directory ==="
find . -path '*/objects/importer/model*' -type f -name '*.java' 2>/dev/null | head -20

Repository: netgrif/application-engine

Length of output: 153


🏁 Script executed:

#!/bin/bash

# Search more broadly for Scope enum in importer context
echo "=== Searching for Scope enum/class in importer package ==="
rg -t java 'enum Scope|class Scope' --max-count 20

# Check if the imported path exists
echo ""
echo "=== Checking objects/importer directory structure ==="
find . -path '*/objects/importer*' -type d | head -20

# Try to find any file with "Scope" in importer package
echo ""
echo "=== Finding files with Scope in importer package ==="
find . -path '*/objects/importer*' -name '*Scope*' -type f

Repository: netgrif/application-engine

Length of output: 237


🏁 Script executed:

#!/bin/bash

# Search for where Scope enum is actually defined
echo "=== All occurrences of 'enum Scope' or 'class Scope' in codebase ==="
rg 'enum Scope|class Scope' -B 2 -A 5 --max-count 20

# Also check what's imported from importer.model
echo ""
echo "=== Files in com/netgrif/application/engine/objects/importer/model ==="
find . -type d -path '*/objects/importer/model' | xargs ls -la 2>/dev/null || echo "Directory not found or no files"

# List structure
find . -path '*/objects/importer/model*' | head -30

Repository: netgrif/application-engine

Length of output: 1353


🏁 Script executed:

#!/bin/bash

# Check if Scope.java exists at the expected location
echo "=== Looking for Scope.java in any location ==="
fd 'Scope.java' -type f

# Check the complete importer model directory
echo ""
echo "=== Complete importer package structure ==="
find . -type f -path '*/importer/model/*.java' 2>/dev/null | head -20

Repository: netgrif/application-engine

Length of output: 349


🏁 Script executed:

#!/bin/bash

# Search for GLOBAL in the entire codebase to see if Scope enum exists anywhere
echo "=== Searching for GLOBAL enum constant ==="
rg 'GLOBAL' --max-count 30 | head -40

# Check imports of Scope to understand the issue
echo ""
echo "=== All imports of Scope ==="
rg 'import.*Scope' -A 1 -B 1

# Check what's actually in the importer/model directory by listing Java files
echo ""
echo "=== Java files in importer service directory ==="
find application-engine/src/main/java/com/netgrif/application/engine/importer -name '*.java' | head -20

Repository: netgrif/application-engine

Length of output: 50384


🏁 Script executed:

#!/bin/bash

# Search more specifically for Scope class/enum
echo "=== Search for any Scope definition ==="
rg -t java 'enum Scope|class Scope' -A 3 | head -50

# Check if there's a Scope import that works
echo ""
echo "=== Checking actual imports in FunctionValidator ==="
rg -t java 'import.*Scope' application-engine/src/main/java/com/netgrif/application/engine/importer/service/FunctionValidator.java

# Verify if the importer model package exists and what it contains
echo ""
echo "=== List all Java files in importer service directory ==="
find application-engine/src/main/java/com/netgrif/application/engine/importer -name '*.java' -type f | head -30

Repository: netgrif/application-engine

Length of output: 2671


🏁 Script executed:

#!/bin/bash

# Search for any files with "Scope" in the importer context
echo "=== All files with 'Scope' in importer package ==="
find application-engine/src/main/java/com/netgrif/application/engine/importer -name '*Scope*' -o -name '*scope*'

# Check if Scope enum is defined in any model package
echo ""
echo "=== Looking for model package directories ==="
find application-engine -type d -name 'model'

# Search in nae-object-library for Scope
echo ""
echo "=== Checking nae-object-library for Scope ==="
find nae-object-library -name '*Scope*.java' -type f

Repository: netgrif/application-engine

Length of output: 321


Interface is correct but compilation blocked by missing Scope enum.

The interface definition, JavaDoc, and method signature are well-structured. However, FunctionValidator.java imports Scope from com.netgrif.application.engine.objects.importer.model.Scope, which does not exist in the codebase. The importer.model package has no Scope enum definition, causing an unresolvable import at line 22 and preventing the implementation from compiling. This is a critical blocking issue that must be resolved before this change can be merged.

🧰 Tools
🪛 GitHub Actions: Pull Request

[error] 1-1: BUILD FAILURE: Compilation failed in module application-engine. See log for details. Command: mvn clean verify -DskipTests=true

🤖 Prompt for AI Agents
In
@application-engine/src/main/java/com/netgrif/application/engine/importer/service/IFunctionValidator.java
around lines 1 - 15, The build fails because FunctionValidator.java imports a
non-existent com.netgrif.application.engine.objects.importer.model.Scope; either
add a Scope enum into that package with the expected constants (e.g., NAMESPACE
and GLOBAL) or change FunctionValidator to reference the correct existing enum
(or fully-qualified type) used elsewhere in the project; update the import in
FunctionValidator.java (and any other classes importing Scope) to point to the
new or correct enum and ensure checkDeprecatedAttributes(Function) uses that
enum for scope comparisons/assignments so the implementation compiles.

Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
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.common.ResourceNotFoundException;
import com.netgrif.application.engine.objects.common.ResourceNotFoundExceptionCode;
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 +65,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.getDefaultVersionByIdentifier(DashboardItemConstants.PROCESS_IDENTIFIER);
if (petriNet == null) {
throw new ResourceNotFoundException(ResourceNotFoundExceptionCode.DEFAULT_PROCESS_NOT_FOUND, "Dashboard item process not found");
}
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 @@ -8,7 +8,10 @@
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.common.ResourceNotFoundException;
import com.netgrif.application.engine.objects.common.ResourceNotFoundExceptionCode;
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 +67,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.getDefaultVersionByIdentifier(DashboardManagementConstants.PROCESS_IDENTIFIER);
if (petriNet == null) {
throw new ResourceNotFoundException(ResourceNotFoundExceptionCode.DEFAULT_PROCESS_NOT_FOUND, "Dashboard management process not found");
}
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
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,16 @@ public interface PetriNetRepository extends MongoRepository<PetriNet, String>, Q
*/
PetriNet findByIdentifierAndVersion(String identifier, Version version);

/**
* Finds a {@link PetriNet} entity by its identifier and defaultVersion attribute
*
* @param identifier the unique identifier of the PetriNet.
* @param defaultVersion if true, the default version will be found, otherwise the non-default version will be found
* @param pageable the pagination details.
* @return the {@link PetriNet} entity matching the given identifier and defaultVersion attribute, or {@code null} if none found.
*/
Page<PetriNet> findByIdentifierAndDefaultVersion(String identifier, boolean defaultVersion, Pageable pageable);
Comment on lines +36 to +44
Copy link

@coderabbitai coderabbitai bot Jan 8, 2026

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Incorrect Javadoc: Method returns Page, not a single entity or null.

The Javadoc states the method returns "the {@link PetriNet} entity... or {@code null} if none found" but the actual return type is Page<PetriNet>. An empty page is returned when no match is found, not null.

📝 Proposed fix for Javadoc
     /**
      * Finds a {@link PetriNet} entity by its identifier and defaultVersion attribute
      *
      * @param identifier the unique identifier of the PetriNet.
      * @param defaultVersion if true, the default version will be found, otherwise the non-default version will be found
      * @param pageable the pagination details.
-     * @return the {@link PetriNet} entity matching the given identifier and defaultVersion attribute, or {@code null} if none found.
+     * @return a {@link Page} containing the matching {@link PetriNet} entities, or an empty page if none found.
      */
     Page<PetriNet> findByIdentifierAndDefaultVersion(String identifier, boolean defaultVersion, Pageable pageable);
🤖 Prompt for AI Agents
In
@application-engine/src/main/java/com/netgrif/application/engine/petrinet/domain/repositories/PetriNetRepository.java
around lines 36 - 44, The Javadoc for findByIdentifierAndDefaultVersion
incorrectly describes a single PetriNet or null; update it to state the method
returns a Page<PetriNet> and that an empty Page is returned when no matches are
found. Edit the Javadoc for the method findByIdentifierAndDefaultVersion(String
identifier, boolean defaultVersion, Pageable pageable) to describe the
pagination behavior and that an empty Page (not null) is returned if there are
no results.

Copy link
Contributor

Choose a reason for hiding this comment

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

This is fixed in depending pull request

Copy link

Choose a reason for hiding this comment

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

@Retoocs, understood! Since this will be addressed in the dependent PR (#389), the Javadoc will be corrected before this PR is merged. Thank you for clarifying.


🧠 Learnings used
Learnt from: Retoocs
Repo: netgrif/application-engine PR: 383
File: application-engine/src/main/java/com/netgrif/application/engine/startup/ApplicationRunnerOrderResolver.java:43-43
Timestamp: 2025-11-14T10:22:01.634Z
Learning: For the netgrif/application-engine repository, avoid flagging trivial or nitpick-level issues such as redundant null checks, minor code style improvements, or obvious simplifications that don't affect functionality or introduce bugs. Focus review comments on substantive issues like logic errors, security concerns, performance problems, or breaking changes.


/**
* Finds a paginated list of {@link PetriNet} entities by their identifier.
*
Expand Down Expand Up @@ -68,4 +78,13 @@ public interface PetriNetRepository extends MongoRepository<PetriNet, String>, Q
*/
@Query("{ 'roles.?0' : { $exists: true } }")
Page<PetriNet> findAllByRoleId(String roleId, Pageable pageable);

/**
* Find all active Petri Nets
*
* @param pageable the pagination details
*
* @return a {@link Page} of active {@link PetriNet} entities
* */
Page<PetriNet> findAllByDefaultVersionTrue(Pageable pageable);
}
Loading
Loading