Cisco Cisco Unified Customer Voice Portal 11.0(1) 开发者指南

下载
页码 98
C
HAPTER 
12:
 
S
AY 
I
S
MART 
P
LUGINS
 
 
V
OICE
XML
 
P
ROGRAMMING 
G
UIDE 
 
 
 
FOR 
C
ISCO 
U
NIFIED 
C
USTOMER 
V
OICE 
P
ORTAL 
R
ELEASE 
4.0(1) 
 
 
 
 
65
 
Utility Methods 
These utility methods are provided to aid Say It Smart plugin developers. Their use is optional. 
void validateArguments(Object data, String inputFormat,  
 
String outputFormat, String fileset) 
This method validates each argument and throws a 
SayItSmartException
 if there is an error 
with one of them. The exception is thrown if 
data
 is 
null
, or 
inputFormat
outputFormat
, or 
fileset
 does not correspond to the ones defined in the 
getDisplayInformation()
 method. 
Additionally, an exception is thrown if 
outputFormat
 does not depend on 
inputFormat
 or 
fileset
 does not depend on the 
outputFormat
. The error message lists all the appropriate 
options available. 
All Unified CVP Say It Smart plugins call this method in the first line of their execution 
methods. 
String createError(String header, String[] options, String footer) 
This utility method is a shortcut for creating an error message when some value does not match 
one of an array of different possible values. The error conveys that and lists all the values the 
data can be.  Many Unified CVP Say It Smart plugins provide an array of 
String
s containing 
formats that they will accept input data to arrive in and this method is used when the input data 
does not arrive in a supported format. The output string starts with “SayItSmart Error – 
PLUGIN” where PLUGIN is the name of the plugin type as returned by the 
getDsplayInformation()
 method. The header then appears, followed by a comma-delimited 
list of correct values (with the last option following an “and”) followed by the footer. 
This is best explained with an example. A Say It Smart plugin named "Foo" has the input 
formats "a", "b", "c", and "d". If the input format passed was "e", this method can be called to 
create the error message. Calling the message like so: 
createError("Only the input formats supported are: ", new String[] {"a", "b", 
"c", "d"}, " Please use a supported format."). 
will produce the following error message: 
SayItSmart Error - Foo: Only the input formats supported are: "a", "b", "c", 
and "d". Please use a supported format. 
 
String[] getFilesetContents(String fileset) 
This utility method returns an array of 
String
s containing the filenames required for the fileset 
passed as input. This method can be used to determine what audio files need to be recorded to 
fully support a fileset for a Say It Smart plugin. At this point, this method exists only for 
informational purposes, it is not accessed by either Unified CVP VoiceXML Studio or Unified 
CVP VoiceXML Server.