com.sas.prompts
Interface PromptValuesInterface

All Known Implementing Classes:
PromptValues

public interface PromptValuesInterface

Interface for classes which hold sets of prompt values.


Method Summary
 void acceptPromptValuesVisitor(PromptValuesVisitorInterface visitor)
          Accept method for visitor object (see visitor pattern) which passes the visitor on to any delegate PromptValues objects.
 void addPromptValueChangeListener(PromptValueChangeListener listener)
          Adds a listener so that changes to prompt values can be monitored.
 void addPromptValuesDelegate(PromptValuesInterface promptValues)
          Adds another PromptValues object as a delegate of this PromptValues object.
 void clearPromptValue(PromptDefinitionInterface promptDefinition)
          Clears the prompt value such that isPromptValueSet returns false.
 void clearPromptValuesDelegates()
          Removes all previously added delegates.
 PromptValuesInterface findPromptValuesForPromptDefinition(PromptDefinitionInterface promptDefinition)
          Recursively finds the first PromptValues object which holds the PromptGroup which contains the specified PromptDefinition.
 com.sas.util.MutableUserInfoInterface getMutableUserInfo()
          Returns a user info object which can be read and/or modified.
 PromptDefinitionInterface getPromptDefinition(java.lang.String promptName, boolean recursive)
          Returns the PromptDefinitionInterface for the given prompt name in the PromptGroup held by the PromptValuesInterface.
 java.util.List getPromptDefinitionCombinations(PromptDefinitionInterface promptDefinition)
          Returns a List of PromptDefinitionInterfaces which are combined with the specified prompt.
 PromptGroupInterface getPromptGroup()
          Returns the PromptGroupInterface that this is attached to.
 java.lang.Object getPromptValue(PromptDefinitionInterface promptDefinition)
          Returns the current value of the prompt.
 java.util.Date getPromptValueAsDate(PromptDefinitionInterface promptDefinition)
          Returns the current value of the specified prompt definition.
 double getPromptValueAsDouble(PromptDefinitionInterface promptDefinition)
          Returns the current value of the specified prompt definition.
 int getPromptValueAsInt(PromptDefinitionInterface promptDefinition)
          Returns the current value of the specified prompt definition.
 java.util.List getPromptValueAsList(PromptDefinitionInterface promptDefinition)
          Returns the current value of the specified prompt definition.
 java.lang.String getPromptValueAsString(PromptDefinitionInterface promptDefinition)
          Returns the current value of the specified prompt definition.
 java.lang.String getPromptValueAsString(PromptDefinitionInterface promptDefinition, java.util.Locale locale)
          Returns the specified prompt value as a string formatted in the specified locale.
 PromptValueChangeListener[] getPromptValueChangeListeners()
          Returns an array of all the PromptValueChangeListeners added to this PromptValues with addPromptValuesChangeListener().
 java.util.Map getPromptValues()
          Returns the values of all prompts stored in this PromptValueInterface.
 java.util.Map getPromptValues(PromptGroupInterface promptGroup, boolean recursive, boolean includeDefaultAndStickyValues)
          Returns the values for the specified prompt definition group, possibly recursing into subgroups.
 java.util.List getPromptValuesDelegates()
          Returns a list of delegates for the PromptValues.
 void init(java.util.Map options)
          When called, this method will check all the definitions that have a value provider that implement the ValueProviderInitializationInterface and will call initialize method on each value provider with the options passed in.
 boolean isAllPromptValuesValid()
          Returns whether all the prompts contain valid values.
 boolean isAllRequiredPromptsValid()
          Returns true if all the required prompts contain a value and the value is valid, false otherwise
 boolean isPromptValueAvailable(PromptDefinitionInterface promptDefinition)
          Returns true is the prompt has either a value set, a sticky value or a default value, false otherwise.
 boolean isPromptValueSet(PromptDefinitionInterface promptDefinition)
          Returns whether the prompt value is actually set.
 boolean isPromptValueValid(PromptDefinitionInterface promptDefinition)
          Returns whether the prompt value is currently valid or not.
 void removePromptValueChangeListener(PromptValueChangeListener listener)
          Removes a listener from monitoring prompt value changes.
 void removePromptValuesDelegate(PromptValuesInterface promptValues)
          Removes a PromptValues delegate previously added with addPromptValuesDelegate.
 void setInitParameter(java.lang.String key, java.lang.Object value)
          When called, this method will check all the definitions that have a value provider that implement the ValueProviderInitializationInterface and will call initialize method on each value provider with the key-value pair passed in.
 void setPromptGroup(PromptGroupInterface promptGroup, boolean clearValuesNotInGroup)
          Sets the PromptGroupInterface that this PromptValues is attached to.
 void setPromptValue(PromptDefinitionInterface promptDefinition, java.util.Date value)
          Sets the current value of the PromptDefinitionInterface to the specified Date.
 void setPromptValue(PromptDefinitionInterface promptDefinition, double value)
          Sets the current value of the PromptDefinitionInterface to the specified int.
 void setPromptValue(PromptDefinitionInterface promptDefinition, java.util.List value)
          Sets the current value of the PromptDefinitionInterface to the specified List.
 void setPromptValue(PromptDefinitionInterface promptDefinition, java.lang.Object value)
          Sets the current value of the prompt.
 void setPromptValue(PromptDefinitionInterface promptDefinition, java.lang.Object value, java.util.Locale inputLocale)
          Sets the current value of the PromptDefinitionInterface.
 void setPromptValue(PromptDefinitionInterface promptDefinition, java.lang.String value)
          Sets the current value of the PromptDefinitionInterface to the specified String.
 void setPromptValues(java.util.Map definitionToValueMap, java.util.Locale inputLocale)
          Sets one or more of prompt values at the same time.
 

