org.apache.taglibs.rdc.core
Class BaseModel

java.lang.Object
  extended by org.apache.taglibs.rdc.core.BaseModel
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
Alpha, Alphanum, Color, ComponentModel, Country, CreditCardAmount, CreditCardExpiry, CreditCardNumber, CreditCardType, Currency, Date, Digits, Duration, GroupModel, ISBN, MortgageType, Number, Pause, Percent, RDCTemplate, SelectOne, SocialSecurityNumber, Time, USMajorCity, USState, ZipCode

public abstract class BaseModel
extends java.lang.Object
implements java.io.Serializable

This is the base class for all RDCs. Each atomic RDC must extend this class. GroupModel and ComponentModel extend this class.

Author:
Abhishek Verma, Rahul Akolkar
See Also:
Serialized Form

Nested Class Summary
static interface BaseModel.ValueInterpreter
          Interface used by components to interpret the results sent back from the vxml browser/client.
 
Field Summary
protected  java.util.Map ambiguousValues
          Contains the list of ambiguous values keyed on grammar conforming values For e.g., a map of ambiguous values for say, time 5'o clock would be Key Value 0500a 5 A M 0500p 5 P M
protected  java.lang.String candidates
          The serialized n-best data from the vxml browser
protected  java.lang.String canonicalizedValue
          The normalized value for the input of this RDC
protected  java.lang.String className
          The class of the bean that subclasses this instance
protected  org.w3c.dom.Document configuration
          The default (parsed) configuration
protected  java.lang.Boolean confirm
          specifies whether to do confirmation or not
protected  java.lang.Boolean confirmed
          Response of the user to the confirmation dialog
static java.lang.String DEFAULT_INITIAL_GRAMMAR_NAME
          The name that will be associated with the default grammar used to refer to the initial value associated with this RDC
static float DEFAULT_MIN_CONFIDENCE
          The default value of the minimum confidence.
static int DEFAULT_NUM_N_BEST
          The unique identifier associated with this RDC
protected  java.lang.Boolean echo
          The user preference for playing back the return value associated with the RDC
static int ERR_NO_DEFAULT
          A constant for errorCode stating no default value is specified
static int ERR_NONE
          A constant for errorCode when there is no error
protected  int errorCode
          This is used to identify the error that occured
protected  int exitStatus
          The status at exit, indicating whether this RDC collected input or gracefully exited after a number of retries
protected  java.util.List grammars
          Path to component grammar(s)
protected  java.lang.String id
          The unique identifier associated with this RDC
protected  java.lang.Object initial
          The default/initial value associated with this RDC
protected  Grammar initialGrammar
          The grammar available for the user to pick default/initial value associated with this RDC
protected  java.util.Map interpretation
          The semantic interpretation returned for the input of this RDC
protected  java.lang.Boolean isAmbiguous
          Indicates whether the current value for this RDC is ambiguous
protected  java.lang.Boolean isValid
          Indicates whether the current value for this RDC is valid with respect to the supplied constraints
protected  java.lang.String locale
          The Locale for this RDC
protected  int maxNoInput
          Maximum number of client side <noinput> events before this RDC gracefully exits with Constants.EXIT_MAXNOINPUT exitStatus
protected  int maxNoMatch
          Maximum number of client side <nomatch> events before this RDC gracefully exits with Constants.EXIT_MAXNOMATCH exitStatus
protected  float minConfidence
          Minimum confidence below which all values are treated as invalid
protected  int numNBest
          The maximum number of n-best results requested from the vxml browser
protected  java.util.Map paramsMap
          Map this model's properties to the params in the request it should look for
static java.lang.String PROPERTY_INITIAL_GRAMMAR
          The property under which the initial grammar is stored in the resource bundles in org.apache.taglibs.rdc.resources
protected  java.util.Locale rdcLocale
          The Locale for this RDC, defaults to Constants.rdcLocale
protected  java.util.ResourceBundle rdcResourceBundle
          The ResourceBundle for this RDC,defaults to Constants.rdcResourceBundle
