Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
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
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
Original file line number Diff line number Diff line change
Expand Up @@ -2439,9 +2439,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 @@ -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
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 @@ -54,7 +59,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));
caches.addAll(additional);
return caches;
}
Expand Down
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
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,15 @@ public interface PetriNetRepository extends MongoRepository<PetriNet, String>, Q
*/
PetriNet findByIdentifierAndVersion(String identifier, Version version);

/**
* Finds a {@link PetriNet} entity by its identifier and versionActive attribute
*
* @param identifier the unique identifier of the PetriNet.
* @param versionActive if true, the active version will be found, otherwise the inactive version
* @return the {@link PetriNet} entity matching the given identifier and versionActive attribute, or {@code null} if none found.
*/
PetriNet findByIdentifierAndVersionActive(String identifier, boolean versionActive);

/**
* Finds a paginated list of {@link PetriNet} entities by their identifier.
*
Expand Down
Loading
Loading