Method Detail

init

void init(java.util.Map options)
When called, this method will check all the definitions that have a value provider that implement the ValueProviderInitializationInterface and will call initialize method on each value provider with the options passed in.

Parameters:
options - Map a map of options, see the ValueProviderInitializationInterface for more details

setInitParameter

void setInitParameter(java.lang.String key,
                      java.lang.Object value)
When called, this method will check all the definitions that have a value provider that implement the ValueProviderInitializationInterface and will call initialize method on each value provider with the key-value pair passed in. The key-value pairs are not held onto, so if this method is called more then once, the initialize method on the value providers will only get passed the current key-value pair, so if more then one param is needed, either use the init(Map) method or the value provider needs to handle initialize being called more then once.

Parameters:
key -
value -

getPromptValue

java.lang.Object getPromptValue(PromptDefinitionInterface promptDefinition)
                                throws PromptValueNotFoundException
Returns the current value of the prompt. If no value is set, a default from the sticky defaults or the PromptDefinitionInterface will be returned if available.

Parameters:
promptDefinition - The prompt definition to return the value for
Returns:
The current value of the prompt
Throws:
PromptValueNotFoundException

getPromptValueAsDate

java.util.Date getPromptValueAsDate(PromptDefinitionInterface promptDefinition)
                                    throws PromptValueNotFoundException
Returns the current value of the specified prompt definition. If no value is set, a default from the sticky defaults or the PromptDefinitionInterface will be returned if available. The returned value will be cast to a Date. If the value is not a Date, a ClassCastException will be thrown.

Parameters:
promptDefinition - The prompt definition to return the value for
Returns:
The current value of the prompt
Throws:
PromptValueNotFoundException

getPromptValueAsDouble

double getPromptValueAsDouble(PromptDefinitionInterface promptDefinition)
                              throws PromptValueNotFoundException
Returns the current value of the specified prompt definition. If no value is set, a default from the sticky defaults or the PromptDefinitionInterface will be returned if available. The returned value will be cast to a Double and then converted to a double. If the value is not a Double, a ClassCastException will be thrown.

