org.speakright.sro
Class BaseSROQuestion

java.lang.Object
  extended by org.speakright.core.FlowBase
      extended by org.speakright.core.flows.QuestionFlow
          extended by org.speakright.sro.BaseSROQuestion
All Implemented Interfaces:
java.io.Serializable, IFlow
Direct Known Subclasses:
App.AskCharacter, genSROChoice, genSROConfirmYesNo, genSRODigitString, genSROListNavigator, genSRONumber, genSROYesNo, TestNumber.genSROQuantity

public class BaseSROQuestion
extends QuestionFlow

Base class for all SROs (SpeakRight Objects). SROs are re-usable "speech objects" for common things like dates, times, numbers, and currency. Each SRO has

Author:
IanRaeLaptop
See Also:
Serialized Form

Nested Class Summary
 class BaseSROQuestion.MyConfirmationWrapper
           
 
Field Summary
protected  ChoiceFlow m_cmds
           
protected  java.lang.String m_main1Prompt
           
protected  int m_maxReExecutions
           
protected  java.lang.String m_modelVar
           
protected  java.lang.String m_noreco1Prompt
           
protected  java.lang.String m_noreco2Prompt
           
protected  java.lang.String m_noreco3Prompt
           
protected  java.lang.String m_noreco4Prompt
           
protected  java.lang.String m_prefixPrompt
           
protected  java.lang.String m_silence1Prompt
           
protected  java.lang.String m_silence2Prompt
           
protected  java.lang.String m_silence3Prompt
           
protected  java.lang.String m_silence4Prompt
           
protected  java.lang.String m_slotName
           
protected  SROSubjectItem m_subject
           
protected  java.lang.String m_subjectWord
           
 
Fields inherited from class org.speakright.core.flows.QuestionFlow
m_quest
 
Constructor Summary
BaseSROQuestion()
           
BaseSROQuestion(java.lang.String subject)
           
 
Method Summary
 void addCancelCommand(java.lang.String cmd)
          Add a cancel command.
 void addCommand(java.lang.String cmd, IFlow flow)
          Adds a command such as "cancel" or "main menu".
 void execute(IExecutionContext context)
          The default implementation of execute is to render this object.
 IFlow getNext(IFlow current, SRResults results)
          The default implementation of getNext is to return null.
protected  void initMainPrompt(IExecutionContext context, java.lang.String normal, java.lang.String validationFailed, java.lang.String confirmationWasRejected)
          A common pattern is that the main prompt changes depending on whether this is the first time we've asked the question, or we're re-asking the question because of validation-failure or confirmation-rejection.
protected  void initPrompt(PromptType type, java.lang.String text)
           
protected  void initPrompts()
           
protected  void initPrompts(IExecutionContext context)
           
protected  void initSubPrompts(Question quest)
           
 IFlow onValidateFailed(IFlow current, SRResults results)
          The default implementation of onValidateFailed is to return null, indicating that this object does not handle validate-failed events.
 void set_main1Prompt(java.lang.String text)
           
 void set_noreco1Prompt(java.lang.String text)
           
 void set_noreco2Prompt(java.lang.String text)
           
 void set_noreco3Prompt(java.lang.String text)
           
 void set_noreco4Prompt(java.lang.String text)
           
 void set_prefixPrompt(java.lang.String text)
           
 void set_silence1Prompt(java.lang.String text)
           
 void set_silence2Prompt(java.lang.String text)
           
 void set_silence3Prompt(java.lang.String text)
           
 void set_silence4Prompt(java.lang.String text)
           
 void setConfirmer(IConfirmationFlow flow)
          Set a confirmer.
 void setModelVar(java.lang.String modelVar)
           
protected  void setPromptCondition(Prompt prompt, java.lang.String condition)
           
protected  void setSubjectPlurality(int num, IExecutionContext context)
           
 
Methods inherited from class org.speakright.core.flows.QuestionFlow
add, addBinding, addGrammar, addGrammar, addPrompt, createRenderer, InitPrompts
 
Methods inherited from class org.speakright.core.FlowBase
executionCount, fixupGrammar, fixupPrompt, getFirst, getSubFlowAfter, log, logError, name, onBegin, onCatch, onComplete, onDisconnect, onEnd, onNoInput, onPlatformError, onTransferFailed, promptGroup, setExecutionCount, setName, setPromptGroup, shouldExecute, validateInput
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_prefixPrompt

protected java.lang.String m_prefixPrompt

m_main1Prompt

protected java.lang.String m_main1Prompt

m_silence1Prompt

protected java.lang.String m_silence1Prompt

m_silence2Prompt

protected java.lang.String m_silence2Prompt

m_silence3Prompt

