Interface StateMapping
- All Known Implementing Classes:
StateMappingBase
public interface StateMapping
StateMapping defines the methods necessary to allow for state validation to apply to a state object
- Since:
- 2.2
- Author:
- Kuali Rice Team (rice.collab@kuali.org)
-
Method Summary
Modifier and TypeMethodDescriptionvoidcompleteValidation(ValidationTrace tracer) Validates different requirements of component compiling a series of reports detailing information on errors found in the component.getCurrentState(Object stateObject) Gets the currentState by looking at the statePropertyName on the stateObject passed inThis ONLY applies to client side validations as the controller has full control over what validations to apply on the server.getNextState(Object stateObject) Gets the nextState of the object passed in by looking at the statePropertyName and using the states list to determine the next state in order.getStateNameMessage(String state) Returns the human readable message determined by the key set for the state passed in against the stateNameMessageKeyMap.Map used by getStateNameMessage to determine the key to use when retrieving the message for the state specified.The property name/path to be used when trying to find state String information on the object.The states of this stateMapping.voidsetCustomClientSideValidationStates(Map<String, String> customClientSideValidationStates) Set the custom client side validation behavior map.voidsetStateNameMessageKeyMap(Map<String, String> stateNameMessageKeyMap) Set the stateNameMessageKeyMapvoidsetStatePropertyName(String name) Set the property name/pathvoidSet the states of this stateMapping, in order
-
Method Details
-
getCurrentState
Gets the currentState by looking at the statePropertyName on the stateObject passed in- Parameters:
stateObject- the object containing the state information- Returns:
- the currentState of the object
-
getNextState
Gets the nextState of the object passed in by looking at the statePropertyName and using the states list to determine the next state in order. Returns the currentState if there is no next state.- Parameters:
stateObject- the object containing the state information- Returns:
- the next state of the object, or current state if no next state exists
-
getStateNameMessage
Returns the human readable message determined by the key set for the state passed in against the stateNameMessageKeyMap. If the state cannot be found in the states list or the state passed in is blank, this method will return null. If the key found does not match a message, this method will return the state passed in.- Parameters:
state- state to get the message for- Returns:
- state message, or the state passed in (if a valid state in states). Otherwise, returns null.
-
getStateNameMessageKeyMap
Map used by getStateNameMessage to determine the key to use when retrieving the message for the state specified. The map should be defined as state:messageKeyForState.- Returns:
- map of states and their messageKeys
-
setStateNameMessageKeyMap
Set the stateNameMessageKeyMap- Parameters:
stateNameMessageKeyMap- map of states and their messageKeys
-
getStates
The states of this stateMapping. IMPORTANT: This must be ALL states for this mapping IN ORDER.- Returns:
- list of states, in the order in which they are applied. If states were never set, returns an empty list.
-
setStates
Set the states of this stateMapping, in order- Parameters:
states- list of states, in the order in which they are applied.
-
getStatePropertyName
String getStatePropertyName()The property name/path to be used when trying to find state String information on the object. This is used by getCurrentState(Object object) and getNextState(Object object);- Returns:
- the property name/path representing where state information can be found on the object
-
setStatePropertyName
Set the property name/path- Parameters:
name- the property name/path that points to the string representation of the object's tate
-
getCustomClientSideValidationStates
This ONLY applies to client side validations as the controller has full control over what validations to apply on the server. This setting determines for what states, if any, the client side validation needs to use for its validation instead of the default (by default if state validation is setup, the client side validation will use n+1 as its validation, ie whatever the NEXT state is).The map must be defined as such: (state of the object, state to use for validation on the client when in that state).
Example:
key="INITIAL" value="SUBMIT"
key="SAVE" value="SUBMIT"
In this example, when the object is in the "INITIAL" or the "SAVE" states, validation on the client will be against the "SUBMIT" state- Returns:
- map representing the state of the object and state to use for validation on the client when in that state
-
setCustomClientSideValidationStates
Set the custom client side validation behavior map. This only applies for client-side validation.- Parameters:
customClientSideValidationStates- map representing the state of the object and state to use for validation on the client when in that state
-
completeValidation
Validates different requirements of component compiling a series of reports detailing information on errors found in the component. Used by the RiceDictionaryValidator.- Parameters:
tracer- Record of component's location
-