spring-projects / spring-statemachine

Spring Statemachine is a framework for application developers to use state machine concepts with Spring.
1.52k stars 598 forks source link

Output state diagram #70

Open naude-r opened 9 years ago

naude-r commented 9 years ago

I would be great to be able to generate a state diagram (dot format?) of the configured state machine. This would be useful for documentation purposes as well as seeing a graphical view of the state machine.

jvalkeal commented 9 years ago

Yes, I've been thinking about this also. Dot is prop a best bet to start experimenting with any kind of visualization.

naude-r commented 9 years ago

@jvalkeal how do you generate the current ascii diagram?

jvalkeal commented 9 years ago

@naude-r I'm using http://ditaa.sourceforge.net/. Had to compile it from trunk because current releases seem to be broken with some features.

naude-r commented 9 years ago

@jvalkeal Thank you. the samples can print an ascii diagram using the "print" command. it seems to work with:

@Qualifier("stateChartModel")

how is that processed?

can take a stab at provided Dot output.

jvalkeal commented 9 years ago

There's no magic on that stateChartModel. Content of those files are created as bean at https://github.com/spring-projects/spring-statemachine/blob/master/spring-statemachine-samples/src/main/java/demo/CommonConfiguration.java#L46.

Every sample has a statechartmodel.txt file on its classpath. You can then print content of that file and then I manually use ditaa to provide image png to be used in docs.

jvmlet commented 8 years ago

:+1: for this feature request. However, state machine [web]designer (which I assume is on road-map) should cover this as well. Great competitor to .NET Workflow :)

mehmetsalgar commented 8 years ago

I know this is not exactly it is what asked here, but I created a blog entry, instead having an Output State Diagram as a result artifact, using an UML Diagram to create a Spring State Machine configuration and making it a primary artifact for the project.

May be it can be useful for you, you can reach the blog from the link below.

https://mehmetsalgar.wordpress.com/2015/12/14/ajax-spring-web-flow-and-spring-state-machine/

jvalkeal commented 8 years ago

@mehmetsalgar wow, that is funky. Think I need to take a closer look over the holidays what those components can do. Thx for pointing out your blog :)

WorkingDevel commented 7 years ago

I have started to program a little tool (https://github.com/WorkingDevelopers/spring-state-machine-chart-dumper) that dumps a state machine configuration to an Eclipse MDT UML2 model file (XML; same as used by UmlStateMachineModelFactory). The model file can when be imported into UML Designer or Papyrus. It is in an early stage, but maybe a starting point...

jvalkeal commented 7 years ago

@WorkingDevel didn't see your message here until now.

That is interesting work indeed. I've been thinking that as any config(javaconfig,uml,repository config) is first translated to pojo model(StateMachineModel) we could add feature to dump machine into these pojo's. Then you would not need to use reflection(which is always prone to errors if internals are changed).

One question, how pretty graph models these will produce? As a human it's always easy to draw these models so that graph doesn't look messy, but reversing that so that program does it automatically is, I assume, less ideal when graph is complex. Visualisation from a raw data is always hard!

wolframite commented 6 years ago

I started using Graphviz with guru.nidi - graphviz-java: But it works only with very simple state machines, no region support: https://gist.github.com/wolframite/78afb9b6891fe2815252d300020731dd

jonybuzz commented 5 years ago

I started using Graphviz with guru.nidi - graphviz-java: But it works only with very simple state machines, no region support: https://gist.github.com/wolframite/78afb9b6891fe2815252d300020731dd

@wolframite It seems a good alternative while this enhancement is being developed. Unfortunately the gist is not functional, there are some parts missing. Could you complete it please? Thanks a lot

wolframite commented 5 years ago

@jonybuzz You're right, I fixed it. Problem was that the visualization part looks different in my project, because I outsourced the whole state machine configuration into a JSON file with some customizations. Please try it again. It "works on my laptop"

michael-buerkle commented 3 years ago

It has been a while since the last activity in this issue. Is there a solution to this? I wasn't (yet) able to find anything.

Any advice would be greatly appreciated.

agupta1009 commented 11 months ago

@jvalkeal i am not getting how the ascii diagram ie statechartmodel.txt is generated and from which part of the code. can ypu please attached the piece of code alog with logic for the same