org.speakright.core
Class ExecutionContext

java.lang.Object
  extended by org.speakright.core.ExecutionContext
All Implemented Interfaces:
IExecutionContext, IFlowContext

public class ExecutionContext
extends java.lang.Object
implements IExecutionContext

Contains the VoiceXML page renderer. Passed by SpeakRight to a flow object's execute method.

Author:
Ian Rae

Field Summary
 IModelBinder m_binder
           
 IFlow m_flow
           
 SRLocations m_locations
           
 java.util.ArrayList<java.lang.String> m_promptFileL
           
 java.util.ArrayList m_renderL
           
 SRResults m_results
           
 ThrowEvent m_thrownEvent
           
 
Constructor Summary
ExecutionContext()
           
 
Method Summary
 boolean ConfirmationWasRejected()
          Return true if a confirmation was rejected by the user (by saying 'no' or whatever rejection phrase was in the confirmation grammar).
 SRLocations getLocations()
          get current resource file locations.
 SRResults getResults()
          Get the results of the previous turn.
 void registerPromptFile(java.lang.String path)
          add the file to the list of prompt file locations.
 void render(IFlow flow)
          Render a flow object into a voicexml page.
 void throwEvent(ThrowEvent event)
          "Throws" an event.
 boolean ValidateFailed()
          Return true if the call to ValidateInput for this flow returned false.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_thrownEvent

public ThrowEvent m_thrownEvent

m_renderL

public java.util.ArrayList m_renderL

m_binder

public IModelBinder m_binder

m_promptFileL

public java.util.ArrayList<java.lang.String> m_promptFileL

m_results

public SRResults m_results

m_flow

public IFlow m_flow

m_locations

public SRLocations m_locations
Constructor Detail

ExecutionContext

public ExecutionContext()
Method Detail

throwEvent

public void throwEvent(ThrowEvent event)
"Throws" an event. Although most control flow in SpeakRight is done by getFirst and getNext, there are ocassions where execute needs to. For example, if execute needs to read an external database in order to play some information to the caller. If the database read fails, then execute can "throw" an event to a handler that may branch back to the main menu, or terminate the call.

Specified by:
throwEvent in interface IExecutionContext
Parameters:
event - The event to be thrown, usually a CustomEvent.

render

public void render(IFlow flow)
Render a flow object into a voicexml page.

Specified by:
render in interface IExecutionContext
Parameters:
flow - a flow object

registerPromptFile

public void registerPromptFile(java.lang.String path)
add the file to the list of prompt file locations. This path is only registered for the duration of the current flow's execute method. If you want to register a prompt file for the life of the application use SRInstance.registerPromptFile

Specified by:
registerPromptFile in interface IExecutionContext
Parameters:
path - full file path to the prompts XML file.

getResults

public SRResults getResults()
Get the results of the previous turn. MAY BE NULL (if this is the first flow in the app)

Specified by:
getResults in interface IExecutionContext

ValidateFailed

public boolean ValidateFailed()
Return true if the call to ValidateInput for this flow returned false. This method avoids flow object classes to have to declare their own boolean to track validation failure. Only works in the context of the current execute.

Specified by:
ValidateFailed in interface IExecutionContext
Returns:
result of ValidateInput

ConfirmationWasRejected

public boolean ConfirmationWasRejected()
Description copied from interface: IExecutionContext
Return true if a confirmation was rejected by the user (by saying 'no' or whatever rejection phrase was in the confirmation grammar). Set to true by ConfirmationWrapper just before the previous question (flow object) executes again. This method is used by questions to alter their prompts, to add something like "OK, let's try that again".

Specified by:
ConfirmationWasRejected in interface IExecutionContext
Returns:
result of confirmation. false if no confirmation is active.

getLocations

public SRLocations getLocations()
Description copied from interface: IFlowContext
get current resource file locations.

Specified by:
getLocations in interface IFlowContext
Returns:
locations object