Cisco Cisco Customer Voice Portal 8.0(1) Guida Dello Sviluppatore

Pagina di 122
This is a convenience method which provides more than 
getSubmitURL()
 does by returning
a new 
VAction
 object containing the entire submit to VXML Server along with any arguments
passed as input (as a space-delimited list). The 
VPreference
 object is required to instantiate
the 
VAction
 object and can be obtained by calling the 
getPreference()
 method of the
VoiceElementData
 object. The 
VAction
 object returned by the 
getSubmitVAction()
method is just like any other, the developer can add additional actions to it as desired.
VAction getSubmitVAction(VAction existing, String args)
This convenience method does the same as the above method except it adds the submit to an
existing 
VAction
 object passed as input. There is no 
VPreference
 object required because
no new VFC objects are instantiated in this method. This method may be more convenient
if the developer wants to perform some actions (such as the declaration or assigning variables)
before the submit occurs.
 for a full description of the VFCs.
VoiceElementResult createSubVoiceElement(VoiceElementBase
mainVoiceElement, VMain vxml, Hashtable params, VoiceElementData data)
There are times when one wishes to create a voice element that acts a combination of a group
of existing voice elements, something like a super-element. While one can simply build this
element from scratch, it would be desirable to somehow leverage the work already done with
existing voice elements. The advantage would be that the super-element code need not contain
any VFC code, it would only act as the container for sub-elements within it. This is possible
utilizing the 
createSubVoiceElement()
 method.
This method is intended to be called from an instance of a sub-element, not the super-element.
The super-element first creates an instance of the sub-element and then calls this method
from that instance. This executes a sub-element within the super-element using the same
context. The sub-element executes normally, it reads from a configuration object and creates
VFC classes. The difference is that the super-element can take what the sub-element produced
and modify it or add to it.
The arguments to the 
createSubVoiceElement()
 method are required in order to provide
the correct context for the sub-element to execute within. A voice element requires the correct
context in order for it to be able to read from a configuration object, use the appropriate VFC
objects, and have access to the system. The first argument to the
createSubVoiceElement()
 method must be an instance of the super-element (which will
be 
this
). The last three arguments are simply the arguments the super-element receives in
it’s 
addXmlBody()
 method.
The 
VoiceElementResult
 object returned is a small data structure class containing the
exit state of the sub-element (if any), and whether the sub-element produced any VoiceXML.
This last value is important because the only time a voice element is allowed to produce no
VoiceXML is when it is visited for the last time. It returns an exit state and no VoiceXML
so VXML Server knows to visit the next voice element immediately rather than producing
a VoiceXML page first and visiting the element after the browser makes the next request. If
the sub-element does not return any VoiceXML, the super-element must add its own
VoiceXML content directly, visit another sub-element, or exit with an appropriate exit state.
After the 
createSubVoiceElement()
 method executes, the 
VMain
 object will contain a
Programming Guide for Cisco Unified CVP VXML Server and Cisco Unified Call Studio Release 8.0(1)
65
Chapter 9: Configurable Elements
Voice Elements