Package de.xima.fc.workflow.taglib.data
Class JsfValidationResult
- java.lang.Object
-
- de.xima.fc.workflow.taglib.data.JsfValidationResult
-
- All Implemented Interfaces:
Serializable
public class JsfValidationResult extends Object implements Serializable
Represents the result of a JSF validation phase. Contains all generated messages and whether validation failed or was passed. This can be used, for example, to restore error messages and validation results later.- Since:
- 7.0.0
- Author:
- XIMA MEDIA GmbH
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description JsfValidationResult(boolean validationFailed, Map<String,List<javax.faces.application.FacesMessage>> messages, Map<String,Boolean> validState, javax.faces.application.FacesMessage.Severity maximumSeverity)
Creates a new POJO with the given values.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static JsfValidationResult
empty()
javax.faces.application.FacesMessage.Severity
getMaximumSeverity()
com.google.common.collect.ImmutableMap<String,List<javax.faces.application.FacesMessage>>
getMessages()
com.google.common.collect.ImmutableMap<String,Boolean>
getValidState()
boolean
isValidationFailed()
JsfValidationResult
merge(JsfValidationResult other)
-
-
-
Constructor Detail
-
JsfValidationResult
public JsfValidationResult(boolean validationFailed, Map<String,List<javax.faces.application.FacesMessage>> messages, Map<String,Boolean> validState, javax.faces.application.FacesMessage.Severity maximumSeverity)
Creates a new POJO with the given values.- Parameters:
validationFailed
- The value that will be returned byisValidationFailed()
.messages
- The value that will be returned bygetMessages()
.validState
- The value that will be returned bygetValidState()
.maximumSeverity
- The value that will be returned bygetMaximumSeverity()
.
-
-
Method Detail
-
getMaximumSeverity
@Nullable public javax.faces.application.FacesMessage.Severity getMaximumSeverity()
- Returns:
- The maximum
FacesMessage.getSeverity()
of allgetMessages()
. Will benull
when there are no messages.
-
getMessages
public com.google.common.collect.ImmutableMap<String,List<javax.faces.application.FacesMessage>> getMessages()
- Returns:
- A map between the client ID of each
UIInput
and theFacesMessage
s that were added to it.
-
getValidState
public com.google.common.collect.ImmutableMap<String,Boolean> getValidState()
- Returns:
- A map between the client ID of each
UIInput
and itsEditableValueHolder.isValid()
value.
-
isValidationFailed
public boolean isValidationFailed()
- Returns:
- Whether validation failed, i.e. whether the is at least one
EditableValueHolder.isValid()
set tofalse
.
-
empty
public static JsfValidationResult empty()
- Returns:
- A validation result that is valid and has no messages.
-
merge
public JsfValidationResult merge(JsfValidationResult other)
- Parameters:
other
- Another result to merge.- Returns:
- A new result with the given result merged into it. The valid state and the messages of the given result
override the valid state and messages of this result. The maximum severity is calculated as the maximum of this
result and the given result. The new result has
isValidationFailed()
marked astrue
if it is set to true for either result.
-
-