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

Better ability to introspect flow transitions [SWF-43] #974

Closed
spring-operator opened this issue Nov 2, 2005 · 1 comment
Closed

Better ability to introspect flow transitions [SWF-43] #974

spring-operator opened this issue Nov 2, 2005 · 1 comment
Labels
status: declined A suggestion or change that we don't feel we should currently apply type: enhancement
Milestone

Comments

@spring-operator
Copy link
Contributor

Chris Wood opened SWF-43 and commented

It would be handy if flow transitions had a bit more information available for introspecting.

This is my use case: In my view I run through the list of available transitions out of the particular view state. I'd like to render these as a list of links / submit buttons / whatever on the page, however there's no way to determine the eventId that the particular transition has as it's criteria, so I can't write the 'eventId' parameter easily.

A related issue is that it would be nice to have a canExecute method on the transition which takes a request context (for the current view state) and an eventId (for what view we're going to go to). Why is this useful? Again for the above case where we're running through the list of transitions and determining which ones are valid for this current view. The criteria list could then contain criteria based on security permissions ect.

I'd be happy to implement this bit of functionality and contribute it back if someone gives me the nod.


No further details from SWF-43

@spring-operator
Copy link
Contributor Author

Erwin Vervaet commented

First, we can't easily provide a 'getEventId' method on the Transition class since it's the matching TransitionCriteria that are responsible for transition matching and there is no guarantee that you're using an EventIdTransitionCriteria. If you are using a EventIdTransitionCriteria, you could do:

Transition t = ...;
String eventId = ((EventIdTransitionCriteria)t.getMatchingCriteria()).getEventId();

In JSP EL the casting would go away so you'd be able to do ${transition.matchingCriteria.eventId}. That seems reasonable.

Secondly, the transition class already has a matches(RequestContext) method. An easy way to get the behaviour you want is to write a RequestContextWrapper that delegates all calls except for getLastEvent() to the wrapped RequestContext. The getLastEvent() method just returns the event you'd like to test.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: declined A suggestion or change that we don't feel we should currently apply type: enhancement
Projects
None yet
Development

No branches or pull requests

1 participant