protected  java.lang.Boolean skipSubmit
          Specifies whether this RDC should emit a submit URI - may be removed in later versions of this tag library
protected  int state
          The current state of this RDC
protected  java.lang.Boolean subdialog
          Indicates whether this RDC is invoked as a subdialog.
protected  java.lang.String submit
          The URI to submit the vxml form
protected  java.lang.String utterance
          The utterance of the user; what the user said
protected  java.lang.Object value
          Value currently associated with this RDC
 
Constructor Summary
BaseModel()
           
 
Method Summary
protected  java.lang.Object baseCanonicalize(java.lang.Object input)
          Transforms canonical data from client to its the corresponding value.
protected  java.lang.Boolean baseValidate(java.lang.Object newValue, boolean setErrorCode)
          Validates the input against the given constraints.
protected  java.lang.String calculateCanonicalizedValue(java.lang.Object value)
          Hook for custom canonicalized value calculation.
protected  java.lang.Object canonicalize(java.lang.Object input, boolean isAttribute)
          Hook for custom canonicalization.
 java.util.Map getAmbiguousValues()
          Get the list of ambiguous values
 java.lang.String getCandidates()
          Get the n-best data string
 java.lang.String getCanonicalizedValue()
          Get the normalized value for the input
 java.lang.String getClassName()
          The bean subclassing this instance.
 org.w3c.dom.Document getConfiguration()
          Get the Configuration value.
 java.lang.Boolean getConfirm()
          Get the confirm value
 java.lang.Boolean getConfirmed()
          Get the response of user to the confirmation dialog
 java.lang.Boolean getEcho()
          Get whether the user has requested echoing the return value
 int getERR_NO_DEFAULT()
           
 int getERR_NONE()
           
 int getErrorCode()
          Get the errorCode value
 int getExitStatus()
          Get the exitStatus value
 java.util.List getGrammars()
          Get the grammar path(s) for the RDC grammars is a read only property
 java.lang.String getId()
          Get the id value for this RDC
 java.lang.Object getInitial()
          Gets the initial value
 java.util.Map getInterpretation()
          Get the interpretation for this input
 java.lang.Boolean getIsAmbiguous()
          Get whether the input value is ambiguous or not
 java.lang.Boolean getIsValid()
          Get the whether input is valid or not
 java.lang.String getLocale()
          Get the Locale (String) for this RDC
 int getMaxNoInput()
          Get the maxNoInput value
 int getMaxNoMatch()
          Get the maxNoMatch value
 float getMinConfidence()
          Get the minConfidence
 int getNumNBest()
          Get numNBest
 java.util.Map getParamsMap()
          Get paramsMap - read-only property, no setter
 java.util.Locale getRdcLocale()
          Returns the Locale for this RDC, if it was set, or the default Locale for this deployment
 java.util.ResourceBundle getRdcResourceBundle()
          Return the resourceBundle.
 java.lang.String getSerializedValue()
          Return the serialized value collected by this RDC, used primarily as the value returned when this RDC is invoked by a subdialog (means it goes out as a request parameter).
 java.lang.Boolean getSkipSubmit()
          Get the skipSubmit value
 int getState()
          Get the state value
 java.lang.Boolean getSubdialog()
          Get whether this RDC is invoked as a subdialog
 java.lang.String getSubmit()
          Get the submit URI for the RDC
 java.lang.String getUtterance()
          Get what the user said; the utterance of the user
 java.lang.Object getValue()
          Get the value currently associated with the RDC
 void setAmbiguousValues(java.util.Map ambigValues)
          Set the map of ambiguous values
 void setCandidates(java.lang.String candidates)
          Set the candidates (serialized n-best data string).
 void setCanonicalizedValue(java.lang.String canonicalizedValue)
          Set the normalized value for input
 void setConfiguration(org.w3c.dom.Document newConfiguration)
          Set the Configuration value.
 void setConfirm(java.lang.Boolean confirm)
          Set the confirm value.
 void setConfirmed(java.lang.Boolean confirmed)
          Set the response of user to the confirmation dialog
 void setEcho(java.lang.Boolean echo)
          Set whether the user has requested echo
 void setErrorCode(int errorCode)
          Set the errorCode value
 void setExitStatus(int exitStatus)
          Set the exitStatus value
 void setGrammar(Grammar grammar)
          Add this Grammar object to the list of grammars for this RDC.
 void setId(java.lang.String id)
          Set the id value for this RDC
 void setInitial(java.lang.Object initial)
          Sets the initial value for this RDC.
 void setInterpretation(java.util.Map interp)
          Set the interpretation for this input
 void setIsAmbiguous(java.lang.Boolean isAmbiguous)
          Set whether the input value is ambiguous or not
 void setIsValid(java.lang.Boolean isValid)
          Set whether value is valid or not
 void setLocale(java.lang.String locale)
          Set the Locale (String) for this RDC
 void setMaxNoInput(int maxNoInput)
          Set the maxNoInput value
 void setMaxNoMatch(int maxNoMatch)
          Set the maxNoMatch value
 void setMinConfidence(float minConfidence)
          Set the minConfidence
 void setNumNBest(int numNBest)
          Set numNBest
 void setSkipSubmit(java.lang.Boolean newSkipSubmit)
          Set the skipSubmit value.
 void setState(int state)
          Set the state value
 void setSubdialog(java.lang.Boolean subdialog)
          Set whether this RDC is invoked as a subdialog
 void setSubmit(java.lang.String submit)
          Set the submit URI for the RDC
 void setUtterance(java.lang.String utterance)
          Set what the user said
 void setValue(java.lang.Object value)
          Set the value for this RDC instance.
