+ * This enumeration defines the possible scopes in which a function can operate.
+ */
public enum FunctionScope {
- NAMESPACE("namespace"),
- PROCESS("process");
+ /**
+ * Represents the process-specific scope of a function.
+ */
+ PROCESS("process"),
+
+ /**
+ * Represents the global scope of a function.
+ */
+ GLOBAL("global");
private final String value;
diff --git a/nae-object-library/src/main/java/com/netgrif/application/engine/objects/petrinet/domain/PetriNet.java b/nae-object-library/src/main/java/com/netgrif/application/engine/objects/petrinet/domain/PetriNet.java
index a8b2fa447c..a2d5627ac5 100644
--- a/nae-object-library/src/main/java/com/netgrif/application/engine/objects/petrinet/domain/PetriNet.java
+++ b/nae-object-library/src/main/java/com/netgrif/application/engine/objects/petrinet/domain/PetriNet.java
@@ -1,5 +1,6 @@
package com.netgrif.application.engine.objects.petrinet.domain;
+import com.netgrif.application.engine.objects.annotations.Indexed;
import com.netgrif.application.engine.objects.auth.domain.ActorRef;
import com.netgrif.application.engine.objects.petrinet.domain.arcs.Arc;
import com.netgrif.application.engine.objects.petrinet.domain.arcs.reference.Referencable;
@@ -30,7 +31,7 @@ public abstract class PetriNet extends PetriNetObject {
@Getter
@Setter
- private String identifier; //combination of identifier and version must be unique ... maybe use @CompoundIndex?
+ private String identifier; // todo: combination of identifier and version must be unique ... maybe use @CompoundIndex?
@Getter
@Setter
@@ -72,6 +73,11 @@ public abstract class PetriNet extends PetriNetObject {
@Setter
private Version version;
+ @Getter
+ @Setter
+ @Indexed
+ private boolean versionActive;
+
@Getter
@Setter
private ActorRef author;
@@ -141,22 +147,23 @@ public PetriNet() {
this.title = new I18nString("");
this.importId = "";
this.version = new Version();
- defaultCaseName = new I18nString("");
- initialized = false;
- creationDate = LocalDateTime.now();
- places = new LinkedHashMap<>();
- transitions = new LinkedHashMap<>();
- arcs = new LinkedHashMap<>();
- dataSet = new LinkedHashMap<>();
- roles = new LinkedHashMap<>();
- negativeViewRoles = new LinkedList<>();
- transactions = new LinkedHashMap<>();
- processEvents = new LinkedHashMap<>();
- caseEvents = new LinkedHashMap<>();
- permissions = new HashMap<>();
- userRefs = new HashMap<>();
- functions = new LinkedList<>();
- tags = new HashMap<>();
+ this.defaultCaseName = new I18nString("");
+ this.initialized = false;
+ this.creationDate = LocalDateTime.now();
+ this.places = new LinkedHashMap<>();
+ this.transitions = new LinkedHashMap<>();
+ this.arcs = new LinkedHashMap<>();
+ this.dataSet = new LinkedHashMap<>();
+ this.roles = new LinkedHashMap<>();
+ this.negativeViewRoles = new LinkedList<>();
+ this.transactions = new LinkedHashMap<>();
+ this.processEvents = new LinkedHashMap<>();
+ this.caseEvents = new LinkedHashMap<>();
+ this.permissions = new HashMap<>();
+ this.userRefs = new HashMap<>();
+ this.functions = new LinkedList<>();
+ this.tags = new HashMap<>();
+ this.makeInactive();
}
public PetriNet(PetriNet petriNet) {
@@ -167,6 +174,7 @@ public PetriNet(PetriNet petriNet) {
this.title = petriNet.getTitle();
this.importId = petriNet.getImportId();
this.version = petriNet.getVersion();
+ this.versionActive = petriNet.isVersionActive();
this.defaultCaseName = petriNet.getDefaultCaseName();
this.defaultCaseNameExpression = petriNet.getDefaultCaseNameExpression();
this.initials = petriNet.getInitials();
@@ -430,6 +438,14 @@ public boolean hasDynamicCaseName() {
return defaultCaseNameExpression != null;
}
+ public void makeActive() {
+ this.setVersionActive(true);
+ }
+
+ public void makeInactive() {
+ this.setVersionActive(false);
+ }
+
@Override
public String getStringId() {
return _id.toString();
diff --git a/nae-object-library/src/main/java/com/netgrif/application/engine/objects/petrinet/domain/version/Version.java b/nae-object-library/src/main/java/com/netgrif/application/engine/objects/petrinet/domain/version/Version.java
index 3c5c2d84be..50dd1f5481 100644
--- a/nae-object-library/src/main/java/com/netgrif/application/engine/objects/petrinet/domain/version/Version.java
+++ b/nae-object-library/src/main/java/com/netgrif/application/engine/objects/petrinet/domain/version/Version.java
@@ -52,6 +52,12 @@ public void increment(VersionType type) {
}
}
+ /**
+ * Compares this version to the other version
+ *
+ * @param other other version to be compared with
+ * @return 0 if the versions equal, <0 if this is lower than other, >0 if this is higher than other0>
+ */
public int compareTo(Version other) {
if (this.major != other.major) {
return Long.compare(this.major, other.major);
@@ -62,6 +68,24 @@ public int compareTo(Version other) {
return Long.compare(this.patch, other.patch);
}
+ /**
+ * Checks if this version is higher than the other
+ * @param other other version to be compared with
+ * @return true if this version is higher than the other
+ */
+ public boolean isHigherThan(Version other) {
+ return compareTo(other) > 0;
+ }
+
+ /**
+ * Checks if this version is lower than the other
+ * @param other other version to be compared with
+ * @return true if this version is lower than the other
+ */
+ public boolean isLowerThan(Version other) {
+ return compareTo(other) < 0;
+ }
+
@Override
public Version clone() {
diff --git a/nae-spring-core-adapter/src/main/java/com/netgrif/application/engine/adapter/spring/petrinet/domain/PetriNet.java b/nae-spring-core-adapter/src/main/java/com/netgrif/application/engine/adapter/spring/petrinet/domain/PetriNet.java
index 7e91f07c13..4076351e98 100644
--- a/nae-spring-core-adapter/src/main/java/com/netgrif/application/engine/adapter/spring/petrinet/domain/PetriNet.java
+++ b/nae-spring-core-adapter/src/main/java/com/netgrif/application/engine/adapter/spring/petrinet/domain/PetriNet.java
@@ -60,6 +60,7 @@ public LinkedHashMap