Skip to content
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

Support possibility to create flow in a step by step manner #18

Open
dany52 opened this issue Mar 27, 2015 · 3 comments
Open

Support possibility to create flow in a step by step manner #18

dany52 opened this issue Mar 27, 2015 · 3 comments

Comments

@dany52
Copy link

dany52 commented Mar 27, 2015

instead of "tree style" like

 flow = FlowBuilder

            .from(SHOWING_WELCOME).transit(
                onCardPresent.to(WAITING_FOR_PIN).transit(
                    onPinProvided.to(CHECKING_PIN).transit(
                        onPinValid.to(SHOWING_MAIN_MENU).transit(
                            onMenuShowBalance.to(SHOWING_BALANCE).transit(
                                onCancel.to(SHOWING_MAIN_MENU)
                            ),
                            onMenuWithdrawCash.to(SHOWING_WITHDRAW_MENU).transit(
                                onCancel.to(SHOWING_MAIN_MENU),
                                onConfirm.to(SHOWING_TAKE_CASH).transit(
                                    onCashExtracted.to(SHOWING_MAIN_MENU)
                                )
                            ),
                            onMenuExit.to(RETURNING_CARD)
                        ),
                        onPinInvalid.to(SHOWING_PIN_INVALID).transit(
                            onTryAgain.to(WAITING_FOR_PIN),
                            onNoMoreTries.to(SHOWING_CARD_LOCKED).transit(
                                onConfirm.to(SHOWING_WELCOME)
                            ),
                            onCancel.to(RETURNING_CARD)
                        )
                    ),
                    onCancel.to(RETURNING_CARD).transit(
                        onCardExtracted.to(SHOWING_WELCOME)
                    )
                )
            )
                                  ...

something like

flow = FlowBuilder.register(SHOWING_WELCOME,
                onCardPresent.to(WAITING_FOR_PIN)
);

FlowBuilder.register(WAITING_FOR_PIN,
                onPinProvided.to(CHECKING_PIN),
                onCancel.to(RETURNING_CARD)
);
                      ...
FlowBuilder.register(SHOWING_PIN_INVALID,
                 onTryAgain.to(WAITING_FOR_PIN),
                 onNoMoreTries.to(SHOWING_CARD_LOCKED),
                 onCancel.to(RETURNING_CARD)
);
                      ...                                  ...
@Beh01der
Copy link
Owner

I guess I need to re-visit this project.
It may be useful if you want to build FSM dynamically.
Although, the whole point of EasyFlow is to build static FSM in form of a tree.

@dany52
Copy link
Author

dany52 commented Apr 1, 2015

Exactly. Now there is no simple method to build FSM when FSM model store in database.

@Beh01der
Copy link
Owner

Sorry for long delay.
I added a new method to FlowBuilder. fromTransitions(StateEnum startState,
Collection transitions, boolean skipValidation)
Plus I added public constructor to Transition()

If you want to dynamically create EasyFlow instance, first prepare collection of transitions, then create it with FlowBuilder. fromTransitions(...)

Sorry, I don't have time to release it now, so you will have to build it from sources. Also, I haven't tested it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants