|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.jvoicexml.interpreter.FormInterpretationAlgorithm
public final class FormInterpretationAlgorithm
Forms are interpreted by an implicit form interpretation algorithm (FIA). The FIA has a main loop that repeatedly selects a form item and then visits it. The selected form item is the first in document order whose guard condition is not satisfied. For instance, a field's default guard condition tests to see if the field's form item variable has a value, so that if a simple form contains only fields, the user will be prompted for each field in turn.
Interpreting a form item generally involves:
<filled> action that pertained todo
the newly filled in input items.
The FIA ends when it interprets a transfer of control statements (e.g. a
<goto> to another dialog or document or a
<submit> of data to the document server). It also ends
with an implied <exit> when no form item remains eglible
to select.
Form,
Dialog,
VoiceXmlInterpreter| Constructor Summary | |
|---|---|
FormInterpretationAlgorithm(VoiceXmlInterpreterContext ctx,
VoiceXmlInterpreter ip,
Dialog currentDialog)
Construct a new FIA object. |
|
| Method Summary | |
|---|---|
Dialog |
getDialog()
Retrieves the current dialog. |
FormItem |
getFormItem()
Retrieves the currently processed FormItem. |
FormItem |
getFormItem(String name)
Retrieves the FormItem with the given name. |
Collection<FormItem> |
getFormItems()
Retrieves all FormItems of the current dialog of the current
dialog. |
String |
getLocalProperty(String name)
Retrieves the value of the given property. |
TagStrategyExecutor |
getTagStrategyExecutor()
Retrieves the tag strategy executor. |
VoiceXmlInterpreterContext |
getVoiceXmlInterpreterContext()
Retrieves the current VoiceXmlInterpreterContext. |
void |
initialize(InitializationTagStrategyFactory factory)
Implementation of the initialization phase. |
boolean |
isJustFilled(InputItem input)
Checks, if the just_filled flag is set for the given
input item. |
boolean |
isQueuingPrompts()
Checks if the FIA is currently queuing prompts. |
void |
mainLoop()
The main loop of the FIA has three phases: The select phase: The next unfilled FormItem for visiting. |
GrammarDocument |
processGrammar(Grammar grammar)
Process the given grammar tags and add them to the ActiveGrammarSet. |
void |
setJustFilled(InputItem input)
Sets the just_filled flag for the given input item. |
void |
setLocalProperty(String name,
String value)
Sets the property with the given name to the given value. |
void |
setReprompt(boolean on)
Set if the last loop iteration ended with a <catch>
that had no <reprompt>. |
void |
visitBlockFormItem(BlockFormItem block)
A <block> element is visited by setting its form
item variable to true, evaluating its content, and then
bypassing the process phase. |
void |
visitFieldFormItem(InputItem field)
If a <field> is visited, the FIA selects and queues
up any prompts based on the item's prompt counter and prompt
conditions. |
void |
visitInitialFormItem(InitialFormItem initial)
This element controls the initial interaction in a mixed initiative form. |
void |
visitObjectFormItem(ObjectFormItem object)
This input item invokes a platform-specific object with various parameters. |
void |
visitRecordFormItem(RecordFormItem record)
An input item whose value is an audio clip recorded by the user. |
void |
visitSubdialogFormItem(SubdialogFormItem subdialog)
A <>subdialog> input item is roughly like a function
call. |
void |
visitTransferFormItem(TransferFormItem transfer)
An input item which transfers the user to another telephone number. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public FormInterpretationAlgorithm(VoiceXmlInterpreterContext ctx,
VoiceXmlInterpreter ip,
Dialog currentDialog)
ctx - the VoiceXML interpreter context.ip - the VoiceXML interpreter.currentDialog - the dialog to be interpreted.| Method Detail |
|---|
public Dialog getDialog()
public VoiceXmlInterpreterContext getVoiceXmlInterpreterContext()
VoiceXmlInterpreterContext.
VoiceXmlInterpreterContext.public TagStrategyExecutor getTagStrategyExecutor()
public void initialize(InitializationTagStrategyFactory factory)
throws JVoiceXMLEvent
Whenever a dialog is entered, it is initialized. Internal prompt counter
variables (in the dialog's dialog scope) are reset to 1. Each variable
(form level <var> elements and FormItem
variable is initialized, in document order, to undefined or to the
value of the relevant <expr> attribute.
factory - the tag initialization tag factory
JVoiceXMLEvent - Error initializing the FormItems.public FormItem getFormItem(String name)
FormItem with the given name.
name - Name of the FormItem
FormItem, null if it does not
exist.public Collection<FormItem> getFormItems()
FormItems of the current dialog of the current
dialog.
FormItems.public FormItem getFormItem()
FormItem.
public void mainLoop()
throws JVoiceXMLEvent
The select phase: The next unfilled FormItem for visiting.
The collect phase: the selected FormItem is visited, which
prompts the user for input, enables the appropriate grammars, and then
waits for and collects an input (such as a spoken phrase or
DTMF key presses) or an event (such as a request for help or a
no input timeout.
The process phase: an input is processed by filling FormItems
and executing <var> elements to perform input
validation. An event is processed by executing the appropriate event
handler for that event type.
JVoiceXMLEvent - Error or event processing the dialog.public void setJustFilled(InputItem input)
just_filled flag for the given input item.
input - the input item.public boolean isJustFilled(InputItem input)
just_filled flag is set for the given
input item.
input - the input item
true if the flag is set.public boolean isQueuingPrompts()
TagStrategys might be different dependent on the queuing mode.
true if the FIA is currently queiung prompts.
public GrammarDocument processGrammar(Grammar grammar)
throws UnsupportedFormatError,
NoresourceError,
BadFetchError,
SemanticError
ActiveGrammarSet.
grammar - grammar to process.
NoresourceError - Error accessing the input device.
UnsupportedFormatError - If an unsupported grammar has to be processed.
BadFetchError - If the document could not be fetched successfully.
SemanticError - if there was an error evaluating a scripting expression
public void visitBlockFormItem(BlockFormItem block)
throws JVoiceXMLEvent
<block> element is visited by setting its form
item variable to true, evaluating its content, and then
bypassing the process phase. No input is collected, and the next
iteration of the FIA's main loop is entered.
A <block> element is visited by setting its dialog
item variable to true, evaluating its content, and then
bypassing the process phase.
visitBlockFormItem in interface FormItemVisitorblock - The block form item to visit.
JVoiceXMLEvent - Error or event executing the block.
public void visitFieldFormItem(InputItem field)
throws JVoiceXMLEvent
<field> is visited, the FIA selects and queues
up any prompts based on the item's prompt counter and prompt
conditions. Then it activates and listens for the field level
grammar(s) and any higher-level grammars, and waits for the item
to be filled or for some events to be generated.
If a <field> is visited, the FIA selects and queues
up any prompts based on the item's prompt counter and prompt conditions.
Then it activates and listens for the field level grammar(s) and any
higher-level grammars, and waits for the item to be filled or for some
events to be generated.
visitFieldFormItem in interface FormItemVisitorfield - the input form item to visit.
JVoiceXMLEvent - Error or event executing the field.
public void visitInitialFormItem(InitialFormItem initial)
throws JVoiceXMLEvent
<initial>
element, the form item variable of <initial> becomes
true, thus removing it as an alternative for the FIA.
visitInitialFormItem in interface FormItemVisitorinitial - The field form item to visit.
JVoiceXMLEvent - Error or event executing the initial form item.
public void visitObjectFormItem(ObjectFormItem object)
throws JVoiceXMLEvent
<object> element by throwing
error.unsupported.objectname if the particular
platform-specific object is not supported (note that
objectname in error.unsupported.objectname is
a fixed string, so not substituted with the name of the unsupported
object; more specific error information may be provided in the event
_message special variable as described in
Section 5.2.2).
visitObjectFormItem in interface FormItemVisitorobject - The object form item to visit.
JVoiceXMLEvent - Error or event executing the object form item.
public void visitRecordFormItem(RecordFormItem record)
throws JVoiceXMLEvent
<record> element could collect a voice mail message,
for instance.
visitRecordFormItem in interface FormItemVisitorrecord - The record form item to visit.
JVoiceXMLEvent - Error or event executing the record form item.
public void visitSubdialogFormItem(SubdialogFormItem subdialog)
throws JVoiceXMLEvent
<>subdialog> input item is roughly like a function
call. It invokes another dialog on the current page, or invokes another
VoiceXML document. It returns an ECMAScript Object as its result.
visitSubdialogFormItem in interface FormItemVisitorsubdialog - The subdialog form item to visit.
JVoiceXMLEvent - Error or event executing the subdialog form item.
public void visitTransferFormItem(TransferFormItem transfer)
throws JVoiceXMLEvent
visitTransferFormItem in interface FormItemVisitortransfer - The transfer form item to visit.
JVoiceXMLEvent - Error or event executing the transfer form item.public void setReprompt(boolean on)
<catch>
that had no <reprompt>.
on - true if a catch occurred that had no reprompt.public String getLocalProperty(String name)
name - Name of the property.
public void setLocalProperty(String name,
String value)
name - Name of the property.value - Value of the property.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||