Expert Spring MVC and Web Flow

(Dana P.) #1








FlowExecution Repositories


When an active FlowExecutionneeds to be persisted (saved before a page is displayed) or
loaded (resumed after a page is submitted), it is moved to and from a repository. This is
taken care of within Spring Web Flow by implementations of org.springframework.webflow.
execution.repository.FlowExecutionRepository(see Listing 12-18).


Listing 12-18.org.springframework.execution.repository.FlowExecutionRepository


public interface FlowExecutionRepository {
public FlowExecutionContinuationKey generateContinuationKey(
FlowExecution flowExecution
) throws FlowExecutionRepositoryException;


public FlowExecutionContinuationKey generateContinuationKey(
FlowExecution flowExecution,
Serializable conversationId
) throws FlowExecutionRepositoryException;

public FlowExecution getFlowExecution(
FlowExecutionContinuationKey key
) throws FlowExecutionRepositoryException;

public void putFlowExecution(
FlowExecutionContinuationKey key,
FlowExecution flowExecution
) throws FlowExecutionRepositoryException;

public void invalidateConversation(
Serializable conversationId
) throws FlowExecutionRepositoryException;
}


When saved in a repository, a FlowExecutionobject is indexed under a unique key, called a
continuation key. This continuation key provides enough information to track a single logical
user conversation that is still ongoing, as well as an index into a snapshot of the conversation
taken at a point in time (relative to the user) that can be restored. This deserves more explana-
tion, so let’s look at the concept of continuations in detail.


CHAPTER 12 ■ADVANCED SPRING WEB FLOW 353
Free download pdf