protected  java.lang.Boolean validate(java.lang.Object newValue, boolean setErrorCode)
          Hook for custom validation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_MIN_CONFIDENCE

public static final float DEFAULT_MIN_CONFIDENCE
The default value of the minimum confidence. Results below this confidence will result in the associated value being treated as invalid and the RDC will reprompt for user input.

See Also:
Constant Field Values

DEFAULT_NUM_N_BEST

public static final int DEFAULT_NUM_N_BEST
The unique identifier associated with this RDC

See Also:
Constant Field Values

DEFAULT_INITIAL_GRAMMAR_NAME

public static final java.lang.String DEFAULT_INITIAL_GRAMMAR_NAME
The name that will be associated with the default grammar used to refer to the initial value associated with this RDC

See Also:
Grammar, Constant Field Values

PROPERTY_INITIAL_GRAMMAR

public static final java.lang.String PROPERTY_INITIAL_GRAMMAR
The property under which the initial grammar is stored in the resource bundles in org.apache.taglibs.rdc.resources

See Also:
Constant Field Values

ERR_NONE

public static final int ERR_NONE
A constant for errorCode when there is no error

See Also:
Constant Field Values

ERR_NO_DEFAULT

public static final int ERR_NO_DEFAULT
A constant for errorCode stating no default value is specified

See Also:
Constant Field Values

id

protected java.lang.String id
The unique identifier associated with this RDC


state

protected int state
The current state of this RDC


errorCode

protected int errorCode
This is used to identify the error that occured


confirm

protected java.lang.Boolean confirm
specifies whether to do confirmation or not


confirmed

protected java.lang.Boolean confirmed
Response of the user to the confirmation dialog


isValid

protected java.lang.Boolean isValid
Indicates whether the current value for this RDC is valid with respect to the supplied constraints


utterance

protected java.lang.String utterance
The utterance of the user; what the user said


canonicalizedValue

protected java.lang.String canonicalizedValue
The normalized value for the input of this RDC


interpretation

protected java.util.Map interpretation
The semantic interpretation returned for the input of this RDC


submit

protected java.lang.String submit
The URI to submit the vxml form


grammars

protected java.util.List grammars
Path to component grammar(s)


echo

protected java.lang.Boolean echo
The user preference for playing back the return value associated with the RDC


subdialog

protected java.lang.Boolean subdialog
Indicates whether this RDC is invoked as a subdialog. This will affect what happens to the value collected by the RDC


isAmbiguous

protected java.lang.Boolean isAmbiguous
Indicates whether the current value for this RDC is ambiguous


