Keith Donald opened SWF-295 and commented
There are several opportunities for defining simpler flow definitions in native Java. This ticket should realize some of these opportunities.
Specifically:
- Flow definitions that don't span more than one request to the server can easily be mapped to a Java method call. Declarative support for method argument binding and view selection should also be possible (perhaps using Annotations). Arjen Poutsma checked in some code into the Spring sandbox initially targeted as a Spring MVC extension that is relevant to work in this area.
- Rod Johnson prototyped a pure native-Java alternative for defining flows that is definitely worth investigating more. The prototype code is attached to this issue.
Example Java-based flow:
@Flow("editAccount")
public class EditAccountFlow {
@PersistenceContext(type=PersistenceContextType.EXTENDED)
private EntityManager entityManager;
private Long id;
private Account account;
// flow startup callback (typed flow input)
public State start(Long id) {
this.id = id;
this.account = entityManager.find(Account.class, id);
// return the next view
return new AccountView();
}
@ViewState
public class AccountView {
// view event handler
@Transactional
public State confirmEdits() {
entityManager.joinTransaction();
// end flow
return new Finish();
}
}
// flow end callback
public void end() {
this.entityManager.close();
}
}
Affects: 1.0
Attachments:
15 votes, 19 watchers
Keith Donald opened SWF-295 and commented
There are several opportunities for defining simpler flow definitions in native Java. This ticket should realize some of these opportunities.
Specifically:
Example Java-based flow:
@Flow("editAccount")public class EditAccountFlow {
}
Affects: 1.0
Attachments:
15 votes, 19 watchers