protected java.lang.String m_silence3Prompt

m_silence4Prompt

protected java.lang.String m_silence4Prompt

m_noreco1Prompt

protected java.lang.String m_noreco1Prompt

m_noreco2Prompt

protected java.lang.String m_noreco2Prompt

m_noreco3Prompt

protected java.lang.String m_noreco3Prompt

m_noreco4Prompt

protected java.lang.String m_noreco4Prompt

m_maxReExecutions

protected int m_maxReExecutions

m_subjectWord

protected java.lang.String m_subjectWord

m_subject

protected transient SROSubjectItem m_subject

m_slotName

protected java.lang.String m_slotName

m_modelVar

protected java.lang.String m_modelVar

m_cmds

protected ChoiceFlow m_cmds
Constructor Detail

BaseSROQuestion

public BaseSROQuestion()

BaseSROQuestion

public BaseSROQuestion(java.lang.String subject)
Method Detail

set_prefixPrompt

public void set_prefixPrompt(java.lang.String text)

set_main1Prompt

public void set_main1Prompt(java.lang.String text)

set_silence1Prompt

public void set_silence1Prompt(java.lang.String text)

set_silence2Prompt

public void set_silence2Prompt(java.lang.String text)

set_silence3Prompt

public void set_silence3Prompt(java.lang.String text)

set_silence4Prompt

public void set_silence4Prompt(java.lang.String text)

set_noreco1Prompt

public void set_noreco1Prompt(java.lang.String text)

set_noreco2Prompt

public void set_noreco2Prompt(java.lang.String text)

set_noreco3Prompt

public void set_noreco3Prompt(java.lang.String text)

set_noreco4Prompt

public void set_noreco4Prompt(java.lang.String text)

setModelVar

public void setModelVar(java.lang.String modelVar)

addCommand

public void addCommand(java.lang.String cmd,
                       IFlow flow)
Adds a command such as "cancel" or "main menu".

Parameters:
cmd - the user input string for this cmd.
flow - IFlow to be executed when the user input equals choice

addCancelCommand

public void addCancelCommand(java.lang.String cmd)
Add a cancel command. The action of the cancel command is to terminate this SRO. Many applications have this pattern of dialog, where the user can "enter a flight number, or say cancel".

Parameters:
cmd - the command user input

initPrompts

protected void initPrompts()

initSubPrompts

protected void initSubPrompts(Question quest)

initPrompt

protected void initPrompt(PromptType type,
                          java.lang.String text)

initPrompts

protected void initPrompts(IExecutionContext context)

setSubjectPlurality

protected void setSubjectPlurality(int num,
                                   IExecutionContext context)

initMainPrompt

protected void initMainPrompt(IExecutionContext context,
                              java.lang.String normal,
                              java.lang.String validationFailed,
                              java.lang.String confirmationWasRejected)
A common pattern is that the main prompt changes depending on whether this is the first time we've asked the question, or we're re-asking the question because of validation-failure or confirmation-rejection.

Parameters:
context -
normal -
validationFailed -
confirmationWasRejected -

setConfirmer

public void setConfirmer(IConfirmationFlow flow)
Set a confirmer. The confirmer flow object will confirm user input (eg. "Do you want Boston?")

Parameters:
flow - a confirmer object, or null to clear the confirmer

setPromptCondition

protected void setPromptCondition(Prompt prompt,
                                  java.lang.String condition)

getNext

public IFlow getNext(IFlow current,
                     SRResults results)
Description copied from class: FlowBase
The default implementation of getNext is to return null.

Specified by:
getNext in interface IFlow
Overrides:
getNext in class FlowBase
Parameters:
current - the currently executing flow object. More precisely, current is the flow object that this object most recently returned from getFirst or getNext.
results - the results of current's execution by the speech platform. Results contains user input and/or events such as disconnect or platform-error.
Returns:
the next flow to run, or null which means this flow object is finished.

execute

public void execute(IExecutionContext context)
Description copied from class: FlowBase
The default implementation of execute is to render this object. However the default rendering is a 'silent' voicexml page.

Specified by:
execute in interface IFlow
Overrides:
execute in class FlowBase
Parameters:
context - Contains the page renderer.

onValidateFailed

public IFlow onValidateFailed(IFlow current,
                              SRResults results)
Description copied from class: FlowBase
The default implementation of onValidateFailed is to return null, indicating that this object does not handle validate-failed events.

Specified by:
onValidateFailed in interface IFlow
Overrides:
onValidateFailed in class FlowBase
Parameters:
current - the currently executing flow object.
results - the results of current's execution. In this case results will contain the user input that failed validation.
Returns:
the next flow to run, or null which means this flow object does not handle this event.