ambiguousValues

protected java.util.Map ambiguousValues
Contains the list of ambiguous values keyed on grammar conforming values For e.g., a map of ambiguous values for say, time 5'o clock would be Key Value 0500a 5 A M 0500p 5 P M


configuration

protected org.w3c.dom.Document configuration
The default (parsed) configuration


className

protected java.lang.String className
The class of the bean that subclasses this instance


skipSubmit

protected java.lang.Boolean skipSubmit
Specifies whether this RDC should emit a submit URI - may be removed in later versions of this tag library


value

protected java.lang.Object value
Value currently associated with this RDC


initial

protected java.lang.Object initial
The default/initial value associated with this RDC


candidates

protected java.lang.String candidates
The serialized n-best data from the vxml browser


minConfidence

protected float minConfidence
Minimum confidence below which all values are treated as invalid


numNBest

protected int numNBest
The maximum number of n-best results requested from the vxml browser


paramsMap

protected java.util.Map paramsMap
Map this model's properties to the params in the request it should look for


initialGrammar

protected Grammar initialGrammar
The grammar available for the user to pick default/initial value associated with this RDC


exitStatus

protected int exitStatus
The status at exit, indicating whether this RDC collected input or gracefully exited after a number of retries


maxNoInput

protected int maxNoInput
Maximum number of client side <noinput> events before this RDC gracefully exits with Constants.EXIT_MAXNOINPUT exitStatus

See Also:
Constants.EXIT_MAXNOINPUT

maxNoMatch

protected int maxNoMatch
Maximum number of client side <nomatch> events before this RDC gracefully exits with Constants.EXIT_MAXNOMATCH exitStatus

See Also:
Constants.EXIT_MAXNOMATCH

locale

protected java.lang.String locale
The Locale for this RDC


rdcLocale

protected transient java.util.Locale rdcLocale
The Locale for this RDC, defaults to Constants.rdcLocale

See Also:
Constants.rdcLocale

rdcResourceBundle

protected transient java.util.ResourceBundle rdcResourceBundle
The ResourceBundle for this RDC,defaults to Constants.rdcResourceBundle

See Also:
Constants.rdcResourceBundle
Constructor Detail

BaseModel

public BaseModel()
Method Detail

getERR_NONE

public final int getERR_NONE()

getERR_NO_DEFAULT

public final int getERR_NO_DEFAULT()

getId

public java.lang.String getId()
Get the id value for this RDC

Returns:
the id value

setId

public void setId(java.lang.String id)
Set the id value for this RDC

Parameters:
id - The new id value.

getState

public int getState()
Get the state value

Returns:
the state value

setState

public void setState(int state)
Set the state value

Parameters:
state - The new state value

getErrorCode

public int getErrorCode()
Get the errorCode value

Returns:
the errorCode value

setErrorCode

public void setErrorCode(int errorCode)
Set the errorCode value

Parameters:
errorCode - The new errorCode value

getConfirm

public java.lang.Boolean getConfirm()
Get the confirm value

Returns:
the confirm value

setConfirm

public void setConfirm(java.lang.Boolean confirm)
Set the confirm value.

Parameters:
confirm - The new confirm value

getConfirmed

public java.lang.Boolean getConfirmed()
Get the response of user to the confirmation dialog

Returns:
the response to confirmatiom dialog True - the user said 'yes' False - the user said 'no' null - the confirmation dialog hasnt taken place yet

setConfirmed

public void setConfirmed(java.lang.Boolean confirmed)
Set the response of user to the confirmation dialog

Parameters:
confirmed - is new response to confirmation dialog

getIsValid

public java.lang.Boolean getIsValid()
Get the whether input is valid or not

Returns:
the whether the input is valid or not true is valid. True - the input is valid False - the input is invalid null - the validation hasnt taken place

setIsValid

public void setIsValid(java.lang.Boolean isValid)
Set whether value is valid or not

Parameters:
isValid - is new value to indicate whether the input is valid or not

getSubdialog

public java.lang.Boolean getSubdialog()
Get whether this RDC is invoked as a subdialog

