org.kuali.rice.krad.datadictionary.state
Class StateMappingBase

java.lang.Object
  extended by org.kuali.rice.krad.datadictionary.state.StateMappingBase
All Implemented Interfaces:
StateMapping

public class StateMappingBase
extends Object
implements StateMapping

Base implementation of StateMapping.

Since:
2.2
Author:
Kuali Rice Team (rice.collab@kuali.org)
See Also:
StateMapping

Constructor Summary
StateMappingBase()
           
 
Method Summary
 void completeValidation(ValidationTrace tracer)
          Validates different requirements of component compiling a series of reports detailing information on errors found in the component.
 String getCurrentState(Object object)
          Gets the currentState by looking at the statePropertyName on the stateObject passed in
 Map<String,String> getCustomClientSideValidationStates()
          This ONLY applies to client side validations as the controller has full control over what validations to apply on the server.
 String getNextState(Object object)
          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.
 String getStateNameMessage(String state)
          Returns the human readable message determined by the key set for the state passed in against the stateNameMessageKeyMap.
 Map<String,String> getStateNameMessageKeyMap()
          Map used by getStateNameMessage to determine the key to use when retrieving the message for the state specified.
 String getStatePropertyName()
          The property name/path to be used when trying to find state String information on the object.
 List<String> getStates()
          The states of this stateMapping.
 void setCustomClientSideValidationStates(Map<String,String> customClientSideValidationStates)
          Set the custom client side validation behavior map.
 void setStateNameMessageKeyMap(Map<String,String> stateNameMessageKeyMap)
          Set the stateNameMessageKeyMap
 void setStatePropertyName(String statePropertyName)
          Set the property name/path
 void setStates(List<String> states)
          Set the states of this stateMapping, in order
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StateMappingBase

public StateMappingBase()
Method Detail

getStateNameMessage

public String getStateNameMessage(String state)
Description copied from interface: StateMapping
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.

Specified by:
getStateNameMessage in interface StateMapping
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.
See Also:
StateMapping.getStateNameMessage(String)

getCurrentState

public String getCurrentState(Object object)
Description copied from interface: StateMapping
Gets the currentState by looking at the statePropertyName on the stateObject passed in

Specified by:
getCurrentState in interface StateMapping
Parameters:
object - the object containing the state information
Returns:
the currentState of the object
See Also:
StateMapping.getCurrentState(Object object)

getNextState

public String getNextState(Object object)
Description copied from interface: StateMapping
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.

Specified by:
getNextState in interface StateMapping
Parameters:
object - the object containing the state information
Returns:
the next state of the object, or current state if no next state exists
See Also:
StateMapping.getNextState(Object)

getStateNameMessageKeyMap

public Map<String,String> getStateNameMessageKeyMap()
Description copied from interface: StateMapping
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.

Specified by:
getStateNameMessageKeyMap in interface StateMapping
Returns:
map of states and their messageKeys
See Also:
StateMapping.getStateNameMessageKeyMap()

setStateNameMessageKeyMap

public void setStateNameMessageKeyMap(Map<String,String> stateNameMessageKeyMap)
Description copied from interface: StateMapping
Set the stateNameMessageKeyMap

Specified by:
setStateNameMessageKeyMap in interface StateMapping
Parameters:
stateNameMessageKeyMap - map of states and their messageKeys
See Also:
StateMapping.setStateNameMessageKeyMap(java.util.Map)

getStates

public List<String> getStates()
Description copied from interface: StateMapping
The states of this stateMapping. IMPORTANT: This must be ALL states for this mapping IN ORDER.

Specified by:
getStates in interface StateMapping
Returns:
list of states, in the order in which they are applied. If states were never set, returns an empty list.
See Also:
StateMapping.getStates()

setStates

public void setStates(List<String> states)
Description copied from interface: StateMapping
Set the states of this stateMapping, in order

Specified by:
setStates in interface StateMapping
Parameters:
states - list of states, in the order in which they are applied.
See Also:
StateMapping.setStates(java.util.List)

getStatePropertyName

public String getStatePropertyName()
Description copied from interface: StateMapping
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);

Specified by:
getStatePropertyName in interface StateMapping
Returns:
the property name/path representing where state information can be found on the object
See Also:
StateMapping.getStatePropertyName()

setStatePropertyName

public void setStatePropertyName(String statePropertyName)
Description copied from interface: StateMapping
Set the property name/path

Specified by:
setStatePropertyName in interface StateMapping
Parameters:
statePropertyName - the property name/path that points to the string representation of the object's tate
See Also:
StateMapping.setStatePropertyName(String)

getCustomClientSideValidationStates

public Map<String,String> getCustomClientSideValidationStates()
Description copied from interface: StateMapping
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

Specified by:
getCustomClientSideValidationStates in interface StateMapping
Returns:
map representing the state of the object and state to use for validation on the client when in that state
See Also:
StateMapping.getCustomClientSideValidationStates()

setCustomClientSideValidationStates

public void setCustomClientSideValidationStates(Map<String,String> customClientSideValidationStates)
Description copied from interface: StateMapping
Set the custom client side validation behavior map. This only applies for client-side validation.

Specified by:
setCustomClientSideValidationStates in interface StateMapping
Parameters:
customClientSideValidationStates - map representing the state of the object and state to use for validation on the client when in that state
See Also:
StateMapping.setCustomClientSideValidationStates(java.util.Map)

completeValidation

public void completeValidation(ValidationTrace tracer)
Description copied from interface: StateMapping
Validates different requirements of component compiling a series of reports detailing information on errors found in the component. Used by the RiceDictionaryValidator.

Specified by:
completeValidation in interface StateMapping
Parameters:
tracer - Record of component's location
See Also:
StateMapping.completeValidation(org.kuali.rice.krad.datadictionary.validator.ValidationTrace)


Copyright © 2005–2014 The Kuali Foundation. All rights reserved.