org.apache.taglibs.rdc.sampleapps.musicstore
Class AmazonMenuTemplate

java.lang.Object
  extended by org.apache.taglibs.rdc.core.BaseModel
      extended by org.apache.taglibs.rdc.core.RDCTemplate
          extended by org.apache.taglibs.rdc.sampleapps.musicstore.AmazonMenuTemplate
All Implemented Interfaces:
java.io.Serializable, BaseModel.ValueInterpreter

public class AmazonMenuTemplate
extends RDCTemplate
implements BaseModel.ValueInterpreter

The RDC template instance for the main menu of the music store sample application. This template instance has: a) A user defined data model b) Multiple turns in "input" state c) "Mixed initiative" style interaction for first turn d) Custom "dialog management" based on validation criteria for subsequent turns

Author:
Rahul Akolkar
See Also:
Serialized Form

Nested Class Summary
static class AmazonMenuTemplate.AmazonMenuResult
          Class that encapsulates the user's choice from the main menu.
 
Nested classes/interfaces inherited from class org.apache.taglibs.rdc.core.BaseModel
BaseModel.ValueInterpreter
 
Field Summary
static int ERR_NO_CATEGORY
          A constant for Error Code stating no category from the menu has been specified
 
Fields inherited from class org.apache.taglibs.rdc.core.RDCTemplate
bean, constraints, data, dynamicAttributes, fsmFragment, populateGrammars
 
Fields inherited from class org.apache.taglibs.rdc.core.BaseModel
ambiguousValues, candidates, canonicalizedValue, className, configuration, confirm, confirmed, DEFAULT_INITIAL_GRAMMAR_NAME, DEFAULT_MIN_CONFIDENCE, DEFAULT_NUM_N_BEST, echo, ERR_NO_DEFAULT, ERR_NONE, errorCode, exitStatus, grammars, id, initial, initialGrammar, interpretation, isAmbiguous, isValid, locale, maxNoInput, maxNoMatch, minConfidence, numNBest, paramsMap, PROPERTY_INITIAL_GRAMMAR, rdcLocale, rdcResourceBundle, skipSubmit, state, subdialog, submit, utterance, value
 
Constructor Summary
AmazonMenuTemplate()
          Sets default values for all data members
 
Method Summary
 int getERR_NO_CATEGORY()
           
 void initComponentGrammars()
          Initialize the component grammars for first round trip
 void setCategoryGrammar(Grammar g)
           
 void setConfirmed(java.lang.Boolean confirmed)
          Set the response of user to the confirmation dialog
 void setMainGrammar(Grammar g)
           
 void setValueFromInterpretation()
          Sets the new value
protected  java.lang.Boolean validate(java.lang.Object newValue, boolean setErrorCode)
          Custom validation
 
Methods inherited from class org.apache.taglibs.rdc.core.RDCTemplate
getBean, getConstraints, getData, getFsmFragment, setBean, setConstraints, setData, setDynamicAttributes, setFsmFragment, setGrammar
 
Methods inherited from class org.apache.taglibs.rdc.core.BaseModel
baseCanonicalize, baseValidate, calculateCanonicalizedValue, canonicalize, getAmbiguousValues, getCandidates, getCanonicalizedValue, getClassName, getConfiguration, getConfirm, getConfirmed, getEcho, getERR_NO_DEFAULT, getERR_NONE, getErrorCode, getExitStatus, getGrammars, getId, getInitial, getInterpretation, getIsAmbiguous, getIsValid, getLocale, getMaxNoInput, getMaxNoMatch, getMinConfidence, getNumNBest, getParamsMap, getRdcLocale, getRdcResourceBundle, getSerializedValue, getSkipSubmit, getState, getSubdialog, getSubmit, getUtterance, getValue, setAmbiguousValues, setCandidates, setCanonicalizedValue, setConfiguration, setConfirm, setEcho, setErrorCode, setExitStatus, setGrammar, setId, setInitial, setInterpretation, setIsAmbiguous, setIsValid, setLocale, setMaxNoInput, setMaxNoMatch, setMinConfidence, setNumNBest, setSkipSubmit, setState, setSubdialog, setSubmit, setUtterance, setValue
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ERR_NO_CATEGORY

public static final int ERR_NO_CATEGORY
A constant for Error Code stating no category from the menu has been specified

See Also:
Constant Field Values
Constructor Detail

AmazonMenuTemplate

public AmazonMenuTemplate()
Sets default values for all data members

Method Detail

getERR_NO_CATEGORY

public final int getERR_NO_CATEGORY()

setMainGrammar

public void setMainGrammar(Grammar g)

setCategoryGrammar

public void setCategoryGrammar(Grammar g)

setValueFromInterpretation

public void setValueFromInterpretation()
Sets the new value

Specified by:
setValueFromInterpretation in interface BaseModel.ValueInterpreter
See Also:
BaseModel.ValueInterpreter.setValueFromInterpretation()

initComponentGrammars

public void initComponentGrammars()
Initialize the component grammars for first round trip

Overrides:
initComponentGrammars in class RDCTemplate
See Also:
RDCTemplate.initComponentGrammars()

setConfirmed

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

Overrides:
setConfirmed in class BaseModel
Parameters:
confirmed -

validate

protected java.lang.Boolean validate(java.lang.Object newValue,
                                     boolean setErrorCode)
Custom validation

Overrides:
validate in class BaseModel
See Also:
BaseModel.validate(Object,boolean)


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