Returns:
subdialog The subdialog Boolean.

setSubdialog

public void setSubdialog(java.lang.Boolean subdialog)
Set whether this RDC is invoked as a subdialog

Parameters:
subdialog - The subdialog Boolean.

getIsAmbiguous

public java.lang.Boolean getIsAmbiguous()
Get whether the input value is ambiguous or not

Returns:
whether the input value is ambiguous or not True - the input value is ambiguous False, null - the input value is not ambiguous

setIsAmbiguous

public void setIsAmbiguous(java.lang.Boolean isAmbiguous)
Set whether the input value is ambiguous or not

Parameters:
isAmbiguous - is the new value to indicate whether the input is ambiguous or not

getUtterance

public java.lang.String getUtterance()
Get what the user said; the utterance of the user

Returns:
the utterance of the user

setUtterance

public void setUtterance(java.lang.String utterance)
Set what the user said

Parameters:
utterance - is the new utterance of the user

getCanonicalizedValue

public java.lang.String getCanonicalizedValue()
Get the normalized value for the input

Returns:
the normalized value of the input

setCanonicalizedValue

public void setCanonicalizedValue(java.lang.String canonicalizedValue)
Set the normalized value for input

Parameters:
canonicalizedValue - is the normalized value of the input

getInterpretation

public java.util.Map getInterpretation()
Get the interpretation for this input

Returns:
interp the interpretation for this input

setInterpretation

public void setInterpretation(java.util.Map interp)
Set the interpretation for this input

Parameters:
interp - the interpretation for this input

getSubmit

public java.lang.String getSubmit()
Get the submit URI for the RDC

Returns:
the submit URI

setSubmit

public void setSubmit(java.lang.String submit)
Set the submit URI for the RDC

Parameters:
submit - - the submit URI

getGrammars

public java.util.List getGrammars()
Get the grammar path(s) for the RDC grammars is a read only property

Returns:
The grammar path(s)

setGrammar

public void setGrammar(Grammar grammar)
Add this Grammar object to the list of grammars for this RDC.

Parameters:
grammar - - the Grammar object

getEcho

public java.lang.Boolean getEcho()
Get whether the user has requested echoing the return value

Returns:
whether user has requested echo True - echo has been requested False, null - echo has not been requested

setEcho

public void setEcho(java.lang.Boolean echo)
Set whether the user has requested echo

Parameters:
echo - - the user's choice to echo the return value

getAmbiguousValues

public java.util.Map getAmbiguousValues()
Get the list of ambiguous values

Returns:
the map containing the list of ambiguous values

setAmbiguousValues

public void setAmbiguousValues(java.util.Map ambigValues)
Set the map of ambiguous values

Parameters:
ambigValues - A map containing the ambiguous values

getConfiguration

public org.w3c.dom.Document getConfiguration()
Get the Configuration value.

Returns:
the Configuration value.

setConfiguration

public void setConfiguration(org.w3c.dom.Document newConfiguration)
Set the Configuration value.

Parameters:
newConfiguration - The new Configuration value.

getClassName

public java.lang.String getClassName()
The bean subclassing this instance. Read only property.

Returns:
className

getValue

public java.lang.Object getValue()
Get the value currently associated with the RDC

Returns:
the value

setValue

public void setValue(java.lang.Object value)
Set the value for this RDC instance. Update the isValid and canonicalizedValue properties based on the new value.

Parameters:
value - The value returned by the client

getInitial

public java.lang.Object getInitial()
Gets the initial value

Returns:
The default/initial value

setInitial

public void setInitial(java.lang.Object initial)
Sets the initial value for this RDC. Inheriting RDC beans that override this method must also take responsibility for populating the initial grammar when appropriate.

Parameters:
initial - The default/initial value

getSkipSubmit

public java.lang.Boolean getSkipSubmit()
Get the skipSubmit value

Returns:
skipSubmit

setSkipSubmit

public void setSkipSubmit(java.lang.Boolean newSkipSubmit)
Set the skipSubmit value. An RDC will be asked to refrain from submitting its results if a container or component higher up in the heirarchy takes responsibility for submitting the results. Example: First interaction turn of a mixed initiative dialog.

