-
Notifications
You must be signed in to change notification settings - Fork 6
[NAE-2302] Check for process plugin dependencies on deploy #398
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: release/7.0.0-rev9
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -54,6 +54,8 @@ | |
| import java.nio.file.Path; | ||
| import java.util.*; | ||
| import java.util.function.Function; | ||
| import java.util.regex.Matcher; | ||
| import java.util.regex.Pattern; | ||
| import java.util.stream.Collectors; | ||
|
|
||
| @Slf4j | ||
|
|
@@ -67,6 +69,8 @@ public class Importer { | |
| public static final String DEFAULT_FIELD_TEMPLATE = "material"; | ||
| public static final String DEFAULT_FIELD_APPEARANCE = "outline"; | ||
| public static final String DEFAULT_FIELD_ALIGNMENT = null; | ||
| public static final String PLUGIN_STRING_REGEX = "(?<=\\bPlugin\\.)[^.]+"; | ||
| public static final Pattern PLUGIN_STRING_PATTERN = Pattern.compile(PLUGIN_STRING_REGEX); | ||
|
|
||
| @Getter | ||
| protected Document document; | ||
|
|
@@ -222,6 +226,7 @@ protected Optional<PetriNet> createPetriNet() throws MissingPetriNetMetaDataExce | |
| resolveCaseEvents(document.getCaseEvents()); | ||
| evaluateFunctions(); | ||
| actions.forEach(this::evaluateActions); | ||
| net.setPluginDependencies(extractPluginDependencies()); | ||
|
|
||
| if (document.getCaseName() != null && document.getCaseName().isDynamic()) { | ||
| net.setDefaultCaseNameExpression(new Expression(document.getCaseName().getValue())); | ||
|
|
@@ -1343,4 +1348,16 @@ protected Map<String, String> buildTagsMap(List<Tag> tagsList) { | |
| } | ||
| return tags; | ||
| } | ||
|
|
||
| @Transactional | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No need for There is no database interaction in the method |
||
| protected Set<String> extractPluginDependencies() { | ||
| HashSet<String> plugins = new HashSet<>(); | ||
| for (Action action: this.actions.values()) { | ||
| Matcher matcher = PLUGIN_STRING_PATTERN.matcher(action.getDefinition()); | ||
| while (matcher.find()) { | ||
| plugins.add(matcher.group(0)); | ||
| } | ||
| } | ||
| return plugins; | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -134,6 +134,10 @@ public abstract class PetriNet extends PetriNetObject { | |
| @Setter | ||
| private Map<String, String> tags; | ||
|
|
||
| @Getter | ||
| @Setter | ||
| private Set<String> pluginDependencies; | ||
|
Comment on lines
+137
to
+139
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧹 Nitpick | 🔵 Trivial Plugin dependency field looks good; consider defensive copy in copy constructor The new In the copy constructor, though, Consider defensively copying and null‑guarding here: - this.pluginDependencies = petriNet.getPluginDependencies();
+ Set<String> sourcePlugins = petriNet.getPluginDependencies();
+ this.pluginDependencies = sourcePlugins != null
+ ? new HashSet<>(sourcePlugins)
+ : new HashSet<>();This keeps the field non‑null and avoids accidental cross‑net coupling via a shared set. Also applies to: 164-165, 200-200 🤖 Prompt for AI Agents |
||
|
|
||
| public PetriNet() { | ||
| this._id = new ObjectId(); | ||
| this.identifier = "Default"; | ||
|
|
@@ -157,6 +161,7 @@ public PetriNet() { | |
| userRefs = new HashMap<>(); | ||
| functions = new LinkedList<>(); | ||
| tags = new HashMap<>(); | ||
| pluginDependencies = new HashSet<>(); | ||
| } | ||
|
|
||
| public PetriNet(PetriNet petriNet) { | ||
|
|
@@ -192,6 +197,7 @@ public PetriNet(PetriNet petriNet) { | |
| this.defaultRoleEnabled = petriNet.isDefaultRoleEnabled(); | ||
| this.anonymousRoleEnabled = petriNet.isAnonymousRoleEnabled(); | ||
| this.author = petriNet.getAuthor(); | ||
| this.pluginDependencies = petriNet.getPluginDependencies(); | ||
| initializeArcs(); | ||
| } | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.