Parameters:
promptDefinition - The prompt definition to return the value for
Returns:
The current value of the prompt
Throws:
PromptValueNotFoundException

getPromptValueAsInt

int getPromptValueAsInt(PromptDefinitionInterface promptDefinition)
                        throws PromptValueNotFoundException
Returns the current value of the specified prompt definition. If no value is set, a default from the sticky defaults or the PromptDefinitionInterface will be returned if available. The returned value will be cast to an Integer and then converted to an int. If the value is not an Integer, a ClassCastException will be thrown.

Parameters:
promptDefinition - The prompt definition to return the value for
Returns:
The current value of the prompt
Throws:
PromptValueNotFoundException

getPromptValueAsList

java.util.List getPromptValueAsList(PromptDefinitionInterface promptDefinition)
                                    throws PromptValueNotFoundException
Returns the current value of the specified prompt definition. If no value is set, a default from the sticky defaults or the PromptDefinitionInterface will be returned if available. If the value is a List, it will be returned directly. If it is not a List, a List will be created and the value will be added to the List before the list is returned.

Parameters:
promptDefinition - The prompt definition to return the value for
Returns:
The current value of the prompt
Throws:
PromptValueNotFoundException

getPromptValueAsString

java.lang.String getPromptValueAsString(PromptDefinitionInterface promptDefinition)
                                        throws PromptValueNotFoundException
Returns the current value of the specified prompt definition. If no value is set, a default from the sticky defaults or the PromptDefinitionInterface will be returned if available. The returned value will be cast to a String. If the value is not a String, a ClassCastException will be thrown.

Parameters:
promptDefinition - The prompt definition to return the value for
Returns:
The current value of the prompt
Throws:
PromptValueNotFoundException

setPromptValue

void setPromptValue(PromptDefinitionInterface promptDefinition,
                    java.lang.Object value)
                    throws InvalidPromptValueException
Sets the current value of the prompt.

Parameters:
promptDefinition - The prompt definition to set the value of
value - The new value of the prompt.
Throws:
InvalidPromptValueException

setPromptValue

void setPromptValue(PromptDefinitionInterface promptDefinition,
                    double value)
                    throws InvalidPromptValueException
Sets the current value of the PromptDefinitionInterface to the specified int.

