Package de.xima.fc.form.common.models
Class XValidationParams
- java.lang.Object
-
- de.xima.fc.form.common.models.XValidationParams
-
- All Implemented Interfaces:
IXBaseValidationParams,IXValidationParams,Serializable
public class XValidationParams extends Object implements IXValidationParams
Simple POJO implementation ofIXValidationParams.- Author:
- XIMA MEDIA GmbH
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description XValidationParams(List<String[]> values, Map<String,List<String[]>> valuesMap, int ordinalIndex, Map<String,? extends IFormContainerMetaData> dynContainerMap, IXItemPropertiesData xItemPropertiesData, IXFormRenderConfig formRenderConfig, Map<Serializable,Serializable> frqSessionAttributes, long clientId, boolean shouldValidate, boolean serverValidationRequiredBySubmitAction, boolean serverValidationEnabledForElement, boolean itemAvailable, boolean itemEditable)Creates a new params object with the given data.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description longgetClientId()Map<String,? extends IFormContainerMetaData>getDynContainerMap()String[]getElementValues()Map<String,List<String[]>>getFieldValuesMap()IXFormRenderConfiggetFormRenderConfig()Map<Serializable,Serializable>getFRQSessionAttributes()StringgetI18nValue(String i18nKey)intgetOrdinalIndex()intgetRepetitionIndex()List<String[]>getValues()List<String[]>getValues(String key)IXItemPropertiesDatagetXItemPropertiesData()booleanisItemAvailable()Gets whether the element is available, i.e. neither hidden due to a hidden-if condition and not unavailable due to a state or user group restriction.booleanisItemEditable()Gets whether the item is editable, i.e. neither read-only due to a read-only-if condition and not read-only due to a state or user group restriction.booleanisServerValidationEnabledForElement()Gets whether server-side validation is enabled for the element.booleanisServerValidationRequiredBySubmitAction()Gets whether the submit buttons that was used to submit the form requires server-side validation.booleanisShouldValidate()Whether server-side validation should be performed.booleanisValuesEmpty(List<String[]> values)-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface de.xima.fc.form.common.models.IXBaseValidationParams
getClientId, getDynContainerMap, getFieldValuesMap, getFormRenderConfig, getFRQSessionAttributes, getI18nValue, getLocale, getValues, isServerValidationRequiredBySubmitAction, isValuesEmpty
-
Methods inherited from interface de.xima.fc.form.common.models.IXValidationParams
isShouldValidate
-
-
-
-
Constructor Detail
-
XValidationParams
public XValidationParams(List<String[]> values, Map<String,List<String[]>> valuesMap, int ordinalIndex, Map<String,? extends IFormContainerMetaData> dynContainerMap, IXItemPropertiesData xItemPropertiesData, IXFormRenderConfig formRenderConfig, Map<Serializable,Serializable> frqSessionAttributes, long clientId, boolean shouldValidate, boolean serverValidationRequiredBySubmitAction, boolean serverValidationEnabledForElement, boolean itemAvailable, boolean itemEditable)
Creates a new params object with the given data.- Parameters:
values- The value forIXValidationParams.getValues().valuesMap- The value forIXBaseValidationParams.getFieldValuesMap().ordinalIndex- The 0-based ordinal index of the element repetition.dynContainerMap- The value forIXBaseValidationParams.getDynContainerMap().xItemPropertiesData- The value forIXValidationParams.getXItemPropertiesData().formRenderConfig- The value forIXBaseValidationParams.getFormRenderConfig().frqSessionAttributes- The value forIXBaseValidationParams.getFRQSessionAttributes().clientId- The value forIXBaseValidationParams.getClientId().shouldValidate- The value forIXValidationParams.isShouldValidate().serverValidationRequiredBySubmitAction- The value forIXBaseValidationParams.isServerValidationRequiredBySubmitAction().serverValidationEnabledForElement- The value forIXValidationParams.isServerValidationEnabledForElement().itemAvailable- The value forIXValidationParams.isItemAvailable().itemEditable- The value forIXValidationParams.isItemEditable().- Since:
- 8.5.6
-
-
Method Detail
-
getValues
public List<String[]> getValues()
- Specified by:
getValuesin interfaceIXValidationParams- Returns:
- The values that were submitted for this form item.
-
getXItemPropertiesData
public IXItemPropertiesData getXItemPropertiesData()
- Specified by:
getXItemPropertiesDatain interfaceIXValidationParams- Returns:
- A wrapper object for accessing the properties (
XPropertyEnum) of the form item to validate.
-
isItemAvailable
public boolean isItemAvailable()
Description copied from interface:IXValidationParamsGets whether the element is available, i.e. neither hidden due to a hidden-if condition and not unavailable due to a state or user group restriction.- Specified by:
isItemAvailablein interfaceIXValidationParams- Returns:
- true if the item is available, false otherwise.
-
isItemEditable
public boolean isItemEditable()
Description copied from interface:IXValidationParamsGets whether the item is editable, i.e. neither read-only due to a read-only-if condition and not read-only due to a state or user group restriction.- Specified by:
isItemEditablein interfaceIXValidationParams- Returns:
- true if the item is editable, false otherwise.
-
isServerValidationEnabledForElement
public boolean isServerValidationEnabledForElement()
Description copied from interface:IXValidationParamsGets whether server-side validation is enabled for the element. Server-side validation can be enabled and disabled in the form designer for each element.- Specified by:
isServerValidationEnabledForElementin interfaceIXValidationParams- Returns:
- true if server-side validation is enabled for the element, false otherwise.
-
getElementValues
public String[] getElementValues()
- Specified by:
getElementValuesin interfaceIXValidationParams- Returns:
- The values that were submitted for this form item, for the current
IXValidationParams.getRepetitionIndex(). When not a repeated element, this returns the values for the element.
-
getRepetitionIndex
public int getRepetitionIndex()
- Specified by:
getRepetitionIndexin interfaceIXValidationParams- Returns:
- When the form field is a repeated element: the repetition index (which may neither start at 0 nor is it
necessarily continuous) of the current repetition. When not a repeated element, this returns
-1.
-
getOrdinalIndex
public int getOrdinalIndex()
- Specified by:
getOrdinalIndexin interfaceIXValidationParams- Returns:
- When the form field is a repeated element: the 0-based oridnal index of the current repetition. When not
a repeated element, this returns
-1.
-
getI18nValue
public String getI18nValue(String i18nKey)
- Specified by:
getI18nValuein interfaceIXBaseValidationParams- Parameters:
i18nKey- I18n key for the localized message.- Returns:
- The localized message for the given key, retrieved from the built-in resource bundle. Plugin resource bundles are not considered.
-
getClientId
public long getClientId()
- Specified by:
getClientIdin interfaceIXBaseValidationParams- Returns:
- The ID of the current client to which the form belongs.
-
getFieldValuesMap
public Map<String,List<String[]>> getFieldValuesMap()
- Specified by:
getFieldValuesMapin interfaceIXBaseValidationParams- Returns:
- A map with all values that were submitted. The key is the name of a form field.
-
getFormRenderConfig
public IXFormRenderConfig getFormRenderConfig()
- Specified by:
getFormRenderConfigin interfaceIXBaseValidationParams- Returns:
- The current form render config for accessing the global configuration of the validation process.
-
getValues
public List<String[]> getValues(String key)
- Specified by:
getValuesin interfaceIXBaseValidationParams- Parameters:
key- Name of a form field.- Returns:
- All values that were submitted for the given for the given form field name. The list contains multiple
items when the form field is repeated; the array contains multiple items when the form field submitted
multiple values (e.g. a select element with
multipleset).
-
getFRQSessionAttributes
public Map<Serializable,Serializable> getFRQSessionAttributes()
- Specified by:
getFRQSessionAttributesin interfaceIXBaseValidationParams- Returns:
- All attributes from the current form request session.
-
isValuesEmpty
public boolean isValuesEmpty(List<String[]> values)
- Specified by:
isValuesEmptyin interfaceIXBaseValidationParams- Parameters:
values- List of values of a form field.- Returns:
trueif the values are all empty, orfalseotherwise.
-
getDynContainerMap
public Map<String,? extends IFormContainerMetaData> getDynContainerMap()
- Specified by:
getDynContainerMapin interfaceIXBaseValidationParams- Returns:
- A map with the meta data for repeated elements. The key is the name of a form field.
-
isShouldValidate
public boolean isShouldValidate()
Description copied from interface:IXBaseValidationParamsWhether server-side validation should be performed. Server-validation may be disabled due to one of several reasons.For the form in general:
- The form action does not require validation. When designing a form, the user can choose whether the form
should be validated when a submit button is pressed. This returns
truewhen a submit button was pressed that requires the form to be validated, andfalse.
- Server validation is disabled for the form element in the form designer.
- The element is not rendered due to a state or user group condition.
- The element is disabled due to a state or user group condition.
- The element is hidden, e.g. due to a hidden-if condition.
false. However, there are some use cases when validation needs to be performed no matter the circumstances. In that case, this flag may be ignored.- Specified by:
isShouldValidatein interfaceIXBaseValidationParams- Returns:
- Whether the form element should be validated.
- The form action does not require validation. When designing a form, the user can choose whether the form
should be validated when a submit button is pressed. This returns
-
isServerValidationRequiredBySubmitAction
public boolean isServerValidationRequiredBySubmitAction()
Description copied from interface:IXBaseValidationParamsGets whether the submit buttons that was used to submit the form requires server-side validation. For example, the submit button actionsubmit+checkrequires validation, the actionsubmitdoes not.- Specified by:
isServerValidationRequiredBySubmitActionin interfaceIXBaseValidationParams- Returns:
- true if the submit button action requires server-side validation, false otherwise.
-
-