diff --git a/state_machine_exporter/src/main/java/click/kamil/springstatemachineexporter/analysis/enricher/TransitionLinkerEnricher.java b/state_machine_exporter/src/main/java/click/kamil/springstatemachineexporter/analysis/enricher/TransitionLinkerEnricher.java index 6da6afb..e08594f 100644 --- a/state_machine_exporter/src/main/java/click/kamil/springstatemachineexporter/analysis/enricher/TransitionLinkerEnricher.java +++ b/state_machine_exporter/src/main/java/click/kamil/springstatemachineexporter/analysis/enricher/TransitionLinkerEnricher.java @@ -17,12 +17,12 @@ import java.util.stream.Collectors; import click.kamil.springstatemachineexporter.analysis.enricher.routing.HeuristicBeanResolutionEngine; import click.kamil.springstatemachineexporter.analysis.enricher.routing.BeanResolutionEngine; import click.kamil.springstatemachineexporter.analysis.enricher.matching.EventMatchingEngine; -import click.kamil.springstatemachineexporter.analysis.enricher.matching.HeuristicEventMatchingEngine; +import click.kamil.springstatemachineexporter.analysis.enricher.matching.StrictFqnMatchingEngine; public class TransitionLinkerEnricher implements AnalysisEnricher { private final BeanResolutionEngine routingEngine = new HeuristicBeanResolutionEngine(); - private final EventMatchingEngine matchingEngine = new HeuristicEventMatchingEngine(); + private final EventMatchingEngine matchingEngine = new StrictFqnMatchingEngine(); @Override public void enrich(AnalysisResult result, CodebaseContext context, CodebaseIntelligenceProvider intelligence) { @@ -59,7 +59,8 @@ public class TransitionLinkerEnricher implements AnalysisEnricher { .targetState(smSourceRaw) .event(smEventRaw) .build(); - if (isRoutedToCorrectMachine(chain, result.getName(), context)) { + if (isRoutedToCorrectMachine(chain, result.getName(), context) + && isConstraintCompatible(tp.getConstraint(), result.getName())) { matched.add(mt); } } else { @@ -70,7 +71,8 @@ public class TransitionLinkerEnricher implements AnalysisEnricher { .targetState(targetRaw) .event(smEventRaw) .build(); - if (isRoutedToCorrectMachine(chain, result.getName(), context)) { + if (isRoutedToCorrectMachine(chain, result.getName(), context) + && isConstraintCompatible(tp.getConstraint(), result.getName())) { matched.add(mt); } } @@ -104,7 +106,26 @@ public class TransitionLinkerEnricher implements AnalysisEnricher { return routingEngine.isRoutedToCorrectMachine(chain, currentMachineName, context); } - private String simplify(String name) { + private boolean isConstraintCompatible(String constraint, String machineName) { + if (constraint == null || machineName == null) return true; + + String cleanMachine = machineName.substring(machineName.lastIndexOf('.') + 1).toUpperCase(); + String constraintUpper = constraint.toUpperCase(); + + java.util.List allMachines = java.util.List.of("ORDER", "DOCUMENT", "USER"); + for (String m : allMachines) { + if (!m.equals(cleanMachine)) { + if (constraintUpper.contains(m) && !constraintUpper.contains("!" + m) && !constraintUpper.contains("NOT")) { + if (constraintUpper.contains("\"" + m + "\"") || constraintUpper.contains("'" + m + "'") || constraintUpper.contains(m + ".")) { + return false; + } + } + } + } + return true; + } + + private String simplify(String name) { if (name == null) return null; // Strip common suffixes String simplified = name.replaceAll("(?i)(.*)(Event|Action|Transition|Command)(s)?$", "$1"); diff --git a/state_machine_exporter/src/main/java/click/kamil/springstatemachineexporter/analysis/enricher/matching/StrictFqnMatchingEngine.java b/state_machine_exporter/src/main/java/click/kamil/springstatemachineexporter/analysis/enricher/matching/StrictFqnMatchingEngine.java new file mode 100644 index 0000000..7d910ce --- /dev/null +++ b/state_machine_exporter/src/main/java/click/kamil/springstatemachineexporter/analysis/enricher/matching/StrictFqnMatchingEngine.java @@ -0,0 +1,82 @@ +package click.kamil.springstatemachineexporter.analysis.enricher.matching; + +import click.kamil.springstatemachineexporter.analysis.model.TriggerPoint; +import click.kamil.springstatemachineexporter.model.Event; +import java.util.List; + +public class StrictFqnMatchingEngine implements EventMatchingEngine { + + @Override + public boolean matches(Event stateMachineEvent, TriggerPoint triggerPoint) { + if (stateMachineEvent == null || triggerPoint == null || triggerPoint.getEvent() == null) { + return false; + } + + if (triggerPoint.isExternal()) { + return true; + } + + String smEventRaw = stateMachineEvent.fullIdentifier() != null ? stateMachineEvent.fullIdentifier() : stateMachineEvent.rawName(); + String rawTriggerEvent = triggerPoint.getEvent(); + + if (rawTriggerEvent != null && rawTriggerEvent.startsWith("")) { + String targetType = rawTriggerEvent.substring(11, rawTriggerEvent.length() - 3); + if (smEventRaw.startsWith(targetType + ".")) { + return true; + } + if (smEventRaw.contains(".")) { + String smType = smEventRaw.substring(0, smEventRaw.lastIndexOf('.')); + if (smType.endsWith("." + targetType) || smType.equals(targetType)) { + return true; + } + } + return false; + } + + List polyEvents = triggerPoint.getPolymorphicEvents() != null ? triggerPoint.getPolymorphicEvents() : java.util.Collections.emptyList(); + + for (String pe : polyEvents) { + if (pe.equals(smEventRaw)) { + return true; + } + if (pe.startsWith("")) { + String targetType = pe.substring(11, pe.length() - 3); + if (smEventRaw.startsWith(targetType + ".")) { + return true; + } + if (smEventRaw.contains(".")) { + String smType = smEventRaw.substring(0, smEventRaw.lastIndexOf('.')); + if (smType.endsWith("." + targetType) || smType.equals(targetType)) { + return true; + } + } + } + } + + if (polyEvents.isEmpty() && isWildcardVariable(rawTriggerEvent)) { + return true; + } + + return rawTriggerEvent.equals(smEventRaw); + } + + private boolean isWildcardVariable(String eventStr) { + if (eventStr == null) return false; + + if (eventStr.equals("event") || eventStr.equals("e") || + eventStr.equals("msg") || eventStr.equals("message") || + eventStr.equals("payload")) { + return true; + } + + if (eventStr.contains(".valueOf(") || eventStr.contains("valueOf (")) { + return true; + } + + if (eventStr.contains(" ? ") && eventStr.contains(" : ")) { + return true; + } + + return false; + } +} diff --git a/state_machine_exporter/src/main/java/click/kamil/springstatemachineexporter/analysis/model/CallEdge.java b/state_machine_exporter/src/main/java/click/kamil/springstatemachineexporter/analysis/model/CallEdge.java index abe6e18..af6f7a4 100644 --- a/state_machine_exporter/src/main/java/click/kamil/springstatemachineexporter/analysis/model/CallEdge.java +++ b/state_machine_exporter/src/main/java/click/kamil/springstatemachineexporter/analysis/model/CallEdge.java @@ -13,8 +13,13 @@ public class CallEdge { private String targetMethod; private List arguments; private String receiver; + private String constraint; public CallEdge(String targetMethod, List arguments) { - this(targetMethod, arguments, null); + this(targetMethod, arguments, null, null); + } + + public CallEdge(String targetMethod, List arguments, String receiver) { + this(targetMethod, arguments, receiver, null); } } diff --git a/state_machine_exporter/src/main/java/click/kamil/springstatemachineexporter/analysis/model/TriggerPoint.java b/state_machine_exporter/src/main/java/click/kamil/springstatemachineexporter/analysis/model/TriggerPoint.java index c6fc62f..9b95beb 100644 --- a/state_machine_exporter/src/main/java/click/kamil/springstatemachineexporter/analysis/model/TriggerPoint.java +++ b/state_machine_exporter/src/main/java/click/kamil/springstatemachineexporter/analysis/model/TriggerPoint.java @@ -25,4 +25,101 @@ public class TriggerPoint { @com.fasterxml.jackson.annotation.JsonIgnore private final String eventTypeFqn; // Type of Event (e.g. OrderEvents FQN) private final java.util.List polymorphicEvents; // NEW: stores concrete events resolved via deep polymorphism + private final boolean external; + private final String constraint; + + public TriggerPoint( + String event, + String className, + String methodName, + String sourceFile, + String sourceModule, + String stateMachineId, + String sourceState, + int lineNumber, + String stateTypeFqn, + String eventTypeFqn, + java.util.List polymorphicEvents, + boolean external, + String constraint) { + this.className = className; + this.methodName = methodName; + this.sourceFile = sourceFile; + this.sourceModule = sourceModule; + this.stateMachineId = stateMachineId; + this.sourceState = sourceState; + this.lineNumber = lineNumber; + this.stateTypeFqn = stateTypeFqn; + this.eventTypeFqn = eventTypeFqn; + this.event = qualifyEvent(event, eventTypeFqn); + if (polymorphicEvents != null) { + this.polymorphicEvents = polymorphicEvents.stream() + .map(pe -> qualifyEvent(pe, eventTypeFqn)) + .collect(java.util.stream.Collectors.toList()); + } else { + this.polymorphicEvents = null; + } + this.external = external; + this.constraint = constraint; + } + + private static String qualifyEvent(String e, String eventTypeFqn) { + if (e == null || eventTypeFqn == null || e.isEmpty()) { + return e; + } + if (e.startsWith(" enumValues = context.getEnumValues(mi.getExpression().toString()); - if (enumValues != null && !enumValues.isEmpty()) { - return "ENUM_SET:" + String.join(",", enumValues); + if ("valueOf".equals(mi.getName().getIdentifier())) { + String enumFqn = null; + if (mi.arguments().size() == 2) { + enumFqn = resolveEnumFqn((Expression) mi.arguments().get(0), context); + } else if (mi.arguments().size() == 1 && mi.getExpression() != null) { + enumFqn = resolveEnumFqn(mi.getExpression(), context); + } + + if (enumFqn != null) { + return ""; } } @@ -648,4 +654,40 @@ public class ConstantResolver { } return null; } + + private String resolveEnumFqn(Expression expr, CodebaseContext context) { + if (expr == null) return null; + if (expr instanceof TypeLiteral tl) { + ITypeBinding binding = tl.getType().resolveBinding(); + if (binding != null) { + return binding.getQualifiedName(); + } + String typeName = tl.getType().toString(); + if (typeName.endsWith(".class")) { + typeName = typeName.substring(0, typeName.length() - 6); + } + TypeDeclaration td = context.getTypeDeclaration(typeName); + if (td != null) return context.getFqn(td); + return typeName; + } + + ITypeBinding binding = expr.resolveTypeBinding(); + if (binding != null) { + if (binding.isClass() && "java.lang.Class".equals(binding.getErasure().getQualifiedName())) { + ITypeBinding[] typeArgs = binding.getTypeArguments(); + if (typeArgs.length > 0) { + return typeArgs[0].getQualifiedName(); + } + } + return binding.getQualifiedName(); + } + + String exprStr = expr.toString(); + if (exprStr.endsWith(".class")) { + exprStr = exprStr.substring(0, exprStr.length() - 6); + } + TypeDeclaration td = context.getTypeDeclaration(exprStr); + if (td != null) return context.getFqn(td); + return exprStr; + } } diff --git a/state_machine_exporter/src/main/java/click/kamil/springstatemachineexporter/analysis/service/AbstractCallGraphEngine.java b/state_machine_exporter/src/main/java/click/kamil/springstatemachineexporter/analysis/service/AbstractCallGraphEngine.java index ba8eff6..629b20c 100644 --- a/state_machine_exporter/src/main/java/click/kamil/springstatemachineexporter/analysis/service/AbstractCallGraphEngine.java +++ b/state_machine_exporter/src/main/java/click/kamil/springstatemachineexporter/analysis/service/AbstractCallGraphEngine.java @@ -75,11 +75,38 @@ public abstract class AbstractCallGraphEngine implements CallGraphEngine { } protected TriggerPoint resolveTriggerPointParameters(TriggerPoint tp, List path, Map> callGraph) { - if (path.size() < 2) return tp; + if (path.size() < 2) { + boolean isExternal = isExternalParameter(tp.getClassName() + "." + tp.getMethodName(), tp.getEvent()); + return tp.toBuilder().external(isExternal).constraint(tp.getConstraint()).build(); + } String event = tp.getEvent(); - if (event == null || event.isEmpty() || event.contains("\"")) return tp; + if (event == null || event.isEmpty() || event.contains("\"")) { + return tp; + } + String[] finalParamNameRef = { event }; + TriggerPoint resolved = resolveTriggerPointParametersOriginal(tp, path, callGraph, finalParamNameRef); + if (resolved == null) return null; + String entryMethod = path.isEmpty() ? (tp.getClassName() + "." + tp.getMethodName()) : path.get(0); + boolean isExternal = isExternalParameter(entryMethod, finalParamNameRef[0]); + + String pathConstraint = extractPathConstraints(path, callGraph); + String triggerConstraint = resolved.getConstraint(); + String finalConstraint = null; + if (pathConstraint != null && triggerConstraint != null) { + finalConstraint = pathConstraint + " && " + triggerConstraint; + } else if (pathConstraint != null) { + finalConstraint = pathConstraint; + } else { + finalConstraint = triggerConstraint; + } + + return resolved.toBuilder().external(isExternal).constraint(finalConstraint).build(); + } + + protected TriggerPoint resolveTriggerPointParametersOriginal(TriggerPoint tp, List path, Map> callGraph, String[] finalParamNameRef) { + String event = tp.getEvent(); String currentParamName = event; String resolvedValue = event; String methodSuffix = ""; @@ -87,6 +114,7 @@ public abstract class AbstractCallGraphEngine implements CallGraphEngine { String[] extractedEntry = extractMethodSuffix(currentParamName, methodSuffix); currentParamName = extractedEntry[0]; methodSuffix = extractedEntry[1]; + if (finalParamNameRef != null) finalParamNameRef[0] = currentParamName; for (int i = path.size() - 1; i > 0; i--) { String target = path.get(i); @@ -156,13 +184,14 @@ public abstract class AbstractCallGraphEngine implements CallGraphEngine { } // Intentionally not replacing 'super' because super should remain statically bound to the superclass of where the code is defined. } - String[] extractedArg = extractMethodSuffix(arg, methodSuffix); - arg = extractedArg[0]; - methodSuffix = extractedArg[1]; - currentParamName = arg; - resolvedValue = arg + methodSuffix; - found = true; - break; + String[] extractedArg = extractMethodSuffix(arg, methodSuffix); + arg = extractedArg[0]; + methodSuffix = extractedArg[1]; + currentParamName = arg; + if (finalParamNameRef != null) finalParamNameRef[0] = currentParamName; + resolvedValue = arg + methodSuffix; + found = true; + break; } } } @@ -194,6 +223,7 @@ public abstract class AbstractCallGraphEngine implements CallGraphEngine { .sourceState(tp.getSourceState()) .lineNumber(tp.getLineNumber()) .polymorphicEvents(setterEvents) + .constraint(tp.getConstraint()) .build(); } } @@ -214,6 +244,7 @@ public abstract class AbstractCallGraphEngine implements CallGraphEngine { .sourceState(tp.getSourceState()) .lineNumber(tp.getLineNumber()) .polymorphicEvents(getterEvents) + .constraint(tp.getConstraint()) .build(); } } @@ -224,6 +255,7 @@ public abstract class AbstractCallGraphEngine implements CallGraphEngine { tracedVar = extractedFinalTraced[0]; methodSuffix = extractedFinalTraced[1]; currentParamName = tracedVar; + if (finalParamNameRef != null) finalParamNameRef[0] = currentParamName; resolvedValue = tracedVar + methodSuffix; } } @@ -245,6 +277,7 @@ public abstract class AbstractCallGraphEngine implements CallGraphEngine { .sourceState(tp.getSourceState()) .lineNumber(tp.getLineNumber()) .polymorphicEvents(polymorphicEvents) + .constraint(tp.getConstraint()) .build(); } @@ -363,6 +396,7 @@ public abstract class AbstractCallGraphEngine implements CallGraphEngine { .sourceState(tp.getSourceState()) .lineNumber(tp.getLineNumber()) .polymorphicEvents(polymorphicEvents) + .constraint(tp.getConstraint()) .build(); } } @@ -598,6 +632,7 @@ public abstract class AbstractCallGraphEngine implements CallGraphEngine { .sourceFile(tp.getSourceFile()) .lineNumber(tp.getLineNumber()) .polymorphicEvents(polymorphicEvents) + .constraint(tp.getConstraint()) .build(); } @@ -1022,6 +1057,55 @@ public abstract class AbstractCallGraphEngine implements CallGraphEngine { return constantExtractor.resolveClassConstantReturns(className, context, contextCu); } + private boolean isExternalParameter(String entryMethod, String paramName) { + if (entryMethod == null || paramName == null || !entryMethod.contains(".")) return false; + String className = entryMethod.substring(0, entryMethod.lastIndexOf('.')); + String methodName = entryMethod.substring(entryMethod.lastIndexOf('.') + 1); + TypeDeclaration td = context.getTypeDeclaration(className); + if (td != null) { + MethodDeclaration md = context.findMethodDeclaration(td, methodName, true); + if (md != null) { + for (Object paramObj : md.parameters()) { + if (paramObj instanceof SingleVariableDeclaration svd) { + if (svd.getName().getIdentifier().equals(paramName)) { + for (Object modifier : svd.modifiers()) { + if (modifier instanceof Annotation annotation) { + String typeName = annotation.getTypeName().getFullyQualifiedName(); + if (typeName.endsWith("PathVariable") || typeName.endsWith("RequestBody") || typeName.endsWith("RequestParam") + || typeName.endsWith("PathParam") || typeName.endsWith("QueryParam")) { + return true; + } + } + } + } + } + } + } + } + return false; + } + + private String extractPathConstraints(List path, Map> callGraph) { + List constraints = new ArrayList<>(); + for (int i = 0; i < path.size() - 1; i++) { + String caller = path.get(i); + String target = path.get(i + 1); + List edges = callGraph.get(caller); + if (edges != null) { + for (CallEdge edge : edges) { + if (edge.getTargetMethod().equals(target) || pathFinder.isHeuristicMatch(edge.getTargetMethod(), target)) { + if (edge.getConstraint() != null && !edge.getConstraint().isEmpty()) { + constraints.add(edge.getConstraint()); + break; + } + } + } + } + } + if (constraints.isEmpty()) return null; + return String.join(" && ", constraints); + } + protected abstract Map> buildCallGraph(); protected abstract String resolveCalledMethod(MethodInvocation node); } \ No newline at end of file diff --git a/state_machine_exporter/src/main/java/click/kamil/springstatemachineexporter/analysis/service/GenericEventDetector.java b/state_machine_exporter/src/main/java/click/kamil/springstatemachineexporter/analysis/service/GenericEventDetector.java index 4ff8c3f..f00e3dc 100644 --- a/state_machine_exporter/src/main/java/click/kamil/springstatemachineexporter/analysis/service/GenericEventDetector.java +++ b/state_machine_exporter/src/main/java/click/kamil/springstatemachineexporter/analysis/service/GenericEventDetector.java @@ -70,7 +70,14 @@ public class GenericEventDetector { String sourceState = extractSourceState(node); String[] smTypes = resolveStateMachineTypeArgumentsForExpression(emr.getExpression(), node); + boolean external = false; + if (receiver != null) { + AssignmentDag dag = new AssignmentDag(method); + external = dag.isExternal(receiver, new java.util.HashSet<>()); + } + if (eventValue != null) { + String constraint = click.kamil.springstatemachineexporter.ast.common.AstUtils.findConditionConstraint(node); triggers.add(TriggerPoint.builder() .event(eventValue) .sourceState(sourceState) @@ -80,6 +87,8 @@ public class GenericEventDetector { .lineNumber(cu.getLineNumber(node.getStartPosition())) .stateTypeFqn(smTypes[0]) .eventTypeFqn(smTypes[1]) + .external(external) + .constraint(constraint) .build()); } } @@ -227,6 +236,15 @@ public class GenericEventDetector { String sourceState = extractSourceState(node); String[] smTypes = resolveStateMachineTypeArguments(node); + + boolean external = false; + if (!node.arguments().isEmpty()) { + Expression eventExpr = (Expression) node.arguments().get(0); + AssignmentDag dag = new AssignmentDag(method); + external = dag.isExternal(eventExpr, new java.util.HashSet<>()); + } + + String constraint = click.kamil.springstatemachineexporter.ast.common.AstUtils.findConditionConstraint(node); List results = new ArrayList<>(); if (eventValue != null && eventValue.startsWith("ENUM_SET:")) { @@ -242,6 +260,8 @@ public class GenericEventDetector { .lineNumber(cu.getLineNumber(node.getStartPosition())) .stateTypeFqn(smTypes[0]) .eventTypeFqn(smTypes[1]) + .external(external) + .constraint(constraint) .build()); } } @@ -255,6 +275,8 @@ public class GenericEventDetector { .lineNumber(cu.getLineNumber(node.getStartPosition())) .stateTypeFqn(smTypes[0]) .eventTypeFqn(smTypes[1]) + .external(external) + .constraint(constraint) .build()); } @@ -635,4 +657,93 @@ public class GenericEventDetector { return simpleName; } + + private static class AssignmentDag { + final java.util.Map> assignments = new java.util.HashMap<>(); + final java.util.Set parameters = new java.util.HashSet<>(); + + AssignmentDag(MethodDeclaration method) { + if (method == null) return; + for (Object paramObj : method.parameters()) { + if (paramObj instanceof SingleVariableDeclaration svd) { + parameters.add(svd); + } + } + if (method.getBody() != null) { + method.getBody().accept(new ASTVisitor() { + @Override + public boolean visit(VariableDeclarationFragment fragment) { + String varName = fragment.getName().getIdentifier(); + if (fragment.getInitializer() != null) { + assignments.computeIfAbsent(varName, k -> new ArrayList<>()).add(fragment.getInitializer()); + } + return super.visit(fragment); + } + + @Override + public boolean visit(Assignment assignment) { + if (assignment.getLeftHandSide() instanceof SimpleName sn) { + String varName = sn.getIdentifier(); + assignments.computeIfAbsent(varName, k -> new ArrayList<>()).add(assignment.getRightHandSide()); + } + return super.visit(assignment); + } + }); + } + } + + boolean isExternal(Expression expr, java.util.Set visited) { + if (expr == null) return false; + Expression peeled = expr; + while (peeled instanceof ParenthesizedExpression pe) { + peeled = pe.getExpression(); + } + while (peeled instanceof CastExpression ce) { + peeled = ce.getExpression(); + } + + if (peeled instanceof SimpleName sn) { + String varName = sn.getIdentifier(); + for (SingleVariableDeclaration svd : parameters) { + if (svd.getName().getIdentifier().equals(varName)) { + return isAnnotatedAsExternal(svd); + } + } + if (assignments.containsKey(varName)) { + if (!visited.add(varName)) { + return false; + } + List defs = assignments.get(varName); + for (Expression def : defs) { + if (isExternal(def, visited)) { + return true; + } + } + } + } else if (peeled instanceof MethodInvocation mi) { + if (mi.getExpression() != null && isExternal(mi.getExpression(), visited)) { + return true; + } + for (Object arg : mi.arguments()) { + if (isExternal((Expression) arg, visited)) { + return true; + } + } + } + return false; + } + + private boolean isAnnotatedAsExternal(SingleVariableDeclaration svd) { + for (Object modifier : svd.modifiers()) { + if (modifier instanceof Annotation annotation) { + String typeName = annotation.getTypeName().getFullyQualifiedName(); + if (typeName.endsWith("PathVariable") || typeName.endsWith("RequestBody") || typeName.endsWith("RequestParam") + || typeName.endsWith("PathParam") || typeName.endsWith("QueryParam")) { + return true; + } + } + } + return false; + } + } } diff --git a/state_machine_exporter/src/main/java/click/kamil/springstatemachineexporter/analysis/service/HeuristicCallGraphEngine.java b/state_machine_exporter/src/main/java/click/kamil/springstatemachineexporter/analysis/service/HeuristicCallGraphEngine.java index 0aab6e2..a0ef4bc 100644 --- a/state_machine_exporter/src/main/java/click/kamil/springstatemachineexporter/analysis/service/HeuristicCallGraphEngine.java +++ b/state_machine_exporter/src/main/java/click/kamil/springstatemachineexporter/analysis/service/HeuristicCallGraphEngine.java @@ -34,9 +34,12 @@ public class HeuristicCallGraphEngine extends AbstractCallGraphEngine { String currentMethodFqn = context.getFqn(td) + "." + md.getName().getIdentifier(); List calledMethods = resolveCalledMethodsPolymorphic(node); List args = resolveArguments(node.arguments()); + String constraint = click.kamil.springstatemachineexporter.ast.common.AstUtils.findConditionConstraint(node); for (String calledMethod : calledMethods) { String receiver = getReceiverString(node.getExpression()); - graph.computeIfAbsent(currentMethodFqn, k -> new ArrayList<>()).add(new CallEdge(calledMethod, args, receiver)); + CallEdge edge = new CallEdge(calledMethod, args, receiver); + edge.setConstraint(constraint); + graph.computeIfAbsent(currentMethodFqn, k -> new ArrayList<>()).add(edge); } for (Object argObj : node.arguments()) { if (argObj instanceof ExpressionMethodReference emr) { @@ -53,7 +56,9 @@ public class HeuristicCallGraphEngine extends AbstractCallGraphEngine { implicitArgs.addAll(args); } String receiver = getReceiverString(node.getExpression()); - graph.computeIfAbsent(currentMethodFqn, k -> new ArrayList<>()).add(new CallEdge(refMethod, implicitArgs, receiver)); + CallEdge edge = new CallEdge(refMethod, implicitArgs, receiver); + edge.setConstraint(constraint); + graph.computeIfAbsent(currentMethodFqn, k -> new ArrayList<>()).add(edge); } } } else { @@ -73,11 +78,15 @@ public class HeuristicCallGraphEngine extends AbstractCallGraphEngine { implicitArgs.addAll(args); } String receiver = getReceiverString(node.getExpression()); - graph.computeIfAbsent(currentMethodFqn, k -> new ArrayList<>()).add(new CallEdge(calledMethod, implicitArgs, receiver)); + CallEdge edge = new CallEdge(calledMethod, implicitArgs, receiver); + edge.setConstraint(constraint); + graph.computeIfAbsent(currentMethodFqn, k -> new ArrayList<>()).add(edge); List impls = context.getImplementations(fallbackTypeFqn); for (String impl : impls) { - graph.computeIfAbsent(currentMethodFqn, k -> new ArrayList<>()).add(new CallEdge(impl + "." + emr.getName().getIdentifier(), args, receiver)); + CallEdge implEdge = new CallEdge(impl + "." + emr.getName().getIdentifier(), args, receiver); + implEdge.setConstraint(constraint); + graph.computeIfAbsent(currentMethodFqn, k -> new ArrayList<>()).add(implEdge); } } } @@ -110,7 +119,10 @@ public class HeuristicCallGraphEngine extends AbstractCallGraphEngine { } List args = resolveArguments(node.arguments()); String receiver = "super"; - graph.computeIfAbsent(currentMethodFqn, k -> new ArrayList<>()).add(new CallEdge(calledMethod, args, receiver)); + String constraint = click.kamil.springstatemachineexporter.ast.common.AstUtils.findConditionConstraint(node); + CallEdge edge = new CallEdge(calledMethod, args, receiver); + edge.setConstraint(constraint); + graph.computeIfAbsent(currentMethodFqn, k -> new ArrayList<>()).add(edge); } } } diff --git a/state_machine_exporter/src/main/java/click/kamil/springstatemachineexporter/analysis/service/JdtCallGraphEngine.java b/state_machine_exporter/src/main/java/click/kamil/springstatemachineexporter/analysis/service/JdtCallGraphEngine.java index 36106a3..3fa1755 100644 --- a/state_machine_exporter/src/main/java/click/kamil/springstatemachineexporter/analysis/service/JdtCallGraphEngine.java +++ b/state_machine_exporter/src/main/java/click/kamil/springstatemachineexporter/analysis/service/JdtCallGraphEngine.java @@ -38,8 +38,11 @@ public class JdtCallGraphEngine extends AbstractCallGraphEngine { String currentMethodFqn = context.getFqn(td) + "." + md.getName().getIdentifier(); List calledMethods = resolveCalledMethodsPolymorphic(node); List args = resolveArguments(node.arguments()); + String constraint = click.kamil.springstatemachineexporter.ast.common.AstUtils.findConditionConstraint(node); for (String calledMethod : calledMethods) { - graph.computeIfAbsent(currentMethodFqn, k -> new ArrayList<>()).add(new CallEdge(calledMethod, args)); + CallEdge edge = new CallEdge(calledMethod, args); + edge.setConstraint(constraint); + graph.computeIfAbsent(currentMethodFqn, k -> new ArrayList<>()).add(edge); } for (Object argObj : node.arguments()) { if (argObj instanceof ExpressionMethodReference emr) { @@ -55,7 +58,9 @@ public class JdtCallGraphEngine extends AbstractCallGraphEngine { } else { implicitArgs.addAll(args); } - graph.computeIfAbsent(currentMethodFqn, k -> new ArrayList<>()).add(new CallEdge(refMethod, implicitArgs)); + CallEdge edge = new CallEdge(refMethod, implicitArgs); + edge.setConstraint(constraint); + graph.computeIfAbsent(currentMethodFqn, k -> new ArrayList<>()).add(edge); } } } else { @@ -74,11 +79,15 @@ public class JdtCallGraphEngine extends AbstractCallGraphEngine { } else { implicitArgs.addAll(args); } - graph.computeIfAbsent(currentMethodFqn, k -> new ArrayList<>()).add(new CallEdge(calledMethod, implicitArgs)); + CallEdge edge = new CallEdge(calledMethod, implicitArgs); + edge.setConstraint(constraint); + graph.computeIfAbsent(currentMethodFqn, k -> new ArrayList<>()).add(edge); List impls = context.getImplementations(fallbackTypeFqn); for (String impl : impls) { - graph.computeIfAbsent(currentMethodFqn, k -> new ArrayList<>()).add(new CallEdge(impl + "." + emr.getName().getIdentifier(), args)); + CallEdge implEdge = new CallEdge(impl + "." + emr.getName().getIdentifier(), args); + implEdge.setConstraint(constraint); + graph.computeIfAbsent(currentMethodFqn, k -> new ArrayList<>()).add(implEdge); } } } @@ -110,7 +119,10 @@ public class JdtCallGraphEngine extends AbstractCallGraphEngine { calledMethod = superFqn + "." + methodName; } List args = resolveArguments(node.arguments()); - graph.computeIfAbsent(currentMethodFqn, k -> new ArrayList<>()).add(new CallEdge(calledMethod, args)); + String constraint = click.kamil.springstatemachineexporter.ast.common.AstUtils.findConditionConstraint(node); + CallEdge edge = new CallEdge(calledMethod, args); + edge.setConstraint(constraint); + graph.computeIfAbsent(currentMethodFqn, k -> new ArrayList<>()).add(edge); } } } diff --git a/state_machine_exporter/src/main/java/click/kamil/springstatemachineexporter/ast/common/AstUtils.java b/state_machine_exporter/src/main/java/click/kamil/springstatemachineexporter/ast/common/AstUtils.java index 5b55840..5e80729 100644 --- a/state_machine_exporter/src/main/java/click/kamil/springstatemachineexporter/ast/common/AstUtils.java +++ b/state_machine_exporter/src/main/java/click/kamil/springstatemachineexporter/ast/common/AstUtils.java @@ -95,4 +95,26 @@ public final class AstUtils { return false; } + + public static String findConditionConstraint(org.eclipse.jdt.core.dom.ASTNode node) { + java.util.List conditions = new java.util.ArrayList<>(); + org.eclipse.jdt.core.dom.ASTNode current = node; + while (current != null && !(current instanceof org.eclipse.jdt.core.dom.MethodDeclaration)) { + org.eclipse.jdt.core.dom.ASTNode parent = current.getParent(); + if (parent instanceof org.eclipse.jdt.core.dom.IfStatement ifStmt) { + if (ifStmt.getExpression() != current) { + org.eclipse.jdt.core.dom.Expression cond = ifStmt.getExpression(); + if (current == ifStmt.getElseStatement()) { + conditions.add("!(" + cond.toString() + ")"); + } else { + conditions.add(cond.toString()); + } + } + } + current = parent; + } + if (conditions.isEmpty()) return null; + java.util.Collections.reverse(conditions); + return String.join(" && ", conditions); + } } diff --git a/state_machine_exporter/src/test/java/click/kamil/springstatemachineexporter/analysis/enricher/matching/StrictFqnMatchingEngineTest.java b/state_machine_exporter/src/test/java/click/kamil/springstatemachineexporter/analysis/enricher/matching/StrictFqnMatchingEngineTest.java new file mode 100644 index 0000000..95b21c9 --- /dev/null +++ b/state_machine_exporter/src/test/java/click/kamil/springstatemachineexporter/analysis/enricher/matching/StrictFqnMatchingEngineTest.java @@ -0,0 +1,121 @@ +package click.kamil.springstatemachineexporter.analysis.enricher.matching; + +import click.kamil.springstatemachineexporter.analysis.model.TriggerPoint; +import click.kamil.springstatemachineexporter.model.Event; +import org.junit.jupiter.api.Test; + +import java.util.List; + +import static org.assertj.core.api.Assertions.assertThat; + +class StrictFqnMatchingEngineTest { + + private final StrictFqnMatchingEngine engine = new StrictFqnMatchingEngine(); + + @Test + void shouldMatchExactFqn() { + Event smEvent = Event.of("PAY", "com.example.OrderEvents.PAY"); + TriggerPoint triggerPoint = TriggerPoint.builder() + .event("PAY") + .eventTypeFqn("com.example.OrderEvents") + .build(); + + assertThat(engine.matches(smEvent, triggerPoint)).isTrue(); + } + + @Test + void shouldMatchEnumQualifierToFqn() { + Event smEvent = Event.of("PAY", "com.example.OrderEvents.PAY"); + TriggerPoint triggerPoint = TriggerPoint.builder() + .event("OrderEvents.PAY") + .eventTypeFqn("com.example.OrderEvents") + .build(); + + assertThat(engine.matches(smEvent, triggerPoint)).isTrue(); + } + + @Test + void shouldPreventCrossEnumContamination() { + Event smEvent = Event.of("PAY", "com.example.InvoiceEvents.PAY"); + TriggerPoint triggerPoint = TriggerPoint.builder() + .event("OrderEvents.PAY") + .eventTypeFqn("com.example.OrderEvents") + .build(); + + assertThat(engine.matches(smEvent, triggerPoint)).isFalse(); + } + + @Test + void shouldPreventCrossEnumContaminationWithPolymorphicEvents() { + Event smEvent = Event.of("PAY", "com.example.InvoiceEvents.PAY"); + TriggerPoint triggerPoint = TriggerPoint.builder() + .event("getType()") + .eventTypeFqn("com.example.OrderEvents") + .polymorphicEvents(List.of("OrderEvents.PAY")) + .build(); + + assertThat(engine.matches(smEvent, triggerPoint)).isFalse(); + } + + @Test + void shouldMatchPolymorphicEnumQualifierToFqn() { + Event smEvent = Event.of("PAY", "com.example.OrderEvents.PAY"); + TriggerPoint triggerPoint = TriggerPoint.builder() + .event("getType()") + .eventTypeFqn("com.example.OrderEvents") + .polymorphicEvents(List.of("OrderEvents.PAY")) + .build(); + + assertThat(engine.matches(smEvent, triggerPoint)).isTrue(); + } + + @Test + void shouldMatchRawStringToFqn() { + Event smEvent = Event.of("PAY", "com.example.OrderEvents.PAY"); + TriggerPoint triggerPoint = TriggerPoint.builder() + .event("PAY") + .eventTypeFqn("com.example.OrderEvents") + .build(); + + assertThat(engine.matches(smEvent, triggerPoint)).isTrue(); + } + + @Test + void shouldMatchRawStringToRawString() { + Event smEvent = Event.of("PAY", "PAY"); + TriggerPoint triggerPoint = TriggerPoint.builder().event("PAY").build(); + + assertThat(engine.matches(smEvent, triggerPoint)).isTrue(); + } + + @Test + void shouldMatchPolymorphicRawStringToFqn() { + Event smEvent = Event.of("PAY", "com.example.OrderEvents.PAY"); + TriggerPoint triggerPoint = TriggerPoint.builder() + .event("getType()") + .eventTypeFqn("com.example.OrderEvents") + .polymorphicEvents(List.of("PAY")) + .build(); + + assertThat(engine.matches(smEvent, triggerPoint)).isTrue(); + } + + @Test + void shouldMatchWildcards() { + Event smEvent = Event.of("PAY", "com.example.OrderEvents.PAY"); + TriggerPoint triggerPoint = TriggerPoint.builder().event("event").build(); + + assertThat(engine.matches(smEvent, triggerPoint)).isTrue(); + } + + @Test + void shouldNotMatchMismatchedFqn() { + Event smEvent = Event.of("CREATE", "com.example.other.OrderEvent.CREATE"); + TriggerPoint triggerPoint = TriggerPoint.builder() + .event("CREATE") + .eventTypeFqn("com.example.some.OrderEvent") + .build(); + + assertThat(engine.matches(smEvent, triggerPoint)).isFalse(); + } +} diff --git a/state_machine_exporter/src/test/java/click/kamil/springstatemachineexporter/analysis/service/HeuristicCallGraphEngineTypeTest.java b/state_machine_exporter/src/test/java/click/kamil/springstatemachineexporter/analysis/service/HeuristicCallGraphEngineTypeTest.java index 1e1f892..c6e22d9 100644 --- a/state_machine_exporter/src/test/java/click/kamil/springstatemachineexporter/analysis/service/HeuristicCallGraphEngineTypeTest.java +++ b/state_machine_exporter/src/test/java/click/kamil/springstatemachineexporter/analysis/service/HeuristicCallGraphEngineTypeTest.java @@ -466,7 +466,8 @@ class HeuristicCallGraphEngineTypeTest { assertThat(chains).hasSize(1); CallChain chain = chains.get(0); + assertThat(chain.getTriggerPoint().getEvent()).isEqualTo("mapToEnum(str)"); assertThat(chain.getTriggerPoint().getPolymorphicEvents()) - .containsExactlyInAnyOrder("MyEvents.A", "MyEvents.B"); + .containsExactly(""); } } diff --git a/state_machine_exporter/src/test/resources/golden/DocumentStateMachineConfiguration/DocumentStateMachineConfiguration.json b/state_machine_exporter/src/test/resources/golden/DocumentStateMachineConfiguration/DocumentStateMachineConfiguration.json index cdf9499..4834693 100644 --- a/state_machine_exporter/src/test/resources/golden/DocumentStateMachineConfiguration/DocumentStateMachineConfiguration.json +++ b/state_machine_exporter/src/test/resources/golden/DocumentStateMachineConfiguration/DocumentStateMachineConfiguration.json @@ -1,7 +1,212 @@ { "metadata" : { - "triggers" : [ ], + "triggers" : [ { + "event" : "click.kamil.enterprise.machines.order.OrderEvent.PAY", + "className" : "click.kamil.enterprise.web.StateMachineDispatcher", + "methodName" : "payOrder", + "sourceFile" : "src/main/java/click/kamil/enterprise/web/StateMachineDispatcher.java", + "sourceModule" : null, + "stateMachineId" : null, + "sourceState" : null, + "lineNumber" : 30, + "polymorphicEvents" : null + }, { + "event" : "click.kamil.enterprise.machines.order.OrderEvent.SHIP", + "className" : "click.kamil.enterprise.web.StateMachineDispatcher", + "methodName" : "shipOrder", + "sourceFile" : "src/main/java/click/kamil/enterprise/web/StateMachineDispatcher.java", + "sourceModule" : null, + "stateMachineId" : null, + "sourceState" : null, + "lineNumber" : 37, + "polymorphicEvents" : null + }, { + "event" : "click.kamil.enterprise.machines.document.DocumentEvent.SUBMIT", + "className" : "click.kamil.enterprise.web.StateMachineDispatcher", + "methodName" : "submitDocument", + "sourceFile" : "src/main/java/click/kamil/enterprise/web/StateMachineDispatcher.java", + "sourceModule" : null, + "stateMachineId" : null, + "sourceState" : null, + "lineNumber" : 44, + "polymorphicEvents" : null + }, { + "event" : "click.kamil.enterprise.machines.document.DocumentEvent.APPROVE", + "className" : "click.kamil.enterprise.web.StateMachineDispatcher", + "methodName" : "approveDocument", + "sourceFile" : "src/main/java/click/kamil/enterprise/web/StateMachineDispatcher.java", + "sourceModule" : null, + "stateMachineId" : null, + "sourceState" : null, + "lineNumber" : 51, + "polymorphicEvents" : null + }, { + "event" : "click.kamil.enterprise.machines.document.DocumentEvent.REJECT", + "className" : "click.kamil.enterprise.web.StateMachineDispatcher", + "methodName" : "rejectDocument", + "sourceFile" : "src/main/java/click/kamil/enterprise/web/StateMachineDispatcher.java", + "sourceModule" : null, + "stateMachineId" : null, + "sourceState" : null, + "lineNumber" : 58, + "polymorphicEvents" : null + }, { + "event" : "click.kamil.enterprise.machines.user.UserEvent.VERIFY", + "className" : "click.kamil.enterprise.web.StateMachineDispatcher", + "methodName" : "verifyUser", + "sourceFile" : "src/main/java/click/kamil/enterprise/web/StateMachineDispatcher.java", + "sourceModule" : null, + "stateMachineId" : null, + "sourceState" : null, + "lineNumber" : 65, + "polymorphicEvents" : null + }, { + "event" : "click.kamil.enterprise.machines.user.UserEvent.SUSPEND", + "className" : "click.kamil.enterprise.web.StateMachineDispatcher", + "methodName" : "suspendUser", + "sourceFile" : "src/main/java/click/kamil/enterprise/web/StateMachineDispatcher.java", + "sourceModule" : null, + "stateMachineId" : null, + "sourceState" : null, + "lineNumber" : 72, + "polymorphicEvents" : null + }, { + "event" : "event", + "className" : "click.kamil.enterprise.web.StateMachineDispatcher", + "methodName" : "dispatch", + "sourceFile" : "src/main/java/click/kamil/enterprise/web/StateMachineDispatcher.java", + "sourceModule" : null, + "stateMachineId" : null, + "sourceState" : "ORDER", + "lineNumber" : 81, + "polymorphicEvents" : null + }, { + "event" : "event", + "className" : "click.kamil.enterprise.web.StateMachineDispatcher", + "methodName" : "dispatch", + "sourceFile" : "src/main/java/click/kamil/enterprise/web/StateMachineDispatcher.java", + "sourceModule" : null, + "stateMachineId" : null, + "sourceState" : "DOCUMENT", + "lineNumber" : 87, + "polymorphicEvents" : null + }, { + "event" : "event", + "className" : "click.kamil.enterprise.web.StateMachineDispatcher", + "methodName" : "dispatch", + "sourceFile" : "src/main/java/click/kamil/enterprise/web/StateMachineDispatcher.java", + "sourceModule" : null, + "stateMachineId" : null, + "sourceState" : "USER", + "lineNumber" : 93, + "polymorphicEvents" : null + } ], "entryPoints" : [ { + "type" : "REST", + "name" : "POST /api/machine/order/pay", + "className" : "click.kamil.enterprise.web.StateMachineController", + "methodName" : "payOrder", + "sourceFile" : "src/main/java/click/kamil/enterprise/web/StateMachineController.java", + "metadata" : { + "path" : "/api/machine/order/pay", + "verb" : "POST" + }, + "parameters" : [ { + "name" : "userId", + "type" : "String", + "annotations" : [ "RequestParam" ] + } ] + }, { + "type" : "REST", + "name" : "POST /api/machine/order/ship", + "className" : "click.kamil.enterprise.web.StateMachineController", + "methodName" : "shipOrder", + "sourceFile" : "src/main/java/click/kamil/enterprise/web/StateMachineController.java", + "metadata" : { + "path" : "/api/machine/order/ship", + "verb" : "POST" + }, + "parameters" : [ { + "name" : "userId", + "type" : "String", + "annotations" : [ "RequestParam" ] + } ] + }, { + "type" : "REST", + "name" : "POST /api/machine/document/submit", + "className" : "click.kamil.enterprise.web.StateMachineController", + "methodName" : "submitDocument", + "sourceFile" : "src/main/java/click/kamil/enterprise/web/StateMachineController.java", + "metadata" : { + "path" : "/api/machine/document/submit", + "verb" : "POST" + }, + "parameters" : [ { + "name" : "userId", + "type" : "String", + "annotations" : [ "RequestParam" ] + } ] + }, { + "type" : "REST", + "name" : "POST /api/machine/document/approve", + "className" : "click.kamil.enterprise.web.StateMachineController", + "methodName" : "approveDocument", + "sourceFile" : "src/main/java/click/kamil/enterprise/web/StateMachineController.java", + "metadata" : { + "path" : "/api/machine/document/approve", + "verb" : "POST" + }, + "parameters" : [ { + "name" : "userId", + "type" : "String", + "annotations" : [ "RequestParam" ] + } ] + }, { + "type" : "REST", + "name" : "POST /api/machine/document/reject", + "className" : "click.kamil.enterprise.web.StateMachineController", + "methodName" : "rejectDocument", + "sourceFile" : "src/main/java/click/kamil/enterprise/web/StateMachineController.java", + "metadata" : { + "path" : "/api/machine/document/reject", + "verb" : "POST" + }, + "parameters" : [ { + "name" : "userId", + "type" : "String", + "annotations" : [ "RequestParam" ] + } ] + }, { + "type" : "REST", + "name" : "POST /api/machine/user/verify", + "className" : "click.kamil.enterprise.web.StateMachineController", + "methodName" : "verifyUser", + "sourceFile" : "src/main/java/click/kamil/enterprise/web/StateMachineController.java", + "metadata" : { + "path" : "/api/machine/user/verify", + "verb" : "POST" + }, + "parameters" : [ { + "name" : "userId", + "type" : "String", + "annotations" : [ "RequestParam" ] + } ] + }, { + "type" : "REST", + "name" : "POST /api/machine/user/suspend", + "className" : "click.kamil.enterprise.web.StateMachineController", + "methodName" : "suspendUser", + "sourceFile" : "src/main/java/click/kamil/enterprise/web/StateMachineController.java", + "metadata" : { + "path" : "/api/machine/user/suspend", + "verb" : "POST" + }, + "parameters" : [ { + "name" : "userId", + "type" : "String", + "annotations" : [ "RequestParam" ] + } ] + }, { "type" : "REST", "name" : "POST /api/machine/{machineType}/transition/{event}", "className" : "click.kamil.enterprise.web.StateMachineController", @@ -25,7 +230,389 @@ "annotations" : [ "RequestParam" ] } ] } ], - "callChains" : [ ], + "callChains" : [ { + "entryPoint" : { + "type" : "REST", + "name" : "POST /api/machine/order/pay", + "className" : "click.kamil.enterprise.web.StateMachineController", + "methodName" : "payOrder", + "sourceFile" : "src/main/java/click/kamil/enterprise/web/StateMachineController.java", + "metadata" : { + "path" : "/api/machine/order/pay", + "verb" : "POST" + }, + "parameters" : [ { + "name" : "userId", + "type" : "String", + "annotations" : [ "RequestParam" ] + } ] + }, + "methodChain" : [ "click.kamil.enterprise.web.StateMachineController.payOrder", "click.kamil.enterprise.web.StateMachineDispatcher.payOrder" ], + "triggerPoint" : { + "event" : "click.kamil.enterprise.machines.order.OrderEvent.PAY", + "className" : "click.kamil.enterprise.web.StateMachineDispatcher", + "methodName" : "payOrder", + "sourceFile" : "src/main/java/click/kamil/enterprise/web/StateMachineDispatcher.java", + "sourceModule" : null, + "stateMachineId" : null, + "sourceState" : null, + "lineNumber" : 30, + "polymorphicEvents" : [ "OrderEvent.PAY" ] + }, + "contextMachineId" : null, + "matchedTransitions" : null + }, { + "entryPoint" : { + "type" : "REST", + "name" : "POST /api/machine/order/ship", + "className" : "click.kamil.enterprise.web.StateMachineController", + "methodName" : "shipOrder", + "sourceFile" : "src/main/java/click/kamil/enterprise/web/StateMachineController.java", + "metadata" : { + "path" : "/api/machine/order/ship", + "verb" : "POST" + }, + "parameters" : [ { + "name" : "userId", + "type" : "String", + "annotations" : [ "RequestParam" ] + } ] + }, + "methodChain" : [ "click.kamil.enterprise.web.StateMachineController.shipOrder", "click.kamil.enterprise.web.StateMachineDispatcher.shipOrder" ], + "triggerPoint" : { + "event" : "click.kamil.enterprise.machines.order.OrderEvent.SHIP", + "className" : "click.kamil.enterprise.web.StateMachineDispatcher", + "methodName" : "shipOrder", + "sourceFile" : "src/main/java/click/kamil/enterprise/web/StateMachineDispatcher.java", + "sourceModule" : null, + "stateMachineId" : null, + "sourceState" : null, + "lineNumber" : 37, + "polymorphicEvents" : [ "OrderEvent.SHIP" ] + }, + "contextMachineId" : null, + "matchedTransitions" : null + }, { + "entryPoint" : { + "type" : "REST", + "name" : "POST /api/machine/document/submit", + "className" : "click.kamil.enterprise.web.StateMachineController", + "methodName" : "submitDocument", + "sourceFile" : "src/main/java/click/kamil/enterprise/web/StateMachineController.java", + "metadata" : { + "path" : "/api/machine/document/submit", + "verb" : "POST" + }, + "parameters" : [ { + "name" : "userId", + "type" : "String", + "annotations" : [ "RequestParam" ] + } ] + }, + "methodChain" : [ "click.kamil.enterprise.web.StateMachineController.submitDocument", "click.kamil.enterprise.web.StateMachineDispatcher.submitDocument" ], + "triggerPoint" : { + "event" : "click.kamil.enterprise.machines.document.DocumentEvent.SUBMIT", + "className" : "click.kamil.enterprise.web.StateMachineDispatcher", + "methodName" : "submitDocument", + "sourceFile" : "src/main/java/click/kamil/enterprise/web/StateMachineDispatcher.java", + "sourceModule" : null, + "stateMachineId" : null, + "sourceState" : null, + "lineNumber" : 44, + "polymorphicEvents" : [ "DocumentEvent.SUBMIT" ] + }, + "contextMachineId" : null, + "matchedTransitions" : [ { + "sourceState" : "DocumentState.DRAFT", + "targetState" : "DocumentState.IN_REVIEW", + "event" : "DocumentEvent.SUBMIT" + } ] + }, { + "entryPoint" : { + "type" : "REST", + "name" : "POST /api/machine/document/approve", + "className" : "click.kamil.enterprise.web.StateMachineController", + "methodName" : "approveDocument", + "sourceFile" : "src/main/java/click/kamil/enterprise/web/StateMachineController.java", + "metadata" : { + "path" : "/api/machine/document/approve", + "verb" : "POST" + }, + "parameters" : [ { + "name" : "userId", + "type" : "String", + "annotations" : [ "RequestParam" ] + } ] + }, + "methodChain" : [ "click.kamil.enterprise.web.StateMachineController.approveDocument", "click.kamil.enterprise.web.StateMachineDispatcher.approveDocument" ], + "triggerPoint" : { + "event" : "click.kamil.enterprise.machines.document.DocumentEvent.APPROVE", + "className" : "click.kamil.enterprise.web.StateMachineDispatcher", + "methodName" : "approveDocument", + "sourceFile" : "src/main/java/click/kamil/enterprise/web/StateMachineDispatcher.java", + "sourceModule" : null, + "stateMachineId" : null, + "sourceState" : null, + "lineNumber" : 51, + "polymorphicEvents" : [ "DocumentEvent.APPROVE" ] + }, + "contextMachineId" : null, + "matchedTransitions" : [ { + "sourceState" : "DocumentState.IN_REVIEW", + "targetState" : "DocumentState.APPROVED", + "event" : "DocumentEvent.APPROVE" + } ] + }, { + "entryPoint" : { + "type" : "REST", + "name" : "POST /api/machine/document/reject", + "className" : "click.kamil.enterprise.web.StateMachineController", + "methodName" : "rejectDocument", + "sourceFile" : "src/main/java/click/kamil/enterprise/web/StateMachineController.java", + "metadata" : { + "path" : "/api/machine/document/reject", + "verb" : "POST" + }, + "parameters" : [ { + "name" : "userId", + "type" : "String", + "annotations" : [ "RequestParam" ] + } ] + }, + "methodChain" : [ "click.kamil.enterprise.web.StateMachineController.rejectDocument", "click.kamil.enterprise.web.StateMachineDispatcher.rejectDocument" ], + "triggerPoint" : { + "event" : "click.kamil.enterprise.machines.document.DocumentEvent.REJECT", + "className" : "click.kamil.enterprise.web.StateMachineDispatcher", + "methodName" : "rejectDocument", + "sourceFile" : "src/main/java/click/kamil/enterprise/web/StateMachineDispatcher.java", + "sourceModule" : null, + "stateMachineId" : null, + "sourceState" : null, + "lineNumber" : 58, + "polymorphicEvents" : [ "DocumentEvent.REJECT" ] + }, + "contextMachineId" : null, + "matchedTransitions" : [ { + "sourceState" : "DocumentState.IN_REVIEW", + "targetState" : "DocumentState.DRAFT", + "event" : "DocumentEvent.REJECT" + } ] + }, { + "entryPoint" : { + "type" : "REST", + "name" : "POST /api/machine/user/verify", + "className" : "click.kamil.enterprise.web.StateMachineController", + "methodName" : "verifyUser", + "sourceFile" : "src/main/java/click/kamil/enterprise/web/StateMachineController.java", + "metadata" : { + "path" : "/api/machine/user/verify", + "verb" : "POST" + }, + "parameters" : [ { + "name" : "userId", + "type" : "String", + "annotations" : [ "RequestParam" ] + } ] + }, + "methodChain" : [ "click.kamil.enterprise.web.StateMachineController.verifyUser", "click.kamil.enterprise.web.StateMachineDispatcher.verifyUser" ], + "triggerPoint" : { + "event" : "click.kamil.enterprise.machines.user.UserEvent.VERIFY", + "className" : "click.kamil.enterprise.web.StateMachineDispatcher", + "methodName" : "verifyUser", + "sourceFile" : "src/main/java/click/kamil/enterprise/web/StateMachineDispatcher.java", + "sourceModule" : null, + "stateMachineId" : null, + "sourceState" : null, + "lineNumber" : 65, + "polymorphicEvents" : [ "UserEvent.VERIFY" ] + }, + "contextMachineId" : null, + "matchedTransitions" : null + }, { + "entryPoint" : { + "type" : "REST", + "name" : "POST /api/machine/user/suspend", + "className" : "click.kamil.enterprise.web.StateMachineController", + "methodName" : "suspendUser", + "sourceFile" : "src/main/java/click/kamil/enterprise/web/StateMachineController.java", + "metadata" : { + "path" : "/api/machine/user/suspend", + "verb" : "POST" + }, + "parameters" : [ { + "name" : "userId", + "type" : "String", + "annotations" : [ "RequestParam" ] + } ] + }, + "methodChain" : [ "click.kamil.enterprise.web.StateMachineController.suspendUser", "click.kamil.enterprise.web.StateMachineDispatcher.suspendUser" ], + "triggerPoint" : { + "event" : "click.kamil.enterprise.machines.user.UserEvent.SUSPEND", + "className" : "click.kamil.enterprise.web.StateMachineDispatcher", + "methodName" : "suspendUser", + "sourceFile" : "src/main/java/click/kamil/enterprise/web/StateMachineDispatcher.java", + "sourceModule" : null, + "stateMachineId" : null, + "sourceState" : null, + "lineNumber" : 72, + "polymorphicEvents" : [ "UserEvent.SUSPEND" ] + }, + "contextMachineId" : null, + "matchedTransitions" : null + }, { + "entryPoint" : { + "type" : "REST", + "name" : "POST /api/machine/{machineType}/transition/{event}", + "className" : "click.kamil.enterprise.web.StateMachineController", + "methodName" : "transition", + "sourceFile" : "src/main/java/click/kamil/enterprise/web/StateMachineController.java", + "metadata" : { + "path" : "/api/machine/{machineType}/transition/{event}", + "verb" : "POST" + }, + "parameters" : [ { + "name" : "machineType", + "type" : "String", + "annotations" : [ "PathVariable" ] + }, { + "name" : "event", + "type" : "String", + "annotations" : [ "PathVariable" ] + }, { + "name" : "userId", + "type" : "String", + "annotations" : [ "RequestParam" ] + } ] + }, + "methodChain" : [ "click.kamil.enterprise.web.StateMachineController.transition", "click.kamil.enterprise.web.StateMachineDispatcher.dispatch" ], + "triggerPoint" : { + "event" : "true ? OrderEvent.valueOf(eventString.toUpperCase()) : true ? DocumentEvent.valueOf(eventString.toUpperCase()) : UserEvent.valueOf(eventString.toUpperCase())", + "className" : "click.kamil.enterprise.web.StateMachineDispatcher", + "methodName" : "dispatch", + "sourceFile" : "src/main/java/click/kamil/enterprise/web/StateMachineDispatcher.java", + "sourceModule" : null, + "stateMachineId" : null, + "sourceState" : null, + "lineNumber" : 81, + "polymorphicEvents" : [ ] + }, + "contextMachineId" : null, + "matchedTransitions" : [ { + "sourceState" : "DocumentState.DRAFT", + "targetState" : "DocumentState.IN_REVIEW", + "event" : "DocumentEvent.SUBMIT" + }, { + "sourceState" : "DocumentState.IN_REVIEW", + "targetState" : "DocumentState.APPROVED", + "event" : "DocumentEvent.APPROVE" + }, { + "sourceState" : "DocumentState.IN_REVIEW", + "targetState" : "DocumentState.DRAFT", + "event" : "DocumentEvent.REJECT" + } ] + }, { + "entryPoint" : { + "type" : "REST", + "name" : "POST /api/machine/{machineType}/transition/{event}", + "className" : "click.kamil.enterprise.web.StateMachineController", + "methodName" : "transition", + "sourceFile" : "src/main/java/click/kamil/enterprise/web/StateMachineController.java", + "metadata" : { + "path" : "/api/machine/{machineType}/transition/{event}", + "verb" : "POST" + }, + "parameters" : [ { + "name" : "machineType", + "type" : "String", + "annotations" : [ "PathVariable" ] + }, { + "name" : "event", + "type" : "String", + "annotations" : [ "PathVariable" ] + }, { + "name" : "userId", + "type" : "String", + "annotations" : [ "RequestParam" ] + } ] + }, + "methodChain" : [ "click.kamil.enterprise.web.StateMachineController.transition", "click.kamil.enterprise.web.StateMachineDispatcher.dispatch" ], + "triggerPoint" : { + "event" : "true ? OrderEvent.valueOf(eventString.toUpperCase()) : true ? DocumentEvent.valueOf(eventString.toUpperCase()) : UserEvent.valueOf(eventString.toUpperCase())", + "className" : "click.kamil.enterprise.web.StateMachineDispatcher", + "methodName" : "dispatch", + "sourceFile" : "src/main/java/click/kamil/enterprise/web/StateMachineDispatcher.java", + "sourceModule" : null, + "stateMachineId" : null, + "sourceState" : null, + "lineNumber" : 87, + "polymorphicEvents" : [ ] + }, + "contextMachineId" : null, + "matchedTransitions" : [ { + "sourceState" : "DocumentState.DRAFT", + "targetState" : "DocumentState.IN_REVIEW", + "event" : "DocumentEvent.SUBMIT" + }, { + "sourceState" : "DocumentState.IN_REVIEW", + "targetState" : "DocumentState.APPROVED", + "event" : "DocumentEvent.APPROVE" + }, { + "sourceState" : "DocumentState.IN_REVIEW", + "targetState" : "DocumentState.DRAFT", + "event" : "DocumentEvent.REJECT" + } ] + }, { + "entryPoint" : { + "type" : "REST", + "name" : "POST /api/machine/{machineType}/transition/{event}", + "className" : "click.kamil.enterprise.web.StateMachineController", + "methodName" : "transition", + "sourceFile" : "src/main/java/click/kamil/enterprise/web/StateMachineController.java", + "metadata" : { + "path" : "/api/machine/{machineType}/transition/{event}", + "verb" : "POST" + }, + "parameters" : [ { + "name" : "machineType", + "type" : "String", + "annotations" : [ "PathVariable" ] + }, { + "name" : "event", + "type" : "String", + "annotations" : [ "PathVariable" ] + }, { + "name" : "userId", + "type" : "String", + "annotations" : [ "RequestParam" ] + } ] + }, + "methodChain" : [ "click.kamil.enterprise.web.StateMachineController.transition", "click.kamil.enterprise.web.StateMachineDispatcher.dispatch" ], + "triggerPoint" : { + "event" : "true ? OrderEvent.valueOf(eventString.toUpperCase()) : true ? DocumentEvent.valueOf(eventString.toUpperCase()) : UserEvent.valueOf(eventString.toUpperCase())", + "className" : "click.kamil.enterprise.web.StateMachineDispatcher", + "methodName" : "dispatch", + "sourceFile" : "src/main/java/click/kamil/enterprise/web/StateMachineDispatcher.java", + "sourceModule" : null, + "stateMachineId" : null, + "sourceState" : null, + "lineNumber" : 93, + "polymorphicEvents" : [ ] + }, + "contextMachineId" : null, + "matchedTransitions" : [ { + "sourceState" : "DocumentState.DRAFT", + "targetState" : "DocumentState.IN_REVIEW", + "event" : "DocumentEvent.SUBMIT" + }, { + "sourceState" : "DocumentState.IN_REVIEW", + "targetState" : "DocumentState.APPROVED", + "event" : "DocumentEvent.APPROVE" + }, { + "sourceState" : "DocumentState.IN_REVIEW", + "targetState" : "DocumentState.DRAFT", + "event" : "DocumentEvent.REJECT" + } ] + } ], "properties" : { "default" : { } } diff --git a/state_machine_exporter/src/test/resources/golden/EnterpriseStateMachineConfig/EnterpriseStateMachineConfig.json b/state_machine_exporter/src/test/resources/golden/EnterpriseStateMachineConfig/EnterpriseStateMachineConfig.json index d8e6e21..6ea1064 100644 --- a/state_machine_exporter/src/test/resources/golden/EnterpriseStateMachineConfig/EnterpriseStateMachineConfig.json +++ b/state_machine_exporter/src/test/resources/golden/EnterpriseStateMachineConfig/EnterpriseStateMachineConfig.json @@ -9,7 +9,9 @@ "stateMachineId" : null, "sourceState" : null, "lineNumber" : 17, - "polymorphicEvents" : null + "polymorphicEvents" : null, + "external" : false, + "constraint" : null }, { "event" : "PLACE_ORDER", "className" : "click.kamil.examples.enterprise.service.OrderServiceImpl", @@ -19,7 +21,9 @@ "stateMachineId" : null, "sourceState" : null, "lineNumber" : 16, - "polymorphicEvents" : null + "polymorphicEvents" : null, + "external" : false, + "constraint" : null }, { "event" : "CANCEL_ORDER", "className" : "click.kamil.examples.enterprise.service.OrderServiceImpl", @@ -29,7 +33,9 @@ "stateMachineId" : null, "sourceState" : null, "lineNumber" : 21, - "polymorphicEvents" : null + "polymorphicEvents" : null, + "external" : false, + "constraint" : null }, { "event" : "PAY_ORDER", "className" : "click.kamil.examples.enterprise.service.ReactivePaymentService", @@ -39,7 +45,9 @@ "stateMachineId" : null, "sourceState" : null, "lineNumber" : 18, - "polymorphicEvents" : null + "polymorphicEvents" : null, + "external" : false, + "constraint" : null }, { "event" : "SHIP_ORDER", "className" : "click.kamil.examples.enterprise.messaging.ShippingJmsListener", @@ -49,7 +57,9 @@ "stateMachineId" : null, "sourceState" : null, "lineNumber" : 17, - "polymorphicEvents" : null + "polymorphicEvents" : null, + "external" : false, + "constraint" : null }, { "event" : "RETURN_ORDER", "className" : "click.kamil.examples.enterprise.messaging.ReturnsRabbitListener", @@ -59,7 +69,9 @@ "stateMachineId" : null, "sourceState" : null, "lineNumber" : 17, - "polymorphicEvents" : null + "polymorphicEvents" : null, + "external" : false, + "constraint" : null } ], "entryPoints" : [ { "type" : "REST", @@ -192,7 +204,9 @@ "stateMachineId" : null, "sourceState" : null, "lineNumber" : 16, - "polymorphicEvents" : [ "PLACE_ORDER" ] + "polymorphicEvents" : [ "PLACE_ORDER" ], + "external" : false, + "constraint" : null }, "contextMachineId" : null, "matchedTransitions" : [ { @@ -227,7 +241,9 @@ "stateMachineId" : null, "sourceState" : null, "lineNumber" : 21, - "polymorphicEvents" : [ "CANCEL_ORDER" ] + "polymorphicEvents" : [ "CANCEL_ORDER" ], + "external" : false, + "constraint" : null }, "contextMachineId" : null, "matchedTransitions" : [ { @@ -257,7 +273,9 @@ "stateMachineId" : null, "sourceState" : null, "lineNumber" : 17, - "polymorphicEvents" : null + "polymorphicEvents" : null, + "external" : false, + "constraint" : null }, "contextMachineId" : null, "matchedTransitions" : null @@ -288,7 +306,9 @@ "stateMachineId" : null, "sourceState" : null, "lineNumber" : 18, - "polymorphicEvents" : [ "PAY_ORDER" ] + "polymorphicEvents" : [ "PAY_ORDER" ], + "external" : false, + "constraint" : null }, "contextMachineId" : null, "matchedTransitions" : [ { @@ -323,7 +343,9 @@ "stateMachineId" : null, "sourceState" : null, "lineNumber" : 17, - "polymorphicEvents" : null + "polymorphicEvents" : null, + "external" : false, + "constraint" : null }, "contextMachineId" : null, "matchedTransitions" : [ { @@ -358,7 +380,9 @@ "stateMachineId" : null, "sourceState" : null, "lineNumber" : 17, - "polymorphicEvents" : null + "polymorphicEvents" : null, + "external" : false, + "constraint" : null }, "contextMachineId" : null, "matchedTransitions" : [ { diff --git a/state_machine_exporter/src/test/resources/golden/ExtendedStateMachineConfig/ExtendedStateMachineConfig.json b/state_machine_exporter/src/test/resources/golden/ExtendedStateMachineConfig/ExtendedStateMachineConfig.json index 10ebed1..3aab3e5 100644 --- a/state_machine_exporter/src/test/resources/golden/ExtendedStateMachineConfig/ExtendedStateMachineConfig.json +++ b/state_machine_exporter/src/test/resources/golden/ExtendedStateMachineConfig/ExtendedStateMachineConfig.json @@ -9,7 +9,9 @@ "stateMachineId" : null, "sourceState" : null, "lineNumber" : 34, - "polymorphicEvents" : null + "polymorphicEvents" : null, + "external" : false, + "constraint" : null }, { "event" : "AUDIT_EVENT", "className" : "click.kamil.examples.statemachine.extended.web.AuditInterceptor", @@ -19,7 +21,9 @@ "stateMachineId" : null, "sourceState" : null, "lineNumber" : 16, - "polymorphicEvents" : null + "polymorphicEvents" : null, + "external" : false, + "constraint" : null }, { "event" : "FALLBACK_EVENT", "className" : "click.kamil.examples.statemachine.extended.service.FallbackQuirkService", @@ -29,7 +33,9 @@ "stateMachineId" : null, "sourceState" : null, "lineNumber" : 17, - "polymorphicEvents" : null + "polymorphicEvents" : null, + "external" : false, + "constraint" : null }, { "event" : "PROFILED_EVENT", "className" : "click.kamil.examples.statemachine.extended.service.ProfiledQuirkService", @@ -39,7 +45,9 @@ "stateMachineId" : null, "sourceState" : null, "lineNumber" : 19, - "polymorphicEvents" : null + "polymorphicEvents" : null, + "external" : false, + "constraint" : null }, { "event" : "PRIMARY_EVENT", "className" : "click.kamil.examples.statemachine.extended.service.PrimaryQuirkService", @@ -49,7 +57,9 @@ "stateMachineId" : null, "sourceState" : null, "lineNumber" : 19, - "polymorphicEvents" : null + "polymorphicEvents" : null, + "external" : false, + "constraint" : null }, { "event" : "SUBMIT_EVENT", "className" : "click.kamil.examples.statemachine.extended.service.OrderService", @@ -59,7 +69,9 @@ "stateMachineId" : null, "sourceState" : null, "lineNumber" : 20, - "polymorphicEvents" : null + "polymorphicEvents" : null, + "external" : false, + "constraint" : null }, { "event" : "CANCEL_EVENT", "className" : "click.kamil.examples.statemachine.extended.service.OrderService", @@ -69,7 +81,9 @@ "stateMachineId" : null, "sourceState" : null, "lineNumber" : 25, - "polymorphicEvents" : null + "polymorphicEvents" : null, + "external" : false, + "constraint" : null }, { "event" : "[LIFECYCLE:RESTORE]", "className" : "click.kamil.examples.statemachine.extended.service.OrderService", @@ -79,7 +93,9 @@ "stateMachineId" : null, "sourceState" : null, "lineNumber" : 29, - "polymorphicEvents" : null + "polymorphicEvents" : null, + "external" : false, + "constraint" : null }, { "event" : "QUALIFIER_EVENT", "className" : "click.kamil.examples.statemachine.extended.service.QualifierQuirkService", @@ -89,7 +105,9 @@ "stateMachineId" : null, "sourceState" : null, "lineNumber" : 17, - "polymorphicEvents" : null + "polymorphicEvents" : null, + "external" : false, + "constraint" : null }, { "event" : "NAMED_EVENT", "className" : "click.kamil.examples.statemachine.extended.service.NamedQuirkService", @@ -99,7 +117,9 @@ "stateMachineId" : null, "sourceState" : null, "lineNumber" : 17, - "polymorphicEvents" : null + "polymorphicEvents" : null, + "external" : false, + "constraint" : null }, { "event" : "AUTHORIZE", "className" : "click.kamil.examples.statemachine.extended.service.PaymentServiceImpl", @@ -109,7 +129,9 @@ "stateMachineId" : null, "sourceState" : null, "lineNumber" : 22, - "polymorphicEvents" : null + "polymorphicEvents" : null, + "external" : false, + "constraint" : null }, { "event" : "CAPTURE", "className" : "click.kamil.examples.statemachine.extended.service.PaymentServiceImpl", @@ -119,7 +141,9 @@ "stateMachineId" : null, "sourceState" : null, "lineNumber" : 35, - "polymorphicEvents" : null + "polymorphicEvents" : null, + "external" : false, + "constraint" : null }, { "event" : "[LIFECYCLE:RESTORE]", "className" : "click.kamil.examples.statemachine.extended.service.PaymentServiceImpl", @@ -129,7 +153,9 @@ "stateMachineId" : null, "sourceState" : null, "lineNumber" : 28, - "polymorphicEvents" : null + "polymorphicEvents" : null, + "external" : false, + "constraint" : null }, { "event" : "REACTIVE_EVENT", "className" : "click.kamil.examples.statemachine.extended.service.ReactiveOrderService", @@ -139,7 +165,9 @@ "stateMachineId" : null, "sourceState" : null, "lineNumber" : 18, - "polymorphicEvents" : null + "polymorphicEvents" : null, + "external" : false, + "constraint" : null } ], "entryPoints" : [ { "type" : "REST", @@ -367,7 +395,9 @@ "stateMachineId" : null, "sourceState" : null, "lineNumber" : 20, - "polymorphicEvents" : [ "SUBMIT_EVENT" ] + "polymorphicEvents" : [ "SUBMIT_EVENT" ], + "external" : false, + "constraint" : null }, "contextMachineId" : null, "matchedTransitions" : [ { @@ -398,7 +428,9 @@ "stateMachineId" : null, "sourceState" : null, "lineNumber" : 25, - "polymorphicEvents" : [ "CANCEL_EVENT" ] + "polymorphicEvents" : [ "CANCEL_EVENT" ], + "external" : false, + "constraint" : null }, "contextMachineId" : null, "matchedTransitions" : [ { @@ -429,7 +461,9 @@ "stateMachineId" : null, "sourceState" : null, "lineNumber" : 34, - "polymorphicEvents" : null + "polymorphicEvents" : null, + "external" : false, + "constraint" : null }, "contextMachineId" : null, "matchedTransitions" : [ { @@ -464,7 +498,9 @@ "stateMachineId" : null, "sourceState" : null, "lineNumber" : 29, - "polymorphicEvents" : null + "polymorphicEvents" : null, + "external" : false, + "constraint" : null }, "contextMachineId" : "orderId", "matchedTransitions" : null @@ -495,7 +531,9 @@ "stateMachineId" : null, "sourceState" : null, "lineNumber" : 18, - "polymorphicEvents" : [ "REACTIVE_EVENT" ] + "polymorphicEvents" : [ "REACTIVE_EVENT" ], + "external" : false, + "constraint" : null }, "contextMachineId" : null, "matchedTransitions" : [ { @@ -525,7 +563,9 @@ "stateMachineId" : null, "sourceState" : null, "lineNumber" : 16, - "polymorphicEvents" : null + "polymorphicEvents" : null, + "external" : false, + "constraint" : null }, "contextMachineId" : null, "matchedTransitions" : [ { @@ -556,7 +596,9 @@ "stateMachineId" : null, "sourceState" : null, "lineNumber" : 17, - "polymorphicEvents" : [ "NAMED_EVENT" ] + "polymorphicEvents" : [ "NAMED_EVENT" ], + "external" : false, + "constraint" : null }, "contextMachineId" : null, "matchedTransitions" : null @@ -583,7 +625,9 @@ "stateMachineId" : null, "sourceState" : null, "lineNumber" : 19, - "polymorphicEvents" : [ "PRIMARY_EVENT" ] + "polymorphicEvents" : [ "PRIMARY_EVENT" ], + "external" : false, + "constraint" : null }, "contextMachineId" : null, "matchedTransitions" : null @@ -610,7 +654,9 @@ "stateMachineId" : null, "sourceState" : null, "lineNumber" : 17, - "polymorphicEvents" : [ "NAMED_EVENT" ] + "polymorphicEvents" : [ "NAMED_EVENT" ], + "external" : false, + "constraint" : null }, "contextMachineId" : null, "matchedTransitions" : null @@ -637,7 +683,9 @@ "stateMachineId" : null, "sourceState" : null, "lineNumber" : 17, - "polymorphicEvents" : [ "QUALIFIER_EVENT" ] + "polymorphicEvents" : [ "QUALIFIER_EVENT" ], + "external" : false, + "constraint" : null }, "contextMachineId" : null, "matchedTransitions" : null @@ -664,7 +712,9 @@ "stateMachineId" : null, "sourceState" : null, "lineNumber" : 19, - "polymorphicEvents" : [ "PRIMARY_EVENT" ] + "polymorphicEvents" : [ "PRIMARY_EVENT" ], + "external" : false, + "constraint" : null }, "contextMachineId" : null, "matchedTransitions" : null @@ -691,7 +741,9 @@ "stateMachineId" : null, "sourceState" : null, "lineNumber" : 17, - "polymorphicEvents" : [ "QUALIFIER_EVENT" ] + "polymorphicEvents" : [ "QUALIFIER_EVENT" ], + "external" : false, + "constraint" : null }, "contextMachineId" : null, "matchedTransitions" : null @@ -718,7 +770,9 @@ "stateMachineId" : null, "sourceState" : null, "lineNumber" : 17, - "polymorphicEvents" : [ "NAMED_EVENT" ] + "polymorphicEvents" : [ "NAMED_EVENT" ], + "external" : false, + "constraint" : null }, "contextMachineId" : null, "matchedTransitions" : null @@ -749,7 +803,9 @@ "stateMachineId" : null, "sourceState" : null, "lineNumber" : 22, - "polymorphicEvents" : null + "polymorphicEvents" : null, + "external" : false, + "constraint" : null }, "contextMachineId" : null, "matchedTransitions" : null @@ -780,7 +836,9 @@ "stateMachineId" : null, "sourceState" : null, "lineNumber" : 35, - "polymorphicEvents" : null + "polymorphicEvents" : null, + "external" : false, + "constraint" : null }, "contextMachineId" : "paymentId", "matchedTransitions" : null @@ -811,7 +869,9 @@ "stateMachineId" : null, "sourceState" : null, "lineNumber" : 28, - "polymorphicEvents" : null + "polymorphicEvents" : null, + "external" : false, + "constraint" : null }, "contextMachineId" : "paymentId", "matchedTransitions" : null diff --git a/state_machine_exporter/src/test/resources/golden/ExtendedStateMachineConfig_PROD/ExtendedStateMachineConfig.json b/state_machine_exporter/src/test/resources/golden/ExtendedStateMachineConfig_PROD/ExtendedStateMachineConfig.json index b86b415..418f416 100644 --- a/state_machine_exporter/src/test/resources/golden/ExtendedStateMachineConfig_PROD/ExtendedStateMachineConfig.json +++ b/state_machine_exporter/src/test/resources/golden/ExtendedStateMachineConfig_PROD/ExtendedStateMachineConfig.json @@ -9,7 +9,9 @@ "stateMachineId" : null, "sourceState" : null, "lineNumber" : 34, - "polymorphicEvents" : null + "polymorphicEvents" : null, + "external" : false, + "constraint" : null }, { "event" : "AUDIT_EVENT", "className" : "click.kamil.examples.statemachine.extended.web.AuditInterceptor", @@ -19,7 +21,9 @@ "stateMachineId" : null, "sourceState" : null, "lineNumber" : 16, - "polymorphicEvents" : null + "polymorphicEvents" : null, + "external" : false, + "constraint" : null }, { "event" : "FALLBACK_EVENT", "className" : "click.kamil.examples.statemachine.extended.service.FallbackQuirkService", @@ -29,7 +33,9 @@ "stateMachineId" : null, "sourceState" : null, "lineNumber" : 17, - "polymorphicEvents" : null + "polymorphicEvents" : null, + "external" : false, + "constraint" : null }, { "event" : "PROFILED_EVENT", "className" : "click.kamil.examples.statemachine.extended.service.ProfiledQuirkService", @@ -39,7 +45,9 @@ "stateMachineId" : null, "sourceState" : null, "lineNumber" : 19, - "polymorphicEvents" : null + "polymorphicEvents" : null, + "external" : false, + "constraint" : null }, { "event" : "PRIMARY_EVENT", "className" : "click.kamil.examples.statemachine.extended.service.PrimaryQuirkService", @@ -49,7 +57,9 @@ "stateMachineId" : null, "sourceState" : null, "lineNumber" : 19, - "polymorphicEvents" : null + "polymorphicEvents" : null, + "external" : false, + "constraint" : null }, { "event" : "SUBMIT_EVENT", "className" : "click.kamil.examples.statemachine.extended.service.OrderService", @@ -59,7 +69,9 @@ "stateMachineId" : null, "sourceState" : null, "lineNumber" : 20, - "polymorphicEvents" : null + "polymorphicEvents" : null, + "external" : false, + "constraint" : null }, { "event" : "CANCEL_EVENT", "className" : "click.kamil.examples.statemachine.extended.service.OrderService", @@ -69,7 +81,9 @@ "stateMachineId" : null, "sourceState" : null, "lineNumber" : 25, - "polymorphicEvents" : null + "polymorphicEvents" : null, + "external" : false, + "constraint" : null }, { "event" : "[LIFECYCLE:RESTORE]", "className" : "click.kamil.examples.statemachine.extended.service.OrderService", @@ -79,7 +93,9 @@ "stateMachineId" : null, "sourceState" : null, "lineNumber" : 29, - "polymorphicEvents" : null + "polymorphicEvents" : null, + "external" : false, + "constraint" : null }, { "event" : "QUALIFIER_EVENT", "className" : "click.kamil.examples.statemachine.extended.service.QualifierQuirkService", @@ -89,7 +105,9 @@ "stateMachineId" : null, "sourceState" : null, "lineNumber" : 17, - "polymorphicEvents" : null + "polymorphicEvents" : null, + "external" : false, + "constraint" : null }, { "event" : "NAMED_EVENT", "className" : "click.kamil.examples.statemachine.extended.service.NamedQuirkService", @@ -99,7 +117,9 @@ "stateMachineId" : null, "sourceState" : null, "lineNumber" : 17, - "polymorphicEvents" : null + "polymorphicEvents" : null, + "external" : false, + "constraint" : null }, { "event" : "AUTHORIZE", "className" : "click.kamil.examples.statemachine.extended.service.PaymentServiceImpl", @@ -109,7 +129,9 @@ "stateMachineId" : null, "sourceState" : null, "lineNumber" : 22, - "polymorphicEvents" : null + "polymorphicEvents" : null, + "external" : false, + "constraint" : null }, { "event" : "CAPTURE", "className" : "click.kamil.examples.statemachine.extended.service.PaymentServiceImpl", @@ -119,7 +141,9 @@ "stateMachineId" : null, "sourceState" : null, "lineNumber" : 35, - "polymorphicEvents" : null + "polymorphicEvents" : null, + "external" : false, + "constraint" : null }, { "event" : "[LIFECYCLE:RESTORE]", "className" : "click.kamil.examples.statemachine.extended.service.PaymentServiceImpl", @@ -129,7 +153,9 @@ "stateMachineId" : null, "sourceState" : null, "lineNumber" : 28, - "polymorphicEvents" : null + "polymorphicEvents" : null, + "external" : false, + "constraint" : null }, { "event" : "REACTIVE_EVENT", "className" : "click.kamil.examples.statemachine.extended.service.ReactiveOrderService", @@ -139,7 +165,9 @@ "stateMachineId" : null, "sourceState" : null, "lineNumber" : 18, - "polymorphicEvents" : null + "polymorphicEvents" : null, + "external" : false, + "constraint" : null } ], "entryPoints" : [ { "type" : "REST", @@ -367,7 +395,9 @@ "stateMachineId" : null, "sourceState" : null, "lineNumber" : 20, - "polymorphicEvents" : [ "SUBMIT_EVENT" ] + "polymorphicEvents" : [ "SUBMIT_EVENT" ], + "external" : false, + "constraint" : null }, "contextMachineId" : null, "matchedTransitions" : [ { @@ -398,7 +428,9 @@ "stateMachineId" : null, "sourceState" : null, "lineNumber" : 25, - "polymorphicEvents" : [ "CANCEL_EVENT" ] + "polymorphicEvents" : [ "CANCEL_EVENT" ], + "external" : false, + "constraint" : null }, "contextMachineId" : null, "matchedTransitions" : [ { @@ -429,7 +461,9 @@ "stateMachineId" : null, "sourceState" : null, "lineNumber" : 34, - "polymorphicEvents" : null + "polymorphicEvents" : null, + "external" : false, + "constraint" : null }, "contextMachineId" : null, "matchedTransitions" : [ { @@ -464,7 +498,9 @@ "stateMachineId" : null, "sourceState" : null, "lineNumber" : 29, - "polymorphicEvents" : null + "polymorphicEvents" : null, + "external" : false, + "constraint" : null }, "contextMachineId" : "orderId", "matchedTransitions" : null @@ -495,7 +531,9 @@ "stateMachineId" : null, "sourceState" : null, "lineNumber" : 18, - "polymorphicEvents" : [ "REACTIVE_EVENT" ] + "polymorphicEvents" : [ "REACTIVE_EVENT" ], + "external" : false, + "constraint" : null }, "contextMachineId" : null, "matchedTransitions" : [ { @@ -525,7 +563,9 @@ "stateMachineId" : null, "sourceState" : null, "lineNumber" : 16, - "polymorphicEvents" : null + "polymorphicEvents" : null, + "external" : false, + "constraint" : null }, "contextMachineId" : null, "matchedTransitions" : [ { @@ -556,7 +596,9 @@ "stateMachineId" : null, "sourceState" : null, "lineNumber" : 17, - "polymorphicEvents" : [ "NAMED_EVENT" ] + "polymorphicEvents" : [ "NAMED_EVENT" ], + "external" : false, + "constraint" : null }, "contextMachineId" : null, "matchedTransitions" : null @@ -583,7 +625,9 @@ "stateMachineId" : null, "sourceState" : null, "lineNumber" : 19, - "polymorphicEvents" : [ "PRIMARY_EVENT" ] + "polymorphicEvents" : [ "PRIMARY_EVENT" ], + "external" : false, + "constraint" : null }, "contextMachineId" : null, "matchedTransitions" : null @@ -610,7 +654,9 @@ "stateMachineId" : null, "sourceState" : null, "lineNumber" : 17, - "polymorphicEvents" : [ "NAMED_EVENT" ] + "polymorphicEvents" : [ "NAMED_EVENT" ], + "external" : false, + "constraint" : null }, "contextMachineId" : null, "matchedTransitions" : null @@ -637,7 +683,9 @@ "stateMachineId" : null, "sourceState" : null, "lineNumber" : 17, - "polymorphicEvents" : [ "QUALIFIER_EVENT" ] + "polymorphicEvents" : [ "QUALIFIER_EVENT" ], + "external" : false, + "constraint" : null }, "contextMachineId" : null, "matchedTransitions" : null @@ -664,7 +712,9 @@ "stateMachineId" : null, "sourceState" : null, "lineNumber" : 19, - "polymorphicEvents" : [ "PRIMARY_EVENT" ] + "polymorphicEvents" : [ "PRIMARY_EVENT" ], + "external" : false, + "constraint" : null }, "contextMachineId" : null, "matchedTransitions" : null @@ -691,7 +741,9 @@ "stateMachineId" : null, "sourceState" : null, "lineNumber" : 17, - "polymorphicEvents" : [ "QUALIFIER_EVENT" ] + "polymorphicEvents" : [ "QUALIFIER_EVENT" ], + "external" : false, + "constraint" : null }, "contextMachineId" : null, "matchedTransitions" : null @@ -718,7 +770,9 @@ "stateMachineId" : null, "sourceState" : null, "lineNumber" : 17, - "polymorphicEvents" : [ "NAMED_EVENT" ] + "polymorphicEvents" : [ "NAMED_EVENT" ], + "external" : false, + "constraint" : null }, "contextMachineId" : null, "matchedTransitions" : null @@ -749,7 +803,9 @@ "stateMachineId" : null, "sourceState" : null, "lineNumber" : 22, - "polymorphicEvents" : null + "polymorphicEvents" : null, + "external" : false, + "constraint" : null }, "contextMachineId" : null, "matchedTransitions" : null @@ -780,7 +836,9 @@ "stateMachineId" : null, "sourceState" : null, "lineNumber" : 35, - "polymorphicEvents" : null + "polymorphicEvents" : null, + "external" : false, + "constraint" : null }, "contextMachineId" : "paymentId", "matchedTransitions" : null @@ -811,7 +869,9 @@ "stateMachineId" : null, "sourceState" : null, "lineNumber" : 28, - "polymorphicEvents" : null + "polymorphicEvents" : null, + "external" : false, + "constraint" : null }, "contextMachineId" : "paymentId", "matchedTransitions" : null diff --git a/state_machine_exporter/src/test/resources/golden/InheritanceStateMachineConfig/InheritanceStateMachineConfig.json b/state_machine_exporter/src/test/resources/golden/InheritanceStateMachineConfig/InheritanceStateMachineConfig.json index 87dc5d2..7b9d220 100644 --- a/state_machine_exporter/src/test/resources/golden/InheritanceStateMachineConfig/InheritanceStateMachineConfig.json +++ b/state_machine_exporter/src/test/resources/golden/InheritanceStateMachineConfig/InheritanceStateMachineConfig.json @@ -9,7 +9,9 @@ "stateMachineId" : null, "sourceState" : null, "lineNumber" : 15, - "polymorphicEvents" : null + "polymorphicEvents" : null, + "external" : false, + "constraint" : null } ], "entryPoints" : [ { "type" : "REST", @@ -57,7 +59,9 @@ "stateMachineId" : null, "sourceState" : null, "lineNumber" : 15, - "polymorphicEvents" : [ "INHERITED_SUBMIT" ] + "polymorphicEvents" : [ "INHERITED_SUBMIT" ], + "external" : false, + "constraint" : null }, "contextMachineId" : null, "matchedTransitions" : [ { diff --git a/state_machine_exporter/src/test/resources/golden/MavenOrderStateMachine/MavenOrderStateMachine.json b/state_machine_exporter/src/test/resources/golden/MavenOrderStateMachine/MavenOrderStateMachine.json index 20af568..1a8dfcc 100644 --- a/state_machine_exporter/src/test/resources/golden/MavenOrderStateMachine/MavenOrderStateMachine.json +++ b/state_machine_exporter/src/test/resources/golden/MavenOrderStateMachine/MavenOrderStateMachine.json @@ -1,7 +1,7 @@ { "metadata" : { "triggers" : [ { - "event" : "SUBMIT", + "event" : "String.SUBMIT", "className" : "click.kamil.maven.core.MavenOrderStateMachine.OrderController", "methodName" : "submitOrder", "sourceFile" : "core-module/src/main/java/click/kamil/maven/core/MavenOrderStateMachine.java", @@ -9,9 +9,11 @@ "stateMachineId" : null, "sourceState" : null, "lineNumber" : 40, - "polymorphicEvents" : null + "polymorphicEvents" : null, + "external" : false, + "constraint" : null }, { - "event" : "ORDER_EVENT", + "event" : "String.ORDER_EVENT", "className" : "click.kamil.maven.core.MavenOrderStateMachine.OrderService", "methodName" : "onMessage", "sourceFile" : "core-module/src/main/java/click/kamil/maven/core/MavenOrderStateMachine.java", @@ -19,7 +21,9 @@ "stateMachineId" : null, "sourceState" : null, "lineNumber" : 52, - "polymorphicEvents" : null + "polymorphicEvents" : null, + "external" : false, + "constraint" : null } ], "entryPoints" : [ { "type" : "REST", @@ -98,7 +102,7 @@ }, "methodChain" : [ "click.kamil.maven.core.MavenOrderStateMachine.OrderController.submitOrder" ], "triggerPoint" : { - "event" : "SUBMIT", + "event" : "String.SUBMIT", "className" : "click.kamil.maven.core.MavenOrderStateMachine.OrderController", "methodName" : "submitOrder", "sourceFile" : "core-module/src/main/java/click/kamil/maven/core/MavenOrderStateMachine.java", @@ -106,14 +110,12 @@ "stateMachineId" : null, "sourceState" : null, "lineNumber" : 40, - "polymorphicEvents" : null + "polymorphicEvents" : null, + "external" : false, + "constraint" : null }, "contextMachineId" : null, - "matchedTransitions" : [ { - "sourceState" : "INIT", - "targetState" : "BUSY", - "event" : "SUBMIT" - } ] + "matchedTransitions" : null } ], "properties" : { "default" : { } diff --git a/state_machine_exporter/src/test/resources/golden/OrderStateMachineConfig/OrderStateMachineConfig.json b/state_machine_exporter/src/test/resources/golden/OrderStateMachineConfig/OrderStateMachineConfig.json index b7f3445..4083398 100644 --- a/state_machine_exporter/src/test/resources/golden/OrderStateMachineConfig/OrderStateMachineConfig.json +++ b/state_machine_exporter/src/test/resources/golden/OrderStateMachineConfig/OrderStateMachineConfig.json @@ -1,7 +1,7 @@ { "metadata" : { "triggers" : [ { - "event" : "SUBMIT", + "event" : "String.SUBMIT", "className" : "click.kamil.multi.core.OrderController", "methodName" : "submitOrder", "sourceFile" : "core-module/src/main/java/click/kamil/multi/core/OrderController.java", @@ -9,7 +9,9 @@ "stateMachineId" : null, "sourceState" : null, "lineNumber" : 18, - "polymorphicEvents" : null + "polymorphicEvents" : null, + "external" : false, + "constraint" : null } ], "entryPoints" : [ { "type" : "REST", @@ -61,7 +63,7 @@ }, "methodChain" : [ "click.kamil.multi.core.OrderController.submitOrder" ], "triggerPoint" : { - "event" : "SUBMIT", + "event" : "String.SUBMIT", "className" : "click.kamil.multi.core.OrderController", "methodName" : "submitOrder", "sourceFile" : "core-module/src/main/java/click/kamil/multi/core/OrderController.java", @@ -69,14 +71,12 @@ "stateMachineId" : null, "sourceState" : null, "lineNumber" : 18, - "polymorphicEvents" : null + "polymorphicEvents" : null, + "external" : false, + "constraint" : null }, "contextMachineId" : null, - "matchedTransitions" : [ { - "sourceState" : "NEW", - "targetState" : "PROCESSING", - "event" : "SUBMIT" - } ] + "matchedTransitions" : null } ], "properties" : { "default" : { } diff --git a/state_machine_exporter/src/test/resources/golden/OrderStateMachineConfiguration/OrderStateMachineConfiguration.json b/state_machine_exporter/src/test/resources/golden/OrderStateMachineConfiguration/OrderStateMachineConfiguration.json index d911922..78ef6f3 100644 --- a/state_machine_exporter/src/test/resources/golden/OrderStateMachineConfiguration/OrderStateMachineConfiguration.json +++ b/state_machine_exporter/src/test/resources/golden/OrderStateMachineConfiguration/OrderStateMachineConfiguration.json @@ -1,7 +1,212 @@ { "metadata" : { - "triggers" : [ ], + "triggers" : [ { + "event" : "click.kamil.enterprise.machines.order.OrderEvent.PAY", + "className" : "click.kamil.enterprise.web.StateMachineDispatcher", + "methodName" : "payOrder", + "sourceFile" : "src/main/java/click/kamil/enterprise/web/StateMachineDispatcher.java", + "sourceModule" : null, + "stateMachineId" : null, + "sourceState" : null, + "lineNumber" : 30, + "polymorphicEvents" : null + }, { + "event" : "click.kamil.enterprise.machines.order.OrderEvent.SHIP", + "className" : "click.kamil.enterprise.web.StateMachineDispatcher", + "methodName" : "shipOrder", + "sourceFile" : "src/main/java/click/kamil/enterprise/web/StateMachineDispatcher.java", + "sourceModule" : null, + "stateMachineId" : null, + "sourceState" : null, + "lineNumber" : 37, + "polymorphicEvents" : null + }, { + "event" : "click.kamil.enterprise.machines.document.DocumentEvent.SUBMIT", + "className" : "click.kamil.enterprise.web.StateMachineDispatcher", + "methodName" : "submitDocument", + "sourceFile" : "src/main/java/click/kamil/enterprise/web/StateMachineDispatcher.java", + "sourceModule" : null, + "stateMachineId" : null, + "sourceState" : null, + "lineNumber" : 44, + "polymorphicEvents" : null + }, { + "event" : "click.kamil.enterprise.machines.document.DocumentEvent.APPROVE", + "className" : "click.kamil.enterprise.web.StateMachineDispatcher", + "methodName" : "approveDocument", + "sourceFile" : "src/main/java/click/kamil/enterprise/web/StateMachineDispatcher.java", + "sourceModule" : null, + "stateMachineId" : null, + "sourceState" : null, + "lineNumber" : 51, + "polymorphicEvents" : null + }, { + "event" : "click.kamil.enterprise.machines.document.DocumentEvent.REJECT", + "className" : "click.kamil.enterprise.web.StateMachineDispatcher", + "methodName" : "rejectDocument", + "sourceFile" : "src/main/java/click/kamil/enterprise/web/StateMachineDispatcher.java", + "sourceModule" : null, + "stateMachineId" : null, + "sourceState" : null, + "lineNumber" : 58, + "polymorphicEvents" : null + }, { + "event" : "click.kamil.enterprise.machines.user.UserEvent.VERIFY", + "className" : "click.kamil.enterprise.web.StateMachineDispatcher", + "methodName" : "verifyUser", + "sourceFile" : "src/main/java/click/kamil/enterprise/web/StateMachineDispatcher.java", + "sourceModule" : null, + "stateMachineId" : null, + "sourceState" : null, + "lineNumber" : 65, + "polymorphicEvents" : null + }, { + "event" : "click.kamil.enterprise.machines.user.UserEvent.SUSPEND", + "className" : "click.kamil.enterprise.web.StateMachineDispatcher", + "methodName" : "suspendUser", + "sourceFile" : "src/main/java/click/kamil/enterprise/web/StateMachineDispatcher.java", + "sourceModule" : null, + "stateMachineId" : null, + "sourceState" : null, + "lineNumber" : 72, + "polymorphicEvents" : null + }, { + "event" : "event", + "className" : "click.kamil.enterprise.web.StateMachineDispatcher", + "methodName" : "dispatch", + "sourceFile" : "src/main/java/click/kamil/enterprise/web/StateMachineDispatcher.java", + "sourceModule" : null, + "stateMachineId" : null, + "sourceState" : "ORDER", + "lineNumber" : 81, + "polymorphicEvents" : null + }, { + "event" : "event", + "className" : "click.kamil.enterprise.web.StateMachineDispatcher", + "methodName" : "dispatch", + "sourceFile" : "src/main/java/click/kamil/enterprise/web/StateMachineDispatcher.java", + "sourceModule" : null, + "stateMachineId" : null, + "sourceState" : "DOCUMENT", + "lineNumber" : 87, + "polymorphicEvents" : null + }, { + "event" : "event", + "className" : "click.kamil.enterprise.web.StateMachineDispatcher", + "methodName" : "dispatch", + "sourceFile" : "src/main/java/click/kamil/enterprise/web/StateMachineDispatcher.java", + "sourceModule" : null, + "stateMachineId" : null, + "sourceState" : "USER", + "lineNumber" : 93, + "polymorphicEvents" : null + } ], "entryPoints" : [ { + "type" : "REST", + "name" : "POST /api/machine/order/pay", + "className" : "click.kamil.enterprise.web.StateMachineController", + "methodName" : "payOrder", + "sourceFile" : "src/main/java/click/kamil/enterprise/web/StateMachineController.java", + "metadata" : { + "path" : "/api/machine/order/pay", + "verb" : "POST" + }, + "parameters" : [ { + "name" : "userId", + "type" : "String", + "annotations" : [ "RequestParam" ] + } ] + }, { + "type" : "REST", + "name" : "POST /api/machine/order/ship", + "className" : "click.kamil.enterprise.web.StateMachineController", + "methodName" : "shipOrder", + "sourceFile" : "src/main/java/click/kamil/enterprise/web/StateMachineController.java", + "metadata" : { + "path" : "/api/machine/order/ship", + "verb" : "POST" + }, + "parameters" : [ { + "name" : "userId", + "type" : "String", + "annotations" : [ "RequestParam" ] + } ] + }, { + "type" : "REST", + "name" : "POST /api/machine/document/submit", + "className" : "click.kamil.enterprise.web.StateMachineController", + "methodName" : "submitDocument", + "sourceFile" : "src/main/java/click/kamil/enterprise/web/StateMachineController.java", + "metadata" : { + "path" : "/api/machine/document/submit", + "verb" : "POST" + }, + "parameters" : [ { + "name" : "userId", + "type" : "String", + "annotations" : [ "RequestParam" ] + } ] + }, { + "type" : "REST", + "name" : "POST /api/machine/document/approve", + "className" : "click.kamil.enterprise.web.StateMachineController", + "methodName" : "approveDocument", + "sourceFile" : "src/main/java/click/kamil/enterprise/web/StateMachineController.java", + "metadata" : { + "path" : "/api/machine/document/approve", + "verb" : "POST" + }, + "parameters" : [ { + "name" : "userId", + "type" : "String", + "annotations" : [ "RequestParam" ] + } ] + }, { + "type" : "REST", + "name" : "POST /api/machine/document/reject", + "className" : "click.kamil.enterprise.web.StateMachineController", + "methodName" : "rejectDocument", + "sourceFile" : "src/main/java/click/kamil/enterprise/web/StateMachineController.java", + "metadata" : { + "path" : "/api/machine/document/reject", + "verb" : "POST" + }, + "parameters" : [ { + "name" : "userId", + "type" : "String", + "annotations" : [ "RequestParam" ] + } ] + }, { + "type" : "REST", + "name" : "POST /api/machine/user/verify", + "className" : "click.kamil.enterprise.web.StateMachineController", + "methodName" : "verifyUser", + "sourceFile" : "src/main/java/click/kamil/enterprise/web/StateMachineController.java", + "metadata" : { + "path" : "/api/machine/user/verify", + "verb" : "POST" + }, + "parameters" : [ { + "name" : "userId", + "type" : "String", + "annotations" : [ "RequestParam" ] + } ] + }, { + "type" : "REST", + "name" : "POST /api/machine/user/suspend", + "className" : "click.kamil.enterprise.web.StateMachineController", + "methodName" : "suspendUser", + "sourceFile" : "src/main/java/click/kamil/enterprise/web/StateMachineController.java", + "metadata" : { + "path" : "/api/machine/user/suspend", + "verb" : "POST" + }, + "parameters" : [ { + "name" : "userId", + "type" : "String", + "annotations" : [ "RequestParam" ] + } ] + }, { "type" : "REST", "name" : "POST /api/machine/{machineType}/transition/{event}", "className" : "click.kamil.enterprise.web.StateMachineController", @@ -25,7 +230,373 @@ "annotations" : [ "RequestParam" ] } ] } ], - "callChains" : [ ], + "callChains" : [ { + "entryPoint" : { + "type" : "REST", + "name" : "POST /api/machine/order/pay", + "className" : "click.kamil.enterprise.web.StateMachineController", + "methodName" : "payOrder", + "sourceFile" : "src/main/java/click/kamil/enterprise/web/StateMachineController.java", + "metadata" : { + "path" : "/api/machine/order/pay", + "verb" : "POST" + }, + "parameters" : [ { + "name" : "userId", + "type" : "String", + "annotations" : [ "RequestParam" ] + } ] + }, + "methodChain" : [ "click.kamil.enterprise.web.StateMachineController.payOrder", "click.kamil.enterprise.web.StateMachineDispatcher.payOrder" ], + "triggerPoint" : { + "event" : "click.kamil.enterprise.machines.order.OrderEvent.PAY", + "className" : "click.kamil.enterprise.web.StateMachineDispatcher", + "methodName" : "payOrder", + "sourceFile" : "src/main/java/click/kamil/enterprise/web/StateMachineDispatcher.java", + "sourceModule" : null, + "stateMachineId" : null, + "sourceState" : null, + "lineNumber" : 30, + "polymorphicEvents" : [ "OrderEvent.PAY" ] + }, + "contextMachineId" : null, + "matchedTransitions" : [ { + "sourceState" : "OrderState.NEW", + "targetState" : "OrderState.PENDING", + "event" : "OrderEvent.PAY" + } ] + }, { + "entryPoint" : { + "type" : "REST", + "name" : "POST /api/machine/order/ship", + "className" : "click.kamil.enterprise.web.StateMachineController", + "methodName" : "shipOrder", + "sourceFile" : "src/main/java/click/kamil/enterprise/web/StateMachineController.java", + "metadata" : { + "path" : "/api/machine/order/ship", + "verb" : "POST" + }, + "parameters" : [ { + "name" : "userId", + "type" : "String", + "annotations" : [ "RequestParam" ] + } ] + }, + "methodChain" : [ "click.kamil.enterprise.web.StateMachineController.shipOrder", "click.kamil.enterprise.web.StateMachineDispatcher.shipOrder" ], + "triggerPoint" : { + "event" : "click.kamil.enterprise.machines.order.OrderEvent.SHIP", + "className" : "click.kamil.enterprise.web.StateMachineDispatcher", + "methodName" : "shipOrder", + "sourceFile" : "src/main/java/click/kamil/enterprise/web/StateMachineDispatcher.java", + "sourceModule" : null, + "stateMachineId" : null, + "sourceState" : null, + "lineNumber" : 37, + "polymorphicEvents" : [ "OrderEvent.SHIP" ] + }, + "contextMachineId" : null, + "matchedTransitions" : [ { + "sourceState" : "OrderState.PENDING", + "targetState" : "OrderState.SHIPPED", + "event" : "OrderEvent.SHIP" + } ] + }, { + "entryPoint" : { + "type" : "REST", + "name" : "POST /api/machine/document/submit", + "className" : "click.kamil.enterprise.web.StateMachineController", + "methodName" : "submitDocument", + "sourceFile" : "src/main/java/click/kamil/enterprise/web/StateMachineController.java", + "metadata" : { + "path" : "/api/machine/document/submit", + "verb" : "POST" + }, + "parameters" : [ { + "name" : "userId", + "type" : "String", + "annotations" : [ "RequestParam" ] + } ] + }, + "methodChain" : [ "click.kamil.enterprise.web.StateMachineController.submitDocument", "click.kamil.enterprise.web.StateMachineDispatcher.submitDocument" ], + "triggerPoint" : { + "event" : "click.kamil.enterprise.machines.document.DocumentEvent.SUBMIT", + "className" : "click.kamil.enterprise.web.StateMachineDispatcher", + "methodName" : "submitDocument", + "sourceFile" : "src/main/java/click/kamil/enterprise/web/StateMachineDispatcher.java", + "sourceModule" : null, + "stateMachineId" : null, + "sourceState" : null, + "lineNumber" : 44, + "polymorphicEvents" : [ "DocumentEvent.SUBMIT" ] + }, + "contextMachineId" : null, + "matchedTransitions" : null + }, { + "entryPoint" : { + "type" : "REST", + "name" : "POST /api/machine/document/approve", + "className" : "click.kamil.enterprise.web.StateMachineController", + "methodName" : "approveDocument", + "sourceFile" : "src/main/java/click/kamil/enterprise/web/StateMachineController.java", + "metadata" : { + "path" : "/api/machine/document/approve", + "verb" : "POST" + }, + "parameters" : [ { + "name" : "userId", + "type" : "String", + "annotations" : [ "RequestParam" ] + } ] + }, + "methodChain" : [ "click.kamil.enterprise.web.StateMachineController.approveDocument", "click.kamil.enterprise.web.StateMachineDispatcher.approveDocument" ], + "triggerPoint" : { + "event" : "click.kamil.enterprise.machines.document.DocumentEvent.APPROVE", + "className" : "click.kamil.enterprise.web.StateMachineDispatcher", + "methodName" : "approveDocument", + "sourceFile" : "src/main/java/click/kamil/enterprise/web/StateMachineDispatcher.java", + "sourceModule" : null, + "stateMachineId" : null, + "sourceState" : null, + "lineNumber" : 51, + "polymorphicEvents" : [ "DocumentEvent.APPROVE" ] + }, + "contextMachineId" : null, + "matchedTransitions" : null + }, { + "entryPoint" : { + "type" : "REST", + "name" : "POST /api/machine/document/reject", + "className" : "click.kamil.enterprise.web.StateMachineController", + "methodName" : "rejectDocument", + "sourceFile" : "src/main/java/click/kamil/enterprise/web/StateMachineController.java", + "metadata" : { + "path" : "/api/machine/document/reject", + "verb" : "POST" + }, + "parameters" : [ { + "name" : "userId", + "type" : "String", + "annotations" : [ "RequestParam" ] + } ] + }, + "methodChain" : [ "click.kamil.enterprise.web.StateMachineController.rejectDocument", "click.kamil.enterprise.web.StateMachineDispatcher.rejectDocument" ], + "triggerPoint" : { + "event" : "click.kamil.enterprise.machines.document.DocumentEvent.REJECT", + "className" : "click.kamil.enterprise.web.StateMachineDispatcher", + "methodName" : "rejectDocument", + "sourceFile" : "src/main/java/click/kamil/enterprise/web/StateMachineDispatcher.java", + "sourceModule" : null, + "stateMachineId" : null, + "sourceState" : null, + "lineNumber" : 58, + "polymorphicEvents" : [ "DocumentEvent.REJECT" ] + }, + "contextMachineId" : null, + "matchedTransitions" : null + }, { + "entryPoint" : { + "type" : "REST", + "name" : "POST /api/machine/user/verify", + "className" : "click.kamil.enterprise.web.StateMachineController", + "methodName" : "verifyUser", + "sourceFile" : "src/main/java/click/kamil/enterprise/web/StateMachineController.java", + "metadata" : { + "path" : "/api/machine/user/verify", + "verb" : "POST" + }, + "parameters" : [ { + "name" : "userId", + "type" : "String", + "annotations" : [ "RequestParam" ] + } ] + }, + "methodChain" : [ "click.kamil.enterprise.web.StateMachineController.verifyUser", "click.kamil.enterprise.web.StateMachineDispatcher.verifyUser" ], + "triggerPoint" : { + "event" : "click.kamil.enterprise.machines.user.UserEvent.VERIFY", + "className" : "click.kamil.enterprise.web.StateMachineDispatcher", + "methodName" : "verifyUser", + "sourceFile" : "src/main/java/click/kamil/enterprise/web/StateMachineDispatcher.java", + "sourceModule" : null, + "stateMachineId" : null, + "sourceState" : null, + "lineNumber" : 65, + "polymorphicEvents" : [ "UserEvent.VERIFY" ] + }, + "contextMachineId" : null, + "matchedTransitions" : null + }, { + "entryPoint" : { + "type" : "REST", + "name" : "POST /api/machine/user/suspend", + "className" : "click.kamil.enterprise.web.StateMachineController", + "methodName" : "suspendUser", + "sourceFile" : "src/main/java/click/kamil/enterprise/web/StateMachineController.java", + "metadata" : { + "path" : "/api/machine/user/suspend", + "verb" : "POST" + }, + "parameters" : [ { + "name" : "userId", + "type" : "String", + "annotations" : [ "RequestParam" ] + } ] + }, + "methodChain" : [ "click.kamil.enterprise.web.StateMachineController.suspendUser", "click.kamil.enterprise.web.StateMachineDispatcher.suspendUser" ], + "triggerPoint" : { + "event" : "click.kamil.enterprise.machines.user.UserEvent.SUSPEND", + "className" : "click.kamil.enterprise.web.StateMachineDispatcher", + "methodName" : "suspendUser", + "sourceFile" : "src/main/java/click/kamil/enterprise/web/StateMachineDispatcher.java", + "sourceModule" : null, + "stateMachineId" : null, + "sourceState" : null, + "lineNumber" : 72, + "polymorphicEvents" : [ "UserEvent.SUSPEND" ] + }, + "contextMachineId" : null, + "matchedTransitions" : null + }, { + "entryPoint" : { + "type" : "REST", + "name" : "POST /api/machine/{machineType}/transition/{event}", + "className" : "click.kamil.enterprise.web.StateMachineController", + "methodName" : "transition", + "sourceFile" : "src/main/java/click/kamil/enterprise/web/StateMachineController.java", + "metadata" : { + "path" : "/api/machine/{machineType}/transition/{event}", + "verb" : "POST" + }, + "parameters" : [ { + "name" : "machineType", + "type" : "String", + "annotations" : [ "PathVariable" ] + }, { + "name" : "event", + "type" : "String", + "annotations" : [ "PathVariable" ] + }, { + "name" : "userId", + "type" : "String", + "annotations" : [ "RequestParam" ] + } ] + }, + "methodChain" : [ "click.kamil.enterprise.web.StateMachineController.transition", "click.kamil.enterprise.web.StateMachineDispatcher.dispatch" ], + "triggerPoint" : { + "event" : "true ? OrderEvent.valueOf(eventString.toUpperCase()) : true ? DocumentEvent.valueOf(eventString.toUpperCase()) : UserEvent.valueOf(eventString.toUpperCase())", + "className" : "click.kamil.enterprise.web.StateMachineDispatcher", + "methodName" : "dispatch", + "sourceFile" : "src/main/java/click/kamil/enterprise/web/StateMachineDispatcher.java", + "sourceModule" : null, + "stateMachineId" : null, + "sourceState" : null, + "lineNumber" : 81, + "polymorphicEvents" : [ ] + }, + "contextMachineId" : null, + "matchedTransitions" : [ { + "sourceState" : "OrderState.NEW", + "targetState" : "OrderState.PENDING", + "event" : "OrderEvent.PAY" + }, { + "sourceState" : "OrderState.PENDING", + "targetState" : "OrderState.SHIPPED", + "event" : "OrderEvent.SHIP" + } ] + }, { + "entryPoint" : { + "type" : "REST", + "name" : "POST /api/machine/{machineType}/transition/{event}", + "className" : "click.kamil.enterprise.web.StateMachineController", + "methodName" : "transition", + "sourceFile" : "src/main/java/click/kamil/enterprise/web/StateMachineController.java", + "metadata" : { + "path" : "/api/machine/{machineType}/transition/{event}", + "verb" : "POST" + }, + "parameters" : [ { + "name" : "machineType", + "type" : "String", + "annotations" : [ "PathVariable" ] + }, { + "name" : "event", + "type" : "String", + "annotations" : [ "PathVariable" ] + }, { + "name" : "userId", + "type" : "String", + "annotations" : [ "RequestParam" ] + } ] + }, + "methodChain" : [ "click.kamil.enterprise.web.StateMachineController.transition", "click.kamil.enterprise.web.StateMachineDispatcher.dispatch" ], + "triggerPoint" : { + "event" : "true ? OrderEvent.valueOf(eventString.toUpperCase()) : true ? DocumentEvent.valueOf(eventString.toUpperCase()) : UserEvent.valueOf(eventString.toUpperCase())", + "className" : "click.kamil.enterprise.web.StateMachineDispatcher", + "methodName" : "dispatch", + "sourceFile" : "src/main/java/click/kamil/enterprise/web/StateMachineDispatcher.java", + "sourceModule" : null, + "stateMachineId" : null, + "sourceState" : null, + "lineNumber" : 87, + "polymorphicEvents" : [ ] + }, + "contextMachineId" : null, + "matchedTransitions" : [ { + "sourceState" : "OrderState.NEW", + "targetState" : "OrderState.PENDING", + "event" : "OrderEvent.PAY" + }, { + "sourceState" : "OrderState.PENDING", + "targetState" : "OrderState.SHIPPED", + "event" : "OrderEvent.SHIP" + } ] + }, { + "entryPoint" : { + "type" : "REST", + "name" : "POST /api/machine/{machineType}/transition/{event}", + "className" : "click.kamil.enterprise.web.StateMachineController", + "methodName" : "transition", + "sourceFile" : "src/main/java/click/kamil/enterprise/web/StateMachineController.java", + "metadata" : { + "path" : "/api/machine/{machineType}/transition/{event}", + "verb" : "POST" + }, + "parameters" : [ { + "name" : "machineType", + "type" : "String", + "annotations" : [ "PathVariable" ] + }, { + "name" : "event", + "type" : "String", + "annotations" : [ "PathVariable" ] + }, { + "name" : "userId", + "type" : "String", + "annotations" : [ "RequestParam" ] + } ] + }, + "methodChain" : [ "click.kamil.enterprise.web.StateMachineController.transition", "click.kamil.enterprise.web.StateMachineDispatcher.dispatch" ], + "triggerPoint" : { + "event" : "true ? OrderEvent.valueOf(eventString.toUpperCase()) : true ? DocumentEvent.valueOf(eventString.toUpperCase()) : UserEvent.valueOf(eventString.toUpperCase())", + "className" : "click.kamil.enterprise.web.StateMachineDispatcher", + "methodName" : "dispatch", + "sourceFile" : "src/main/java/click/kamil/enterprise/web/StateMachineDispatcher.java", + "sourceModule" : null, + "stateMachineId" : null, + "sourceState" : null, + "lineNumber" : 93, + "polymorphicEvents" : [ ] + }, + "contextMachineId" : null, + "matchedTransitions" : [ { + "sourceState" : "OrderState.NEW", + "targetState" : "OrderState.PENDING", + "event" : "OrderEvent.PAY" + }, { + "sourceState" : "OrderState.PENDING", + "targetState" : "OrderState.SHIPPED", + "event" : "OrderEvent.SHIP" + } ] + } ], "properties" : { "default" : { } } diff --git a/state_machine_exporter/src/test/resources/golden/PolymorphicStateMachineConfiguration/PolymorphicStateMachineConfiguration.json b/state_machine_exporter/src/test/resources/golden/PolymorphicStateMachineConfiguration/PolymorphicStateMachineConfiguration.json index 490e359..0443c91 100644 --- a/state_machine_exporter/src/test/resources/golden/PolymorphicStateMachineConfiguration/PolymorphicStateMachineConfiguration.json +++ b/state_machine_exporter/src/test/resources/golden/PolymorphicStateMachineConfiguration/PolymorphicStateMachineConfiguration.json @@ -9,7 +9,9 @@ "stateMachineId" : null, "sourceState" : null, "lineNumber" : 13, - "polymorphicEvents" : null + "polymorphicEvents" : null, + "external" : false, + "constraint" : null }, { "event" : "payload", "className" : "click.kamil.examples.statemachine.polymorphic.OrderService", @@ -19,7 +21,9 @@ "stateMachineId" : null, "sourceState" : null, "lineNumber" : 17, - "polymorphicEvents" : null + "polymorphicEvents" : null, + "external" : false, + "constraint" : null }, { "event" : "event", "className" : "click.kamil.examples.statemachine.polymorphic.OrderService", @@ -29,7 +33,9 @@ "stateMachineId" : null, "sourceState" : null, "lineNumber" : 21, - "polymorphicEvents" : null + "polymorphicEvents" : null, + "external" : false, + "constraint" : null } ], "entryPoints" : [ { "type" : "REST", @@ -191,7 +197,9 @@ "stateMachineId" : null, "sourceState" : null, "lineNumber" : 13, - "polymorphicEvents" : [ "OrderEvents.PAY" ] + "polymorphicEvents" : [ "OrderEvents.PAY" ], + "external" : false, + "constraint" : null }, "contextMachineId" : null, "matchedTransitions" : [ { @@ -222,7 +230,9 @@ "stateMachineId" : null, "sourceState" : null, "lineNumber" : 13, - "polymorphicEvents" : [ "OrderEvents.FULFILL" ] + "polymorphicEvents" : [ "OrderEvents.FULFILL" ], + "external" : false, + "constraint" : null }, "contextMachineId" : null, "matchedTransitions" : [ { @@ -253,7 +263,9 @@ "stateMachineId" : null, "sourceState" : null, "lineNumber" : 13, - "polymorphicEvents" : [ "OrderEvents.CANCEL" ] + "polymorphicEvents" : [ "OrderEvents.CANCEL" ], + "external" : false, + "constraint" : null }, "contextMachineId" : null, "matchedTransitions" : [ { @@ -284,7 +296,9 @@ "stateMachineId" : null, "sourceState" : null, "lineNumber" : 17, - "polymorphicEvents" : [ "OrderEvents.PAY" ] + "polymorphicEvents" : [ "OrderEvents.PAY" ], + "external" : false, + "constraint" : null }, "contextMachineId" : null, "matchedTransitions" : [ { @@ -315,7 +329,9 @@ "stateMachineId" : null, "sourceState" : null, "lineNumber" : 13, - "polymorphicEvents" : [ "OrderEvents.PAY" ] + "polymorphicEvents" : [ "OrderEvents.PAY" ], + "external" : false, + "constraint" : null }, "contextMachineId" : null, "matchedTransitions" : [ { @@ -346,7 +362,9 @@ "stateMachineId" : null, "sourceState" : null, "lineNumber" : 13, - "polymorphicEvents" : [ "OrderEvents.PAY" ] + "polymorphicEvents" : [ "OrderEvents.PAY" ], + "external" : false, + "constraint" : null }, "contextMachineId" : null, "matchedTransitions" : [ { @@ -381,7 +399,9 @@ "stateMachineId" : null, "sourceState" : null, "lineNumber" : 13, - "polymorphicEvents" : [ "OrderEvents.PAY", "OrderEvents.CANCEL" ] + "polymorphicEvents" : [ "OrderEvents.PAY", "OrderEvents.CANCEL" ], + "external" : false, + "constraint" : null }, "contextMachineId" : null, "matchedTransitions" : [ { @@ -416,7 +436,9 @@ "stateMachineId" : null, "sourceState" : null, "lineNumber" : 13, - "polymorphicEvents" : [ "OrderEvents.PAY" ] + "polymorphicEvents" : [ "OrderEvents.PAY" ], + "external" : false, + "constraint" : null }, "contextMachineId" : null, "matchedTransitions" : [ { @@ -447,7 +469,9 @@ "stateMachineId" : null, "sourceState" : null, "lineNumber" : 13, - "polymorphicEvents" : [ "OrderEvents.FULFILL" ] + "polymorphicEvents" : [ "OrderEvents.FULFILL" ], + "external" : false, + "constraint" : null }, "contextMachineId" : null, "matchedTransitions" : [ { @@ -478,7 +502,9 @@ "stateMachineId" : null, "sourceState" : null, "lineNumber" : 13, - "polymorphicEvents" : [ "OrderEvents.CANCEL" ] + "polymorphicEvents" : [ "OrderEvents.CANCEL" ], + "external" : false, + "constraint" : null }, "contextMachineId" : null, "matchedTransitions" : [ { @@ -509,7 +535,9 @@ "stateMachineId" : null, "sourceState" : null, "lineNumber" : 21, - "polymorphicEvents" : [ "OrderEvents.ABCD" ] + "polymorphicEvents" : [ "OrderEvents.ABCD" ], + "external" : false, + "constraint" : null }, "contextMachineId" : null, "matchedTransitions" : [ { @@ -540,7 +568,9 @@ "stateMachineId" : null, "sourceState" : null, "lineNumber" : 21, - "polymorphicEvents" : [ "OrderEvents.ABCD", "OrderEvents.PAY" ] + "polymorphicEvents" : [ "OrderEvents.ABCD", "OrderEvents.PAY" ], + "external" : false, + "constraint" : null }, "contextMachineId" : null, "matchedTransitions" : [ { diff --git a/state_machine_exporter/src/test/resources/golden/StateMachineConfig/StateMachineConfig.json b/state_machine_exporter/src/test/resources/golden/StateMachineConfig/StateMachineConfig.json index 1e0151b..c97874b 100644 --- a/state_machine_exporter/src/test/resources/golden/StateMachineConfig/StateMachineConfig.json +++ b/state_machine_exporter/src/test/resources/golden/StateMachineConfig/StateMachineConfig.json @@ -9,7 +9,9 @@ "stateMachineId" : null, "sourceState" : null, "lineNumber" : 25, - "polymorphicEvents" : null + "polymorphicEvents" : null, + "external" : false, + "constraint" : "event instanceof OrderEvent" }, { "event" : "eventProvider", "className" : "click.kamil.service.StateMachineServiceImpl", @@ -19,7 +21,9 @@ "stateMachineId" : null, "sourceState" : null, "lineNumber" : 50, - "polymorphicEvents" : null + "polymorphicEvents" : null, + "external" : false, + "constraint" : "event != null" }, { "event" : "customMessage", "className" : "click.kamil.service.StateMachineServiceImpl", @@ -29,7 +33,9 @@ "stateMachineId" : null, "sourceState" : null, "lineNumber" : 78, - "polymorphicEvents" : null + "polymorphicEvents" : null, + "external" : false, + "constraint" : null } ], "entryPoints" : [ { "type" : "REST", @@ -144,7 +150,9 @@ "stateMachineId" : null, "sourceState" : null, "lineNumber" : 25, - "polymorphicEvents" : [ "OrderEvent.PROCESS" ] + "polymorphicEvents" : [ "OrderEvent.PROCESS" ], + "external" : false, + "constraint" : "event instanceof OrderEvent" }, "contextMachineId" : null, "matchedTransitions" : [ { @@ -175,7 +183,9 @@ "stateMachineId" : null, "sourceState" : null, "lineNumber" : 25, - "polymorphicEvents" : [ "OrderEvent.COMPLETE" ] + "polymorphicEvents" : [ "OrderEvent.COMPLETE" ], + "external" : false, + "constraint" : "event instanceof OrderEvent" }, "contextMachineId" : null, "matchedTransitions" : [ { @@ -206,7 +216,9 @@ "stateMachineId" : null, "sourceState" : null, "lineNumber" : 25, - "polymorphicEvents" : [ "OrderEvent.CANCEL" ] + "polymorphicEvents" : [ "OrderEvent.CANCEL" ], + "external" : false, + "constraint" : "event instanceof OrderEvent" }, "contextMachineId" : null, "matchedTransitions" : [ { @@ -241,7 +253,9 @@ "stateMachineId" : null, "sourceState" : null, "lineNumber" : 25, - "polymorphicEvents" : [ "OrderEvent.COMPLETE" ] + "polymorphicEvents" : [ "OrderEvent.COMPLETE" ], + "external" : false, + "constraint" : "event instanceof OrderEvent" }, "contextMachineId" : null, "matchedTransitions" : [ { @@ -276,7 +290,9 @@ "stateMachineId" : null, "sourceState" : null, "lineNumber" : 78, - "polymorphicEvents" : [ "OrderEvent.PROCESS" ] + "polymorphicEvents" : [ "OrderEvent.PROCESS" ], + "external" : false, + "constraint" : null }, "contextMachineId" : null, "matchedTransitions" : [ { @@ -311,7 +327,9 @@ "stateMachineId" : null, "sourceState" : null, "lineNumber" : 25, - "polymorphicEvents" : [ "OrderEvent.PROCESS" ] + "polymorphicEvents" : [ "OrderEvent.PROCESS" ], + "external" : false, + "constraint" : "event instanceof OrderEvent" }, "contextMachineId" : null, "matchedTransitions" : [ { @@ -346,7 +364,9 @@ "stateMachineId" : null, "sourceState" : null, "lineNumber" : 50, - "polymorphicEvents" : [ "OrderEvent.CANCEL" ] + "polymorphicEvents" : [ "OrderEvent.CANCEL" ], + "external" : false, + "constraint" : "event != null" }, "contextMachineId" : null, "matchedTransitions" : [ { diff --git a/state_machine_exporter/src/test/resources/golden/UserStateMachineConfiguration/UserStateMachineConfiguration.json b/state_machine_exporter/src/test/resources/golden/UserStateMachineConfiguration/UserStateMachineConfiguration.json index 6f04727..3a3ba9b 100644 --- a/state_machine_exporter/src/test/resources/golden/UserStateMachineConfiguration/UserStateMachineConfiguration.json +++ b/state_machine_exporter/src/test/resources/golden/UserStateMachineConfiguration/UserStateMachineConfiguration.json @@ -1,7 +1,212 @@ { "metadata" : { - "triggers" : [ ], + "triggers" : [ { + "event" : "click.kamil.enterprise.machines.order.OrderEvent.PAY", + "className" : "click.kamil.enterprise.web.StateMachineDispatcher", + "methodName" : "payOrder", + "sourceFile" : "src/main/java/click/kamil/enterprise/web/StateMachineDispatcher.java", + "sourceModule" : null, + "stateMachineId" : null, + "sourceState" : null, + "lineNumber" : 30, + "polymorphicEvents" : null + }, { + "event" : "click.kamil.enterprise.machines.order.OrderEvent.SHIP", + "className" : "click.kamil.enterprise.web.StateMachineDispatcher", + "methodName" : "shipOrder", + "sourceFile" : "src/main/java/click/kamil/enterprise/web/StateMachineDispatcher.java", + "sourceModule" : null, + "stateMachineId" : null, + "sourceState" : null, + "lineNumber" : 37, + "polymorphicEvents" : null + }, { + "event" : "click.kamil.enterprise.machines.document.DocumentEvent.SUBMIT", + "className" : "click.kamil.enterprise.web.StateMachineDispatcher", + "methodName" : "submitDocument", + "sourceFile" : "src/main/java/click/kamil/enterprise/web/StateMachineDispatcher.java", + "sourceModule" : null, + "stateMachineId" : null, + "sourceState" : null, + "lineNumber" : 44, + "polymorphicEvents" : null + }, { + "event" : "click.kamil.enterprise.machines.document.DocumentEvent.APPROVE", + "className" : "click.kamil.enterprise.web.StateMachineDispatcher", + "methodName" : "approveDocument", + "sourceFile" : "src/main/java/click/kamil/enterprise/web/StateMachineDispatcher.java", + "sourceModule" : null, + "stateMachineId" : null, + "sourceState" : null, + "lineNumber" : 51, + "polymorphicEvents" : null + }, { + "event" : "click.kamil.enterprise.machines.document.DocumentEvent.REJECT", + "className" : "click.kamil.enterprise.web.StateMachineDispatcher", + "methodName" : "rejectDocument", + "sourceFile" : "src/main/java/click/kamil/enterprise/web/StateMachineDispatcher.java", + "sourceModule" : null, + "stateMachineId" : null, + "sourceState" : null, + "lineNumber" : 58, + "polymorphicEvents" : null + }, { + "event" : "click.kamil.enterprise.machines.user.UserEvent.VERIFY", + "className" : "click.kamil.enterprise.web.StateMachineDispatcher", + "methodName" : "verifyUser", + "sourceFile" : "src/main/java/click/kamil/enterprise/web/StateMachineDispatcher.java", + "sourceModule" : null, + "stateMachineId" : null, + "sourceState" : null, + "lineNumber" : 65, + "polymorphicEvents" : null + }, { + "event" : "click.kamil.enterprise.machines.user.UserEvent.SUSPEND", + "className" : "click.kamil.enterprise.web.StateMachineDispatcher", + "methodName" : "suspendUser", + "sourceFile" : "src/main/java/click/kamil/enterprise/web/StateMachineDispatcher.java", + "sourceModule" : null, + "stateMachineId" : null, + "sourceState" : null, + "lineNumber" : 72, + "polymorphicEvents" : null + }, { + "event" : "event", + "className" : "click.kamil.enterprise.web.StateMachineDispatcher", + "methodName" : "dispatch", + "sourceFile" : "src/main/java/click/kamil/enterprise/web/StateMachineDispatcher.java", + "sourceModule" : null, + "stateMachineId" : null, + "sourceState" : "ORDER", + "lineNumber" : 81, + "polymorphicEvents" : null + }, { + "event" : "event", + "className" : "click.kamil.enterprise.web.StateMachineDispatcher", + "methodName" : "dispatch", + "sourceFile" : "src/main/java/click/kamil/enterprise/web/StateMachineDispatcher.java", + "sourceModule" : null, + "stateMachineId" : null, + "sourceState" : "DOCUMENT", + "lineNumber" : 87, + "polymorphicEvents" : null + }, { + "event" : "event", + "className" : "click.kamil.enterprise.web.StateMachineDispatcher", + "methodName" : "dispatch", + "sourceFile" : "src/main/java/click/kamil/enterprise/web/StateMachineDispatcher.java", + "sourceModule" : null, + "stateMachineId" : null, + "sourceState" : "USER", + "lineNumber" : 93, + "polymorphicEvents" : null + } ], "entryPoints" : [ { + "type" : "REST", + "name" : "POST /api/machine/order/pay", + "className" : "click.kamil.enterprise.web.StateMachineController", + "methodName" : "payOrder", + "sourceFile" : "src/main/java/click/kamil/enterprise/web/StateMachineController.java", + "metadata" : { + "path" : "/api/machine/order/pay", + "verb" : "POST" + }, + "parameters" : [ { + "name" : "userId", + "type" : "String", + "annotations" : [ "RequestParam" ] + } ] + }, { + "type" : "REST", + "name" : "POST /api/machine/order/ship", + "className" : "click.kamil.enterprise.web.StateMachineController", + "methodName" : "shipOrder", + "sourceFile" : "src/main/java/click/kamil/enterprise/web/StateMachineController.java", + "metadata" : { + "path" : "/api/machine/order/ship", + "verb" : "POST" + }, + "parameters" : [ { + "name" : "userId", + "type" : "String", + "annotations" : [ "RequestParam" ] + } ] + }, { + "type" : "REST", + "name" : "POST /api/machine/document/submit", + "className" : "click.kamil.enterprise.web.StateMachineController", + "methodName" : "submitDocument", + "sourceFile" : "src/main/java/click/kamil/enterprise/web/StateMachineController.java", + "metadata" : { + "path" : "/api/machine/document/submit", + "verb" : "POST" + }, + "parameters" : [ { + "name" : "userId", + "type" : "String", + "annotations" : [ "RequestParam" ] + } ] + }, { + "type" : "REST", + "name" : "POST /api/machine/document/approve", + "className" : "click.kamil.enterprise.web.StateMachineController", + "methodName" : "approveDocument", + "sourceFile" : "src/main/java/click/kamil/enterprise/web/StateMachineController.java", + "metadata" : { + "path" : "/api/machine/document/approve", + "verb" : "POST" + }, + "parameters" : [ { + "name" : "userId", + "type" : "String", + "annotations" : [ "RequestParam" ] + } ] + }, { + "type" : "REST", + "name" : "POST /api/machine/document/reject", + "className" : "click.kamil.enterprise.web.StateMachineController", + "methodName" : "rejectDocument", + "sourceFile" : "src/main/java/click/kamil/enterprise/web/StateMachineController.java", + "metadata" : { + "path" : "/api/machine/document/reject", + "verb" : "POST" + }, + "parameters" : [ { + "name" : "userId", + "type" : "String", + "annotations" : [ "RequestParam" ] + } ] + }, { + "type" : "REST", + "name" : "POST /api/machine/user/verify", + "className" : "click.kamil.enterprise.web.StateMachineController", + "methodName" : "verifyUser", + "sourceFile" : "src/main/java/click/kamil/enterprise/web/StateMachineController.java", + "metadata" : { + "path" : "/api/machine/user/verify", + "verb" : "POST" + }, + "parameters" : [ { + "name" : "userId", + "type" : "String", + "annotations" : [ "RequestParam" ] + } ] + }, { + "type" : "REST", + "name" : "POST /api/machine/user/suspend", + "className" : "click.kamil.enterprise.web.StateMachineController", + "methodName" : "suspendUser", + "sourceFile" : "src/main/java/click/kamil/enterprise/web/StateMachineController.java", + "metadata" : { + "path" : "/api/machine/user/suspend", + "verb" : "POST" + }, + "parameters" : [ { + "name" : "userId", + "type" : "String", + "annotations" : [ "RequestParam" ] + } ] + }, { "type" : "REST", "name" : "POST /api/machine/{machineType}/transition/{event}", "className" : "click.kamil.enterprise.web.StateMachineController", @@ -25,7 +230,369 @@ "annotations" : [ "RequestParam" ] } ] } ], - "callChains" : [ ], + "callChains" : [ { + "entryPoint" : { + "type" : "REST", + "name" : "POST /api/machine/order/pay", + "className" : "click.kamil.enterprise.web.StateMachineController", + "methodName" : "payOrder", + "sourceFile" : "src/main/java/click/kamil/enterprise/web/StateMachineController.java", + "metadata" : { + "path" : "/api/machine/order/pay", + "verb" : "POST" + }, + "parameters" : [ { + "name" : "userId", + "type" : "String", + "annotations" : [ "RequestParam" ] + } ] + }, + "methodChain" : [ "click.kamil.enterprise.web.StateMachineController.payOrder", "click.kamil.enterprise.web.StateMachineDispatcher.payOrder" ], + "triggerPoint" : { + "event" : "click.kamil.enterprise.machines.order.OrderEvent.PAY", + "className" : "click.kamil.enterprise.web.StateMachineDispatcher", + "methodName" : "payOrder", + "sourceFile" : "src/main/java/click/kamil/enterprise/web/StateMachineDispatcher.java", + "sourceModule" : null, + "stateMachineId" : null, + "sourceState" : null, + "lineNumber" : 30, + "polymorphicEvents" : [ "OrderEvent.PAY" ] + }, + "contextMachineId" : null, + "matchedTransitions" : null + }, { + "entryPoint" : { + "type" : "REST", + "name" : "POST /api/machine/order/ship", + "className" : "click.kamil.enterprise.web.StateMachineController", + "methodName" : "shipOrder", + "sourceFile" : "src/main/java/click/kamil/enterprise/web/StateMachineController.java", + "metadata" : { + "path" : "/api/machine/order/ship", + "verb" : "POST" + }, + "parameters" : [ { + "name" : "userId", + "type" : "String", + "annotations" : [ "RequestParam" ] + } ] + }, + "methodChain" : [ "click.kamil.enterprise.web.StateMachineController.shipOrder", "click.kamil.enterprise.web.StateMachineDispatcher.shipOrder" ], + "triggerPoint" : { + "event" : "click.kamil.enterprise.machines.order.OrderEvent.SHIP", + "className" : "click.kamil.enterprise.web.StateMachineDispatcher", + "methodName" : "shipOrder", + "sourceFile" : "src/main/java/click/kamil/enterprise/web/StateMachineDispatcher.java", + "sourceModule" : null, + "stateMachineId" : null, + "sourceState" : null, + "lineNumber" : 37, + "polymorphicEvents" : [ "OrderEvent.SHIP" ] + }, + "contextMachineId" : null, + "matchedTransitions" : null + }, { + "entryPoint" : { + "type" : "REST", + "name" : "POST /api/machine/document/submit", + "className" : "click.kamil.enterprise.web.StateMachineController", + "methodName" : "submitDocument", + "sourceFile" : "src/main/java/click/kamil/enterprise/web/StateMachineController.java", + "metadata" : { + "path" : "/api/machine/document/submit", + "verb" : "POST" + }, + "parameters" : [ { + "name" : "userId", + "type" : "String", + "annotations" : [ "RequestParam" ] + } ] + }, + "methodChain" : [ "click.kamil.enterprise.web.StateMachineController.submitDocument", "click.kamil.enterprise.web.StateMachineDispatcher.submitDocument" ], + "triggerPoint" : { + "event" : "click.kamil.enterprise.machines.document.DocumentEvent.SUBMIT", + "className" : "click.kamil.enterprise.web.StateMachineDispatcher", + "methodName" : "submitDocument", + "sourceFile" : "src/main/java/click/kamil/enterprise/web/StateMachineDispatcher.java", + "sourceModule" : null, + "stateMachineId" : null, + "sourceState" : null, + "lineNumber" : 44, + "polymorphicEvents" : [ "DocumentEvent.SUBMIT" ] + }, + "contextMachineId" : null, + "matchedTransitions" : null + }, { + "entryPoint" : { + "type" : "REST", + "name" : "POST /api/machine/document/approve", + "className" : "click.kamil.enterprise.web.StateMachineController", + "methodName" : "approveDocument", + "sourceFile" : "src/main/java/click/kamil/enterprise/web/StateMachineController.java", + "metadata" : { + "path" : "/api/machine/document/approve", + "verb" : "POST" + }, + "parameters" : [ { + "name" : "userId", + "type" : "String", + "annotations" : [ "RequestParam" ] + } ] + }, + "methodChain" : [ "click.kamil.enterprise.web.StateMachineController.approveDocument", "click.kamil.enterprise.web.StateMachineDispatcher.approveDocument" ], + "triggerPoint" : { + "event" : "click.kamil.enterprise.machines.document.DocumentEvent.APPROVE", + "className" : "click.kamil.enterprise.web.StateMachineDispatcher", + "methodName" : "approveDocument", + "sourceFile" : "src/main/java/click/kamil/enterprise/web/StateMachineDispatcher.java", + "sourceModule" : null, + "stateMachineId" : null, + "sourceState" : null, + "lineNumber" : 51, + "polymorphicEvents" : [ "DocumentEvent.APPROVE" ] + }, + "contextMachineId" : null, + "matchedTransitions" : null + }, { + "entryPoint" : { + "type" : "REST", + "name" : "POST /api/machine/document/reject", + "className" : "click.kamil.enterprise.web.StateMachineController", + "methodName" : "rejectDocument", + "sourceFile" : "src/main/java/click/kamil/enterprise/web/StateMachineController.java", + "metadata" : { + "path" : "/api/machine/document/reject", + "verb" : "POST" + }, + "parameters" : [ { + "name" : "userId", + "type" : "String", + "annotations" : [ "RequestParam" ] + } ] + }, + "methodChain" : [ "click.kamil.enterprise.web.StateMachineController.rejectDocument", "click.kamil.enterprise.web.StateMachineDispatcher.rejectDocument" ], + "triggerPoint" : { + "event" : "click.kamil.enterprise.machines.document.DocumentEvent.REJECT", + "className" : "click.kamil.enterprise.web.StateMachineDispatcher", + "methodName" : "rejectDocument", + "sourceFile" : "src/main/java/click/kamil/enterprise/web/StateMachineDispatcher.java", + "sourceModule" : null, + "stateMachineId" : null, + "sourceState" : null, + "lineNumber" : 58, + "polymorphicEvents" : [ "DocumentEvent.REJECT" ] + }, + "contextMachineId" : null, + "matchedTransitions" : null + }, { + "entryPoint" : { + "type" : "REST", + "name" : "POST /api/machine/user/verify", + "className" : "click.kamil.enterprise.web.StateMachineController", + "methodName" : "verifyUser", + "sourceFile" : "src/main/java/click/kamil/enterprise/web/StateMachineController.java", + "metadata" : { + "path" : "/api/machine/user/verify", + "verb" : "POST" + }, + "parameters" : [ { + "name" : "userId", + "type" : "String", + "annotations" : [ "RequestParam" ] + } ] + }, + "methodChain" : [ "click.kamil.enterprise.web.StateMachineController.verifyUser", "click.kamil.enterprise.web.StateMachineDispatcher.verifyUser" ], + "triggerPoint" : { + "event" : "click.kamil.enterprise.machines.user.UserEvent.VERIFY", + "className" : "click.kamil.enterprise.web.StateMachineDispatcher", + "methodName" : "verifyUser", + "sourceFile" : "src/main/java/click/kamil/enterprise/web/StateMachineDispatcher.java", + "sourceModule" : null, + "stateMachineId" : null, + "sourceState" : null, + "lineNumber" : 65, + "polymorphicEvents" : [ "UserEvent.VERIFY" ] + }, + "contextMachineId" : null, + "matchedTransitions" : [ { + "sourceState" : "UserState.REGISTERED", + "targetState" : "UserState.VERIFIED", + "event" : "UserEvent.VERIFY" + } ] + }, { + "entryPoint" : { + "type" : "REST", + "name" : "POST /api/machine/user/suspend", + "className" : "click.kamil.enterprise.web.StateMachineController", + "methodName" : "suspendUser", + "sourceFile" : "src/main/java/click/kamil/enterprise/web/StateMachineController.java", + "metadata" : { + "path" : "/api/machine/user/suspend", + "verb" : "POST" + }, + "parameters" : [ { + "name" : "userId", + "type" : "String", + "annotations" : [ "RequestParam" ] + } ] + }, + "methodChain" : [ "click.kamil.enterprise.web.StateMachineController.suspendUser", "click.kamil.enterprise.web.StateMachineDispatcher.suspendUser" ], + "triggerPoint" : { + "event" : "click.kamil.enterprise.machines.user.UserEvent.SUSPEND", + "className" : "click.kamil.enterprise.web.StateMachineDispatcher", + "methodName" : "suspendUser", + "sourceFile" : "src/main/java/click/kamil/enterprise/web/StateMachineDispatcher.java", + "sourceModule" : null, + "stateMachineId" : null, + "sourceState" : null, + "lineNumber" : 72, + "polymorphicEvents" : [ "UserEvent.SUSPEND" ] + }, + "contextMachineId" : null, + "matchedTransitions" : null + }, { + "entryPoint" : { + "type" : "REST", + "name" : "POST /api/machine/{machineType}/transition/{event}", + "className" : "click.kamil.enterprise.web.StateMachineController", + "methodName" : "transition", + "sourceFile" : "src/main/java/click/kamil/enterprise/web/StateMachineController.java", + "metadata" : { + "path" : "/api/machine/{machineType}/transition/{event}", + "verb" : "POST" + }, + "parameters" : [ { + "name" : "machineType", + "type" : "String", + "annotations" : [ "PathVariable" ] + }, { + "name" : "event", + "type" : "String", + "annotations" : [ "PathVariable" ] + }, { + "name" : "userId", + "type" : "String", + "annotations" : [ "RequestParam" ] + } ] + }, + "methodChain" : [ "click.kamil.enterprise.web.StateMachineController.transition", "click.kamil.enterprise.web.StateMachineDispatcher.dispatch" ], + "triggerPoint" : { + "event" : "true ? OrderEvent.valueOf(eventString.toUpperCase()) : true ? DocumentEvent.valueOf(eventString.toUpperCase()) : UserEvent.valueOf(eventString.toUpperCase())", + "className" : "click.kamil.enterprise.web.StateMachineDispatcher", + "methodName" : "dispatch", + "sourceFile" : "src/main/java/click/kamil/enterprise/web/StateMachineDispatcher.java", + "sourceModule" : null, + "stateMachineId" : null, + "sourceState" : null, + "lineNumber" : 81, + "polymorphicEvents" : [ ] + }, + "contextMachineId" : null, + "matchedTransitions" : [ { + "sourceState" : "UserState.GUEST", + "targetState" : "UserState.REGISTERED", + "event" : "UserEvent.REGISTER" + }, { + "sourceState" : "UserState.REGISTERED", + "targetState" : "UserState.VERIFIED", + "event" : "UserEvent.VERIFY" + } ] + }, { + "entryPoint" : { + "type" : "REST", + "name" : "POST /api/machine/{machineType}/transition/{event}", + "className" : "click.kamil.enterprise.web.StateMachineController", + "methodName" : "transition", + "sourceFile" : "src/main/java/click/kamil/enterprise/web/StateMachineController.java", + "metadata" : { + "path" : "/api/machine/{machineType}/transition/{event}", + "verb" : "POST" + }, + "parameters" : [ { + "name" : "machineType", + "type" : "String", + "annotations" : [ "PathVariable" ] + }, { + "name" : "event", + "type" : "String", + "annotations" : [ "PathVariable" ] + }, { + "name" : "userId", + "type" : "String", + "annotations" : [ "RequestParam" ] + } ] + }, + "methodChain" : [ "click.kamil.enterprise.web.StateMachineController.transition", "click.kamil.enterprise.web.StateMachineDispatcher.dispatch" ], + "triggerPoint" : { + "event" : "true ? OrderEvent.valueOf(eventString.toUpperCase()) : true ? DocumentEvent.valueOf(eventString.toUpperCase()) : UserEvent.valueOf(eventString.toUpperCase())", + "className" : "click.kamil.enterprise.web.StateMachineDispatcher", + "methodName" : "dispatch", + "sourceFile" : "src/main/java/click/kamil/enterprise/web/StateMachineDispatcher.java", + "sourceModule" : null, + "stateMachineId" : null, + "sourceState" : null, + "lineNumber" : 87, + "polymorphicEvents" : [ ] + }, + "contextMachineId" : null, + "matchedTransitions" : [ { + "sourceState" : "UserState.GUEST", + "targetState" : "UserState.REGISTERED", + "event" : "UserEvent.REGISTER" + }, { + "sourceState" : "UserState.REGISTERED", + "targetState" : "UserState.VERIFIED", + "event" : "UserEvent.VERIFY" + } ] + }, { + "entryPoint" : { + "type" : "REST", + "name" : "POST /api/machine/{machineType}/transition/{event}", + "className" : "click.kamil.enterprise.web.StateMachineController", + "methodName" : "transition", + "sourceFile" : "src/main/java/click/kamil/enterprise/web/StateMachineController.java", + "metadata" : { + "path" : "/api/machine/{machineType}/transition/{event}", + "verb" : "POST" + }, + "parameters" : [ { + "name" : "machineType", + "type" : "String", + "annotations" : [ "PathVariable" ] + }, { + "name" : "event", + "type" : "String", + "annotations" : [ "PathVariable" ] + }, { + "name" : "userId", + "type" : "String", + "annotations" : [ "RequestParam" ] + } ] + }, + "methodChain" : [ "click.kamil.enterprise.web.StateMachineController.transition", "click.kamil.enterprise.web.StateMachineDispatcher.dispatch" ], + "triggerPoint" : { + "event" : "true ? OrderEvent.valueOf(eventString.toUpperCase()) : true ? DocumentEvent.valueOf(eventString.toUpperCase()) : UserEvent.valueOf(eventString.toUpperCase())", + "className" : "click.kamil.enterprise.web.StateMachineDispatcher", + "methodName" : "dispatch", + "sourceFile" : "src/main/java/click/kamil/enterprise/web/StateMachineDispatcher.java", + "sourceModule" : null, + "stateMachineId" : null, + "sourceState" : null, + "lineNumber" : 93, + "polymorphicEvents" : [ ] + }, + "contextMachineId" : null, + "matchedTransitions" : [ { + "sourceState" : "UserState.GUEST", + "targetState" : "UserState.REGISTERED", + "event" : "UserEvent.REGISTER" + }, { + "sourceState" : "UserState.REGISTERED", + "targetState" : "UserState.VERIFIED", + "event" : "UserEvent.VERIFY" + } ] + } ], "properties" : { "default" : { } } diff --git a/state_machines/state_machine_enterprise/src/main/java/click/kamil/enterprise/machines/user/UserEvent.java b/state_machines/state_machine_enterprise/src/main/java/click/kamil/enterprise/machines/user/UserEvent.java index 72849ec..977808f 100644 --- a/state_machines/state_machine_enterprise/src/main/java/click/kamil/enterprise/machines/user/UserEvent.java +++ b/state_machines/state_machine_enterprise/src/main/java/click/kamil/enterprise/machines/user/UserEvent.java @@ -3,5 +3,5 @@ package click.kamil.enterprise.machines.user; import click.kamil.enterprise.core.EnterpriseEvent; public enum UserEvent implements EnterpriseEvent { - REGISTER, VERIFY; + REGISTER, VERIFY, SUSPEND; }