Parameters:
promptDefinition - The prompt definition to set the value of
value - The new value of the prompt.
promptDefinition - The prompt definition to set the value of
value - The new value of the prompt.
Throws:
InvalidPromptValueException - public void setPromptValue( PromptDefinitionInterface promptDefinition, int value ) throws InvalidPromptValueException; /** Sets the current value of the PromptDefinitionInterface to the specified double.
InvalidPromptValueException

setPromptValue

void setPromptValue(PromptDefinitionInterface promptDefinition,
                    java.util.Date value)
                    throws InvalidPromptValueException
Sets the current value of the PromptDefinitionInterface to the specified Date.

Parameters:
promptDefinition - The prompt definition to set the value of
value - The new value of the prompt.
Throws:
InvalidPromptValueException

setPromptValue

void setPromptValue(PromptDefinitionInterface promptDefinition,
                    java.util.List value)
                    throws InvalidPromptValueException
Sets the current value of the PromptDefinitionInterface to the specified List.

Parameters:
promptDefinition - The prompt definition to set the value of
value - The new value of the prompt.
Throws:
InvalidPromptValueException

setPromptValue

void setPromptValue(PromptDefinitionInterface promptDefinition,
                    java.lang.String value)
                    throws InvalidPromptValueException
Sets the current value of the PromptDefinitionInterface to the specified String.

Parameters:
promptDefinition - The prompt definition to set the value of
value - The new value of the prompt.
Throws:
InvalidPromptValueException

setPromptValue

void setPromptValue(PromptDefinitionInterface promptDefinition,
                    java.lang.Object value,
                    java.util.Locale inputLocale)
                    throws InvalidPromptValueException
Sets the current value of the PromptDefinitionInterface.

Parameters:
promptDefinition - The prompt definition to set the value of
value - The new value of the prompt.
inputLocale - The locale that the value was entered in
Throws:
InvalidPromptValueException

setPromptValues

void setPromptValues(java.util.Map definitionToValueMap,
                     java.util.Locale inputLocale)
                     throws InvalidPromptValueException
Sets one or more of prompt values at the same time.

Parameters:
definitionToValueMap - A Map containing the names and values of the prompts to set the value of.
inputLocale - The locale that the values were entered in.
Throws:
InvalidPromptValueException

getPromptValueAsString

java.lang.String getPromptValueAsString(PromptDefinitionInterface promptDefinition,
                                        java.util.Locale locale)
                                        throws PromptValueNotFoundException
Returns the specified prompt value as a string formatted in the specified locale.

Parameters:
promptDefinition - The prompt to return the value of
locale - Locale The locale to format the value for
Returns:
the specified prompt value as a string formatted in the specified locale.
Throws:
PromptValueNotFoundException

isPromptValueSet

boolean isPromptValueSet(PromptDefinitionInterface promptDefinition)
Returns whether the prompt value is actually set. This is useful since getPromptValue may return a default even though no value is set.

Parameters:
promptDefinition - PromptDefinitionInterface
Returns:
whether the prompt value is actually set

isPromptValueAvailable

boolean isPromptValueAvailable(PromptDefinitionInterface promptDefinition)
Returns true is the prompt has either a value set, a sticky value or a default value, false otherwise.

Parameters:
promptDefinition - The prompt to query whether its value is available
Returns:
true is a value is availabel, false otherwise

clearPromptValue

void clearPromptValue(PromptDefinitionInterface promptDefinition)
Clears the prompt value such that isPromptValueSet returns false. getPromptValue may still return a value due to sticky defaults or a default value set in the prompt definition.

Parameters:
promptDefinition - The prompt to clear the value of

isPromptValueValid

boolean isPromptValueValid(PromptDefinitionInterface promptDefinition)
Returns whether the prompt value is currently valid or not.

Parameters:
promptDefinition - The prompt to determine if the value is valid
Returns:
whether the prompt value is currently valid or not.

isAllPromptValuesValid

boolean isAllPromptValuesValid()
Returns whether all the prompts contain valid values.

Returns:
whether all the prompts contain valid values.

isAllRequiredPromptsValid

boolean isAllRequiredPromptsValid()
Returns true if all the required prompts contain a value and the value is valid, false otherwise

Returns:
true is the required prompt are valid

getPromptValues

java.util.Map getPromptValues(PromptGroupInterface promptGroup,
                              boolean recursive,
                              boolean includeDefaultAndStickyValues)
Returns the values for the specified prompt definition group, possibly recursing into subgroups. Only values associated with the prompts defined in the group will be included in the resulting Map.

Parameters:
promptGroup - The group to get values for
recursive - Whether to return values from subgroups of the group passed in
includeDefaultAndStickyValues - Whether to result default and sticky value or just values that have been set
Returns:
A Map of PromptDefinitionInterfaces to objects which represent the current values of the prompts

getPromptValues

java.util.Map getPromptValues()
Returns the values of all prompts stored in this PromptValueInterface. TODO: Do we need a parameter like includeDefaultAndStickyValues?

Returns:
the values of all prompts stored in this PromptValueInterface.

getPromptGroup

PromptGroupInterface getPromptGroup()
Returns the PromptGroupInterface that this is attached to.

Returns:
The PromptGroupInterface that the prompt values are for

setPromptGroup

void setPromptGroup(PromptGroupInterface promptGroup,
                    boolean clearValuesNotInGroup)
Sets the PromptGroupInterface that this PromptValues is attached to. Optionally, setPromptGroup will clear any prompt values which have already been set on the PromptValues but are not in the group passed in.

Parameters:
promptGroup - The PromptGroupInterface that the prompt values are for
clearValuesNotInGroup - Whether to clear values not in the group set on the PromptValues

addPromptValueChangeListener

void addPromptValueChangeListener(PromptValueChangeListener listener)
Adds a listener so that changes to prompt values can be monitored. Events should be sent when values are changed or cleared. Notifications are not sent for implicit changes to values by changing defaults or sticky values. TODO: Can a listener be added more than once?

Parameters:
The - listener to call when a value change occurs

removePromptValueChangeListener

void removePromptValueChangeListener(PromptValueChangeListener listener)
Removes a listener from monitoring prompt value changes. If the listener is not registered, no action is taken.

Parameters:
The - listener to stop calling when a value change occurs

getPromptValueChangeListeners

PromptValueChangeListener[] getPromptValueChangeListeners()
Returns an array of all the PromptValueChangeListeners added to this PromptValues with addPromptValuesChangeListener().

Returns:
all of the PromptValueChangeListeners added or an empty array if no listeners have been added

getPromptDefinition

PromptDefinitionInterface getPromptDefinition(java.lang.String promptName,
                                              boolean recursive)
Returns the PromptDefinitionInterface for the given prompt name in the PromptGroup held by the PromptValuesInterface. Note that only the first prompt found with the given name will be returned. The prompt model does not require that prompt names be unique, so there may be any number of prompts with the same name.

Parameters:
promptName - The name of the prompt to search for
recursive - Whether to search in subgroups of the main prompt group
Returns:
PromptDefinitionInterface

clearPromptValuesDelegates

void clearPromptValuesDelegates()
Removes all previously added delegates.


addPromptValuesDelegate

void addPromptValuesDelegate(PromptValuesInterface promptValues)
Adds another PromptValues object as a delegate of this PromptValues object. Values for PromptDefinitions of the delegate can be set/retrieved on the base or delegate PromptValues object. This allows for chaining and grouping of prompts from different sources while keeping their values stored in separate PromptValuesInterface implementations.

Parameters:
promptValues - The delegate to add

removePromptValuesDelegate

void removePromptValuesDelegate(PromptValuesInterface promptValues)
Removes a PromptValues delegate previously added with addPromptValuesDelegate.

Parameters:
promptValues - The delegate to remove

getPromptValuesDelegates

java.util.List getPromptValuesDelegates()
Returns a list of delegates for the PromptValues. null or an empty list will be returned if there are no delegates.

Returns:
a list of delegates for the PromptValues.

findPromptValuesForPromptDefinition

PromptValuesInterface findPromptValuesForPromptDefinition(PromptDefinitionInterface promptDefinition)
Recursively finds the first PromptValues object which holds the PromptGroup which contains the specified PromptDefinition. The returned PromptValues will either be the PromptValues this method is called on, a delegate, a descendent to a delegate, or null.

Parameters:
promptDefinition - The PromptDefinitionInterface to find the PromptValues for.
Returns:
the first PromptValues object which holds the PromptGroup which contains the specified prompt

acceptPromptValuesVisitor

void acceptPromptValuesVisitor(PromptValuesVisitorInterface visitor)
Accept method for visitor object (see visitor pattern) which passes the visitor on to any delegate PromptValues objects.

Parameters:
visitor - The visitor to call for each delegate

getMutableUserInfo

com.sas.util.MutableUserInfoInterface getMutableUserInfo()
Returns a user info object which can be read and/or modified.

Returns:
a user info object which can be read and/or modified.

getPromptDefinitionCombinations

java.util.List getPromptDefinitionCombinations(PromptDefinitionInterface promptDefinition)
Returns a List of PromptDefinitionInterfaces which are combined with the specified prompt.

Parameters:
promptDefinition - The prompt to return combinations for
Returns:
a List of PromptDefinitionInterfaces which are combined with the specified PromptDefinitionInterface.



Copyright © 2009 SAS Institute Inc. All Rights Reserved.