org.apache.taglibs.rdc
Class Time

java.lang.Object
  extended byorg.apache.taglibs.rdc.core.BaseModel
      extended byorg.apache.taglibs.rdc.Time
All Implemented Interfaces:
java.io.Serializable

public class Time
extends BaseModel

Datamodel for the time RDC. The time RDC will be associated with the time input, and the maximum and minimum times within which the time input must lie.

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

Nested Class Summary
 
Nested classes inherited from class org.apache.taglibs.rdc.core.BaseModel
BaseModel.ValueInterpreter
 
Field Summary
static int ERR_INVALID_TIME
          A constant for Error Code stating Invalid time
static int ERR_NEED_EARLIER_TIME
          A constant for Error Code stating the time entered is later than allowed
static int ERR_NEED_LATER_TIME
          A constant for Error Code stating the time entered is earlier than allowed
 
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
Time()
          Sets default values for all data members
 
Method Summary
protected  java.lang.String calculateCanonicalizedValue(java.lang.Object time)
          Builds a time string to be used for output into prompts etc.
protected  java.lang.Object canonicalize(java.lang.Object input, boolean isAttribute)
          Converts the min and max time strings to java.util.Date objects
 java.lang.String getMaxTime()
          Gets the maximum allowed time
 java.lang.String getMinTime()
          Gets the minimum allowed time
 void setMaxTime(java.lang.String maxTime)
          Sets maximum allowed time
 void setMinTime(java.lang.String minTime)
          Sets minimum allowed time
 void setValue(java.lang.Object value)
          Sets the value of time.
protected  java.lang.Boolean validate(java.lang.Object newValue, boolean setErrorCode)
          Validates the received input against validation constraints
 
Methods inherited from class org.apache.taglibs.rdc.core.BaseModel
baseCanonicalize, baseValidate, 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, setConfirmed, setEcho, setErrorCode, setExitStatus, setGrammar, setId, setInitial, setInterpretation, setIsAmbiguous, setIsValid, setLocale, setMaxNoInput, setMaxNoMatch, setMinConfidence, setNumNBest, setSkipSubmit, setState, setSubdialog, setSubmit, setUtterance
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ERR_INVALID_TIME

public static final int ERR_INVALID_TIME
A constant for Error Code stating Invalid time

See Also:
Constant Field Values

ERR_NEED_EARLIER_TIME

public static final int ERR_NEED_EARLIER_TIME
A constant for Error Code stating the time entered is later than allowed

See Also:
Constant Field Values

ERR_NEED_LATER_TIME

public static final int ERR_NEED_LATER_TIME
A constant for Error Code stating the time entered is earlier than allowed

See Also:
Constant Field Values
Constructor Detail

Time

public Time()
Sets default values for all data members

Method Detail

getMaxTime

public java.lang.String getMaxTime()
Gets the maximum allowed time

Returns:
the maximum allowed time

setMaxTime

public void setMaxTime(java.lang.String maxTime)
Sets maximum allowed time

Parameters:
maxTime - the maximum allowed time

getMinTime

public java.lang.String getMinTime()
Gets the minimum allowed time

Returns:
the minimum allowed time

setMinTime

public void setMinTime(java.lang.String minTime)
Sets minimum allowed time

Parameters:
minTime - the minimum allowed time

setValue

public void setValue(java.lang.Object value)
Sets the value of time.

Overrides:
setValue in class BaseModel
Parameters:
value - the value of time returned by grammar (hhmma) 5 P M will be 0500p
See Also:
BaseModel.setValue(Object)

canonicalize

protected java.lang.Object canonicalize(java.lang.Object input,
                                        boolean isAttribute)
Converts the min and max time strings to java.util.Date objects

Overrides:
canonicalize in class BaseModel
Parameters:
input - the value
Returns:
The java.util.Date object for the time string

validate

protected java.lang.Boolean validate(java.lang.Object newValue,
                                     boolean setErrorCode)
Validates the received input against validation constraints

Overrides:
validate in class BaseModel
Returns:
TRUE if valid, FALSE if invalid

calculateCanonicalizedValue

protected java.lang.String calculateCanonicalizedValue(java.lang.Object time)
Builds a time string to be used for output into prompts etc. For e.g., 0505am gets converted to 5 5 AM

Overrides:
calculateCanonicalizedValue in class BaseModel
Returns:
the time string for time


Copyright ? 2000-2004 The Apache Software Foundation. All Rights Reserved.