org.wizard4j.engine
Class FlowchartSession

java.lang.Object
  extended by org.wizard4j.engine.FlowchartSession

public class FlowchartSession
extends java.lang.Object

For each flowchart execution, a FlowchartSession needs to be created. The session reacts to user FlowchartRequests (parsing and state update) and it provides new FlowchartResponses to the user.


Constructor Summary
FlowchartSession(Flowchart flowchart)
           
 
Method Summary
 boolean getActionMask(EUserAction userAction)
           
 java.lang.String getBuiltInFlowchartPresentation(EBuiltInFlowchartPresentationMode presentationMode)
           
 java.lang.String getBuiltInResultPresentation(EBuiltInResultPresentationMode presentationMode)
           
 FlowchartResponse getCurrentFlowchartResponse()
           
 FlowchartMonitor getFlowchartMonitor()
           
 EGroupType getGroupType()
           
 ResultNode getResult()
           
 java.lang.String getState()
           
 FlowchartResponse index(int index)
           
 boolean isAllowMultipleRatesPerRun()
           
 boolean isAllowMultipleSavesPerRun()
           
 boolean isAutomaticSave()
           
 boolean isResendResponseAtRequestError()
           
 boolean isResendResponseWithErrorAtParameterError()
           
 boolean isStoreStateInResponse()
           
 FlowchartResponse next(FlowchartRequest flowchartRequest)
           
 FlowchartResponse previous()
           
 FlowchartResponse rate(int rating)
           
 FlowchartResponse save()
           
 void setActionMask(EUserAction userAction, boolean mask)
          Allows to explicitly mask certain user actions.
 void setAllowMultipleRatesPerRun(boolean allowMultipleRatesPerRun)
          To enable/disable multiple ratings during a single flowchart execution.
 void setAllowMultipleSavesPerRun(boolean allowMultipleSavesPerRun)
          To enable/disable multiple savings during a single flowchart execution.
 void setAutomaticSave(boolean automaticSave)
          To enable/disable automatic saving.
 void setFlowchartMonitor(FlowchartMonitor flowchartMonitor)
          To enable session monitoring, a FlowchartMonitor instance must be assigned to the session.
 void setGroupType(EGroupType groupType)
           
 void setResendResponseAtRequestError(boolean resendResponseAtRequestError)
          This determines whether at request error an exception is thrown or the original response is returned.
 void setResendResponseWithErrorAtParameterError(boolean resendResponseWithErrorAtParameterError)
          This determines whether at parameter error an exception is thrown or the original response is returned.
 void setStoreStateInResponse(boolean storeStateInResponse)
          This must be set for stateless sessions (cfr.
 FlowchartResponse start()
           
 FlowchartResponse state(java.lang.String state)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FlowchartSession

public FlowchartSession(Flowchart flowchart)
Parameters:
flowchart -
Method Detail

start

public FlowchartResponse start()
                        throws UnexpectedRequestException
Returns:
flowchartResponse
Throws:
UnexpectedRequestException

next

public FlowchartResponse next(FlowchartRequest flowchartRequest)
                       throws UnexpectedRequestException,
                              InvalidValueException
Parameters:
flowchartRequest -
Returns:
flowchartResponse
Throws:
UnexpectedRequestException
InvalidValueException

previous

public FlowchartResponse previous()
                           throws UnexpectedRequestException
Returns:
flowchartResponse
Throws:
UnexpectedRequestException

index

public FlowchartResponse index(int index)
                        throws UnexpectedRequestException
Parameters:
index -
Returns:
flowchartResponse
Throws:
UnexpectedRequestException

state

public FlowchartResponse state(java.lang.String state)
                        throws UnexpectedRequestException
Parameters:
state -
Returns:
flowchartResponse
Throws:
UnexpectedRequestException

save

public FlowchartResponse save()
                       throws UnexpectedRequestException
Returns:
flowchartResponse
Throws:
UnexpectedRequestException

rate

public FlowchartResponse rate(int rating)
                       throws UnexpectedRequestException
Parameters:
rating -
Returns:
flowchartResponse
Throws:
UnexpectedRequestException

setActionMask

public void setActionMask(EUserAction userAction,
                          boolean mask)
Allows to explicitly mask certain user actions.

Parameters:
userAction -
mask -

getActionMask

public boolean getActionMask(EUserAction userAction)
Parameters:
userAction -
Returns:
true if action is masked.

getCurrentFlowchartResponse

public FlowchartResponse getCurrentFlowchartResponse()
Returns:
current flowchartResponse.

getResult

public ResultNode getResult()
Returns:
the result node tree

getState

public java.lang.String getState()
Returns:
current state in a string description.

getBuiltInFlowchartPresentation

public java.lang.String getBuiltInFlowchartPresentation(EBuiltInFlowchartPresentationMode presentationMode)
Parameters:
presentationMode -
Returns:
flowchart presentation

getBuiltInResultPresentation

public java.lang.String getBuiltInResultPresentation(EBuiltInResultPresentationMode presentationMode)
Parameters:
presentationMode -
Returns:
result presentation

setFlowchartMonitor

public void setFlowchartMonitor(FlowchartMonitor flowchartMonitor)
To enable session monitoring, a FlowchartMonitor instance must be assigned to the session.

Parameters:
flowchartMonitor -

getFlowchartMonitor

public FlowchartMonitor getFlowchartMonitor()
Returns:
configured monitor.

setGroupType

public void setGroupType(EGroupType groupType)
Parameters:
groupType -

setResendResponseAtRequestError

public void setResendResponseAtRequestError(boolean resendResponseAtRequestError)
This determines whether at request error an exception is thrown or the original response is returned.

Parameters:
resendResponseAtRequestError -

setResendResponseWithErrorAtParameterError

public void setResendResponseWithErrorAtParameterError(boolean resendResponseWithErrorAtParameterError)
This determines whether at parameter error an exception is thrown or the original response is returned.

Parameters:
resendResponseWithErrorAtParameterError -

isAllowMultipleSavesPerRun

public boolean isAllowMultipleSavesPerRun()
Returns:
true/false

setAllowMultipleSavesPerRun

public void setAllowMultipleSavesPerRun(boolean allowMultipleSavesPerRun)
To enable/disable multiple savings during a single flowchart execution. Default is false.

Parameters:
allowMultipleSavesPerRun -

isAllowMultipleRatesPerRun

public boolean isAllowMultipleRatesPerRun()
Returns:
true/false

setAllowMultipleRatesPerRun

public void setAllowMultipleRatesPerRun(boolean allowMultipleRatesPerRun)
To enable/disable multiple ratings during a single flowchart execution. Default is false.

Parameters:
allowMultipleRatesPerRun -

isAutomaticSave

public boolean isAutomaticSave()
Returns:
true/false

setAutomaticSave

public void setAutomaticSave(boolean automaticSave)
To enable/disable automatic saving. When this value is set, the result will be saved automatically when the flowchart has ended (i.e. FlowchartMonitor.eventSave(ResultNode) is called).

When the value is cleared there will be a user interaction that allows to explicitly save the result.

Default is false.

Parameters:
automaticSave -

isStoreStateInResponse

public boolean isStoreStateInResponse()
Returns:
true/false

setStoreStateInResponse

public void setStoreStateInResponse(boolean storeStateInResponse)
This must be set for stateless sessions (cfr. rest), in which case the state is kept at the client side. Default is false.

Parameters:
storeStateInResponse -

getGroupType

public EGroupType getGroupType()
Returns:
groupType

isResendResponseAtRequestError

public boolean isResendResponseAtRequestError()
Returns:
true/false

isResendResponseWithErrorAtParameterError

public boolean isResendResponseWithErrorAtParameterError()
Returns:
true/false