-
Notifications
You must be signed in to change notification settings - Fork 616
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New Feature - PlantUML visualization #1158
base: main
Are you sure you want to change the base?
Conversation
…to illustrate the issue
@pdalfarr Please sign the Contributor License Agreement! Click here to manually synchronize the status of this Pull Request. See the FAQ for frequently asked questions. |
这是来自QQ邮箱的假期自动回复邮件。
您好,我最近正在休假中,无法亲自回复您的邮件。我将在假期结束后,尽快给您回复。
|
@pdalfarr Thank you for signing the Contributor License Agreement! |
// It seems Spring statemachine does not support org.eclipse.uml2.uml.ConnectionPointReference ! | ||
// Arguments.of("org/springframework/statemachine/uml/simple-connectionpointref", null), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Limitation in Spring state machine ?
// It seems Spring statemachine UML parser creates duplicated transitions! | ||
// Arguments.of("org/springframework/statemachine/uml/simple-root-regions", null), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug in Spring state machine ?
new PlantUmlWriterParameters<String>() | ||
.hiddenTransition("S1", RIGHT, "S2") | ||
), | ||
Arguments.of("org/springframework/statemachine/uml/simple-guards", null), | ||
Arguments.of("org/springframework/statemachine/uml/simple-history-deep", null), | ||
Arguments.of("org/springframework/statemachine/uml/simple-history-default", null), | ||
Arguments.of("org/springframework/statemachine/uml/simple-history-shallow", null), | ||
Arguments.of("org/springframework/statemachine/uml/simple-junction", null), | ||
Arguments.of("org/springframework/statemachine/uml/simple-localtransition", | ||
// add some parameters to make diagram more readable | ||
new PlantUmlWriterParameters<String>() | ||
.arrowDirection("S22", UP, "S2") | ||
.arrowDirection("S21", UP, "S2") | ||
.arrowDirection("S22", UP, "S2") | ||
.arrowDirection("S21", UP, "S2") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PlantUmlWriterParameters allow to tweak diagram by 'forcing' direction of some arrows / transitions
Hi @bclozel |
Hi there! |
/** | ||
* Implement a 'name strategy' based on this sequence: | ||
* <UL> | ||
* <LI>{@link Expression}</LI> | ||
* <LI>{@link BeanNameAware}</LI> | ||
* <LI>Lambda's unique "arg$1" parameter</LI> | ||
* </UL> | ||
* If all these strategy are failing, fallback to "class name" of the object | ||
* | ||
* @param object object to get "name" from | ||
* @return name of the object | ||
*/ | ||
public static String getName(Object object) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This class should probably be compared to
Lines 137 to 143 in 26ef2bc
private static <S, E> String actionToName(Function<StateContext<S, E>, Mono<Void>> action) { | |
return ObjectUtils.getDisplayString(action); | |
} | |
private static <S, E> String actionFunctionToName(Function<StateContext<S, E>, Mono<Void>> action) { | |
return ObjectUtils.getDisplayString(action); | |
} |
which seems to be the current mean to get "names" of Spring State Machine actions, guard, etc..
@bclozel I see you are a committer on some Spring projects, so I take the opportunity to ask you this: how I can do to reach out to Spring State Machine "owner(s)" ? ( ? Maybe someone at Pivotal / VMWare could help regarding my questions ? ) |
I think @jvalkeal knows. |
Hi @jvalkeal Who can I reach out to, to discuss this PR? Thanks |
… make 'Connection' cComparable
@fmbenhassine , we can discuss this whenever you want ;-) |
Add the ability to dump a Spring stateMachine to PlanUML format and to .png format 🥳
Features:
see
spring-statemachine/spring-statemachine-uml/src/main/java/org/springframework/statemachine/plantuml/PlantUmlWriterParameters.java
Lines 246 to 248 in 59df160
Action@0x1f4f5d1d
Unit tests:
What does it looks like?
Here are some results (I dumped .puml files to .png):
action-with-transition-choice.uml -> action-with-transition-choice.puml :
multijoin-forkjoin.uml -> multijoin-forkjoin.puml :
Note:
Two *.uml files from test folder leads to inaccurate diagram.
These 2 errors, in simple-connectionpointref.puml and simple-root-regions.puml, are likely to be related to some limitations in spring statemachine UML parser.
Credit: The idea of creating this feature came to me while reading https://github.com/DeveloperUtils/spring-state-machine-chart-dumper