Parameters:
newSkipSubmit -

getMinConfidence

public float getMinConfidence()
Get the minConfidence

Returns:
minConfidence the current value

setMinConfidence

public void setMinConfidence(float minConfidence)
Set the minConfidence

Parameters:
minConfidence - the new value

getCandidates

public java.lang.String getCandidates()
Get the n-best data string

Returns:
the serialized n-best data

setCandidates

public void setCandidates(java.lang.String candidates)
Set the candidates (serialized n-best data string). Treatment depends on whether this component instance implements the ValueInterpreter interface.

Parameters:
candidates - The serialized n-best results from the vxml browser
See Also:
interface

getNumNBest

public int getNumNBest()
Get numNBest

Returns:
the maximum number of n-best values that the browser will be asked to return

setNumNBest

public void setNumNBest(int numNBest)
Set numNBest

Parameters:
numNBest - the new maximum number of n-best values requested

getParamsMap

public java.util.Map getParamsMap()
Get paramsMap - read-only property, no setter

Returns:
paramsMap

getExitStatus

public int getExitStatus()
Get the exitStatus value

Returns:
the exitStatus value

setExitStatus

public void setExitStatus(int exitStatus)
Set the exitStatus value

Parameters:
exitStatus - The new exitStatus value

getMaxNoInput

public int getMaxNoInput()
Get the maxNoInput value

Returns:
Returns the maxNoInput.

setMaxNoInput

public void setMaxNoInput(int maxNoInput)
Set the maxNoInput value

Parameters:
maxNoInput - The maxNoInput to set.

getMaxNoMatch

public int getMaxNoMatch()
Get the maxNoMatch value

Returns:
Returns the maxNoMatch.

setMaxNoMatch

public void setMaxNoMatch(int maxNoMatch)
Set the maxNoMatch value

Parameters:
maxNoMatch - The maxNoMatch to set.

setLocale

public void setLocale(java.lang.String locale)
Set the Locale (String) for this RDC

Parameters:
locale - The locale (String) to set.

getLocale

public java.lang.String getLocale()
Get the Locale (String) for this RDC

Returns:
locale The locale (String)

getRdcLocale

public java.util.Locale getRdcLocale()
Returns the Locale for this RDC, if it was set, or the default Locale for this deployment

Returns:
Locale Returns the Locale for this RDC

getRdcResourceBundle

public java.util.ResourceBundle getRdcResourceBundle()
Return the resourceBundle.

Returns:
Returns the resourceBundle.

baseCanonicalize

protected java.lang.Object baseCanonicalize(java.lang.Object input)
Transforms canonical data from client to its the corresponding value.

Parameters:
input - the value
Returns:
the canonicalized value

baseValidate

protected java.lang.Boolean baseValidate(java.lang.Object newValue,
                                         boolean setErrorCode)
Validates the input against the given constraints. Inheriting RDC bean must override this method to do any custom validation.

Returns:
TRUE if valid, FALSE otherwise

canonicalize

protected java.lang.Object canonicalize(java.lang.Object input,
                                        boolean isAttribute)
Hook for custom canonicalization. Inheriting RDC bean must override this method to do any custom canonicalization.

Parameters:
input - the value
Returns:
the canonicalized value

validate

protected java.lang.Boolean validate(java.lang.Object newValue,
                                     boolean setErrorCode)
Hook for custom validation. Inheriting RDC bean must override this method to do any custom validation.

Returns:
TRUE if valid, FALSE otherwise

calculateCanonicalizedValue

protected java.lang.String calculateCanonicalizedValue(java.lang.Object value)
Hook for custom canonicalized value calculation. Inheriting RDC bean must override this method to do any custom calculation of the canonical value.

Returns:
String The canonical value

getSerializedValue

public java.lang.String getSerializedValue()
Return the serialized value collected by this RDC, used primarily as the value returned when this RDC is invoked by a subdialog (means it goes out as a request parameter).



Copyright © 2004-2009 The Apache Software Foundation. All Rights Reserved.